@youcan/celeste-tokens 0.6.88 → 0.6.90
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/dist/preset.ts +58 -21
- package/package.json +1 -1
- package/src/generate.ts +4 -1
- package/src/unocss-formatter.ts +38 -10
package/dist/preset.ts
CHANGED
|
@@ -313,7 +313,7 @@ export const presetCeleste = definePreset((options: CelestePresetOptions = {}):
|
|
|
313
313
|
"primary-dark": "#cb0f64",
|
|
314
314
|
"primary-alpha-24": "rgba(251, 75, 163, 0.24)"
|
|
315
315
|
},
|
|
316
|
-
"
|
|
316
|
+
"font": {
|
|
317
317
|
"inter-display": "InterDisplay",
|
|
318
318
|
"inter": "InterVariable",
|
|
319
319
|
"cairo": "Cairo",
|
|
@@ -351,7 +351,7 @@ export const presetCeleste = definePreset((options: CelestePresetOptions = {}):
|
|
|
351
351
|
"7": "0.04em",
|
|
352
352
|
"8": "0.02em"
|
|
353
353
|
},
|
|
354
|
-
"
|
|
354
|
+
"radius": {
|
|
355
355
|
"4": "4px",
|
|
356
356
|
"6": "6px",
|
|
357
357
|
"8": "8px",
|
|
@@ -362,25 +362,17 @@ export const presetCeleste = definePreset((options: CelestePresetOptions = {}):
|
|
|
362
362
|
"24": "24px",
|
|
363
363
|
"full": "999px"
|
|
364
364
|
},
|
|
365
|
-
"
|
|
366
|
-
"regular":
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
"buttons":
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
"
|
|
376
|
-
"neutral": "0 1px 2px 0 #1b1c1d7a, 0 0 0 1px #242628",
|
|
377
|
-
"primary": "0 1px 2px 0 #0e121b3d, 0 0 0 1px #e1116f",
|
|
378
|
-
"error": "0 1px 2px 0 #0e121b3d, 0 0 0 1px #fb3748",
|
|
379
|
-
"stroke": "0 1px 3px 0 #0e121b1f, 0 0 0 1px #e1e4ea"
|
|
380
|
-
},
|
|
381
|
-
"toggle": {
|
|
382
|
-
"switch": "0 6px 10px 0 #0e121b0f, 0 2px 4px 0 #0e121b08"
|
|
383
|
-
}
|
|
365
|
+
"shadow": {
|
|
366
|
+
"regular-xs": "0 1px 2px 0 #0a0d1408",
|
|
367
|
+
"regular-md": "0 16px 32px -12px #0e121b1a",
|
|
368
|
+
"buttons-primary-focus": "0 0 0 2px #ffffff, 0 0 0 4px #fb4ba31a",
|
|
369
|
+
"buttons-important-focus": "0 0 0 2px #ffffff, 0 0 0 4px #99a0ae29",
|
|
370
|
+
"buttons-error-focus": "0 0 0 2px #ffffff, 0 0 0 4px #fb37481a",
|
|
371
|
+
"fancy-buttons-neutral": "0 1px 2px 0 #1b1c1d7a, 0 0 0 1px #242628",
|
|
372
|
+
"fancy-buttons-primary": "0 1px 2px 0 #0e121b3d, 0 0 0 1px #e1116f",
|
|
373
|
+
"fancy-buttons-error": "0 1px 2px 0 #0e121b3d, 0 0 0 1px #fb3748",
|
|
374
|
+
"fancy-buttons-stroke": "0 1px 3px 0 #0e121b1f, 0 0 0 1px #e1e4ea",
|
|
375
|
+
"toggle-switch": "0 6px 10px 0 #0e121b0f, 0 2px 4px 0 #0e121b08"
|
|
384
376
|
},
|
|
385
377
|
"spacing": {
|
|
386
378
|
"0": "0",
|
|
@@ -400,6 +392,51 @@ export const presetCeleste = definePreset((options: CelestePresetOptions = {}):
|
|
|
400
392
|
"normal": "300ms",
|
|
401
393
|
"slow": "400ms",
|
|
402
394
|
"extra-slow": "500ms"
|
|
395
|
+
},
|
|
396
|
+
"animation": {
|
|
397
|
+
"keyframes": {
|
|
398
|
+
"celeste-fade-in": "{from{opacity: 0;}}",
|
|
399
|
+
"celeste-fade-out": "{to{opacity: 0;}}",
|
|
400
|
+
"celeste-zoom-in": "{from{opacity: 0;transform: scale(0.95);}}",
|
|
401
|
+
"celeste-zoom-out": "{to{opacity: 0;transform: scale(0.95);}}",
|
|
402
|
+
"celeste-spin-in": "{from{opacity: 0;transform: rotate(-30deg);}}",
|
|
403
|
+
"celeste-spin-out": "{to{opacity: 0;transform: rotate(30deg);}}",
|
|
404
|
+
"celeste-slide-in-from-top": "{from{transform: translateY(-100%);}}",
|
|
405
|
+
"celeste-slide-in-from-bottom": "{from{transform: translateY(100%);}}",
|
|
406
|
+
"celeste-slide-in-from-left": "{from{transform: translateX(-100%);}}",
|
|
407
|
+
"celeste-slide-in-from-right": "{from{transform: translateX(100%);}}",
|
|
408
|
+
"celeste-slide-out-to-top": "{to{transform: translateY(-100%);}}",
|
|
409
|
+
"celeste-slide-out-to-bottom": "{to{transform: translateY(100%);}}",
|
|
410
|
+
"celeste-slide-out-to-left": "{to{transform: translateX(-100%);}}",
|
|
411
|
+
"celeste-slide-out-to-right": "{to{transform: translateX(100%);}}",
|
|
412
|
+
"celeste-bounce": "{0%,100%{transform: translateY(-25%);animation-timing-function: cubic-bezier(0.8,0,1,1);}50%{transform: translateY(0);animation-timing-function: cubic-bezier(0,0,0.2,1);}}",
|
|
413
|
+
"celeste-pulse": "{0%,100%{opacity: 1;}50%{opacity: 0.5;}}",
|
|
414
|
+
"celeste-ping": "{75%,100%{transform: scale(2);opacity: 0;}}",
|
|
415
|
+
"celeste-shake": "{0%,100%{transform: translateX(0);}10%,30%,50%,70%,90%{transform: translateX(-10px);}20%,40%,60%,80%{transform: translateX(10px);}}",
|
|
416
|
+
"celeste-swing": "{0%,100%{transform: rotate(0deg);}20%{transform: rotate(15deg);}40%{transform: rotate(-10deg);}60%{transform: rotate(5deg);}80%{transform: rotate(-5deg);}}",
|
|
417
|
+
"celeste-wiggle": "{0%,100%{transform: rotate(-3deg);}50%{transform: rotate(3deg);}}",
|
|
418
|
+
"celeste-flip": "{from{transform: perspective(400px) rotateY(-180deg);opacity: 0;}to{transform: perspective(400px) rotateY(0);opacity: 1;}}",
|
|
419
|
+
"celeste-flip-out": "{from{transform: perspective(400px) rotateY(0);opacity: 1;}to{transform: perspective(400px) rotateY(180deg);opacity: 0;}}",
|
|
420
|
+
"celeste-accordion-down": "{from{height: 0;}to{height: var(--radix-accordion-content-height);}}",
|
|
421
|
+
"celeste-accordion-up": "{from{height: var(--radix-accordion-content-height);}to{height: 0;}}",
|
|
422
|
+
"celeste-collapsible-down": "{from{height: 0;}to{height: var(--radix-collapsible-content-height);}}",
|
|
423
|
+
"celeste-collapsible-up": "{from{height: var(--radix-collapsible-content-height);}to{height: 0;}}",
|
|
424
|
+
"celeste-enter": "{from{opacity: 0;transform: translate3d(0,0,0) scale3d(0.95,0.95,0.95) rotate(0);}}",
|
|
425
|
+
"celeste-exit": "{to{opacity: 0;transform: translate3d(0,0,0) scale3d(0.95,0.95,0.95) rotate(0);}}",
|
|
426
|
+
"celeste-scale-in": "{from{opacity: 0;transform: scale(0);}to{opacity: 1;transform: scale(1);}}",
|
|
427
|
+
"celeste-scale-out": "{from{opacity: 1;transform: scale(1);}to{opacity: 0;transform: scale(0);}}",
|
|
428
|
+
"celeste-rotate-in": "{from{opacity: 0;transform: rotate(-200deg);}to{opacity: 1;transform: rotate(0);}}",
|
|
429
|
+
"celeste-rotate-out": "{from{opacity: 1;transform: rotate(0);}to{opacity: 0;transform: rotate(200deg);}}",
|
|
430
|
+
"celeste-slide-down": "{from{height: 0;opacity: 0;}to{height: 100%;opacity: 1;}}",
|
|
431
|
+
"celeste-slide-up": "{from{height: 100%;opacity: 1;}to{height: 0;opacity: 0;}}",
|
|
432
|
+
"celeste-slide-left": "{from{width: 0;opacity: 0;}to{width: 100%;opacity: 1;}}",
|
|
433
|
+
"celeste-slide-right": "{from{width: 100%;opacity: 1;}to{width: 0;opacity: 0;}}",
|
|
434
|
+
"celeste-glow": "{0%,100%{box-shadow: 0 0 5px rgba(255,255,255,0.2);}50%{box-shadow: 0 0 20px rgba(255,255,255,0.6);}}",
|
|
435
|
+
"celeste-flash": "{0%,50%,100%{opacity: 1;}25%,75%{opacity: 0;}}",
|
|
436
|
+
"celeste-rubber-band": "{0%{transform: scale(1);}30%{transform: scaleX(1.25) scaleY(0.75);}40%{transform: scaleX(0.75) scaleY(1.25);}50%{transform: scaleX(1.15) scaleY(0.85);}65%{transform: scaleX(0.95) scaleY(1.05);}75%{transform: scaleX(1.05) scaleY(0.95);}100%{transform: scale(1);}}",
|
|
437
|
+
"celeste-jello": "{0%,100%{transform: skewX(0deg) skewY(0deg);}30%{transform: skewX(25deg) skewY(-25deg);}40%{transform: skewX(-15deg) skewY(15deg);}50%{transform: skewX(15deg) skewY(-15deg);}65%{transform: skewX(-5deg) skewY(5deg);}75%{transform: skewX(5deg) skewY(-5deg);}}",
|
|
438
|
+
"celeste-heartbeat": "{0%,100%{transform: scale(1);}14%,42%{transform: scale(1.3);}28%,70%{transform: scale(1);}}"
|
|
439
|
+
}
|
|
403
440
|
}
|
|
404
441
|
},
|
|
405
442
|
"shortcuts": {
|
package/package.json
CHANGED
package/src/generate.ts
CHANGED
package/src/unocss-formatter.ts
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
|
-
export function unocssFormat({ dictionary }: { dictionary: any }): string {
|
|
1
|
+
export function unocssFormat({ dictionary, animations }: { dictionary: any; animations: string }): string {
|
|
2
|
+
const keyframes: Record<string, string> = {};
|
|
3
|
+
const keyframesRegex = /@keyframes\s+([\w-]+)\s*\{([\s\S]*?)(?=@keyframes|$)/g;
|
|
4
|
+
|
|
5
|
+
for (const match of animations.matchAll(keyframesRegex)) {
|
|
6
|
+
const name = match[1];
|
|
7
|
+
|
|
8
|
+
const fullContent = match[2].trim();
|
|
9
|
+
|
|
10
|
+
const innerContent = fullContent.replace(/\}\s*$/, '').trim();
|
|
11
|
+
|
|
12
|
+
const minified = innerContent
|
|
13
|
+
.replace(/\s+/g, ' ')
|
|
14
|
+
.replace(/\s*\{\s*/g, '{')
|
|
15
|
+
.replace(/\s*\}\s*/g, '}')
|
|
16
|
+
.replace(/\s*;\s*/g, ';')
|
|
17
|
+
.replace(/\s*,\s*/g, ',');
|
|
18
|
+
|
|
19
|
+
keyframes[name] = `{${minified}}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
2
22
|
const preset: Record<string, any> = {
|
|
3
23
|
name: 'presetCeleste',
|
|
4
24
|
theme: {
|
|
5
25
|
colors: {},
|
|
6
|
-
|
|
26
|
+
font: {},
|
|
7
27
|
fontSize: {},
|
|
8
28
|
fontWeight: {},
|
|
9
29
|
lineHeight: {},
|
|
10
30
|
letterSpacing: {},
|
|
11
|
-
|
|
12
|
-
|
|
31
|
+
radius: {},
|
|
32
|
+
shadow: {},
|
|
13
33
|
spacing: {},
|
|
14
34
|
duration: {},
|
|
35
|
+
animation: {
|
|
36
|
+
keyframes,
|
|
37
|
+
},
|
|
15
38
|
},
|
|
16
39
|
shortcuts: {},
|
|
17
40
|
};
|
|
@@ -29,15 +52,15 @@ export function unocssFormat({ dictionary }: { dictionary: any }): string {
|
|
|
29
52
|
|
|
30
53
|
const propertyMap: Record<string, string> = {
|
|
31
54
|
color: 'colors',
|
|
32
|
-
fontFamilies: '
|
|
55
|
+
fontFamilies: 'font',
|
|
33
56
|
fontSizes: 'fontSize',
|
|
34
57
|
fontWeights: 'fontWeight',
|
|
35
58
|
lineHeights: 'lineHeight',
|
|
36
59
|
letterSpacing: 'letterSpacing',
|
|
37
60
|
spacing: 'spacing',
|
|
38
|
-
radius: '
|
|
39
|
-
shadow: '
|
|
40
|
-
boxShadow: '
|
|
61
|
+
radius: 'radius',
|
|
62
|
+
shadow: 'shadow',
|
|
63
|
+
boxShadow: 'shadow',
|
|
41
64
|
animation: 'duration',
|
|
42
65
|
duration: 'duration',
|
|
43
66
|
};
|
|
@@ -62,13 +85,13 @@ export function unocssFormat({ dictionary }: { dictionary: any }): string {
|
|
|
62
85
|
let themeKey = propertyMap[root] ?? propertyMap[$type] ?? propertyMap[type];
|
|
63
86
|
|
|
64
87
|
if (!themeKey && path.includes('radius')) {
|
|
65
|
-
themeKey = '
|
|
88
|
+
themeKey = 'radius';
|
|
66
89
|
}
|
|
67
90
|
|
|
68
91
|
if (themeKey) {
|
|
69
92
|
let finalValue = val;
|
|
70
93
|
|
|
71
|
-
if (themeKey === '
|
|
94
|
+
if (themeKey === 'shadow') {
|
|
72
95
|
if (typeof val === 'object' && val !== null) {
|
|
73
96
|
const shadows = Array.isArray(val) ? val : [val];
|
|
74
97
|
finalValue = shadows.map((s: any) => {
|
|
@@ -79,6 +102,11 @@ export function unocssFormat({ dictionary }: { dictionary: any }): string {
|
|
|
79
102
|
return `${inset}${x}px ${y}px ${blur}px ${spread}px ${color}`;
|
|
80
103
|
}).join(', ');
|
|
81
104
|
}
|
|
105
|
+
|
|
106
|
+
const flatKey = subPath.join('-');
|
|
107
|
+
preset.theme.shadow[flatKey] = finalValue;
|
|
108
|
+
|
|
109
|
+
return;
|
|
82
110
|
}
|
|
83
111
|
|
|
84
112
|
set(preset.theme[themeKey], subPath, finalValue);
|