@aziontech/theme 4.2.0 → 4.3.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.
Files changed (55) hide show
  1. package/README.md +110 -335
  2. package/dist/v4/globals.css +249 -72
  3. package/dist/v4/globals.scss +249 -72
  4. package/package.json +4 -13
  5. package/src/scripts/build-tokens.mjs +57 -7
  6. package/src/scripts/compile-primitives.js +9 -5
  7. package/src/scripts/compile-theme.js +12 -6
  8. package/src/scripts/refs.d.ts +1 -0
  9. package/src/scripts/refs.d.ts.map +1 -1
  10. package/src/scripts/refs.js +11 -0
  11. package/src/scripts/zero-unit.mjs +64 -0
  12. package/src/tokens/README.md +44 -29
  13. package/src/tokens/index.d.ts +0 -1
  14. package/src/tokens/index.js +0 -1
  15. package/src/tokens/primitives/animations/animate.d.ts +6 -0
  16. package/src/tokens/primitives/animations/animate.d.ts.map +1 -1
  17. package/src/tokens/primitives/animations/animate.js +14 -3
  18. package/src/tokens/primitives/animations/keyframes.d.ts +13 -1
  19. package/src/tokens/primitives/animations/keyframes.d.ts.map +1 -1
  20. package/src/tokens/primitives/animations/keyframes.js +23 -4
  21. package/src/tokens/primitives/colors/colors.d.ts +4 -0
  22. package/src/tokens/primitives/colors/colors.d.ts.map +1 -1
  23. package/src/tokens/primitives/colors/colors.js +9 -0
  24. package/src/tokens/primitives/shape/container.d.ts.map +1 -1
  25. package/src/tokens/primitives/shape/container.js +30 -13
  26. package/src/tokens/primitives/typography/leading.d.ts +1 -0
  27. package/src/tokens/primitives/typography/leading.js +1 -0
  28. package/src/tokens/primitives/typography/tracking.js +12 -6
  29. package/src/tokens/semantic/colors.js +5 -2
  30. package/src/tokens/semantic/layouts.data.d.ts +65 -0
  31. package/src/tokens/semantic/layouts.data.d.ts.map +1 -0
  32. package/src/tokens/semantic/layouts.data.js +282 -0
  33. package/src/tokens/semantic/texts.data.d.ts +28 -10
  34. package/src/tokens/semantic/texts.data.d.ts.map +1 -1
  35. package/src/tokens/semantic/texts.data.js +50 -30
  36. package/src/tokens/semantic/z-indices.data.d.ts +1 -1
  37. package/src/tokens/semantic/z-indices.data.js +1 -1
  38. package/src/tokens/theme/accent.js +18 -6
  39. package/src/tokens/theme/background.d.ts +12 -0
  40. package/src/tokens/theme/background.js +11 -2
  41. package/src/tokens/theme/border.js +26 -4
  42. package/src/tokens/theme/code-sintax.d.ts +6 -0
  43. package/src/tokens/theme/code-sintax.js +2 -0
  44. package/src/tokens/theme/feedback/info.js +2 -2
  45. package/src/tokens/theme/surfaces.d.ts +12 -0
  46. package/src/tokens/theme/surfaces.d.ts.map +1 -1
  47. package/src/tokens/theme/surfaces.js +4 -0
  48. package/src/tokens/theme/text.js +2 -2
  49. package/src/tokens/theme.d.ts +4 -0
  50. package/src/scripts/css-vars.d.ts +0 -7
  51. package/src/scripts/css-vars.d.ts.map +0 -1
  52. package/src/scripts/css-vars.js +0 -46
  53. package/src/scripts/resolve.d.ts +0 -5
  54. package/src/scripts/resolve.d.ts.map +0 -1
  55. package/src/scripts/resolve.js +0 -107
@@ -15,10 +15,12 @@
15
15
  * old `mobile` (default, applied >768) → `md` (≥768)
16
16
  */
17
17
 
18
+ import { curve, duration } from '../primitives/animations/animate.js'
18
19
  import { fontFamily } from '../primitives/typography/font-family.js'
19
20
  import { fontSize } from '../primitives/typography/font-size.js'
