@cognitap/radiant 0.0.2 → 0.0.4
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 +357 -0
- package/README.md +944 -29
- package/dist/library/Accordion.d.ts +56 -0
- package/dist/library/Accordion.d.ts.map +1 -0
- package/dist/library/Accordion.js +89 -0
- package/dist/library/Accordion.js.map +1 -0
- package/dist/library/Button.d.ts +25 -3
- package/dist/library/Button.d.ts.map +1 -1
- package/dist/library/Button.js +31 -3
- package/dist/library/Button.js.map +1 -1
- package/dist/library/Card.d.ts +31 -0
- package/dist/library/Card.d.ts.map +1 -0
- package/dist/library/Card.js +69 -0
- package/dist/library/Card.js.map +1 -0
- package/dist/library/Checkbox.d.ts +13 -0
- package/dist/library/Checkbox.d.ts.map +1 -0
- package/dist/library/Checkbox.js +77 -0
- package/dist/library/Checkbox.js.map +1 -0
- package/dist/library/Collapsible.d.ts +32 -0
- package/dist/library/Collapsible.d.ts.map +1 -0
- package/dist/library/Collapsible.js +99 -0
- package/dist/library/Collapsible.js.map +1 -0
- package/dist/library/Dialog.d.ts +50 -0
- package/dist/library/Dialog.d.ts.map +1 -0
- package/dist/library/Dialog.js +215 -0
- package/dist/library/Dialog.js.map +1 -0
- package/dist/library/Field.d.ts +68 -0
- package/dist/library/Field.d.ts.map +1 -0
- package/dist/library/Field.js +114 -0
- package/dist/library/Field.js.map +1 -0
- package/dist/library/Input.d.ts +10 -0
- package/dist/library/Input.d.ts.map +1 -0
- package/dist/library/Input.js +51 -0
- package/dist/library/Input.js.map +1 -0
- package/dist/library/Link.d.ts +27 -0
- package/dist/library/Link.d.ts.map +1 -0
- package/dist/library/Link.js +50 -0
- package/dist/library/Link.js.map +1 -0
- package/dist/library/RadioGroup.d.ts +27 -0
- package/dist/library/RadioGroup.d.ts.map +1 -0
- package/dist/library/RadioGroup.js +103 -0
- package/dist/library/RadioGroup.js.map +1 -0
- package/dist/library/ThemeScope.d.ts +10 -0
- package/dist/library/ThemeScope.d.ts.map +1 -0
- package/dist/library/ThemeScope.js +41 -0
- package/dist/library/ThemeScope.js.map +1 -0
- package/dist/library/actionStyles.d.ts +11 -0
- package/dist/library/actionStyles.d.ts.map +1 -0
- package/dist/library/actionStyles.js +75 -0
- package/dist/library/actionStyles.js.map +1 -0
- package/dist/library/cn.d.ts +1 -2
- package/dist/library/cn.d.ts.map +1 -1
- package/dist/library/cn.js +1 -8
- package/dist/library/cn.js.map +1 -1
- package/dist/library/color/colorFamilies.d.ts +3 -0
- package/dist/library/color/colorFamilies.d.ts.map +1 -0
- package/dist/library/color/colorFamilies.js +20 -0
- package/dist/library/color/colorFamilies.js.map +1 -0
- package/dist/library/color/generateColorWall.d.ts +54 -0
- package/dist/library/color/generateColorWall.d.ts.map +1 -0
- package/dist/library/color/generateColorWall.js +231 -0
- package/dist/library/color/generateColorWall.js.map +1 -0
- package/dist/library/color/index.d.ts +5 -0
- package/dist/library/color/index.d.ts.map +1 -0
- package/dist/library/color/index.js +3 -0
- package/dist/library/color/index.js.map +1 -0
- package/dist/library/color/oklch.d.ts +17 -0
- package/dist/library/color/oklch.d.ts.map +1 -0
- package/dist/library/color/oklch.js +79 -0
- package/dist/library/color/oklch.js.map +1 -0
- package/dist/library/color/recommendColorPalette.d.ts +65 -0
- package/dist/library/color/recommendColorPalette.d.ts.map +1 -0
- package/dist/library/color/recommendColorPalette.js +263 -0
- package/dist/library/color/recommendColorPalette.js.map +1 -0
- package/dist/library/controlStyles.d.ts +5 -0
- package/dist/library/controlStyles.d.ts.map +1 -0
- package/dist/library/controlStyles.js +15 -0
- package/dist/library/controlStyles.js.map +1 -0
- package/dist/library/index.d.ts +30 -1
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +14 -0
- package/dist/library/index.js.map +1 -1
- package/dist/library/internal/events.d.ts +8 -0
- package/dist/library/internal/events.d.ts.map +1 -0
- package/dist/library/internal/events.js +13 -0
- package/dist/library/internal/events.js.map +1 -0
- package/dist/library/internal/ids.d.ts +3 -0
- package/dist/library/internal/ids.d.ts.map +1 -0
- package/dist/library/internal/ids.js +6 -0
- package/dist/library/internal/ids.js.map +1 -0
- package/dist/library/internal/selection.d.ts +5 -0
- package/dist/library/internal/selection.d.ts.map +1 -0
- package/dist/library/internal/selection.js +18 -0
- package/dist/library/internal/selection.js.map +1 -0
- package/dist/library/presentation.d.ts +18 -0
- package/dist/library/presentation.d.ts.map +1 -0
- package/dist/library/presentation.js +2 -0
- package/dist/library/presentation.js.map +1 -0
- package/dist/library/react/useComposedRefs.d.ts +4 -0
- package/dist/library/react/useComposedRefs.d.ts.map +1 -0
- package/dist/library/react/useComposedRefs.js +28 -0
- package/dist/library/react/useComposedRefs.js.map +1 -0
- package/dist/library/react/useControllableState.d.ts +16 -0
- package/dist/library/react/useControllableState.d.ts.map +1 -0
- package/dist/library/react/useControllableState.js +29 -0
- package/dist/library/react/useControllableState.js.map +1 -0
- package/dist/library/react/useNativeOwner.d.ts +17 -0
- package/dist/library/react/useNativeOwner.d.ts.map +1 -0
- package/dist/library/react/useNativeOwner.js +17 -0
- package/dist/library/react/useNativeOwner.js.map +1 -0
- package/dist/library/reset.css +1 -0
- package/dist/library/styles.css +2 -1
- package/dist/library/themes/components.d.ts +217 -0
- package/dist/library/themes/components.d.ts.map +1 -0
- package/dist/library/themes/components.js +229 -0
- package/dist/library/themes/components.js.map +1 -0
- package/dist/library/themes/default.d.ts +2 -0
- package/dist/library/themes/default.d.ts.map +1 -0
- package/dist/library/themes/default.js +4 -0
- package/dist/library/themes/default.js.map +1 -0
- package/dist/library/themes/defineTheme.d.ts +33 -0
- package/dist/library/themes/defineTheme.d.ts.map +1 -0
- package/dist/library/themes/defineTheme.js +98 -0
- package/dist/library/themes/defineTheme.js.map +1 -0
- package/dist/library/themes/expressive.d.ts +2 -0
- package/dist/library/themes/expressive.d.ts.map +1 -0
- package/dist/library/themes/expressive.js +132 -0
- package/dist/library/themes/expressive.js.map +1 -0
- package/dist/library/themes/glass.d.ts +2 -0
- package/dist/library/themes/glass.d.ts.map +1 -0
- package/dist/library/themes/glass.js +132 -0
- package/dist/library/themes/glass.js.map +1 -0
- package/dist/library/themes/index.d.ts +18 -0
- package/dist/library/themes/index.d.ts.map +1 -0
- package/dist/library/themes/index.js +23 -0
- package/dist/library/themes/index.js.map +1 -0
- package/dist/library/themes/jelly.d.ts +2 -0
- package/dist/library/themes/jelly.d.ts.map +1 -0
- package/dist/library/themes/jelly.js +130 -0
- package/dist/library/themes/jelly.js.map +1 -0
- package/dist/library/themes/preset-values.d.ts +4 -0
- package/dist/library/themes/preset-values.d.ts.map +1 -0
- package/dist/library/themes/preset-values.js +5 -0
- package/dist/library/themes/preset-values.js.map +1 -0
- package/dist/library/themes/radiant.d.ts +2 -0
- package/dist/library/themes/radiant.d.ts.map +1 -0
- package/dist/library/themes/radiant.js +129 -0
- package/dist/library/themes/radiant.js.map +1 -0
- package/dist/library/themes/sharp-3d.d.ts +2 -0
- package/dist/library/themes/sharp-3d.d.ts.map +1 -0
- package/dist/library/themes/sharp-3d.js +142 -0
- package/dist/library/themes/sharp-3d.js.map +1 -0
- package/dist/library/themes/soft-squircle.d.ts +2 -0
- package/dist/library/themes/soft-squircle.d.ts.map +1 -0
- package/dist/library/themes/soft-squircle.js +131 -0
- package/dist/library/themes/soft-squircle.js.map +1 -0
- package/dist/library/themes/themeDocument.d.ts +16 -0
- package/dist/library/themes/themeDocument.d.ts.map +1 -0
- package/dist/library/themes/themeDocument.js +307 -0
- package/dist/library/themes/themeDocument.js.map +1 -0
- package/dist/library/themes/themeDocumentTypes.d.ts +69 -0
- package/dist/library/themes/themeDocumentTypes.d.ts.map +1 -0
- package/dist/library/themes/themeDocumentTypes.js +2 -0
- package/dist/library/themes/themeDocumentTypes.js.map +1 -0
- package/dist/library/themes/ticket.d.ts +2 -0
- package/dist/library/themes/ticket.d.ts.map +1 -0
- package/dist/library/themes/ticket.js +141 -0
- package/dist/library/themes/ticket.js.map +1 -0
- package/dist/library/themes/tokens.d.ts +100 -0
- package/dist/library/themes/tokens.d.ts.map +1 -0
- package/dist/library/themes/tokens.js +171 -0
- package/dist/library/themes/tokens.js.map +1 -0
- package/dist/library/themes/types.d.ts +2 -0
- package/dist/library/themes/types.d.ts.map +1 -0
- package/dist/library/themes/types.js +2 -0
- package/dist/library/themes/types.js.map +1 -0
- package/dist/library/themes/updateThemeAppearance.d.ts +29 -0
- package/dist/library/themes/updateThemeAppearance.d.ts.map +1 -0
- package/dist/library/themes/updateThemeAppearance.js +138 -0
- package/dist/library/themes/updateThemeAppearance.js.map +1 -0
- package/docs/accessibility.md +189 -0
- package/docs/system.md +231 -0
- package/docs/theming.md +804 -0
- package/package.json +34 -10
- package/src/Accordion.tsx +235 -0
- package/src/Button.tsx +95 -15
- package/src/Card.tsx +143 -0
- package/src/Checkbox.tsx +189 -0
- package/src/Collapsible.tsx +193 -0
- package/src/Dialog.tsx +333 -0
- package/src/Field.tsx +293 -0
- package/src/Input.tsx +82 -0
- package/src/Link.tsx +95 -0
- package/src/RadioGroup.tsx +255 -0
- package/src/ThemeScope.tsx +64 -0
- package/src/actionStyles.ts +90 -0
- package/src/cn.ts +1 -10
- package/src/color/colorFamilies.ts +19 -0
- package/src/color/generateColorWall.ts +358 -0
- package/src/color/index.ts +11 -0
- package/src/color/oklch.ts +95 -0
- package/src/color/recommendColorPalette.ts +375 -0
- package/src/controlStyles.ts +19 -0
- package/src/index.ts +130 -1
- package/src/internal/events.ts +17 -0
- package/src/internal/ids.ts +5 -0
- package/src/internal/selection.ts +20 -0
- package/src/presentation.ts +12 -0
- package/src/react/useComposedRefs.ts +32 -0
- package/src/react/useControllableState.ts +50 -0
- package/src/react/useNativeOwner.ts +33 -0
- package/src/styles.css +2 -14
- package/src/themes/baseline.css +116 -0
- package/src/themes/components.ts +249 -0
- package/src/themes/default.ts +4 -0
- package/src/themes/defineTheme.ts +145 -0
- package/src/themes/expressive.ts +132 -0
- package/src/themes/glass.ts +135 -0
- package/src/themes/index.ts +57 -0
- package/src/themes/jelly.ts +130 -0
- package/src/themes/preset-values.ts +5 -0
- package/src/themes/radiant.ts +129 -0
- package/src/themes/sharp-3d.ts +142 -0
- package/src/themes/soft-squircle.ts +131 -0
- package/src/themes/themeDocument.ts +340 -0
- package/src/themes/themeDocumentTypes.ts +76 -0
- package/src/themes/ticket.ts +141 -0
- package/src/themes/tokens.ts +262 -0
- package/src/themes/types.ts +10 -0
- package/src/themes/updateThemeAppearance.ts +172 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { defineTheme } from './defineTheme.js';
|
|
2
|
+
import { snap, settle } from './preset-values.js';
|
|
3
|
+
export const sharp = defineTheme({
|
|
4
|
+
id: 'sharp-3d',
|
|
5
|
+
name: 'Sharp 3D',
|
|
6
|
+
tokens: {
|
|
7
|
+
color: {
|
|
8
|
+
surface: '#ffffff',
|
|
9
|
+
foreground: '#111111',
|
|
10
|
+
mutedForeground: '#53504a',
|
|
11
|
+
border: '#111111',
|
|
12
|
+
accent: '#ff90e8',
|
|
13
|
+
accentForeground: '#111111',
|
|
14
|
+
neutral: '#ffffff',
|
|
15
|
+
neutralForeground: '#111111',
|
|
16
|
+
warning: '#ffc900',
|
|
17
|
+
warningForeground: '#111111',
|
|
18
|
+
danger: '#ff5d5d',
|
|
19
|
+
dangerForeground: '#111111',
|
|
20
|
+
focus: '#111111',
|
|
21
|
+
placeholder: '#53504a',
|
|
22
|
+
disabledBackground: '#ffffff',
|
|
23
|
+
disabledBorder: '#111111',
|
|
24
|
+
invalid: '#b52929'
|
|
25
|
+
},
|
|
26
|
+
typography: {
|
|
27
|
+
family: 'system-ui, sans-serif',
|
|
28
|
+
bodySize: '1rem',
|
|
29
|
+
smallSize: '0.875rem',
|
|
30
|
+
headingSize: '1.25rem',
|
|
31
|
+
bodyWeight: 400,
|
|
32
|
+
labelWeight: 600,
|
|
33
|
+
headingWeight: 700,
|
|
34
|
+
letterSpacing: '0'
|
|
35
|
+
},
|
|
36
|
+
control: {
|
|
37
|
+
small: {
|
|
38
|
+
height: '2rem',
|
|
39
|
+
paddingInline: '0.75rem',
|
|
40
|
+
fontSize: '0.8125rem',
|
|
41
|
+
indicatorSize: '1rem'
|
|
42
|
+
},
|
|
43
|
+
medium: {
|
|
44
|
+
height: '2.75rem',
|
|
45
|
+
paddingInline: '1.25rem',
|
|
46
|
+
fontSize: '0.875rem',
|
|
47
|
+
indicatorSize: '1.125rem'
|
|
48
|
+
},
|
|
49
|
+
large: {
|
|
50
|
+
height: '3.25rem',
|
|
51
|
+
paddingInline: '1.5rem',
|
|
52
|
+
fontSize: '0.9375rem',
|
|
53
|
+
indicatorSize: '1.25rem'
|
|
54
|
+
},
|
|
55
|
+
radius: '0px',
|
|
56
|
+
cornerShape: 'round',
|
|
57
|
+
borderWidth: '2px',
|
|
58
|
+
borderStyle: 'solid'
|
|
59
|
+
},
|
|
60
|
+
surface: {
|
|
61
|
+
canvas: '#f4f1ea',
|
|
62
|
+
radius: '0px',
|
|
63
|
+
cornerShape: 'round',
|
|
64
|
+
borderWidth: '2px',
|
|
65
|
+
borderStyle: 'solid',
|
|
66
|
+
padding: '1.5rem',
|
|
67
|
+
gap: '1rem',
|
|
68
|
+
shadow: '4px 4px 0 var(--rad-color-border)',
|
|
69
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.22)',
|
|
70
|
+
backdrop: 'rgb(15 12 25 / 0.45)'
|
|
71
|
+
},
|
|
72
|
+
focus: {
|
|
73
|
+
width: '2px',
|
|
74
|
+
offset: '0px',
|
|
75
|
+
style: 'solid'
|
|
76
|
+
},
|
|
77
|
+
motion: {
|
|
78
|
+
pressDuration: '60ms',
|
|
79
|
+
pressEase: snap,
|
|
80
|
+
releaseDuration: '120ms',
|
|
81
|
+
releaseEase: settle,
|
|
82
|
+
colorDuration: '150ms',
|
|
83
|
+
disclosureDuration: '180ms'
|
|
84
|
+
},
|
|
85
|
+
state: { disabledOpacity: 0.5 }
|
|
86
|
+
},
|
|
87
|
+
components: {
|
|
88
|
+
button: {
|
|
89
|
+
borderColor: 'var(--rad-color-border)',
|
|
90
|
+
radiusPressed: '0px',
|
|
91
|
+
textTransform: 'uppercase',
|
|
92
|
+
fontWeight: 400,
|
|
93
|
+
letterSpacing: '0.02em',
|
|
94
|
+
shadow: '4px 4px 0 0 var(--rad-color-border)',
|
|
95
|
+
shadowPressed: '1px 1px 0 0 var(--rad-color-border)',
|
|
96
|
+
ghostShadow: '4px 4px 0 0 var(--rad-color-border)',
|
|
97
|
+
ghostShadowPressed: '1px 1px 0 0 var(--rad-color-border)',
|
|
98
|
+
sheen: 0,
|
|
99
|
+
highlight: 0,
|
|
100
|
+
glow: '0%',
|
|
101
|
+
pressScale: 1,
|
|
102
|
+
pressShift: '3px',
|
|
103
|
+
pressShiftX: '3px',
|
|
104
|
+
fontFamily: "'Archivo Black', system-ui, sans-serif"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
modes: {
|
|
108
|
+
light: {
|
|
109
|
+
components: { link: { hoverColor: 'var(--rad-color-foreground)' } }
|
|
110
|
+
},
|
|
111
|
+
dark: {
|
|
112
|
+
tokens: {
|
|
113
|
+
color: {
|
|
114
|
+
surface: '#27242a',
|
|
115
|
+
foreground: '#fff8ef',
|
|
116
|
+
mutedForeground: '#c5bcb3',
|
|
117
|
+
border: '#fff8ef',
|
|
118
|
+
accent: '#ff90e8',
|
|
119
|
+
accentForeground: '#111111',
|
|
120
|
+
neutral: '#3b3540',
|
|
121
|
+
neutralForeground: '#fff8ef',
|
|
122
|
+
warning: '#ffc900',
|
|
123
|
+
warningForeground: '#111111',
|
|
124
|
+
danger: '#ff8585',
|
|
125
|
+
dangerForeground: '#111111',
|
|
126
|
+
focus: '#fff8ef',
|
|
127
|
+
placeholder: '#c5bcb3',
|
|
128
|
+
disabledBackground: '#3b3540',
|
|
129
|
+
disabledBorder: '#fff8ef',
|
|
130
|
+
invalid: '#ff8585'
|
|
131
|
+
},
|
|
132
|
+
surface: {
|
|
133
|
+
canvas: '#171419',
|
|
134
|
+
shadow: '4px 4px 0 var(--rad-color-border)',
|
|
135
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.65)',
|
|
136
|
+
backdrop: 'rgb(0 0 0 / 0.65)'
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=sharp-3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharp-3d.js","sourceRoot":"","sources":["../../../src/themes/sharp-3d.ts"],"names":[],"mappings":"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","sourcesContent":["import { defineTheme } from './defineTheme.js'\nimport { snap, settle } from './preset-values.js'\n\nexport const sharp = defineTheme({\n id: 'sharp-3d',\n name: 'Sharp 3D',\n tokens: {\n color: {\n surface: '#ffffff',\n foreground: '#111111',\n mutedForeground: '#53504a',\n border: '#111111',\n accent: '#ff90e8',\n accentForeground: '#111111',\n neutral: '#ffffff',\n neutralForeground: '#111111',\n warning: '#ffc900',\n warningForeground: '#111111',\n danger: '#ff5d5d',\n dangerForeground: '#111111',\n focus: '#111111',\n placeholder: '#53504a',\n disabledBackground: '#ffffff',\n disabledBorder: '#111111',\n invalid: '#b52929'\n },\n typography: {\n family: 'system-ui, sans-serif',\n bodySize: '1rem',\n smallSize: '0.875rem',\n headingSize: '1.25rem',\n bodyWeight: 400,\n labelWeight: 600,\n headingWeight: 700,\n letterSpacing: '0'\n },\n control: {\n small: {\n height: '2rem',\n paddingInline: '0.75rem',\n fontSize: '0.8125rem',\n indicatorSize: '1rem'\n },\n medium: {\n height: '2.75rem',\n paddingInline: '1.25rem',\n fontSize: '0.875rem',\n indicatorSize: '1.125rem'\n },\n large: {\n height: '3.25rem',\n paddingInline: '1.5rem',\n fontSize: '0.9375rem',\n indicatorSize: '1.25rem'\n },\n radius: '0px',\n cornerShape: 'round',\n borderWidth: '2px',\n borderStyle: 'solid'\n },\n surface: {\n canvas: '#f4f1ea',\n radius: '0px',\n cornerShape: 'round',\n borderWidth: '2px',\n borderStyle: 'solid',\n padding: '1.5rem',\n gap: '1rem',\n shadow: '4px 4px 0 var(--rad-color-border)',\n overlayShadow: '0 20px 60px rgb(0 0 0 / 0.22)',\n backdrop: 'rgb(15 12 25 / 0.45)'\n },\n focus: {\n width: '2px',\n offset: '0px',\n style: 'solid'\n },\n motion: {\n pressDuration: '60ms',\n pressEase: snap,\n releaseDuration: '120ms',\n releaseEase: settle,\n colorDuration: '150ms',\n disclosureDuration: '180ms'\n },\n state: { disabledOpacity: 0.5 }\n },\n components: {\n button: {\n borderColor: 'var(--rad-color-border)',\n radiusPressed: '0px',\n textTransform: 'uppercase',\n fontWeight: 400,\n letterSpacing: '0.02em',\n shadow: '4px 4px 0 0 var(--rad-color-border)',\n shadowPressed: '1px 1px 0 0 var(--rad-color-border)',\n ghostShadow: '4px 4px 0 0 var(--rad-color-border)',\n ghostShadowPressed: '1px 1px 0 0 var(--rad-color-border)',\n sheen: 0,\n highlight: 0,\n glow: '0%',\n pressScale: 1,\n pressShift: '3px',\n pressShiftX: '3px',\n fontFamily: \"'Archivo Black', system-ui, sans-serif\"\n }\n },\n modes: {\n light: {\n components: { link: { hoverColor: 'var(--rad-color-foreground)' } }\n },\n dark: {\n tokens: {\n color: {\n surface: '#27242a',\n foreground: '#fff8ef',\n mutedForeground: '#c5bcb3',\n border: '#fff8ef',\n accent: '#ff90e8',\n accentForeground: '#111111',\n neutral: '#3b3540',\n neutralForeground: '#fff8ef',\n warning: '#ffc900',\n warningForeground: '#111111',\n danger: '#ff8585',\n dangerForeground: '#111111',\n focus: '#fff8ef',\n placeholder: '#c5bcb3',\n disabledBackground: '#3b3540',\n disabledBorder: '#fff8ef',\n invalid: '#ff8585'\n },\n surface: {\n canvas: '#171419',\n shadow: '4px 4px 0 var(--rad-color-border)',\n overlayShadow: '0 20px 60px rgb(0 0 0 / 0.65)',\n backdrop: 'rgb(0 0 0 / 0.65)'\n }\n }\n }\n }\n})\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soft-squircle.d.ts","sourceRoot":"","sources":["../../../src/themes/soft-squircle.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,kCA+Hf,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { defineTheme } from './defineTheme.js';
|
|
2
|
+
import { snap, spring } from './preset-values.js';
|
|
3
|
+
export const soft = defineTheme({
|
|
4
|
+
id: 'soft-squircle',
|
|
5
|
+
name: 'Soft squircle',
|
|
6
|
+
tokens: {
|
|
7
|
+
color: {
|
|
8
|
+
surface: '#ffffff',
|
|
9
|
+
foreground: '#24314d',
|
|
10
|
+
mutedForeground: '#5c6880',
|
|
11
|
+
border: '#c5cfe6',
|
|
12
|
+
accent: '#2858c9',
|
|
13
|
+
accentForeground: '#ffffff',
|
|
14
|
+
neutral: '#eaf0ff',
|
|
15
|
+
neutralForeground: '#234581',
|
|
16
|
+
warning: '#efc355',
|
|
17
|
+
warningForeground: '#44300c',
|
|
18
|
+
danger: '#b52c34',
|
|
19
|
+
dangerForeground: '#ffffff',
|
|
20
|
+
focus: '#2858c9',
|
|
21
|
+
placeholder: '#5c6880',
|
|
22
|
+
disabledBackground: '#eaf0ff',
|
|
23
|
+
disabledBorder: '#c5cfe6',
|
|
24
|
+
invalid: '#b52c34'
|
|
25
|
+
},
|
|
26
|
+
typography: {
|
|
27
|
+
family: "'Nunito', system-ui, sans-serif",
|
|
28
|
+
bodySize: '1rem',
|
|
29
|
+
smallSize: '0.875rem',
|
|
30
|
+
headingSize: '1.25rem',
|
|
31
|
+
bodyWeight: 400,
|
|
32
|
+
labelWeight: 600,
|
|
33
|
+
headingWeight: 700,
|
|
34
|
+
letterSpacing: '0'
|
|
35
|
+
},
|
|
36
|
+
control: {
|
|
37
|
+
small: {
|
|
38
|
+
height: '2rem',
|
|
39
|
+
paddingInline: '0.75rem',
|
|
40
|
+
fontSize: '0.8125rem',
|
|
41
|
+
indicatorSize: '1rem'
|
|
42
|
+
},
|
|
43
|
+
medium: {
|
|
44
|
+
height: '2.75rem',
|
|
45
|
+
paddingInline: '1.125rem',
|
|
46
|
+
fontSize: '0.875rem',
|
|
47
|
+
indicatorSize: '1.125rem'
|
|
48
|
+
},
|
|
49
|
+
large: {
|
|
50
|
+
height: '3.25rem',
|
|
51
|
+
paddingInline: '1.5rem',
|
|
52
|
+
fontSize: '0.9375rem',
|
|
53
|
+
indicatorSize: '1.25rem'
|
|
54
|
+
},
|
|
55
|
+
radius: '1rem',
|
|
56
|
+
cornerShape: 'squircle',
|
|
57
|
+
borderWidth: '1px',
|
|
58
|
+
borderStyle: 'solid'
|
|
59
|
+
},
|
|
60
|
+
surface: {
|
|
61
|
+
canvas: '#f3f6ff',
|
|
62
|
+
radius: '1rem',
|
|
63
|
+
cornerShape: 'squircle',
|
|
64
|
+
borderWidth: '1px',
|
|
65
|
+
borderStyle: 'solid',
|
|
66
|
+
padding: '1.5rem',
|
|
67
|
+
gap: '1rem',
|
|
68
|
+
shadow: '0 1px 3px rgb(0 0 0 / 0.08)',
|
|
69
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.22)',
|
|
70
|
+
backdrop: 'rgb(15 12 25 / 0.45)'
|
|
71
|
+
},
|
|
72
|
+
focus: {
|
|
73
|
+
width: '2px',
|
|
74
|
+
offset: '4px',
|
|
75
|
+
style: 'solid'
|
|
76
|
+
},
|
|
77
|
+
motion: {
|
|
78
|
+
pressDuration: '90ms',
|
|
79
|
+
pressEase: snap,
|
|
80
|
+
releaseDuration: '520ms',
|
|
81
|
+
releaseEase: spring,
|
|
82
|
+
colorDuration: '150ms',
|
|
83
|
+
disclosureDuration: '180ms'
|
|
84
|
+
},
|
|
85
|
+
state: { disabledOpacity: 0.5 }
|
|
86
|
+
},
|
|
87
|
+
components: {
|
|
88
|
+
button: {
|
|
89
|
+
radiusPressed: '0.375rem',
|
|
90
|
+
fontWeight: 800,
|
|
91
|
+
shadow: '0 1px 1px rgb(0 0 0 / 0.12)',
|
|
92
|
+
shadowPressed: '0 1px 1px rgb(0 0 0 / 0.12)',
|
|
93
|
+
sheen: 0.08,
|
|
94
|
+
glow: '55%',
|
|
95
|
+
highlight: 0.22,
|
|
96
|
+
pressScale: 0.96
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
modes: {
|
|
100
|
+
dark: {
|
|
101
|
+
tokens: {
|
|
102
|
+
color: {
|
|
103
|
+
surface: '#1a2237',
|
|
104
|
+
foreground: '#edf2ff',
|
|
105
|
+
mutedForeground: '#b2c2e5',
|
|
106
|
+
border: '#596d9b',
|
|
107
|
+
accent: '#9cbaff',
|
|
108
|
+
accentForeground: '#142e68',
|
|
109
|
+
neutral: '#2c3b5f',
|
|
110
|
+
neutralForeground: '#e3ebff',
|
|
111
|
+
warning: '#efc355',
|
|
112
|
+
warningForeground: '#352507',
|
|
113
|
+
danger: '#ff9298',
|
|
114
|
+
dangerForeground: '#3c111a',
|
|
115
|
+
focus: '#a9c4ff',
|
|
116
|
+
placeholder: '#b2c2e5',
|
|
117
|
+
disabledBackground: '#2c3b5f',
|
|
118
|
+
disabledBorder: '#596d9b',
|
|
119
|
+
invalid: '#ff9298'
|
|
120
|
+
},
|
|
121
|
+
surface: {
|
|
122
|
+
canvas: '#10182a',
|
|
123
|
+
shadow: '0 1px 4px rgb(0 0 0 / 0.4)',
|
|
124
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.65)',
|
|
125
|
+
backdrop: 'rgb(0 0 0 / 0.65)'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=soft-squircle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soft-squircle.js","sourceRoot":"","sources":["../../../src/themes/soft-squircle.ts"],"names":[],"mappings":"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","sourcesContent":["import { defineTheme } from './defineTheme.js'\nimport { snap, spring } from './preset-values.js'\n\nexport const soft = defineTheme({\n id: 'soft-squircle',\n name: 'Soft squircle',\n tokens: {\n color: {\n surface: '#ffffff',\n foreground: '#24314d',\n mutedForeground: '#5c6880',\n border: '#c5cfe6',\n accent: '#2858c9',\n accentForeground: '#ffffff',\n neutral: '#eaf0ff',\n neutralForeground: '#234581',\n warning: '#efc355',\n warningForeground: '#44300c',\n danger: '#b52c34',\n dangerForeground: '#ffffff',\n focus: '#2858c9',\n placeholder: '#5c6880',\n disabledBackground: '#eaf0ff',\n disabledBorder: '#c5cfe6',\n invalid: '#b52c34'\n },\n typography: {\n family: \"'Nunito', system-ui, sans-serif\",\n bodySize: '1rem',\n smallSize: '0.875rem',\n headingSize: '1.25rem',\n bodyWeight: 400,\n labelWeight: 600,\n headingWeight: 700,\n letterSpacing: '0'\n },\n control: {\n small: {\n height: '2rem',\n paddingInline: '0.75rem',\n fontSize: '0.8125rem',\n indicatorSize: '1rem'\n },\n medium: {\n height: '2.75rem',\n paddingInline: '1.125rem',\n fontSize: '0.875rem',\n indicatorSize: '1.125rem'\n },\n large: {\n height: '3.25rem',\n paddingInline: '1.5rem',\n fontSize: '0.9375rem',\n indicatorSize: '1.25rem'\n },\n radius: '1rem',\n cornerShape: 'squircle',\n borderWidth: '1px',\n borderStyle: 'solid'\n },\n surface: {\n canvas: '#f3f6ff',\n radius: '1rem',\n cornerShape: 'squircle',\n borderWidth: '1px',\n borderStyle: 'solid',\n padding: '1.5rem',\n gap: '1rem',\n shadow: '0 1px 3px rgb(0 0 0 / 0.08)',\n overlayShadow: '0 20px 60px rgb(0 0 0 / 0.22)',\n backdrop: 'rgb(15 12 25 / 0.45)'\n },\n focus: {\n width: '2px',\n offset: '4px',\n style: 'solid'\n },\n motion: {\n pressDuration: '90ms',\n pressEase: snap,\n releaseDuration: '520ms',\n releaseEase: spring,\n colorDuration: '150ms',\n disclosureDuration: '180ms'\n },\n state: { disabledOpacity: 0.5 }\n },\n components: {\n button: {\n radiusPressed: '0.375rem',\n fontWeight: 800,\n shadow: '0 1px 1px rgb(0 0 0 / 0.12)',\n shadowPressed: '0 1px 1px rgb(0 0 0 / 0.12)',\n sheen: 0.08,\n glow: '55%',\n highlight: 0.22,\n pressScale: 0.96\n }\n },\n modes: {\n dark: {\n tokens: {\n color: {\n surface: '#1a2237',\n foreground: '#edf2ff',\n mutedForeground: '#b2c2e5',\n border: '#596d9b',\n accent: '#9cbaff',\n accentForeground: '#142e68',\n neutral: '#2c3b5f',\n neutralForeground: '#e3ebff',\n warning: '#efc355',\n warningForeground: '#352507',\n danger: '#ff9298',\n dangerForeground: '#3c111a',\n focus: '#a9c4ff',\n placeholder: '#b2c2e5',\n disabledBackground: '#2c3b5f',\n disabledBorder: '#596d9b',\n invalid: '#ff9298'\n },\n surface: {\n canvas: '#10182a',\n shadow: '0 1px 4px rgb(0 0 0 / 0.4)',\n overlayShadow: '0 20px 60px rgb(0 0 0 / 0.65)',\n backdrop: 'rgb(0 0 0 / 0.65)'\n }\n }\n }\n }\n})\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Theme, type ThemeDefinition } from './defineTheme.js';
|
|
2
|
+
import type { ThemeDocument, ThemeSectionExport, ThemeSectionName, ThemeSections } from './themeDocumentTypes.js';
|
|
3
|
+
export type * from './themeDocumentTypes.js';
|
|
4
|
+
/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */
|
|
5
|
+
export declare function parseThemeDocument(input: unknown): ThemeDocument | ThemeSectionExport;
|
|
6
|
+
/** Validate and detach an immutable, portable authoring snapshot. */
|
|
7
|
+
export declare function defineThemeDocument(document: ThemeDocument): ThemeDocument;
|
|
8
|
+
/** Compile only authored semantic values through the existing application theme runtime. */
|
|
9
|
+
export declare function compileThemeDocument(document: ThemeDocument): Theme;
|
|
10
|
+
/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */
|
|
11
|
+
export declare function updateThemeDocument(document: ThemeDocument, sections: ThemeSections, mode?: 'merge' | 'replace'): ThemeDocument;
|
|
12
|
+
/** Export exactly these sections, with no document identity or implicit component exceptions. */
|
|
13
|
+
export declare function exportThemeSections(document: ThemeDocument, names: readonly ThemeSectionName[]): ThemeSectionExport;
|
|
14
|
+
/** Bring existing authored themes into the workshop without materialising defaults as overrides. */
|
|
15
|
+
export declare function themeDocumentFromDefinition(definition: ThemeDefinition): ThemeDocument;
|
|
16
|
+
//# sourceMappingURL=themeDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeDocument.d.ts","sourceRoot":"","sources":["../../../src/themes/themeDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,eAAe,EAAmB,MAAM,kBAAkB,CAAA;AAEjG,OAAO,KAAK,EAEV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,yBAAyB,CAAA;AAEhC,mBAAmB,yBAAyB,CAAA;AA0L5C,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,kBAAkB,CAiDrF;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAK1E;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,KAAK,CAGnE;AAiBD,gGAAgG;AAChG,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,aAAa,EACvB,IAAI,GAAE,OAAO,GAAG,SAAmB,GAClC,aAAa,CAWf;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,SAAS,gBAAgB,EAAE,GACjC,kBAAkB,CAapB;AAED,oGAAoG;AACpG,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,eAAe,GAAG,aAAa,CAwBtF"}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { defineTheme } from './defineTheme.js';
|
|
2
|
+
import { freezeTree, tokenDefaults } from './tokens.js';
|
|
3
|
+
const sectionNames = [
|
|
4
|
+
...Object.keys(tokenDefaults.light),
|
|
5
|
+
'components'
|
|
6
|
+
];
|
|
7
|
+
const stops = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]);
|
|
8
|
+
function record(value, path) {
|
|
9
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
10
|
+
throw new TypeError(`${path} must be an object.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function keys(value, allowed, path) {
|
|
14
|
+
for (const key of Object.keys(value)) {
|
|
15
|
+
if (!allowed.includes(key))
|
|
16
|
+
throw new TypeError(`Unknown key: ${path}.${key}.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function textValue(value, path) {
|
|
20
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
21
|
+
throw new TypeError(`${path} must be a nonempty string.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function choice(value, allowed, path) {
|
|
25
|
+
if (!allowed.includes(value)) {
|
|
26
|
+
throw new TypeError(`${path} must be one of: ${allowed.join(', ')}.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function list(value, path) {
|
|
30
|
+
if (!Array.isArray(value))
|
|
31
|
+
throw new TypeError(`${path} must be an array.`);
|
|
32
|
+
}
|
|
33
|
+
function unique(value, seen, path) {
|
|
34
|
+
if (seen.has(value))
|
|
35
|
+
throw new TypeError(`Duplicate value at ${path}: ${String(value)}.`);
|
|
36
|
+
seen.add(value);
|
|
37
|
+
}
|
|
38
|
+
/** Copy data without running getters/toJSON or silently losing functions and binaries. */
|
|
39
|
+
function jsonCopy(value, path, ancestors = new Set()) {
|
|
40
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
41
|
+
return value;
|
|
42
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
43
|
+
return value === 0 ? 0 : value;
|
|
44
|
+
if (!value || typeof value !== 'object')
|
|
45
|
+
throw new TypeError(`${path} must contain JSON data only.`);
|
|
46
|
+
if (ancestors.has(value))
|
|
47
|
+
throw new TypeError(`Circular reference at ${path}.`);
|
|
48
|
+
const array = Array.isArray(value);
|
|
49
|
+
const prototype = Object.getPrototypeOf(value);
|
|
50
|
+
if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) {
|
|
51
|
+
throw new TypeError(`${path} must contain plain JSON objects, not class instances or binaries.`);
|
|
52
|
+
}
|
|
53
|
+
ancestors.add(value);
|
|
54
|
+
const result = array ? [] : {};
|
|
55
|
+
if (Object.getOwnPropertySymbols(value).length)
|
|
56
|
+
throw new TypeError(`${path} cannot contain symbol keys.`);
|
|
57
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
58
|
+
for (const key of Object.keys(descriptors).sort()) {
|
|
59
|
+
if (array && key === 'length')
|
|
60
|
+
continue;
|
|
61
|
+
if (['__proto__', 'constructor', 'prototype'].includes(key))
|
|
62
|
+
throw new TypeError(`Forbidden key: ${path}.${key}.`);
|
|
63
|
+
const descriptor = descriptors[key];
|
|
64
|
+
if (!('value' in descriptor) || !descriptor.enumerable) {
|
|
65
|
+
throw new TypeError(`${path}.${key} must be an enumerable data property.`);
|
|
66
|
+
}
|
|
67
|
+
if (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)) {
|
|
68
|
+
throw new TypeError(`${path}.${key} is not an array index.`);
|
|
69
|
+
}
|
|
70
|
+
// Optional object properties follow JSON omission rules; array holes/undefined are invalid.
|
|
71
|
+
if (descriptor.value === undefined && !array)
|
|
72
|
+
continue;
|
|
73
|
+
const copy = jsonCopy(descriptor.value, `${path}.${key}`, ancestors);
|
|
74
|
+
Object.defineProperty(result, key, {
|
|
75
|
+
value: copy,
|
|
76
|
+
enumerable: true,
|
|
77
|
+
writable: true,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (array && Object.keys(result).length !== value.length)
|
|
82
|
+
throw new TypeError(`${path} cannot contain array holes.`);
|
|
83
|
+
ancestors.delete(value);
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
function validateColor(value, path) {
|
|
87
|
+
if (value.brand !== undefined) {
|
|
88
|
+
record(value.brand, `${path}.brand`);
|
|
89
|
+
keys(value.brand, ['value', 'gamut', 'srgbFallback'], `${path}.brand`);
|
|
90
|
+
textValue(value.brand.value, `${path}.brand.value`);
|
|
91
|
+
choice(value.brand.gamut, ['srgb', 'display-p3'], `${path}.brand.gamut`);
|
|
92
|
+
if (value.brand.srgbFallback !== undefined)
|
|
93
|
+
textValue(value.brand.srgbFallback, `${path}.brand.srgbFallback`);
|
|
94
|
+
if (value.fidelity === undefined)
|
|
95
|
+
value.fidelity = 'anchored';
|
|
96
|
+
}
|
|
97
|
+
if (value.fidelity !== undefined)
|
|
98
|
+
choice(value.fidelity, ['anchored', 'unanchored'], `${path}.fidelity`);
|
|
99
|
+
if (value.palettes !== undefined) {
|
|
100
|
+
list(value.palettes, `${path}.palettes`);
|
|
101
|
+
const ids = new Set();
|
|
102
|
+
for (const [i, palette] of value.palettes.entries()) {
|
|
103
|
+
const p = `${path}.palettes.${i}`;
|
|
104
|
+
record(palette, p);
|
|
105
|
+
keys(palette, ['id', 'name', 'swatches'], p);
|
|
106
|
+
textValue(palette.id, `${p}.id`);
|
|
107
|
+
textValue(palette.name, `${p}.name`);
|
|
108
|
+
unique(palette.id, ids, `${p}.id`);
|
|
109
|
+
list(palette.swatches, `${p}.swatches`);
|
|
110
|
+
if (!palette.swatches.length)
|
|
111
|
+
throw new TypeError(`${p}.swatches must not be empty.`);
|
|
112
|
+
const seen = new Set();
|
|
113
|
+
for (const [j, swatch] of palette.swatches.entries()) {
|
|
114
|
+
const s = `${p}.swatches.${j}`;
|
|
115
|
+
record(swatch, s);
|
|
116
|
+
keys(swatch, ['stop', 'value', 'srgbFallback'], s);
|
|
117
|
+
if (!stops.has(swatch.stop))
|
|
118
|
+
throw new TypeError(`${s}.stop must be a numbered color stop (50–950).`);
|
|
119
|
+
unique(swatch.stop, seen, `${s}.stop`);
|
|
120
|
+
textValue(swatch.value, `${s}.value`);
|
|
121
|
+
if (swatch.srgbFallback !== undefined)
|
|
122
|
+
textValue(swatch.srgbFallback, `${s}.srgbFallback`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (value.anchor !== undefined) {
|
|
127
|
+
record(value.anchor, `${path}.anchor`);
|
|
128
|
+
keys(value.anchor, ['paletteId', 'stop'], `${path}.anchor`);
|
|
129
|
+
textValue(value.anchor.paletteId, `${path}.anchor.paletteId`);
|
|
130
|
+
if (!stops.has(value.anchor.stop))
|
|
131
|
+
throw new TypeError(`${path}.anchor.stop must be a numbered color stop (50–950).`);
|
|
132
|
+
const color = value;
|
|
133
|
+
const swatch = color.palettes
|
|
134
|
+
?.find(p => p.id === color.anchor.paletteId)
|
|
135
|
+
?.swatches.find(s => s.stop === color.anchor.stop);
|
|
136
|
+
if (!color.brand || color.fidelity !== 'anchored' || swatch?.value !== color.brand.value) {
|
|
137
|
+
throw new TypeError(`${path}.anchor must reference a swatch containing the exact brand.value with anchored fidelity. Regenerate or replace the color section.`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function validateFonts(value, path) {
|
|
142
|
+
list(value, path);
|
|
143
|
+
const ids = new Set();
|
|
144
|
+
for (const [i, font] of value.entries()) {
|
|
145
|
+
const p = `${path}.${i}`;
|
|
146
|
+
record(font, p);
|
|
147
|
+
keys(font, ['id', 'family', 'source', 'weights', 'styles'], p);
|
|
148
|
+
textValue(font.id, `${p}.id`);
|
|
149
|
+
textValue(font.family, `${p}.family`);
|
|
150
|
+
unique(font.id, ids, `${p}.id`);
|
|
151
|
+
choice(font.source, ['system', 'catalog', 'local'], `${p}.source`);
|
|
152
|
+
for (const key of ['weights', 'styles']) {
|
|
153
|
+
if (font[key] === undefined)
|
|
154
|
+
continue;
|
|
155
|
+
list(font[key], `${p}.${key}`);
|
|
156
|
+
const seen = new Set();
|
|
157
|
+
for (const [j, item] of font[key].entries()) {
|
|
158
|
+
const at = `${p}.${key}.${j}`;
|
|
159
|
+
if (key === 'styles')
|
|
160
|
+
choice(item, ['normal', 'italic'], at);
|
|
161
|
+
else if (typeof item !== 'number' || item < 1 || item > 1000)
|
|
162
|
+
throw new TypeError(`${at} must be a weight from 1 to 1000.`);
|
|
163
|
+
unique(item, seen, at);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function toDefinition(sections, id, name) {
|
|
169
|
+
const common = { tokens: {} };
|
|
170
|
+
const modes = { light: { tokens: {} }, dark: { tokens: {} } };
|
|
171
|
+
for (const sectionName of sectionNames) {
|
|
172
|
+
const section = sections[sectionName];
|
|
173
|
+
if (!section)
|
|
174
|
+
continue;
|
|
175
|
+
for (const mode of ['common', 'light', 'dark']) {
|
|
176
|
+
const values = mode === 'common' ? section.values : section.modes?.[mode];
|
|
177
|
+
if (values === undefined)
|
|
178
|
+
continue;
|
|
179
|
+
const layer = mode === 'common' ? common : modes[mode];
|
|
180
|
+
if (sectionName === 'components')
|
|
181
|
+
layer.components = values;
|
|
182
|
+
else
|
|
183
|
+
layer.tokens[sectionName] = values;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return { id, name, ...common, modes };
|
|
187
|
+
}
|
|
188
|
+
/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */
|
|
189
|
+
export function parseThemeDocument(input) {
|
|
190
|
+
const value = jsonCopy(input, 'document');
|
|
191
|
+
record(value, 'document');
|
|
192
|
+
choice(value.kind, ['radiant-theme', 'radiant-theme-sections'], 'document.kind');
|
|
193
|
+
if (value.version !== 1)
|
|
194
|
+
throw new TypeError(`Unsupported document.version: ${String(value.version)}. Expected 1; migrate the configuration before importing.`);
|
|
195
|
+
const full = value.kind === 'radiant-theme';
|
|
196
|
+
keys(value, full ? ['kind', 'version', 'id', 'name', 'sections'] : ['kind', 'version', 'sections'], 'document');
|
|
197
|
+
record(value.sections, 'document.sections');
|
|
198
|
+
keys(value.sections, sectionNames, 'document.sections');
|
|
199
|
+
for (const [name, section] of Object.entries(value.sections)) {
|
|
200
|
+
const path = `document.sections.${name}`;
|
|
201
|
+
record(section, path);
|
|
202
|
+
keys(section, [
|
|
203
|
+
'values',
|
|
204
|
+
'modes',
|
|
205
|
+
...(name === 'color'
|
|
206
|
+
? ['brand', 'fidelity', 'palettes', 'anchor']
|
|
207
|
+
: name === 'typography'
|
|
208
|
+
? ['fonts']
|
|
209
|
+
: [])
|
|
210
|
+
], path);
|
|
211
|
+
if (section.modes !== undefined) {
|
|
212
|
+
record(section.modes, `${path}.modes`);
|
|
213
|
+
keys(section.modes, ['light', 'dark'], `${path}.modes`);
|
|
214
|
+
}
|
|
215
|
+
if (name === 'color')
|
|
216
|
+
validateColor(section, path);
|
|
217
|
+
if (name === 'typography' && section.fonts !== undefined)
|
|
218
|
+
validateFonts(section.fonts, `${path}.fonts`);
|
|
219
|
+
}
|
|
220
|
+
// Reuse the canonical token/component validation and resolution; no second token schema.
|
|
221
|
+
defineTheme(toDefinition(value.sections, full ? value.id : 'section-export', full ? value.name : 'Section export'));
|
|
222
|
+
return freezeTree(jsonCopy(value, 'document'));
|
|
223
|
+
}
|
|
224
|
+
/** Validate and detach an immutable, portable authoring snapshot. */
|
|
225
|
+
export function defineThemeDocument(document) {
|
|
226
|
+
const result = parseThemeDocument(document);
|
|
227
|
+
if (result.kind !== 'radiant-theme')
|
|
228
|
+
throw new TypeError('Expected a radiant-theme document with id and name.');
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
/** Compile only authored semantic values through the existing application theme runtime. */
|
|
232
|
+
export function compileThemeDocument(document) {
|
|
233
|
+
const validated = defineThemeDocument(document);
|
|
234
|
+
return defineTheme(toDefinition(validated.sections, validated.id, validated.name));
|
|
235
|
+
}
|
|
236
|
+
function merge(base, patch) {
|
|
237
|
+
if (!base ||
|
|
238
|
+
!patch ||
|
|
239
|
+
typeof base !== 'object' ||
|
|
240
|
+
typeof patch !== 'object' ||
|
|
241
|
+
Array.isArray(base) ||
|
|
242
|
+
Array.isArray(patch))
|
|
243
|
+
return patch;
|
|
244
|
+
const result = { ...base };
|
|
245
|
+
for (const [key, value] of Object.entries(patch))
|
|
246
|
+
result[key] = merge(result[key], value);
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */
|
|
250
|
+
export function updateThemeDocument(document, sections, mode = 'merge') {
|
|
251
|
+
const base = defineThemeDocument(document);
|
|
252
|
+
choice(mode, ['merge', 'replace'], 'update mode');
|
|
253
|
+
// Check the patch's JSON boundary before merging, including keys a spread would discard.
|
|
254
|
+
const patch = jsonCopy(sections, 'sections');
|
|
255
|
+
record(patch, 'sections');
|
|
256
|
+
keys(patch, sectionNames, 'sections');
|
|
257
|
+
const next = { ...base.sections };
|
|
258
|
+
for (const [name, section] of Object.entries(patch))
|
|
259
|
+
next[name] = mode === 'replace' ? section : merge(next[name], section);
|
|
260
|
+
return defineThemeDocument({ ...base, sections: next });
|
|
261
|
+
}
|
|
262
|
+
/** Export exactly these sections, with no document identity or implicit component exceptions. */
|
|
263
|
+
export function exportThemeSections(document, names) {
|
|
264
|
+
const base = defineThemeDocument(document);
|
|
265
|
+
list(names, 'section names');
|
|
266
|
+
const sections = {};
|
|
267
|
+
for (const name of names) {
|
|
268
|
+
choice(name, sectionNames, 'section name');
|
|
269
|
+
if (base.sections[name] !== undefined)
|
|
270
|
+
sections[name] = base.sections[name];
|
|
271
|
+
}
|
|
272
|
+
return parseThemeDocument({
|
|
273
|
+
kind: 'radiant-theme-sections',
|
|
274
|
+
version: 1,
|
|
275
|
+
sections
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/** Bring existing authored themes into the workshop without materialising defaults as overrides. */
|
|
279
|
+
export function themeDocumentFromDefinition(definition) {
|
|
280
|
+
const copy = jsonCopy(definition, 'theme');
|
|
281
|
+
defineTheme(copy);
|
|
282
|
+
const sections = {};
|
|
283
|
+
for (const name of sectionNames) {
|
|
284
|
+
const section = {};
|
|
285
|
+
const values = name === 'components' ? copy.components : copy.tokens?.[name];
|
|
286
|
+
if (values !== undefined)
|
|
287
|
+
section.values = values;
|
|
288
|
+
const modes = {};
|
|
289
|
+
for (const mode of ['light', 'dark']) {
|
|
290
|
+
const values = name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name];
|
|
291
|
+
if (values !== undefined)
|
|
292
|
+
modes[mode] = values;
|
|
293
|
+
}
|
|
294
|
+
if (Object.keys(modes).length)
|
|
295
|
+
section.modes = modes;
|
|
296
|
+
if (Object.keys(section).length)
|
|
297
|
+
sections[name] = section;
|
|
298
|
+
}
|
|
299
|
+
return defineThemeDocument({
|
|
300
|
+
kind: 'radiant-theme',
|
|
301
|
+
version: 1,
|
|
302
|
+
id: copy.id,
|
|
303
|
+
name: copy.name,
|
|
304
|
+
sections
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=themeDocument.js.map
|