@g9tm/lynxcontrols-foundation 2.5.7 → 2.5.9
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/catalog/catalog.json +235 -3
- package/catalog/index.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/culture/text.d.ts +2 -0
- package/dist/culture/text.d.ts.map +1 -1
- package/dist/culture/text.js +3 -2
- package/dist/culture/text.js.map +1 -1
- package/dist/services/keys.d.ts +7 -0
- package/dist/services/keys.d.ts.map +1 -1
- package/dist/services/keys.js.map +1 -1
- package/dist/theme/appearance-kit.d.ts +148 -0
- package/dist/theme/appearance-kit.d.ts.map +1 -0
- package/dist/theme/appearance-kit.js +410 -0
- package/dist/theme/appearance-kit.js.map +1 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -0
- package/dist/theme/recipe.d.ts.map +1 -1
- package/dist/theme/recipe.js +11 -3
- package/dist/theme/recipe.js.map +1 -1
- package/docs/api.md +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { g9DefaultShape } from "../tokens/shape.js";
|
|
2
|
+
import { g9BuiltInThemes, importTheme } from "./appearance.js";
|
|
3
|
+
import { formatColor, toHex, tryParseColor, withAlpha } from "./color.js";
|
|
4
|
+
import { ensureContrast, mixOklch, readableOn } from "./oklch.js";
|
|
5
|
+
const g9AppTokenNames = [
|
|
6
|
+
'hover',
|
|
7
|
+
'press',
|
|
8
|
+
'field',
|
|
9
|
+
'skeleton',
|
|
10
|
+
'accent-soft',
|
|
11
|
+
'accent-glow',
|
|
12
|
+
'accent-gradient',
|
|
13
|
+
'text-on-accent',
|
|
14
|
+
'glass',
|
|
15
|
+
'glass-border',
|
|
16
|
+
'bubble-mine',
|
|
17
|
+
'bubble-mine-text',
|
|
18
|
+
'bubble-mine-meta',
|
|
19
|
+
'bubble-other',
|
|
20
|
+
'bubble-other-text',
|
|
21
|
+
'bubble-other-border',
|
|
22
|
+
'highlight',
|
|
23
|
+
'link',
|
|
24
|
+
'selection',
|
|
25
|
+
'focus-ring',
|
|
26
|
+
'online',
|
|
27
|
+
'away',
|
|
28
|
+
'busy'
|
|
29
|
+
];
|
|
30
|
+
const css = (c)=>formatColor(c);
|
|
31
|
+
function g9AppTokens(theme, options = {}) {
|
|
32
|
+
var _p_InputBackground, _options_overrides;
|
|
33
|
+
const p = theme.palette;
|
|
34
|
+
const dark = 'dark' === theme.scheme;
|
|
35
|
+
const accent = options.accent && tryParseColor(options.accent) ? options.accent : p.Primary;
|
|
36
|
+
const own = accent === p.Primary;
|
|
37
|
+
const onAccent = own ? p.OnPrimary : readableOn(accent);
|
|
38
|
+
const surface = p.Surface;
|
|
39
|
+
const field = null != (_p_InputBackground = p.InputBackground) ? _p_InputBackground : p.SurfaceContainerLow;
|
|
40
|
+
const out = {
|
|
41
|
+
hover: css(withAlpha(p.TextPrimary, dark ? 0.08 : 0.06)),
|
|
42
|
+
press: css(withAlpha(p.TextPrimary, dark ? 0.14 : 0.1)),
|
|
43
|
+
field,
|
|
44
|
+
skeleton: p.SurfaceContainerHigh,
|
|
45
|
+
'accent-soft': css(withAlpha(accent, dark ? 0.16 : 0.11)),
|
|
46
|
+
'accent-glow': css(withAlpha(accent, dark ? 0.48 : 0.34)),
|
|
47
|
+
'accent-gradient': `linear-gradient(135deg, ${mixOklch(accent, '#ffffff', 0.2)} 0%, ${accent} 50%, ${mixOklch(accent, '#000000', 0.2)} 100%)`,
|
|
48
|
+
'text-on-accent': onAccent,
|
|
49
|
+
glass: css(withAlpha(surface, dark ? 0.6 : 0.72)),
|
|
50
|
+
'glass-border': css(withAlpha(p.OutlineVariant, 0.6)),
|
|
51
|
+
'bubble-mine': accent,
|
|
52
|
+
'bubble-mine-text': onAccent,
|
|
53
|
+
'bubble-mine-meta': css(withAlpha(onAccent, 0.76)),
|
|
54
|
+
'bubble-other': p.SurfaceContainer,
|
|
55
|
+
'bubble-other-text': p.TextPrimary,
|
|
56
|
+
'bubble-other-border': p.OutlineVariant,
|
|
57
|
+
highlight: css(withAlpha(accent, dark ? 0.22 : 0.14)),
|
|
58
|
+
link: ensureContrast(accent, surface, 4.5),
|
|
59
|
+
selection: css(withAlpha(accent, dark ? 0.34 : 0.22)),
|
|
60
|
+
'focus-ring': css(withAlpha(accent, dark ? 0.72 : 0.55)),
|
|
61
|
+
online: p.Success,
|
|
62
|
+
away: p.Warning,
|
|
63
|
+
busy: p.Error
|
|
64
|
+
};
|
|
65
|
+
for (const [name, value] of Object.entries(null != (_options_overrides = options.overrides) ? _options_overrides : {}))if (value) out[name] = value;
|
|
66
|
+
return Object.freeze(out);
|
|
67
|
+
}
|
|
68
|
+
function g9AppTokenVariables(theme, options = {}, prefix = 'g9-') {
|
|
69
|
+
const out = {};
|
|
70
|
+
for (const [name, value] of Object.entries(g9AppTokens(theme, options)))out[`--${prefix}${name}`] = value;
|
|
71
|
+
return Object.freeze(out);
|
|
72
|
+
}
|
|
73
|
+
const MAX_VALUE = 2000;
|
|
74
|
+
function g9SanitizeTokens(input, allowed) {
|
|
75
|
+
const known = new Set(allowed);
|
|
76
|
+
const result = {};
|
|
77
|
+
if (!input) return result;
|
|
78
|
+
for (const [rawName, rawValue] of Object.entries(input)){
|
|
79
|
+
var _value_match;
|
|
80
|
+
const name = rawName.replace(/^--g9-/, '');
|
|
81
|
+
if (!known.has(name) || 'string' != typeof rawValue) continue;
|
|
82
|
+
const value = rawValue.trim();
|
|
83
|
+
if (!value || value.length > MAX_VALUE) continue;
|
|
84
|
+
if (/[;{}<>]|\/\*|\\/.test(value.replace(/url\("data:image\/svg\+xml,[^"]*"\)/g, ''))) continue;
|
|
85
|
+
const urls = null != (_value_match = value.match(/url\(([^)]*)\)/g)) ? _value_match : [];
|
|
86
|
+
if (!urls.some((url)=>!/^url\(["']?data:image\//.test(url))) {
|
|
87
|
+
if (!/expression\s*\(|javascript:/i.test(value)) result[name] = value;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
const g9DefaultAppearance = Object.freeze({
|
|
93
|
+
theme: 'system',
|
|
94
|
+
light: 'classic',
|
|
95
|
+
dark: 'midnight',
|
|
96
|
+
accent: null,
|
|
97
|
+
wallpaper: 'theme',
|
|
98
|
+
fontScale: 'normal',
|
|
99
|
+
effects: 'auto',
|
|
100
|
+
density: 'regular'
|
|
101
|
+
});
|
|
102
|
+
const SCALES = [
|
|
103
|
+
'small',
|
|
104
|
+
'normal',
|
|
105
|
+
'large',
|
|
106
|
+
'larger'
|
|
107
|
+
];
|
|
108
|
+
const EFFECTS = [
|
|
109
|
+
'auto',
|
|
110
|
+
'on',
|
|
111
|
+
'off'
|
|
112
|
+
];
|
|
113
|
+
const DENSITIES = [
|
|
114
|
+
'compact',
|
|
115
|
+
'regular',
|
|
116
|
+
'comfortable'
|
|
117
|
+
];
|
|
118
|
+
function g9NormalizeAppearance(raw, defaults = g9DefaultAppearance) {
|
|
119
|
+
const r = raw && 'object' == typeof raw ? raw : {};
|
|
120
|
+
const text = (v, d)=>'string' == typeof v && v.trim() ? v : d;
|
|
121
|
+
const pick = (v, list, d)=>list.includes(v) ? v : d;
|
|
122
|
+
const accent = 'string' == typeof r.accent && /^#[0-9a-f]{6}$/i.test(r.accent) ? r.accent.toLowerCase() : null;
|
|
123
|
+
return Object.freeze({
|
|
124
|
+
theme: text(r.theme, defaults.theme),
|
|
125
|
+
light: text(r.light, defaults.light),
|
|
126
|
+
dark: text(r.dark, defaults.dark),
|
|
127
|
+
accent: void 0 === r.accent ? defaults.accent : accent,
|
|
128
|
+
wallpaper: text(r.wallpaper, defaults.wallpaper),
|
|
129
|
+
fontScale: pick(r.fontScale, SCALES, defaults.fontScale),
|
|
130
|
+
effects: pick(r.effects, EFFECTS, defaults.effects),
|
|
131
|
+
density: pick(r.density, DENSITIES, defaults.density)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const g9FontScaleFactors = Object.freeze({
|
|
135
|
+
small: 0.9,
|
|
136
|
+
normal: 1,
|
|
137
|
+
large: 1.12,
|
|
138
|
+
larger: 1.25
|
|
139
|
+
});
|
|
140
|
+
function g9ScaledType(scale, base = g9DefaultShape.type) {
|
|
141
|
+
const k = 'number' == typeof scale ? scale : g9FontScaleFactors[scale];
|
|
142
|
+
const out = {};
|
|
143
|
+
for (const [role, t] of Object.entries(base))out[role] = {
|
|
144
|
+
...t,
|
|
145
|
+
size: Math.round(t.size * k),
|
|
146
|
+
lineHeight: Math.round(t.lineHeight * k)
|
|
147
|
+
};
|
|
148
|
+
return Object.freeze(out);
|
|
149
|
+
}
|
|
150
|
+
function g9EffectsEnabled(mode, device = {}) {
|
|
151
|
+
if ('auto' !== mode) return 'on' === mode;
|
|
152
|
+
return !device.reducedMotion && !device.lowEnd;
|
|
153
|
+
}
|
|
154
|
+
function g9ActiveThemeId(settings, systemScheme) {
|
|
155
|
+
if ('system' !== settings.theme) return settings.theme;
|
|
156
|
+
return 'dark' === systemScheme ? settings.dark : settings.light;
|
|
157
|
+
}
|
|
158
|
+
function g9ThemeFromInput(input, source) {
|
|
159
|
+
if (!input || 'object' != typeof input) return null;
|
|
160
|
+
const t = input;
|
|
161
|
+
try {
|
|
162
|
+
const def = importTheme(JSON.stringify({
|
|
163
|
+
format: 'g9-theme',
|
|
164
|
+
version: 1,
|
|
165
|
+
theme: t
|
|
166
|
+
}));
|
|
167
|
+
if (!def.name || 'string' == typeof def.name && !def.name.trim()) return null;
|
|
168
|
+
return Object.freeze({
|
|
169
|
+
...def,
|
|
170
|
+
id: 'org' !== source || def.id.startsWith('org:') ? def.id : `org:${def.id}`,
|
|
171
|
+
source
|
|
172
|
+
});
|
|
173
|
+
} catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function createG9ThemeRegistry(options = {}) {
|
|
178
|
+
var _options_builtins, _options_maxPersonal, _options_personal;
|
|
179
|
+
const builtins = null != (_options_builtins = options.builtins) ? _options_builtins : g9BuiltInThemes;
|
|
180
|
+
const max = Math.max(1, null != (_options_maxPersonal = options.maxPersonal) ? _options_maxPersonal : 12);
|
|
181
|
+
let org = [];
|
|
182
|
+
let personal = (null != (_options_personal = options.personal) ? _options_personal : []).map((t)=>g9ThemeFromInput(t, 'personal')).filter((t)=>null !== t).slice(0, max);
|
|
183
|
+
const listeners = new Set();
|
|
184
|
+
let snapshot = {
|
|
185
|
+
themes: [
|
|
186
|
+
...builtins,
|
|
187
|
+
...personal
|
|
188
|
+
],
|
|
189
|
+
revision: 0
|
|
190
|
+
};
|
|
191
|
+
const rebuild = ()=>{
|
|
192
|
+
snapshot = {
|
|
193
|
+
themes: [
|
|
194
|
+
...builtins,
|
|
195
|
+
...org,
|
|
196
|
+
...personal
|
|
197
|
+
],
|
|
198
|
+
revision: snapshot.revision + 1
|
|
199
|
+
};
|
|
200
|
+
for (const l of [
|
|
201
|
+
...listeners
|
|
202
|
+
])l();
|
|
203
|
+
};
|
|
204
|
+
const find = (id)=>{
|
|
205
|
+
var _snapshot_themes_find;
|
|
206
|
+
return null != (_snapshot_themes_find = snapshot.themes.find((t)=>t.id === id)) ? _snapshot_themes_find : null;
|
|
207
|
+
};
|
|
208
|
+
return {
|
|
209
|
+
get: ()=>snapshot,
|
|
210
|
+
subscribe (listener) {
|
|
211
|
+
listeners.add(listener);
|
|
212
|
+
return ()=>listeners.delete(listener);
|
|
213
|
+
},
|
|
214
|
+
find,
|
|
215
|
+
themeOrDefault: (id)=>{
|
|
216
|
+
var _find;
|
|
217
|
+
return null != (_find = find(id)) ? _find : builtins[0];
|
|
218
|
+
},
|
|
219
|
+
setOrgThemes (inputs) {
|
|
220
|
+
org = inputs.map((i)=>g9ThemeFromInput(i, 'org')).filter((t)=>null !== t);
|
|
221
|
+
rebuild();
|
|
222
|
+
},
|
|
223
|
+
savePersonal (theme) {
|
|
224
|
+
var _options_savePersonal;
|
|
225
|
+
const own = Object.freeze({
|
|
226
|
+
...theme,
|
|
227
|
+
source: 'personal'
|
|
228
|
+
});
|
|
229
|
+
personal = [
|
|
230
|
+
own,
|
|
231
|
+
...personal.filter((t)=>t.id !== theme.id)
|
|
232
|
+
].slice(0, max);
|
|
233
|
+
null == (_options_savePersonal = options.savePersonal) || _options_savePersonal.call(options, personal);
|
|
234
|
+
rebuild();
|
|
235
|
+
},
|
|
236
|
+
removePersonal (id) {
|
|
237
|
+
var _options_savePersonal;
|
|
238
|
+
if (!personal.some((t)=>t.id === id)) return;
|
|
239
|
+
personal = personal.filter((t)=>t.id !== id);
|
|
240
|
+
null == (_options_savePersonal = options.savePersonal) || _options_savePersonal.call(options, personal);
|
|
241
|
+
rebuild();
|
|
242
|
+
},
|
|
243
|
+
personal: ()=>personal
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function g9NewPersonalThemeId(random = Math.random) {
|
|
247
|
+
let id = '';
|
|
248
|
+
for(let i = 0; i < 12; i++)id += Math.floor(36 * random()).toString(36);
|
|
249
|
+
return `me:${id}`;
|
|
250
|
+
}
|
|
251
|
+
function g9PersonalDraft(base, name, id = g9NewPersonalThemeId()) {
|
|
252
|
+
var _base_wallpaper;
|
|
253
|
+
return {
|
|
254
|
+
id,
|
|
255
|
+
name,
|
|
256
|
+
base,
|
|
257
|
+
accent: toHex(base.brand.primary),
|
|
258
|
+
surfaces: 'neutral',
|
|
259
|
+
wallpaper: null != (_base_wallpaper = base.wallpaper) ? _base_wallpaper : 'theme'
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
const TINTS = {
|
|
263
|
+
cool: '#3b82f6',
|
|
264
|
+
warm: '#f59e0b'
|
|
265
|
+
};
|
|
266
|
+
const SURFACES = [
|
|
267
|
+
[
|
|
268
|
+
'Background',
|
|
269
|
+
0.07,
|
|
270
|
+
0.04
|
|
271
|
+
],
|
|
272
|
+
[
|
|
273
|
+
'BackgroundSecondary',
|
|
274
|
+
0.08,
|
|
275
|
+
0.05
|
|
276
|
+
],
|
|
277
|
+
[
|
|
278
|
+
'Surface',
|
|
279
|
+
0.09,
|
|
280
|
+
0.05
|
|
281
|
+
],
|
|
282
|
+
[
|
|
283
|
+
'SurfaceContainerLow',
|
|
284
|
+
0.09,
|
|
285
|
+
0.05
|
|
286
|
+
],
|
|
287
|
+
[
|
|
288
|
+
'SurfaceContainer',
|
|
289
|
+
0.1,
|
|
290
|
+
0.06
|
|
291
|
+
],
|
|
292
|
+
[
|
|
293
|
+
'SurfaceContainerHigh',
|
|
294
|
+
0.12,
|
|
295
|
+
0.08
|
|
296
|
+
]
|
|
297
|
+
];
|
|
298
|
+
function g9BuildPersonalTheme(draft, palettes) {
|
|
299
|
+
var _draft_scheme;
|
|
300
|
+
const accent = tryParseColor(draft.accent) ? draft.accent : draft.base.brand.primary;
|
|
301
|
+
const scheme = null != (_draft_scheme = draft.scheme) ? _draft_scheme : 'dark' === draft.base.mode ? 'dark' : 'light';
|
|
302
|
+
let overrides;
|
|
303
|
+
if ('neutral' !== draft.surfaces) {
|
|
304
|
+
const tint = 'tinted' === draft.surfaces ? accent : TINTS[draft.surfaces];
|
|
305
|
+
const of = (s)=>{
|
|
306
|
+
const o = {};
|
|
307
|
+
for (const [token, d, l] of SURFACES)o[token] = mixOklch(palettes[s][token], tint, 'dark' === s ? d : l);
|
|
308
|
+
return o;
|
|
309
|
+
};
|
|
310
|
+
overrides = {
|
|
311
|
+
light: of('light'),
|
|
312
|
+
dark: of('dark')
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
const name = draft.name.trim().slice(0, 60);
|
|
316
|
+
return Object.freeze({
|
|
317
|
+
id: draft.id,
|
|
318
|
+
name: name || draft.base.name,
|
|
319
|
+
source: 'personal',
|
|
320
|
+
recipe: draft.base.recipe,
|
|
321
|
+
brand: {
|
|
322
|
+
...draft.base.brand,
|
|
323
|
+
primary: accent
|
|
324
|
+
},
|
|
325
|
+
...overrides ? {
|
|
326
|
+
overrides
|
|
327
|
+
} : {},
|
|
328
|
+
...draft.base.shape ? {
|
|
329
|
+
shape: draft.base.shape
|
|
330
|
+
} : {},
|
|
331
|
+
mode: scheme,
|
|
332
|
+
...'theme' !== draft.wallpaper ? {
|
|
333
|
+
wallpaper: draft.wallpaper
|
|
334
|
+
} : {}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function g9ThemeFileName(name) {
|
|
338
|
+
const slug = name.trim().toLowerCase().replace(/[\s!-/:-@[-`{-~،؛؟«»]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40);
|
|
339
|
+
return `${slug || 'theme'}.g9theme.json`;
|
|
340
|
+
}
|
|
341
|
+
const glow = (c, a)=>css(withAlpha(c, a));
|
|
342
|
+
const g9Wallpapers = Object.freeze([
|
|
343
|
+
{
|
|
344
|
+
id: 'none',
|
|
345
|
+
name: {
|
|
346
|
+
en: 'None',
|
|
347
|
+
fa: 'هیچ'
|
|
348
|
+
},
|
|
349
|
+
paint: (p)=>({
|
|
350
|
+
color: p.Background
|
|
351
|
+
})
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: 'aurora',
|
|
355
|
+
name: {
|
|
356
|
+
en: 'Aurora',
|
|
357
|
+
fa: 'شفق'
|
|
358
|
+
},
|
|
359
|
+
paint: (p, s)=>({
|
|
360
|
+
color: p.Background,
|
|
361
|
+
image: `radial-gradient(circle at 0% 0%, ${glow(p.Primary, 'dark' === s ? 0.18 : 0.12)} 0%, transparent 60%), radial-gradient(circle at 100% 100%, ${glow(p.Tertiary, 'dark' === s ? 0.16 : 0.1)} 0%, transparent 60%)`
|
|
362
|
+
})
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
id: 'dusk',
|
|
366
|
+
name: {
|
|
367
|
+
en: 'Dusk',
|
|
368
|
+
fa: 'غروب'
|
|
369
|
+
},
|
|
370
|
+
paint: (p, s)=>({
|
|
371
|
+
color: p.Background,
|
|
372
|
+
image: `linear-gradient(180deg, ${glow(p.Primary, 'dark' === s ? 0.12 : 0.08)} 0%, transparent 45%, ${glow(p.Secondary, 'dark' === s ? 0.1 : 0.06)} 100%)`
|
|
373
|
+
})
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
id: 'mesh',
|
|
377
|
+
name: {
|
|
378
|
+
en: 'Mesh',
|
|
379
|
+
fa: 'توری'
|
|
380
|
+
},
|
|
381
|
+
paint: (p, s)=>{
|
|
382
|
+
const k = 'dark' === s ? 1 : 0.75;
|
|
383
|
+
return {
|
|
384
|
+
color: p.Background,
|
|
385
|
+
image: [
|
|
386
|
+
`radial-gradient(circle at 15% 20%, ${glow(p.Primary, 0.14 * k)} 0%, transparent 55%)`,
|
|
387
|
+
`radial-gradient(circle at 85% 30%, ${glow(p.Tertiary, 0.14 * k)} 0%, transparent 55%)`,
|
|
388
|
+
`radial-gradient(circle at 50% 95%, ${glow(p.Secondary, 0.14 * k)} 0%, transparent 55%)`
|
|
389
|
+
].join(', ')
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: 'paper',
|
|
395
|
+
name: {
|
|
396
|
+
en: 'Paper',
|
|
397
|
+
fa: 'کاغذی'
|
|
398
|
+
},
|
|
399
|
+
paint: (p, s)=>({
|
|
400
|
+
color: mixOklch(p.Background, 'dark' === s ? '#000000' : '#f5ecd7', 0.25)
|
|
401
|
+
})
|
|
402
|
+
}
|
|
403
|
+
]);
|
|
404
|
+
function g9Wallpaper(id, list = g9Wallpapers) {
|
|
405
|
+
var _list_find;
|
|
406
|
+
return null != (_list_find = list.find((w)=>w.id === id)) ? _list_find : null;
|
|
407
|
+
}
|
|
408
|
+
export { createG9ThemeRegistry, g9ActiveThemeId, g9AppTokenNames, g9AppTokenVariables, g9AppTokens, g9BuildPersonalTheme, g9DefaultAppearance, g9EffectsEnabled, g9FontScaleFactors, g9NewPersonalThemeId, g9NormalizeAppearance, g9PersonalDraft, g9SanitizeTokens, g9ScaledType, g9ThemeFileName, g9ThemeFromInput, g9Wallpaper, g9Wallpapers };
|
|
409
|
+
|
|
410
|
+
//# sourceMappingURL=appearance-kit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme/appearance-kit.js","sources":["../../src/theme/appearance-kit.ts"],"sourcesContent":["// The appearance kit (2.5.8, from G9Hub item 42): what an app's Settings → Appearance needs over the theme engine —\n// the tokens a messenger adds to a palette (hover / press, fields and skeletons, the accent's soft wash and glow,\n// glass, chat bubbles, presence colours), each derived from the palette so every theme and accent drives them; the\n// person's settings (theme, light and dark themes when following the device, accent, wallpaper, text size, effects,\n// density); a theme registry (built in, the organisation's from the server, the person's own on the device); a\n// personal theme built from a base theme, an accent and a surface tone; wallpapers; and a token sanitizer for themes\n// that come from outside. Pure: the app persists the settings and the personal themes.\nimport type { G9ColorToken, G9PaletteValues } from '../tokens/generated/palettes';\nimport { type G9Density, type G9TypeRole, type G9TypeRoleName, g9DefaultShape } from '../tokens/shape';\nimport { type G9ThemeDefinition, g9BuiltInThemes, importTheme } from './appearance';\nimport { formatColor, toHex, tryParseColor, withAlpha } from './color';\nimport { ensureContrast, mixOklch, readableOn } from './oklch';\nimport type { G9ColorScheme } from './theme';\n\n// ------------------------------------------------------------------------------------------------ the app tokens\n\n/** The tokens an app (a messenger) adds to the library palette. */\nexport const g9AppTokenNames = [\n 'hover',\n 'press',\n 'field',\n 'skeleton',\n 'accent-soft',\n 'accent-glow',\n 'accent-gradient',\n 'text-on-accent',\n 'glass',\n 'glass-border',\n 'bubble-mine',\n 'bubble-mine-text',\n 'bubble-mine-meta',\n 'bubble-other',\n 'bubble-other-text',\n 'bubble-other-border',\n 'highlight',\n 'link',\n 'selection',\n 'focus-ring',\n 'online',\n 'away',\n 'busy',\n] as const;\n\n/** The name of an app token (`hover`, `bubble-mine`…). */\nexport type G9AppTokenName = (typeof g9AppTokenNames)[number];\n\n/** Options of {@link g9AppTokens}. */\nexport interface G9AppTokenOptions {\n /** The person's accent (`#rrggbb`) over the theme's primary; null / invalid: the theme's own. */\n readonly accent?: string | null;\n /** Values the app (or a theme) sets itself. */\n readonly overrides?: Partial<Record<G9AppTokenName, string>>;\n}\n\nconst css = (c: Parameters<typeof formatColor>[0]) => formatColor(c);\n\n/** The app tokens for a palette and scheme: plain colours (and one gradient), never variables. */\nexport function g9AppTokens(\n theme: { readonly palette: G9PaletteValues; readonly scheme: G9ColorScheme },\n options: G9AppTokenOptions = {},\n): Readonly<Record<G9AppTokenName, string>> {\n const p = theme.palette;\n const dark = theme.scheme === 'dark';\n const accent = options.accent && tryParseColor(options.accent) ? options.accent : p.Primary;\n const own = accent === p.Primary;\n const onAccent = own ? p.OnPrimary : readableOn(accent);\n const surface = p.Surface;\n const field = (p as Partial<Record<string, string>>).InputBackground ?? p.SurfaceContainerLow;\n const out: Record<G9AppTokenName, string> = {\n hover: css(withAlpha(p.TextPrimary, dark ? 0.08 : 0.06)),\n press: css(withAlpha(p.TextPrimary, dark ? 0.14 : 0.1)),\n field,\n skeleton: p.SurfaceContainerHigh,\n 'accent-soft': css(withAlpha(accent, dark ? 0.16 : 0.11)),\n 'accent-glow': css(withAlpha(accent, dark ? 0.48 : 0.34)),\n 'accent-gradient': `linear-gradient(135deg, ${mixOklch(accent, '#ffffff', 0.2)} 0%, ${accent} 50%, ${mixOklch(accent, '#000000', 0.2)} 100%)`,\n 'text-on-accent': onAccent,\n glass: css(withAlpha(surface, dark ? 0.6 : 0.72)),\n 'glass-border': css(withAlpha(p.OutlineVariant, 0.6)),\n 'bubble-mine': accent,\n 'bubble-mine-text': onAccent,\n 'bubble-mine-meta': css(withAlpha(onAccent, 0.76)),\n 'bubble-other': p.SurfaceContainer,\n 'bubble-other-text': p.TextPrimary,\n 'bubble-other-border': p.OutlineVariant,\n highlight: css(withAlpha(accent, dark ? 0.22 : 0.14)),\n link: ensureContrast(accent, surface, 4.5),\n selection: css(withAlpha(accent, dark ? 0.34 : 0.22)),\n 'focus-ring': css(withAlpha(accent, dark ? 0.72 : 0.55)),\n online: p.Success,\n away: p.Warning,\n busy: p.Error,\n };\n for (const [name, value] of Object.entries(options.overrides ?? {})) if (value) out[name as G9AppTokenName] = value;\n return Object.freeze(out);\n}\n\n/** The app tokens as CSS variables (`--g9-hover`…; `prefix` default `g9-`), for G9Provider's `themeExtras`. */\nexport function g9AppTokenVariables(\n theme: { readonly palette: G9PaletteValues; readonly scheme: G9ColorScheme },\n options: G9AppTokenOptions = {},\n prefix = 'g9-',\n): Readonly<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const [name, value] of Object.entries(g9AppTokens(theme, options))) out[`--${prefix}${name}`] = value;\n return Object.freeze(out);\n}\n\n// ------------------------------------------------------------------------------------------------ the sanitizer\n\nconst MAX_VALUE = 2000;\n\n/**\n * Only well-formed tokens of `allowed` names (a leading `--g9-` is dropped first), from a theme that came from outside\n * (the server, a file): values that cannot break out of a declaration, and pictures only as inline `data:` images.\n */\nexport function g9SanitizeTokens(\n input: Readonly<Record<string, unknown>> | null | undefined,\n allowed: readonly string[],\n): Record<string, string> {\n const known = new Set(allowed);\n const result: Record<string, string> = {};\n if (!input) return result;\n for (const [rawName, rawValue] of Object.entries(input)) {\n const name = rawName.replace(/^--g9-/, '');\n if (!known.has(name) || typeof rawValue !== 'string') continue;\n const value = rawValue.trim();\n if (!value || value.length > MAX_VALUE) continue;\n if (/[;{}<>]|\\/\\*|\\\\/.test(value.replace(/url\\(\"data:image\\/svg\\+xml,[^\"]*\"\\)/g, ''))) continue;\n const urls = value.match(/url\\(([^)]*)\\)/g) ?? [];\n if (urls.some((url) => !/^url\\([\"']?data:image\\//.test(url))) continue;\n if (/expression\\s*\\(|javascript:/i.test(value)) continue;\n result[name] = value;\n }\n return result;\n}\n\n// ------------------------------------------------------------------------------------------------ the settings\n\n/** A text size step. */\nexport type G9FontScale = 'small' | 'normal' | 'large' | 'larger';\n/** Whether effects are on, off, or decided by the device. */\nexport type G9EffectsMode = 'auto' | 'on' | 'off';\n\n/** What a person chose on Settings → Appearance (kept per device by the app). */\nexport interface G9AppearanceSettings {\n /** A theme id, or `system`: follow the device between `light` and `dark`. */\n readonly theme: string;\n readonly light: string;\n readonly dark: string;\n /** `#rrggbb`, or null for the theme's own. */\n readonly accent: string | null;\n /** A wallpaper id; `theme` keeps the theme's own. */\n readonly wallpaper: string;\n readonly fontScale: G9FontScale;\n /** `auto`: off on low-end devices and when the system asks for reduced motion. */\n readonly effects: G9EffectsMode;\n readonly density: G9Density;\n}\n\n/** The settings of a new install. */\nexport const g9DefaultAppearance: G9AppearanceSettings = Object.freeze({\n theme: 'system',\n light: 'classic',\n dark: 'midnight',\n accent: null,\n wallpaper: 'theme',\n fontScale: 'normal',\n effects: 'auto',\n density: 'regular',\n});\n\nconst SCALES: readonly G9FontScale[] = ['small', 'normal', 'large', 'larger'];\nconst EFFECTS: readonly G9EffectsMode[] = ['auto', 'on', 'off'];\nconst DENSITIES: readonly G9Density[] = ['compact', 'regular', 'comfortable'];\n\n/** Stored settings read back loosely: every unknown or broken field takes its default. */\nexport function g9NormalizeAppearance(\n raw: unknown,\n defaults: G9AppearanceSettings = g9DefaultAppearance,\n): G9AppearanceSettings {\n const r = (raw && typeof raw === 'object' ? raw : {}) as Partial<Record<keyof G9AppearanceSettings, unknown>>;\n const text = (v: unknown, d: string) => (typeof v === 'string' && v.trim() ? v : d);\n const pick = <T extends string>(v: unknown, list: readonly T[], d: T) => (list.includes(v as T) ? (v as T) : d);\n const accent = typeof r.accent === 'string' && /^#[0-9a-f]{6}$/i.test(r.accent) ? r.accent.toLowerCase() : null;\n return Object.freeze({\n theme: text(r.theme, defaults.theme),\n light: text(r.light, defaults.light),\n dark: text(r.dark, defaults.dark),\n accent: r.accent === undefined ? defaults.accent : accent,\n wallpaper: text(r.wallpaper, defaults.wallpaper),\n fontScale: pick(r.fontScale, SCALES, defaults.fontScale),\n effects: pick(r.effects, EFFECTS, defaults.effects),\n density: pick(r.density, DENSITIES, defaults.density),\n });\n}\n\n/** Text size factors. */\nexport const g9FontScaleFactors: Readonly<Record<G9FontScale, number>> = Object.freeze({\n small: 0.9,\n normal: 1,\n large: 1.12,\n larger: 1.25,\n});\n\n/** The type scale at a text size (sizes and line heights rounded), for G9Provider's `shape.type`. */\nexport function g9ScaledType(\n scale: G9FontScale | number,\n base: { readonly [K in G9TypeRoleName]: G9TypeRole } = g9DefaultShape.type,\n): { readonly [K in G9TypeRoleName]: G9TypeRole } {\n const k = typeof scale === 'number' ? scale : g9FontScaleFactors[scale];\n const out = {} as Record<G9TypeRoleName, G9TypeRole>;\n for (const [role, t] of Object.entries(base) as [G9TypeRoleName, G9TypeRole][])\n out[role] = { ...t, size: Math.round(t.size * k), lineHeight: Math.round(t.lineHeight * k) };\n return Object.freeze(out);\n}\n\n/** Whether effects (blur, glow, motion flourishes) are on. */\nexport function g9EffectsEnabled(\n mode: G9EffectsMode,\n device: { readonly reducedMotion?: boolean; readonly lowEnd?: boolean } = {},\n): boolean {\n if (mode !== 'auto') return mode === 'on';\n return !device.reducedMotion && !device.lowEnd;\n}\n\n/** The theme id in force: the chosen one, or the light / dark one for the device's scheme when following it. */\nexport function g9ActiveThemeId(settings: G9AppearanceSettings, systemScheme: G9ColorScheme): string {\n if (settings.theme !== 'system') return settings.theme;\n return systemScheme === 'dark' ? settings.dark : settings.light;\n}\n\n// ------------------------------------------------------------------------------------------------ the registry\n\n/** The themes a person can pick, by source. */\nexport interface G9ThemeRegistrySnapshot {\n readonly themes: readonly G9ThemeDefinition[];\n readonly revision: number;\n}\n\n/** Options of {@link createG9ThemeRegistry}. */\nexport interface G9ThemeRegistryOptions {\n /** Default {@link g9BuiltInThemes}. */\n readonly builtins?: readonly G9ThemeDefinition[];\n /** The person's own themes as the app stored them (read before the first paint). */\n readonly personal?: readonly G9ThemeDefinition[];\n /** Saves the personal list (the device's preferences). */\n readonly savePersonal?: (themes: readonly G9ThemeDefinition[]) => void;\n /** The most personal themes kept. Default 12. */\n readonly maxPersonal?: number;\n}\n\n/** Every theme: built in, the organisation's, the person's own (a store an appearance page reads). */\nexport interface G9ThemeRegistry {\n get(): G9ThemeRegistrySnapshot;\n subscribe(listener: () => void): () => void;\n /** A theme by id, or null. */\n find(id: string): G9ThemeDefinition | null;\n /** A theme by id; one that disappeared (an admin deleted it) falls back to the first built-in theme. */\n themeOrDefault(id: string): G9ThemeDefinition;\n /** Replaces the organisation's themes (from the server; each read loosely, broken ones dropped). */\n setOrgThemes(inputs: readonly unknown[]): void;\n /** Adds or replaces a personal theme (the newest first; past the limit the oldest go). */\n savePersonal(theme: G9ThemeDefinition): void;\n removePersonal(id: string): void;\n readonly personal: () => readonly G9ThemeDefinition[];\n}\n\n/** A theme from the server or a file, read loosely (a newer server never breaks the client); null when broken. */\nexport function g9ThemeFromInput(input: unknown, source: G9ThemeDefinition['source']): G9ThemeDefinition | null {\n if (!input || typeof input !== 'object') return null;\n const t = input as Partial<G9ThemeDefinition>;\n try {\n const def = importTheme(JSON.stringify({ format: 'g9-theme', version: 1, theme: t }));\n if (!def.name || (typeof def.name === 'string' && !def.name.trim())) return null;\n return Object.freeze({\n ...def,\n id: source === 'org' && !def.id.startsWith('org:') ? `org:${def.id}` : def.id,\n source,\n });\n } catch {\n return null;\n }\n}\n\n/** Creates a theme registry. */\nexport function createG9ThemeRegistry(options: G9ThemeRegistryOptions = {}): G9ThemeRegistry {\n const builtins = options.builtins ?? g9BuiltInThemes;\n const max = Math.max(1, options.maxPersonal ?? 12);\n let org: G9ThemeDefinition[] = [];\n let personal: G9ThemeDefinition[] = (options.personal ?? [])\n .map((t) => g9ThemeFromInput(t, 'personal'))\n .filter((t): t is G9ThemeDefinition => t !== null)\n .slice(0, max);\n const listeners = new Set<() => void>();\n let snapshot: G9ThemeRegistrySnapshot = { themes: [...builtins, ...personal], revision: 0 };\n const rebuild = () => {\n snapshot = { themes: [...builtins, ...org, ...personal], revision: snapshot.revision + 1 };\n for (const l of [...listeners]) l();\n };\n const find = (id: string) => snapshot.themes.find((t) => t.id === id) ?? null;\n return {\n get: () => snapshot,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n find,\n themeOrDefault: (id) => find(id) ?? (builtins[0] as G9ThemeDefinition),\n setOrgThemes(inputs) {\n org = inputs.map((i) => g9ThemeFromInput(i, 'org')).filter((t): t is G9ThemeDefinition => t !== null);\n rebuild();\n },\n savePersonal(theme) {\n const own = Object.freeze({ ...theme, source: 'personal' as const });\n personal = [own, ...personal.filter((t) => t.id !== theme.id)].slice(0, max);\n options.savePersonal?.(personal);\n rebuild();\n },\n removePersonal(id) {\n if (!personal.some((t) => t.id === id)) return;\n personal = personal.filter((t) => t.id !== id);\n options.savePersonal?.(personal);\n rebuild();\n },\n personal: () => personal,\n };\n}\n\n// ------------------------------------------------------------------------------------------------ personal themes\n\n/** How a personal theme's surfaces are tinted. */\nexport type G9SurfaceTone = 'neutral' | 'cool' | 'warm' | 'tinted';\n\n/** What the personal theme editor edits. */\nexport interface G9PersonalThemeDraft {\n readonly id: string;\n readonly name: string;\n /** The theme it starts from. */\n readonly base: G9ThemeDefinition;\n /** `#rrggbb`. */\n readonly accent: string;\n readonly surfaces: G9SurfaceTone;\n /** A wallpaper id, or `theme`. */\n readonly wallpaper: string;\n /** Light or dark (default the base's own mode, else light). */\n readonly scheme?: G9ColorScheme;\n}\n\n/** A fresh personal id (`me:…`). */\nexport function g9NewPersonalThemeId(random: () => number = Math.random): string {\n let id = '';\n for (let i = 0; i < 12; i++) id += Math.floor(random() * 36).toString(36);\n return `me:${id}`;\n}\n\n/** A draft starting from `base`. */\nexport function g9PersonalDraft(\n base: G9ThemeDefinition,\n name: string,\n id: string = g9NewPersonalThemeId(),\n): G9PersonalThemeDraft {\n return {\n id,\n name,\n base,\n accent: toHex(base.brand.primary),\n surfaces: 'neutral',\n wallpaper: base.wallpaper ?? 'theme',\n };\n}\n\nconst TINTS: Readonly<Record<'cool' | 'warm', string>> = { cool: '#3b82f6', warm: '#f59e0b' };\nconst SURFACES: readonly [G9ColorToken, number, number][] = [\n // token, tint in dark, tint in light (fractions)\n ['Background', 0.07, 0.04],\n ['BackgroundSecondary', 0.08, 0.05],\n ['Surface', 0.09, 0.05],\n ['SurfaceContainerLow', 0.09, 0.05],\n ['SurfaceContainer', 0.1, 0.06],\n ['SurfaceContainerHigh', 0.12, 0.08],\n];\n\n/**\n * The theme a draft describes: the base's recipe with the draft's accent, its surfaces tinted (cool, warm, or by the\n * accent) through overrides measured on `palettes` (the base's palettes for the accent: `recipePalettes(...)`).\n */\nexport function g9BuildPersonalTheme(\n draft: G9PersonalThemeDraft,\n palettes: { readonly light: G9PaletteValues; readonly dark: G9PaletteValues },\n): G9ThemeDefinition {\n const accent = tryParseColor(draft.accent) ? draft.accent : draft.base.brand.primary;\n const scheme: G9ColorScheme = draft.scheme ?? (draft.base.mode === 'dark' ? 'dark' : 'light');\n let overrides: G9ThemeDefinition['overrides'];\n if (draft.surfaces !== 'neutral') {\n const tint = draft.surfaces === 'tinted' ? accent : TINTS[draft.surfaces];\n const of = (s: G9ColorScheme) => {\n const o: Partial<Record<G9ColorToken, string>> = {};\n for (const [token, d, l] of SURFACES) o[token] = mixOklch(palettes[s][token], tint, s === 'dark' ? d : l);\n return o;\n };\n overrides = { light: of('light'), dark: of('dark') };\n }\n const name = draft.name.trim().slice(0, 60);\n return Object.freeze({\n id: draft.id,\n name: name || draft.base.name,\n source: 'personal' as const,\n recipe: draft.base.recipe,\n brand: { ...draft.base.brand, primary: accent },\n ...(overrides ? { overrides } : {}),\n ...(draft.base.shape ? { shape: draft.base.shape } : {}),\n mode: scheme,\n ...(draft.wallpaper !== 'theme' ? { wallpaper: draft.wallpaper } : {}),\n });\n}\n\n/** A file name for a theme export (letters, digits, dashes; any script). */\nexport function g9ThemeFileName(name: string): string {\n const slug = name\n .trim()\n .toLowerCase()\n .replace(/[\\s!-/:-@[-`{-~،؛؟«»]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 40);\n return `${slug || 'theme'}.g9theme.json`;\n}\n\n// ------------------------------------------------------------------------------------------------ wallpapers\n\n/** A chat wallpaper: layers drawn behind a thread, from the palette so it follows the theme and accent. */\nexport interface G9Wallpaper {\n readonly id: string;\n readonly name: Readonly<Record<string, string>>;\n /** The background for a palette and scheme: a colour and optional gradient layers (Lynx `background-image`). */\n paint(palette: G9PaletteValues, scheme: G9ColorScheme): { readonly color: string; readonly image?: string };\n}\n\nconst glow = (c: string, a: number) => css(withAlpha(c, a));\n\n/** Wallpapers drawn with gradients only (no pictures, no network). */\nexport const g9Wallpapers: readonly G9Wallpaper[] = Object.freeze([\n { id: 'none', name: { en: 'None', fa: 'هیچ' }, paint: (p) => ({ color: p.Background }) },\n {\n id: 'aurora',\n name: { en: 'Aurora', fa: 'شفق' },\n paint: (p, s) => ({\n color: p.Background,\n image: `radial-gradient(circle at 0% 0%, ${glow(p.Primary, s === 'dark' ? 0.18 : 0.12)} 0%, transparent 60%), radial-gradient(circle at 100% 100%, ${glow(p.Tertiary, s === 'dark' ? 0.16 : 0.1)} 0%, transparent 60%)`,\n }),\n },\n {\n id: 'dusk',\n name: { en: 'Dusk', fa: 'غروب' },\n paint: (p, s) => ({\n color: p.Background,\n image: `linear-gradient(180deg, ${glow(p.Primary, s === 'dark' ? 0.12 : 0.08)} 0%, transparent 45%, ${glow(p.Secondary, s === 'dark' ? 0.1 : 0.06)} 100%)`,\n }),\n },\n {\n id: 'mesh',\n name: { en: 'Mesh', fa: 'توری' },\n paint: (p, s) => {\n const k = s === 'dark' ? 1 : 0.75;\n return {\n color: p.Background,\n image: [\n `radial-gradient(circle at 15% 20%, ${glow(p.Primary, 0.14 * k)} 0%, transparent 55%)`,\n `radial-gradient(circle at 85% 30%, ${glow(p.Tertiary, 0.14 * k)} 0%, transparent 55%)`,\n `radial-gradient(circle at 50% 95%, ${glow(p.Secondary, 0.14 * k)} 0%, transparent 55%)`,\n ].join(', '),\n };\n },\n },\n {\n id: 'paper',\n name: { en: 'Paper', fa: 'کاغذی' },\n paint: (p, s) => ({ color: mixOklch(p.Background, s === 'dark' ? '#000000' : '#f5ecd7', 0.25) }),\n },\n] satisfies G9Wallpaper[]);\n\n/** A wallpaper by id (from `list`, default {@link g9Wallpapers}), or null. */\nexport function g9Wallpaper(id: string, list: readonly G9Wallpaper[] = g9Wallpapers): G9Wallpaper | null {\n return list.find((w) => w.id === id) ?? null;\n}\n"],"names":["g9AppTokenNames","css","c","formatColor","g9AppTokens","theme","options","_p_InputBackground","_options_overrides","p","dark","accent","tryParseColor","own","onAccent","readableOn","surface","field","out","withAlpha","mixOklch","ensureContrast","name","value","Object","g9AppTokenVariables","prefix","MAX_VALUE","g9SanitizeTokens","input","allowed","known","Set","result","rawName","rawValue","_value_match","urls","url","g9DefaultAppearance","SCALES","EFFECTS","DENSITIES","g9NormalizeAppearance","raw","defaults","r","text","v","d","pick","list","undefined","g9FontScaleFactors","g9ScaledType","scale","base","g9DefaultShape","k","role","t","Math","g9EffectsEnabled","mode","device","g9ActiveThemeId","settings","systemScheme","g9ThemeFromInput","source","def","importTheme","JSON","createG9ThemeRegistry","_options_builtins","_options_maxPersonal","_options_personal","builtins","g9BuiltInThemes","max","org","personal","listeners","snapshot","rebuild","l","find","id","_snapshot_themes_find","listener","_find","inputs","i","g9NewPersonalThemeId","random","g9PersonalDraft","_base_wallpaper","toHex","TINTS","SURFACES","g9BuildPersonalTheme","draft","palettes","_draft_scheme","scheme","overrides","tint","of","s","o","token","g9ThemeFileName","slug","glow","a","g9Wallpapers","g9Wallpaper","_list_find","w"],"mappings":";;;;AAiBO,MAAMA,kBAAkB;IAC7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAaD,MAAMC,MAAM,CAACC,IAAyCC,YAAYD;AAG3D,SAASE,YACdC,KAA4E,EAC5EC,UAA6B,CAAC,CAAC;QAQjBC,oBA0B6BC;IAhC3C,MAAMC,IAAIJ,MAAM,OAAO;IACvB,MAAMK,OAAOL,AAAiB,WAAjBA,MAAM,MAAM;IACzB,MAAMM,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
1
1
|
export { aliasCssVariables, aliasPalette, type G9TokenAliasMap, g9AliasPresets } from './aliases.js';
|
|
2
2
|
export { applyThemeDefinition, exportTheme, type G9ThemeDefinition, type G9ThemeSource, g9AccentPresets, g9BuiltInThemes, importTheme, overriddenTokens, previewThemeDefinition, themeName, } from './appearance.js';
|
|
3
|
+
export { createG9ThemeRegistry, type G9AppearanceSettings, type G9AppTokenName, type G9AppTokenOptions, type G9EffectsMode, type G9FontScale, type G9PersonalThemeDraft, type G9SurfaceTone, type G9ThemeRegistry, type G9ThemeRegistryOptions, type G9ThemeRegistrySnapshot, type G9Wallpaper, g9ActiveThemeId, g9AppTokenNames, g9AppTokens, g9AppTokenVariables, g9BuildPersonalTheme, g9DefaultAppearance, g9EffectsEnabled, g9FontScaleFactors, g9NewPersonalThemeId, g9NormalizeAppearance, g9PersonalDraft, g9SanitizeTokens, g9ScaledType, g9ThemeFileName, g9ThemeFromInput, g9Wallpaper, g9Wallpapers, } from './appearance-kit.js';
|
|
3
4
|
export { createBrandPalette, createBrandPalettes, type G9BrandColors, type G9BrandPaletteOptions } from './brand.js';
|
|
4
5
|
export { applyAlpha, createBorderColor, createHoverColor, createPressedColor, darken, formatColor, type G9Color, G9ColorFormatError, type G9ColorInput, type G9Rgba, getContrastingTextColor, getContrastRatio, getLuminance, lighten, meetsWcagAA, meetsWcagAAA, mix, parseColor, parseMauiColor, rgba, toHex, toRgba, tryParseColor, withAlpha, withOpacity, } from './color.js';
|
|
5
6
|
export { contrastFailures, contrastReport, type G9ContrastResult, type G9ContrastRule, g9ContrastRules, } from './contrast.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,KAAK,iBAAiB,E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Y,EACZ,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,WAAW,EACX,cAAc,EACd,KAAK,aAAa,EAClB,SAAS,EACT,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,SAAS,EACT,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3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,OAAO,EACL,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,KAAK,uBAAuB,EAC5B,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,WAAW,EACX,cAAc,EACd,KAAK,aAAa,EAClB,SAAS,EACT,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,SAAS,EACT,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
|
package/dist/theme/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { aliasCssVariables, aliasPalette, g9AliasPresets } from "./aliases.js";
|
|
2
2
|
export { applyThemeDefinition, exportTheme, g9AccentPresets, g9BuiltInThemes, importTheme, overriddenTokens, previewThemeDefinition, themeName } from "./appearance.js";
|
|
3
|
+
export { createG9ThemeRegistry, g9ActiveThemeId, g9AppTokenNames, g9AppTokenVariables, g9AppTokens, g9BuildPersonalTheme, g9DefaultAppearance, g9EffectsEnabled, g9FontScaleFactors, g9NewPersonalThemeId, g9NormalizeAppearance, g9PersonalDraft, g9SanitizeTokens, g9ScaledType, g9ThemeFileName, g9ThemeFromInput, g9Wallpaper, g9Wallpapers } from "./appearance-kit.js";
|
|
3
4
|
export { createBrandPalette, createBrandPalettes } from "./brand.js";
|
|
4
5
|
export { G9ColorFormatError, applyAlpha, createBorderColor, createHoverColor, createPressedColor, darken, formatColor, getContrastRatio, getContrastingTextColor, getLuminance, lighten, meetsWcagAA, meetsWcagAAA, mix, parseColor, parseMauiColor, rgba, toHex, toRgba, tryParseColor, withAlpha, withOpacity } from "./color.js";
|
|
5
6
|
export { contrastFailures, contrastReport, g9ContrastRules } from "./contrast.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../../src/theme/recipe.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,KAAK,aAAa,EAA4C,MAAM,SAAS,CAAC;AAEvF,sBAAsB;AACtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,2CAA2C;IAC3C,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,eAAe,CAAC;IACtE,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,4FAA4F;IAC5F,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;C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AAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAGnD;IAAE,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAChF;AAED,gEAAgE;AAChE,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,qBAAqB,EAC9B,KAAK,GAAE,OAAO,CAAC,aAAa,CAAM,GACjC,aAAa,CAEf;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,EACnF,OAAO,GAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,CAAM,GACrF,aAAa,CAkBf"}
|
package/dist/theme/recipe.js
CHANGED
|
@@ -3,15 +3,23 @@ import { createBrandPalette } from "./brand.js";
|
|
|
3
3
|
import { oklchToHex, toOklch } from "./oklch.js";
|
|
4
4
|
import { lazyPalettes, stockPalette, trustPalette } from "./theme.js";
|
|
5
5
|
const registry = new Map();
|
|
6
|
+
const shared = globalThis;
|
|
7
|
+
if (!shared.__g9RecipeRegistries) shared.__g9RecipeRegistries = [];
|
|
8
|
+
const copies = shared.__g9RecipeRegistries;
|
|
9
|
+
copies.push(registry);
|
|
6
10
|
function registerRecipe(recipe) {
|
|
7
11
|
if (!recipe.name) throw new G9Error('theme-recipe-name', 'A recipe needs a name.');
|
|
8
12
|
registry.set(recipe.name, recipe);
|
|
9
13
|
}
|
|
10
14
|
function getRecipe(name) {
|
|
11
15
|
const recipe = registry.get(name);
|
|
12
|
-
if (!recipe)
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
if (!recipe) {
|
|
17
|
+
const elsewhere = copies.some((other)=>other !== registry && other.has(name));
|
|
18
|
+
const hint = elsewhere ? ` It is registered in ANOTHER copy of @g9tm/lynxcontrols-foundation: ${copies.length} copies are loaded, because a package pins a different version of the family and npm nested one. Give every @g9tm/lynxcontrols* dependency the same version.` : copies.length > 1 ? ` Note: ${copies.length} copies of @g9tm/lynxcontrols-foundation are loaded (a package pins a different version); a recipe registered in one is unknown to the others.` : '';
|
|
19
|
+
throw new G9Error('theme-unknown-recipe', `No theme recipe "${name}". Known: ${[
|
|
20
|
+
...registry.keys()
|
|
21
|
+
].join(', ')}.${hint}`);
|
|
22
|
+
}
|
|
15
23
|
return recipe;
|
|
16
24
|
}
|
|
17
25
|
const listRecipes = ()=>[
|
package/dist/theme/recipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme/recipe.js","sources":["../../src/theme/recipe.ts"],"sourcesContent":["// Theme recipes: named ways of turning a brand into palettes (and optionally a shape). The library ships a few; an app\n// registers its own (ShopManager's store templates `tazeh`, `gozar`, `abgineh`…, G9Hub's built-in themes) and then\n// every control follows the chosen recipe through the theme store. A recipe is pure data → palette, so it also runs on\n// a server or in the Svelte web app (foundation has no Lynx dependency).\nimport { G9Error } from '../errors';\nimport type { G9ColorToken, G9PaletteValues } from '../tokens/generated/palettes';\nimport type { G9ShapeSet } from '../tokens/shape';\nimport { createBrandPalette, type G9BrandColors, type G9BrandPaletteOptions } from './brand';\nimport { oklchToHex, toOklch } from './oklch';\nimport type { G9PaletteOverrides } from './theme';\nimport { type G9ColorScheme, lazyPalettes, stockPalette, trustPalette } from './theme';\n\n/** A named recipe. */\nexport interface G9ThemeRecipe {\n readonly name: string;\n /** Human name per language (`{ fa: 'تازه', en: 'Fresh' }`). */\n readonly title?: Readonly<Record<string, string>>;\n /** The palette of `scheme` for `brand`. */\n palette(brand: G9BrandColors, scheme: G9ColorScheme): G9PaletteValues;\n /** The recipe's shape (radii, type roles, control heights); default: the library's. */\n readonly shape?: Partial<G9ShapeSet>;\n /** The scheme the recipe looks best in when the user has not chosen (`'light'` default). */\n readonly defaultScheme?: G9ColorScheme;\n}\n\nconst registry = new Map<string, G9ThemeRecipe>();\n\n/** Adds or replaces a recipe. */\nexport function registerRecipe(recipe: G9ThemeRecipe): void {\n if (!recipe.name) throw new G9Error('theme-recipe-name', 'A recipe needs a name.');\n registry.set(recipe.name, recipe);\n}\n\n/** The recipe called `name`. @throws {G9Error} `theme-unknown-recipe`. */\nexport function getRecipe(name: string): G9ThemeRecipe {\n const recipe = registry.get(name);\n if (!recipe) {\n throw new G9Error('theme-unknown-recipe', `No theme recipe \"${name}\". Known: ${[...registry.keys()].join(', ')}.`);\n }\n return recipe;\n}\n\n/** Every registered recipe, in registration order. */\nexport const listRecipes = (): readonly G9ThemeRecipe[] => [...registry.values()];\n\n// The palettes recipes made, by recipe, scheme and brand: switching back to a theme costs nothing.\nconst MADE = new Map<string, G9PaletteValues>();\nconst MADE_LIMIT = 24;\n\n/** One scheme of a recipe for a brand (cached). */\nexport function recipePalette(name: string, brand: G9BrandColors, scheme: G9ColorScheme): G9PaletteValues {\n const recipe = getRecipe(name);\n const key = `${name}|${scheme}|${JSON.stringify(brand)}`;\n const hit = MADE.get(key);\n if (hit) {\n // most recently used last\n MADE.delete(key);\n MADE.set(key, hit);\n return hit;\n }\n const made = recipe.palette(brand, scheme);\n const p = trustPalette(Object.isFrozen(made) ? made : Object.freeze({ ...made }));\n MADE.set(key, p);\n if (MADE.size > MADE_LIMIT) MADE.delete(MADE.keys().next().value as string);\n return p;\n}\n\n/**\n * The palettes a recipe makes for a brand, both schemes (a theme store's `palettes` option): each scheme is built when\n * first read and cached, so the store only builds the one it paints.\n */\nexport function recipePalettes(name: string, brand: G9BrandColors) {\n getRecipe(name);\n const p = lazyPalettes((scheme) => recipePalette(name, brand, scheme));\n return p as { readonly light: G9PaletteValues; readonly dark: G9PaletteValues };\n}\n\n/** A recipe built on the brand generator with fixed options. */\nexport function brandRecipe(\n name: string,\n options: G9BrandPaletteOptions,\n extra: Partial<G9ThemeRecipe> = {},\n): G9ThemeRecipe {\n return { name, ...extra, palette: (brand, scheme) => createBrandPalette(brand, scheme, options) };\n}\n\n/**\n * A designer's recipe: hand-picked tokens per scheme over a generated base (ShopManager's `designedRecipe`). Tokens not\n * listed come from the brand generator, so a designed theme stays complete when the token set grows.\n */\nexport function designedRecipe(\n name: string,\n designed: { readonly light: G9PaletteOverrides; readonly dark: G9PaletteOverrides },\n options: G9BrandPaletteOptions & Partial<Omit<G9ThemeRecipe, 'name' | 'palette'>> = {},\n): G9ThemeRecipe {\n const { tint, contrast, keepBrand, ...extra } = options;\n const brandOptions: G9BrandPaletteOptions = {\n ...(tint !== undefined ? { tint } : {}),\n ...(contrast !== undefined ? { contrast } : {}),\n ...(keepBrand !== undefined ? { keepBrand } : {}),\n };\n return {\n name,\n ...extra,\n palette(brand, scheme) {\n const base = createBrandPalette(brand, scheme, brandOptions);\n const over = designed[scheme];\n const next: Record<string, string> = { ...base };\n for (const [token, value] of Object.entries(over)) if (value !== undefined) next[token as G9ColorToken] = value;\n return Object.freeze(next) as unknown as G9PaletteValues;\n },\n };\n}\n\n// ---- built-in recipes -------------------------------------------------------------------------------------------------\n\n/** The stock MAUI palettes, whatever the brand (the 1.x look). */\nregisterRecipe({ name: 'stock', title: { en: 'Stock', fa: 'پیشفرض' }, palette: (_b, scheme) => stockPalette(scheme) });\n/** The brand generator with balanced greys. */\nregisterRecipe(brandRecipe('tonal', { tint: 0.35 }, { title: { en: 'Tonal', fa: 'همرنگ' } }));\n/** Pure greys, the brand only where it acts (a calm, editorial look). */\nregisterRecipe(brandRecipe('neutral', { tint: 0 }, { title: { en: 'Neutral', fa: 'خنثی' } }));\n/** Surfaces washed in the brand hue (a playful, branded look). */\nregisterRecipe(brandRecipe('tinted', { tint: 1 }, { title: { en: 'Tinted', fa: 'رنگین' } }));\n/** AAA contrast everywhere (accessibility first). */\nregisterRecipe(\n brandRecipe(\n 'contrast',\n { tint: 0.2, contrast: 'AAA', keepBrand: false },\n { title: { en: 'High contrast', fa: 'کنتراست بالا' } },\n ),\n);\n/** A dark-first look: deep brand-tinted surfaces, brand fills lightened (Riskara's \"mission control\"). */\nregisterRecipe({\n name: 'midnight',\n title: { en: 'Midnight', fa: 'نیمهشب' },\n defaultScheme: 'dark',\n palette(brand, scheme) {\n const base = createBrandPalette(brand, scheme, { tint: 1 });\n if (scheme === 'light') return base;\n const { h } = toOklch(brand.primary);\n const deep = (l: number) => oklchToHex({ l, c: 0.035, h });\n return Object.freeze({\n ...base,\n Background: deep(0.14),\n SurfaceContainerLowest: deep(0.12),\n SurfaceDim: deep(0.14),\n Surface: deep(0.19),\n CardBackground: deep(0.19),\n InputBackground: deep(0.19),\n SurfaceContainerLow: deep(0.21),\n SurfaceContainer: deep(0.23),\n SurfaceVariant: deep(0.25),\n SurfaceContainerHigh: deep(0.27),\n SurfaceContainerHighest: deep(0.3),\n }) as G9PaletteValues;\n },\n});\n"],"names":["registry","Map","registerRecipe","recipe","G9Error","getRecipe","name","listRecipes","MADE","MADE_LIMIT","recipePalette","brand","scheme","key","JSON","hit","made","p","trustPalette","Object","recipePalettes","lazyPalettes","brandRecipe","options","extra","createBrandPalette","designedRecipe","designed","tint","contrast","keepBrand","brandOptions","undefined","base","over","next","token","value","_b","stockPalette","h","toOklch","deep","l","oklchToHex"],"mappings":";;;;AAyBA,MAAMA,WAAW,IAAIC;AAGd,SAASC,eAAeC,MAAqB;IAClD,IAAI,CAACA,OAAO,IAAI,EAAE,MAAM,IAAIC,QAAQ,qBAAqB;IACzDJ,SAAS,GAAG,CAACG,OAAO,IAAI,EAAEA;AAC5B;AAGO,SAASE,UAAUC,IAAY;IACpC,MAAMH,SAASH,SAAS,GAAG,CAACM;IAC5B,IAAI,CAACH,QACH,MAAM,IAAIC,QAAQ,wBAAwB,CAAC,iBAAiB,EAAEE,KAAK,UAAU,EAAE;WAAIN,SAAS,IAAI;KAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEnH,OAAOG;AACT;AAGO,MAAMI,cAAc,IAAgC;WAA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QACzD,IAAIA,AAAW,YAAXA,QAAoB,OAAOqB;QAC/B,MAAM,EAAEO,CAAC,EAAE,GAAGC,QAAQ9B,MAAM,OAAO;QACnC,MAAM+B,OAAO,CAACC,IAAcC,WAAW;gBAAED;gBAAG,GAAG;gBAAOH;YAAE;QACxD,OAAOrB,OAAO,MAAM,CAAC;YACnB,GAAGc,IAAI;YACP,YAAYS,KAAK;YACjB,wBAAwBA,KAAK;YAC7B,YAAYA,KAAK;YACjB,SAASA,KAAK;YACd,gBAAgBA,KAAK;YACrB,iBAAiBA,KAAK;YACtB,qBAAqBA,KAAK;YAC1B,kBAAkBA,KAAK;YACvB,gBAAgBA,KAAK;YACrB,sBAAsBA,KAAK;YAC3B,yBAAyBA,KAAK;QAChC;IACF;AACF"}
|
|
1
|
+
{"version":3,"file":"theme/recipe.js","sources":["../../src/theme/recipe.ts"],"sourcesContent":["// Theme recipes: named ways of turning a brand into palettes (and optionally a shape). The library ships a few; an app\n// registers its own (ShopManager's store templates `tazeh`, `gozar`, `abgineh`…, G9Hub's built-in themes) and then\n// every control follows the chosen recipe through the theme store. A recipe is pure data → palette, so it also runs on\n// a server or in the Svelte web app (foundation has no Lynx dependency).\nimport { G9Error } from '../errors';\nimport type { G9ColorToken, G9PaletteValues } from '../tokens/generated/palettes';\nimport type { G9ShapeSet } from '../tokens/shape';\nimport { createBrandPalette, type G9BrandColors, type G9BrandPaletteOptions } from './brand';\nimport { oklchToHex, toOklch } from './oklch';\nimport type { G9PaletteOverrides } from './theme';\nimport { type G9ColorScheme, lazyPalettes, stockPalette, trustPalette } from './theme';\n\n/** A named recipe. */\nexport interface G9ThemeRecipe {\n readonly name: string;\n /** Human name per language (`{ fa: 'تازه', en: 'Fresh' }`). */\n readonly title?: Readonly<Record<string, string>>;\n /** The palette of `scheme` for `brand`. */\n palette(brand: G9BrandColors, scheme: G9ColorScheme): G9PaletteValues;\n /** The recipe's shape (radii, type roles, control heights); default: the library's. */\n readonly shape?: Partial<G9ShapeSet>;\n /** The scheme the recipe looks best in when the user has not chosen (`'light'` default). */\n readonly defaultScheme?: G9ColorScheme;\n}\n\nconst registry = new Map<string, G9ThemeRecipe>();\n\n// Every copy of this module in the process (2.5.9): a package that pins another version of the family makes npm nest a\n// second foundation, and a recipe registered in one copy is unknown to the other (ShopManager's apps opened blank with\n// `No theme recipe \"berjis\"`). The registries are shared through a global list so the error can say so.\nconst shared = globalThis as { __g9RecipeRegistries?: Map<string, G9ThemeRecipe>[] };\nif (!shared.__g9RecipeRegistries) shared.__g9RecipeRegistries = [];\nconst copies = shared.__g9RecipeRegistries;\ncopies.push(registry);\n\n/** Adds or replaces a recipe. */\nexport function registerRecipe(recipe: G9ThemeRecipe): void {\n if (!recipe.name) throw new G9Error('theme-recipe-name', 'A recipe needs a name.');\n registry.set(recipe.name, recipe);\n}\n\n/** The recipe called `name`. @throws {G9Error} `theme-unknown-recipe`. */\nexport function getRecipe(name: string): G9ThemeRecipe {\n const recipe = registry.get(name);\n if (!recipe) {\n const elsewhere = copies.some((other) => other !== registry && other.has(name));\n const hint = elsewhere\n ? ` It is registered in ANOTHER copy of @g9tm/lynxcontrols-foundation: ${copies.length} copies are loaded, because a package pins a different version of the family and npm nested one. Give every @g9tm/lynxcontrols* dependency the same version.`\n : copies.length > 1\n ? ` Note: ${copies.length} copies of @g9tm/lynxcontrols-foundation are loaded (a package pins a different version); a recipe registered in one is unknown to the others.`\n : '';\n throw new G9Error(\n 'theme-unknown-recipe',\n `No theme recipe \"${name}\". Known: ${[...registry.keys()].join(', ')}.${hint}`,\n );\n }\n return recipe;\n}\n\n/** Every registered recipe, in registration order. */\nexport const listRecipes = (): readonly G9ThemeRecipe[] => [...registry.values()];\n\n// The palettes recipes made, by recipe, scheme and brand: switching back to a theme costs nothing.\nconst MADE = new Map<string, G9PaletteValues>();\nconst MADE_LIMIT = 24;\n\n/** One scheme of a recipe for a brand (cached). */\nexport function recipePalette(name: string, brand: G9BrandColors, scheme: G9ColorScheme): G9PaletteValues {\n const recipe = getRecipe(name);\n const key = `${name}|${scheme}|${JSON.stringify(brand)}`;\n const hit = MADE.get(key);\n if (hit) {\n // most recently used last\n MADE.delete(key);\n MADE.set(key, hit);\n return hit;\n }\n const made = recipe.palette(brand, scheme);\n const p = trustPalette(Object.isFrozen(made) ? made : Object.freeze({ ...made }));\n MADE.set(key, p);\n if (MADE.size > MADE_LIMIT) MADE.delete(MADE.keys().next().value as string);\n return p;\n}\n\n/**\n * The palettes a recipe makes for a brand, both schemes (a theme store's `palettes` option): each scheme is built when\n * first read and cached, so the store only builds the one it paints.\n */\nexport function recipePalettes(name: string, brand: G9BrandColors) {\n getRecipe(name);\n const p = lazyPalettes((scheme) => recipePalette(name, brand, scheme));\n return p as { readonly light: G9PaletteValues; readonly dark: G9PaletteValues };\n}\n\n/** A recipe built on the brand generator with fixed options. */\nexport function brandRecipe(\n name: string,\n options: G9BrandPaletteOptions,\n extra: Partial<G9ThemeRecipe> = {},\n): G9ThemeRecipe {\n return { name, ...extra, palette: (brand, scheme) => createBrandPalette(brand, scheme, options) };\n}\n\n/**\n * A designer's recipe: hand-picked tokens per scheme over a generated base (ShopManager's `designedRecipe`). Tokens not\n * listed come from the brand generator, so a designed theme stays complete when the token set grows.\n */\nexport function designedRecipe(\n name: string,\n designed: { readonly light: G9PaletteOverrides; readonly dark: G9PaletteOverrides },\n options: G9BrandPaletteOptions & Partial<Omit<G9ThemeRecipe, 'name' | 'palette'>> = {},\n): G9ThemeRecipe {\n const { tint, contrast, keepBrand, ...extra } = options;\n const brandOptions: G9BrandPaletteOptions = {\n ...(tint !== undefined ? { tint } : {}),\n ...(contrast !== undefined ? { contrast } : {}),\n ...(keepBrand !== undefined ? { keepBrand } : {}),\n };\n return {\n name,\n ...extra,\n palette(brand, scheme) {\n const base = createBrandPalette(brand, scheme, brandOptions);\n const over = designed[scheme];\n const next: Record<string, string> = { ...base };\n for (const [token, value] of Object.entries(over)) if (value !== undefined) next[token as G9ColorToken] = value;\n return Object.freeze(next) as unknown as G9PaletteValues;\n },\n };\n}\n\n// ---- built-in recipes -------------------------------------------------------------------------------------------------\n\n/** The stock MAUI palettes, whatever the brand (the 1.x look). */\nregisterRecipe({ name: 'stock', title: { en: 'Stock', fa: 'پیشفرض' }, palette: (_b, scheme) => stockPalette(scheme) });\n/** The brand generator with balanced greys. */\nregisterRecipe(brandRecipe('tonal', { tint: 0.35 }, { title: { en: 'Tonal', fa: 'همرنگ' } }));\n/** Pure greys, the brand only where it acts (a calm, editorial look). */\nregisterRecipe(brandRecipe('neutral', { tint: 0 }, { title: { en: 'Neutral', fa: 'خنثی' } }));\n/** Surfaces washed in the brand hue (a playful, branded look). */\nregisterRecipe(brandRecipe('tinted', { tint: 1 }, { title: { en: 'Tinted', fa: 'رنگین' } }));\n/** AAA contrast everywhere (accessibility first). */\nregisterRecipe(\n brandRecipe(\n 'contrast',\n { tint: 0.2, contrast: 'AAA', keepBrand: false },\n { title: { en: 'High contrast', fa: 'کنتراست بالا' } },\n ),\n);\n/** A dark-first look: deep brand-tinted surfaces, brand fills lightened (Riskara's \"mission control\"). */\nregisterRecipe({\n name: 'midnight',\n title: { en: 'Midnight', fa: 'نیمهشب' },\n defaultScheme: 'dark',\n palette(brand, scheme) {\n const base = createBrandPalette(brand, scheme, { tint: 1 });\n if (scheme === 'light') return base;\n const { h } = toOklch(brand.primary);\n const deep = (l: number) => oklchToHex({ l, c: 0.035, h });\n return Object.freeze({\n ...base,\n Background: deep(0.14),\n SurfaceContainerLowest: deep(0.12),\n SurfaceDim: deep(0.14),\n Surface: deep(0.19),\n CardBackground: deep(0.19),\n InputBackground: deep(0.19),\n SurfaceContainerLow: deep(0.21),\n SurfaceContainer: deep(0.23),\n SurfaceVariant: deep(0.25),\n SurfaceContainerHigh: deep(0.27),\n SurfaceContainerHighest: deep(0.3),\n }) as G9PaletteValues;\n },\n});\n"],"names":["registry","Map","shared","globalThis","copies","registerRecipe","recipe","G9Error","getRecipe","name","elsewhere","other","hint","listRecipes","MADE","MADE_LIMIT","recipePalette","brand","scheme","key","JSON","hit","made","p","trustPalette","Object","recipePalettes","lazyPalettes","brandRecipe","options","extra","createBrandPalette","designedRecipe","designed","tint","contrast","keepBrand","brandOptions","undefined","base","over","next","token","value","_b","stockPalette","h","toOklch","deep","l","oklchToHex"],"mappings":";;;;AAyBA,MAAMA,WAAW,IAAIC;AAKrB,MAAMC,SAASC;AACf,IAAI,CAACD,OAAO,oBAAoB,EAAEA,OAAO,oBAAoB,GAAG,EAAE;AAClE,MAAME,SAASF,OAAO,oBAAoB;AAC1CE,OAAO,IAAI,CAACJ;AAGL,SAASK,eAAeC,MAAqB;IAClD,IAAI,CAACA,OAAO,IAAI,EAAE,MAAM,IAAIC,QAAQ,qBAAqB;IACzDP,SAAS,GAAG,CAACM,OAAO,IAAI,EAAEA;AAC5B;AAGO,SAASE,UAAUC,IAAY;IACpC,MAAMH,SAASN,SAAS,GAAG,CAACS;IAC5B,IAAI,CAACH,QAAQ;QACX,MAAMI,YAAYN,OAAO,IAAI,CAAC,CAACO,QAAUA,UAAUX,YAAYW,MAAM,GAAG,CAACF;QACzE,MAAMG,OAAOF,YACT,CAAC,oEAAoE,EAAEN,OAAO,MAAM,CAAC,4JAA4J,CAAC,GAClPA,OAAO,MAAM,GAAG,IACd,CAAC,OAAO,EAAEA,OAAO,MAAM,CAAC,8IAA8I,CAAC,GACvK;QACN,MAAM,IAAIG,QACR,wBACA,CAAC,iBAAiB,EAAEE,KAAK,UAAU,EAAE;eAAIT,SAAS,IAAI;SAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAEY,MAAM;IAElF;IACA,OAAON;AACT;AAGO,MAAMO,cAAc,IAAgC;WAAIb,SAAS,MAAM;KAAG;AAGjF,MAAMc,OAAO,IAAIb;AACjB,MAAMc,aAAa;AAGZ,SAASC,cAAcP,IAAY,EAAEQ,KAAoB,EAAEC,MAAqB;IACrF,MAAMZ,SAASE,UAAUC;IACzB,MAAMU,MAAM,GAAGV,KAAK,CAAC,EAAES,OAAO,C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