@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,131 @@
|
|
|
1
|
+
import { defineTheme } from './defineTheme.js'
|
|
2
|
+
import { snap, spring } from './preset-values.js'
|
|
3
|
+
|
|
4
|
+
export const soft = defineTheme({
|
|
5
|
+
id: 'soft-squircle',
|
|
6
|
+
name: 'Soft squircle',
|
|
7
|
+
tokens: {
|
|
8
|
+
color: {
|
|
9
|
+
surface: '#ffffff',
|
|
10
|
+
foreground: '#24314d',
|
|
11
|
+
mutedForeground: '#5c6880',
|
|
12
|
+
border: '#c5cfe6',
|
|
13
|
+
accent: '#2858c9',
|
|
14
|
+
accentForeground: '#ffffff',
|
|
15
|
+
neutral: '#eaf0ff',
|
|
16
|
+
neutralForeground: '#234581',
|
|
17
|
+
warning: '#efc355',
|
|
18
|
+
warningForeground: '#44300c',
|
|
19
|
+
danger: '#b52c34',
|
|
20
|
+
dangerForeground: '#ffffff',
|
|
21
|
+
focus: '#2858c9',
|
|
22
|
+
placeholder: '#5c6880',
|
|
23
|
+
disabledBackground: '#eaf0ff',
|
|
24
|
+
disabledBorder: '#c5cfe6',
|
|
25
|
+
invalid: '#b52c34'
|
|
26
|
+
},
|
|
27
|
+
typography: {
|
|
28
|
+
family: "'Nunito', system-ui, sans-serif",
|
|
29
|
+
bodySize: '1rem',
|
|
30
|
+
smallSize: '0.875rem',
|
|
31
|
+
headingSize: '1.25rem',
|
|
32
|
+
bodyWeight: 400,
|
|
33
|
+
labelWeight: 600,
|
|
34
|
+
headingWeight: 700,
|
|
35
|
+
letterSpacing: '0'
|
|
36
|
+
},
|
|
37
|
+
control: {
|
|
38
|
+
small: {
|
|
39
|
+
height: '2rem',
|
|
40
|
+
paddingInline: '0.75rem',
|
|
41
|
+
fontSize: '0.8125rem',
|
|
42
|
+
indicatorSize: '1rem'
|
|
43
|
+
},
|
|
44
|
+
medium: {
|
|
45
|
+
height: '2.75rem',
|
|
46
|
+
paddingInline: '1.125rem',
|
|
47
|
+
fontSize: '0.875rem',
|
|
48
|
+
indicatorSize: '1.125rem'
|
|
49
|
+
},
|
|
50
|
+
large: {
|
|
51
|
+
height: '3.25rem',
|
|
52
|
+
paddingInline: '1.5rem',
|
|
53
|
+
fontSize: '0.9375rem',
|
|
54
|
+
indicatorSize: '1.25rem'
|
|
55
|
+
},
|
|
56
|
+
radius: '1rem',
|
|
57
|
+
cornerShape: 'squircle',
|
|
58
|
+
borderWidth: '1px',
|
|
59
|
+
borderStyle: 'solid'
|
|
60
|
+
},
|
|
61
|
+
surface: {
|
|
62
|
+
canvas: '#f3f6ff',
|
|
63
|
+
radius: '1rem',
|
|
64
|
+
cornerShape: 'squircle',
|
|
65
|
+
borderWidth: '1px',
|
|
66
|
+
borderStyle: 'solid',
|
|
67
|
+
padding: '1.5rem',
|
|
68
|
+
gap: '1rem',
|
|
69
|
+
shadow: '0 1px 3px rgb(0 0 0 / 0.08)',
|
|
70
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.22)',
|
|
71
|
+
backdrop: 'rgb(15 12 25 / 0.45)'
|
|
72
|
+
},
|
|
73
|
+
focus: {
|
|
74
|
+
width: '2px',
|
|
75
|
+
offset: '4px',
|
|
76
|
+
style: 'solid'
|
|
77
|
+
},
|
|
78
|
+
motion: {
|
|
79
|
+
pressDuration: '90ms',
|
|
80
|
+
pressEase: snap,
|
|
81
|
+
releaseDuration: '520ms',
|
|
82
|
+
releaseEase: spring,
|
|
83
|
+
colorDuration: '150ms',
|
|
84
|
+
disclosureDuration: '180ms'
|
|
85
|
+
},
|
|
86
|
+
state: { disabledOpacity: 0.5 }
|
|
87
|
+
},
|
|
88
|
+
components: {
|
|
89
|
+
button: {
|
|
90
|
+
radiusPressed: '0.375rem',
|
|
91
|
+
fontWeight: 800,
|
|
92
|
+
shadow: '0 1px 1px rgb(0 0 0 / 0.12)',
|
|
93
|
+
shadowPressed: '0 1px 1px rgb(0 0 0 / 0.12)',
|
|
94
|
+
sheen: 0.08,
|
|
95
|
+
glow: '55%',
|
|
96
|
+
highlight: 0.22,
|
|
97
|
+
pressScale: 0.96
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
modes: {
|
|
101
|
+
dark: {
|
|
102
|
+
tokens: {
|
|
103
|
+
color: {
|
|
104
|
+
surface: '#1a2237',
|
|
105
|
+
foreground: '#edf2ff',
|
|
106
|
+
mutedForeground: '#b2c2e5',
|
|
107
|
+
border: '#596d9b',
|
|
108
|
+
accent: '#9cbaff',
|
|
109
|
+
accentForeground: '#142e68',
|
|
110
|
+
neutral: '#2c3b5f',
|
|
111
|
+
neutralForeground: '#e3ebff',
|
|
112
|
+
warning: '#efc355',
|
|
113
|
+
warningForeground: '#352507',
|
|
114
|
+
danger: '#ff9298',
|
|
115
|
+
dangerForeground: '#3c111a',
|
|
116
|
+
focus: '#a9c4ff',
|
|
117
|
+
placeholder: '#b2c2e5',
|
|
118
|
+
disabledBackground: '#2c3b5f',
|
|
119
|
+
disabledBorder: '#596d9b',
|
|
120
|
+
invalid: '#ff9298'
|
|
121
|
+
},
|
|
122
|
+
surface: {
|
|
123
|
+
canvas: '#10182a',
|
|
124
|
+
shadow: '0 1px 4px rgb(0 0 0 / 0.4)',
|
|
125
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.65)',
|
|
126
|
+
backdrop: 'rgb(0 0 0 / 0.65)'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
})
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { defineTheme, type Theme, type ThemeDefinition, type ThemeLayer } from './defineTheme.js'
|
|
2
|
+
import { freezeTree, tokenDefaults } from './tokens.js'
|
|
3
|
+
import type {
|
|
4
|
+
ThemeColorSection,
|
|
5
|
+
ThemeDocument,
|
|
6
|
+
ThemeSectionExport,
|
|
7
|
+
ThemeSectionName,
|
|
8
|
+
ThemeSections
|
|
9
|
+
} from './themeDocumentTypes.js'
|
|
10
|
+
|
|
11
|
+
export type * from './themeDocumentTypes.js'
|
|
12
|
+
|
|
13
|
+
const sectionNames: readonly ThemeSectionName[] = [
|
|
14
|
+
...Object.keys(tokenDefaults.light),
|
|
15
|
+
'components'
|
|
16
|
+
] as ThemeSectionName[]
|
|
17
|
+
const stops = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])
|
|
18
|
+
type RecordValue = Record<string, unknown>
|
|
19
|
+
|
|
20
|
+
function record(value: unknown, path: string): asserts value is RecordValue {
|
|
21
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
22
|
+
throw new TypeError(`${path} must be an object.`)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function keys(value: RecordValue, allowed: readonly string[], path: string) {
|
|
27
|
+
for (const key of Object.keys(value)) {
|
|
28
|
+
if (!allowed.includes(key)) throw new TypeError(`Unknown key: ${path}.${key}.`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function textValue(value: unknown, path: string) {
|
|
33
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
34
|
+
throw new TypeError(`${path} must be a nonempty string.`)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function choice(value: unknown, allowed: readonly unknown[], path: string) {
|
|
39
|
+
if (!allowed.includes(value)) {
|
|
40
|
+
throw new TypeError(`${path} must be one of: ${allowed.join(', ')}.`)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function list(value: unknown, path: string): asserts value is unknown[] {
|
|
45
|
+
if (!Array.isArray(value)) throw new TypeError(`${path} must be an array.`)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function unique(value: unknown, seen: Set<unknown>, path: string) {
|
|
49
|
+
if (seen.has(value)) throw new TypeError(`Duplicate value at ${path}: ${String(value)}.`)
|
|
50
|
+
seen.add(value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Copy data without running getters/toJSON or silently losing functions and binaries. */
|
|
54
|
+
function jsonCopy(value: unknown, path: string, ancestors = new Set<object>()): unknown {
|
|
55
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean') return value
|
|
56
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value === 0 ? 0 : value
|
|
57
|
+
if (!value || typeof value !== 'object')
|
|
58
|
+
throw new TypeError(`${path} must contain JSON data only.`)
|
|
59
|
+
if (ancestors.has(value)) throw new TypeError(`Circular reference at ${path}.`)
|
|
60
|
+
const array = Array.isArray(value)
|
|
61
|
+
const prototype = Object.getPrototypeOf(value)
|
|
62
|
+
if (
|
|
63
|
+
array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null
|
|
64
|
+
) {
|
|
65
|
+
throw new TypeError(`${path} must contain plain JSON objects, not class instances or binaries.`)
|
|
66
|
+
}
|
|
67
|
+
ancestors.add(value)
|
|
68
|
+
const result: RecordValue | unknown[] = array ? [] : {}
|
|
69
|
+
if (Object.getOwnPropertySymbols(value).length)
|
|
70
|
+
throw new TypeError(`${path} cannot contain symbol keys.`)
|
|
71
|
+
const descriptors = Object.getOwnPropertyDescriptors(value)
|
|
72
|
+
for (const key of Object.keys(descriptors).sort()) {
|
|
73
|
+
if (array && key === 'length') continue
|
|
74
|
+
if (['__proto__', 'constructor', 'prototype'].includes(key))
|
|
75
|
+
throw new TypeError(`Forbidden key: ${path}.${key}.`)
|
|
76
|
+
const descriptor = descriptors[key]
|
|
77
|
+
if (!('value' in descriptor) || !descriptor.enumerable) {
|
|
78
|
+
throw new TypeError(`${path}.${key} must be an enumerable data property.`)
|
|
79
|
+
}
|
|
80
|
+
if (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)) {
|
|
81
|
+
throw new TypeError(`${path}.${key} is not an array index.`)
|
|
82
|
+
}
|
|
83
|
+
// Optional object properties follow JSON omission rules; array holes/undefined are invalid.
|
|
84
|
+
if (descriptor.value === undefined && !array) continue
|
|
85
|
+
const copy = jsonCopy(descriptor.value, `${path}.${key}`, ancestors)
|
|
86
|
+
Object.defineProperty(result, key, {
|
|
87
|
+
value: copy,
|
|
88
|
+
enumerable: true,
|
|
89
|
+
writable: true,
|
|
90
|
+
configurable: true
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
if (array && Object.keys(result).length !== value.length)
|
|
94
|
+
throw new TypeError(`${path} cannot contain array holes.`)
|
|
95
|
+
ancestors.delete(value)
|
|
96
|
+
return result
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function validateColor(value: RecordValue, path: string) {
|
|
100
|
+
if (value.brand !== undefined) {
|
|
101
|
+
record(value.brand, `${path}.brand`)
|
|
102
|
+
keys(value.brand, ['value', 'gamut', 'srgbFallback'], `${path}.brand`)
|
|
103
|
+
textValue(value.brand.value, `${path}.brand.value`)
|
|
104
|
+
choice(value.brand.gamut, ['srgb', 'display-p3'], `${path}.brand.gamut`)
|
|
105
|
+
if (value.brand.srgbFallback !== undefined)
|
|
106
|
+
textValue(value.brand.srgbFallback, `${path}.brand.srgbFallback`)
|
|
107
|
+
if (value.fidelity === undefined) value.fidelity = 'anchored'
|
|
108
|
+
}
|
|
109
|
+
if (value.fidelity !== undefined)
|
|
110
|
+
choice(value.fidelity, ['anchored', 'unanchored'], `${path}.fidelity`)
|
|
111
|
+
if (value.palettes !== undefined) {
|
|
112
|
+
list(value.palettes, `${path}.palettes`)
|
|
113
|
+
const ids = new Set<unknown>()
|
|
114
|
+
for (const [i, palette] of value.palettes.entries()) {
|
|
115
|
+
const p = `${path}.palettes.${i}`
|
|
116
|
+
record(palette, p)
|
|
117
|
+
keys(palette, ['id', 'name', 'swatches'], p)
|
|
118
|
+
textValue(palette.id, `${p}.id`)
|
|
119
|
+
textValue(palette.name, `${p}.name`)
|
|
120
|
+
unique(palette.id, ids, `${p}.id`)
|
|
121
|
+
list(palette.swatches, `${p}.swatches`)
|
|
122
|
+
if (!palette.swatches.length) throw new TypeError(`${p}.swatches must not be empty.`)
|
|
123
|
+
const seen = new Set<unknown>()
|
|
124
|
+
for (const [j, swatch] of palette.swatches.entries()) {
|
|
125
|
+
const s = `${p}.swatches.${j}`
|
|
126
|
+
record(swatch, s)
|
|
127
|
+
keys(swatch, ['stop', 'value', 'srgbFallback'], s)
|
|
128
|
+
if (!stops.has(swatch.stop as number))
|
|
129
|
+
throw new TypeError(`${s}.stop must be a numbered color stop (50–950).`)
|
|
130
|
+
unique(swatch.stop, seen, `${s}.stop`)
|
|
131
|
+
textValue(swatch.value, `${s}.value`)
|
|
132
|
+
if (swatch.srgbFallback !== undefined) textValue(swatch.srgbFallback, `${s}.srgbFallback`)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (value.anchor !== undefined) {
|
|
137
|
+
record(value.anchor, `${path}.anchor`)
|
|
138
|
+
keys(value.anchor, ['paletteId', 'stop'], `${path}.anchor`)
|
|
139
|
+
textValue(value.anchor.paletteId, `${path}.anchor.paletteId`)
|
|
140
|
+
if (!stops.has(value.anchor.stop as number))
|
|
141
|
+
throw new TypeError(`${path}.anchor.stop must be a numbered color stop (50–950).`)
|
|
142
|
+
const color = value as ThemeColorSection
|
|
143
|
+
const swatch = color.palettes
|
|
144
|
+
?.find(p => p.id === color.anchor!.paletteId)
|
|
145
|
+
?.swatches.find(s => s.stop === color.anchor!.stop)
|
|
146
|
+
if (!color.brand || color.fidelity !== 'anchored' || swatch?.value !== color.brand.value) {
|
|
147
|
+
throw new TypeError(
|
|
148
|
+
`${path}.anchor must reference a swatch containing the exact brand.value with anchored fidelity. Regenerate or replace the color section.`
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function validateFonts(value: unknown, path: string) {
|
|
155
|
+
list(value, path)
|
|
156
|
+
const ids = new Set<unknown>()
|
|
157
|
+
for (const [i, font] of value.entries()) {
|
|
158
|
+
const p = `${path}.${i}`
|
|
159
|
+
record(font, p)
|
|
160
|
+
keys(font, ['id', 'family', 'source', 'weights', 'styles'], p)
|
|
161
|
+
textValue(font.id, `${p}.id`)
|
|
162
|
+
textValue(font.family, `${p}.family`)
|
|
163
|
+
unique(font.id, ids, `${p}.id`)
|
|
164
|
+
choice(font.source, ['system', 'catalog', 'local'], `${p}.source`)
|
|
165
|
+
for (const key of ['weights', 'styles']) {
|
|
166
|
+
if (font[key] === undefined) continue
|
|
167
|
+
list(font[key], `${p}.${key}`)
|
|
168
|
+
const seen = new Set<unknown>()
|
|
169
|
+
for (const [j, item] of font[key].entries()) {
|
|
170
|
+
const at = `${p}.${key}.${j}`
|
|
171
|
+
if (key === 'styles') choice(item, ['normal', 'italic'], at)
|
|
172
|
+
else if (typeof item !== 'number' || item < 1 || item > 1000)
|
|
173
|
+
throw new TypeError(`${at} must be a weight from 1 to 1000.`)
|
|
174
|
+
unique(item, seen, at)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function toDefinition(sections: ThemeSections, id: string, name: string): ThemeDefinition {
|
|
181
|
+
const common: { tokens: RecordValue; components?: ThemeLayer['components'] } = { tokens: {} }
|
|
182
|
+
const modes = { light: { tokens: {} } as typeof common, dark: { tokens: {} } as typeof common }
|
|
183
|
+
for (const sectionName of sectionNames) {
|
|
184
|
+
const section = sections[sectionName]
|
|
185
|
+
if (!section) continue
|
|
186
|
+
for (const mode of ['common', 'light', 'dark'] as const) {
|
|
187
|
+
const values = mode === 'common' ? section.values : section.modes?.[mode]
|
|
188
|
+
if (values === undefined) continue
|
|
189
|
+
const layer = mode === 'common' ? common : modes[mode]
|
|
190
|
+
if (sectionName === 'components') layer.components = values as ThemeLayer['components']
|
|
191
|
+
else layer.tokens[sectionName] = values
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return { id, name, ...common, modes }
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */
|
|
198
|
+
export function parseThemeDocument(input: unknown): ThemeDocument | ThemeSectionExport {
|
|
199
|
+
const value = jsonCopy(input, 'document')
|
|
200
|
+
record(value, 'document')
|
|
201
|
+
choice(value.kind, ['radiant-theme', 'radiant-theme-sections'], 'document.kind')
|
|
202
|
+
if (value.version !== 1)
|
|
203
|
+
throw new TypeError(
|
|
204
|
+
`Unsupported document.version: ${String(value.version)}. Expected 1; migrate the configuration before importing.`
|
|
205
|
+
)
|
|
206
|
+
const full = value.kind === 'radiant-theme'
|
|
207
|
+
keys(
|
|
208
|
+
value,
|
|
209
|
+
full ? ['kind', 'version', 'id', 'name', 'sections'] : ['kind', 'version', 'sections'],
|
|
210
|
+
'document'
|
|
211
|
+
)
|
|
212
|
+
record(value.sections, 'document.sections')
|
|
213
|
+
keys(value.sections, sectionNames, 'document.sections')
|
|
214
|
+
for (const [name, section] of Object.entries(value.sections)) {
|
|
215
|
+
const path = `document.sections.${name}`
|
|
216
|
+
record(section, path)
|
|
217
|
+
keys(
|
|
218
|
+
section,
|
|
219
|
+
[
|
|
220
|
+
'values',
|
|
221
|
+
'modes',
|
|
222
|
+
...(name === 'color'
|
|
223
|
+
? ['brand', 'fidelity', 'palettes', 'anchor']
|
|
224
|
+
: name === 'typography'
|
|
225
|
+
? ['fonts']
|
|
226
|
+
: [])
|
|
227
|
+
],
|
|
228
|
+
path
|
|
229
|
+
)
|
|
230
|
+
if (section.modes !== undefined) {
|
|
231
|
+
record(section.modes, `${path}.modes`)
|
|
232
|
+
keys(section.modes, ['light', 'dark'], `${path}.modes`)
|
|
233
|
+
}
|
|
234
|
+
if (name === 'color') validateColor(section, path)
|
|
235
|
+
if (name === 'typography' && section.fonts !== undefined)
|
|
236
|
+
validateFonts(section.fonts, `${path}.fonts`)
|
|
237
|
+
}
|
|
238
|
+
// Reuse the canonical token/component validation and resolution; no second token schema.
|
|
239
|
+
defineTheme(
|
|
240
|
+
toDefinition(
|
|
241
|
+
value.sections as ThemeSections,
|
|
242
|
+
full ? (value.id as string) : 'section-export',
|
|
243
|
+
full ? (value.name as string) : 'Section export'
|
|
244
|
+
)
|
|
245
|
+
)
|
|
246
|
+
return freezeTree(jsonCopy(value, 'document') as object) as ThemeDocument | ThemeSectionExport
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** Validate and detach an immutable, portable authoring snapshot. */
|
|
250
|
+
export function defineThemeDocument(document: ThemeDocument): ThemeDocument {
|
|
251
|
+
const result = parseThemeDocument(document)
|
|
252
|
+
if (result.kind !== 'radiant-theme')
|
|
253
|
+
throw new TypeError('Expected a radiant-theme document with id and name.')
|
|
254
|
+
return result
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Compile only authored semantic values through the existing application theme runtime. */
|
|
258
|
+
export function compileThemeDocument(document: ThemeDocument): Theme {
|
|
259
|
+
const validated = defineThemeDocument(document)
|
|
260
|
+
return defineTheme(toDefinition(validated.sections, validated.id, validated.name))
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function merge(base: unknown, patch: unknown): unknown {
|
|
264
|
+
if (
|
|
265
|
+
!base ||
|
|
266
|
+
!patch ||
|
|
267
|
+
typeof base !== 'object' ||
|
|
268
|
+
typeof patch !== 'object' ||
|
|
269
|
+
Array.isArray(base) ||
|
|
270
|
+
Array.isArray(patch)
|
|
271
|
+
)
|
|
272
|
+
return patch
|
|
273
|
+
const result: RecordValue = { ...base }
|
|
274
|
+
for (const [key, value] of Object.entries(patch)) result[key] = merge(result[key], value)
|
|
275
|
+
return result
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */
|
|
279
|
+
export function updateThemeDocument(
|
|
280
|
+
document: ThemeDocument,
|
|
281
|
+
sections: ThemeSections,
|
|
282
|
+
mode: 'merge' | 'replace' = 'merge'
|
|
283
|
+
): ThemeDocument {
|
|
284
|
+
const base = defineThemeDocument(document)
|
|
285
|
+
choice(mode, ['merge', 'replace'], 'update mode')
|
|
286
|
+
// Check the patch's JSON boundary before merging, including keys a spread would discard.
|
|
287
|
+
const patch = jsonCopy(sections, 'sections')
|
|
288
|
+
record(patch, 'sections')
|
|
289
|
+
keys(patch, sectionNames, 'sections')
|
|
290
|
+
const next = { ...base.sections } as RecordValue
|
|
291
|
+
for (const [name, section] of Object.entries(patch))
|
|
292
|
+
next[name] = mode === 'replace' ? section : merge(next[name], section)
|
|
293
|
+
return defineThemeDocument({ ...base, sections: next })
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Export exactly these sections, with no document identity or implicit component exceptions. */
|
|
297
|
+
export function exportThemeSections(
|
|
298
|
+
document: ThemeDocument,
|
|
299
|
+
names: readonly ThemeSectionName[]
|
|
300
|
+
): ThemeSectionExport {
|
|
301
|
+
const base = defineThemeDocument(document)
|
|
302
|
+
list(names, 'section names')
|
|
303
|
+
const sections: RecordValue = {}
|
|
304
|
+
for (const name of names) {
|
|
305
|
+
choice(name, sectionNames, 'section name')
|
|
306
|
+
if (base.sections[name] !== undefined) sections[name] = base.sections[name]
|
|
307
|
+
}
|
|
308
|
+
return parseThemeDocument({
|
|
309
|
+
kind: 'radiant-theme-sections',
|
|
310
|
+
version: 1,
|
|
311
|
+
sections
|
|
312
|
+
}) as ThemeSectionExport
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** Bring existing authored themes into the workshop without materialising defaults as overrides. */
|
|
316
|
+
export function themeDocumentFromDefinition(definition: ThemeDefinition): ThemeDocument {
|
|
317
|
+
const copy = jsonCopy(definition, 'theme') as ThemeDefinition
|
|
318
|
+
defineTheme(copy)
|
|
319
|
+
const sections: RecordValue = {}
|
|
320
|
+
for (const name of sectionNames) {
|
|
321
|
+
const section: RecordValue = {}
|
|
322
|
+
const values = name === 'components' ? copy.components : copy.tokens?.[name]
|
|
323
|
+
if (values !== undefined) section.values = values
|
|
324
|
+
const modes: RecordValue = {}
|
|
325
|
+
for (const mode of ['light', 'dark'] as const) {
|
|
326
|
+
const values =
|
|
327
|
+
name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name]
|
|
328
|
+
if (values !== undefined) modes[mode] = values
|
|
329
|
+
}
|
|
330
|
+
if (Object.keys(modes).length) section.modes = modes
|
|
331
|
+
if (Object.keys(section).length) sections[name] = section
|
|
332
|
+
}
|
|
333
|
+
return defineThemeDocument({
|
|
334
|
+
kind: 'radiant-theme',
|
|
335
|
+
version: 1,
|
|
336
|
+
id: copy.id,
|
|
337
|
+
name: copy.name,
|
|
338
|
+
sections
|
|
339
|
+
})
|
|
340
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ThemeComponentOverrides } from './components.js'
|
|
2
|
+
import type { ThemeTokens } from './tokens.js'
|
|
3
|
+
|
|
4
|
+
/** One existing token group, with independently authored mode layers. */
|
|
5
|
+
export interface ThemeSection<T> {
|
|
6
|
+
readonly values?: T
|
|
7
|
+
readonly modes?: { readonly light?: T; readonly dark?: T }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ThemeColorStop = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950
|
|
11
|
+
|
|
12
|
+
export interface ThemeBrandSource {
|
|
13
|
+
/** Unmodified source text. A mapped fallback never replaces this value. */
|
|
14
|
+
readonly value: string
|
|
15
|
+
readonly gamut: 'srgb' | 'display-p3'
|
|
16
|
+
readonly srgbFallback?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ThemePalette {
|
|
20
|
+
readonly id: string
|
|
21
|
+
readonly name: string
|
|
22
|
+
readonly swatches: readonly {
|
|
23
|
+
readonly stop: ThemeColorStop
|
|
24
|
+
readonly value: string
|
|
25
|
+
readonly srgbFallback?: string
|
|
26
|
+
}[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ThemeColorSection extends ThemeSection<ThemeTokens['color']> {
|
|
30
|
+
readonly brand?: ThemeBrandSource
|
|
31
|
+
/** Defaults to anchored when a brand is present. Generation belongs to the color engine. */
|
|
32
|
+
readonly fidelity?: 'anchored' | 'unanchored'
|
|
33
|
+
readonly palettes?: readonly ThemePalette[]
|
|
34
|
+
/** Optional until generation; references the exact original, never its fallback. */
|
|
35
|
+
readonly anchor?: { readonly paletteId: string; readonly stop: ThemeColorStop }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Portable descriptors only. The consuming application owns loading and local availability. */
|
|
39
|
+
export interface ThemeFontMetadata {
|
|
40
|
+
readonly id: string
|
|
41
|
+
readonly family: string
|
|
42
|
+
readonly source: 'system' | 'catalog' | 'local'
|
|
43
|
+
readonly weights?: readonly number[]
|
|
44
|
+
readonly styles?: readonly ('normal' | 'italic')[]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ThemeTypographySection extends ThemeSection<ThemeTokens['typography']> {
|
|
48
|
+
readonly fonts?: readonly ThemeFontMetadata[]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Token groups are the extension seams for richer typesetting and spring authoring. */
|
|
52
|
+
export type ThemeSections = {
|
|
53
|
+
readonly [K in keyof ThemeTokens]?: K extends 'color'
|
|
54
|
+
? ThemeColorSection
|
|
55
|
+
: K extends 'typography'
|
|
56
|
+
? ThemeTypographySection
|
|
57
|
+
: ThemeSection<ThemeTokens[K]>
|
|
58
|
+
} & {
|
|
59
|
+
readonly components?: ThemeSection<ThemeComponentOverrides>
|
|
60
|
+
}
|
|
61
|
+
export type ThemeSectionName = keyof ThemeSections
|
|
62
|
+
|
|
63
|
+
export interface ThemeDocument {
|
|
64
|
+
readonly kind: 'radiant-theme'
|
|
65
|
+
readonly version: 1
|
|
66
|
+
readonly id: string
|
|
67
|
+
readonly name: string
|
|
68
|
+
readonly sections: ThemeSections
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A selective export has no identity and cannot accidentally replace an entire document. */
|
|
72
|
+
export interface ThemeSectionExport {
|
|
73
|
+
readonly kind: 'radiant-theme-sections'
|
|
74
|
+
readonly version: 1
|
|
75
|
+
readonly sections: ThemeSections
|
|
76
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { defineTheme } from './defineTheme.js'
|
|
2
|
+
import { snap, settle } from './preset-values.js'
|
|
3
|
+
|
|
4
|
+
export const ticket = defineTheme({
|
|
5
|
+
id: 'ticket',
|
|
6
|
+
name: 'Ticket',
|
|
7
|
+
tokens: {
|
|
8
|
+
color: {
|
|
9
|
+
surface: '#fff2dc',
|
|
10
|
+
foreground: '#583a27',
|
|
11
|
+
mutedForeground: '#795f46',
|
|
12
|
+
border: '#765036',
|
|
13
|
+
accent: '#a43e19',
|
|
14
|
+
accentForeground: '#fff8eb',
|
|
15
|
+
neutral: '#f4e2c4',
|
|
16
|
+
neutralForeground: '#583a27',
|
|
17
|
+
warning: '#e6b74c',
|
|
18
|
+
warningForeground: '#44300c',
|
|
19
|
+
danger: '#a52b2f',
|
|
20
|
+
dangerForeground: '#ffffff',
|
|
21
|
+
focus: '#a43e19',
|
|
22
|
+
placeholder: '#795f46',
|
|
23
|
+
disabledBackground: '#f4e2c4',
|
|
24
|
+
disabledBorder: '#765036',
|
|
25
|
+
invalid: '#a52b2f'
|
|
26
|
+
},
|
|
27
|
+
typography: {
|
|
28
|
+
family: "'Barlow Condensed', system-ui, sans-serif",
|
|
29
|
+
bodySize: '1rem',
|
|
30
|
+
smallSize: '0.875rem',
|
|
31
|
+
headingSize: '1.25rem',
|
|
32
|
+
bodyWeight: 400,
|
|
33
|
+
labelWeight: 600,
|
|
34
|
+
headingWeight: 700,
|
|
35
|
+
letterSpacing: '0'
|
|
36
|
+
},
|
|
37
|
+
control: {
|
|
38
|
+
small: {
|
|
39
|
+
height: '2rem',
|
|
40
|
+
paddingInline: '0.75rem',
|
|
41
|
+
fontSize: '0.8125rem',
|
|
42
|
+
indicatorSize: '1rem'
|
|
43
|
+
},
|
|
44
|
+
medium: {
|
|
45
|
+
height: '2.75rem',
|
|
46
|
+
paddingInline: '1.5rem',
|
|
47
|
+
fontSize: '0.875rem',
|
|
48
|
+
indicatorSize: '1.125rem'
|
|
49
|
+
},
|
|
50
|
+
large: {
|
|
51
|
+
height: '3.25rem',
|
|
52
|
+
paddingInline: '1.5rem',
|
|
53
|
+
fontSize: '0.9375rem',
|
|
54
|
+
indicatorSize: '1.25rem'
|
|
55
|
+
},
|
|
56
|
+
radius: '0.875rem',
|
|
57
|
+
cornerShape: 'scoop',
|
|
58
|
+
borderWidth: '1.5px',
|
|
59
|
+
borderStyle: 'dashed'
|
|
60
|
+
},
|
|
61
|
+
surface: {
|
|
62
|
+
canvas: '#f7ead9',
|
|
63
|
+
radius: '0.875rem',
|
|
64
|
+
cornerShape: 'scoop',
|
|
65
|
+
borderWidth: '1.5px',
|
|
66
|
+
borderStyle: 'dashed',
|
|
67
|
+
padding: '1.5rem',
|
|
68
|
+
gap: '1rem',
|
|
69
|
+
shadow: '0 2px 0 color-mix(in oklab, var(--rad-color-border) 40%, transparent)',
|
|
70
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.22)',
|
|
71
|
+
backdrop: 'rgb(15 12 25 / 0.45)'
|
|
72
|
+
},
|
|
73
|
+
focus: {
|
|
74
|
+
width: '2px',
|
|
75
|
+
offset: '4px',
|
|
76
|
+
style: 'solid'
|
|
77
|
+
},
|
|
78
|
+
motion: {
|
|
79
|
+
pressDuration: '100ms',
|
|
80
|
+
pressEase: snap,
|
|
81
|
+
releaseDuration: '200ms',
|
|
82
|
+
releaseEase: settle,
|
|
83
|
+
colorDuration: '150ms',
|
|
84
|
+
disclosureDuration: '180ms'
|
|
85
|
+
},
|
|
86
|
+
state: { disabledOpacity: 0.5 }
|
|
87
|
+
},
|
|
88
|
+
components: {
|
|
89
|
+
// Small indicators need a legible box rather than the full-size ticket cutout.
|
|
90
|
+
checkbox: {
|
|
91
|
+
radius: '0.125rem',
|
|
92
|
+
cornerShape: 'round',
|
|
93
|
+
borderWidth: '2px',
|
|
94
|
+
borderStyle: 'solid'
|
|
95
|
+
},
|
|
96
|
+
button: {
|
|
97
|
+
radiusPressed: '0.5rem',
|
|
98
|
+
textTransform: 'uppercase',
|
|
99
|
+
cornerShapePressed: 'round',
|
|
100
|
+
fontWeight: 600,
|
|
101
|
+
letterSpacing: '0.08em',
|
|
102
|
+
shadow: '0 2px 0 0 color-mix(in oklab, var(--rad-color-border) 40%, transparent)',
|
|
103
|
+
shadowPressed: '0 0 #0000',
|
|
104
|
+
sheen: 0,
|
|
105
|
+
highlight: 0,
|
|
106
|
+
pressScale: 1,
|
|
107
|
+
pressShift: '2px'
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
modes: {
|
|
111
|
+
dark: {
|
|
112
|
+
tokens: {
|
|
113
|
+
color: {
|
|
114
|
+
surface: '#30261e',
|
|
115
|
+
foreground: '#fff0d5',
|
|
116
|
+
mutedForeground: '#d0b697',
|
|
117
|
+
border: '#b4946c',
|
|
118
|
+
accent: '#ffb18c',
|
|
119
|
+
accentForeground: '#49200f',
|
|
120
|
+
neutral: '#493726',
|
|
121
|
+
neutralForeground: '#ffedce',
|
|
122
|
+
warning: '#efc355',
|
|
123
|
+
warningForeground: '#352507',
|
|
124
|
+
danger: '#ff9298',
|
|
125
|
+
dangerForeground: '#3c111a',
|
|
126
|
+
focus: '#ffc09f',
|
|
127
|
+
placeholder: '#d0b697',
|
|
128
|
+
disabledBackground: '#493726',
|
|
129
|
+
disabledBorder: '#b4946c',
|
|
130
|
+
invalid: '#ff9298'
|
|
131
|
+
},
|
|
132
|
+
surface: {
|
|
133
|
+
canvas: '#1d1712',
|
|
134
|
+
shadow: '0 2px 0 color-mix(in oklab, var(--rad-color-border) 40%, transparent)',
|
|
135
|
+
overlayShadow: '0 20px 60px rgb(0 0 0 / 0.65)',
|
|
136
|
+
backdrop: 'rgb(0 0 0 / 0.65)'
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
})
|