@uniai-fe/uds-foundation 0.0.1

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.
@@ -0,0 +1,28 @@
1
+ import { ThemeTokens, ThemeTypographyCategory } from '../types/theme-tokens.js';
2
+
3
+ declare const tokens: ThemeTokens;
4
+ type ThemeColorPrimitiveKey = keyof typeof tokens.color.primitive;
5
+ declare function colorPrimitiveHex(key: ThemeColorPrimitiveKey): string;
6
+ declare function colorPrimitiveVar(key: ThemeColorPrimitiveKey): string;
7
+ type ThemeSpacingPaddingKey = keyof typeof tokens.spacing.padding;
8
+ type ThemeSpacingGapKey = keyof typeof tokens.spacing.gap;
9
+ declare function spacingPaddingPx(key: ThemeSpacingPaddingKey): number;
10
+ declare function spacingPaddingVar(key: ThemeSpacingPaddingKey): string;
11
+ declare function spacingGapPx(key: ThemeSpacingGapKey): number;
12
+ declare function spacingGapVar(key: ThemeSpacingGapKey): string;
13
+ type ThemeLayoutBreakpointKey = keyof typeof tokens.layout.breakpoint;
14
+ type ThemeLayoutSizeKey = keyof typeof tokens.layout.size;
15
+ type ThemeLayoutRadiusSizeKey = keyof typeof tokens.layout.radius.size;
16
+ type ThemeLayoutRadiusLevelKey = keyof typeof tokens.layout.radius.level;
17
+ declare function layoutBreakpointPx(key: ThemeLayoutBreakpointKey): number;
18
+ declare function layoutBreakpointVar(key: ThemeLayoutBreakpointKey): string;
19
+ declare function layoutSizePx(key: ThemeLayoutSizeKey): number;
20
+ declare function layoutSizeVar(key: ThemeLayoutSizeKey): string;
21
+ declare function layoutRadiusSizePx(key: ThemeLayoutRadiusSizeKey): number;
22
+ declare function layoutRadiusSizeVar(key: ThemeLayoutRadiusSizeKey): string;
23
+ declare function layoutRadiusLevelPx(key: ThemeLayoutRadiusLevelKey): number;
24
+ declare function layoutRadiusLevelVar(key: ThemeLayoutRadiusLevelKey): string;
25
+ type ThemeTypographyCategoryKey = keyof typeof tokens.typography;
26
+ declare function typographyVariants(category: ThemeTypographyCategoryKey): ThemeTypographyCategory;
27
+
28
+ export { type ThemeColorPrimitiveKey, type ThemeLayoutBreakpointKey, type ThemeLayoutRadiusLevelKey, type ThemeLayoutRadiusSizeKey, type ThemeLayoutSizeKey, type ThemeSpacingGapKey, type ThemeSpacingPaddingKey, type ThemeTypographyCategoryKey, colorPrimitiveHex, colorPrimitiveVar, layoutBreakpointPx, layoutBreakpointVar, layoutRadiusLevelPx, layoutRadiusLevelVar, layoutRadiusSizePx, layoutRadiusSizeVar, layoutSizePx, layoutSizeVar, spacingGapPx, spacingGapVar, spacingPaddingPx, spacingPaddingVar, typographyVariants };
@@ -0,0 +1,70 @@
1
+ import { themeTokens } from "../data/tokens.js";
2
+ const tokens = themeTokens;
3
+ const cssVar = (name) => `var(--${name})`;
4
+ const kebab = (value) => value.replace(/_/g, "-");
5
+ const dropPrefix = (value, prefix) => value.startsWith(`${prefix}_`) ? value.slice(prefix.length + 1) : value;
6
+ function colorPrimitiveHex(key) {
7
+ return tokens.color.primitive[key];
8
+ }
9
+ function colorPrimitiveVar(key) {
10
+ return cssVar(`color-${kebab(key)}`);
11
+ }
12
+ function spacingPaddingPx(key) {
13
+ return tokens.spacing.padding[key];
14
+ }
15
+ function spacingPaddingVar(key) {
16
+ const suffix = kebab(dropPrefix(key, "padding"));
17
+ return cssVar(`spacing-padding-${suffix}`);
18
+ }
19
+ function spacingGapPx(key) {
20
+ return tokens.spacing.gap[key];
21
+ }
22
+ function spacingGapVar(key) {
23
+ const suffix = kebab(dropPrefix(key, "gap"));
24
+ return cssVar(`spacing-gap-${suffix}`);
25
+ }
26
+ function layoutBreakpointPx(key) {
27
+ return tokens.layout.breakpoint[key];
28
+ }
29
+ function layoutBreakpointVar(key) {
30
+ return cssVar(`theme-breakpoint-${kebab(key)}-start`);
31
+ }
32
+ function layoutSizePx(key) {
33
+ return tokens.layout.size[key];
34
+ }
35
+ function layoutSizeVar(key) {
36
+ return cssVar(`theme-size-${kebab(key)}`);
37
+ }
38
+ function layoutRadiusSizePx(key) {
39
+ return tokens.layout.radius.size[key];
40
+ }
41
+ function layoutRadiusSizeVar(key) {
42
+ const suffix = kebab(dropPrefix(key, "size"));
43
+ return cssVar(`theme-radius-${suffix}`);
44
+ }
45
+ function layoutRadiusLevelPx(key) {
46
+ return tokens.layout.radius.level[key];
47
+ }
48
+ function layoutRadiusLevelVar(key) {
49
+ return cssVar(`theme-radius-${kebab(key)}`);
50
+ }
51
+ function typographyVariants(category) {
52
+ return tokens.typography[category];
53
+ }
54
+ export {
55
+ colorPrimitiveHex,
56
+ colorPrimitiveVar,
57
+ layoutBreakpointPx,
58
+ layoutBreakpointVar,
59
+ layoutRadiusLevelPx,
60
+ layoutRadiusLevelVar,
61
+ layoutRadiusSizePx,
62
+ layoutRadiusSizeVar,
63
+ layoutSizePx,
64
+ layoutSizeVar,
65
+ spacingGapPx,
66
+ spacingGapVar,
67
+ spacingPaddingPx,
68
+ spacingPaddingVar,
69
+ typographyVariants
70
+ };