@snagtag/design-system 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3239 -0
- package/dist/index.d.cts +884 -0
- package/dist/index.d.ts +884 -0
- package/dist/index.js +3100 -0
- package/dist/manifest.json +9 -0
- package/package.json +31 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,884 @@
|
|
|
1
|
+
/** HSL colour representation. */
|
|
2
|
+
interface HSL {
|
|
3
|
+
/** Hue: 0-360 */
|
|
4
|
+
h: number;
|
|
5
|
+
/** Saturation: 0-100 */
|
|
6
|
+
s: number;
|
|
7
|
+
/** Lightness: 0-100 */
|
|
8
|
+
l: number;
|
|
9
|
+
}
|
|
10
|
+
/** Colour harmony types for palette suggestions. */
|
|
11
|
+
type HarmonyType = 'complementary' | 'analogous' | 'triadic' | 'split-complementary';
|
|
12
|
+
/** A suggested colour palette based on colour theory. */
|
|
13
|
+
interface ColourSuggestion {
|
|
14
|
+
type: HarmonyType;
|
|
15
|
+
colours: string[];
|
|
16
|
+
label: string;
|
|
17
|
+
description: string;
|
|
18
|
+
contrastScore: number;
|
|
19
|
+
}
|
|
20
|
+
/** A saved theme preset (built-in). */
|
|
21
|
+
interface ThemePreset$1 {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
values: Record<string, string>;
|
|
25
|
+
builtIn: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** A user-created custom preset. */
|
|
28
|
+
interface CustomPreset {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
values: Record<string, string>;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
|
+
/** A snapshot of theme values at a point in time. */
|
|
36
|
+
interface ThemeVersion {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string | null;
|
|
39
|
+
current: Record<string, string>;
|
|
40
|
+
previous: Record<string, string>;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
}
|
|
43
|
+
/** Full theme export payload. */
|
|
44
|
+
interface ThemeSnapshot$1 {
|
|
45
|
+
name: string;
|
|
46
|
+
version: string;
|
|
47
|
+
values: Record<string, string>;
|
|
48
|
+
exportedAt: string;
|
|
49
|
+
}
|
|
50
|
+
/** Theme export with metadata. */
|
|
51
|
+
interface ThemeExport {
|
|
52
|
+
snapshot: ThemeSnapshot$1;
|
|
53
|
+
css: string;
|
|
54
|
+
json: string;
|
|
55
|
+
}
|
|
56
|
+
/** WCAG contrast quality breakdown. */
|
|
57
|
+
interface QualityBreakdown$2 {
|
|
58
|
+
score: number;
|
|
59
|
+
maxScore: number;
|
|
60
|
+
label: string;
|
|
61
|
+
}
|
|
62
|
+
/** A WCAG contrast issue between two theme tokens. */
|
|
63
|
+
interface ContrastIssue$2 {
|
|
64
|
+
fgKey: string;
|
|
65
|
+
bgKey: string;
|
|
66
|
+
fgValue: string;
|
|
67
|
+
bgValue: string;
|
|
68
|
+
ratio: number;
|
|
69
|
+
required: number;
|
|
70
|
+
level: 'AA' | 'AAA';
|
|
71
|
+
}
|
|
72
|
+
/** Immutable state for the theme editor with undo/redo support. */
|
|
73
|
+
interface ThemeEditorState {
|
|
74
|
+
current: Record<string, string>;
|
|
75
|
+
saved: Record<string, string>;
|
|
76
|
+
undoStack: Record<string, string>[];
|
|
77
|
+
redoStack: Record<string, string>[];
|
|
78
|
+
isDirty: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** A group of related design tokens. */
|
|
81
|
+
interface TokenCategory$1 {
|
|
82
|
+
label: string;
|
|
83
|
+
keys: string[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface DesignSystemAdapter {
|
|
87
|
+
loadTheme(): Promise<Record<string, string>>;
|
|
88
|
+
saveTheme(overrides: Record<string, string>): Promise<void>;
|
|
89
|
+
listPresets(): Promise<CustomPreset[]>;
|
|
90
|
+
savePreset(name: string, values: Record<string, string>): Promise<CustomPreset>;
|
|
91
|
+
deletePreset(id: string): Promise<void>;
|
|
92
|
+
renamePreset(id: string, newName: string): Promise<void>;
|
|
93
|
+
duplicatePreset(id: string): Promise<CustomPreset>;
|
|
94
|
+
saveVersion(current: Record<string, string>, previous: Record<string, string>, label?: string): Promise<ThemeVersion>;
|
|
95
|
+
listVersions(): Promise<ThemeVersion[]>;
|
|
96
|
+
restoreVersion(versionId: string): Promise<Record<string, string>>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Colour utilities - pure functions for colour manipulation,
|
|
101
|
+
* contrast checking, and palette generation.
|
|
102
|
+
*
|
|
103
|
+
* Self-contained - no external dependencies.
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/** Lighten a hex colour by mixing with white. `amount` 0-1 (0=original, 1=white). */
|
|
107
|
+
declare function lighten(hex: string, amount: number): string;
|
|
108
|
+
/** Darken a hex colour by mixing with black. `amount` 0-1 (0=original, 1=black). */
|
|
109
|
+
declare function darken(hex: string, amount: number): string;
|
|
110
|
+
/** Relative luminance per WCAG 2.0 definition. */
|
|
111
|
+
declare function luminance(hex: string): number;
|
|
112
|
+
/** Returns true if the background is dark (text should be light). */
|
|
113
|
+
declare function isDark(hex: string): boolean;
|
|
114
|
+
/** WCAG AA contrast ratio between two hex colours. */
|
|
115
|
+
declare function contrastRatio(fg: string, bg: string): number;
|
|
116
|
+
/**
|
|
117
|
+
* Ensure a colour meets WCAG AA contrast (4.5:1) against white.
|
|
118
|
+
* If it doesn't, darken it incrementally until it does.
|
|
119
|
+
*/
|
|
120
|
+
declare function ensureContrastOnWhite(hex: string): string;
|
|
121
|
+
/** Convert a hex colour (#rrggbb) to HSL. */
|
|
122
|
+
declare function hexToHSL(hex: string): HSL;
|
|
123
|
+
/** Convert HSL back to hex. */
|
|
124
|
+
declare function hslToHex$1(hsl: HSL): string;
|
|
125
|
+
/** Rotate hue by a given number of degrees. */
|
|
126
|
+
declare function rotateHue(hsl: HSL, degrees: number): HSL;
|
|
127
|
+
/**
|
|
128
|
+
* Generate a full lightness scale (50-950) from a base colour,
|
|
129
|
+
* varying lightness while preserving hue and saturation.
|
|
130
|
+
*/
|
|
131
|
+
declare function generateScale(hex: string): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Given a primary hex colour, generate palette suggestions
|
|
134
|
+
* using four colour harmony rules.
|
|
135
|
+
*/
|
|
136
|
+
declare function suggestPalettes(primaryHex: string): ColourSuggestion[];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Theme defaults, CSS variable mappings, and token categories.
|
|
140
|
+
* These are the canonical defaults for the design system package.
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The hardcoded defaults matching a standard design system theme.
|
|
145
|
+
* These are the "factory" values used when no overrides are set.
|
|
146
|
+
*/
|
|
147
|
+
declare const THEME_DEFAULTS: Record<string, string>;
|
|
148
|
+
/**
|
|
149
|
+
* Maps theme JSON keys to the CSS custom properties they control.
|
|
150
|
+
*/
|
|
151
|
+
declare const THEME_KEY_TO_CSS: Record<string, string>;
|
|
152
|
+
/**
|
|
153
|
+
* Grouped theme categories for the editor UI.
|
|
154
|
+
* Each entry groups related theme keys for display in a settings panel.
|
|
155
|
+
*/
|
|
156
|
+
declare const THEME_CATEGORIES: TokenCategory$1[];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Theme Editor State - pure state management for the design system editor.
|
|
160
|
+
* Provides undo/redo, dirty detection, and immutable state transitions.
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
declare function createThemeEditorState(initial: Record<string, string>): ThemeEditorState;
|
|
164
|
+
declare function applyChange(state: ThemeEditorState, key: string, value: string): ThemeEditorState;
|
|
165
|
+
declare function applyBulkChange(state: ThemeEditorState, changes: Record<string, string>): ThemeEditorState;
|
|
166
|
+
declare function undo(state: ThemeEditorState): ThemeEditorState;
|
|
167
|
+
declare function redo(state: ThemeEditorState): ThemeEditorState;
|
|
168
|
+
declare function markSaved(state: ThemeEditorState): ThemeEditorState;
|
|
169
|
+
declare function resetToDefaults(state: ThemeEditorState, defaults: Record<string, string>): ThemeEditorState;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Token Registry - maps the three-tier token system.
|
|
173
|
+
*
|
|
174
|
+
* Primitive: raw values (brand-600 = #2563eb)
|
|
175
|
+
* Semantic: purpose-bound (btn-primary-bg = brand-600)
|
|
176
|
+
* Component: specific usage (a specific button instance's background)
|
|
177
|
+
*
|
|
178
|
+
* This registry is the source of truth for the inspector to trace
|
|
179
|
+
* any computed value back through the chain.
|
|
180
|
+
*/
|
|
181
|
+
interface TokenDefinition {
|
|
182
|
+
/** CSS custom property name (e.g. '--color-btn-primary-bg') */
|
|
183
|
+
cssVar: string;
|
|
184
|
+
/** Human-readable label */
|
|
185
|
+
label: string;
|
|
186
|
+
/** Token category */
|
|
187
|
+
category: 'colour' | 'typography' | 'spacing' | 'border' | 'shadow' | 'motion';
|
|
188
|
+
/** What CSS var it references (if any) - for chain tracing */
|
|
189
|
+
references?: string;
|
|
190
|
+
/** Which ThemeProvider key controls this (if themeable) */
|
|
191
|
+
themeKey?: string;
|
|
192
|
+
/** Default value (resolved) */
|
|
193
|
+
defaultValue: string;
|
|
194
|
+
}
|
|
195
|
+
interface TokenCategory {
|
|
196
|
+
label: string;
|
|
197
|
+
tokens: TokenDefinition[];
|
|
198
|
+
}
|
|
199
|
+
declare const TOKEN_REGISTRY: TokenCategory[];
|
|
200
|
+
/**
|
|
201
|
+
* Find a token by its CSS custom property name.
|
|
202
|
+
*/
|
|
203
|
+
declare function findToken(cssVar: string): TokenDefinition | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Get the full reference chain for a CSS var.
|
|
206
|
+
* Returns an array from the given token through to the final primitive.
|
|
207
|
+
* e.g. --color-btn-primary-bg -> --color-brand-600 -> (primitive, no further reference)
|
|
208
|
+
*/
|
|
209
|
+
declare function getTokenChain(cssVar: string): TokenDefinition[];
|
|
210
|
+
/**
|
|
211
|
+
* List all tokens that reference the given CSS var (reverse lookup).
|
|
212
|
+
*/
|
|
213
|
+
declare function getDependents(cssVar: string): TokenDefinition[];
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Colour blindness simulation - transforms hex colours to simulate
|
|
217
|
+
* how they appear under different types of colour vision deficiency.
|
|
218
|
+
*
|
|
219
|
+
* Uses Brettel/Vienot colour blindness simulation matrices.
|
|
220
|
+
* Pure functions, no side effects.
|
|
221
|
+
*/
|
|
222
|
+
type ColourBlindnessType = 'protanopia' | 'deuteranopia' | 'tritanopia' | 'achromatopsia';
|
|
223
|
+
interface ColourBlindnessInfo {
|
|
224
|
+
type: ColourBlindnessType;
|
|
225
|
+
label: string;
|
|
226
|
+
description: string;
|
|
227
|
+
prevalence: string;
|
|
228
|
+
}
|
|
229
|
+
declare const COLOUR_BLINDNESS_TYPES: ColourBlindnessInfo[];
|
|
230
|
+
/**
|
|
231
|
+
* Simulate how a hex colour appears under a specific colour blindness type.
|
|
232
|
+
*/
|
|
233
|
+
declare function simulateColourBlindness(hex: string, type: ColourBlindnessType): string;
|
|
234
|
+
/**
|
|
235
|
+
* Simulate colour blindness across a full theme's colour values.
|
|
236
|
+
* Returns a new Record with transformed values.
|
|
237
|
+
*/
|
|
238
|
+
declare function simulateThemeColourBlindness(theme: Record<string, string>, type: ColourBlindnessType): Record<string, string>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Theme Snapshots - auto-captured theme state for the time machine.
|
|
242
|
+
* Stored in localStorage per tenant. Capped at 50 snapshots.
|
|
243
|
+
*
|
|
244
|
+
* Snapshots are captured:
|
|
245
|
+
* 1. When the editor opens (opening snapshot - guaranteed restore point)
|
|
246
|
+
* 2. Every 5 minutes if changes have been made
|
|
247
|
+
* 3. On manual save
|
|
248
|
+
*/
|
|
249
|
+
interface ThemeSnapshot {
|
|
250
|
+
id: string;
|
|
251
|
+
timestamp: string;
|
|
252
|
+
label: 'opening' | 'auto' | 'save';
|
|
253
|
+
values: Record<string, string>;
|
|
254
|
+
changedKeysFromPrevious: number;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Check if two theme objects are identical.
|
|
258
|
+
*/
|
|
259
|
+
declare function themesAreEqual(a: Record<string, string>, b: Record<string, string>): boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Read all snapshots for a tenant from localStorage.
|
|
262
|
+
*/
|
|
263
|
+
declare function readSnapshots(tenantId: string): ThemeSnapshot[];
|
|
264
|
+
/**
|
|
265
|
+
* Capture a new snapshot. Returns the snapshot if captured,
|
|
266
|
+
* null if skipped (no changes since last snapshot).
|
|
267
|
+
*/
|
|
268
|
+
declare function captureSnapshot(tenantId: string, values: Record<string, string>, label: ThemeSnapshot['label']): ThemeSnapshot | null;
|
|
269
|
+
/**
|
|
270
|
+
* Get a specific snapshot by ID.
|
|
271
|
+
*/
|
|
272
|
+
declare function getSnapshot(tenantId: string, snapshotId: string): ThemeSnapshot | null;
|
|
273
|
+
/**
|
|
274
|
+
* Clear all snapshots for a tenant (e.g. on editor close).
|
|
275
|
+
*/
|
|
276
|
+
declare function clearSnapshots(tenantId: string): void;
|
|
277
|
+
/**
|
|
278
|
+
* Get the opening snapshot (first one with label 'opening').
|
|
279
|
+
*/
|
|
280
|
+
declare function getOpeningSnapshot(tenantId: string): ThemeSnapshot | null;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Font Pairing Recommender - curated list of web-safe font pairings
|
|
284
|
+
* with relevance scoring based on the current font selection.
|
|
285
|
+
*
|
|
286
|
+
* Pure functions, no side effects.
|
|
287
|
+
*/
|
|
288
|
+
interface FontPairing {
|
|
289
|
+
display: string;
|
|
290
|
+
body: string;
|
|
291
|
+
label: string;
|
|
292
|
+
description: string;
|
|
293
|
+
category: 'sans' | 'serif' | 'mixed';
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Curated web-safe font pairings. Uses system-available and widely
|
|
297
|
+
* supported fonts only - no external font service dependency.
|
|
298
|
+
*/
|
|
299
|
+
declare const FONT_PAIRINGS: FontPairing[];
|
|
300
|
+
/**
|
|
301
|
+
* Suggest font pairings sorted by relevance to the current font.
|
|
302
|
+
*/
|
|
303
|
+
declare function suggestPairings(currentFont: string): FontPairing[];
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Type Scale Generator - generates a harmonious set of font sizes
|
|
307
|
+
* from a base size and a ratio.
|
|
308
|
+
*
|
|
309
|
+
* Used by the design system manager to produce consistent typography
|
|
310
|
+
* tokens across the application.
|
|
311
|
+
*/
|
|
312
|
+
type ScaleRatio = 'minor-third' | 'major-third' | 'perfect-fourth' | 'augmented-fourth' | 'perfect-fifth' | 'golden-ratio';
|
|
313
|
+
declare const SCALE_RATIOS: Record<ScaleRatio, {
|
|
314
|
+
value: number;
|
|
315
|
+
label: string;
|
|
316
|
+
description: string;
|
|
317
|
+
}>;
|
|
318
|
+
interface TypeScaleLevel {
|
|
319
|
+
/** Semantic name, e.g. 'h1', 'body-md' */
|
|
320
|
+
name: string;
|
|
321
|
+
/** Size in pixels */
|
|
322
|
+
size: number;
|
|
323
|
+
/** Size as a rem string, e.g. '1.875rem' */
|
|
324
|
+
sizeRem: string;
|
|
325
|
+
/** Line-height ratio, e.g. 1.2 */
|
|
326
|
+
lineHeight: number;
|
|
327
|
+
/** Font weight, e.g. 700 */
|
|
328
|
+
weight: number;
|
|
329
|
+
}
|
|
330
|
+
interface TypeScale {
|
|
331
|
+
baseSizePx: number;
|
|
332
|
+
ratio: ScaleRatio;
|
|
333
|
+
levels: TypeScaleLevel[];
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Generate a type scale from a base size and ratio.
|
|
337
|
+
* Returns h1-h4, body-lg, body-md (base), body-sm, caption.
|
|
338
|
+
*/
|
|
339
|
+
declare function generateTypeScale(baseSizePx: number, ratio: ScaleRatio): TypeScale;
|
|
340
|
+
/**
|
|
341
|
+
* Convert a type scale to CSS custom properties suitable for injection into @theme.
|
|
342
|
+
* Returns a record like { '--font-size-h1': '2.441rem', '--line-height-h1': '1.15', ... }
|
|
343
|
+
*/
|
|
344
|
+
declare function typeScaleToCSSVars(scale: TypeScale): Record<string, string>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Bezier Utilities - parse, format, sample, and manipulate cubic-bezier values.
|
|
348
|
+
*/
|
|
349
|
+
/**
|
|
350
|
+
* Parse a CSS cubic-bezier string into its four control values.
|
|
351
|
+
* Accepts formats: "cubic-bezier(x1, y1, x2, y2)" or just "x1, y1, x2, y2".
|
|
352
|
+
* Returns null if the string cannot be parsed.
|
|
353
|
+
*/
|
|
354
|
+
declare function parseCubicBezier(value: string): [number, number, number, number] | null;
|
|
355
|
+
/**
|
|
356
|
+
* Format four bezier control values into a CSS cubic-bezier() string.
|
|
357
|
+
*/
|
|
358
|
+
declare function formatCubicBezier(x1: number, y1: number, x2: number, y2: number): string;
|
|
359
|
+
/**
|
|
360
|
+
* Sample points along a cubic bezier curve for SVG path rendering.
|
|
361
|
+
* Returns an array of { x, y } points from t=0 to t=1.
|
|
362
|
+
*/
|
|
363
|
+
declare function sampleBezierCurve(x1: number, y1: number, x2: number, y2: number, steps?: number): {
|
|
364
|
+
x: number;
|
|
365
|
+
y: number;
|
|
366
|
+
}[];
|
|
367
|
+
/**
|
|
368
|
+
* Clamp a control point value to valid ranges.
|
|
369
|
+
* X values are clamped to [0, 1], Y values to [-0.5, 1.5] for bounce effects.
|
|
370
|
+
*/
|
|
371
|
+
declare function clampControlPoint(value: number, axis: 'x' | 'y'): number;
|
|
372
|
+
/**
|
|
373
|
+
* Snap a value to the nearest grid increment.
|
|
374
|
+
*/
|
|
375
|
+
declare function snapToGrid(value: number, gridSize: number): number;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Easing Presets - named easing presets with cubic-bezier values,
|
|
379
|
+
* grouped by category (basic, material, expressive).
|
|
380
|
+
*/
|
|
381
|
+
interface EasingPreset {
|
|
382
|
+
label: string;
|
|
383
|
+
value: string;
|
|
384
|
+
description: string;
|
|
385
|
+
category: 'basic' | 'material' | 'expressive';
|
|
386
|
+
}
|
|
387
|
+
declare const EASING_PRESETS: EasingPreset[];
|
|
388
|
+
/**
|
|
389
|
+
* Get presets grouped by category.
|
|
390
|
+
*/
|
|
391
|
+
declare function getPresetsByCategory(): Record<string, EasingPreset[]>;
|
|
392
|
+
/**
|
|
393
|
+
* Find a preset by its CSS value.
|
|
394
|
+
*/
|
|
395
|
+
declare function findPresetByValue(value: string): EasingPreset | undefined;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Registry Overlay - layers token reassignment operations on top of the
|
|
399
|
+
* static TOKEN_REGISTRY without mutating it.
|
|
400
|
+
*
|
|
401
|
+
* Supports moving tokens between categories, adding custom categories,
|
|
402
|
+
* and extracting new tokens.
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
interface ExtractedTokenDef {
|
|
406
|
+
cssVar: string;
|
|
407
|
+
label: string;
|
|
408
|
+
category: string;
|
|
409
|
+
defaultValue: string;
|
|
410
|
+
referencesVar?: string;
|
|
411
|
+
}
|
|
412
|
+
interface RegistryOverlay {
|
|
413
|
+
/** cssVar -> new category label */
|
|
414
|
+
moves: Map<string, string>;
|
|
415
|
+
/** User-created category names */
|
|
416
|
+
customCategories: string[];
|
|
417
|
+
/** Tokens extracted from hardcoded values */
|
|
418
|
+
extractedTokens: ExtractedTokenDef[];
|
|
419
|
+
}
|
|
420
|
+
declare function createOverlay(): RegistryOverlay;
|
|
421
|
+
declare function moveToken(overlay: RegistryOverlay, cssVar: string, targetCategory: string): RegistryOverlay;
|
|
422
|
+
declare function bulkMoveTokens(overlay: RegistryOverlay, cssVars: string[], targetCategory: string): RegistryOverlay;
|
|
423
|
+
declare function addCustomCategory(overlay: RegistryOverlay, label: string): RegistryOverlay;
|
|
424
|
+
declare function addExtractedToken(overlay: RegistryOverlay, token: ExtractedTokenDef): RegistryOverlay;
|
|
425
|
+
/**
|
|
426
|
+
* Compute the effective categories by applying overlay moves and extracted
|
|
427
|
+
* tokens on top of the static registry.
|
|
428
|
+
*/
|
|
429
|
+
declare function getEffectiveCategories(overlay: RegistryOverlay): TokenCategory[];
|
|
430
|
+
/** Get all category labels (static + custom). */
|
|
431
|
+
declare function getAllCategoryLabels(overlay: RegistryOverlay): string[];
|
|
432
|
+
/** Find which category a token currently belongs to (considering moves). */
|
|
433
|
+
declare function getTokenCategory(overlay: RegistryOverlay, cssVar: string): string | undefined;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Token Extraction - validates and creates new token definitions from
|
|
437
|
+
* hardcoded CSS values.
|
|
438
|
+
*/
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Validate a proposed token name (CSS custom property format).
|
|
442
|
+
* Must be lowercase with hyphens only, starting with --.
|
|
443
|
+
*/
|
|
444
|
+
declare function validateTokenName(name: string): {
|
|
445
|
+
valid: boolean;
|
|
446
|
+
error?: string;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Suggest a token name based on the value and target category.
|
|
450
|
+
*/
|
|
451
|
+
declare function suggestTokenName(value: string, category: string): string;
|
|
452
|
+
/**
|
|
453
|
+
* Extract a hardcoded value into a new named token in the overlay.
|
|
454
|
+
*/
|
|
455
|
+
declare function extractToken(overlay: RegistryOverlay, token: ExtractedTokenDef): RegistryOverlay;
|
|
456
|
+
/**
|
|
457
|
+
* Check if an overlay already contains an extracted token with the given cssVar.
|
|
458
|
+
*/
|
|
459
|
+
declare function hasExtractedToken(overlay: RegistryOverlay, cssVar: string): boolean;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Reassignment State - undo/redo state management for token reassignment
|
|
463
|
+
* operations. Follows an immutable pattern.
|
|
464
|
+
*/
|
|
465
|
+
|
|
466
|
+
interface ReassignmentAction {
|
|
467
|
+
type: 'move' | 'extract' | 'bulk-move' | 'add-category';
|
|
468
|
+
before: RegistryOverlay;
|
|
469
|
+
after: RegistryOverlay;
|
|
470
|
+
description: string;
|
|
471
|
+
}
|
|
472
|
+
interface ReassignmentState {
|
|
473
|
+
overlay: RegistryOverlay;
|
|
474
|
+
undoStack: ReassignmentAction[];
|
|
475
|
+
redoStack: ReassignmentAction[];
|
|
476
|
+
}
|
|
477
|
+
declare function createReassignmentState(): ReassignmentState;
|
|
478
|
+
declare function applyMove(state: ReassignmentState, cssVar: string, targetCategory: string, tokenLabel?: string): ReassignmentState;
|
|
479
|
+
declare function applyBulkMove(state: ReassignmentState, cssVars: string[], targetCategory: string): ReassignmentState;
|
|
480
|
+
declare function applyExtract(state: ReassignmentState, token: ExtractedTokenDef): ReassignmentState;
|
|
481
|
+
declare function applyAddCategory(state: ReassignmentState, label: string): ReassignmentState;
|
|
482
|
+
declare function undoReassignment(state: ReassignmentState): ReassignmentState;
|
|
483
|
+
declare function redoReassignment(state: ReassignmentState): ReassignmentState;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Token Usage Counter - scans the DOM to determine which CSS custom property
|
|
487
|
+
* tokens are actively in use and by how many elements.
|
|
488
|
+
*/
|
|
489
|
+
interface TokenUsageResult {
|
|
490
|
+
cssVar: string;
|
|
491
|
+
label: string;
|
|
492
|
+
count: number;
|
|
493
|
+
/** First 5 elements using this token (for preview) */
|
|
494
|
+
elements: HTMLElement[];
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Count how many DOM elements use each token.
|
|
498
|
+
* If cssVar is provided, counts only that token.
|
|
499
|
+
* Otherwise counts all tokens (expensive - use sparingly).
|
|
500
|
+
*/
|
|
501
|
+
declare function countTokenUsage(cssVar?: string): TokenUsageResult[];
|
|
502
|
+
/**
|
|
503
|
+
* Get usage count for a single token (uses cache if available).
|
|
504
|
+
*/
|
|
505
|
+
declare function getTokenUsageCount(cssVar: string): number;
|
|
506
|
+
/**
|
|
507
|
+
* Clear the usage cache to force a fresh scan on next call.
|
|
508
|
+
*/
|
|
509
|
+
declare function clearUsageCache(): void;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Unused Token Scanner - detects design tokens that are defined
|
|
513
|
+
* but not referenced in any component CSS.
|
|
514
|
+
*
|
|
515
|
+
* Uses DOM scanning to find which CSS custom properties are actually
|
|
516
|
+
* in use. Runs client-side only.
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
interface UnusedTokenResult {
|
|
520
|
+
token: TokenDefinition;
|
|
521
|
+
/** Whether it's referenced by another token (chain dependency) */
|
|
522
|
+
isChainDependency: boolean;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Find tokens that are defined in the registry but not used in any
|
|
526
|
+
* stylesheet or inline style.
|
|
527
|
+
*/
|
|
528
|
+
declare function findUnusedTokens(): UnusedTokenResult[];
|
|
529
|
+
/**
|
|
530
|
+
* Get usage statistics for the token registry.
|
|
531
|
+
*/
|
|
532
|
+
declare function getTokenUsageStats(): {
|
|
533
|
+
total: number;
|
|
534
|
+
used: number;
|
|
535
|
+
unused: number;
|
|
536
|
+
chainDependencies: number;
|
|
537
|
+
usageRate: number;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Dark Mode - generates dark theme variants by intelligently inverting
|
|
542
|
+
* colour lightness while preserving hue for semantic colours.
|
|
543
|
+
*
|
|
544
|
+
* Strategy:
|
|
545
|
+
* - Surface colours: swap lightness (light becomes dark)
|
|
546
|
+
* - Text colours: swap lightness (dark becomes light)
|
|
547
|
+
* - Semantic colours: keep hue, adjust lightness for dark backgrounds
|
|
548
|
+
* - Border colours: lighten for visibility on dark surfaces
|
|
549
|
+
* - Brand colours: keep hue, shift lightness range
|
|
550
|
+
*/
|
|
551
|
+
/** Convert hex (#rrggbb) to HSL {h: 0-360, s: 0-100, l: 0-100}. */
|
|
552
|
+
declare function hexToHsl(hex: string): {
|
|
553
|
+
h: number;
|
|
554
|
+
s: number;
|
|
555
|
+
l: number;
|
|
556
|
+
};
|
|
557
|
+
/** Convert HSL {h: 0-360, s: 0-100, l: 0-100} to hex (#rrggbb). */
|
|
558
|
+
declare function hslToHex(h: number, s: number, l: number): string;
|
|
559
|
+
/**
|
|
560
|
+
* Invert the lightness of a hex colour.
|
|
561
|
+
* L: 95 becomes 5, L: 10 becomes 90, etc.
|
|
562
|
+
*/
|
|
563
|
+
declare function invertLightness(hex: string): string;
|
|
564
|
+
/**
|
|
565
|
+
* Adjust a semantic colour for dark mode - keeps hue, reduces saturation
|
|
566
|
+
* slightly, and shifts lightness to work on dark backgrounds.
|
|
567
|
+
*/
|
|
568
|
+
declare function adjustSemanticForDark(hex: string, _semanticType?: string): string;
|
|
569
|
+
interface DarkModeConfig {
|
|
570
|
+
surfaceInversion: Record<string, string>;
|
|
571
|
+
textInversion: Record<string, string>;
|
|
572
|
+
semanticAdjustments: Record<string, string>;
|
|
573
|
+
borderAdjustments: Record<string, string>;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Generate a complete dark theme from a light theme.
|
|
577
|
+
* Returns a Record of CSS variable name -> dark hex value.
|
|
578
|
+
*/
|
|
579
|
+
declare function generateDarkTheme(lightTheme?: Record<string, string>): Record<string, string>;
|
|
580
|
+
/** Check whether dark mode is currently active. */
|
|
581
|
+
declare function isDarkMode(): boolean;
|
|
582
|
+
/** Apply or remove the dark mode class from documentElement. */
|
|
583
|
+
declare function setDarkMode(enabled: boolean): void;
|
|
584
|
+
/** Check system colour scheme preference. */
|
|
585
|
+
declare function systemPrefersDark(): boolean;
|
|
586
|
+
/**
|
|
587
|
+
* Resolve a dark mode preference to a concrete light/dark value.
|
|
588
|
+
*/
|
|
589
|
+
declare function resolveMode(mode: 'light' | 'dark' | 'system'): 'light' | 'dark';
|
|
590
|
+
/**
|
|
591
|
+
* Apply dark mode to the DOM based on the user preference.
|
|
592
|
+
*/
|
|
593
|
+
declare function applyDarkModeToDOM(mode: 'light' | 'dark' | 'system'): void;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Surface Override System - context-specific theme overrides for different
|
|
597
|
+
* environments: kiosk (touchscreen), print, outdoor, low-light.
|
|
598
|
+
*
|
|
599
|
+
* Each surface is a partial theme override applied on top of the base theme
|
|
600
|
+
* (and dark mode). Cascade:
|
|
601
|
+
* THEME_DEFAULTS < tenant_defaults < profile_overrides < dark_mode < surface
|
|
602
|
+
*/
|
|
603
|
+
type SurfaceType = 'default' | 'kiosk' | 'print' | 'outdoor' | 'low-light';
|
|
604
|
+
interface SurfaceDefinition {
|
|
605
|
+
id: SurfaceType;
|
|
606
|
+
name: string;
|
|
607
|
+
description: string;
|
|
608
|
+
overrides: Record<string, string>;
|
|
609
|
+
cssClass: string;
|
|
610
|
+
}
|
|
611
|
+
declare const SURFACE_DEFINITIONS: SurfaceDefinition[];
|
|
612
|
+
/** Get the override map for a given surface type. */
|
|
613
|
+
declare function getSurfaceOverrides(surfaceType: SurfaceType): Record<string, string>;
|
|
614
|
+
/** Get the full definition for a surface type. */
|
|
615
|
+
declare function getSurfaceDefinition(surfaceType: SurfaceType): SurfaceDefinition | undefined;
|
|
616
|
+
/** Apply a surface to the DOM - sets CSS class and variable overrides. */
|
|
617
|
+
declare function applySurface(surfaceType: SurfaceType): void;
|
|
618
|
+
/** Remove all surface overrides from the DOM. */
|
|
619
|
+
declare function clearSurface(): void;
|
|
620
|
+
/** Get the currently active surface from DOM classes. */
|
|
621
|
+
declare function getActiveSurface(): SurfaceType;
|
|
622
|
+
/**
|
|
623
|
+
* Apply surface to the DOM.
|
|
624
|
+
*/
|
|
625
|
+
declare function applySurfaceToDOM(surface: SurfaceType): void;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Density Modes - compact, default, and comfortable spacing modes.
|
|
629
|
+
*
|
|
630
|
+
* Each mode applies a multiplier to spacing tokens and subtle adjustments
|
|
631
|
+
* to font size and line height via CSS custom properties.
|
|
632
|
+
*/
|
|
633
|
+
type DensityMode = 'compact' | 'default' | 'comfortable';
|
|
634
|
+
interface DensityConfig {
|
|
635
|
+
mode: DensityMode;
|
|
636
|
+
label: string;
|
|
637
|
+
description: string;
|
|
638
|
+
spacingMultiplier: number;
|
|
639
|
+
fontSizeAdjust: number;
|
|
640
|
+
lineHeightAdjust: number;
|
|
641
|
+
}
|
|
642
|
+
declare const DENSITY_CONFIGS: Record<DensityMode, DensityConfig>;
|
|
643
|
+
/**
|
|
644
|
+
* Get CSS variable overrides for a given density mode.
|
|
645
|
+
* Returns spacing tokens multiplied by the density factor,
|
|
646
|
+
* plus font-size and line-height adjustment variables.
|
|
647
|
+
*/
|
|
648
|
+
declare function getDensityCSS(mode: DensityMode): Record<string, string>;
|
|
649
|
+
/** Apply density mode to the DOM. */
|
|
650
|
+
declare function applyDensity(mode: DensityMode): void;
|
|
651
|
+
/** Get the currently active density from DOM classes. */
|
|
652
|
+
declare function getActiveDensity(): DensityMode;
|
|
653
|
+
/**
|
|
654
|
+
* Apply density to the DOM.
|
|
655
|
+
*/
|
|
656
|
+
declare function applyDensityToDOM(density: DensityMode): void;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Built-in theme presets for the design system editor.
|
|
660
|
+
* Each preset provides a complete set of theme overrides.
|
|
661
|
+
*/
|
|
662
|
+
interface ThemePreset {
|
|
663
|
+
id: string;
|
|
664
|
+
name: string;
|
|
665
|
+
description: string;
|
|
666
|
+
category: 'professional' | 'vibrant' | 'dark' | 'warm' | 'custom';
|
|
667
|
+
values: Record<string, string>;
|
|
668
|
+
preview: {
|
|
669
|
+
primary: string;
|
|
670
|
+
surface: string;
|
|
671
|
+
text: string;
|
|
672
|
+
accent: string;
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Build a full preset by merging overrides onto THEME_DEFAULTS.
|
|
677
|
+
* Ensures every preset has complete key coverage.
|
|
678
|
+
*/
|
|
679
|
+
declare function makePreset(base: Omit<ThemePreset, 'values'> & {
|
|
680
|
+
overrides: Record<string, string>;
|
|
681
|
+
}): ThemePreset;
|
|
682
|
+
declare const BUILT_IN_PRESETS: ThemePreset[];
|
|
683
|
+
/** Look up a built-in preset by ID. */
|
|
684
|
+
declare function findPreset(id: string): ThemePreset | undefined;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Theme export/import - JSON file operations for theme sharing.
|
|
688
|
+
*/
|
|
689
|
+
interface ThemeExportPayload {
|
|
690
|
+
version: 1;
|
|
691
|
+
name: string;
|
|
692
|
+
exportedAt: string;
|
|
693
|
+
values: Record<string, string>;
|
|
694
|
+
metadata?: {
|
|
695
|
+
presetId?: string;
|
|
696
|
+
tenantName?: string;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Create a ThemeExportPayload object from the current theme state.
|
|
701
|
+
*/
|
|
702
|
+
declare function exportTheme(current: Record<string, string>, name: string, metadata?: ThemeExportPayload['metadata']): ThemeExportPayload;
|
|
703
|
+
/**
|
|
704
|
+
* Validate an imported theme JSON structure.
|
|
705
|
+
* Returns validation result with parsed data or errors.
|
|
706
|
+
*/
|
|
707
|
+
declare function validateImport(data: unknown): {
|
|
708
|
+
valid: boolean;
|
|
709
|
+
errors: string[];
|
|
710
|
+
warnings: string[];
|
|
711
|
+
parsed?: ThemeExportPayload;
|
|
712
|
+
};
|
|
713
|
+
/**
|
|
714
|
+
* Trigger a browser download of the theme as a JSON file.
|
|
715
|
+
*/
|
|
716
|
+
declare function downloadThemeAsJSON(theme: ThemeExportPayload): void;
|
|
717
|
+
/**
|
|
718
|
+
* Read a theme from a File object (from file picker).
|
|
719
|
+
*/
|
|
720
|
+
declare function readThemeFromFile(file: File): Promise<ThemeExportPayload>;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* W3C Design Tokens Format - exports the token registry to the
|
|
724
|
+
* W3C Community Group Design Tokens Format specification.
|
|
725
|
+
*
|
|
726
|
+
* See: https://design-tokens.github.io/community-group/format/
|
|
727
|
+
*/
|
|
728
|
+
interface W3CToken {
|
|
729
|
+
$type: string;
|
|
730
|
+
$value: string;
|
|
731
|
+
$description?: string;
|
|
732
|
+
$extensions?: Record<string, unknown>;
|
|
733
|
+
}
|
|
734
|
+
type W3CGroup = {
|
|
735
|
+
[key: string]: W3CToken | W3CGroup;
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
738
|
+
* Export the full token registry in W3C Design Tokens format.
|
|
739
|
+
*/
|
|
740
|
+
declare function exportToW3CFormat(overrides?: Record<string, string>): W3CGroup;
|
|
741
|
+
/**
|
|
742
|
+
* Download the W3C tokens as a JSON file.
|
|
743
|
+
*/
|
|
744
|
+
declare function downloadW3CTokens(overrides?: Record<string, string>): void;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Style Guide Export - generates a comprehensive markdown style guide
|
|
748
|
+
* from the token registry, theme values, and component patterns.
|
|
749
|
+
*/
|
|
750
|
+
/**
|
|
751
|
+
* Generate a comprehensive markdown style guide.
|
|
752
|
+
*/
|
|
753
|
+
declare function generateStyleGuide(overrides?: Record<string, string>): string;
|
|
754
|
+
declare function downloadStyleGuide(overrides?: Record<string, string>): void;
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Audit Report Generator - produces a structured markdown report
|
|
758
|
+
* from quality score, contrast checker, and consistency checker.
|
|
759
|
+
*
|
|
760
|
+
* NOTE: Session A creates quality-score.ts, contrast-checker.ts, and
|
|
761
|
+
* consistency-checker.ts. Until those are merged, this file uses local
|
|
762
|
+
* type stubs and placeholder implementations.
|
|
763
|
+
*/
|
|
764
|
+
interface QualityBreakdown$1 {
|
|
765
|
+
overall: number;
|
|
766
|
+
colourHarmony: number;
|
|
767
|
+
contrastCompliance: number;
|
|
768
|
+
typographyConsistency: number;
|
|
769
|
+
spacingRegularity: number;
|
|
770
|
+
}
|
|
771
|
+
interface ContrastIssue$1 {
|
|
772
|
+
foregroundLabel: string;
|
|
773
|
+
foregroundHex: string;
|
|
774
|
+
backgroundLabel: string;
|
|
775
|
+
backgroundHex: string;
|
|
776
|
+
ratio: number;
|
|
777
|
+
requiredRatio: number;
|
|
778
|
+
suggestedFix: string;
|
|
779
|
+
}
|
|
780
|
+
interface ConsistencyIssue$1 {
|
|
781
|
+
severity: 'warning' | 'error';
|
|
782
|
+
category: string;
|
|
783
|
+
message: string;
|
|
784
|
+
suggestion: string;
|
|
785
|
+
}
|
|
786
|
+
interface AuditReport {
|
|
787
|
+
generatedAt: string;
|
|
788
|
+
quality: QualityBreakdown$1;
|
|
789
|
+
contrastIssues: ContrastIssue$1[];
|
|
790
|
+
consistencyIssues: ConsistencyIssue$1[];
|
|
791
|
+
tokenStats: {
|
|
792
|
+
total: number;
|
|
793
|
+
byCategory: Record<string, number>;
|
|
794
|
+
themeable: number;
|
|
795
|
+
};
|
|
796
|
+
summary: string;
|
|
797
|
+
}
|
|
798
|
+
declare function generateAuditReport(overrides?: Record<string, string>): AuditReport;
|
|
799
|
+
declare function auditReportToMarkdown(report: AuditReport): string;
|
|
800
|
+
declare function downloadAuditReport(report: AuditReport): void;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* DOM utilities for applying and clearing theme values on the document root.
|
|
804
|
+
* These functions set/remove CSS custom properties on document.documentElement.
|
|
805
|
+
*/
|
|
806
|
+
/**
|
|
807
|
+
* Apply a merged theme to the DOM by setting CSS custom properties on :root.
|
|
808
|
+
* Derives sidebar states and accent variants automatically.
|
|
809
|
+
*/
|
|
810
|
+
declare function applyThemeToDOM(merged: Record<string, string>): void;
|
|
811
|
+
/** Remove all theme overrides from :root, restoring CSS defaults. */
|
|
812
|
+
declare function clearThemeFromDOM(): void;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Contrast Fix Engine - scans colour token pairs for WCAG AA failures
|
|
816
|
+
* and suggests fixes by adjusting foreground lightness/darkness.
|
|
817
|
+
*
|
|
818
|
+
* Pure functions, no side effects.
|
|
819
|
+
*/
|
|
820
|
+
interface ContrastIssue {
|
|
821
|
+
foregroundVar: string;
|
|
822
|
+
backgroundVar: string;
|
|
823
|
+
foregroundLabel: string;
|
|
824
|
+
backgroundLabel: string;
|
|
825
|
+
foregroundHex: string;
|
|
826
|
+
backgroundHex: string;
|
|
827
|
+
ratio: number;
|
|
828
|
+
requiredRatio: number;
|
|
829
|
+
suggestedFix: string;
|
|
830
|
+
level: 'AA' | 'AAA';
|
|
831
|
+
themeKey?: string;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Suggest a fix for a foreground colour that fails contrast against
|
|
835
|
+
* a background. Adjusts the foreground by darkening or lightening
|
|
836
|
+
* until the target ratio is met.
|
|
837
|
+
*/
|
|
838
|
+
declare function suggestFix(fg: string, bg: string, targetRatio: number): string;
|
|
839
|
+
/**
|
|
840
|
+
* Find all contrast issues in the current theme.
|
|
841
|
+
* Pass overrides to check customised values; defaults to THEME_DEFAULTS.
|
|
842
|
+
*/
|
|
843
|
+
declare function findContrastIssues(overrides?: Record<string, string>): ContrastIssue[];
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* Border/Shape Consistency Checker - scans token values for
|
|
847
|
+
* inconsistencies in border radius, border width, and spacing.
|
|
848
|
+
*
|
|
849
|
+
* Pure functions, no side effects.
|
|
850
|
+
*/
|
|
851
|
+
interface ConsistencyIssue {
|
|
852
|
+
severity: 'warning' | 'info';
|
|
853
|
+
category: 'border' | 'radius' | 'spacing';
|
|
854
|
+
message: string;
|
|
855
|
+
affectedTokens: string[];
|
|
856
|
+
suggestion: string;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Run all consistency checks and return combined issues.
|
|
860
|
+
* Optionally pass token overrides to check against modified values.
|
|
861
|
+
*/
|
|
862
|
+
declare function checkConsistency(overrides?: Record<string, string>): ConsistencyIssue[];
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Design Quality Score - composite score (0-100) computed from
|
|
866
|
+
* colour harmony, contrast compliance, typography consistency,
|
|
867
|
+
* and spacing regularity.
|
|
868
|
+
*
|
|
869
|
+
* Pure functions, no side effects.
|
|
870
|
+
*/
|
|
871
|
+
interface QualityBreakdown {
|
|
872
|
+
overall: number;
|
|
873
|
+
colourHarmony: number;
|
|
874
|
+
contrastCompliance: number;
|
|
875
|
+
typographyConsistency: number;
|
|
876
|
+
spacingRegularity: number;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Calculate the overall design quality score and breakdown.
|
|
880
|
+
* Pass overrides to score customised theme values.
|
|
881
|
+
*/
|
|
882
|
+
declare function calculateQualityScore(overrides?: Record<string, string>): QualityBreakdown;
|
|
883
|
+
|
|
884
|
+
export { type ConsistencyIssue$1 as AuditConsistencyIssue, type ContrastIssue$1 as AuditContrastIssue, type QualityBreakdown$1 as AuditQualityBreakdown, type AuditReport, BUILT_IN_PRESETS, COLOUR_BLINDNESS_TYPES, type ColourBlindnessInfo, type ColourBlindnessType, type ColourSuggestion, type ConsistencyIssue, type ContrastIssue$2 as ContrastIssue, type CustomPreset, DENSITY_CONFIGS, type DarkModeConfig, type DensityConfig, type DensityMode, type DesignSystemAdapter, type ThemePreset as DesignThemePreset, EASING_PRESETS, type EasingPreset, type ExtractedTokenDef, FONT_PAIRINGS, type FontPairing, type HSL, type HarmonyType, type QualityBreakdown$2 as QualityBreakdown, type ReassignmentAction, type ReassignmentState, type RegistryOverlay, SCALE_RATIOS, SURFACE_DEFINITIONS, type ScaleRatio, type SurfaceDefinition, type SurfaceType, THEME_CATEGORIES, THEME_DEFAULTS, THEME_KEY_TO_CSS, TOKEN_REGISTRY, type ThemeEditorState, type ThemeExport, type ThemeExportPayload, type ThemePreset$1 as ThemePreset, type ThemeSnapshot, type ThemeVersion, type TokenCategory, type TokenDefinition, type TokenUsageResult, type TypeScale, type TypeScaleLevel, type UnusedTokenResult, addCustomCategory, addExtractedToken, adjustSemanticForDark, applyAddCategory, applyBulkChange, applyBulkMove, applyChange, applyDarkModeToDOM, applyDensity, applyDensityToDOM, applyExtract, applyMove, applySurface, applySurfaceToDOM, applyThemeToDOM, auditReportToMarkdown, bulkMoveTokens, calculateQualityScore, captureSnapshot, checkConsistency, clampControlPoint, clearSnapshots, clearSurface, clearThemeFromDOM, clearUsageCache, contrastRatio, countTokenUsage, createOverlay, createReassignmentState, createThemeEditorState, darken, downloadAuditReport, downloadStyleGuide, downloadThemeAsJSON, downloadW3CTokens, ensureContrastOnWhite, exportTheme, exportToW3CFormat, extractToken, findContrastIssues, findPreset, findPresetByValue, findToken, findUnusedTokens, formatCubicBezier, generateAuditReport, generateDarkTheme, generateScale, generateStyleGuide, generateTypeScale, getActiveDensity, getActiveSurface, getAllCategoryLabels, getDensityCSS, getDependents, getEffectiveCategories, getOpeningSnapshot, getPresetsByCategory, getSnapshot, getSurfaceDefinition, getSurfaceOverrides, getTokenCategory, getTokenChain, getTokenUsageCount, getTokenUsageStats, hasExtractedToken, hexToHSL, hexToHsl, hslToHex$1 as hslToHex, hslToHex as hslToHexDark, invertLightness, isDark, isDarkMode, lighten, luminance, makePreset, markSaved, moveToken, parseCubicBezier, readSnapshots, readThemeFromFile, redo, redoReassignment, resetToDefaults, resolveMode, rotateHue, sampleBezierCurve, setDarkMode, simulateColourBlindness, simulateThemeColourBlindness, snapToGrid, suggestFix, suggestPairings, suggestPalettes, suggestTokenName, systemPrefersDark, themesAreEqual, typeScaleToCSSVars, undo, undoReassignment, validateImport, validateTokenName };
|