@kungal/ui-tokens 0.2.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/src/tokens.css ADDED
@@ -0,0 +1,554 @@
1
+ /*
2
+ * @kungal/ui-tokens — KunUI design tokens (framework-agnostic).
3
+ *
4
+ * This file is the single source of truth for KunUI's visual language:
5
+ * the semantic color scales, the radius buckets, the z-index layering,
6
+ * and the animation keyframes. It contains ZERO framework code and ZERO
7
+ * component classes — it is pure CSS custom properties + Tailwind v4
8
+ * `@theme` declarations, so it can be consumed identically by a Vue app,
9
+ * a React app, or plain HTML.
10
+ *
11
+ * USAGE — import it AFTER Tailwind in your app's entry stylesheet:
12
+ *
13
+ * @import 'tailwindcss';
14
+ * @import '@kungal/ui-tokens/css'; // this file
15
+ * @source '../node_modules/@kungal/ui-vue'; // scan whichever KunUI render
16
+ * // layer you use (vue/react)
17
+ *
18
+ * Deliberately NOT included here (they are consumer-/package-specific):
19
+ * - `@import 'tailwindcss'` → the consuming app owns its Tailwind import
20
+ * - `@source` directives → each render-layer package declares its own
21
+ */
22
+
23
+ @custom-variant dark (&:is(.kun-dark-mode *));
24
+
25
+ :root {
26
+ /* Global alpha applied to "glassy" semantic surfaces (background +
27
+ * default-100). Lower = more see-through. Apps may override in :root. */
28
+ --kun-global-opacity: 0.7;
29
+
30
+ /* Backdrop blur strength for glass surfaces (Card / Modal / sticky
31
+ * topbar). 0 = no blur. Referenced as
32
+ * `backdrop-blur-[var(--kun-background-blur)]` by those components.
33
+ * Apps may override (e.g. a user-adjustable glass-blur setting). */
34
+ --kun-background-blur: 0px;
35
+ }
36
+
37
+ @theme {
38
+ --color-black: #000;
39
+ --color-white: #fff;
40
+
41
+ --color-background: hsla(var(--background), var(--kun-global-opacity));
42
+ --color-foreground: hsl(var(--foreground));
43
+ --color-content1: hsl(var(--content1));
44
+ --color-content2: hsl(var(--content2));
45
+ --color-content3: hsl(var(--content3));
46
+ --color-content4: hsl(var(--content4));
47
+
48
+ --color-default: hsla(var(--default-500));
49
+ --color-primary: hsl(var(--primary-500));
50
+ --color-secondary: hsl(var(--secondary-500));
51
+ --color-success: hsl(var(--success-500));
52
+ --color-warning: hsl(var(--warning-500));
53
+ --color-danger: hsl(var(--danger-500));
54
+ --color-info: hsl(var(--info-500));
55
+
56
+ --color-default-50: hsla(var(--default-50));
57
+ --color-default-100: hsla(var(--default-100), var(--kun-global-opacity));
58
+ --color-default-200: hsla(var(--default-200));
59
+ --color-default-300: hsla(var(--default-300));
60
+ --color-default-400: hsla(var(--default-400));
61
+ --color-default-500: hsla(var(--default-500));
62
+ --color-default-600: hsla(var(--default-600));
63
+ --color-default-700: hsla(var(--default-700));
64
+ --color-default-800: hsla(var(--default-800));
65
+ --color-default-900: hsla(var(--default-900));
66
+ --color-default-950: hsla(var(--default-950));
67
+ --color-primary-50: hsl(var(--primary-50));
68
+ --color-primary-100: hsl(var(--primary-100));
69
+ --color-primary-200: hsl(var(--primary-200));
70
+ --color-primary-300: hsl(var(--primary-300));
71
+ --color-primary-400: hsl(var(--primary-400));
72
+ --color-primary-500: hsl(var(--primary-500));
73
+ --color-primary-600: hsl(var(--primary-600));
74
+ --color-primary-700: hsl(var(--primary-700));
75
+ --color-primary-800: hsl(var(--primary-800));
76
+ --color-primary-900: hsl(var(--primary-900));
77
+ --color-primary-950: hsl(var(--primary-950));
78
+ --color-secondary-50: hsl(var(--secondary-50));
79
+ --color-secondary-100: hsl(var(--secondary-100));
80
+ --color-secondary-200: hsl(var(--secondary-200));
81
+ --color-secondary-300: hsl(var(--secondary-300));
82
+ --color-secondary-400: hsl(var(--secondary-400));
83
+ --color-secondary-500: hsl(var(--secondary-500));
84
+ --color-secondary-600: hsl(var(--secondary-600));
85
+ --color-secondary-700: hsl(var(--secondary-700));
86
+ --color-secondary-800: hsl(var(--secondary-800));
87
+ --color-secondary-900: hsl(var(--secondary-900));
88
+ --color-secondary-950: hsl(var(--secondary-950));
89
+ --color-success-50: hsl(var(--success-50));
90
+ --color-success-100: hsl(var(--success-100));
91
+ --color-success-200: hsl(var(--success-200));
92
+ --color-success-300: hsl(var(--success-300));
93
+ --color-success-400: hsl(var(--success-400));
94
+ --color-success-500: hsl(var(--success-500));
95
+ --color-success-600: hsl(var(--success-600));
96
+ --color-success-700: hsl(var(--success-700));
97
+ --color-success-800: hsl(var(--success-800));
98
+ --color-success-900: hsl(var(--success-900));
99
+ --color-success-950: hsl(var(--success-950));
100
+ --color-warning-50: hsl(var(--warning-50));
101
+ --color-warning-100: hsl(var(--warning-100));
102
+ --color-warning-200: hsl(var(--warning-200));
103
+ --color-warning-300: hsl(var(--warning-300));
104
+ --color-warning-400: hsl(var(--warning-400));
105
+ --color-warning-500: hsl(var(--warning-500));
106
+ --color-warning-600: hsl(var(--warning-600));
107
+ --color-warning-700: hsl(var(--warning-700));
108
+ --color-warning-800: hsl(var(--warning-800));
109
+ --color-warning-900: hsl(var(--warning-900));
110
+ --color-warning-950: hsl(var(--warning-950));
111
+ --color-danger-50: hsl(var(--danger-50));
112
+ --color-danger-100: hsl(var(--danger-100));
113
+ --color-danger-200: hsl(var(--danger-200));
114
+ --color-danger-300: hsl(var(--danger-300));
115
+ --color-danger-400: hsl(var(--danger-400));
116
+ --color-danger-500: hsl(var(--danger-500));
117
+ --color-danger-600: hsl(var(--danger-600));
118
+ --color-danger-700: hsl(var(--danger-700));
119
+ --color-danger-800: hsl(var(--danger-800));
120
+ --color-danger-900: hsl(var(--danger-900));
121
+ --color-danger-950: hsl(var(--danger-950));
122
+ --color-info-50: hsl(var(--info-50));
123
+ --color-info-100: hsl(var(--info-100));
124
+ --color-info-200: hsl(var(--info-200));
125
+ --color-info-300: hsl(var(--info-300));
126
+ --color-info-400: hsl(var(--info-400));
127
+ --color-info-500: hsl(var(--info-500));
128
+ --color-info-600: hsl(var(--info-600));
129
+ --color-info-700: hsl(var(--info-700));
130
+ --color-info-800: hsl(var(--info-800));
131
+ --color-info-900: hsl(var(--info-900));
132
+ --color-info-950: hsl(var(--info-950));
133
+
134
+ /* Border radius — 5 buckets every KunUI component references.
135
+ * Override by setting :root { --radius-kun-md: ... } in the consuming
136
+ * app, or per-subtree via the render layer's config provider.
137
+ * Tailwind v4 @theme auto-generates the utility classes:
138
+ * rounded-kun-none / -sm / -md / -lg / -full
139
+ * The framework-agnostic class map lives in @kungal/ui-core (kunRoundedClasses). */
140
+ --radius-kun-none: 0;
141
+ --radius-kun-sm: 0.25rem;
142
+ --radius-kun-md: 0.5rem;
143
+ --radius-kun-lg: 0.75rem;
144
+ --radius-kun-full: 9999px;
145
+
146
+ /* z-index layering — floating UI must stack predictably so a popover
147
+ * opened inside a modal (or from a sticky topbar) is always visible.
148
+ * Tier rule: a floating element always sits above the layer that
149
+ * triggered it. sticky < modal < popover < alert < message.
150
+ * The band sits very high (9000+) to win against app-side legacy
151
+ * headers that use z-50/100/9999. */
152
+ --z-kun-sticky: 30;
153
+ --z-kun-modal: 9000;
154
+ --z-kun-popover: 9300;
155
+ --z-kun-alert: 9700;
156
+ --z-kun-message: 9999;
157
+
158
+ /* Animations */
159
+ --animate-shake: shake 1s ease-in-out;
160
+ --animate-bounceInDown: bounceInDown 1s ease-in-out;
161
+ --animate-tada: tada 1s ease-in-out;
162
+ --animate-bounce: bounce 1s ease-in-out;
163
+ --animate-fadeInUp: fadeInUp 0.5s ease-in-out;
164
+ --animate-fadeOutDown: fadeOutDown 0.5s ease-in-out;
165
+ --animate-swing: swing 1s ease-in-out;
166
+ --animate-bounceInRight: bounceInRight 0.5s ease-in-out;
167
+
168
+ @keyframes shake {
169
+ 0%,
170
+ 100% {
171
+ transform: translateX(0);
172
+ }
173
+ 6% {
174
+ transform: translateX(-6px) rotateY(-9deg);
175
+ }
176
+ 18% {
177
+ transform: translateX(5px) rotateY(7deg);
178
+ }
179
+ 31% {
180
+ transform: translateX(-3px) rotateY(-5deg);
181
+ }
182
+ 43% {
183
+ transform: translateX(2px) rotateY(3deg);
184
+ }
185
+ 50% {
186
+ transform: translateX(0);
187
+ }
188
+ }
189
+
190
+ @keyframes bounceInDown {
191
+ 0% {
192
+ opacity: 0;
193
+ transform: translateY(-500px);
194
+ }
195
+ 60% {
196
+ opacity: 1;
197
+ transform: translateY(30px);
198
+ }
199
+ 80% {
200
+ transform: translateY(-10px);
201
+ }
202
+ 100% {
203
+ transform: translateY(0);
204
+ }
205
+ }
206
+
207
+ @keyframes tada {
208
+ 0% {
209
+ transform: scale(1);
210
+ }
211
+ 10%,
212
+ 20% {
213
+ transform: scale(0.9) rotate(-3deg);
214
+ }
215
+ 30%,
216
+ 50%,
217
+ 70%,
218
+ 90% {
219
+ transform: scale(1.1) rotate(3deg);
220
+ }
221
+ 40%,
222
+ 60%,
223
+ 80% {
224
+ transform: scale(1.1) rotate(-3deg);
225
+ }
226
+ 100% {
227
+ transform: scale(1) rotate(0);
228
+ }
229
+ }
230
+
231
+ @keyframes bounce {
232
+ 0%,
233
+ 20%,
234
+ 50%,
235
+ 80%,
236
+ 100% {
237
+ transform: translateY(0);
238
+ }
239
+ 40% {
240
+ transform: translateY(-30px);
241
+ }
242
+ 60% {
243
+ transform: translateY(-15px);
244
+ }
245
+ }
246
+
247
+ /* animate.css: https://github.com/animate-css/animate.css */
248
+ @keyframes fadeInUp {
249
+ from {
250
+ opacity: 0;
251
+ transform: translate3d(0, 100%, 0);
252
+ }
253
+ to {
254
+ opacity: 1;
255
+ transform: translate3d(0, 0, 0);
256
+ }
257
+ }
258
+
259
+ @keyframes fadeOutDown {
260
+ from {
261
+ opacity: 1;
262
+ }
263
+ to {
264
+ opacity: 0;
265
+ transform: translate3d(0, 100%, 0);
266
+ }
267
+ }
268
+
269
+ @keyframes swing {
270
+ 20% {
271
+ transform: rotate3d(0, 0, 1, 15deg);
272
+ }
273
+ 40% {
274
+ transform: rotate3d(0, 0, 1, -10deg);
275
+ }
276
+ 60% {
277
+ transform: rotate3d(0, 0, 1, 5deg);
278
+ }
279
+ 80% {
280
+ transform: rotate3d(0, 0, 1, -5deg);
281
+ }
282
+ to {
283
+ transform: rotate3d(0, 0, 1, 0deg);
284
+ }
285
+ }
286
+
287
+ @keyframes bounceInRight {
288
+ from,
289
+ 60%,
290
+ 75%,
291
+ 90%,
292
+ to {
293
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
294
+ }
295
+ from {
296
+ opacity: 0;
297
+ transform: translate3d(3000px, 0, 0) scaleX(3);
298
+ }
299
+ 60% {
300
+ opacity: 1;
301
+ transform: translate3d(-25px, 0, 0) scaleX(1);
302
+ }
303
+ 75% {
304
+ transform: translate3d(10px, 0, 0) scaleX(0.98);
305
+ }
306
+ 90% {
307
+ transform: translate3d(-5px, 0, 0) scaleX(0.995);
308
+ }
309
+ to {
310
+ transform: translate3d(0, 0, 0);
311
+ }
312
+ }
313
+ }
314
+
315
+ /* Explicit z-index utilities — Tailwind v4's @theme auto-generation does
316
+ * NOT cover the --z-* namespace (only --color / --radius / --spacing /
317
+ * --font etc.), so `class="z-kun-popover"` silently no-ops without these
318
+ * @utility blocks. They are the load-bearing piece of the z-index system,
319
+ * not the @theme declarations above. The value derefs the @theme variable
320
+ * so a consumer's `:root { --z-kun-modal: ... }` override propagates. */
321
+ @utility z-kun-sticky {
322
+ z-index: var(--z-kun-sticky);
323
+ }
324
+ @utility z-kun-modal {
325
+ z-index: var(--z-kun-modal);
326
+ }
327
+ @utility z-kun-popover {
328
+ z-index: var(--z-kun-popover);
329
+ }
330
+ @utility z-kun-alert {
331
+ z-index: var(--z-kun-alert);
332
+ }
333
+ @utility z-kun-message {
334
+ z-index: var(--z-kun-message);
335
+ }
336
+
337
+ @layer base {
338
+ :root {
339
+ /* Content color */
340
+ --background: 0, 0%, 100%;
341
+ --foreground: 202, 24%, 9%;
342
+
343
+ --content1: 0, 0%, 100%;
344
+ --content2: 240, 5%, 96%;
345
+ --content3: 240, 6%, 90%;
346
+ --content4: 240, 5%, 84%;
347
+
348
+ /* Primary colors - Blue */
349
+ --primary-50: 213, 92%, 95%;
350
+ --primary-100: 212, 92%, 90%;
351
+ --primary-200: 212, 92%, 79%;
352
+ --primary-300: 212, 92%, 69%;
353
+ --primary-400: 212, 92%, 58%;
354
+ --primary-500: 212, 100%, 47%;
355
+ --primary-600: 212, 100%, 38%;
356
+ --primary-700: 212, 100%, 29%;
357
+ --primary-800: 212, 100%, 19%;
358
+ --primary-900: 212, 100%, 10%;
359
+
360
+ /* Info colors - Cyan */
361
+ --info-50: 192, 100%, 97%;
362
+ --info-100: 190, 92%, 95%;
363
+ --info-200: 189, 95%, 92%;
364
+ --info-300: 189, 94%, 88%;
365
+ --info-400: 190, 96%, 82%;
366
+ --info-500: 190, 95%, 74%;
367
+ --info-600: 190, 95%, 44%;
368
+ --info-700: 191, 92%, 42%;
369
+ --info-800: 192, 85%, 36%;
370
+ --info-900: 192, 87%, 15%;
371
+
372
+ /* Success colors - Green */
373
+ --success-50: 147, 64%, 95%;
374
+ --success-100: 146, 61%, 89%;
375
+ --success-200: 146, 62%, 77%;
376
+ --success-300: 146, 63%, 66%;
377
+ --success-400: 146, 62%, 55%;
378
+ --success-500: 146, 79%, 44%;
379
+ --success-600: 146, 80%, 35%;
380
+ --success-700: 146, 79%, 26%;
381
+ --success-800: 146, 80%, 17%;
382
+ --success-900: 146, 78%, 9%;
383
+
384
+ /* Secondary colors - Pink */
385
+ --secondary-50: 317, 100%, 96%;
386
+ --secondary-100: 317, 100%, 93%;
387
+ --secondary-200: 317, 100%, 86%;
388
+ --secondary-300: 317, 100%, 79%;
389
+ --secondary-400: 317, 100%, 72%;
390
+ --secondary-500: 317, 100%, 65%;
391
+ --secondary-600: 317, 58%, 52%;
392
+ --secondary-700: 317, 53%, 39%;
393
+ --secondary-800: 317, 53%, 26%;
394
+ --secondary-900: 317, 52%, 13%;
395
+
396
+ /* Default colors - Purple */
397
+ --default-50: 270, 62%, 95%;
398
+ --default-100: 270, 59%, 89%;
399
+ --default-200: 270, 59%, 79%;
400
+ --default-300: 270, 59%, 68%;
401
+ --default-400: 270, 59%, 58%;
402
+ --default-500: 270, 67%, 47%;
403
+ --default-600: 270, 67%, 38%;
404
+ --default-700: 270, 67%, 28%;
405
+ --default-800: 270, 67%, 19%;
406
+ --default-900: 270, 67%, 9%;
407
+
408
+ /* Danger colors - Red */
409
+ --danger-50: 339, 92%, 95%;
410
+ --danger-100: 340, 92%, 90%;
411
+ --danger-200: 339, 90%, 80%;
412
+ --danger-300: 339, 91%, 71%;
413
+ --danger-400: 339, 90%, 61%;
414
+ --danger-500: 339, 90%, 51%;
415
+ --danger-600: 339, 87%, 41%;
416
+ --danger-700: 339, 86%, 31%;
417
+ --danger-800: 339, 87%, 20%;
418
+ --danger-900: 340, 85%, 10%;
419
+
420
+ /* Warning colors - Yellow */
421
+ --warning-50: 55, 92%, 95%;
422
+ --warning-100: 37, 91%, 91%;
423
+ --warning-200: 37, 91%, 82%;
424
+ --warning-300: 37, 91%, 73%;
425
+ --warning-400: 37, 91%, 64%;
426
+ --warning-500: 37, 91%, 55%;
427
+ --warning-600: 37, 74%, 44%;
428
+ --warning-700: 37, 74%, 33%;
429
+ --warning-800: 37, 75%, 22%;
430
+ --warning-900: 37, 75%, 11%;
431
+
432
+ /* Default colors - Zinc (overrides the purple block above; matches
433
+ * the source layer, where the zinc scale is the effective default) */
434
+ --default-50: 0, 0%, 98%;
435
+ --default-100: 240, 5%, 96%;
436
+ --default-200: 240, 6%, 90%;
437
+ --default-300: 240, 5%, 84%;
438
+ --default-400: 240, 5%, 65%;
439
+ --default-500: 240, 4%, 46%;
440
+ --default-600: 240, 5%, 34%;
441
+ --default-700: 240, 5%, 26%;
442
+ --default-800: 240, 4%, 16%;
443
+ --default-900: 240, 6%, 10%;
444
+
445
+ /* Radius */
446
+ --radius: 0.5rem;
447
+ }
448
+
449
+ .kun-dark-mode {
450
+ /* Content color */
451
+ --background: 0, 0%, 0%;
452
+ --foreground: 210, 6%, 93%;
453
+ --content1: 240, 6%, 10%;
454
+ --content2: 240, 4%, 16%;
455
+ --content3: 240, 5%, 26%;
456
+ --content4: 240, 5%, 34%;
457
+
458
+ /* Primary colors - Blue */
459
+ --primary-50: 212, 100%, 10%;
460
+ --primary-100: 212, 100%, 19%;
461
+ --primary-200: 212, 100%, 29%;
462
+ --primary-300: 212, 100%, 38%;
463
+ --primary-400: 212, 100%, 47%;
464
+ --primary-500: 212, 92%, 58%;
465
+ --primary-600: 212, 92%, 69%;
466
+ --primary-700: 212, 92%, 79%;
467
+ --primary-800: 212, 92%, 90%;
468
+ --primary-900: 213, 92%, 95%;
469
+
470
+ /* Info colors - Cyan */
471
+ --info-50: 192, 87%, 15%;
472
+ --info-100: 192, 85%, 36%;
473
+ --info-200: 191, 92%, 42%;
474
+ --info-300: 190, 95%, 44%;
475
+ --info-400: 190, 95%, 74%;
476
+ --info-500: 190, 96%, 82%;
477
+ --info-600: 189, 94%, 88%;
478
+ --info-700: 189, 95%, 92%;
479
+ --info-800: 190, 92%, 95%;
480
+ --info-900: 192, 100%, 97%;
481
+
482
+ /* Success colors - Green */
483
+ --success-50: 146, 78%, 9%;
484
+ --success-100: 146, 80%, 17%;
485
+ --success-200: 146, 79%, 26%;
486
+ --success-300: 146, 80%, 35%;
487
+ --success-400: 146, 79%, 44%;
488
+ --success-500: 146, 62%, 55%;
489
+ --success-600: 146, 63%, 66%;
490
+ --success-700: 146, 62%, 77%;
491
+ --success-800: 146, 61%, 89%;
492
+ --success-900: 147, 64%, 95%;
493
+
494
+ /* Secondary colors - Pink */
495
+ --secondary-50: 317, 52%, 13%;
496
+ --secondary-100: 317, 53%, 26%;
497
+ --secondary-200: 317, 53%, 39%;
498
+ --secondary-300: 317, 58%, 52%;
499
+ --secondary-400: 317, 100%, 65%;
500
+ --secondary-500: 317, 100%, 72%;
501
+ --secondary-600: 317, 100%, 79%;
502
+ --secondary-700: 317, 100%, 86%;
503
+ --secondary-800: 317, 100%, 93%;
504
+ --secondary-900: 317, 100%, 96%;
505
+
506
+ /* Default colors - Purple */
507
+ --default-50: 270, 67%, 9%;
508
+ --default-100: 270, 67%, 19%;
509
+ --default-200: 270, 67%, 28%;
510
+ --default-300: 270, 67%, 38%;
511
+ --default-400: 270, 67%, 47%;
512
+ --default-500: 270, 59%, 58%;
513
+ --default-600: 270, 59%, 68%;
514
+ --default-700: 270, 59%, 79%;
515
+ --default-800: 270, 59%, 89%;
516
+ --default-900: 270, 62%, 95%;
517
+
518
+ /* Danger colors - Red */
519
+ --danger-50: 340, 85%, 10%;
520
+ --danger-100: 339, 87%, 20%;
521
+ --danger-200: 339, 86%, 31%;
522
+ --danger-300: 339, 87%, 41%;
523
+ --danger-400: 339, 90%, 51%;
524
+ --danger-500: 339, 90%, 61%;
525
+ --danger-600: 339, 91%, 71%;
526
+ --danger-700: 339, 90%, 80%;
527
+ --danger-800: 340, 92%, 90%;
528
+ --danger-900: 339, 92%, 95%;
529
+
530
+ /* Warning colors - Yellow */
531
+ --warning-50: 37, 75%, 11%;
532
+ --warning-100: 37, 75%, 22%;
533
+ --warning-200: 37, 74%, 33%;
534
+ --warning-300: 37, 74%, 44%;
535
+ --warning-400: 37, 91%, 55%;
536
+ --warning-500: 37, 91%, 64%;
537
+ --warning-600: 37, 91%, 73%;
538
+ --warning-700: 37, 91%, 82%;
539
+ --warning-800: 37, 91%, 91%;
540
+ --warning-900: 55, 92%, 95%;
541
+
542
+ /* Default colors - Zinc */
543
+ --default-50: 240, 6%, 10%;
544
+ --default-100: 240, 4%, 16%;
545
+ --default-200: 240, 5%, 26%;
546
+ --default-300: 240, 5%, 34%;
547
+ --default-400: 240, 4%, 46%;
548
+ --default-500: 240, 5%, 65%;
549
+ --default-600: 240, 5%, 84%;
550
+ --default-700: 240, 6%, 90%;
551
+ --default-800: 240, 5%, 96%;
552
+ --default-900: 0, 0%, 98%;
553
+ }
554
+ }