@aleph-alpha/config-css 0.12.1 → 0.13.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/CHANGELOG.md +20 -0
- package/dist/index.d.ts +24 -7
- package/dist/index.js +41 -40
- package/package.json +2 -2
- package/src/index.ts +42 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 0.13.0 (2025-05-12)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- type-safety for `Theme` tokens
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Max Hammer
|
|
10
|
+
|
|
11
|
+
## 0.12.2 (2025-05-09)
|
|
12
|
+
|
|
13
|
+
### 🩹 Fixes
|
|
14
|
+
|
|
15
|
+
- **deps:** update unocss monorepo to v66.1.1
|
|
16
|
+
|
|
17
|
+
### ❤️ Thank You
|
|
18
|
+
|
|
19
|
+
- Renovatebot
|
|
20
|
+
|
|
1
21
|
## 0.12.1 (2025-05-04)
|
|
2
22
|
|
|
3
23
|
### 🩹 Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { default as default_2 } from '../sd-output/light-mode.json';
|
|
2
|
+
import { default as default_3 } from '../sd-output/spacings.json';
|
|
3
|
+
import { default as default_4 } from '../sd-output/box-shadows.json';
|
|
1
4
|
import { Preset } from 'unocss';
|
|
2
5
|
|
|
6
|
+
export declare const commonPresets: Preset<Theme>[];
|
|
7
|
+
|
|
3
8
|
export declare const createPresets: () => Preset<Theme>[];
|
|
4
9
|
|
|
5
10
|
export declare const getDesignSystemContentPathConfig: (framework: "vue" | "svelte") => {
|
|
@@ -11,20 +16,32 @@ export declare const getDesignSystemContentPathConfig: (framework: "vue" | "svel
|
|
|
11
16
|
};
|
|
12
17
|
};
|
|
13
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `presetsAlephAlpha` instead.
|
|
21
|
+
* preset**S** is misleading since it's not a preset but a function that returns a list of presets.
|
|
22
|
+
*/
|
|
23
|
+
export declare const presetAlephAlpha: () => Preset<Theme>[];
|
|
24
|
+
|
|
14
25
|
/**
|
|
15
26
|
* The Aleph Alpha CSS preset for UnoCSS.
|
|
16
27
|
* It uses the Windi CSS preset for UnoCSS.
|
|
17
28
|
* and adds aleph alpha specific utilities for tokens from the design sysstem.
|
|
18
29
|
*/
|
|
19
|
-
declare const
|
|
20
|
-
export default
|
|
21
|
-
export {
|
|
30
|
+
declare const presetsAlephAlpha: () => Preset<Theme>[];
|
|
31
|
+
export default presetsAlephAlpha;
|
|
32
|
+
export { presetsAlephAlpha }
|
|
22
33
|
|
|
23
34
|
export declare type Theme = {
|
|
24
|
-
colors?: Record<
|
|
25
|
-
spacing?: Record<
|
|
26
|
-
size?: Record<
|
|
27
|
-
boxShadow?: Record<
|
|
35
|
+
colors?: Record<keyof typeof default_2, string>;
|
|
36
|
+
spacing?: Record<keyof typeof default_3, string>;
|
|
37
|
+
size?: Record<keyof typeof default_3, string>;
|
|
38
|
+
boxShadow?: Record<keyof typeof default_4, string>;
|
|
28
39
|
};
|
|
29
40
|
|
|
41
|
+
/**
|
|
42
|
+
* This preset is used to add the aleph alpha specific utilities for tokens from the design system.
|
|
43
|
+
* Only the dark theme tokens are not included.
|
|
44
|
+
*/
|
|
45
|
+
export declare const tokenPreset: Preset<Theme>;
|
|
46
|
+
|
|
30
47
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePreset as w, presetWind as Z, presetTypography as O } from "unocss";
|
|
2
2
|
import R from "unocss-preset-theme";
|
|
3
3
|
function F(e) {
|
|
4
4
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -329,7 +329,7 @@ const re = {
|
|
|
329
329
|
px: G,
|
|
330
330
|
rem: B,
|
|
331
331
|
time: J
|
|
332
|
-
}, ie = M(re),
|
|
332
|
+
}, ie = M(re), l = ie, n = "--una", d = "una-in", b = "una-out";
|
|
333
333
|
function ae(e) {
|
|
334
334
|
return {
|
|
335
335
|
t: "top",
|
|
@@ -339,49 +339,49 @@ function ae(e) {
|
|
|
339
339
|
}[e ?? ""] ?? e;
|
|
340
340
|
}
|
|
341
341
|
function g(e, i) {
|
|
342
|
-
let r =
|
|
342
|
+
let r = l.cssvar.fraction.rem(e || ne);
|
|
343
343
|
return r ? (i = ae(i), !r.startsWith("var(--") && ["top", "left"].includes(i ?? "") && (r.startsWith("-") ? r = r.slice(1) : r !== "0" && (r = `-${r}`)), [r, i]) : [];
|
|
344
344
|
}
|
|
345
|
-
const y = "0", x = "0", h = "30deg", ne = "100%",
|
|
345
|
+
const y = "0", x = "0", h = "30deg", ne = "100%", m = "(t|b|l|r|top|bottom|left|right)", oe = [
|
|
346
346
|
[
|
|
347
347
|
/^fade-in(?:-(.+))?$/,
|
|
348
348
|
([, e]) => ({
|
|
349
|
-
[`${n}-enter-opacity`]:
|
|
349
|
+
[`${n}-enter-opacity`]: l.cssvar.percent(e || y)
|
|
350
350
|
}),
|
|
351
351
|
{ autocomplete: "fade-(in|out)-<percent>" }
|
|
352
352
|
],
|
|
353
353
|
[
|
|
354
354
|
/^fade-out(?:-(.+))?$/,
|
|
355
355
|
([, e]) => ({
|
|
356
|
-
[`${n}-exit-opacity`]:
|
|
356
|
+
[`${n}-exit-opacity`]: l.cssvar.percent(e || y)
|
|
357
357
|
})
|
|
358
358
|
]
|
|
359
359
|
], ce = [
|
|
360
360
|
[
|
|
361
361
|
/^zoom-in(?:-(.+))?$/,
|
|
362
362
|
([, e]) => ({
|
|
363
|
-
[`${n}-enter-scale`]:
|
|
363
|
+
[`${n}-enter-scale`]: l.cssvar.fraction.percent(e || x)
|
|
364
364
|
}),
|
|
365
365
|
{ autocomplete: "zoom-(in|out)-<percent>" }
|
|
366
366
|
],
|
|
367
367
|
[
|
|
368
368
|
/^zoom-out(?:-(.+))?$/,
|
|
369
369
|
([, e]) => ({
|
|
370
|
-
[`${n}-exit-scale`]:
|
|
370
|
+
[`${n}-exit-scale`]: l.cssvar.fraction.percent(e || x)
|
|
371
371
|
})
|
|
372
372
|
]
|
|
373
373
|
], fe = [
|
|
374
374
|
[
|
|
375
375
|
/^spin-in(?:-(.+))?$/,
|
|
376
376
|
([, e]) => ({
|
|
377
|
-
[`${n}-enter-rotate`]:
|
|
377
|
+
[`${n}-enter-rotate`]: l.cssvar.degree(e || h)
|
|
378
378
|
}),
|
|
379
379
|
{ autocomplete: "spin-(in|out)-<percent>" }
|
|
380
380
|
],
|
|
381
381
|
[
|
|
382
382
|
/^spin-out(?:-(.+))?$/,
|
|
383
383
|
([, e]) => ({
|
|
384
|
-
[`${n}-exit-rotate`]:
|
|
384
|
+
[`${n}-exit-rotate`]: l.cssvar.degree(e || h)
|
|
385
385
|
})
|
|
386
386
|
]
|
|
387
387
|
], se = [
|
|
@@ -403,10 +403,10 @@ const y = "0", x = "0", h = "30deg", ne = "100%", l = "(t|b|l|r|top|bottom|left|
|
|
|
403
403
|
},
|
|
404
404
|
{
|
|
405
405
|
autocomplete: [
|
|
406
|
-
`slide-(in|out)-${
|
|
407
|
-
`slide-(in|out)-${
|
|
408
|
-
`slide-in-from-${
|
|
409
|
-
`slide-in-from-${
|
|
406
|
+
`slide-(in|out)-${m}-<percent>`,
|
|
407
|
+
`slide-(in|out)-${m}-full`,
|
|
408
|
+
`slide-in-from-${m}-<percent>`,
|
|
409
|
+
`slide-in-from-${m}-full`
|
|
410
410
|
]
|
|
411
411
|
}
|
|
412
412
|
],
|
|
@@ -428,18 +428,18 @@ const y = "0", x = "0", h = "30deg", ne = "100%", l = "(t|b|l|r|top|bottom|left|
|
|
|
428
428
|
},
|
|
429
429
|
{
|
|
430
430
|
autocomplete: [
|
|
431
|
-
`slide-out-to-${
|
|
432
|
-
`slide-out-to-${
|
|
431
|
+
`slide-out-to-${m}-<percent>`,
|
|
432
|
+
`slide-out-to-${m}-full`
|
|
433
433
|
]
|
|
434
434
|
}
|
|
435
435
|
]
|
|
436
|
-
],
|
|
436
|
+
], le = [
|
|
437
437
|
...oe,
|
|
438
438
|
...ce,
|
|
439
439
|
...fe,
|
|
440
440
|
...se
|
|
441
441
|
];
|
|
442
|
-
function
|
|
442
|
+
function me(e) {
|
|
443
443
|
const { unit: i = "ms" } = e, r = (t) => {
|
|
444
444
|
var a;
|
|
445
445
|
return {
|
|
@@ -498,8 +498,8 @@ const Ae = {
|
|
|
498
498
|
name: "unocss-preset-animations",
|
|
499
499
|
theme: Ae,
|
|
500
500
|
layers: { "una-base": -999 },
|
|
501
|
-
shortcuts:
|
|
502
|
-
rules:
|
|
501
|
+
shortcuts: me(e),
|
|
502
|
+
rules: le
|
|
503
503
|
});
|
|
504
504
|
function be(e) {
|
|
505
505
|
return e.replace(/((?:rgb|hsl)a?)\(([^)]+)\)/g, (i, r, t) => {
|
|
@@ -919,20 +919,18 @@ const pe = (e = {}) => {
|
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
921
|
]
|
|
922
|
-
}), Ke = () => {
|
|
922
|
+
}), Ke = w(() => ({
|
|
923
|
+
name: "@aleph-alpha/uno-css-preset",
|
|
924
|
+
rules: [...Object.entries(Re), ["h-screen", { height: "100vh" }]],
|
|
925
|
+
theme: {
|
|
926
|
+
colors: ye,
|
|
927
|
+
spacing: q,
|
|
928
|
+
size: q,
|
|
929
|
+
boxShadow: ve
|
|
930
|
+
}
|
|
931
|
+
}))(), je = () => {
|
|
923
932
|
const e = [];
|
|
924
|
-
return e.push(
|
|
925
|
-
O(() => ({
|
|
926
|
-
name: "@aleph-alpha/uno-css-preset",
|
|
927
|
-
rules: [...Object.entries(Re), ["h-screen", { height: "100vh" }]],
|
|
928
|
-
theme: {
|
|
929
|
-
colors: ye,
|
|
930
|
-
spacing: q,
|
|
931
|
-
size: q,
|
|
932
|
-
boxShadow: ve
|
|
933
|
-
}
|
|
934
|
-
}))()
|
|
935
|
-
), e.push(
|
|
933
|
+
return e.push(Ke), e.push(
|
|
936
934
|
R({
|
|
937
935
|
theme: {
|
|
938
936
|
dark: { colors: ge }
|
|
@@ -943,12 +941,12 @@ const pe = (e = {}) => {
|
|
|
943
941
|
legacyColorSpace: !0
|
|
944
942
|
})
|
|
945
943
|
), e;
|
|
946
|
-
},
|
|
947
|
-
w(),
|
|
944
|
+
}, ke = [
|
|
948
945
|
Z(),
|
|
946
|
+
O(),
|
|
949
947
|
ze(),
|
|
950
948
|
de()
|
|
951
|
-
],
|
|
949
|
+
], Ne = je(), Be = () => [...ke, ...Ne], Ie = Be, Pe = (e) => {
|
|
952
950
|
const i = e === "vue" ? "node_modules/@aleph-alpha/ds-components-vue/**/*" : "node_modules/@aleph-alpha/ds-components-svelte/**/*";
|
|
953
951
|
return {
|
|
954
952
|
content: {
|
|
@@ -966,8 +964,11 @@ const pe = (e = {}) => {
|
|
|
966
964
|
};
|
|
967
965
|
};
|
|
968
966
|
export {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
967
|
+
ke as commonPresets,
|
|
968
|
+
je as createPresets,
|
|
969
|
+
Be as default,
|
|
970
|
+
Pe as getDesignSystemContentPathConfig,
|
|
971
|
+
Ie as presetAlephAlpha,
|
|
972
|
+
Be as presetsAlephAlpha,
|
|
973
|
+
Ke as tokenPreset
|
|
973
974
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/config-css",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"prettier": "@aleph-alpha/prettier-config-frontend",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@tokens-studio/sd-transforms": "1.3.0",
|
|
18
|
-
"@unocss/preset-legacy-compat": "66.1.
|
|
18
|
+
"@unocss/preset-legacy-compat": "66.1.1",
|
|
19
19
|
"token-transformer": "0.0.33",
|
|
20
20
|
"unocss": "^66.0.0",
|
|
21
21
|
"unocss-preset-animations": "1.2.1",
|
package/src/index.ts
CHANGED
|
@@ -9,30 +9,34 @@ import spacingsSet from '../sd-output/spacings.json';
|
|
|
9
9
|
import typographySet from '../sd-output/typography.json';
|
|
10
10
|
import { presetWebFontsAlephAlpha } from './presetWebFontsAlephAlpha';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
colors?: Record<
|
|
14
|
-
spacing?: Record<
|
|
15
|
-
size?: Record<
|
|
16
|
-
boxShadow?: Record<
|
|
12
|
+
type Theme = {
|
|
13
|
+
colors?: Record<keyof typeof lightModeSet, string>;
|
|
14
|
+
spacing?: Record<keyof typeof spacingsSet, string>;
|
|
15
|
+
size?: Record<keyof typeof spacingsSet, string>;
|
|
16
|
+
boxShadow?: Record<keyof typeof boxShadowsSet, string>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* This preset is used to add the aleph alpha specific utilities for tokens from the design system.
|
|
21
|
+
* Only the dark theme tokens are not included.
|
|
22
|
+
*/
|
|
23
|
+
const tokenPreset: Preset<Theme> = definePreset<Theme>(() => {
|
|
24
|
+
return {
|
|
25
|
+
name: '@aleph-alpha/uno-css-preset',
|
|
26
|
+
rules: [...Object.entries(typographySet), ['h-screen', { height: '100vh' }]],
|
|
27
|
+
theme: {
|
|
28
|
+
colors: lightModeSet,
|
|
29
|
+
spacing: spacingsSet,
|
|
30
|
+
size: spacingsSet,
|
|
31
|
+
boxShadow: boxShadowsSet,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
|
|
36
|
+
const createPresets = (): Preset<Theme>[] => {
|
|
20
37
|
const presets: Preset<Theme>[] = [];
|
|
21
38
|
|
|
22
|
-
presets.push(
|
|
23
|
-
definePreset<Theme>(() => {
|
|
24
|
-
return {
|
|
25
|
-
name: '@aleph-alpha/uno-css-preset',
|
|
26
|
-
rules: [...Object.entries(typographySet), ['h-screen', { height: '100vh' }]],
|
|
27
|
-
theme: {
|
|
28
|
-
colors: lightModeSet,
|
|
29
|
-
spacing: spacingsSet,
|
|
30
|
-
size: spacingsSet,
|
|
31
|
-
boxShadow: boxShadowsSet,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
})()
|
|
35
|
-
);
|
|
39
|
+
presets.push(tokenPreset);
|
|
36
40
|
|
|
37
41
|
presets.push(
|
|
38
42
|
presetTheme({
|
|
@@ -57,7 +61,6 @@ const commonPresets: Preset<Theme>[] = [
|
|
|
57
61
|
presetWebFontsAlephAlpha(),
|
|
58
62
|
presetAnimations(),
|
|
59
63
|
];
|
|
60
|
-
|
|
61
64
|
const presets = createPresets();
|
|
62
65
|
|
|
63
66
|
/**
|
|
@@ -65,11 +68,17 @@ const presets = createPresets();
|
|
|
65
68
|
* It uses the Windi CSS preset for UnoCSS.
|
|
66
69
|
* and adds aleph alpha specific utilities for tokens from the design sysstem.
|
|
67
70
|
*/
|
|
68
|
-
|
|
71
|
+
const presetsAlephAlpha = (): Preset<Theme>[] => {
|
|
69
72
|
return [...commonPresets, ...presets];
|
|
70
73
|
};
|
|
71
74
|
|
|
72
|
-
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Use `presetsAlephAlpha` instead.
|
|
77
|
+
* preset**S** is misleading since it's not a preset but a function that returns a list of presets.
|
|
78
|
+
*/
|
|
79
|
+
const presetAlephAlpha = presetsAlephAlpha;
|
|
80
|
+
|
|
81
|
+
const getDesignSystemContentPathConfig = (framework: 'vue' | 'svelte') => {
|
|
73
82
|
const moduleLocation =
|
|
74
83
|
framework === 'vue'
|
|
75
84
|
? 'node_modules/@aleph-alpha/ds-components-vue/**/*'
|
|
@@ -90,4 +99,13 @@ export const getDesignSystemContentPathConfig = (framework: 'vue' | 'svelte') =>
|
|
|
90
99
|
};
|
|
91
100
|
};
|
|
92
101
|
|
|
93
|
-
export
|
|
102
|
+
export {
|
|
103
|
+
type Theme,
|
|
104
|
+
tokenPreset,
|
|
105
|
+
commonPresets,
|
|
106
|
+
presetAlephAlpha,
|
|
107
|
+
presetsAlephAlpha,
|
|
108
|
+
getDesignSystemContentPathConfig,
|
|
109
|
+
createPresets,
|
|
110
|
+
};
|
|
111
|
+
export default presetsAlephAlpha;
|