@aziontech/theme 2.5.0 → 4.0.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/README.md +73 -66
- package/dist/v4/globals.css +799 -79
- package/dist/v4/globals.scss +799 -79
- package/package.json +6 -23
- package/src/scripts/build-tokens.mjs +197 -230
- package/src/scripts/compile-primitives.js +79 -79
- package/src/scripts/compile-theme.js +70 -63
- package/src/scripts/css-vars.d.ts.map +1 -1
- package/src/scripts/css-vars.js +20 -16
- package/src/scripts/refs.js +2 -2
- package/src/scripts/resolve.d.ts.map +1 -1
- package/src/scripts/resolve.js +50 -47
- package/src/tokens/README.md +53 -74
- package/src/tokens/index.js +5 -5
- package/src/tokens/primitives/animations/animate.d.ts +10 -0
- package/src/tokens/primitives/animations/animate.d.ts.map +1 -1
- package/src/tokens/primitives/animations/animate.js +15 -5
- package/src/tokens/primitives/animations/ease.d.ts.map +1 -1
- package/src/tokens/primitives/animations/ease.js +3 -3
- package/src/tokens/primitives/animations/keyframes.d.ts +63 -0
- package/src/tokens/primitives/animations/keyframes.d.ts.map +1 -0
- package/src/tokens/primitives/animations/keyframes.js +69 -0
- package/src/tokens/primitives/border-widths.d.ts.map +1 -1
- package/src/tokens/primitives/border-widths.js +3 -3
- package/src/tokens/primitives/breakpoints.d.ts.map +1 -1
- package/src/tokens/primitives/breakpoints.js +3 -3
- package/src/tokens/primitives/colors/alpha.d.ts +80 -80
- package/src/tokens/primitives/colors/alpha.js +84 -84
- package/src/tokens/primitives/colors/brand.d.ts +22 -22
- package/src/tokens/primitives/colors/brand.js +28 -28
- package/src/tokens/primitives/colors/colors.d.ts +88 -88
- package/src/tokens/primitives/colors/colors.js +107 -107
- package/src/tokens/primitives/effects/blur.d.ts.map +1 -1
- package/src/tokens/primitives/effects/blur.js +3 -3
- package/src/tokens/primitives/effects/drop-shadow.d.ts.map +1 -1
- package/src/tokens/primitives/effects/drop-shadow.js +3 -3
- package/src/tokens/primitives/effects/inset-shadow.d.ts.map +1 -1
- package/src/tokens/primitives/effects/inset-shadow.js +3 -3
- package/src/tokens/primitives/effects/opacity.d.ts.map +1 -1
- package/src/tokens/primitives/effects/opacity.js +3 -3
- package/src/tokens/primitives/effects/perspective.js +3 -3
- package/src/tokens/primitives/effects/shadow.d.ts.map +1 -1
- package/src/tokens/primitives/effects/shadow.js +3 -3
- package/src/{azion/_fonts.scss → tokens/primitives/fonts.css} +19 -4
- package/src/tokens/primitives/ring-offset.d.ts.map +1 -1
- package/src/tokens/primitives/ring-offset.js +3 -3
- package/src/tokens/primitives/shape/aspect-video.d.ts.map +1 -1
- package/src/tokens/primitives/shape/aspect-video.js +2 -2
- package/src/tokens/primitives/shape/container.d.ts.map +1 -1
- package/src/tokens/primitives/shape/container.js +3 -3
- package/src/tokens/primitives/shape/height.d.ts.map +1 -1
- package/src/tokens/primitives/shape/height.js +3 -3
- package/src/tokens/primitives/shape/radius.d.ts.map +1 -1
- package/src/tokens/primitives/shape/radius.js +3 -3
- package/src/tokens/primitives/shape/size.d.ts.map +1 -1
- package/src/tokens/primitives/shape/size.js +3 -3
- package/src/tokens/primitives/shape/spacing.d.ts.map +1 -1
- package/src/tokens/primitives/shape/spacing.js +3 -3
- package/src/tokens/primitives/shape/width.d.ts.map +1 -1
- package/src/tokens/primitives/shape/width.js +4 -4
- package/src/tokens/primitives/typography/font-size.d.ts.map +1 -1
- package/src/tokens/primitives/typography/font-size.js +4 -4
- package/src/tokens/primitives/typography/font-weight.js +3 -3
- package/src/tokens/primitives/typography/leading.js +3 -3
- package/src/tokens/primitives/typography/line-height.d.ts.map +1 -1
- package/src/tokens/primitives/typography/line-height.js +3 -3
- package/src/tokens/primitives/typography/tracking.js +3 -3
- package/src/tokens/semantic/colors.js +17 -17
- package/src/tokens/semantic/containers.data.d.ts.map +1 -1
- package/src/tokens/semantic/containers.data.js +3 -3
- package/src/tokens/semantic/containers.js +25 -25
- package/src/tokens/semantic/spacings.data.d.ts.map +1 -1
- package/src/tokens/semantic/spacings.data.js +3 -3
- package/src/tokens/semantic/texts.data.d.ts +59 -28
- package/src/tokens/semantic/texts.data.d.ts.map +1 -1
- package/src/tokens/semantic/texts.data.js +90 -56
- package/src/tokens/theme/accent.js +6 -6
- package/src/tokens/theme/border.js +6 -6
- package/src/tokens/theme/code-sintax.d.ts +53 -0
- package/src/tokens/theme/code-sintax.d.ts.map +1 -0
- package/src/tokens/theme/code-sintax.js +28 -0
- package/src/tokens/theme/feedback/danger.js +6 -6
- package/src/tokens/theme/feedback/info.js +6 -6
- package/src/tokens/theme/feedback/success.js +6 -6
- package/src/tokens/theme/feedback/warning.js +6 -6
- package/src/tokens/theme/primary.js +6 -6
- package/src/tokens/theme/ring.js +6 -6
- package/src/tokens/theme/secondary.js +6 -6
- package/src/tokens/theme/surfaces.d.ts.map +1 -1
- package/src/tokens/theme/surfaces.js +6 -6
- package/src/tokens/theme/text.d.ts +6 -0
- package/src/tokens/theme/text.js +2 -0
- package/src/tokens/theme.d.ts +110 -110
- package/src/tokens/theme.js +9 -9
- package/default.js +0 -1
- package/dist/v3/globals.css +0 -855
- package/dist/v3/globals.scss +0 -855
- package/dist/v3/tailwind-preset.js +0 -510
- package/dist/v3/tailwind.config.js +0 -518
- package/src/azion/_custom.scss +0 -3
- package/src/azion/_extensions.scss +0 -37
- package/src/azion/_variables-widget.scss +0 -400
- package/src/azion/_variables.scss +0 -407
- package/src/azion/custom/_code.scss +0 -11
- package/src/azion/custom/_focus.scss +0 -5
- package/src/azion/custom/_scrollbehavior.scss +0 -6
- package/src/azion/custom/_selection.scss +0 -4
- package/src/azion/custom/_special-button.scss +0 -57
- package/src/azion/extended-components/_autocomplete.scss +0 -13
- package/src/azion/extended-components/_badge.scss +0 -53
- package/src/azion/extended-components/_breadcumb.scss +0 -18
- package/src/azion/extended-components/_button.scss +0 -134
- package/src/azion/extended-components/_calendar.scss +0 -310
- package/src/azion/extended-components/_carousel.scss +0 -9
- package/src/azion/extended-components/_checkbox.scss +0 -33
- package/src/azion/extended-components/_datatable.scss +0 -130
- package/src/azion/extended-components/_dialog.scss +0 -45
- package/src/azion/extended-components/_divider.scss +0 -37
- package/src/azion/extended-components/_dropdown.scss +0 -10
- package/src/azion/extended-components/_dropdownitem.scss +0 -13
- package/src/azion/extended-components/_inlinemessage.scss +0 -10
- package/src/azion/extended-components/_inputnumber.scss +0 -40
- package/src/azion/extended-components/_inputpassword.scss +0 -4
- package/src/azion/extended-components/_inputswitch.scss +0 -53
- package/src/azion/extended-components/_listbox.scss +0 -35
- package/src/azion/extended-components/_markdown.scss +0 -135
- package/src/azion/extended-components/_menuitem.scss +0 -22
- package/src/azion/extended-components/_multiselect.scss +0 -167
- package/src/azion/extended-components/_overlaypanel.scss +0 -18
- package/src/azion/extended-components/_picklist.scss +0 -25
- package/src/azion/extended-components/_progressbar.scss +0 -6
- package/src/azion/extended-components/_radiobutton.scss +0 -63
- package/src/azion/extended-components/_selectbutton.scss +0 -36
- package/src/azion/extended-components/_sidebar.scss +0 -28
- package/src/azion/extended-components/_splitbutton.scss +0 -22
- package/src/azion/extended-components/_tabmenu.scss +0 -21
- package/src/azion/extended-components/_tabview.scss +0 -41
- package/src/azion/extended-components/_tag.scss +0 -47
- package/src/azion/extended-components/_toast.scss +0 -9
- package/src/azion/extended-components/_tooltip.scss +0 -7
- package/src/azion/extended-components/_treeselect.scss +0 -10
- package/src/azion/extended-components/jsonform/_inputcheckbox.scss +0 -41
- package/src/azion/extended-components/jsonform/_inputtext.scss +0 -26
- package/src/azion/extended-components/jsonform/_label.scss +0 -185
- package/src/azion/extended-components/jsonform/_select.scss +0 -34
- package/src/azion/theme-base/_colors.scss +0 -18
- package/src/azion/theme-base/_common.scss +0 -75
- package/src/azion/theme-base/_components.scss +0 -103
- package/src/azion/theme-base/_mixins.scss +0 -250
- package/src/azion/theme-base/components/button/_button.scss +0 -567
- package/src/azion/theme-base/components/button/_speeddial.scss +0 -97
- package/src/azion/theme-base/components/button/_splitbutton.scss +0 -390
- package/src/azion/theme-base/components/data/_carousel.scss +0 -37
- package/src/azion/theme-base/components/data/_datatable.scss +0 -347
- package/src/azion/theme-base/components/data/_dataview.scss +0 -47
- package/src/azion/theme-base/components/data/_filter.scss +0 -138
- package/src/azion/theme-base/components/data/_orderlist.scss +0 -70
- package/src/azion/theme-base/components/data/_organizationchart.scss +0 -50
- package/src/azion/theme-base/components/data/_paginator.scss +0 -92
- package/src/azion/theme-base/components/data/_picklist.scss +0 -70
- package/src/azion/theme-base/components/data/_timeline.scss +0 -38
- package/src/azion/theme-base/components/data/_tree.scss +0 -90
- package/src/azion/theme-base/components/data/_treetable.scss +0 -251
- package/src/azion/theme-base/components/file/_fileupload.scss +0 -82
- package/src/azion/theme-base/components/input/_autocomplete.scss +0 -114
- package/src/azion/theme-base/components/input/_calendar.scss +0 -251
- package/src/azion/theme-base/components/input/_cascadeselect.scss +0 -106
- package/src/azion/theme-base/components/input/_checkbox.scss +0 -86
- package/src/azion/theme-base/components/input/_chips.scss +0 -53
- package/src/azion/theme-base/components/input/_colorpicker.scss +0 -18
- package/src/azion/theme-base/components/input/_dropdown.scss +0 -147
- package/src/azion/theme-base/components/input/_editor.scss +0 -122
- package/src/azion/theme-base/components/input/_inputgroup.scss +0 -74
- package/src/azion/theme-base/components/input/_inputnumber.scss +0 -5
- package/src/azion/theme-base/components/input/_inputswitch.scss +0 -62
- package/src/azion/theme-base/components/input/_inputtext.scss +0 -100
- package/src/azion/theme-base/components/input/_listbox.scss +0 -89
- package/src/azion/theme-base/components/input/_multiselect.scss +0 -166
- package/src/azion/theme-base/components/input/_password.scss +0 -33
- package/src/azion/theme-base/components/input/_radiobutton.scss +0 -78
- package/src/azion/theme-base/components/input/_rating.scss +0 -60
- package/src/azion/theme-base/components/input/_selectbutton.scss +0 -50
- package/src/azion/theme-base/components/input/_slider.scss +0 -49
- package/src/azion/theme-base/components/input/_togglebutton.scss +0 -52
- package/src/azion/theme-base/components/input/_treeselect.scss +0 -91
- package/src/azion/theme-base/components/menu/_breadcrumb.scss +0 -42
- package/src/azion/theme-base/components/menu/_contextmenu.scss +0 -39
- package/src/azion/theme-base/components/menu/_dock.scss +0 -95
- package/src/azion/theme-base/components/menu/_megamenu.scss +0 -55
- package/src/azion/theme-base/components/menu/_menu.scss +0 -33
- package/src/azion/theme-base/components/menu/_menubar.scss +0 -141
- package/src/azion/theme-base/components/menu/_panelmenu.scss +0 -153
- package/src/azion/theme-base/components/menu/_steps.scss +0 -56
- package/src/azion/theme-base/components/menu/_tabmenu.scss +0 -49
- package/src/azion/theme-base/components/menu/_tieredmenu.scss +0 -43
- package/src/azion/theme-base/components/messages/_inlinemessage.scss +0 -64
- package/src/azion/theme-base/components/messages/_message.scss +0 -100
- package/src/azion/theme-base/components/messages/_toast.scss +0 -100
- package/src/azion/theme-base/components/misc/_avatar.scss +0 -30
- package/src/azion/theme-base/components/misc/_badge.scss +0 -48
- package/src/azion/theme-base/components/misc/_blockui.scss +0 -0
- package/src/azion/theme-base/components/misc/_chip.scss +0 -39
- package/src/azion/theme-base/components/misc/_inplace.scss +0 -17
- package/src/azion/theme-base/components/misc/_progressbar.scss +0 -17
- package/src/azion/theme-base/components/misc/_progressspinner.scss +0 -49
- package/src/azion/theme-base/components/misc/_scrolltop.scss +0 -25
- package/src/azion/theme-base/components/misc/_skeleton.scss +0 -8
- package/src/azion/theme-base/components/misc/_tag.scss +0 -40
- package/src/azion/theme-base/components/misc/_terminal.scss +0 -12
- package/src/azion/theme-base/components/multimedia/_galleria.scss +0 -151
- package/src/azion/theme-base/components/multimedia/_image.scss +0 -54
- package/src/azion/theme-base/components/overlay/_confirmpopup.scss +0 -72
- package/src/azion/theme-base/components/overlay/_dialog.scss +0 -64
- package/src/azion/theme-base/components/overlay/_overlaypanel.scss +0 -38
- package/src/azion/theme-base/components/overlay/_sidebar.scss +0 -23
- package/src/azion/theme-base/components/overlay/_tooltip.scss +0 -33
- package/src/azion/theme-base/components/panel/_accordion.scss +0 -118
- package/src/azion/theme-base/components/panel/_card.scss +0 -30
- package/src/azion/theme-base/components/panel/_divider.scss +0 -40
- package/src/azion/theme-base/components/panel/_fieldset.scss +0 -51
- package/src/azion/theme-base/components/panel/_panel.scss +0 -47
- package/src/azion/theme-base/components/panel/_scrollpanel.scss +0 -11
- package/src/azion/theme-base/components/panel/_splitter.scss +0 -24
- package/src/azion/theme-base/components/panel/_tabview.scss +0 -66
- package/src/azion/theme-base/components/panel/_toolbar.scss +0 -11
- package/src/azion/theme-widget.scss +0 -9
- package/src/azion/theme.scss +0 -9
- package/src/azion/variables/_button.scss +0 -438
- package/src/azion/variables/_data.scss +0 -346
- package/src/azion/variables/_form.scss +0 -570
- package/src/azion/variables/_general.scss +0 -149
- package/src/azion/variables/_media.scss +0 -231
- package/src/azion/variables/_menu.scss +0 -287
- package/src/azion/variables/_message.scss +0 -145
- package/src/azion/variables/_misc.scss +0 -143
- package/src/azion/variables/_overlay.scss +0 -67
- package/src/azion/variables/_panel.scss +0 -327
- package/src/tests/primitives.html +0 -293
- package/src/tests/theme.html +0 -310
- package/src/tests/tokens.html +0 -87
- package/src/tokens/semantic/animations.d.ts +0 -3
- package/src/tokens/semantic/animations.d.ts.map +0 -1
- package/src/tokens/semantic/animations.js +0 -80
- package/src/tokens/semantic/spacings.d.ts +0 -3
- package/src/tokens/semantic/spacings.d.ts.map +0 -1
- package/src/tokens/semantic/spacings.js +0 -163
- package/src/tokens/semantic/texts.d.ts +0 -3
- package/src/tokens/semantic/texts.d.ts.map +0 -1
- package/src/tokens/semantic/texts.js +0 -299
- package/tokens.js +0 -7
- package/widget.js +0 -1
|
@@ -7,33 +7,33 @@
|
|
|
7
7
|
* but for primitives only — no semantic light/dark split.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { primitives as colorPrimitives } from '../tokens/primitives/colors/colors.js'
|
|
11
|
-
import { animate } from '../tokens/primitives/animations/animate.js'
|
|
12
|
-
import { ease } from '../tokens/primitives/animations/ease.js'
|
|
13
|
-
import { borderWidths } from '../tokens/primitives/border-widths.js'
|
|
14
|
-
import { breakpoints } from '../tokens/primitives/breakpoints.js'
|
|
15
|
-
import { blur } from '../tokens/primitives/effects/blur.js'
|
|
16
|
-
import { dropShadow } from '../tokens/primitives/effects/drop-shadow.js'
|
|
17
|
-
import { insetShadow } from '../tokens/primitives/effects/inset-shadow.js'
|
|
18
|
-
import { opacity } from '../tokens/primitives/effects/opacity.js'
|
|
19
|
-
import { perspective } from '../tokens/primitives/effects/perspective.js'
|
|
20
|
-
import { shadow } from '../tokens/primitives/effects/shadow.js'
|
|
21
|
-
import { ringOffset } from '../tokens/primitives/ring-offset.js'
|
|
22
|
-
import { aspectVideo } from '../tokens/primitives/shape/aspect-video.js'
|
|
23
|
-
import { container } from '../tokens/primitives/shape/container.js'
|
|
24
|
-
import { height } from '../tokens/primitives/shape/height.js'
|
|
25
|
-
import { radius } from '../tokens/primitives/shape/radius.js'
|
|
26
|
-
import { shape as shapeAliases } from '../tokens/primitives/shape/shape.js'
|
|
27
|
-
import { size } from '../tokens/primitives/shape/size.js'
|
|
28
|
-
import { spacing } from '../tokens/primitives/shape/spacing.js'
|
|
29
|
-
import { width } from '../tokens/primitives/shape/width.js'
|
|
30
|
-
import { fontFamily } from '../tokens/primitives/typography/font-family.js'
|
|
31
|
-
import { fontSize } from '../tokens/primitives/typography/font-size.js'
|
|
32
|
-
import { fontWeight } from '../tokens/primitives/typography/font-weight.js'
|
|
33
|
-
import { leading } from '../tokens/primitives/typography/leading.js'
|
|
34
|
-
import { lineHeight } from '../tokens/primitives/typography/line-height.js'
|
|
35
|
-
import { tracking } from '../tokens/primitives/typography/tracking.js'
|
|
36
|
-
import { isTokenRef } from './refs.js'
|
|
10
|
+
import { primitives as colorPrimitives } from '../tokens/primitives/colors/colors.js'
|
|
11
|
+
import { animate } from '../tokens/primitives/animations/animate.js'
|
|
12
|
+
import { ease } from '../tokens/primitives/animations/ease.js'
|
|
13
|
+
import { borderWidths } from '../tokens/primitives/border-widths.js'
|
|
14
|
+
import { breakpoints } from '../tokens/primitives/breakpoints.js'
|
|
15
|
+
import { blur } from '../tokens/primitives/effects/blur.js'
|
|
16
|
+
import { dropShadow } from '../tokens/primitives/effects/drop-shadow.js'
|
|
17
|
+
import { insetShadow } from '../tokens/primitives/effects/inset-shadow.js'
|
|
18
|
+
import { opacity } from '../tokens/primitives/effects/opacity.js'
|
|
19
|
+
import { perspective } from '../tokens/primitives/effects/perspective.js'
|
|
20
|
+
import { shadow } from '../tokens/primitives/effects/shadow.js'
|
|
21
|
+
import { ringOffset } from '../tokens/primitives/ring-offset.js'
|
|
22
|
+
import { aspectVideo } from '../tokens/primitives/shape/aspect-video.js'
|
|
23
|
+
import { container } from '../tokens/primitives/shape/container.js'
|
|
24
|
+
import { height } from '../tokens/primitives/shape/height.js'
|
|
25
|
+
import { radius } from '../tokens/primitives/shape/radius.js'
|
|
26
|
+
import { shape as shapeAliases } from '../tokens/primitives/shape/shape.js'
|
|
27
|
+
import { size } from '../tokens/primitives/shape/size.js'
|
|
28
|
+
import { spacing } from '../tokens/primitives/shape/spacing.js'
|
|
29
|
+
import { width } from '../tokens/primitives/shape/width.js'
|
|
30
|
+
import { fontFamily } from '../tokens/primitives/typography/font-family.js'
|
|
31
|
+
import { fontSize } from '../tokens/primitives/typography/font-size.js'
|
|
32
|
+
import { fontWeight } from '../tokens/primitives/typography/font-weight.js'
|
|
33
|
+
import { leading } from '../tokens/primitives/typography/leading.js'
|
|
34
|
+
import { lineHeight } from '../tokens/primitives/typography/line-height.js'
|
|
35
|
+
import { tracking } from '../tokens/primitives/typography/tracking.js'
|
|
36
|
+
import { isTokenRef } from './refs.js'
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Returns two trees:
|
|
@@ -43,13 +43,13 @@ import { isTokenRef } from './refs.js';
|
|
|
43
43
|
* wrappers removed, so emitted CSS vars are flat (no group prefix).
|
|
44
44
|
*/
|
|
45
45
|
export const buildTrees = () => {
|
|
46
|
-
const { brand, ...restColors } = colorPrimitives
|
|
46
|
+
const { brand, ...restColors } = colorPrimitives
|
|
47
47
|
const color = {
|
|
48
48
|
...restColors,
|
|
49
|
-
primary: brand.primary,
|
|
50
|
-
accent: brand.accent,
|
|
51
|
-
absolute: brand.absolute
|
|
52
|
-
}
|
|
49
|
+
'brand-primary': brand.primary,
|
|
50
|
+
'brand-accent': brand.accent,
|
|
51
|
+
absolute: brand.absolute
|
|
52
|
+
}
|
|
53
53
|
|
|
54
54
|
const shape = {
|
|
55
55
|
container,
|
|
@@ -59,25 +59,25 @@ export const buildTrees = () => {
|
|
|
59
59
|
spacing,
|
|
60
60
|
width,
|
|
61
61
|
'aspect-video': aspectVideo,
|
|
62
|
-
...shapeAliases
|
|
63
|
-
}
|
|
62
|
+
...shapeAliases
|
|
63
|
+
}
|
|
64
64
|
const typography = {
|
|
65
65
|
font: fontFamily,
|
|
66
66
|
text: fontSize,
|
|
67
67
|
'font-weight': fontWeight,
|
|
68
68
|
leading,
|
|
69
69
|
'line-height': lineHeight,
|
|
70
|
-
tracking
|
|
71
|
-
}
|
|
70
|
+
tracking
|
|
71
|
+
}
|
|
72
72
|
const effects = {
|
|
73
73
|
blur,
|
|
74
74
|
'drop-shadow': dropShadow,
|
|
75
75
|
shadow,
|
|
76
76
|
'inset-shadow': insetShadow,
|
|
77
77
|
opacity,
|
|
78
|
-
perspective
|
|
79
|
-
}
|
|
80
|
-
const animations = { ease, animate }
|
|
78
|
+
perspective
|
|
79
|
+
}
|
|
80
|
+
const animations = { ease, animate }
|
|
81
81
|
|
|
82
82
|
const refsTree = {
|
|
83
83
|
color,
|
|
@@ -87,8 +87,8 @@ export const buildTrees = () => {
|
|
|
87
87
|
typography,
|
|
88
88
|
effects,
|
|
89
89
|
animations,
|
|
90
|
-
'ring-offset': ringOffset['ring-offset']
|
|
91
|
-
}
|
|
90
|
+
'ring-offset': ringOffset['ring-offset']
|
|
91
|
+
}
|
|
92
92
|
|
|
93
93
|
const varsTree = {
|
|
94
94
|
color,
|
|
@@ -98,68 +98,68 @@ export const buildTrees = () => {
|
|
|
98
98
|
...typography,
|
|
99
99
|
...effects,
|
|
100
100
|
...animations,
|
|
101
|
-
'ring-offset': ringOffset['ring-offset']
|
|
102
|
-
}
|
|
101
|
+
'ring-offset': ringOffset['ring-offset']
|
|
102
|
+
}
|
|
103
103
|
|
|
104
|
-
return { refsTree, varsTree }
|
|
105
|
-
}
|
|
104
|
+
return { refsTree, varsTree }
|
|
105
|
+
}
|
|
106
106
|
|
|
107
107
|
const getValueByPath = (obj, path) =>
|
|
108
108
|
path.split('.').reduce((acc, key) => {
|
|
109
|
-
if (acc && typeof acc === 'object' && key in acc) return acc[key]
|
|
110
|
-
return undefined
|
|
111
|
-
}, obj)
|
|
109
|
+
if (acc && typeof acc === 'object' && key in acc) return acc[key]
|
|
110
|
+
return undefined
|
|
111
|
+
}, obj)
|
|
112
112
|
|
|
113
113
|
const resolveRef = (refPath, refsTree) => {
|
|
114
|
-
const direct = getValueByPath(refsTree, refPath)
|
|
115
|
-
if (typeof direct === 'string' || typeof direct === 'number') return String(direct)
|
|
116
|
-
return null
|
|
117
|
-
}
|
|
114
|
+
const direct = getValueByPath(refsTree, refPath)
|
|
115
|
+
if (typeof direct === 'string' || typeof direct === 'number') return String(direct)
|
|
116
|
+
return null
|
|
117
|
+
}
|
|
118
118
|
|
|
119
119
|
// A leaf key of `DEFAULT` collapses to the parent prefix (Tailwind convention),
|
|
120
120
|
// so `{ radius: { DEFAULT: '4px' } }` emits `--radius: 4px;`.
|
|
121
121
|
const varNameFor = (path) => {
|
|
122
|
-
const segments = path[path.length - 1] === 'DEFAULT' ? path.slice(0, -1) : path
|
|
123
|
-
return `--${segments.join('-')}
|
|
124
|
-
}
|
|
122
|
+
const segments = path[path.length - 1] === 'DEFAULT' ? path.slice(0, -1) : path
|
|
123
|
+
return `--${segments.join('-')}`
|
|
124
|
+
}
|
|
125
125
|
|
|
126
126
|
export const flatten = (obj, refsTree, prefix = []) => {
|
|
127
|
-
const result = {}
|
|
127
|
+
const result = {}
|
|
128
128
|
Object.entries(obj).forEach(([key, value]) => {
|
|
129
|
-
const nextPath = [...prefix, key]
|
|
129
|
+
const nextPath = [...prefix, key]
|
|
130
130
|
if (isTokenRef(value)) {
|
|
131
|
-
const resolved = resolveRef(value.__ref, refsTree)
|
|
132
|
-
result[varNameFor(nextPath)] = resolved ?? value.__ref
|
|
133
|
-
return
|
|
131
|
+
const resolved = resolveRef(value.__ref, refsTree)
|
|
132
|
+
result[varNameFor(nextPath)] = resolved ?? value.__ref
|
|
133
|
+
return
|
|
134
134
|
}
|
|
135
135
|
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
136
|
-
Object.assign(result, flatten(value, refsTree, nextPath))
|
|
137
|
-
return
|
|
136
|
+
Object.assign(result, flatten(value, refsTree, nextPath))
|
|
137
|
+
return
|
|
138
138
|
}
|
|
139
139
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
140
|
-
result[varNameFor(nextPath)] = String(value)
|
|
140
|
+
result[varNameFor(nextPath)] = String(value)
|
|
141
141
|
}
|
|
142
|
-
})
|
|
143
|
-
return result
|
|
144
|
-
}
|
|
142
|
+
})
|
|
143
|
+
return result
|
|
144
|
+
}
|
|
145
145
|
|
|
146
146
|
export const compilePrimitivesVars = () => {
|
|
147
|
-
const { refsTree, varsTree } = buildTrees()
|
|
148
|
-
return flatten(varsTree, refsTree)
|
|
149
|
-
}
|
|
147
|
+
const { refsTree, varsTree } = buildTrees()
|
|
148
|
+
return flatten(varsTree, refsTree)
|
|
149
|
+
}
|
|
150
150
|
|
|
151
151
|
export const compilePrimitivesCss = () => {
|
|
152
|
-
const vars = compilePrimitivesVars()
|
|
152
|
+
const vars = compilePrimitivesVars()
|
|
153
153
|
const body = Object.entries(vars)
|
|
154
154
|
.map(([k, v]) => ` ${k}: ${v};`)
|
|
155
|
-
.join('\n')
|
|
156
|
-
return `:root, [data-theme=light], .azion.azion-light {\n${body}\n}
|
|
157
|
-
}
|
|
155
|
+
.join('\n')
|
|
156
|
+
return `:root, [data-theme=light], .azion.azion-light {\n${body}\n}`
|
|
157
|
+
}
|
|
158
158
|
|
|
159
159
|
export const injectPrimitivesCss = () => {
|
|
160
|
-
const style = document.createElement('style')
|
|
161
|
-
style.setAttribute('data-azion-primitives', 'true')
|
|
162
|
-
style.textContent = compilePrimitivesCss()
|
|
163
|
-
document.head.appendChild(style)
|
|
164
|
-
return style
|
|
165
|
-
}
|
|
160
|
+
const style = document.createElement('style')
|
|
161
|
+
style.setAttribute('data-azion-primitives', 'true')
|
|
162
|
+
style.textContent = compilePrimitivesCss()
|
|
163
|
+
document.head.appendChild(style)
|
|
164
|
+
return style
|
|
165
|
+
}
|
|
@@ -2,80 +2,85 @@
|
|
|
2
2
|
* Compile semantic theme tokens into a light/dark CSS variables stylesheet.
|
|
3
3
|
*
|
|
4
4
|
* Resolves `tokenRef(...)` aliases from `tokens/theme/*` (primary, secondary,
|
|
5
|
-
* accent, surfaces, background, border, text, ring, feedback/*)
|
|
5
|
+
* accent, surfaces, background, border, text, ring, code-sintax, feedback/*)
|
|
6
|
+
* against the
|
|
6
7
|
* primitives + brand + (pre-resolved) surfaces. Emits two blocks (light + dark).
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
brandPrimitives,
|
|
12
|
+
primitives as colorPrimitives
|
|
13
|
+
} from '../tokens/primitives/colors/colors.js'
|
|
14
|
+
import { accent } from '../tokens/theme/accent.js'
|
|
15
|
+
import { background } from '../tokens/theme/background.js'
|
|
16
|
+
import { codeSintax } from '../tokens/theme/code-sintax.js'
|
|
17
|
+
import { border } from '../tokens/theme/border.js'
|
|
18
|
+
import { danger } from '../tokens/theme/feedback/danger.js'
|
|
19
|
+
import { info } from '../tokens/theme/feedback/info.js'
|
|
20
|
+
import { success } from '../tokens/theme/feedback/success.js'
|
|
21
|
+
import { warning } from '../tokens/theme/feedback/warning.js'
|
|
22
|
+
import { primary } from '../tokens/theme/primary.js'
|
|
23
|
+
import { ring } from '../tokens/theme/ring.js'
|
|
24
|
+
import { secondary } from '../tokens/theme/secondary.js'
|
|
25
|
+
import { surfaces } from '../tokens/theme/surfaces.js'
|
|
26
|
+
import { text } from '../tokens/theme/text.js'
|
|
27
|
+
import { isTokenRef } from './refs.js'
|
|
23
28
|
|
|
24
|
-
const VARIANTS = ['light', 'dark']
|
|
29
|
+
const VARIANTS = ['light', 'dark']
|
|
25
30
|
|
|
26
31
|
const getValueByPath = (obj, path) =>
|
|
27
32
|
path.split('.').reduce((acc, key) => {
|
|
28
|
-
if (acc && typeof acc === 'object' && key in acc) return acc[key]
|
|
29
|
-
return undefined
|
|
30
|
-
}, obj)
|
|
33
|
+
if (acc && typeof acc === 'object' && key in acc) return acc[key]
|
|
34
|
+
return undefined
|
|
35
|
+
}, obj)
|
|
31
36
|
|
|
32
37
|
const resolveRef = (ref, surfacesResolved) => {
|
|
33
38
|
if (ref.startsWith('primitives.')) {
|
|
34
|
-
const v = getValueByPath(colorPrimitives, ref.slice('primitives.'.length))
|
|
35
|
-
return typeof v === 'string' || typeof v === 'number' ? String(v) : null
|
|
39
|
+
const v = getValueByPath(colorPrimitives, ref.slice('primitives.'.length))
|
|
40
|
+
return typeof v === 'string' || typeof v === 'number' ? String(v) : null
|
|
36
41
|
}
|
|
37
42
|
if (ref.startsWith('brand.primary.primary-')) {
|
|
38
|
-
const shade = ref.slice('brand.primary.primary-'.length)
|
|
39
|
-
return brandPrimitives.primary[shade] ?? null
|
|
43
|
+
const shade = ref.slice('brand.primary.primary-'.length)
|
|
44
|
+
return brandPrimitives.primary[shade] ?? null
|
|
40
45
|
}
|
|
41
46
|
if (ref.startsWith('brand.accent.accent-')) {
|
|
42
|
-
const shade = ref.slice('brand.accent.accent-'.length)
|
|
43
|
-
return brandPrimitives.accent[shade] ?? null
|
|
47
|
+
const shade = ref.slice('brand.accent.accent-'.length)
|
|
48
|
+
return brandPrimitives.accent[shade] ?? null
|
|
44
49
|
}
|
|
45
50
|
if (ref.startsWith('brand.absolute.')) {
|
|
46
|
-
const name = ref.slice('brand.absolute.'.length)
|
|
47
|
-
return brandPrimitives.absolute[name] ?? null
|
|
51
|
+
const name = ref.slice('brand.absolute.'.length)
|
|
52
|
+
return brandPrimitives.absolute[name] ?? null
|
|
48
53
|
}
|
|
49
54
|
if (ref.startsWith('theme.surfaces.')) {
|
|
50
|
-
const key = ref.slice('theme.surfaces.'.length)
|
|
51
|
-
return surfacesResolved[key] ?? null
|
|
55
|
+
const key = ref.slice('theme.surfaces.'.length)
|
|
56
|
+
return surfacesResolved[key] ?? null
|
|
52
57
|
}
|
|
53
|
-
return null
|
|
54
|
-
}
|
|
58
|
+
return null
|
|
59
|
+
}
|
|
55
60
|
|
|
56
61
|
const resolveGroup = (group, surfacesResolved) => {
|
|
57
|
-
const result = {}
|
|
62
|
+
const result = {}
|
|
58
63
|
Object.entries(group).forEach(([key, value]) => {
|
|
59
|
-
if (!isTokenRef(value)) return
|
|
60
|
-
const resolved = resolveRef(value.__ref, surfacesResolved)
|
|
61
|
-
if (resolved != null) result[`--${key}`] = String(resolved)
|
|
62
|
-
})
|
|
63
|
-
return result
|
|
64
|
-
}
|
|
64
|
+
if (!isTokenRef(value)) return
|
|
65
|
+
const resolved = resolveRef(value.__ref, surfacesResolved)
|
|
66
|
+
if (resolved != null) result[`--${key}`] = String(resolved)
|
|
67
|
+
})
|
|
68
|
+
return result
|
|
69
|
+
}
|
|
65
70
|
|
|
66
71
|
const compileVariant = (variant) => {
|
|
67
72
|
// Surfaces resolved first — other groups depend on them.
|
|
68
|
-
const surfacesResolved = {}
|
|
73
|
+
const surfacesResolved = {}
|
|
69
74
|
Object.entries(surfaces[variant]).forEach(([key, value]) => {
|
|
70
|
-
if (!isTokenRef(value)) return
|
|
71
|
-
const v = resolveRef(value.__ref, {})
|
|
72
|
-
if (v != null) surfacesResolved[key] = String(v)
|
|
73
|
-
})
|
|
75
|
+
if (!isTokenRef(value)) return
|
|
76
|
+
const v = resolveRef(value.__ref, {})
|
|
77
|
+
if (v != null) surfacesResolved[key] = String(v)
|
|
78
|
+
})
|
|
74
79
|
|
|
75
|
-
const vars = {}
|
|
80
|
+
const vars = {}
|
|
76
81
|
Object.entries(surfacesResolved).forEach(([k, v]) => {
|
|
77
|
-
vars[`--${k}`] = v
|
|
78
|
-
})
|
|
82
|
+
vars[`--${k}`] = v
|
|
83
|
+
})
|
|
79
84
|
|
|
80
85
|
const groups = [
|
|
81
86
|
primary[variant],
|
|
@@ -85,33 +90,35 @@ const compileVariant = (variant) => {
|
|
|
85
90
|
border[variant],
|
|
86
91
|
text[variant],
|
|
87
92
|
ring[variant],
|
|
93
|
+
codeSintax[variant],
|
|
88
94
|
success[variant],
|
|
89
95
|
warning[variant],
|
|
90
96
|
danger[variant],
|
|
91
|
-
info[variant]
|
|
92
|
-
]
|
|
93
|
-
groups.forEach((g) => Object.assign(vars, resolveGroup(g, surfacesResolved)))
|
|
94
|
-
return vars
|
|
95
|
-
}
|
|
97
|
+
info[variant]
|
|
98
|
+
]
|
|
99
|
+
groups.forEach((g) => Object.assign(vars, resolveGroup(g, surfacesResolved)))
|
|
100
|
+
return vars
|
|
101
|
+
}
|
|
96
102
|
|
|
97
|
-
export const compileThemeVars = () =>
|
|
103
|
+
export const compileThemeVars = () =>
|
|
104
|
+
Object.fromEntries(VARIANTS.map((v) => [v, compileVariant(v)]))
|
|
98
105
|
|
|
99
106
|
export const compileThemeCss = () => {
|
|
100
|
-
const { light, dark } = compileThemeVars()
|
|
107
|
+
const { light, dark } = compileThemeVars()
|
|
101
108
|
const fmt = (vars) =>
|
|
102
109
|
Object.entries(vars)
|
|
103
110
|
.map(([k, v]) => ` ${k}: ${v};`)
|
|
104
|
-
.join('\n')
|
|
111
|
+
.join('\n')
|
|
105
112
|
return [
|
|
106
113
|
`:root, [data-theme=light], .azion.azion-light {\n${fmt(light)}\n}`,
|
|
107
|
-
`[data-theme=dark], .dark, .azion.azion-dark {\n${fmt(dark)}\n}
|
|
108
|
-
].join('\n\n')
|
|
109
|
-
}
|
|
114
|
+
`[data-theme=dark], .dark, .azion.azion-dark {\n${fmt(dark)}\n}`
|
|
115
|
+
].join('\n\n')
|
|
116
|
+
}
|
|
110
117
|
|
|
111
118
|
export const injectThemeCss = () => {
|
|
112
|
-
const style = document.createElement('style')
|
|
113
|
-
style.setAttribute('data-azion-theme', 'true')
|
|
114
|
-
style.textContent = compileThemeCss()
|
|
115
|
-
document.head.appendChild(style)
|
|
116
|
-
return style
|
|
117
|
-
}
|
|
119
|
+
const style = document.createElement('style')
|
|
120
|
+
style.setAttribute('data-azion-theme', 'true')
|
|
121
|
+
style.textContent = compileThemeCss()
|
|
122
|
+
document.head.appendChild(style)
|
|
123
|
+
return style
|
|
124
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-vars.d.ts","sourceRoot":"","sources":["css-vars.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css-vars.d.ts","sourceRoot":"","sources":["css-vars.js"],"names":[],"mappings":"AAgBO;;;EAQH;AAEG,wCAWN;AAEM,kDAMN"}
|
package/src/scripts/css-vars.js
CHANGED
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
* `{ light, dark }` map of CSS variable names → resolved color values.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
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'
|
|
12
16
|
|
|
13
17
|
export const createCssVars = () =>
|
|
14
18
|
resolveRefsToCssVars({
|
|
@@ -17,26 +21,26 @@ export const createCssVars = () =>
|
|
|
17
21
|
brandPrimitives,
|
|
18
22
|
textSemantic: semanticColorsData.text,
|
|
19
23
|
backgroundSemantic: semanticColorsData.background,
|
|
20
|
-
borderSemantic: semanticColorsData.border
|
|
21
|
-
})
|
|
24
|
+
borderSemantic: semanticColorsData.border
|
|
25
|
+
})
|
|
22
26
|
|
|
23
27
|
export const cssVarsString = () => {
|
|
24
|
-
const { light, dark } = createCssVars()
|
|
28
|
+
const { light, dark } = createCssVars()
|
|
25
29
|
const format = (vars) =>
|
|
26
30
|
Object.entries(vars)
|
|
27
31
|
.map(([key, value]) => ` ${key}: ${value};`)
|
|
28
|
-
.join('\n')
|
|
32
|
+
.join('\n')
|
|
29
33
|
|
|
30
34
|
return [
|
|
31
35
|
`:root, [data-theme=light], .azion.azion-light {\n${format(light)}\n}`,
|
|
32
|
-
`[data-theme=dark], .dark, .azion.azion-dark {\n${format(dark)}\n}
|
|
33
|
-
].join('\n\n')
|
|
34
|
-
}
|
|
36
|
+
`[data-theme=dark], .dark, .azion.azion-dark {\n${format(dark)}\n}`
|
|
37
|
+
].join('\n\n')
|
|
38
|
+
}
|
|
35
39
|
|
|
36
40
|
export const injectCssVars = () => {
|
|
37
|
-
const style = document.createElement('style')
|
|
38
|
-
style.setAttribute('data-azion-tokens', 'true')
|
|
39
|
-
style.textContent = cssVarsString()
|
|
40
|
-
document.head.appendChild(style)
|
|
41
|
-
return style
|
|
42
|
-
}
|
|
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
|
+
}
|
package/src/scripts/refs.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Token reference helpers.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export const tokenRef = (path) => ({ __ref: path })
|
|
5
|
+
export const tokenRef = (path) => ({ __ref: path })
|
|
6
6
|
|
|
7
|
-
export const isTokenRef = (value) => typeof value === 'object' && value !== null && '__ref' in value
|
|
7
|
+
export const isTokenRef = (value) => typeof value === 'object' && value !== null && '__ref' in value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["resolve.js"],"names":[],"mappings":"AAiCO;;;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["resolve.js"],"names":[],"mappings":"AAiCO;;;EAyEN"}
|
package/src/scripts/resolve.js
CHANGED
|
@@ -2,103 +2,106 @@
|
|
|
2
2
|
* Resolve token refs to CSS variable map.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { isTokenRef } from './refs.js'
|
|
5
|
+
import { isTokenRef } from './refs.js'
|
|
6
6
|
|
|
7
7
|
const getValueByPath = (obj, path) =>
|
|
8
8
|
path.split('.').reduce((acc, key) => {
|
|
9
9
|
if (acc && typeof acc === 'object' && key in acc) {
|
|
10
|
-
return acc[key]
|
|
10
|
+
return acc[key]
|
|
11
11
|
}
|
|
12
|
-
return undefined
|
|
13
|
-
}, obj)
|
|
12
|
+
return undefined
|
|
13
|
+
}, obj)
|
|
14
14
|
|
|
15
15
|
const flattenToCssVars = (obj, prefix = []) => {
|
|
16
|
-
const result = {}
|
|
16
|
+
const result = {}
|
|
17
17
|
Object.entries(obj).forEach(([key, value]) => {
|
|
18
|
-
const nextPath = [...prefix, key]
|
|
18
|
+
const nextPath = [...prefix, key]
|
|
19
19
|
if (value && typeof value === 'object' && !Array.isArray(value) && !isTokenRef(value)) {
|
|
20
|
-
Object.assign(result, flattenToCssVars(value, nextPath))
|
|
21
|
-
return
|
|
20
|
+
Object.assign(result, flattenToCssVars(value, nextPath))
|
|
21
|
+
return
|
|
22
22
|
}
|
|
23
23
|
if (isTokenRef(value)) {
|
|
24
|
-
result[`--${nextPath.join('-')}`] = value.__ref
|
|
25
|
-
return
|
|
24
|
+
result[`--${nextPath.join('-')}`] = value.__ref
|
|
25
|
+
return
|
|
26
26
|
}
|
|
27
27
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
28
|
-
result[`--${nextPath.join('-')}`] = String(value)
|
|
28
|
+
result[`--${nextPath.join('-')}`] = String(value)
|
|
29
29
|
}
|
|
30
|
-
})
|
|
31
|
-
return result
|
|
32
|
-
}
|
|
30
|
+
})
|
|
31
|
+
return result
|
|
32
|
+
}
|
|
33
33
|
|
|
34
34
|
export const resolveRefsToCssVars = (tokens) => {
|
|
35
35
|
const baseForResolve = {
|
|
36
36
|
primitives: tokens.primitives,
|
|
37
37
|
surfacePrimitives: tokens.surfacePrimitives,
|
|
38
|
-
brandPrimitives: tokens.brandPrimitives
|
|
39
|
-
}
|
|
38
|
+
brandPrimitives: tokens.brandPrimitives
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
const baseForVars = { primitives: tokens.primitives, surfacePrimitives: tokens.surfacePrimitives }
|
|
41
|
+
const baseForVars = { primitives: tokens.primitives, surfacePrimitives: tokens.surfacePrimitives }
|
|
42
42
|
|
|
43
43
|
const lightSemantic = {
|
|
44
44
|
text: tokens.textSemantic.light,
|
|
45
45
|
background: tokens.backgroundSemantic.light,
|
|
46
|
-
border: tokens.borderSemantic.light
|
|
47
|
-
}
|
|
46
|
+
border: tokens.borderSemantic.light
|
|
47
|
+
}
|
|
48
48
|
const darkSemantic = {
|
|
49
49
|
text: tokens.textSemantic.dark,
|
|
50
50
|
background: tokens.backgroundSemantic.dark,
|
|
51
|
-
border: tokens.borderSemantic.dark
|
|
52
|
-
}
|
|
51
|
+
border: tokens.borderSemantic.dark
|
|
52
|
+
}
|
|
53
53
|
|
|
54
54
|
const resolveBrandRef = (ref) => {
|
|
55
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
|
|
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
59
|
}
|
|
60
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
|
|
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
64
|
}
|
|
65
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
|
|
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
69
|
}
|
|
70
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
|
|
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
74
|
}
|
|
75
|
-
return null
|
|
76
|
-
}
|
|
75
|
+
return null
|
|
76
|
+
}
|
|
77
77
|
|
|
78
78
|
const resolveSemantic = (semantic) => {
|
|
79
|
-
const flattened = flattenToCssVars(semantic)
|
|
79
|
+
const flattened = flattenToCssVars(semantic)
|
|
80
80
|
return Object.fromEntries(
|
|
81
81
|
Object.entries(flattened).map(([key, value]) => {
|
|
82
82
|
if (value.startsWith('brand.')) {
|
|
83
|
-
return [key, resolveBrandRef(value) ?? value]
|
|
83
|
+
return [key, resolveBrandRef(value) ?? value]
|
|
84
84
|
}
|
|
85
85
|
if (value.startsWith('primitives.') || value.startsWith('surfacePrimitives.')) {
|
|
86
|
-
const resolved = getValueByPath(baseForResolve, value)
|
|
87
|
-
return [
|
|
86
|
+
const resolved = getValueByPath(baseForResolve, value)
|
|
87
|
+
return [
|
|
88
|
+
key,
|
|
89
|
+
typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : value
|
|
90
|
+
]
|
|
88
91
|
}
|
|
89
|
-
return [key, value]
|
|
92
|
+
return [key, value]
|
|
90
93
|
})
|
|
91
|
-
)
|
|
92
|
-
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
93
96
|
|
|
94
97
|
return {
|
|
95
98
|
light: {
|
|
96
99
|
...flattenToCssVars(baseForVars),
|
|
97
|
-
...resolveSemantic(lightSemantic)
|
|
100
|
+
...resolveSemantic(lightSemantic)
|
|
98
101
|
},
|
|
99
102
|
dark: {
|
|
100
103
|
...flattenToCssVars(baseForVars),
|
|
101
|
-
...resolveSemantic(darkSemantic)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
104
|
+
...resolveSemantic(darkSemantic)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|