@designil/labdsnov-tokens 0.0.0-setup

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -0
  3. package/package.json +39 -0
  4. package/tokens.css +317 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 designil
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @designil/labdsnov-tokens
2
+
3
+ token ทั้งหมดของ design system [labdsnov](https://github.com/dxnat/labdsnov) เป็น CSS custom properties ธรรมดา ไม่ต้องใช้ React ไม่ต้องใช้ Tailwind ใช้ได้กับ Vue, Svelte, Webflow, HTML ธรรมดา หรืออีเมล
4
+
5
+ ถ้าแอปใช้ component จาก [`@designil/labdsnov`](https://www.npmjs.com/package/@designil/labdsnov) อยู่แล้ว ไม่ต้องติดตั้งแพ็กเกจนี้เพิ่ม `@designil/labdsnov/styles.css` มี token ครบอยู่แล้ว
6
+
7
+ ## ติดตั้ง
8
+
9
+ ```bash
10
+ pnpm add @designil/labdsnov-tokens
11
+ ```
12
+
13
+ ## ใช้
14
+
15
+ ```css
16
+ @import "@designil/labdsnov-tokens/tokens.css";
17
+
18
+ .price-card {
19
+ background: var(--card);
20
+ color: var(--card-foreground);
21
+ border: 1px solid var(--border);
22
+ border-radius: var(--radius);
23
+ }
24
+
25
+ .price-card .cta {
26
+ background: var(--button-primary-bg);
27
+ color: var(--button-primary-fg);
28
+ }
29
+ ```
30
+
31
+ หรือไม่ต้อง build เลย ดึงจาก CDN สำหรับ prototype:
32
+
33
+ ```html
34
+ <link
35
+ rel="stylesheet"
36
+ href="https://cdn.jsdelivr.net/npm/@designil/labdsnov-tokens/tokens.css"
37
+ />
38
+ ```
39
+
40
+ โหมดมืด: ใส่ class `dark` ที่ `<html>` (หรือกล่องที่ครอบ)
41
+
42
+ ## มี token อะไรบ้าง
43
+
44
+ สามชั้น:
45
+
46
+ 1. **primitive** `--palette-*` เช่น `--palette-orange-700` สีดิบ ใช้ได้เฉพาะใน token ชั้นถัดไป
47
+ 2. **semantic** เช่น `--background`, `--primary`, `--muted-foreground`, `--border`, `--radius`
48
+ 3. **component** เช่น `--button-primary-bg`, `--field-border`, `--badge-success-fg`
49
+
50
+ ชื่อและค่าทุกตัวอยู่ใน [Colors](https://github.com/dxnat/labdsnov/blob/main/packages/ui/docs/Colors.md) และ [Component tokens](https://github.com/dxnat/labdsnov/blob/main/packages/ui/docs/ComponentTokens.md) ทุกคู่สีของตัวอักษรกับพื้นผ่าน WCAG 2.2 AA ทั้งสองโหมด
51
+
52
+ ในแอปให้ใช้ semantic หรือ component token อย่าใช้ `--palette-*` ตรง ๆ เวลาทีม design system ปรับสี เขาจะให้ semantic token ชี้ไปสีใหม่ แอปที่ใช้ `--primary` ได้สีใหม่เองโดยไม่ต้องแก้อะไร แอปที่ใช้ `--palette-orange-700` ตรง ๆ จะค้างอยู่ที่สีเดิม
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@designil/labdsnov-tokens",
3
+ "version": "0.0.0-setup",
4
+ "description": "labdsnov design tokens as plain CSS custom properties: primitive, semantic and component tokens, light and dark, WCAG 2.2 AA checked. No framework needed.",
5
+ "keywords": [
6
+ "design-system",
7
+ "design-tokens",
8
+ "css-variables",
9
+ "thai"
10
+ ],
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/dxnat/labdsnov.git",
15
+ "directory": "packages/tokens"
16
+ },
17
+ "homepage": "https://github.com/dxnat/labdsnov/tree/main/packages/tokens#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/dxnat/labdsnov/issues"
20
+ },
21
+ "type": "module",
22
+ "sideEffects": [
23
+ "**/*.css"
24
+ ],
25
+ "exports": {
26
+ "./tokens.css": "./tokens.css",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "files": [
30
+ "tokens.css"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "build": "node -e \"\"",
37
+ "typecheck": "node -e \"\""
38
+ }
39
+ }
package/tokens.css ADDED
@@ -0,0 +1,317 @@
1
+ /*
2
+ * @designil/labdsnov-tokens: every design token of the labdsnov design system
3
+ * as plain CSS custom properties. No Tailwind, no build step: import this file
4
+ * and use var(--primary), var(--button-primary-bg) and so on in any stack.
5
+ *
6
+ * Three layers: primitive colours (--palette-*, one value each), semantic
7
+ * colour and radius tokens in :root and .dark that point at them, then
8
+ * component tokens that point at the semantic ones. Dark mode is a `.dark`
9
+ * class on <html> (or any ancestor).
10
+ *
11
+ * Every text and control pair passes WCAG 2.2 AA in both modes, checked by
12
+ * `pnpm tokens:check` (packages/ui/scripts/tokens.mjs) in CI.
13
+ * This file is the source of truth: @designil/labdsnov imports it.
14
+ */
15
+
16
+ /* ---------- Primitive tokens ----------
17
+ * The raw palette. Nothing outside the semantic layer below should use these:
18
+ * components use component tokens, and component tokens point at semantic ones.
19
+ * Names follow Tailwind's hue-step scale. Values that are exactly Tailwind's keep
20
+ * its step (e.g. olive-950); values tuned for WCAG AA take the nearest free
21
+ * step (e.g. olive-550). docs/Colors.md lists which ones differ from Tailwind.
22
+ * Translucent colours are their own primitives (-a10 = 10% opacity) rather than
23
+ * color-mix(), whose build fallback is the opaque colour.
24
+ * Prefixed --palette- so they never override Tailwind's own --color-* palette.
25
+ */
26
+ :root {
27
+ --palette-white: oklch(1 0 0);
28
+ --palette-white-a10: oklch(1 0 0 / 10%);
29
+ --palette-white-a15: oklch(1 0 0 / 15%);
30
+ --palette-neutral-50: oklch(0.985 0 0);
31
+ --palette-olive-50: oklch(0.988 0.003 106.5);
32
+ --palette-olive-100: oklch(0.966 0.005 106.5);
33
+ --palette-olive-200: oklch(0.93 0.007 106.5);
34
+ --palette-olive-350: oklch(0.8 0.02 106.9);
35
+ --palette-olive-400: oklch(0.737 0.021 106.9);
36
+ --palette-olive-500: oklch(0.6 0.02 106.9);
37
+ --palette-olive-550: oklch(0.55 0.015 106.9);
38
+ --palette-olive-600: oklch(0.5 0.027 107.3);
39
+ --palette-olive-650: oklch(0.45 0.03 106.9);
40
+ --palette-olive-800: oklch(0.286 0.016 107.4);
41
+ --palette-olive-900: oklch(0.228 0.013 107.4);
42
+ --palette-olive-950: oklch(0.153 0.006 107.1);
43
+ --palette-zinc-100: oklch(0.967 0.001 286.375);
44
+ --palette-zinc-800: oklch(0.274 0.006 286.033);
45
+ --palette-zinc-900: oklch(0.21 0.006 285.885);
46
+ --palette-orange-50: oklch(0.98 0.016 73.684);
47
+ --palette-orange-500: oklch(0.705 0.187 47.604);
48
+ --palette-orange-700: oklch(0.553 0.195 38.402);
49
+ --palette-orange-950: oklch(0.205 0.05 40);
50
+ --palette-red-400: oklch(0.75 0.16 22.216);
51
+ --palette-red-700: oklch(0.505 0.2 27.325);
52
+ --palette-green-500: oklch(0.75 0.16 150);
53
+ --palette-green-700: oklch(0.49 0.12 150);
54
+ --palette-amber-400: oklch(0.82 0.15 80);
55
+ --palette-amber-800: oklch(0.5 0.12 60);
56
+ --palette-teal-500: oklch(0.72 0.11 190);
57
+ --palette-teal-700: oklch(0.52 0.1 190);
58
+ --palette-blue-400: oklch(0.7 0.14 262);
59
+ --palette-blue-700: oklch(0.5 0.17 262);
60
+ --palette-fuchsia-400: oklch(0.72 0.17 330);
61
+ --palette-fuchsia-700: oklch(0.52 0.19 330);
62
+ --palette-lime-500: oklch(0.78 0.17 135);
63
+ --palette-lime-700: oklch(0.55 0.15 135);
64
+ }
65
+
66
+ :root {
67
+ /* ---------- Semantic tokens ----------
68
+ * Checked against WCAG 2.2 AA: text pairs ≥ 4.5:1, control boundaries,
69
+ * focus rings, chart series ≥ 3:1. `--border` is for decorative edges
70
+ * (cards, separators, tables); use `--control-border` where the edge is
71
+ * what shows that something is a field or control.
72
+ */
73
+ --background: var(--palette-white);
74
+ --foreground: var(--palette-olive-950);
75
+ --card: var(--palette-white);
76
+ --card-foreground: var(--palette-olive-950);
77
+ --popover: var(--palette-white);
78
+ --popover-foreground: var(--palette-olive-950);
79
+ --primary: var(--palette-orange-700);
80
+ --primary-foreground: var(--palette-orange-50);
81
+ --secondary: var(--palette-zinc-100);
82
+ --secondary-foreground: var(--palette-zinc-900);
83
+ --muted: var(--palette-olive-100);
84
+ --muted-foreground: var(--palette-olive-600);
85
+ --accent: var(--palette-olive-100);
86
+ --accent-foreground: var(--palette-olive-900);
87
+ --destructive: var(--palette-red-700);
88
+ --success: var(--palette-green-700);
89
+ --warning: var(--palette-amber-800);
90
+ --border: var(--palette-olive-200);
91
+ --input: var(--palette-olive-200);
92
+ --control-border: var(--palette-olive-500);
93
+ --ring: var(--palette-olive-650);
94
+ --chart-1: var(--palette-orange-700);
95
+ --chart-2: var(--palette-teal-700);
96
+ --chart-3: var(--palette-blue-700);
97
+ --chart-4: var(--palette-fuchsia-700);
98
+ --chart-5: var(--palette-lime-700);
99
+ --radius: 0.625rem;
100
+ --sidebar: var(--palette-olive-50);
101
+ --sidebar-foreground: var(--palette-olive-950);
102
+ --sidebar-primary: var(--palette-orange-700);
103
+ --sidebar-primary-foreground: var(--palette-orange-50);
104
+ --sidebar-accent: var(--palette-olive-100);
105
+ --sidebar-accent-foreground: var(--palette-olive-900);
106
+ --sidebar-border: var(--palette-olive-200);
107
+ --sidebar-ring: var(--palette-olive-650);
108
+ }
109
+
110
+ .dark {
111
+ --background: var(--palette-olive-950);
112
+ --foreground: var(--palette-olive-50);
113
+ --card: var(--palette-olive-900);
114
+ --card-foreground: var(--palette-olive-50);
115
+ --popover: var(--palette-olive-900);
116
+ --popover-foreground: var(--palette-olive-50);
117
+ --primary: var(--palette-orange-500);
118
+ --primary-foreground: var(--palette-orange-950);
119
+ --secondary: var(--palette-zinc-800);
120
+ --secondary-foreground: var(--palette-neutral-50);
121
+ --muted: var(--palette-olive-800);
122
+ --muted-foreground: var(--palette-olive-400);
123
+ --accent: var(--palette-olive-800);
124
+ --accent-foreground: var(--palette-olive-50);
125
+ --destructive: var(--palette-red-400);
126
+ --success: var(--palette-green-500);
127
+ --warning: var(--palette-amber-400);
128
+ --border: var(--palette-white-a10);
129
+ --input: var(--palette-white-a15);
130
+ --control-border: var(--palette-olive-550);
131
+ --ring: var(--palette-olive-350);
132
+ --chart-1: var(--palette-orange-500);
133
+ --chart-2: var(--palette-teal-500);
134
+ --chart-3: var(--palette-blue-400);
135
+ --chart-4: var(--palette-fuchsia-400);
136
+ --chart-5: var(--palette-lime-500);
137
+ --sidebar: var(--palette-olive-900);
138
+ --sidebar-foreground: var(--palette-olive-50);
139
+ --sidebar-primary: var(--palette-orange-500);
140
+ --sidebar-primary-foreground: var(--palette-orange-950);
141
+ --sidebar-accent: var(--palette-olive-800);
142
+ --sidebar-accent-foreground: var(--palette-olive-50);
143
+ --sidebar-border: var(--palette-white-a10);
144
+ --sidebar-ring: var(--palette-olive-350);
145
+ }
146
+
147
+ /* ---------- Component tokens ----------
148
+ * What each component paints, named by component and part. They point at the
149
+ * semantic tokens above, so a theme normally changes only those; override one
150
+ * of these to restyle a single component. Declared on `.dark` as well as
151
+ * `:root` so they follow a `.dark` class placed below `<html>`.
152
+ */
153
+ :root,
154
+ .dark {
155
+ /* Shared states */
156
+ --focus-ring: var(--ring);
157
+ --invalid-border: var(--destructive);
158
+ --invalid-ring: color-mix(in oklab, var(--destructive) 20%, transparent);
159
+
160
+ /* Button */
161
+ --button-primary-bg: var(--primary);
162
+ --button-primary-fg: var(--primary-foreground);
163
+ --button-primary-hover-bg: color-mix(in oklab, var(--primary) 88%, black);
164
+ --button-secondary-bg: var(--secondary);
165
+ --button-secondary-fg: var(--secondary-foreground);
166
+ --button-secondary-hover-bg: color-mix(
167
+ in oklab,
168
+ var(--secondary) 95%,
169
+ var(--foreground)
170
+ );
171
+ --button-outline-bg: var(--background);
172
+ --button-outline-border: var(--border);
173
+ --button-outline-hover-bg: var(--muted);
174
+ --button-ghost-hover-bg: var(--muted);
175
+ --button-hover-fg: var(--foreground);
176
+ --button-destructive-bg: color-mix(
177
+ in oklab,
178
+ var(--destructive) 10%,
179
+ transparent
180
+ );
181
+ --button-destructive-hover-bg: color-mix(
182
+ in oklab,
183
+ var(--destructive) 18%,
184
+ transparent
185
+ );
186
+ --button-destructive-fg: var(--destructive);
187
+ --button-link-fg: var(--primary);
188
+
189
+ /* Badge */
190
+ --badge-default-bg: var(--primary);
191
+ --badge-default-fg: var(--primary-foreground);
192
+ --badge-secondary-bg: var(--secondary);
193
+ --badge-secondary-fg: var(--secondary-foreground);
194
+ --badge-outline-border: var(--border);
195
+ --badge-outline-fg: var(--foreground);
196
+ --badge-destructive-bg: color-mix(
197
+ in oklab,
198
+ var(--destructive) 10%,
199
+ transparent
200
+ );
201
+ --badge-destructive-fg: var(--destructive);
202
+ --badge-success-bg: color-mix(in oklab, var(--success) 10%, transparent);
203
+ --badge-success-fg: var(--success);
204
+ --badge-warning-bg: color-mix(in oklab, var(--warning) 10%, transparent);
205
+ --badge-warning-fg: var(--warning);
206
+
207
+ /* Text fields: Input, Textarea, Select trigger, InputGroup, Combobox, InputOTP */
208
+ --field-bg: color-mix(in oklab, var(--input) 50%, transparent);
209
+ --field-border: var(--control-border);
210
+ --field-placeholder: var(--muted-foreground);
211
+ --field-icon: var(--muted-foreground);
212
+
213
+ /* Checkbox, RadioGroup, Switch */
214
+ --control-bg: var(--background);
215
+ --control-checked-bg: var(--primary);
216
+ --control-checked-fg: var(--primary-foreground);
217
+ --switch-track: var(--control-border);
218
+ --switch-thumb: var(--background);
219
+ --switch-thumb-checked: var(--primary-foreground);
220
+
221
+ /* Tabs */
222
+ --tabs-list-bg: var(--muted);
223
+ --tabs-trigger-fg: var(--muted-foreground);
224
+ --tabs-trigger-active-bg: var(--background);
225
+ --tabs-trigger-active-fg: var(--foreground);
226
+ --tabs-indicator: var(--foreground);
227
+
228
+ /* Progress */
229
+ --progress-track: var(--muted);
230
+ --progress-indicator: var(--primary);
231
+
232
+ /* Menus and lists: Select, DropdownMenu, Combobox, NavigationMenu */
233
+ --menu-item-highlight-bg: var(--accent);
234
+ --menu-item-highlight-fg: var(--accent-foreground);
235
+ --menu-label-fg: var(--muted-foreground);
236
+ --menu-destructive-fg: var(--destructive);
237
+ --menu-destructive-highlight-bg: color-mix(
238
+ in oklab,
239
+ var(--destructive) 10%,
240
+ transparent
241
+ );
242
+
243
+ /* Tooltip */
244
+ --tooltip-bg: var(--foreground);
245
+ --tooltip-fg: var(--background);
246
+
247
+ /* Calendar */
248
+ --calendar-day-selected-bg: var(--primary);
249
+ --calendar-day-selected-fg: var(--primary-foreground);
250
+ --calendar-range-bg: var(--muted);
251
+ --calendar-today-bg: var(--muted);
252
+ --calendar-label-fg: var(--muted-foreground);
253
+
254
+ /* Toggle, ToggleGroup */
255
+ --toggle-fg: var(--muted-foreground);
256
+ --toggle-hover-bg: var(--muted);
257
+ --toggle-hover-fg: var(--foreground);
258
+ --toggle-pressed-bg: var(--muted);
259
+ --toggle-pressed-fg: var(--foreground);
260
+ --toggle-pressed-border: var(--control-border);
261
+ --toggle-outline-border: var(--border);
262
+
263
+ /* ButtonGroup */
264
+ --button-group-text-bg: var(--muted);
265
+ --button-group-text-fg: var(--foreground);
266
+ --button-group-separator: var(--input);
267
+
268
+ /* Kbd */
269
+ --kbd-bg: var(--muted);
270
+ --kbd-fg: var(--muted-foreground);
271
+ --kbd-tooltip-bg: color-mix(in oklab, var(--tooltip-fg) 20%, transparent);
272
+ --kbd-tooltip-fg: var(--tooltip-fg);
273
+
274
+ /* Slider */
275
+ --slider-track: var(--muted);
276
+ --slider-track-border: var(--control-border);
277
+ --slider-range: var(--primary);
278
+ --slider-thumb-bg: var(--background);
279
+ --slider-thumb-border: var(--primary);
280
+
281
+ /* ScrollArea */
282
+ --scroll-area-thumb: var(--control-border);
283
+ }
284
+
285
+ .dark {
286
+ --invalid-ring: color-mix(in oklab, var(--destructive) 40%, transparent);
287
+ --button-primary-hover-bg: color-mix(in oklab, var(--primary) 88%, white);
288
+ --button-outline-bg: transparent;
289
+ --button-outline-hover-bg: var(--input);
290
+ --button-ghost-hover-bg: color-mix(in oklab, var(--muted) 50%, transparent);
291
+ --button-destructive-bg: color-mix(
292
+ in oklab,
293
+ var(--destructive) 20%,
294
+ transparent
295
+ );
296
+ --button-destructive-hover-bg: color-mix(
297
+ in oklab,
298
+ var(--destructive) 30%,
299
+ transparent
300
+ );
301
+ --badge-destructive-bg: color-mix(
302
+ in oklab,
303
+ var(--destructive) 20%,
304
+ transparent
305
+ );
306
+ --badge-success-bg: color-mix(in oklab, var(--success) 20%, transparent);
307
+ --badge-warning-bg: color-mix(in oklab, var(--warning) 20%, transparent);
308
+ --control-bg: color-mix(in oklab, var(--input) 50%, transparent);
309
+ --switch-thumb: var(--foreground);
310
+ --tabs-trigger-active-bg: var(--input);
311
+ --menu-destructive-highlight-bg: color-mix(
312
+ in oklab,
313
+ var(--destructive) 20%,
314
+ transparent
315
+ );
316
+ --kbd-tooltip-bg: color-mix(in oklab, var(--tooltip-fg) 12%, transparent);
317
+ }