Skip to content

pantoken-root / css-in-js

css-in-js ​

Compatibility ​

Target: Emotion CSS-in-JS. Current format: ThemeProvider SSR emits the Pantoken token variable. Minimum host version: 11.14.0. Tested through 11.14.0. Newer releases require review.

Full compatibility matrix

تجربی

@pantoken/css-in-js — یک شیء قالب (theme) Instructure برای کتابخانه‌های CSS-in-JS زمان اجرا.

با هر کتابخانه‌ای که قالب را از props.theme می‌خواند کار می‌کند — Emotion، styled-components و Stitches همه از این قرارداد پیروی می‌کنند. pantokenTheme شیٔ آماده rebrand است، که مبتنی بر var() است تا سوئیچ روشن/تاریک از طریق @pantoken/css جریان یابد. toStyledTheme یکی را از هر IR می‌سازد (و می‌تواند مقادیر صریح را با { resolve } ثابت کند).

نمونه ​

styled-components

tsx
import { ThemeProvider } from "styled-components";
import { pantokenTheme } from "@pantoken/css-in-js";
<ThemeProvider theme={pantokenTheme}>...</ThemeProvider>;
// const Btn = styled.button`background: ${({ theme }) => theme.colorBackgroundBrand};`;

رابط‌ها ​

نام‌های مستعار نوع ​

متغیرها ​

توابع ​

ارجاعات ​

Mode ​

دوباره Mode را صادر می‌کند


default ​

نام‌گذاری مجدد کرده و pantokenTheme را دوباره صادر می‌کند