20
21
  import { fontWeight } from '../primitives/typography/font-weight.js'
21
22
  import { leading } from '../primitives/typography/leading.js'
23
+ import { tracking } from '../primitives/typography/tracking.js'
22
24
 
23
25
  export const textsData = {
24
26
  'text-big-number-md': {
@@ -77,88 +79,106 @@ export const textsData = {
77
79
  'text-label-lg': {
78
80
  fontSize: fontSize.base,
79
81
  lineHeight: leading.normal,
80
- fontWeight: fontWeight.medium
82
+ fontWeight: fontWeight.normal
81
83
  },
82
84
  'text-label-md': {
83
85
  fontSize: fontSize.sm,
84
86
  lineHeight: leading.normal,
85
- fontWeight: fontWeight.medium
87
+ fontWeight: fontWeight.normal
86
88
  },
87
89
  'text-label-sm': {
88
90
  fontSize: fontSize.xs,
89
91
  lineHeight: leading.normal,
90
- fontWeight: fontWeight.medium
92
+ fontWeight: fontWeight.normal
91
93
  },
92
94
  'text-label-code-sm': {
93
95
  fontFamily: fontFamily.code,
94
- fontSize: '0.75rem',
95
- lineHeight: '1',
96
- fontWeight: '400',
97
- letterSpacing: '0'
96
+ fontSize: fontSize.xs,
97
+ lineHeight: leading.none,
98
+ fontWeight: fontWeight.normal,
99
+ letterSpacing: tracking.normal
100
+ },
101
+ 'text-body-code-sm': {
102
+ textWrapStyle: 'pretty',
103
+ fontFamily: fontFamily.code,
104
+ fontSize: fontSize.xs,
105
+ lineHeight: leading.relaxed,
106
+ fontWeight: fontWeight.normal,
107
+ letterSpacing: tracking.normal
98
108
  },
99
109
  'text-label-code-md': {
100
110
  fontFamily: fontFamily.code,
101
- fontSize: '0.875rem',
102
- lineHeight: '1',
103
- fontWeight: '400',
104
- letterSpacing: '0'
111
+ fontSize: fontSize.sm,
112
+ lineHeight: leading.none,
113
+ fontWeight: fontWeight.normal,
114
+ letterSpacing: tracking.normal
105
115
  },
106
116
  'text-label-code-lg': {
107
117
  fontFamily: fontFamily.code,
108
- fontSize: '1rem',
109
- lineHeight: '1',
110
- fontWeight: '400',
111
- letterSpacing: '0'
118
+ fontSize: fontSize.base,
119
+ lineHeight: leading.none,
120
+ fontWeight: fontWeight.normal,
121
+ letterSpacing: tracking.normal
112
122
  },
113
123
  'text-body-lg': {
114
124
  fontSize: { _: fontSize.base, md: fontSize.lg },
115
- lineHeight: leading.normal
125
+ fontWeight: fontWeight.normal,
126
+ lineHeight: leading.snug
116
127
  },
117
128
  'text-body-md': {
118
129
  fontSize: fontSize.base,
119
- lineHeight: leading.normal
130
+ fontWeight: fontWeight.normal,
131
+ lineHeight: leading.snug
132
+ },
133
+ 'text-body-prose-md': {
134
+ fontSize: fontSize.base,
135
+ fontWeight: fontWeight.normal,
136
+ lineHeight: leading.relaxed
120
137
  },
121
138
  'text-body-sm': {
122
139
  fontSize: fontSize.sm,
123
- lineHeight: leading.normal
140
+ fontWeight: fontWeight.normal,
141
+ lineHeight: leading.snug
124
142
  },
125
143
  'text-body-xs': {
126
144
  fontSize: fontSize.xs,
145
+ fontWeight: fontWeight.normal,
146
+ lineHeight: leading.snug
147
+ },
148
+ 'text-body-xxs': {
149
+ fontSize: fontSize.xs,
150
+ fontWeight: fontWeight.normal,
127
151
  lineHeight: leading.normal
128
152
  },
129
153
  'text-tag-sm': {
130
154
  fontSize: fontSize.xs,
131
155
  lineHeight: leading.tight,
132
- fontWeight: fontWeight.semibold
156
+ fontWeight: fontWeight.normal
133
157
  },
134
158
  'text-tag-md': {
135
159
  fontSize: fontSize.xs,
136
160
  lineHeight: leading.tight,
137
- fontWeight: fontWeight.semibold
138
- },
139
- 'text-body-xxs': {
140
- fontSize: fontSize.xs,
141
- lineHeight: leading.normal
161
+ fontWeight: fontWeight.normal
142
162
  },
143
163
  'text-overline-md': {
144
164
  fontFamily: fontFamily.display,
145
165
  fontSize: { _: fontSize.xs, sm: fontSize.sm },
146
166
  lineHeight: leading.snug,
147
- letterSpacing: '0.08em',
167
+ letterSpacing: tracking.widest,
148
168
  textTransform: 'uppercase'
149
169
  },
150
170
  'text-overline-sm': {
151
171
  fontFamily: fontFamily.display,
152
172
  fontSize: fontSize.xs,
153
173
  lineHeight: leading.snug,
154
- letterSpacing: '0.08em',
174
+ letterSpacing: tracking.widest,
155
175
  textTransform: 'uppercase'
156
176
  },
157
177
  'text-overline-xs': {
158
178
  fontFamily: fontFamily.display,
159
179
  fontSize: fontSize.xs,
160
180
  lineHeight: leading.snug,
161
- letterSpacing: '0.08em',
181
+ letterSpacing: tracking.widest,
162
182
  textTransform: 'uppercase'
163
183
  },
164
184
  'text-button-lg': {
@@ -166,14 +186,14 @@ export const textsData = {
166
186
  fontSize: fontSize.sm,
167
187
  fontWeight: fontWeight.normal,
168
188
  lineHeight: leading.tight,
169
- letterSpacing: '0'
189
+ letterSpacing: tracking.normal
170
190
  },
171
191
  'text-button-md': {
172
192
  fontFamily: fontFamily.sans,
173
193
  fontSize: fontSize.xs,
174
194
  fontWeight: fontWeight.normal,
175
195
  lineHeight: leading.tight,
176
- letterSpacing: '0'
196
+ letterSpacing: tracking.normal
177
197
  },
178
198
  /** Inline `<a>` in body/heading — inherits parent size; not the navigation Link component. */
179
199
  'text-link': {
@@ -181,7 +201,7 @@ export const textsData = {
181
201
  lineHeight: 'inherit',
182
202
  color: 'var(--text-link)',
183
203
  borderRadius: 'var(--shape-elements)',
184
- transition: 'all 110ms cubic-bezier(0.39, 0.57, 0.56, 1)',
204
+ transition: `all ${duration['fast-02']} ${curve['productive-entrance']}`,
185
205
  states: {
186
206
  hover: {
187
207
  color: 'var(--text-link-hover)',
@@ -17,7 +17,7 @@
17
17
  * such as drawers, modals, and fixed headers.
18
18
  *
19
19
  * Values are intentionally small and well-spaced to make future additions
20
- * obvious. Consume as `z-[var(--z-input-*)]` in components — do not
20
+ * obvious. Consume as `z-(--z-input-*)` in components — do not
21
21
  * introduce ad-hoc numeric z-index in input `.vue` files.
22
22
  */
23
23
  export const zIndicesData: {
@@ -17,7 +17,7 @@
17
17
  * such as drawers, modals, and fixed headers.
18
18
  *
19
19
  * Values are intentionally small and well-spaced to make future additions
20
- * obvious. Consume as `z-[var(--z-input-*)]` in components — do not
20
+ * obvious. Consume as `z-(--z-input-*)` in components — do not
21
21
  * introduce ad-hoc numeric z-index in input `.vue` files.
22
22
  */
23
23
 
@@ -1,16 +1,28 @@
1
1
  import { tokenRef } from '../../scripts/refs.js'
2
2
 
3
+ // The accent family points at the BLUE primitive ramp (`primitives.blue`, the
4
+ // #0072F5 hue). These values mirror the Figma Theme collection's `accent/*`
5
+ // variables 1-to-1 — Figma is the source of truth, and it already aliases its
6
+ // whole `colors/brand/accent/accent-*` ramp onto `colors/blue/*` (it carries no
7
+ // violet primitives at all). The violet mapping this replaces existed only here.
8
+ //
9
+ // Accent is MODE-INVARIANT, exactly as Figma declares it: Light and Dark resolve
10
+ // to the same values. `accent-contrast` stays black — black on blue-500 is
11
+ // 4.73:1, clearing WCAG AA on the filled accent surface.
12
+ //
13
+ // `brand.accent` still holds violet values in code and ships as
14
+ // `--color-brand-accent-*`; only the semantic `--accent*` group turns blue here.
3
15
  export const accent = {
4
16
  light: {
5
- accent: tokenRef('brand.accent.accent-600'),
6
- 'accent-mask': tokenRef('primitives.alpha.violet.50'),
7
- 'accent-selected': tokenRef('brand.accent.accent-500'),
17
+ accent: tokenRef('primitives.blue.500'),
18
+ 'accent-mask': tokenRef('primitives.alpha.blue.100'),
19
+ 'accent-selected': tokenRef('primitives.blue.500'),
8
20
  'accent-contrast': tokenRef('primitives.base.black')
9
21
  },
10
22
  dark: {
11
- accent: tokenRef('brand.accent.accent-500'),
12
- 'accent-mask': tokenRef('primitives.alpha.violet.100'),
13
- 'accent-selected': tokenRef('brand.accent.accent-500'),
23
+ accent: tokenRef('primitives.blue.500'),
24
+ 'accent-mask': tokenRef('primitives.alpha.blue.100'),
25
+ 'accent-selected': tokenRef('primitives.blue.500'),
14
26
  'accent-contrast': tokenRef('primitives.base.black')
15
27
  }
16
28
  }
@@ -15,6 +15,12 @@ export namespace background {
15
15
  'bg-surface-overlay': {
16
16
  __ref: any;
17
17
  };
18
+ 'bg-placeholder': {
19
+ __ref: any;
20
+ };
21
+ 'bg-placeholder-highlight': {
22
+ __ref: any;
23
+ };
18
24
  'bg-hover': {
19
25
  __ref: any;
20
26
  };
@@ -50,6 +56,12 @@ export namespace background {
50
56
  'bg-surface-overlay': {
51
57
  __ref: any;
52
58
  };
59
+ 'bg-placeholder': {
60
+ __ref: any;
61
+ };
62
+ 'bg-placeholder-highlight': {
63
+ __ref: any;
64
+ };
53
65
  'bg-hover': {
54
66
  __ref: any;
55
67
  };
@@ -7,6 +7,8 @@ export const background = {
7
7
  'bg-surface-raised': tokenRef('theme.surfaces.surface-0'),
8
8
  'bg-mask': tokenRef('primitives.alpha.black.50'),
9
9
  'bg-surface-overlay': tokenRef('theme.surfaces.surface-50'),
10
+ 'bg-placeholder': tokenRef('primitives.alpha.black.100'),
11
+ 'bg-placeholder-highlight': tokenRef('primitives.alpha.white.600'),
10
12
  'bg-hover': tokenRef('primitives.alpha.black.100'),
11
13
  'bg-active': tokenRef('primitives.alpha.black.50'),
12
14
  'bg-backdrop': tokenRef('primitives.alpha.black.800'),
@@ -20,8 +22,15 @@ export const background = {
20
22
  'bg-surface-raised': tokenRef('theme.surfaces.surface-900'),
21
23
  'bg-mask': tokenRef('primitives.alpha.white.50'),
22
24
  'bg-surface-overlay': tokenRef('theme.surfaces.surface-700'),
23
- 'bg-hover': tokenRef('primitives.alpha.black.200'),
24
- 'bg-active': tokenRef('primitives.alpha.black.100'),
25
+ 'bg-placeholder': tokenRef('primitives.alpha.white.100'),
26
+ 'bg-placeholder-highlight': tokenRef('primitives.alpha.white.100'),
27
+ // Interaction overlays LIGHTEN in dark. A black alpha over a dark surface is invisible
28
+ // (and a literal no-op over `bg-canvas`, which is pure black), so hover/active follow the
29
+ // same polarity flip `bg-mask` / `bg-placeholder` / `border-default` already make here.
30
+ // `active` stacks on top of `hover` (the row paints both layers while pressed), so it is
31
+ // the smaller increment, mirroring light's 8% + 2%.
32
+ 'bg-hover': tokenRef('primitives.alpha.white.100'),
33
+ 'bg-active': tokenRef('primitives.alpha.white.50'),
25
34
  'bg-backdrop': tokenRef('primitives.alpha.black.800'),
26
35
  'bg-selected': tokenRef('theme.surfaces.surface-800'),
27
36
  'bg-contrast': tokenRef('theme.surfaces.surface-50'),
@@ -1,15 +1,37 @@
1
1
  import { tokenRef } from '../../scripts/refs.js'
2
2
 
3
+ // The neutral rules are OPAQUE steps of the surface palette, not alpha.
4
+ //
5
+ // They used to be `alpha.black.100` / `alpha.white.100` / `alpha.white.50`, which meant one
6
+ // token painted a different colour on every backdrop — the same hairline read four different
7
+ // ways across canvas / surface / raised / overlay — and two rules meeting composited into a
8
+ // brighter line, so any stacked or abutting border doubled. An opaque step gives a rule one
9
+ // identity wherever it is drawn, and makes overlap a no-op.
10
+ //
11
+ // The steps are ones added to fill the ramp's gaps (`gray.150` / `gray.250` / `gray.750` /
12
+ // `gray.775`), NOT the steps that bracket them — `surface-200` (light) and `surface-800` (dark)
13
+ // are what `--bg-selected` and `--bg-disabled` already use, so a border drawn there is exactly
14
+ // its own fill and vanishes. Every pairing a component can produce now clears zero:
15
+ // light default surface-250 vs canvas 32 · surface 37 · selected/disabled 11
16
+ // light muted surface-150 vs canvas 14 · surface 19 · selected/disabled 7
17
+ // dark default surface-750 vs canvas 43 · surface 33 · raised 23 · selected 17
18
+ // dark muted surface-775 vs canvas 36 · surface 26 · raised 16 · selected 10
19
+ //
20
+ // `muted` sits closer to the background than `default` in BOTH themes — lighter in light,
21
+ // darker in dark. It is a subtler rule, not a second default; it is drawn on `--bg-surface` /
22
+ // `--bg-canvas` (the segmented-button track, the tab-view list, a flow node), never on a
23
+ // selected or disabled fill, which is what lets the light step go as light as it does. Dark
24
+ // cannot go proportionally as subtle: `--bg-surface-raised` sits at 20 and would swallow it.
3
25
  export const border = {
4
26
  light: {
5
- 'border-default': tokenRef('primitives.alpha.black.100'),
6
- 'border-muted': tokenRef('primitives.alpha.black.100'),
27
+ 'border-default': tokenRef('theme.surfaces.surface-250'),
28
+ 'border-muted': tokenRef('theme.surfaces.surface-150'),
7
29
  'border-strong': tokenRef('primitives.base.black'),
8
30
  'border-selected': tokenRef('brand.primary.primary-500')
9
31
  },
10
32
  dark: {
11
- 'border-default': tokenRef('primitives.alpha.white.100'),
12
- 'border-muted': tokenRef('primitives.alpha.white.50'),
33
+ 'border-default': tokenRef('theme.surfaces.surface-750'),
34
+ 'border-muted': tokenRef('theme.surfaces.surface-775'),
13
35
  'border-strong': tokenRef('primitives.base.white'),
14
36
  'border-selected': tokenRef('brand.primary.primary-500')
15
37
  }
@@ -12,6 +12,9 @@ export namespace codeSintax {
12
12
  'code-sintax-punctuation': {
13
13
  __ref: any;
14
14
  };
15
+ 'code-sintax-comment': {
16
+ __ref: any;
17
+ };
15
18
  'code-sintax-function': {
16
19
  __ref: any;
17
20
  };
@@ -35,6 +38,9 @@ export namespace codeSintax {
35
38
  'code-sintax-punctuation': {
36
39
  __ref: any;
37
40
  };
41
+ 'code-sintax-comment': {
42
+ __ref: any;
43
+ };
38
44
  'code-sintax-function': {
39
45
  __ref: any;
40
46
  };
@@ -10,6 +10,7 @@ export const codeSintax = {
10
10
  'code-sintax-line-number': tokenRef('primitives.gray.500'),
11
11
  'code-sintax-keyword': tokenRef('primitives.blue.600'),
12
12
  'code-sintax-punctuation': tokenRef('primitives.gray.500'),
13
+ 'code-sintax-comment': tokenRef('primitives.gray.500'),
13
14
  'code-sintax-function': tokenRef('brand.primary.primary-500'),
14
15
  'code-sintax-type': tokenRef('primitives.yellow.700'),
15
16
  'code-sintax-string': tokenRef('primitives.blue.600')
@@ -19,6 +20,7 @@ export const codeSintax = {
19
20
  'code-sintax-line-number': tokenRef('primitives.gray.400'),
20
21
  'code-sintax-keyword': tokenRef('primitives.blue.400'),
21
22
  'code-sintax-punctuation': tokenRef('primitives.gray.400'),
23
+ 'code-sintax-comment': tokenRef('primitives.gray.400'),
22
24
  'code-sintax-function': tokenRef('brand.primary.primary-500'),
23
25
  'code-sintax-type': tokenRef('primitives.yellow.300'),
24
26
  'code-sintax-string': tokenRef('primitives.blue.400')
@@ -3,12 +3,12 @@ import { tokenRef } from '../../../scripts/refs.js'
3
3
  export const info = {
4
4
  light: {
5
5
  info: tokenRef('primitives.blue.100'),
6
- 'info-border': tokenRef('primitives.alpha.violet.400'),
6
+ 'info-border': tokenRef('primitives.alpha.blue.400'),
7
7
  'info-contrast': tokenRef('primitives.blue.700')
8
8
  },
9
9
  dark: {
10
10
  info: tokenRef('primitives.blue.900'),
11
- 'info-border': tokenRef('primitives.alpha.blue.500'),
11
+ 'info-border': tokenRef('primitives.alpha.blue.400'),
12
12
  'info-contrast': tokenRef('primitives.blue.300')
13
13
  }
14
14
  }
@@ -16,9 +16,15 @@ declare const shared: {
16
16
  'surface-100': {
17
17
  __ref: any;
18
18
  };
19
+ 'surface-150': {
20
+ __ref: any;
21
+ };
19
22
  'surface-200': {
20
23
  __ref: any;
21
24
  };
25
+ 'surface-250': {
26
+ __ref: any;
27
+ };
22
28
  'surface-300': {
23
29
  __ref: any;
24
30
  };
@@ -34,6 +40,12 @@ declare const shared: {
34
40
  'surface-700': {
35
41
  __ref: any;
36
42
  };
43
+ 'surface-750': {
44
+ __ref: any;
45
+ };
46
+ 'surface-775': {
47
+ __ref: any;
48
+ };
37
49
  'surface-800': {
38
50
  __ref: any;
39
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["surfaces.js"],"names":[],"mappings":";;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaC"}
1
+ {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["surfaces.js"],"names":[],"mappings":";;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBC"}
@@ -4,12 +4,16 @@ const shared = {
4
4
  'surface-0': tokenRef('primitives.base.white'),
5
5
  'surface-50': tokenRef('primitives.gray.50'),
6
6
  'surface-100': tokenRef('primitives.gray.100'),
7
+ 'surface-150': tokenRef('primitives.gray.150'),
7
8
  'surface-200': tokenRef('primitives.gray.200'),
9
+ 'surface-250': tokenRef('primitives.gray.250'),
8
10
  'surface-300': tokenRef('primitives.gray.300'),
9
11
  'surface-400': tokenRef('primitives.gray.400'),
10
12
  'surface-500': tokenRef('primitives.gray.500'),
11
13
  'surface-600': tokenRef('primitives.gray.600'),
12
14
  'surface-700': tokenRef('primitives.gray.700'),
15
+ 'surface-750': tokenRef('primitives.gray.750'),
16
+ 'surface-775': tokenRef('primitives.gray.775'),
13
17
  'surface-800': tokenRef('primitives.gray.800'),
14
18
  'surface-900': tokenRef('primitives.gray.900'),
15
19
  'surface-950': tokenRef('primitives.gray.950')
@@ -3,7 +3,7 @@ import { tokenRef } from '../../scripts/refs.js'
3
3
  export const text = {
4
4
  light: {
5
5
  'text-default': tokenRef('primitives.gray.900'),
6
- 'text-muted': tokenRef('primitives.gray.600'),
6
+ 'text-muted': tokenRef('primitives.gray.500'),
7
7
  'text-disabled': tokenRef('primitives.gray.400'),
8
8
  'text-link': tokenRef('primitives.blue.600'),
9
9
  'text-link-hover': tokenRef('primitives.blue.700'),
@@ -11,7 +11,7 @@ export const text = {
11
11
  },
12
12
  dark: {
13
13
  'text-default': tokenRef('primitives.gray.50'),
14
- 'text-muted': tokenRef('primitives.gray.400'),
14
+ 'text-muted': tokenRef('primitives.gray.500'),
15
15
  'text-disabled': tokenRef('primitives.gray.700'),
16
16
  'text-link': tokenRef('primitives.blue.400'),
17
17
  'text-link-hover': tokenRef('primitives.blue.300'),
@@ -77,12 +77,16 @@ export namespace theme {
77
77
  let gray: {
78
78
  50: string;
79
79
  100: string;
80
+ 150: string;
80
81
  200: string;
82
+ 250: string;
81
83
  300: string;
82
84
  400: string;
83
85
  500: string;
84
86
  600: string;
85
87
  700: string;
88
+ 750: string;
89
+ 775: string;
86
90
  800: string;
87
91
  900: string;
88
92
  950: string;
@@ -1,7 +0,0 @@
1
- export function createCssVars(): {
2
- light: {};
3
- dark: {};
4
- };
5
- export function cssVarsString(): string;
6
- export function injectCssVars(): HTMLStyleElement;
7
- //# sourceMappingURL=css-vars.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"css-vars.d.ts","sourceRoot":"","sources":["css-vars.js"],"names":[],"mappings":"AAgBO;;;EAQH;AAEG,wCAWN;AAEM,kDAMN"}
@@ -1,46 +0,0 @@
1
- /**
2
- * CSS variables initializer for semantic tokens.
3
- *
4
- * Reads the single source-of-truth in `tokens/semantic/colors.js` and resolves
5
- * its `tokenRef(...)` entries against the primitive trees, producing a flat
6
- * `{ light, dark }` map of CSS variable names → resolved color values.
7
- */
8
-
9
- import {
10
- brandPrimitives,
11
- primitives,
12
- surfacePrimitives
13
- } from '../tokens/primitives/colors/colors.js'
14
- import { semanticColorsData } from '../tokens/semantic/colors.js'
15
- import { resolveRefsToCssVars } from './resolve.js'
16
-
17
- export const createCssVars = () =>
18
- resolveRefsToCssVars({
19
- primitives,
20
- surfacePrimitives,
21
- brandPrimitives,
22
- textSemantic: semanticColorsData.text,
23
- backgroundSemantic: semanticColorsData.background,
24
- borderSemantic: semanticColorsData.border
25
- })
26
-
27
- export const cssVarsString = () => {
28
- const { light, dark } = createCssVars()
29
- const format = (vars) =>
30
- Object.entries(vars)
31
- .map(([key, value]) => ` ${key}: ${value};`)
32
- .join('\n')
33
-
34
- return [
35
- `:root, [data-theme=light], .azion.azion-light {\n${format(light)}\n}`,
36
- `[data-theme=dark], .dark, .azion.azion-dark {\n${format(dark)}\n}`
37
- ].join('\n\n')
38
- }
39
-
40
- export const injectCssVars = () => {
41
- const style = document.createElement('style')
42
- style.setAttribute('data-azion-tokens', 'true')
43
- style.textContent = cssVarsString()
44
- document.head.appendChild(style)
45
- return style
46
- }
@@ -1,5 +0,0 @@
1
- export function resolveRefsToCssVars(tokens: any): {
2
- light: {};
3
- dark: {};
4
- };
5
- //# sourceMappingURL=resolve.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["resolve.js"],"names":[],"mappings":"AAiCO;;;EAyEN"}
@@ -1,107 +0,0 @@
1
- /**
2
- * Resolve token refs to CSS variable map.
3
- */
4
-
5
- import { isTokenRef } from './refs.js'
6
-
7
- const getValueByPath = (obj, path) =>
8
- path.split('.').reduce((acc, key) => {
9
- if (acc && typeof acc === 'object' && key in acc) {
10
- return acc[key]
11
- }
12
- return undefined
13
- }, obj)
14
-
15
- const flattenToCssVars = (obj, prefix = []) => {
16
- const result = {}
17
- Object.entries(obj).forEach(([key, value]) => {
18
- const nextPath = [...prefix, key]
19
- if (value && typeof value === 'object' && !Array.isArray(value) && !isTokenRef(value)) {
20
- Object.assign(result, flattenToCssVars(value, nextPath))
21
- return
22
- }
23
- if (isTokenRef(value)) {
24
- result[`--${nextPath.join('-')}`] = value.__ref
25
- return
26
- }
27
- if (typeof value === 'string' || typeof value === 'number') {
28
- result[`--${nextPath.join('-')}`] = String(value)
29
- }
30
- })
31
- return result
32
- }
33
-
34
- export const resolveRefsToCssVars = (tokens) => {
35
- const baseForResolve = {
36
- primitives: tokens.primitives,
37
- surfacePrimitives: tokens.surfacePrimitives,
38
- brandPrimitives: tokens.brandPrimitives
39
- }
40
-
41
- const baseForVars = { primitives: tokens.primitives, surfacePrimitives: tokens.surfacePrimitives }
42
-
43
- const lightSemantic = {
44
- text: tokens.textSemantic.light,
45
- background: tokens.backgroundSemantic.light,
46
- border: tokens.borderSemantic.light
47
- }
48
- const darkSemantic = {
49
- text: tokens.textSemantic.dark,
50
- background: tokens.backgroundSemantic.dark,
51
- border: tokens.borderSemantic.dark
52
- }
53
-
54
- const resolveBrandRef = (ref) => {
55
- if (ref.startsWith('brand.surfaces.surface-')) {
56
- const shade = ref.replace('brand.surfaces.surface-', '')
57
- const resolved = getValueByPath(baseForResolve, `surfacePrimitives.surface.${shade}`)
58
- return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null
59
- }
60
- if (ref.startsWith('brand.primary.primary-')) {
61
- const shade = ref.replace('brand.primary.primary-', '')
62
- const resolved = getValueByPath(baseForResolve, `brandPrimitives.primary.${shade}`)
63
- return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null
64
- }
65
- if (ref.startsWith('brand.accent.accent-')) {
66
- const shade = ref.replace('brand.accent.accent-', '')
67
- const resolved = getValueByPath(baseForResolve, `brandPrimitives.accent.${shade}`)
68
- return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null
69
- }
70
- if (ref.startsWith('brand.absolute.')) {
71
- const name = ref.replace('brand.absolute.', '')
72
- const resolved = getValueByPath(baseForResolve, `brandPrimitives.absolute.${name}`)
73
- return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null
74
- }
75
- return null
76
- }
77
-
78
- const resolveSemantic = (semantic) => {
79
- const flattened = flattenToCssVars(semantic)
80
- return Object.fromEntries(
81
- Object.entries(flattened).map(([key, value]) => {
82
- if (value.startsWith('brand.')) {
83
- return [key, resolveBrandRef(value) ?? value]
84
- }
85
- if (value.startsWith('primitives.') || value.startsWith('surfacePrimitives.')) {
86
- const resolved = getValueByPath(baseForResolve, value)
87
- return [
88
- key,
89
- typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : value
90
- ]
91
- }
92
- return [key, value]
93
- })
94
- )
95
- }
96
-
97
- return {
98
- light: {
99
- ...flattenToCssVars(baseForVars),
100
- ...resolveSemantic(lightSemantic)
101
- },
102
- dark: {
103
- ...flattenToCssVars(baseForVars),
104
- ...resolveSemantic(darkSemantic)
105
- }
106
- }
107
- }