@cognitap/radiant 0.0.3 → 0.0.5
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 +69 -0
- package/README.md +28 -15
- package/dist/library/Card.d.ts.map +1 -1
- package/dist/library/Card.js +8 -6
- package/dist/library/Card.js.map +1 -1
- package/dist/library/Checkbox.js +2 -2
- package/dist/library/Checkbox.js.map +1 -1
- package/dist/library/Collapsible.d.ts.map +1 -1
- package/dist/library/Collapsible.js +5 -4
- package/dist/library/Collapsible.js.map +1 -1
- package/dist/library/Dialog.d.ts.map +1 -1
- package/dist/library/Dialog.js +8 -6
- package/dist/library/Dialog.js.map +1 -1
- package/dist/library/Field.js +4 -4
- package/dist/library/Field.js.map +1 -1
- package/dist/library/Input.d.ts.map +1 -1
- package/dist/library/Input.js +4 -3
- package/dist/library/Input.js.map +1 -1
- package/dist/library/Link.d.ts.map +1 -1
- package/dist/library/Link.js +0 -1
- package/dist/library/Link.js.map +1 -1
- package/dist/library/RadioGroup.js +2 -2
- package/dist/library/RadioGroup.js.map +1 -1
- package/dist/library/ThemeScope.js +1 -1
- package/dist/library/ThemeScope.js.map +1 -1
- package/dist/library/actionStyles.js +2 -2
- package/dist/library/actionStyles.js.map +1 -1
- package/dist/library/cn.d.ts +2 -1
- package/dist/library/cn.d.ts.map +1 -1
- package/dist/library/cn.js +22 -1
- 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/index.d.ts +10 -2
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +5 -1
- package/dist/library/index.js.map +1 -1
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/defineTheme.d.ts.map +1 -1
- package/dist/library/themes/defineTheme.js +5 -1
- package/dist/library/themes/defineTheme.js.map +1 -1
- package/dist/library/themes/index.d.ts +4 -0
- package/dist/library/themes/index.d.ts.map +1 -1
- package/dist/library/themes/index.js +2 -0
- package/dist/library/themes/index.js.map +1 -1
- 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 +332 -0
- package/dist/library/themes/themeDocument.js.map +1 -0
- package/dist/library/themes/themeDocumentTypes.d.ts +80 -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/tokens.d.ts +7 -0
- package/dist/library/themes/tokens.d.ts.map +1 -1
- package/dist/library/themes/tokens.js +99 -0
- package/dist/library/themes/tokens.js.map +1 -1
- 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/dist/library/typography/index.d.ts +72 -0
- package/dist/library/typography/index.d.ts.map +1 -0
- package/dist/library/typography/index.js +160 -0
- package/dist/library/typography/index.js.map +1 -0
- package/dist/library/typography/types.d.ts +78 -0
- package/dist/library/typography/types.d.ts.map +1 -0
- package/dist/library/typography/types.js +2 -0
- package/dist/library/typography/types.js.map +1 -0
- package/docs/system.md +20 -0
- package/docs/theming.md +616 -0
- package/package.json +17 -5
- package/src/Card.tsx +8 -6
- package/src/Checkbox.tsx +2 -2
- package/src/Collapsible.tsx +5 -4
- package/src/Dialog.tsx +8 -6
- package/src/Field.tsx +4 -4
- package/src/Input.tsx +4 -3
- package/src/Link.tsx +0 -1
- package/src/RadioGroup.tsx +2 -2
- package/src/ThemeScope.tsx +1 -1
- package/src/actionStyles.ts +2 -2
- package/src/cn.ts +25 -1
- 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/index.ts +40 -0
- package/src/styles.css +1 -0
- package/src/themes/baseline.css +131 -0
- package/src/themes/defineTheme.ts +5 -1
- package/src/themes/index.ts +25 -0
- package/src/themes/themeDocument.ts +370 -0
- package/src/themes/themeDocumentTypes.ts +88 -0
- package/src/themes/tokens.ts +137 -0
- package/src/themes/updateThemeAppearance.ts +172 -0
- package/src/typography/index.ts +199 -0
- package/src/typography/types.ts +92 -0
- package/src/typography.css +336 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { defineTheme } from './defineTheme.js';
|
|
2
|
+
import { freezeTree, tokenDefaults } from './tokens.js';
|
|
3
|
+
import { generateTypography } from '../typography/index.js';
|
|
4
|
+
const sectionNames = [
|
|
5
|
+
...Object.keys(tokenDefaults.light),
|
|
6
|
+
'components'
|
|
7
|
+
];
|
|
8
|
+
const stops = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]);
|
|
9
|
+
function record(value, path) {
|
|
10
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
11
|
+
throw new TypeError(`${path} must be an object.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function keys(value, allowed, path) {
|
|
15
|
+
for (const key of Object.keys(value)) {
|
|
16
|
+
if (!allowed.includes(key))
|
|
17
|
+
throw new TypeError(`Unknown key: ${path}.${key}.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function textValue(value, path) {
|
|
21
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
22
|
+
throw new TypeError(`${path} must be a nonempty string.`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function choice(value, allowed, path) {
|
|
26
|
+
if (!allowed.includes(value)) {
|
|
27
|
+
throw new TypeError(`${path} must be one of: ${allowed.join(', ')}.`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function list(value, path) {
|
|
31
|
+
if (!Array.isArray(value))
|
|
32
|
+
throw new TypeError(`${path} must be an array.`);
|
|
33
|
+
}
|
|
34
|
+
function unique(value, seen, path) {
|
|
35
|
+
if (seen.has(value))
|
|
36
|
+
throw new TypeError(`Duplicate value at ${path}: ${String(value)}.`);
|
|
37
|
+
seen.add(value);
|
|
38
|
+
}
|
|
39
|
+
/** Copy data without running getters/toJSON or silently losing functions and binaries. */
|
|
40
|
+
function jsonCopy(value, path, ancestors = new Set()) {
|
|
41
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
42
|
+
return value;
|
|
43
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
44
|
+
return value === 0 ? 0 : value;
|
|
45
|
+
if (!value || typeof value !== 'object')
|
|
46
|
+
throw new TypeError(`${path} must contain JSON data only.`);
|
|
47
|
+
if (ancestors.has(value))
|
|
48
|
+
throw new TypeError(`Circular reference at ${path}.`);
|
|
49
|
+
const array = Array.isArray(value);
|
|
50
|
+
const prototype = Object.getPrototypeOf(value);
|
|
51
|
+
if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) {
|
|
52
|
+
throw new TypeError(`${path} must contain plain JSON objects, not class instances or binaries.`);
|
|
53
|
+
}
|
|
54
|
+
ancestors.add(value);
|
|
55
|
+
const result = array ? [] : {};
|
|
56
|
+
if (Object.getOwnPropertySymbols(value).length)
|
|
57
|
+
throw new TypeError(`${path} cannot contain symbol keys.`);
|
|
58
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
59
|
+
for (const key of Object.keys(descriptors).sort()) {
|
|
60
|
+
if (array && key === 'length')
|
|
61
|
+
continue;
|
|
62
|
+
if (['__proto__', 'constructor', 'prototype'].includes(key))
|
|
63
|
+
throw new TypeError(`Forbidden key: ${path}.${key}.`);
|
|
64
|
+
const descriptor = descriptors[key];
|
|
65
|
+
if (!('value' in descriptor) || !descriptor.enumerable) {
|
|
66
|
+
throw new TypeError(`${path}.${key} must be an enumerable data property.`);
|
|
67
|
+
}
|
|
68
|
+
if (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)) {
|
|
69
|
+
throw new TypeError(`${path}.${key} is not an array index.`);
|
|
70
|
+
}
|
|
71
|
+
// Optional object properties follow JSON omission rules; array holes/undefined are invalid.
|
|
72
|
+
if (descriptor.value === undefined && !array)
|
|
73
|
+
continue;
|
|
74
|
+
const copy = jsonCopy(descriptor.value, `${path}.${key}`, ancestors);
|
|
75
|
+
Object.defineProperty(result, key, {
|
|
76
|
+
value: copy,
|
|
77
|
+
enumerable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
configurable: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (array && Object.keys(result).length !== value.length)
|
|
83
|
+
throw new TypeError(`${path} cannot contain array holes.`);
|
|
84
|
+
ancestors.delete(value);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
function validateColor(value, path) {
|
|
88
|
+
if (value.brand !== undefined) {
|
|
89
|
+
record(value.brand, `${path}.brand`);
|
|
90
|
+
keys(value.brand, ['value', 'gamut', 'srgbFallback'], `${path}.brand`);
|
|
91
|
+
textValue(value.brand.value, `${path}.brand.value`);
|
|
92
|
+
choice(value.brand.gamut, ['srgb', 'display-p3'], `${path}.brand.gamut`);
|
|
93
|
+
if (value.brand.srgbFallback !== undefined)
|
|
94
|
+
textValue(value.brand.srgbFallback, `${path}.brand.srgbFallback`);
|
|
95
|
+
if (value.fidelity === undefined)
|
|
96
|
+
value.fidelity = 'anchored';
|
|
97
|
+
}
|
|
98
|
+
if (value.fidelity !== undefined)
|
|
99
|
+
choice(value.fidelity, ['anchored', 'unanchored'], `${path}.fidelity`);
|
|
100
|
+
if (value.palettes !== undefined) {
|
|
101
|
+
list(value.palettes, `${path}.palettes`);
|
|
102
|
+
const ids = new Set();
|
|
103
|
+
for (const [i, palette] of value.palettes.entries()) {
|
|
104
|
+
const p = `${path}.palettes.${i}`;
|
|
105
|
+
record(palette, p);
|
|
106
|
+
keys(palette, ['id', 'name', 'swatches'], p);
|
|
107
|
+
textValue(palette.id, `${p}.id`);
|
|
108
|
+
textValue(palette.name, `${p}.name`);
|
|
109
|
+
unique(palette.id, ids, `${p}.id`);
|
|
110
|
+
list(palette.swatches, `${p}.swatches`);
|
|
111
|
+
if (!palette.swatches.length)
|
|
112
|
+
throw new TypeError(`${p}.swatches must not be empty.`);
|
|
113
|
+
const seen = new Set();
|
|
114
|
+
for (const [j, swatch] of palette.swatches.entries()) {
|
|
115
|
+
const s = `${p}.swatches.${j}`;
|
|
116
|
+
record(swatch, s);
|
|
117
|
+
keys(swatch, ['stop', 'value', 'srgbFallback'], s);
|
|
118
|
+
if (!stops.has(swatch.stop))
|
|
119
|
+
throw new TypeError(`${s}.stop must be a numbered color stop (50–950).`);
|
|
120
|
+
unique(swatch.stop, seen, `${s}.stop`);
|
|
121
|
+
textValue(swatch.value, `${s}.value`);
|
|
122
|
+
if (swatch.srgbFallback !== undefined)
|
|
123
|
+
textValue(swatch.srgbFallback, `${s}.srgbFallback`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (value.anchor !== undefined) {
|
|
128
|
+
record(value.anchor, `${path}.anchor`);
|
|
129
|
+
keys(value.anchor, ['paletteId', 'stop'], `${path}.anchor`);
|
|
130
|
+
textValue(value.anchor.paletteId, `${path}.anchor.paletteId`);
|
|
131
|
+
if (!stops.has(value.anchor.stop))
|
|
132
|
+
throw new TypeError(`${path}.anchor.stop must be a numbered color stop (50–950).`);
|
|
133
|
+
const color = value;
|
|
134
|
+
const swatch = color.palettes
|
|
135
|
+
?.find(p => p.id === color.anchor.paletteId)
|
|
136
|
+
?.swatches.find(s => s.stop === color.anchor.stop);
|
|
137
|
+
if (!color.brand || color.fidelity !== 'anchored' || swatch?.value !== color.brand.value) {
|
|
138
|
+
throw new TypeError(`${path}.anchor must reference a swatch containing the exact brand.value with anchored fidelity. Regenerate or replace the color section.`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function validateFonts(value, path) {
|
|
143
|
+
list(value, path);
|
|
144
|
+
const ids = new Set();
|
|
145
|
+
for (const [i, font] of value.entries()) {
|
|
146
|
+
const p = `${path}.${i}`;
|
|
147
|
+
record(font, p);
|
|
148
|
+
keys(font, ['id', 'family', 'source', 'weights', 'styles', 'axes'], p);
|
|
149
|
+
textValue(font.id, `${p}.id`);
|
|
150
|
+
textValue(font.family, `${p}.family`);
|
|
151
|
+
unique(font.id, ids, `${p}.id`);
|
|
152
|
+
choice(font.source, ['system', 'catalog', 'local'], `${p}.source`);
|
|
153
|
+
if (font.axes !== undefined) {
|
|
154
|
+
list(font.axes, `${p}.axes`);
|
|
155
|
+
if (font.axes.length > 32)
|
|
156
|
+
throw new TypeError(`${p}.axes supports at most 32 axes.`);
|
|
157
|
+
const tags = new Set();
|
|
158
|
+
for (const [j, axis] of font.axes.entries()) {
|
|
159
|
+
const at = `${p}.axes.${j}`;
|
|
160
|
+
record(axis, at);
|
|
161
|
+
keys(axis, ['tag', 'min', 'default', 'max'], at);
|
|
162
|
+
if (typeof axis.tag !== 'string' || !/^[A-Za-z][A-Za-z0-9]{3}$/.test(axis.tag))
|
|
163
|
+
throw new TypeError(`${at}.tag must contain four ASCII letters/digits, starting with a letter.`);
|
|
164
|
+
unique(axis.tag, tags, `${at}.tag`);
|
|
165
|
+
for (const key of ['min', 'default', 'max'])
|
|
166
|
+
if (typeof axis[key] !== 'number' ||
|
|
167
|
+
!Number.isFinite(axis[key]) ||
|
|
168
|
+
Math.abs(axis[key]) > 1000000)
|
|
169
|
+
throw new TypeError(`${at}.${key} must be a finite number between -1000000 and 1000000.`);
|
|
170
|
+
if (Number(axis.min) > Number(axis.default) || Number(axis.default) > Number(axis.max))
|
|
171
|
+
throw new TypeError(`${at} must satisfy min <= default <= max.`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const key of ['weights', 'styles']) {
|
|
175
|
+
if (font[key] === undefined)
|
|
176
|
+
continue;
|
|
177
|
+
list(font[key], `${p}.${key}`);
|
|
178
|
+
const seen = new Set();
|
|
179
|
+
for (const [j, item] of font[key].entries()) {
|
|
180
|
+
const at = `${p}.${key}.${j}`;
|
|
181
|
+
if (key === 'styles')
|
|
182
|
+
choice(item, ['normal', 'italic'], at);
|
|
183
|
+
else if (typeof item !== 'number' || !Number.isFinite(item) || item < 1 || item > 1000)
|
|
184
|
+
throw new TypeError(`${at} must be a weight from 1 to 1000.`);
|
|
185
|
+
unique(item, seen, at);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function toDefinition(sections, id, name) {
|
|
191
|
+
const common = { tokens: {} };
|
|
192
|
+
const modes = { light: { tokens: {} }, dark: { tokens: {} } };
|
|
193
|
+
for (const sectionName of sectionNames) {
|
|
194
|
+
const section = sections[sectionName];
|
|
195
|
+
if (!section)
|
|
196
|
+
continue;
|
|
197
|
+
if (sectionName === 'typography' && sections.typography?.typesetting !== undefined) {
|
|
198
|
+
common.tokens.typography = generateTypography(sections.typography.typesetting).tokens;
|
|
199
|
+
}
|
|
200
|
+
for (const mode of ['common', 'light', 'dark']) {
|
|
201
|
+
const values = mode === 'common' ? section.values : section.modes?.[mode];
|
|
202
|
+
if (values === undefined)
|
|
203
|
+
continue;
|
|
204
|
+
const layer = mode === 'common' ? common : modes[mode];
|
|
205
|
+
if (sectionName === 'components')
|
|
206
|
+
layer.components = values;
|
|
207
|
+
else
|
|
208
|
+
layer.tokens[sectionName] = merge(layer.tokens[sectionName], values);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return { id, name, ...common, modes };
|
|
212
|
+
}
|
|
213
|
+
/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */
|
|
214
|
+
export function parseThemeDocument(input) {
|
|
215
|
+
const value = jsonCopy(input, 'document');
|
|
216
|
+
record(value, 'document');
|
|
217
|
+
choice(value.kind, ['radiant-theme', 'radiant-theme-sections'], 'document.kind');
|
|
218
|
+
if (value.version !== 1)
|
|
219
|
+
throw new TypeError(`Unsupported document.version: ${String(value.version)}. Expected 1; migrate the configuration before importing.`);
|
|
220
|
+
const full = value.kind === 'radiant-theme';
|
|
221
|
+
keys(value, full ? ['kind', 'version', 'id', 'name', 'sections'] : ['kind', 'version', 'sections'], 'document');
|
|
222
|
+
record(value.sections, 'document.sections');
|
|
223
|
+
keys(value.sections, sectionNames, 'document.sections');
|
|
224
|
+
for (const [name, section] of Object.entries(value.sections)) {
|
|
225
|
+
const path = `document.sections.${name}`;
|
|
226
|
+
record(section, path);
|
|
227
|
+
keys(section, [
|
|
228
|
+
'values',
|
|
229
|
+
'modes',
|
|
230
|
+
...(name === 'color'
|
|
231
|
+
? ['brand', 'fidelity', 'palettes', 'anchor']
|
|
232
|
+
: name === 'typography'
|
|
233
|
+
? ['fonts', 'typesetting']
|
|
234
|
+
: [])
|
|
235
|
+
], path);
|
|
236
|
+
if (section.modes !== undefined) {
|
|
237
|
+
record(section.modes, `${path}.modes`);
|
|
238
|
+
keys(section.modes, ['light', 'dark'], `${path}.modes`);
|
|
239
|
+
}
|
|
240
|
+
if (name === 'color')
|
|
241
|
+
validateColor(section, path);
|
|
242
|
+
if (name === 'typography' && section.fonts !== undefined)
|
|
243
|
+
validateFonts(section.fonts, `${path}.fonts`);
|
|
244
|
+
}
|
|
245
|
+
// Reuse the canonical token/component validation and resolution; no second token schema.
|
|
246
|
+
defineTheme(toDefinition(value.sections, full ? value.id : 'section-export', full ? value.name : 'Section export'));
|
|
247
|
+
return freezeTree(jsonCopy(value, 'document'));
|
|
248
|
+
}
|
|
249
|
+
/** Validate and detach an immutable, portable authoring snapshot. */
|
|
250
|
+
export function defineThemeDocument(document) {
|
|
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
|
+
/** Compile only authored semantic values through the existing application theme runtime. */
|
|
257
|
+
export function compileThemeDocument(document) {
|
|
258
|
+
const validated = defineThemeDocument(document);
|
|
259
|
+
return defineTheme(toDefinition(validated.sections, validated.id, validated.name));
|
|
260
|
+
}
|
|
261
|
+
function merge(base, patch) {
|
|
262
|
+
if (!base ||
|
|
263
|
+
!patch ||
|
|
264
|
+
typeof base !== 'object' ||
|
|
265
|
+
typeof patch !== 'object' ||
|
|
266
|
+
Array.isArray(base) ||
|
|
267
|
+
Array.isArray(patch))
|
|
268
|
+
return patch;
|
|
269
|
+
const result = { ...base };
|
|
270
|
+
for (const [key, value] of Object.entries(patch))
|
|
271
|
+
result[key] = merge(result[key], value);
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */
|
|
275
|
+
export function updateThemeDocument(document, sections, mode = 'merge') {
|
|
276
|
+
const base = defineThemeDocument(document);
|
|
277
|
+
choice(mode, ['merge', 'replace'], 'update mode');
|
|
278
|
+
// Check the patch's JSON boundary before merging, including keys a spread would discard.
|
|
279
|
+
const patch = jsonCopy(sections, 'sections');
|
|
280
|
+
record(patch, 'sections');
|
|
281
|
+
keys(patch, sectionNames, 'sections');
|
|
282
|
+
const next = { ...base.sections };
|
|
283
|
+
for (const [name, section] of Object.entries(patch))
|
|
284
|
+
next[name] = mode === 'replace' ? section : merge(next[name], section);
|
|
285
|
+
return defineThemeDocument({ ...base, sections: next });
|
|
286
|
+
}
|
|
287
|
+
/** Export exactly these sections, with no document identity or implicit component exceptions. */
|
|
288
|
+
export function exportThemeSections(document, names) {
|
|
289
|
+
const base = defineThemeDocument(document);
|
|
290
|
+
list(names, 'section names');
|
|
291
|
+
const sections = {};
|
|
292
|
+
for (const name of names) {
|
|
293
|
+
choice(name, sectionNames, 'section name');
|
|
294
|
+
if (base.sections[name] !== undefined)
|
|
295
|
+
sections[name] = base.sections[name];
|
|
296
|
+
}
|
|
297
|
+
return parseThemeDocument({
|
|
298
|
+
kind: 'radiant-theme-sections',
|
|
299
|
+
version: 1,
|
|
300
|
+
sections
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/** Bring existing authored themes into the workshop without materialising defaults as overrides. */
|
|
304
|
+
export function themeDocumentFromDefinition(definition) {
|
|
305
|
+
const copy = jsonCopy(definition, 'theme');
|
|
306
|
+
defineTheme(copy);
|
|
307
|
+
const sections = {};
|
|
308
|
+
for (const name of sectionNames) {
|
|
309
|
+
const section = {};
|
|
310
|
+
const values = name === 'components' ? copy.components : copy.tokens?.[name];
|
|
311
|
+
if (values !== undefined)
|
|
312
|
+
section.values = values;
|
|
313
|
+
const modes = {};
|
|
314
|
+
for (const mode of ['light', 'dark']) {
|
|
315
|
+
const values = name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name];
|
|
316
|
+
if (values !== undefined)
|
|
317
|
+
modes[mode] = values;
|
|
318
|
+
}
|
|
319
|
+
if (Object.keys(modes).length)
|
|
320
|
+
section.modes = modes;
|
|
321
|
+
if (Object.keys(section).length)
|
|
322
|
+
sections[name] = section;
|
|
323
|
+
}
|
|
324
|
+
return defineThemeDocument({
|
|
325
|
+
kind: 'radiant-theme',
|
|
326
|
+
version: 1,
|
|
327
|
+
id: copy.id,
|
|
328
|
+
name: copy.name,
|
|
329
|
+
sections
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=themeDocument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeDocument.js","sourceRoot":"","sources":["../../../src/themes/themeDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqD,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAW3D,MAAM,YAAY,GAAgC;IAChD,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IACnC,YAAY;CACS,CAAA;AACvB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAG7E,SAAS,MAAM,CAAC,KAAc,EAAE,IAAY;IAC1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACnD,CAAC;AACH,CAAC;AAED,SAAS,IAAI,CAAC,KAAkB,EAAE,OAA0B,EAAE,IAAY;IACxE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,IAAI,IAAI,GAAG,GAAG,CAAC,CAAA;IACjF,CAAC;AACH,C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,CAAC,KAAK,CAAC,CAAC,MAAM;YAAE,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACpD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IAC3D,CAAC;IACD,OAAO,mBAAmB,CAAC;QACzB,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,CAAC;QACV,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,QAAQ;KACT,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { defineTheme, type Theme, type ThemeDefinition, type ThemeLayer } from './defineTheme.js'\nimport { freezeTree, tokenDefaults } from './tokens.js'\nimport { generateTypography } from '../typography/index.js'\nimport type {\n ThemeColorSection,\n ThemeDocument,\n ThemeSectionExport,\n ThemeSectionName,\n ThemeSections\n} from './themeDocumentTypes.js'\n\nexport type * from './themeDocumentTypes.js'\n\nconst sectionNames: readonly ThemeSectionName[] = [\n ...Object.keys(tokenDefaults.light),\n 'components'\n] as ThemeSectionName[]\nconst stops = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])\ntype RecordValue = Record<string, unknown>\n\nfunction record(value: unknown, path: string): asserts value is RecordValue {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new TypeError(`${path} must be an object.`)\n }\n}\n\nfunction keys(value: RecordValue, allowed: readonly string[], path: string) {\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key)) throw new TypeError(`Unknown key: ${path}.${key}.`)\n }\n}\n\nfunction textValue(value: unknown, path: string) {\n if (typeof value !== 'string' || !value.trim()) {\n throw new TypeError(`${path} must be a nonempty string.`)\n }\n}\n\nfunction choice(value: unknown, allowed: readonly unknown[], path: string) {\n if (!allowed.includes(value)) {\n throw new TypeError(`${path} must be one of: ${allowed.join(', ')}.`)\n }\n}\n\nfunction list(value: unknown, path: string): asserts value is unknown[] {\n if (!Array.isArray(value)) throw new TypeError(`${path} must be an array.`)\n}\n\nfunction unique(value: unknown, seen: Set<unknown>, path: string) {\n if (seen.has(value)) throw new TypeError(`Duplicate value at ${path}: ${String(value)}.`)\n seen.add(value)\n}\n\n/** Copy data without running getters/toJSON or silently losing functions and binaries. */\nfunction jsonCopy(value: unknown, path: string, ancestors = new Set<object>()): unknown {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return value\n if (typeof value === 'number' && Number.isFinite(value)) return value === 0 ? 0 : value\n if (!value || typeof value !== 'object')\n throw new TypeError(`${path} must contain JSON data only.`)\n if (ancestors.has(value)) throw new TypeError(`Circular reference at ${path}.`)\n const array = Array.isArray(value)\n const prototype = Object.getPrototypeOf(value)\n if (\n array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null\n ) {\n throw new TypeError(`${path} must contain plain JSON objects, not class instances or binaries.`)\n }\n ancestors.add(value)\n const result: RecordValue | unknown[] = array ? [] : {}\n if (Object.getOwnPropertySymbols(value).length)\n throw new TypeError(`${path} cannot contain symbol keys.`)\n const descriptors = Object.getOwnPropertyDescriptors(value)\n for (const key of Object.keys(descriptors).sort()) {\n if (array && key === 'length') continue\n if (['__proto__', 'constructor', 'prototype'].includes(key))\n throw new TypeError(`Forbidden key: ${path}.${key}.`)\n const descriptor = descriptors[key]\n if (!('value' in descriptor) || !descriptor.enumerable) {\n throw new TypeError(`${path}.${key} must be an enumerable data property.`)\n }\n if (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)) {\n throw new TypeError(`${path}.${key} is not an array index.`)\n }\n // Optional object properties follow JSON omission rules; array holes/undefined are invalid.\n if (descriptor.value === undefined && !array) continue\n const copy = jsonCopy(descriptor.value, `${path}.${key}`, ancestors)\n Object.defineProperty(result, key, {\n value: copy,\n enumerable: true,\n writable: true,\n configurable: true\n })\n }\n if (array && Object.keys(result).length !== value.length)\n throw new TypeError(`${path} cannot contain array holes.`)\n ancestors.delete(value)\n return result\n}\n\nfunction validateColor(value: RecordValue, path: string) {\n if (value.brand !== undefined) {\n record(value.brand, `${path}.brand`)\n keys(value.brand, ['value', 'gamut', 'srgbFallback'], `${path}.brand`)\n textValue(value.brand.value, `${path}.brand.value`)\n choice(value.brand.gamut, ['srgb', 'display-p3'], `${path}.brand.gamut`)\n if (value.brand.srgbFallback !== undefined)\n textValue(value.brand.srgbFallback, `${path}.brand.srgbFallback`)\n if (value.fidelity === undefined) value.fidelity = 'anchored'\n }\n if (value.fidelity !== undefined)\n choice(value.fidelity, ['anchored', 'unanchored'], `${path}.fidelity`)\n if (value.palettes !== undefined) {\n list(value.palettes, `${path}.palettes`)\n const ids = new Set<unknown>()\n for (const [i, palette] of value.palettes.entries()) {\n const p = `${path}.palettes.${i}`\n record(palette, p)\n keys(palette, ['id', 'name', 'swatches'], p)\n textValue(palette.id, `${p}.id`)\n textValue(palette.name, `${p}.name`)\n unique(palette.id, ids, `${p}.id`)\n list(palette.swatches, `${p}.swatches`)\n if (!palette.swatches.length) throw new TypeError(`${p}.swatches must not be empty.`)\n const seen = new Set<unknown>()\n for (const [j, swatch] of palette.swatches.entries()) {\n const s = `${p}.swatches.${j}`\n record(swatch, s)\n keys(swatch, ['stop', 'value', 'srgbFallback'], s)\n if (!stops.has(swatch.stop as number))\n throw new TypeError(`${s}.stop must be a numbered color stop (50–950).`)\n unique(swatch.stop, seen, `${s}.stop`)\n textValue(swatch.value, `${s}.value`)\n if (swatch.srgbFallback !== undefined) textValue(swatch.srgbFallback, `${s}.srgbFallback`)\n }\n }\n }\n if (value.anchor !== undefined) {\n record(value.anchor, `${path}.anchor`)\n keys(value.anchor, ['paletteId', 'stop'], `${path}.anchor`)\n textValue(value.anchor.paletteId, `${path}.anchor.paletteId`)\n if (!stops.has(value.anchor.stop as number))\n throw new TypeError(`${path}.anchor.stop must be a numbered color stop (50–950).`)\n const color = value as ThemeColorSection\n const swatch = color.palettes\n ?.find(p => p.id === color.anchor!.paletteId)\n ?.swatches.find(s => s.stop === color.anchor!.stop)\n if (!color.brand || color.fidelity !== 'anchored' || swatch?.value !== color.brand.value) {\n throw new TypeError(\n `${path}.anchor must reference a swatch containing the exact brand.value with anchored fidelity. Regenerate or replace the color section.`\n )\n }\n }\n}\n\nfunction validateFonts(value: unknown, path: string) {\n list(value, path)\n const ids = new Set<unknown>()\n for (const [i, font] of value.entries()) {\n const p = `${path}.${i}`\n record(font, p)\n keys(font, ['id', 'family', 'source', 'weights', 'styles', 'axes'], p)\n textValue(font.id, `${p}.id`)\n textValue(font.family, `${p}.family`)\n unique(font.id, ids, `${p}.id`)\n choice(font.source, ['system', 'catalog', 'local'], `${p}.source`)\n if (font.axes !== undefined) {\n list(font.axes, `${p}.axes`)\n if (font.axes.length > 32) throw new TypeError(`${p}.axes supports at most 32 axes.`)\n const tags = new Set<unknown>()\n for (const [j, axis] of font.axes.entries()) {\n const at = `${p}.axes.${j}`\n record(axis, at)\n keys(axis, ['tag', 'min', 'default', 'max'], at)\n if (typeof axis.tag !== 'string' || !/^[A-Za-z][A-Za-z0-9]{3}$/.test(axis.tag))\n throw new TypeError(\n `${at}.tag must contain four ASCII letters/digits, starting with a letter.`\n )\n unique(axis.tag, tags, `${at}.tag`)\n for (const key of ['min', 'default', 'max'])\n if (\n typeof axis[key] !== 'number' ||\n !Number.isFinite(axis[key]) ||\n Math.abs(axis[key]) > 1000000\n )\n throw new TypeError(\n `${at}.${key} must be a finite number between -1000000 and 1000000.`\n )\n if (Number(axis.min) > Number(axis.default) || Number(axis.default) > Number(axis.max))\n throw new TypeError(`${at} must satisfy min <= default <= max.`)\n }\n }\n for (const key of ['weights', 'styles']) {\n if (font[key] === undefined) continue\n list(font[key], `${p}.${key}`)\n const seen = new Set<unknown>()\n for (const [j, item] of font[key].entries()) {\n const at = `${p}.${key}.${j}`\n if (key === 'styles') choice(item, ['normal', 'italic'], at)\n else if (typeof item !== 'number' || !Number.isFinite(item) || item < 1 || item > 1000)\n throw new TypeError(`${at} must be a weight from 1 to 1000.`)\n unique(item, seen, at)\n }\n }\n }\n}\n\nfunction toDefinition(sections: ThemeSections, id: string, name: string): ThemeDefinition {\n const common: { tokens: RecordValue; components?: ThemeLayer['components'] } = { tokens: {} }\n const modes = { light: { tokens: {} } as typeof common, dark: { tokens: {} } as typeof common }\n for (const sectionName of sectionNames) {\n const section = sections[sectionName]\n if (!section) continue\n if (sectionName === 'typography' && sections.typography?.typesetting !== undefined) {\n common.tokens.typography = generateTypography(sections.typography.typesetting).tokens\n }\n for (const mode of ['common', 'light', 'dark'] as const) {\n const values = mode === 'common' ? section.values : section.modes?.[mode]\n if (values === undefined) continue\n const layer = mode === 'common' ? common : modes[mode]\n if (sectionName === 'components') layer.components = values as ThemeLayer['components']\n else layer.tokens[sectionName] = merge(layer.tokens[sectionName], values)\n }\n }\n return { id, name, ...common, modes }\n}\n\n/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */\nexport function parseThemeDocument(input: unknown): ThemeDocument | ThemeSectionExport {\n const value = jsonCopy(input, 'document')\n record(value, 'document')\n choice(value.kind, ['radiant-theme', 'radiant-theme-sections'], 'document.kind')\n if (value.version !== 1)\n throw new TypeError(\n `Unsupported document.version: ${String(value.version)}. Expected 1; migrate the configuration before importing.`\n )\n const full = value.kind === 'radiant-theme'\n keys(\n value,\n full ? ['kind', 'version', 'id', 'name', 'sections'] : ['kind', 'version', 'sections'],\n 'document'\n )\n record(value.sections, 'document.sections')\n keys(value.sections, sectionNames, 'document.sections')\n for (const [name, section] of Object.entries(value.sections)) {\n const path = `document.sections.${name}`\n record(section, path)\n keys(\n section,\n [\n 'values',\n 'modes',\n ...(name === 'color'\n ? ['brand', 'fidelity', 'palettes', 'anchor']\n : name === 'typography'\n ? ['fonts', 'typesetting']\n : [])\n ],\n path\n )\n if (section.modes !== undefined) {\n record(section.modes, `${path}.modes`)\n keys(section.modes, ['light', 'dark'], `${path}.modes`)\n }\n if (name === 'color') validateColor(section, path)\n if (name === 'typography' && section.fonts !== undefined)\n validateFonts(section.fonts, `${path}.fonts`)\n }\n // Reuse the canonical token/component validation and resolution; no second token schema.\n defineTheme(\n toDefinition(\n value.sections as ThemeSections,\n full ? (value.id as string) : 'section-export',\n full ? (value.name as string) : 'Section export'\n )\n )\n return freezeTree(jsonCopy(value, 'document') as object) as ThemeDocument | ThemeSectionExport\n}\n\n/** Validate and detach an immutable, portable authoring snapshot. */\nexport function defineThemeDocument(document: ThemeDocument): ThemeDocument {\n const result = parseThemeDocument(document)\n if (result.kind !== 'radiant-theme')\n throw new TypeError('Expected a radiant-theme document with id and name.')\n return result\n}\n\n/** Compile only authored semantic values through the existing application theme runtime. */\nexport function compileThemeDocument(document: ThemeDocument): Theme {\n const validated = defineThemeDocument(document)\n return defineTheme(toDefinition(validated.sections, validated.id, validated.name))\n}\n\nfunction merge(base: unknown, patch: unknown): unknown {\n if (\n !base ||\n !patch ||\n typeof base !== 'object' ||\n typeof patch !== 'object' ||\n Array.isArray(base) ||\n Array.isArray(patch)\n )\n return patch\n const result: RecordValue = { ...base }\n for (const [key, value] of Object.entries(patch)) result[key] = merge(result[key], value)\n return result\n}\n\n/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */\nexport function updateThemeDocument(\n document: ThemeDocument,\n sections: ThemeSections,\n mode: 'merge' | 'replace' = 'merge'\n): ThemeDocument {\n const base = defineThemeDocument(document)\n choice(mode, ['merge', 'replace'], 'update mode')\n // Check the patch's JSON boundary before merging, including keys a spread would discard.\n const patch = jsonCopy(sections, 'sections')\n record(patch, 'sections')\n keys(patch, sectionNames, 'sections')\n const next = { ...base.sections } as RecordValue\n for (const [name, section] of Object.entries(patch))\n next[name] = mode === 'replace' ? section : merge(next[name], section)\n return defineThemeDocument({ ...base, sections: next })\n}\n\n/** Export exactly these sections, with no document identity or implicit component exceptions. */\nexport function exportThemeSections(\n document: ThemeDocument,\n names: readonly ThemeSectionName[]\n): ThemeSectionExport {\n const base = defineThemeDocument(document)\n list(names, 'section names')\n const sections: RecordValue = {}\n for (const name of names) {\n choice(name, sectionNames, 'section name')\n if (base.sections[name] !== undefined) sections[name] = base.sections[name]\n }\n return parseThemeDocument({\n kind: 'radiant-theme-sections',\n version: 1,\n sections\n }) as ThemeSectionExport\n}\n\n/** Bring existing authored themes into the workshop without materialising defaults as overrides. */\nexport function themeDocumentFromDefinition(definition: ThemeDefinition): ThemeDocument {\n const copy = jsonCopy(definition, 'theme') as ThemeDefinition\n defineTheme(copy)\n const sections: RecordValue = {}\n for (const name of sectionNames) {\n const section: RecordValue = {}\n const values = name === 'components' ? copy.components : copy.tokens?.[name]\n if (values !== undefined) section.values = values\n const modes: RecordValue = {}\n for (const mode of ['light', 'dark'] as const) {\n const values =\n name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name]\n if (values !== undefined) modes[mode] = values\n }\n if (Object.keys(modes).length) section.modes = modes\n if (Object.keys(section).length) sections[name] = section\n }\n return defineThemeDocument({\n kind: 'radiant-theme',\n version: 1,\n id: copy.id,\n name: copy.name,\n sections\n })\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ThemeComponentOverrides } from './components.js';
|
|
2
|
+
import type { ThemeTokens } from './tokens.js';
|
|
3
|
+
import type { TypographyInput } from '../typography/types.js';
|
|
4
|
+
/** One existing token group, with independently authored mode layers. */
|
|
5
|
+
export interface ThemeSection<T> {
|
|
6
|
+
readonly values?: T;
|
|
7
|
+
readonly modes?: {
|
|
8
|
+
readonly light?: T;
|
|
9
|
+
readonly dark?: T;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export type ThemeColorStop = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
13
|
+
export interface ThemeBrandSource {
|
|
14
|
+
/** Unmodified source text. A mapped fallback never replaces this value. */
|
|
15
|
+
readonly value: string;
|
|
16
|
+
readonly gamut: 'srgb' | 'display-p3';
|
|
17
|
+
readonly srgbFallback?: string;
|
|
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
|
+
export interface ThemeColorSection extends ThemeSection<ThemeTokens['color']> {
|
|
29
|
+
readonly brand?: ThemeBrandSource;
|
|
30
|
+
/** Defaults to anchored when a brand is present. Generation belongs to the color engine. */
|
|
31
|
+
readonly fidelity?: 'anchored' | 'unanchored';
|
|
32
|
+
readonly palettes?: readonly ThemePalette[];
|
|
33
|
+
/** Optional until generation; references the exact original, never its fallback. */
|
|
34
|
+
readonly anchor?: {
|
|
35
|
+
readonly paletteId: string;
|
|
36
|
+
readonly stop: ThemeColorStop;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Available OpenType axis range, never a font file or a trial-only setting. */
|
|
40
|
+
export interface ThemeFontAxis {
|
|
41
|
+
readonly tag: string;
|
|
42
|
+
readonly min: number;
|
|
43
|
+
readonly default: number;
|
|
44
|
+
readonly max: number;
|
|
45
|
+
}
|
|
46
|
+
/** Portable descriptors only. The consuming application owns loading and local availability. */
|
|
47
|
+
export interface ThemeFontMetadata {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly family: string;
|
|
50
|
+
readonly source: 'system' | 'catalog' | 'local';
|
|
51
|
+
readonly weights?: readonly number[];
|
|
52
|
+
readonly styles?: readonly ('normal' | 'italic')[];
|
|
53
|
+
readonly axes?: readonly ThemeFontAxis[];
|
|
54
|
+
}
|
|
55
|
+
export interface ThemeTypographySection extends ThemeSection<ThemeTokens['typography']> {
|
|
56
|
+
readonly fonts?: readonly ThemeFontMetadata[];
|
|
57
|
+
/** Generated defaults; explicit values and mode values override these leaves. */
|
|
58
|
+
readonly typesetting?: TypographyInput;
|
|
59
|
+
}
|
|
60
|
+
/** Token groups are the extension seams for richer typesetting and spring authoring. */
|
|
61
|
+
export type ThemeSections = {
|
|
62
|
+
readonly [K in keyof ThemeTokens]?: K extends 'color' ? ThemeColorSection : K extends 'typography' ? ThemeTypographySection : ThemeSection<ThemeTokens[K]>;
|
|
63
|
+
} & {
|
|
64
|
+
readonly components?: ThemeSection<ThemeComponentOverrides>;
|
|
65
|
+
};
|
|
66
|
+
export type ThemeSectionName = keyof ThemeSections;
|
|
67
|
+
export interface ThemeDocument {
|
|
68
|
+
readonly kind: 'radiant-theme';
|
|
69
|
+
readonly version: 1;
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly sections: ThemeSections;
|
|
73
|
+
}
|
|
74
|
+
/** A selective export has no identity and cannot accidentally replace an entire document. */
|
|
75
|
+
export interface ThemeSectionExport {
|
|
76
|
+
readonly kind: 'radiant-theme-sections';
|
|
77
|
+
readonly version: 1;
|
|
78
|
+
readonly sections: ThemeSections;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=themeDocumentTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeDocumentTypes.d.ts","sourceRoot":"","sources":["../../../src/themes/themeDocumentTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,yEAAyE;AACzE,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;KAAE,CAAA;CAC3D;AAED,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,G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AC,QAAQ,EAAE,aAAa,CAAA;CACjC;AAED,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeDocumentTypes.js","sourceRoot":"","sources":["../../../src/themes/themeDocumentTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type { ThemeComponentOverrides } from './components.js'\nimport type { ThemeTokens } from './tokens.js'\nimport type { TypographyInput } from '../typography/types.js'\n\n/** One existing token group, with independently authored mode layers. */\nexport interface ThemeSection<T> {\n readonly values?: T\n readonly modes?: { readonly light?: T; readonly dark?: T }\n}\n\nexport type ThemeColorStop = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950\n\nexport interface ThemeBrandSource {\n /** Unmodified source text. A mapped fallback never replaces this value. */\n readonly value: string\n readonly gamut: 'srgb' | 'display-p3'\n readonly srgbFallback?: string\n}\n\nexport interface ThemePalette {\n readonly id: string\n readonly name: string\n readonly swatches: readonly {\n readonly stop: ThemeColorStop\n readonly value: string\n readonly srgbFallback?: string\n }[]\n}\n\nexport interface ThemeColorSection extends ThemeSection<ThemeTokens['color']> {\n readonly brand?: ThemeBrandSource\n /** Defaults to anchored when a brand is present. Generation belongs to the color engine. */\n readonly fidelity?: 'anchored' | 'unanchored'\n readonly palettes?: readonly ThemePalette[]\n /** Optional until generation; references the exact original, never its fallback. */\n readonly anchor?: { readonly paletteId: string; readonly stop: ThemeColorStop }\n}\n\n/** Available OpenType axis range, never a font file or a trial-only setting. */\nexport interface ThemeFontAxis {\n readonly tag: string\n readonly min: number\n readonly default: number\n readonly max: number\n}\n\n/** Portable descriptors only. The consuming application owns loading and local availability. */\nexport interface ThemeFontMetadata {\n readonly id: string\n readonly family: string\n readonly source: 'system' | 'catalog' | 'local'\n readonly weights?: readonly number[]\n readonly styles?: readonly ('normal' | 'italic')[]\n readonly axes?: readonly ThemeFontAxis[]\n}\n\nexport interface ThemeTypographySection extends ThemeSection<ThemeTokens['typography']> {\n readonly fonts?: readonly ThemeFontMetadata[]\n /** Generated defaults; explicit values and mode values override these leaves. */\n readonly typesetting?: TypographyInput\n}\n\n/** Token groups are the extension seams for richer typesetting and spring authoring. */\nexport type ThemeSections = {\n readonly [K in keyof ThemeTokens]?: K extends 'color'\n ? ThemeColorSection\n : K extends 'typography'\n ? ThemeTypographySection\n : ThemeSection<ThemeTokens[K]>\n} & {\n readonly components?: ThemeSection<ThemeComponentOverrides>\n}\nexport type ThemeSectionName = keyof ThemeSections\n\nexport interface ThemeDocument {\n readonly kind: 'radiant-theme'\n readonly version: 1\n readonly id: string\n readonly name: string\n readonly sections: ThemeSections\n}\n\n/** A selective export has no identity and cannot accidentally replace an entire document. */\nexport interface ThemeSectionExport {\n readonly kind: 'radiant-theme-sections'\n readonly version: 1\n readonly sections: ThemeSections\n}\n"]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { TypographyProseRhythm, TypographyUIRhythm, TypographyStyle, TypographyRole, TypographyTokens, TypographyAssignment } from '../typography/types.js';
|
|
2
|
+
/** Canonical calculations live beside the defaults so source CSS generation stays self-contained. */
|
|
3
|
+
export declare function typographyStyles(prose: TypographyProseRhythm, ui: TypographyUIRhythm): Record<TypographyRole, TypographyStyle>;
|
|
4
|
+
export declare const typographyRoles: readonly TypographyRole[];
|
|
5
|
+
export declare function typographyTokens(styles: Readonly<Record<TypographyRole, TypographyStyle>>, families: Readonly<Record<TypographyAssignment, string>>, flow: number): TypographyTokens;
|
|
1
6
|
/** The complete shared-token registry. CSS names are derived from these paths. */
|
|
2
7
|
export interface SharedTokens {
|
|
3
8
|
color: {
|
|
@@ -28,6 +33,8 @@ export interface SharedTokens {
|
|
|
28
33
|
labelWeight: string | number;
|
|
29
34
|
headingWeight: string | number;
|
|
30
35
|
letterSpacing: string;
|
|
36
|
+
roles: TypographyTokens['roles'];
|
|
37
|
+
flow: TypographyTokens['flow'];
|
|
31
38
|
};
|
|
32
39
|
control: {
|
|
33
40
|
small: ControlMetrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/themes/tokens.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,eAAe,EAAE,MAAM,CAAA;QACvB,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,EAAE,MAAM,CAAA;QACnB,kBAAkB,EAAE,MAAM,CAAA;QAC1B,cAAc,EAAE,MAAM,CAAA;QACtB,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;QACd,gBAAgB,EAAE,MAAM,CAAA;QACxB,OAAO,EAAE,MAAM,CAAA;QACf,iBAAiB,EAAE,MAAM,CAAA;QACzB,OAAO,EAAE,MAAM,CAAA;QACf,iBAAiB,EAAE,MAAM,CAAA;QACzB,MAAM,EAAE,MAAM,CAAA;QACd,gBAAgB,EAAE,MAAM,CAAA;KACzB,CAAA;IACD,UAAU,EAAE;QACV,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,EAAE,MAAM,CAAA;QACnB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;QAC3B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;QAC5B,aAAa,EAAE,MAAM,GAAG,MAAM,CAAA;QAC9B,aAAa,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/themes/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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