@seanyeh77/tokens 0.43.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +32 -1
- package/dist/tokens.css +3 -0
- package/package.json +1 -1
- package/tokens.json +17 -16
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ SeanYeh 設計系統的設計 token:淺色、深色和 `teaching` 預設的 CS
|
|
|
8
8
|
npm i @seanyeh77/tokens
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
`@seanyeh77/ui` 依賴這個套件,安裝時會一起裝好;字體只放在這裡,`@seanyeh77/ui/fonts.css` 從這裡載入。要在自己的程式碼用 `cssVar()` 或 Tailwind 主題時,把它也列進專案的 dependencies(pnpm 只讓專案 import 自己列出的套件)。
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
import { cssVar } from '@seanyeh77/tokens';
|
|
@@ -22,6 +22,8 @@ const style = { color: cssVar('ink-muted') }; // 只有存在的 token 名稱能
|
|
|
22
22
|
@import '@seanyeh77/tokens/tailwind.css';
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
`tokens.css` 每個主題也設 `color-scheme`(淺色和 `teaching` 是 `light`、深色是 `dark`),原生捲軸和表單控制項跟著主題。`presets` 匯出每個 preset 的 `scheme` 與和淺色不同的值。
|
|
26
|
+
|
|
25
27
|
## 文件
|
|
26
28
|
|
|
27
29
|
- 文件網站:<https://seanyeh77.github.io/ui-design-system/>(全部 token 見 `theme.md`)
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,10 @@ export type MotionToken = 'dur-hover' | 'dur-menu' | 'dur-nav' | 'dur-tooltip' |
|
|
|
11
11
|
export type LayerToken = 'z-base' | 'z-raised' | 'z-sticky' | 'z-float' | 'z-header' | 'z-rail' | 'z-hint' | 'z-drawer' | 'z-modal' | 'z-palette' | 'z-tour' | 'z-popover' | 'z-tooltip';
|
|
12
12
|
export type Token = ColorToken | SpaceToken | RadiusToken | ShadowToken | SizeToken | FontToken | TextToken | MotionToken | LayerToken;
|
|
13
13
|
export type ThemeId = 'light' | 'dark' | 'teaching';
|
|
14
|
+
export type PresetId = 'teaching';
|
|
14
15
|
/** Light values; read the live value with getComputedStyle when the theme matters. */
|
|
15
16
|
export declare const tokens: Readonly<Record<Token, string>>;
|
|
17
|
+
/** Each preset: its color scheme (presets are light only) and the values that differ from light. */
|
|
18
|
+
export declare const presets: Readonly<Record<PresetId, { readonly scheme: 'light' | 'dark'; readonly values: Readonly<Partial<Record<Token, string>>> }>>;
|
|
16
19
|
/** `var(--name)` for inline styles: `style={{ color: cssVar('ink-muted') }}`. Only token names compile. */
|
|
17
20
|
export declare function cssVar(name: Token): string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Generated from tokens.json by scripts/build.ts. Do not edit by hand. */
|
|
2
|
-
export const tokens = Object.freeze({
|
|
2
|
+
export const tokens = /* @__PURE__ */ Object.freeze({
|
|
3
3
|
"bg": "#fcfbfb",
|
|
4
4
|
"surface": "#ffffff",
|
|
5
5
|
"surface-sub": "#f6f5f4",
|
|
@@ -150,4 +150,35 @@ export const tokens = Object.freeze({
|
|
|
150
150
|
"font-sans": "Inter, \"Noto Sans TC\", system-ui, sans-serif",
|
|
151
151
|
"font-mono": "\"Geist Mono\", \"Noto Sans TC\", ui-monospace, monospace"
|
|
152
152
|
});
|
|
153
|
+
export const presets = /* @__PURE__ */ Object.freeze({
|
|
154
|
+
"teaching": {
|
|
155
|
+
"scheme": "light",
|
|
156
|
+
"values": {
|
|
157
|
+
"bg": "#fcfbfb",
|
|
158
|
+
"surface": "#ffffff",
|
|
159
|
+
"surface-sub": "#f6f5f4",
|
|
160
|
+
"ink": "#171512",
|
|
161
|
+
"ink-muted": "#6d645a",
|
|
162
|
+
"line": "#e2dfdc",
|
|
163
|
+
"accent": "#027874",
|
|
164
|
+
"accent-hover": "#026a66",
|
|
165
|
+
"accent-press": "#025e5a",
|
|
166
|
+
"accent-text": "#027874",
|
|
167
|
+
"accent-soft": "#e1efee",
|
|
168
|
+
"on-accent": "#ffffff",
|
|
169
|
+
"focus": "#027874",
|
|
170
|
+
"focus-ring": "#027874",
|
|
171
|
+
"chart-1": "#027874",
|
|
172
|
+
"radius-xs": "0px",
|
|
173
|
+
"radius-sm": "0px",
|
|
174
|
+
"radius-chip": "0px",
|
|
175
|
+
"radius-md": "0px",
|
|
176
|
+
"radius-lg": "0px",
|
|
177
|
+
"shadow-sm": "none",
|
|
178
|
+
"shadow-chip": "none",
|
|
179
|
+
"shadow-card": "none",
|
|
180
|
+
"shadow-card-hover": "none"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
153
184
|
export function cssVar(name) { return 'var(--' + name + ')'; }
|
package/dist/tokens.css
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@layer ui.tokens, ui.components;
|
|
4
4
|
@layer ui.tokens {
|
|
5
5
|
:root {
|
|
6
|
+
color-scheme: light;
|
|
6
7
|
--bg: #fcfbfb;
|
|
7
8
|
--surface: #ffffff;
|
|
8
9
|
--surface-sub: #f6f5f4;
|
|
@@ -154,6 +155,7 @@
|
|
|
154
155
|
--font-mono: "Geist Mono", "Noto Sans TC", ui-monospace, monospace;
|
|
155
156
|
}
|
|
156
157
|
[data-theme="dark"] {
|
|
158
|
+
color-scheme: dark;
|
|
157
159
|
--bg: #2f2a25;
|
|
158
160
|
--surface: #393530;
|
|
159
161
|
--surface-sub: #443f3b;
|
|
@@ -213,6 +215,7 @@
|
|
|
213
215
|
--shadow-overlay: 0 20px 48px rgba(0, 0, 0, 0.5);
|
|
214
216
|
}
|
|
215
217
|
[data-theme="teaching"] {
|
|
218
|
+
color-scheme: light;
|
|
216
219
|
--accent: #027874;
|
|
217
220
|
--accent-hover: #026a66;
|
|
218
221
|
--accent-press: #025e5a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seanyeh77/tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Design tokens of SeanYeh's design system: CSS variables for light, dark and the teaching preset, a Tailwind v4 theme, typed token names and self-hosted fonts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Hsiu-An Yeh",
|
package/tokens.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"light": "#fcfbfb",
|
|
20
20
|
"dark": "#2f2a25"
|
|
21
21
|
},
|
|
22
|
-
"usage": "Page background (light:
|
|
22
|
+
"usage": "Page background (light: very light warm gray, neutral-0; dark: dark gray)."
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"name": "surface",
|
|
@@ -823,7 +823,7 @@
|
|
|
823
823
|
{
|
|
824
824
|
"name": "space-5",
|
|
825
825
|
"value": "20px",
|
|
826
|
-
"usage": "
|
|
826
|
+
"usage": "Dialog, drawer and empty-state padding; the gap between the settings category list and its content; the toast's distance from the window edge. Cards use space-4."
|
|
827
827
|
},
|
|
828
828
|
{
|
|
829
829
|
"name": "space-6",
|
|
@@ -833,7 +833,7 @@
|
|
|
833
833
|
{
|
|
834
834
|
"name": "space-8",
|
|
835
835
|
"value": "32px",
|
|
836
|
-
"usage": "Gap between page sections (
|
|
836
|
+
"usage": "Gap between page sections (compact)."
|
|
837
837
|
},
|
|
838
838
|
{
|
|
839
839
|
"name": "space-12",
|
|
@@ -857,7 +857,7 @@
|
|
|
857
857
|
{
|
|
858
858
|
"name": "radius-chip",
|
|
859
859
|
"value": "8px",
|
|
860
|
-
"usage": "Badge
|
|
860
|
+
"usage": "Badge (raised chip)."
|
|
861
861
|
},
|
|
862
862
|
{
|
|
863
863
|
"name": "radius-md",
|
|
@@ -892,7 +892,7 @@
|
|
|
892
892
|
"light": "0 1px 2px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.08)",
|
|
893
893
|
"dark": "0 1px 2px rgba(0, 0, 0, 0.45)"
|
|
894
894
|
},
|
|
895
|
-
"usage": "Badge
|
|
895
|
+
"usage": "Shadow of a raised Badge (chip)."
|
|
896
896
|
},
|
|
897
897
|
{
|
|
898
898
|
"name": "shadow-card",
|
|
@@ -930,12 +930,12 @@
|
|
|
930
930
|
{
|
|
931
931
|
"name": "chip-height",
|
|
932
932
|
"value": "32px",
|
|
933
|
-
"usage": "Badge
|
|
933
|
+
"usage": "Height of a raised Badge (chip)."
|
|
934
934
|
},
|
|
935
935
|
{
|
|
936
936
|
"name": "touch-target",
|
|
937
937
|
"value": "48px",
|
|
938
|
-
"usage": "
|
|
938
|
+
"usage": "Smallest tap area on touch screens; the button still looks 40 px."
|
|
939
939
|
},
|
|
940
940
|
{
|
|
941
941
|
"name": "header-height",
|
|
@@ -950,7 +950,7 @@
|
|
|
950
950
|
{
|
|
951
951
|
"name": "sidebar-collapsed",
|
|
952
952
|
"value": "72px",
|
|
953
|
-
"usage": "Collapsed sidebar, icons only.
|
|
953
|
+
"usage": "Collapsed sidebar, icons only (desktop). Tablets and phones open the navigation in a drawer instead."
|
|
954
954
|
},
|
|
955
955
|
{
|
|
956
956
|
"name": "tabbar-height",
|
|
@@ -965,22 +965,22 @@
|
|
|
965
965
|
{
|
|
966
966
|
"name": "alert-bar",
|
|
967
967
|
"value": "3px",
|
|
968
|
-
"usage": "Alert
|
|
968
|
+
"usage": "Height of the status-colored bar on top of an Alert."
|
|
969
969
|
},
|
|
970
970
|
{
|
|
971
971
|
"name": "bp-tablet",
|
|
972
972
|
"value": "600px",
|
|
973
|
-
"usage": "
|
|
973
|
+
"usage": "Phone to tablet: under 600 px wide is a phone."
|
|
974
974
|
},
|
|
975
975
|
{
|
|
976
976
|
"name": "bp-desktop",
|
|
977
977
|
"value": "960px",
|
|
978
|
-
"usage": "
|
|
978
|
+
"usage": "Tablet to desktop for page layout: 600 to 959 px is a tablet. AppShell's navigation has its own edge at 1024 px: a drawer from 600 to 1023 px, the sidebar from 1024 px."
|
|
979
979
|
},
|
|
980
980
|
{
|
|
981
981
|
"name": "bp-wide",
|
|
982
982
|
"value": "1280px",
|
|
983
|
-
"usage": "
|
|
983
|
+
"usage": "Desktop to wide screen: 960 to 1279 px is a desktop, 1280 px and up a wide screen."
|
|
984
984
|
}
|
|
985
985
|
]
|
|
986
986
|
},
|
|
@@ -999,7 +999,7 @@
|
|
|
999
999
|
{
|
|
1000
1000
|
"name": "dur-nav",
|
|
1001
1001
|
"value": "200ms",
|
|
1002
|
-
"usage": "Navigation moves:
|
|
1002
|
+
"usage": "Navigation moves: the droplet indicator of tabs, segmented controls, switches and the sidebar (lead 120 ms, trail 440 ms), and the staggered rise of cards (ui-rise-in)."
|
|
1003
1003
|
},
|
|
1004
1004
|
{
|
|
1005
1005
|
"name": "dur-tooltip",
|
|
@@ -1014,7 +1014,7 @@
|
|
|
1014
1014
|
{
|
|
1015
1015
|
"name": "dur-toggle",
|
|
1016
1016
|
"value": "300ms",
|
|
1017
|
-
"usage": "
|
|
1017
|
+
"usage": "The theme cross-fade; drawers sliding out and their backdrop; the sidebar widening."
|
|
1018
1018
|
},
|
|
1019
1019
|
{
|
|
1020
1020
|
"name": "dur-drawer",
|
|
@@ -1131,7 +1131,7 @@
|
|
|
1131
1131
|
{
|
|
1132
1132
|
"id": "teaching",
|
|
1133
1133
|
"name": "教材",
|
|
1134
|
-
"usage": "Slidev
|
|
1134
|
+
"usage": "Slidev teaching slides. Hybrid: neutrals and fonts from the design system; the accent, square corners and thin borders from the slide style. Light only. Use: initTheme({ preset: \"teaching\" }), or data-theme-preset=\"teaching\" on the root element before initTheme().",
|
|
1135
1135
|
"values": {
|
|
1136
1136
|
"bg": "#fcfbfb",
|
|
1137
1137
|
"surface": "#ffffff",
|
|
@@ -1157,7 +1157,8 @@
|
|
|
1157
1157
|
"shadow-chip": "none",
|
|
1158
1158
|
"shadow-card": "none",
|
|
1159
1159
|
"shadow-card-hover": "none"
|
|
1160
|
-
}
|
|
1160
|
+
},
|
|
1161
|
+
"scheme": "light"
|
|
1161
1162
|
}
|
|
1162
1163
|
]
|
|
1163
1164
|
}
|