@zc-ui/theme 1.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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=color-generator.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-generator.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/color-generator.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=component-theme.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-theme.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/component-theme.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=css-layers.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-layers.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/css-layers.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=namespace.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/namespace.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=presets.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/presets.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtime-theme.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-theme.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/runtime-theme.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,138 @@
1
+ import { ColorScale } from './colors';
2
+ /** RGB triplet (0–255 each) */
3
+ export interface RGB {
4
+ r: number;
5
+ g: number;
6
+ b: number;
7
+ }
8
+ /** HSL triplet (h: 0–360, s: 0–100, l: 0–100) */
9
+ export interface HSL {
10
+ h: number;
11
+ s: number;
12
+ l: number;
13
+ }
14
+ /**
15
+ * Parse a hex color string (#RGB, #RRGGBB, or without #) into RGB.
16
+ */
17
+ export declare function hexToRgb(hex: string): RGB;
18
+ /**
19
+ * Convert RGB to HSL.
20
+ */
21
+ export declare function rgbToHsl({ r, g, b }: RGB): HSL;
22
+ /**
23
+ * Convert HSL back to RGB.
24
+ */
25
+ export declare function hslToRgb({ h, s, l }: HSL): RGB;
26
+ /**
27
+ * Convert RGB to hex string (#RRGGBB).
28
+ */
29
+ export declare function rgbToHex({ r, g, b }: RGB): string;
30
+ /**
31
+ * Convert a hex color directly to HSL.
32
+ */
33
+ export declare function hexToHsl(hex: string): HSL;
34
+ /**
35
+ * Convert a hex color directly to another hex by adjusting HSL.
36
+ */
37
+ export declare function adjustHsl(hex: string, adjustments: Partial<HSL>): string;
38
+ /**
39
+ * Generate a complete 50–950 color scale from a single base color.
40
+ *
41
+ * The base color is mapped to step 500. Lighter steps (50–400) are generated
42
+ * by increasing lightness, and darker steps (600–950) by decreasing it.
43
+ *
44
+ * @param baseHex The brand/base color as a hex string (e.g. '#409eff')
45
+ * @returns A complete ColorScale object
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const scale = generateColorScale('#409eff')
50
+ * console.log(scale[500]) // '#409eff'
51
+ * console.log(scale[100]) // light tint
52
+ * ```
53
+ */
54
+ export declare function generateColorScale(baseHex: string): ColorScale;
55
+ /**
56
+ * Input for full palette generation.
57
+ * Any omitted color will keep its default value.
58
+ */
59
+ export interface PaletteInput {
60
+ /** Primary / brand color */
61
+ primary?: string;
62
+ /** Success / positive color */
63
+ success?: string;
64
+ /** Warning / caution color */
65
+ warning?: string;
66
+ /** Danger / error color */
67
+ danger?: string;
68
+ /** Info / neutral accent color */
69
+ info?: string;
70
+ }
71
+ /**
72
+ * A complete palette containing color scales for all semantic colors.
73
+ */
74
+ export interface ColorPalette {
75
+ primary: ColorScale;
76
+ success: ColorScale;
77
+ warning: ColorScale;
78
+ danger: ColorScale;
79
+ info: ColorScale;
80
+ }
81
+ /**
82
+ * Generate a complete color palette from one or more brand colors.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * // Generate from a single brand color (others keep defaults)
87
+ * const palette = generatePalette({ primary: '#722ed1' })
88
+ *
89
+ * // Generate from all custom colors
90
+ * const custom = generatePalette({
91
+ * primary: '#722ed1',
92
+ * success: '#52c41a',
93
+ * warning: '#faad14',
94
+ * danger: '#ff4d4f',
95
+ * info: '#8c8c8c',
96
+ * })
97
+ * ```
98
+ */
99
+ export declare function generatePalette(input?: PaletteInput): ColorPalette;
100
+ /** CSS variable prefix used by ZC UI */
101
+ export declare const CSS_VAR_PREFIX = "--color-zc";
102
+ /**
103
+ * Generate CSS custom property declarations from a color palette.
104
+ *
105
+ * @param palette The palette to convert
106
+ * @param prefix CSS variable prefix (default: '--color-zc')
107
+ * @returns Record of CSS variable name → hex value
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const vars = paletteToCssVars(palette)
112
+ * // vars['--color-zc-primary-500'] = '#409eff'
113
+ * ```
114
+ */
115
+ export declare function paletteToCssVars(palette: ColorPalette, prefix?: string): Record<string, string>;
116
+ /**
117
+ * Generate a CSS string of `:root { ... }` declarations from a palette.
118
+ * Useful for generating theme CSS files.
119
+ *
120
+ * @param palette The palette to convert
121
+ * @param selector CSS selector (default: ':root')
122
+ * @param prefix CSS variable prefix
123
+ * @returns CSS text
124
+ */
125
+ export declare function paletteToCssText(palette: ColorPalette, selector?: string, prefix?: string): string;
126
+ /**
127
+ * Calculate the relative luminance of a hex color (for contrast calculation).
128
+ */
129
+ export declare function getLuminance(hex: string): number;
130
+ /**
131
+ * Calculate the contrast ratio between two hex colors (1–21).
132
+ */
133
+ export declare function getContrastRatio(hex1: string, hex2: string): number;
134
+ /**
135
+ * Pick the best text color (black or white) for a given background.
136
+ */
137
+ export declare function getReadableTextColor(bgHex: string): string;
138
+ //# sourceMappingURL=color-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-generator.d.ts","sourceRoot":"","sources":["../../src/color-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAM1C,+BAA+B;AAC/B,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,iDAAiD;AACjD,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAiBzC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,CAkC9C;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,CA2B9C;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAMjD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEzC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAQxE;AAyBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAuB9D;AAMD;;;GAGG;AACH,MAAM,WAAW,YA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color; 50 is the lightest tint; 950 is the darkest shade.
6
+ *
7
+ * Generation method:
8
+ * 50–400 = base mixed with white (progressively more base color)
9
+ * 500 = base color
10
+ * 600–950 = base mixed with black (progressively more black)
11
+ */
12
+ /** A 50–950 color ramp */
13
+ export type ColorScale = {
14
+ 50: string;
15
+ 100: string;
16
+ 200: string;
17
+ 300: string;
18
+ 400: string;
19
+ 500: string;
20
+ 600: string;
21
+ 700: string;
22
+ 800: string;
23
+ 900: string;
24
+ 950: string;
25
+ };
26
+ export declare const primaryScale: ColorScale;
27
+ export declare const successScale: ColorScale;
28
+ export declare const warningScale: ColorScale;
29
+ export declare const dangerScale: ColorScale;
30
+ export declare const infoScale: ColorScale;
31
+ export declare const colorScales: {
32
+ readonly primary: ColorScale;
33
+ readonly success: ColorScale;
34
+ readonly warning: ColorScale;
35
+ readonly danger: ColorScale;
36
+ readonly info: ColorScale;
37
+ };
38
+ /** Semantic names for the five color families */
39
+ export type ColorName = keyof typeof colorScales;
40
+ /** light-N variant lookup (1-9) for each color */
41
+ export declare const lightVariants: Record<ColorName, Record<number, string>>;
42
+ /** dark-N variant lookup for each color */
43
+ export declare const darkVariants: Record<ColorName, Record<number, string>>;
44
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0BAA0B;AAC1B,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAMD,eAAO,MAAM,YAAY,EAAE,UAY1B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,UAY1B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,UAY1B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,UAYzB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,UAYvB,CAAA;AAMD,eAAO,MAAM,WAAW;;;;;;CAMd,CAAA;AAEV,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,WAAW,CAAA;AAOhD,kDAAkD;AAClD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMnE,CAAA;AAED,2CAA2C;AAC3C,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMlE,CAAA"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * ZC UI Theme - CSS Layer Definitions
3
+ *
4
+ * CSS @layer provides a way to control the cascade order of stylesheets,
5
+ * ensuring that ZC UI component styles have a predictable priority
6
+ * relative to user overrides and third-party CSS.
7
+ *
8
+ * Layer order (lowest to highest specificity):
9
+ * 1. zc-reset — CSS reset / normalize (lowest)
10
+ * 2. zc-tokens — Design token CSS variables
11
+ * 3. zc-base — Base element styles
12
+ * 4. zc-components — Component styles (buttons, inputs, etc.)
13
+ * 5. zc-overrides — User / runtime theme overrides (highest)
14
+ *
15
+ * Usage in your CSS:
16
+ * @layer zc-reset, zc-tokens, zc-base, zc-components, zc-overrides;
17
+ *
18
+ * /* Your overrides automatically win over component styles *\/
19
+ * @layer zc-overrides {
20
+ * .my-button { ... }
21
+ * }
22
+ *
23
+ * Programmatic usage:
24
+ * import { cssLayerOrder, cssLayerStyleSheet } from '@zc-ui/theme'
25
+ * // Inject layer ordering into a shadow DOM or style element
26
+ */
27
+ /**
28
+ * The ordered list of CSS layer names used by ZC UI.
29
+ * Earlier layers have LOWER priority; later layers have HIGHER priority.
30
+ */
31
+ export declare const cssLayerOrder: readonly ["zc-reset", "zc-tokens", "zc-base", "zc-components", "zc-overrides"];
32
+ /** Union type of all CSS layer names */
33
+ export type ZcCssLayer = (typeof cssLayerOrder)[number];
34
+ /**
35
+ * The CSS `@layer` declaration string that establishes priority order.
36
+ *
37
+ * Place this at the very top of your CSS (before any other rules)
38
+ * to ensure consistent cascade behavior.
39
+ *
40
+ * @example
41
+ * ```css
42
+ * @layer zc-reset, zc-tokens, zc-base, zc-components, zc-overrides;
43
+ * ```
44
+ */
45
+ export declare const cssLayerDeclaration: string;
46
+ /**
47
+ * Generate a complete CSS string that sets up the layer order.
48
+ * Also includes base tokens in the zc-tokens layer.
49
+ *
50
+ * Useful for injecting into `<style>` tags or shadow DOM.
51
+ */
52
+ export declare function generateCssLayerSetup(): string;
53
+ /**
54
+ * Wrap a CSS string in a named layer.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const myCss = wrapInLayer('zc-overrides', `
59
+ * .my-button { background: red; }
60
+ * `)
61
+ * ```
62
+ */
63
+ export declare function wrapInLayer(layer: ZcCssLayer | string, css: string): string;
64
+ /**
65
+ * Create a CSSStyleSheet-like text with layer ordering for
66
+ * custom elements or shadow DOM.
67
+ *
68
+ * @param layers Custom layer order (default: cssLayerOrder)
69
+ * @returns CSS text with the @layer declaration
70
+ */
71
+ export declare function createLayeredStyleSheet(layers?: readonly string[]): string;
72
+ //# sourceMappingURL=css-layers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-layers.d.ts","sourceRoot":"","sources":["../../src/css-layers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,gFAMhB,CAAA;AAEV,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,QAAwC,CAAA;AAExE;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAW9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,GAAE,SAAS,MAAM,EAAkB,GACxC,MAAM,CAER"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * ZC UI Theme - Design tokens and CSS variables
3
+ */
4
+ export { colorScales, primaryScale, successScale, warningScale, dangerScale, infoScale, lightVariants, darkVariants, } from './colors';
5
+ export type { ColorScale, ColorName } from './colors';
6
+ export { generateColorScale, generatePalette, paletteToCssVars, paletteToCssText, hexToRgb, rgbToHex, hexToHsl, rgbToHsl, hslToRgb, adjustHsl, getLuminance, getContrastRatio, getReadableTextColor, CSS_VAR_PREFIX, } from './color-generator';
7
+ export type { PaletteInput, ColorPalette, RGB, HSL } from './color-generator';
8
+ export { lightTheme, darkTheme, createTheme, mergeThemes, getComponentOverrides, themeToCssText, componentShorthandToCssVars, } from './presets';
9
+ export type { ThemeVariables, ComponentThemeOverrides, ComponentShorthandOverrides, ThemePreset, CreateThemeOptions, } from './presets';
10
+ export { applyTheme, setBrandColor, setBrandColors, setThemeVariable, removeThemeVariable, applyDarkMode, clearThemeOverrides, applyComponentOverrides, removeComponentOverrides, registerTheme, unregisterTheme, getRegisteredTheme, listRegisteredThemes, switchTheme, getCurrentThemeName, createThemeController, } from './runtime-theme';
11
+ export type { ApplyThemeOptions } from './runtime-theme';
12
+ export { cssLayerOrder, cssLayerDeclaration, generateCssLayerSetup, wrapInLayer, createLayeredStyleSheet, } from './css-layers';
13
+ export type { ZcCssLayer } from './css-layers';
14
+ export { createNamespace, applyNamespace, removeNamespace, namespaceToCssText, createVarResolver, DEFAULT_CSS_VAR_PREFIX, } from './namespace';
15
+ export type { CssVarNamespace, CreateNamespaceOptions } from './namespace';
16
+ /**
17
+ * Legacy single-value color tokens (500 = base).
18
+ * Kept for backward compatibility.
19
+ */
20
+ export declare const colors: {
21
+ readonly primary: string;
22
+ readonly success: string;
23
+ readonly warning: string;
24
+ readonly danger: string;
25
+ readonly info: string;
26
+ readonly text: {
27
+ readonly primary: "#303133";
28
+ readonly regular: "#606266";
29
+ readonly secondary: "#909399";
30
+ readonly placeholder: "#a8abb2";
31
+ };
32
+ readonly border: {
33
+ readonly base: "#dcdfe6";
34
+ readonly light: "#e4e7ed";
35
+ readonly lighter: "#ebeef5";
36
+ readonly extraLight: "#f2f6fc";
37
+ };
38
+ readonly fill: {
39
+ readonly base: "#f0f2f5";
40
+ readonly light: "#f5f7fa";
41
+ readonly lighter: "#fafafa";
42
+ };
43
+ };
44
+ /**
45
+ * Font size design tokens
46
+ */
47
+ export declare const fontSizes: {
48
+ readonly xs: "12px";
49
+ readonly sm: "13px";
50
+ readonly base: "14px";
51
+ readonly md: "16px";
52
+ readonly lg: "18px";
53
+ readonly xl: "20px";
54
+ };
55
+ /**
56
+ * Spacing design tokens
57
+ */
58
+ export declare const spacing: {
59
+ readonly xs: "4px";
60
+ readonly sm: "8px";
61
+ readonly base: "12px";
62
+ readonly md: "16px";
63
+ readonly lg: "24px";
64
+ readonly xl: "32px";
65
+ };
66
+ /**
67
+ * Border radius design tokens
68
+ */
69
+ export declare const borderRadius: {
70
+ readonly sm: "2px";
71
+ readonly base: "4px";
72
+ readonly md: "6px";
73
+ readonly lg: "8px";
74
+ readonly round: "20px";
75
+ readonly circle: "50%";
76
+ };
77
+ /**
78
+ * Shadow (box-shadow) design tokens.
79
+ * Used by cards, popovers, modals, etc.
80
+ */
81
+ export declare const shadows: {
82
+ readonly sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)";
83
+ readonly base: "0 2px 8px 0 rgba(0, 0, 0, 0.08)";
84
+ readonly md: "0 4px 12px 0 rgba(0, 0, 0, 0.1)";
85
+ readonly lg: "0 8px 24px 0 rgba(0, 0, 0, 0.12)";
86
+ readonly xl: "0 16px 48px 0 rgba(0, 0, 0, 0.16)";
87
+ readonly dark: "0 4px 12px 0 rgba(0, 0, 0, 0.5)";
88
+ };
89
+ /**
90
+ * Transition design tokens.
91
+ * Unified animation duration and easing for all components.
92
+ */
93
+ export declare const transitions: {
94
+ readonly duration: {
95
+ readonly fast: "0.15s";
96
+ readonly base: "0.25s";
97
+ readonly slow: "0.35s";
98
+ };
99
+ readonly timingFunction: {
100
+ readonly easeIn: "cubic-bezier(0.4, 0, 1, 1)";
101
+ readonly easeOut: "cubic-bezier(0, 0, 0.2, 1)";
102
+ readonly easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)";
103
+ readonly sharp: "cubic-bezier(0.4, 0, 0.6, 1)";
104
+ };
105
+ };
106
+ /**
107
+ * Z-index layer tokens.
108
+ * Ensures consistent stacking order across components.
109
+ */
110
+ export declare const zIndex: {
111
+ readonly base: 1;
112
+ readonly dropdown: 1000;
113
+ readonly sticky: 1100;
114
+ readonly fixed: 1200;
115
+ readonly modal: 1300;
116
+ readonly popover: 1400;
117
+ readonly tooltip: 1500;
118
+ readonly message: 1600;
119
+ };
120
+ /**
121
+ * CSS variable name prefix
122
+ */
123
+ export declare const cssVarPrefix = "--zc";
124
+ /**
125
+ * Dark mode color overrides.
126
+ * Applied when the `.dark` class is present on <html>.
127
+ */
128
+ export declare const darkColors: {
129
+ readonly text: {
130
+ readonly primary: "#e5eaf3";
131
+ readonly regular: "#cfd3dc";
132
+ readonly secondary: "#a3a6ad";
133
+ readonly placeholder: "#8d9095";
134
+ };
135
+ readonly border: {
136
+ readonly base: "#4c4d4f";
137
+ readonly light: "#414243";
138
+ readonly lighter: "#363637";
139
+ readonly extraLight: "#2b2b2c";
140
+ };
141
+ readonly fill: {
142
+ readonly base: "#303030";
143
+ readonly light: "#262727";
144
+ readonly lighter: "#1d1d1d";
145
+ };
146
+ };
147
+ /**
148
+ * Toggle dark mode on/off.
149
+ * Adds or removes the `dark` class on the <html> element.
150
+ */
151
+ export declare function toggleDark(isDark?: boolean): boolean;
152
+ /**
153
+ * Check if dark mode is currently active.
154
+ */
155
+ export declare function isDarkMode(): boolean;
156
+ /**
157
+ * Set the theme explicitly.
158
+ * @param mode 'light' or 'dark'
159
+ */
160
+ export declare function setTheme(mode: 'light' | 'dark'): void;
161
+ /**
162
+ * Get the current theme mode.
163
+ */
164
+ export declare function getTheme(): 'light' | 'dark';
165
+ /**
166
+ * Tailwind CSS v4 theme mapping reference.
167
+ *
168
+ * Note: The actual Tailwind integration is handled by `styles.css`
169
+ * using the CSS-first `@theme` block. This object is kept as a
170
+ * programmatic reference that includes the full color scale.
171
+ */
172
+ export declare const tailwindTheme: {
173
+ readonly colors: {
174
+ readonly primary: import('./colors').ColorScale;
175
+ readonly success: import('./colors').ColorScale;
176
+ readonly warning: import('./colors').ColorScale;
177
+ readonly danger: import('./colors').ColorScale;
178
+ readonly info: import('./colors').ColorScale;
179
+ };
180
+ };
181
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,aAAa,EACb,YAAY,GACb,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGrD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE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AEV;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;CAST,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA;AAElC;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;CAkBb,CAAA;AASV;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAKpD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAOrD;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,OAAO,GAAG,MAAM,CAE3C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;CAQhB,CAAA"}
@@ -0,0 +1,79 @@
1
+ import { PaletteInput } from './color-generator';
2
+ import { ThemeVariables, ThemePreset } from './presets';
3
+ /**
4
+ * A CSS variable namespace definition.
5
+ */
6
+ export interface CssVarNamespace {
7
+ /** Unique name / prefix for this namespace */
8
+ name: string;
9
+ /** CSS variables scoped to this namespace */
10
+ variables: ThemeVariables;
11
+ }
12
+ /**
13
+ * Options for creating a CSS variable namespace.
14
+ */
15
+ export interface CreateNamespaceOptions {
16
+ /** Brand colors to generate scales for */
17
+ brandColors?: PaletteInput;
18
+ /** Additional CSS variables */
19
+ variables?: ThemeVariables;
20
+ /** A theme preset to use as the base */
21
+ preset?: ThemePreset;
22
+ }
23
+ /**
24
+ * Default ZC UI CSS variable prefix.
25
+ */
26
+ export declare const DEFAULT_CSS_VAR_PREFIX = "--color-zc";
27
+ /**
28
+ * Create a CSS variable namespace with a custom prefix.
29
+ *
30
+ * Variables are generated as `--color-{name}-{semanticColor}-{step}`.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const ns = createNamespace('brand-a', {
35
+ * brandColors: { primary: '#722ed1' },
36
+ * })
37
+ * // ns.variables['--color-brand-a-primary-500'] = '#...'
38
+ * ```
39
+ */
40
+ export declare function createNamespace(name: string, options?: CreateNamespaceOptions): CssVarNamespace;
41
+ /**
42
+ * Apply a namespace's CSS variables to a target element.
43
+ *
44
+ * @param element The HTML element to apply variables to
45
+ * @param namespace The namespace to apply
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const ns = createNamespace('brand-a', { brandColors: { primary: '#722ed1' } })
50
+ * applyNamespace(document.querySelector('.brand-a-section'), ns)
51
+ * ```
52
+ */
53
+ export declare function applyNamespace(element: HTMLElement, namespace: CssVarNamespace): void;
54
+ /**
55
+ * Remove a namespace's CSS variables from a target element.
56
+ */
57
+ export declare function removeNamespace(element: HTMLElement, namespace: CssVarNamespace): void;
58
+ /**
59
+ * Generate a CSS text block for a namespace.
60
+ * Useful for creating stylesheets or `<style>` tags.
61
+ *
62
+ * @param namespace The namespace to convert
63
+ * @param selector CSS selector (default: ':root')
64
+ * @returns CSS text
65
+ */
66
+ export declare function namespaceToCssText(namespace: CssVarNamespace, selector?: string): string;
67
+ /**
68
+ * Create a scoped CSS variable resolver.
69
+ * Returns a function that converts standard ZC variable names
70
+ * to namespace-specific ones.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const resolve = createVarResolver('brand-a')
75
+ * resolve('--color-zc-primary-500') // '--color-brand-a-primary-500'
76
+ * ```
77
+ */
78
+ export declare function createVarResolver(namespaceName: string): (cssVar: string) => string;
79
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/namespace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAM5D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,SAAS,EAAE,cAAc,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,0CAA0C;IAC1C,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,+BAA+B;IAC/B,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,wCAAwC;IACxC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAMD;;GAEG;AACH,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAElD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAkCjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,eAAe,GACzB,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,eAAe,GACzB,IAAI,CAIN;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,EAC1B,QAAQ,SAAU,GACjB,MAAM,CAMR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,GACpB,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAQ5B"}