@dryui/theme-wizard 3.0.0 → 5.0.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/package.json +5 -5
- package/dist/actions.d.ts +0 -4
- package/dist/actions.js +0 -9
- package/dist/components/AlphaSlider.svelte +0 -13
- package/dist/components/AlphaSlider.svelte.d.ts +0 -9
- package/dist/components/ContrastBadge.svelte +0 -22
- package/dist/components/ContrastBadge.svelte.d.ts +0 -8
- package/dist/components/HsbPicker.svelte +0 -304
- package/dist/components/HsbPicker.svelte.d.ts +0 -9
- package/dist/components/StepIndicator.svelte +0 -87
- package/dist/components/StepIndicator.svelte.d.ts +0 -7
- package/dist/components/TokenPreview.svelte +0 -55
- package/dist/components/TokenPreview.svelte.d.ts +0 -8
- package/dist/components/WizardShell.svelte +0 -140
- package/dist/components/WizardShell.svelte.d.ts +0 -15
- package/dist/engine/derivation.d.ts +0 -282
- package/dist/engine/derivation.js +0 -1445
- package/dist/engine/derivation.test.d.ts +0 -1
- package/dist/engine/derivation.test.js +0 -956
- package/dist/engine/export-css.d.ts +0 -32
- package/dist/engine/export-css.js +0 -90
- package/dist/engine/export-css.test.d.ts +0 -1
- package/dist/engine/export-css.test.js +0 -78
- package/dist/engine/index.d.ts +0 -10
- package/dist/engine/index.js +0 -6
- package/dist/engine/palette.d.ts +0 -16
- package/dist/engine/palette.js +0 -44
- package/dist/engine/presets.d.ts +0 -6
- package/dist/engine/presets.js +0 -34
- package/dist/engine/url-codec.d.ts +0 -53
- package/dist/engine/url-codec.js +0 -243
- package/dist/engine/url-codec.test.d.ts +0 -1
- package/dist/engine/url-codec.test.js +0 -137
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -17
- package/dist/state.svelte.d.ts +0 -104
- package/dist/state.svelte.js +0 -574
- package/dist/steps/BrandColor.svelte +0 -218
- package/dist/steps/BrandColor.svelte.d.ts +0 -6
- package/dist/steps/Personality.svelte +0 -319
- package/dist/steps/Personality.svelte.d.ts +0 -3
- package/dist/steps/PreviewExport.svelte +0 -115
- package/dist/steps/PreviewExport.svelte.d.ts +0 -9
- package/dist/steps/Shape.svelte +0 -121
- package/dist/steps/Shape.svelte.d.ts +0 -18
- package/dist/steps/Typography.svelte +0 -115
- package/dist/steps/Typography.svelte.d.ts +0 -18
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// apps/docs/src/lib/theme-wizard/url-codec.test.ts
|
|
2
|
-
import { describe, test, expect } from 'bun:test';
|
|
3
|
-
import { encodeTheme, decodeTheme } from './url-codec.js';
|
|
4
|
-
// ─── Round-trip helpers ────────────────────────────────────────────────────────
|
|
5
|
-
function roundTrip(brand, options) {
|
|
6
|
-
const input = options !== undefined ? { brand, options } : { brand };
|
|
7
|
-
const encoded = encodeTheme(input);
|
|
8
|
-
return { encoded, decoded: decodeTheme(encoded) };
|
|
9
|
-
}
|
|
10
|
-
// ─── Encoding ─────────────────────────────────────────────────────────────────
|
|
11
|
-
describe('encodeTheme', () => {
|
|
12
|
-
test('encodes default brand to h230s65b85', () => {
|
|
13
|
-
const encoded = encodeTheme({ brand: { h: 230, s: 65, b: 85 } });
|
|
14
|
-
expect(encoded).toBe('h230s65b85');
|
|
15
|
-
});
|
|
16
|
-
test('encodes ocean brand to h200s80b70', () => {
|
|
17
|
-
const encoded = encodeTheme({ brand: { h: 200, s: 80, b: 70 } });
|
|
18
|
-
expect(encoded).toBe('h200s80b70');
|
|
19
|
-
});
|
|
20
|
-
test('encodes brand without options — no dash suffix', () => {
|
|
21
|
-
const encoded = encodeTheme({ brand: { h: 145, s: 60, b: 55 } });
|
|
22
|
-
expect(encoded).not.toContain('-');
|
|
23
|
-
});
|
|
24
|
-
test('encodes brand + error hue override with dash separator', () => {
|
|
25
|
-
const encoded = encodeTheme({
|
|
26
|
-
brand: { h: 230, s: 65, b: 85 },
|
|
27
|
-
options: { statusHues: { error: 350 } }
|
|
28
|
-
});
|
|
29
|
-
expect(encoded).toBe('h230s65b85-e350');
|
|
30
|
-
});
|
|
31
|
-
test('encodes brand + multiple status hue overrides', () => {
|
|
32
|
-
const encoded = encodeTheme({
|
|
33
|
-
brand: { h: 230, s: 65, b: 85 },
|
|
34
|
-
options: { statusHues: { error: 350, warning: 45 } }
|
|
35
|
-
});
|
|
36
|
-
expect(encoded).toBe('h230s65b85-e350w45');
|
|
37
|
-
});
|
|
38
|
-
test('encodes all four status hues', () => {
|
|
39
|
-
const encoded = encodeTheme({
|
|
40
|
-
brand: { h: 230, s: 65, b: 85 },
|
|
41
|
-
options: { statusHues: { error: 0, warning: 40, success: 145, info: 210 } }
|
|
42
|
-
});
|
|
43
|
-
expect(encoded).toBe('h230s65b85-e0w40s145i210');
|
|
44
|
-
});
|
|
45
|
-
test('empty statusHues object produces no suffix', () => {
|
|
46
|
-
const encoded = encodeTheme({ brand: { h: 230, s: 65, b: 85 }, options: { statusHues: {} } });
|
|
47
|
-
expect(encoded).toBe('h230s65b85');
|
|
48
|
-
});
|
|
49
|
-
test('rounds fractional hue values', () => {
|
|
50
|
-
const encoded = encodeTheme({ brand: { h: 230.7, s: 65.4, b: 85.2 } });
|
|
51
|
-
expect(encoded).toBe('h231s65b85');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
// ─── Decoding ─────────────────────────────────────────────────────────────────
|
|
55
|
-
describe('decodeTheme', () => {
|
|
56
|
-
test('decodes h230s65b85 to default brand', () => {
|
|
57
|
-
const { brand } = decodeTheme('h230s65b85');
|
|
58
|
-
expect(brand).toEqual({ h: 230, s: 65, b: 85 });
|
|
59
|
-
});
|
|
60
|
-
test('decodes brand-only string — options is undefined', () => {
|
|
61
|
-
const result = decodeTheme('h200s80b70');
|
|
62
|
-
expect(result.options).toBeUndefined();
|
|
63
|
-
});
|
|
64
|
-
test('decodes string with single status hue override', () => {
|
|
65
|
-
const result = decodeTheme('h230s65b85-e350');
|
|
66
|
-
expect(result.brand).toEqual({ h: 230, s: 65, b: 85 });
|
|
67
|
-
expect(result.options?.statusHues?.error).toBe(350);
|
|
68
|
-
});
|
|
69
|
-
test('decodes string with multiple status hue overrides', () => {
|
|
70
|
-
const result = decodeTheme('h230s65b85-e350w45');
|
|
71
|
-
expect(result.options?.statusHues?.error).toBe(350);
|
|
72
|
-
expect(result.options?.statusHues?.warning).toBe(45);
|
|
73
|
-
});
|
|
74
|
-
test('decodes all four status hues', () => {
|
|
75
|
-
const result = decodeTheme('h230s65b85-e0w40s145i210');
|
|
76
|
-
expect(result.options?.statusHues).toEqual({
|
|
77
|
-
error: 0,
|
|
78
|
-
warning: 40,
|
|
79
|
-
success: 145,
|
|
80
|
-
info: 210
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
test('throws on empty string', () => {
|
|
84
|
-
expect(() => decodeTheme('')).toThrow();
|
|
85
|
-
});
|
|
86
|
-
test('throws on invalid brand segment', () => {
|
|
87
|
-
expect(() => decodeTheme('invalid')).toThrow();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
// ─── Round-trip ───────────────────────────────────────────────────────────────
|
|
91
|
-
describe('round-trip', () => {
|
|
92
|
-
test('default brand round-trips', () => {
|
|
93
|
-
const brand = { h: 230, s: 65, b: 85 };
|
|
94
|
-
const { decoded } = roundTrip(brand);
|
|
95
|
-
expect(decoded.brand).toEqual(brand);
|
|
96
|
-
});
|
|
97
|
-
test('ocean brand round-trips', () => {
|
|
98
|
-
const brand = { h: 200, s: 80, b: 70 };
|
|
99
|
-
const { decoded } = roundTrip(brand);
|
|
100
|
-
expect(decoded.brand).toEqual(brand);
|
|
101
|
-
});
|
|
102
|
-
test('forest brand round-trips', () => {
|
|
103
|
-
const brand = { h: 145, s: 60, b: 55 };
|
|
104
|
-
const { decoded } = roundTrip(brand);
|
|
105
|
-
expect(decoded.brand).toEqual(brand);
|
|
106
|
-
});
|
|
107
|
-
test('sunset brand round-trips', () => {
|
|
108
|
-
const brand = { h: 25, s: 80, b: 90 };
|
|
109
|
-
const { decoded } = roundTrip(brand);
|
|
110
|
-
expect(decoded.brand).toEqual(brand);
|
|
111
|
-
});
|
|
112
|
-
test('brand + error hue override round-trips', () => {
|
|
113
|
-
const brand = { h: 230, s: 65, b: 85 };
|
|
114
|
-
const options = { statusHues: { error: 350 } };
|
|
115
|
-
const { decoded } = roundTrip(brand, options);
|
|
116
|
-
expect(decoded.brand).toEqual(brand);
|
|
117
|
-
expect(decoded.options?.statusHues?.error).toBe(350);
|
|
118
|
-
});
|
|
119
|
-
test('brand + all status hues round-trips', () => {
|
|
120
|
-
const brand = { h: 230, s: 65, b: 85 };
|
|
121
|
-
const options = {
|
|
122
|
-
statusHues: { error: 5, warning: 38, success: 150, info: 205 }
|
|
123
|
-
};
|
|
124
|
-
const { decoded } = roundTrip(brand, options);
|
|
125
|
-
expect(decoded.brand).toEqual(brand);
|
|
126
|
-
expect(decoded.options?.statusHues).toEqual({ error: 5, warning: 38, success: 150, info: 205 });
|
|
127
|
-
});
|
|
128
|
-
test('compact string format — no redundant characters', () => {
|
|
129
|
-
const { encoded } = roundTrip({ h: 230, s: 65, b: 85 });
|
|
130
|
-
// Should be short: h230s65b85 = 10 chars
|
|
131
|
-
expect(encoded.length).toBeLessThanOrEqual(15);
|
|
132
|
-
});
|
|
133
|
-
test('encoded string only uses URL-safe characters', () => {
|
|
134
|
-
const { encoded } = roundTrip({ h: 230, s: 65, b: 85 }, { statusHues: { error: 0, warning: 40, success: 145, info: 210 } });
|
|
135
|
-
expect(encoded).toMatch(/^[a-zA-Z0-9-]+$/);
|
|
136
|
-
});
|
|
137
|
-
});
|
package/dist/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './engine/index.js';
|
|
2
|
-
export { wizardState, getDerivedTheme, setBrandHsb, setStep, goNextStep, goPrevStep, activateFastTrack, applyPreset, getStyleString, setFontPreset, setTypeScale, resetToDefaults, applyRecipe, setRadiusPreset, setRadiusScale, setDensity, getShadowTokens, getShapeTokens, setPersonality, getPersonalityTokens, getAllTokens, getOverrideTokens, RADIUS_PRESETS, FONT_STACKS } from './state.svelte.js';
|
|
3
|
-
export type { PreviewMode, NeutralMode, RadiusPreset, Density, ShadowPreset, Personality, TypeScale, FontPreset } from './state.svelte.js';
|
|
4
|
-
export { default as PersonalityStep } from './steps/Personality.svelte';
|
|
5
|
-
export { default as BrandColor } from './steps/BrandColor.svelte';
|
|
6
|
-
export { default as Typography } from './steps/Typography.svelte';
|
|
7
|
-
export { default as Shape } from './steps/Shape.svelte';
|
|
8
|
-
export { default as PreviewExport } from './steps/PreviewExport.svelte';
|
|
9
|
-
export { default as WizardShell } from './components/WizardShell.svelte';
|
|
10
|
-
export { default as HsbPicker } from './components/HsbPicker.svelte';
|
|
11
|
-
export { default as ContrastBadge } from './components/ContrastBadge.svelte';
|
|
12
|
-
export { default as AlphaSlider } from './components/AlphaSlider.svelte';
|
|
13
|
-
export { default as StepIndicator } from './components/StepIndicator.svelte';
|
|
14
|
-
export { default as TokenPreview } from './components/TokenPreview.svelte';
|
package/dist/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Re-export all engine functions and types
|
|
2
|
-
export * from './engine/index.js';
|
|
3
|
-
// Re-export state (Svelte 5 runes)
|
|
4
|
-
export { wizardState, getDerivedTheme, setBrandHsb, setStep, goNextStep, goPrevStep, activateFastTrack, applyPreset, getStyleString, setFontPreset, setTypeScale, resetToDefaults, applyRecipe, setRadiusPreset, setRadiusScale, setDensity, getShadowTokens, getShapeTokens, setPersonality, getPersonalityTokens, getAllTokens, getOverrideTokens, RADIUS_PRESETS, FONT_STACKS } from './state.svelte.js';
|
|
5
|
-
// Step components
|
|
6
|
-
export { default as PersonalityStep } from './steps/Personality.svelte';
|
|
7
|
-
export { default as BrandColor } from './steps/BrandColor.svelte';
|
|
8
|
-
export { default as Typography } from './steps/Typography.svelte';
|
|
9
|
-
export { default as Shape } from './steps/Shape.svelte';
|
|
10
|
-
export { default as PreviewExport } from './steps/PreviewExport.svelte';
|
|
11
|
-
// UI components
|
|
12
|
-
export { default as WizardShell } from './components/WizardShell.svelte';
|
|
13
|
-
export { default as HsbPicker } from './components/HsbPicker.svelte';
|
|
14
|
-
export { default as ContrastBadge } from './components/ContrastBadge.svelte';
|
|
15
|
-
export { default as AlphaSlider } from './components/AlphaSlider.svelte';
|
|
16
|
-
export { default as StepIndicator } from './components/StepIndicator.svelte';
|
|
17
|
-
export { default as TokenPreview } from './components/TokenPreview.svelte';
|
package/dist/state.svelte.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { type BrandInput, type ThemeTokens } from './engine/derivation.js';
|
|
2
|
-
import type { WizardRecipe } from './engine/url-codec.js';
|
|
3
|
-
export type PreviewMode = 'light' | 'dark' | 'side-by-side';
|
|
4
|
-
export type NeutralMode = 'monochromatic' | 'neutral';
|
|
5
|
-
export type RadiusPreset = 'sharp' | 'soft' | 'rounded' | 'pill';
|
|
6
|
-
export type Density = 'compact' | 'default' | 'spacious';
|
|
7
|
-
export type ShadowPreset = 'flat' | 'subtle' | 'elevated' | 'deep';
|
|
8
|
-
export type Personality = 'minimal' | 'clean' | 'structured' | 'rich';
|
|
9
|
-
export type FontPreset = 'System' | 'Humanist' | 'Geometric' | 'Classical' | 'Serif' | 'Mono';
|
|
10
|
-
export type TypeScale = 'compact' | 'default' | 'spacious';
|
|
11
|
-
export declare const wizardState: {
|
|
12
|
-
currentStep: number;
|
|
13
|
-
personality: Personality;
|
|
14
|
-
brandHsb: BrandInput;
|
|
15
|
-
neutralMode: NeutralMode;
|
|
16
|
-
statusHues: {
|
|
17
|
-
error: number;
|
|
18
|
-
warning: number;
|
|
19
|
-
success: number;
|
|
20
|
-
info: number;
|
|
21
|
-
};
|
|
22
|
-
darkBgOverrides: {
|
|
23
|
-
base?: string;
|
|
24
|
-
raised?: string;
|
|
25
|
-
overlay?: string;
|
|
26
|
-
};
|
|
27
|
-
fastTrack: boolean;
|
|
28
|
-
typography: {
|
|
29
|
-
fontPreset: FontPreset;
|
|
30
|
-
scale: TypeScale;
|
|
31
|
-
};
|
|
32
|
-
shape: {
|
|
33
|
-
radiusPreset: RadiusPreset;
|
|
34
|
-
radiusScale: number;
|
|
35
|
-
density: Density;
|
|
36
|
-
};
|
|
37
|
-
shadows: {
|
|
38
|
-
preset: ShadowPreset;
|
|
39
|
-
intensity: number;
|
|
40
|
-
tintBrand: boolean;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export declare function getDerivedTheme(): ThemeTokens;
|
|
44
|
-
/** Update the brand color (h: 0-360, s/b: 0-100). */
|
|
45
|
-
export declare function setBrandHsb(h: number, s: number, b: number): void;
|
|
46
|
-
/** Update a single status tone's hue. */
|
|
47
|
-
export declare function setStatusHue(tone: 'error' | 'warning' | 'success' | 'info', hue: number): void;
|
|
48
|
-
/** Update the neutral palette mode. */
|
|
49
|
-
export declare function setNeutralMode(mode: NeutralMode): void;
|
|
50
|
-
/** Set the personality (chrome level) and apply cross-step defaults. */
|
|
51
|
-
export declare function setPersonality(p: Personality): void;
|
|
52
|
-
/** Override a dark background level. */
|
|
53
|
-
export declare function setDarkBg(level: 'base' | 'raised' | 'overlay', value: string): void;
|
|
54
|
-
/** Navigate to a specific step (1–5). */
|
|
55
|
-
export declare function setStep(n: number): void;
|
|
56
|
-
/** Advance to the next step. */
|
|
57
|
-
export declare function goNextStep(): void;
|
|
58
|
-
/** Go back to the previous step. */
|
|
59
|
-
export declare function goPrevStep(): void;
|
|
60
|
-
/** Enable fast-track mode and jump to the final step. */
|
|
61
|
-
export declare function activateFastTrack(): void;
|
|
62
|
-
/** Apply a named preset from the PRESETS array. */
|
|
63
|
-
export declare function applyPreset(name: string): void;
|
|
64
|
-
/**
|
|
65
|
-
* Return a CSS custom property string for live preview injection.
|
|
66
|
-
*
|
|
67
|
-
* @param mode - 'light' | 'dark'
|
|
68
|
-
* @returns e.g. `--dry-color-brand: hsl(230, 75%, 60%); ...`
|
|
69
|
-
*/
|
|
70
|
-
export declare function getStyleString(mode: 'light' | 'dark'): string;
|
|
71
|
-
/** Update the font preset name. */
|
|
72
|
-
export declare function setFontPreset(preset: FontPreset): void;
|
|
73
|
-
/** Update the type scale. */
|
|
74
|
-
export declare function setTypeScale(scale: TypeScale): void;
|
|
75
|
-
/** Reset all wizard state to defaults. */
|
|
76
|
-
export declare function resetToDefaults(): void;
|
|
77
|
-
/** Apply a full wizard recipe, using personality defaults before explicit overrides. */
|
|
78
|
-
export declare function applyRecipe(recipe: WizardRecipe): void;
|
|
79
|
-
export declare function setRadiusPreset(preset: RadiusPreset): void;
|
|
80
|
-
export declare function setRadiusScale(scale: number): void;
|
|
81
|
-
export declare function setDensity(density: Density): void;
|
|
82
|
-
export declare const RADIUS_PRESETS: Record<RadiusPreset, {
|
|
83
|
-
sm: number;
|
|
84
|
-
md: number;
|
|
85
|
-
lg: number;
|
|
86
|
-
xl: number;
|
|
87
|
-
'2xl': number;
|
|
88
|
-
full: number;
|
|
89
|
-
}>;
|
|
90
|
-
export declare function setShadowPreset(preset: ShadowPreset): void;
|
|
91
|
-
export declare function setShadowIntensity(intensity: number): void;
|
|
92
|
-
export declare function setShadowTint(tint: boolean): void;
|
|
93
|
-
export declare function getShadowTokens(shadowPreset?: ShadowPreset, shadowIntensity?: number, tintBrand?: boolean, brandHue?: number): {
|
|
94
|
-
light: Record<string, string>;
|
|
95
|
-
dark: Record<string, string>;
|
|
96
|
-
};
|
|
97
|
-
export declare function getShapeTokens(radiusPreset?: RadiusPreset, radiusScale?: number, densityPreset?: Density): Record<string, string>;
|
|
98
|
-
export declare function getPersonalityTokens(): Record<string, string>;
|
|
99
|
-
export declare const FONT_STACKS: Record<FontPreset, string>;
|
|
100
|
-
export declare function getTypographyTokens(fontPreset?: FontPreset, scale?: TypeScale): Record<string, string>;
|
|
101
|
-
/** Return all tokens (color + shape + shadow + personality + typography) merged for a given mode. */
|
|
102
|
-
export declare function getAllTokens(mode?: 'light' | 'dark'): Record<string, string>;
|
|
103
|
-
/** Return only tokens that the user has changed from defaults. */
|
|
104
|
-
export declare function getOverrideTokens(mode?: 'light' | 'dark'): Record<string, string>;
|