@tenphi/glaze 0.3.0 → 0.5.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/README.md +281 -44
- package/dist/index.cjs +202 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -11
- package/dist/index.d.mts +129 -11
- package/dist/index.mjs +202 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -62,7 +62,15 @@ interface GlazeOutputModes {
|
|
|
62
62
|
/** Include high-contrast variants (both light-HC and dark-HC). Default: false. */
|
|
63
63
|
highContrast?: boolean;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
/** Hex color string for DX hints. Runtime validation in `parseHex()`. */
|
|
66
|
+
type HexColor = `#${string}`;
|
|
67
|
+
/** Direct OKHSL color input. */
|
|
68
|
+
interface OkhslColor {
|
|
69
|
+
h: number;
|
|
70
|
+
s: number;
|
|
71
|
+
l: number;
|
|
72
|
+
}
|
|
73
|
+
interface RegularColorDef {
|
|
66
74
|
/**
|
|
67
75
|
* Lightness value (0–100).
|
|
68
76
|
* - Number: absolute lightness.
|
|
@@ -83,7 +91,60 @@ interface ColorDef {
|
|
|
83
91
|
contrast?: HCPair<MinContrast>;
|
|
84
92
|
/** Adaptation mode. Default: 'auto'. */
|
|
85
93
|
mode?: AdaptationMode;
|
|
94
|
+
/**
|
|
95
|
+
* Fixed opacity (0–1).
|
|
96
|
+
* Output includes alpha in the CSS value.
|
|
97
|
+
* Does not affect contrast resolution — a semi-transparent color
|
|
98
|
+
* has no fixed perceived lightness, so `contrast` and `opacity`
|
|
99
|
+
* should not be combined (a console.warn is emitted).
|
|
100
|
+
*/
|
|
101
|
+
opacity?: number;
|
|
86
102
|
}
|
|
103
|
+
/** Shadow tuning knobs. All values use the 0–1 scale (OKHSL). */
|
|
104
|
+
interface ShadowTuning {
|
|
105
|
+
/** Fraction of fg saturation kept in pigment (0-1). Default: 0.18. */
|
|
106
|
+
saturationFactor?: number;
|
|
107
|
+
/** Upper clamp on pigment saturation (0-1). Default: 0.25. */
|
|
108
|
+
maxSaturation?: number;
|
|
109
|
+
/** Multiplier for bg lightness → pigment lightness. Default: 0.25. */
|
|
110
|
+
lightnessFactor?: number;
|
|
111
|
+
/** [min, max] clamp for pigment lightness (0-1). Default: [0.05, 0.20]. */
|
|
112
|
+
lightnessBounds?: [number, number];
|
|
113
|
+
/**
|
|
114
|
+
* Target minimum gap between pigment lightness and bg lightness (0-1).
|
|
115
|
+
* Default: 0.05.
|
|
116
|
+
*/
|
|
117
|
+
minGapTarget?: number;
|
|
118
|
+
/** Asymptotic max alpha (0-1). Default: 0.6. */
|
|
119
|
+
alphaMax?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Blend weight (0-1) pulling pigment hue toward bg hue.
|
|
122
|
+
* 0 = pure fg hue, 1 = pure bg hue. Default: 0.2.
|
|
123
|
+
*/
|
|
124
|
+
bgHueBlend?: number;
|
|
125
|
+
}
|
|
126
|
+
interface ShadowColorDef {
|
|
127
|
+
type: 'shadow';
|
|
128
|
+
/**
|
|
129
|
+
* Background color name — the surface the shadow sits on.
|
|
130
|
+
* Must reference a non-shadow color in the same theme.
|
|
131
|
+
*/
|
|
132
|
+
bg: string;
|
|
133
|
+
/**
|
|
134
|
+
* Foreground color name for tinting and intensity modulation.
|
|
135
|
+
* Must reference a non-shadow color in the same theme.
|
|
136
|
+
* Omit for achromatic shadow at full user-specified intensity.
|
|
137
|
+
*/
|
|
138
|
+
fg?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Shadow intensity, 0-100.
|
|
141
|
+
* Supports [normal, highContrast] pair.
|
|
142
|
+
*/
|
|
143
|
+
intensity: HCPair<number>;
|
|
144
|
+
/** Override default tuning. Merged field-by-field with global `shadowTuning`. */
|
|
145
|
+
tuning?: ShadowTuning;
|
|
146
|
+
}
|
|
147
|
+
type ColorDef = RegularColorDef | ShadowColorDef;
|
|
87
148
|
type ColorMap = Record<string, ColorDef>;
|
|
88
149
|
/** Resolved color for a single scheme variant. */
|
|
89
150
|
interface ResolvedColorVariant {
|
|
@@ -93,6 +154,8 @@ interface ResolvedColorVariant {
|
|
|
93
154
|
s: number;
|
|
94
155
|
/** OKHSL lightness (0–1). */
|
|
95
156
|
l: number;
|
|
157
|
+
/** Opacity (0–1). Default: 1. */
|
|
158
|
+
alpha: number;
|
|
96
159
|
}
|
|
97
160
|
/** Fully resolved color across all scheme variants. */
|
|
98
161
|
interface ResolvedColor {
|
|
@@ -101,7 +164,8 @@ interface ResolvedColor {
|
|
|
101
164
|
dark: ResolvedColorVariant;
|
|
102
165
|
lightContrast: ResolvedColorVariant;
|
|
103
166
|
darkContrast: ResolvedColorVariant;
|
|
104
|
-
mode
|
|
167
|
+
/** Adaptation mode. Present only for regular colors, omitted for shadows. */
|
|
168
|
+
mode?: AdaptationMode;
|
|
105
169
|
}
|
|
106
170
|
interface GlazeConfig {
|
|
107
171
|
/** Dark scheme lightness window [lo, hi]. Default: [10, 90]. */
|
|
@@ -115,6 +179,8 @@ interface GlazeConfig {
|
|
|
115
179
|
};
|
|
116
180
|
/** Which scheme variants to include in exports. Default: both true. */
|
|
117
181
|
modes?: GlazeOutputModes;
|
|
182
|
+
/** Default tuning for all shadow colors. Per-color tuning merges field-by-field. */
|
|
183
|
+
shadowTuning?: ShadowTuning;
|
|
118
184
|
}
|
|
119
185
|
interface GlazeConfigResolved {
|
|
120
186
|
darkLightness: [number, number];
|
|
@@ -124,6 +190,7 @@ interface GlazeConfigResolved {
|
|
|
124
190
|
highContrast: string;
|
|
125
191
|
};
|
|
126
192
|
modes: Required<GlazeOutputModes>;
|
|
193
|
+
shadowTuning?: ShadowTuning;
|
|
127
194
|
}
|
|
128
195
|
/** Serialized theme configuration (no resolved values). */
|
|
129
196
|
interface GlazeThemeExport {
|
|
@@ -131,6 +198,16 @@ interface GlazeThemeExport {
|
|
|
131
198
|
saturation: number;
|
|
132
199
|
colors: ColorMap;
|
|
133
200
|
}
|
|
201
|
+
/** Input for `glaze.shadow()` standalone factory. */
|
|
202
|
+
interface GlazeShadowInput {
|
|
203
|
+
/** Background color — hex string or OKHSL { h, s (0-1), l (0-1) }. */
|
|
204
|
+
bg: HexColor | OkhslColor;
|
|
205
|
+
/** Foreground color for tinting + intensity modulation. */
|
|
206
|
+
fg?: HexColor | OkhslColor;
|
|
207
|
+
/** Intensity 0-100. */
|
|
208
|
+
intensity: number;
|
|
209
|
+
tuning?: ShadowTuning;
|
|
210
|
+
}
|
|
134
211
|
/** Input for `glaze.color()` standalone factory. */
|
|
135
212
|
interface GlazeColorInput {
|
|
136
213
|
hue: number;
|
|
@@ -145,6 +222,12 @@ interface GlazeColorToken {
|
|
|
145
222
|
resolve(): ResolvedColor;
|
|
146
223
|
/** Export as a flat token map (no color name key). */
|
|
147
224
|
token(options?: GlazeTokenOptions): Record<string, string>;
|
|
225
|
+
/**
|
|
226
|
+
* Export as a tasty style-to-state binding (no color name key).
|
|
227
|
+
* Uses `#name` keys and state aliases (`''`, `@dark`, etc.).
|
|
228
|
+
* @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
|
|
229
|
+
*/
|
|
230
|
+
tasty(options?: GlazeTokenOptions): Record<string, string>;
|
|
148
231
|
/** Export as a flat JSON map (no color name key). */
|
|
149
232
|
json(options?: GlazeJsonOptions): Record<string, string>;
|
|
150
233
|
}
|
|
@@ -173,8 +256,22 @@ interface GlazeTheme {
|
|
|
173
256
|
extend(options: GlazeExtendOptions): GlazeTheme;
|
|
174
257
|
/** Resolve all colors and return the result map. */
|
|
175
258
|
resolve(): Map<string, ResolvedColor>;
|
|
176
|
-
/**
|
|
177
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Export as a flat token map grouped by scheme variant.
|
|
261
|
+
*
|
|
262
|
+
* ```ts
|
|
263
|
+
* theme.tokens()
|
|
264
|
+
* // → { light: { surface: 'okhsl(...)' }, dark: { surface: 'okhsl(...)' } }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
tokens(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
|
|
268
|
+
/**
|
|
269
|
+
* Export as tasty style-to-state bindings.
|
|
270
|
+
* Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
|
|
271
|
+
* Spread into component styles or register as a recipe via `configure({ recipes })`.
|
|
272
|
+
* @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
|
|
273
|
+
*/
|
|
274
|
+
tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
|
|
178
275
|
/** Export as plain JSON. */
|
|
179
276
|
json(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
|
|
180
277
|
/** Export as CSS custom property declarations. */
|
|
@@ -218,8 +315,24 @@ interface GlazeCssResult {
|
|
|
218
315
|
darkContrast: string;
|
|
219
316
|
}
|
|
220
317
|
interface GlazePalette {
|
|
221
|
-
/**
|
|
222
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Export all themes as a flat token map grouped by scheme variant.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* palette.tokens({ prefix: true })
|
|
323
|
+
* // → { light: { 'primary-surface': 'okhsl(...)' }, dark: { 'primary-surface': 'okhsl(...)' } }
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
tokens(options?: GlazeJsonOptions & {
|
|
327
|
+
prefix?: boolean | Record<string, string>;
|
|
328
|
+
}): Record<string, Record<string, string>>;
|
|
329
|
+
/**
|
|
330
|
+
* Export all themes as tasty style-to-state bindings.
|
|
331
|
+
* Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
|
|
332
|
+
* Spread into component styles or register as a recipe via `configure({ recipes })`.
|
|
333
|
+
* @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
|
|
334
|
+
*/
|
|
335
|
+
tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
|
|
223
336
|
/** Export all themes as plain JSON. */
|
|
224
337
|
json(options?: GlazeJsonOptions & {
|
|
225
338
|
prefix?: boolean | Record<string, string>;
|
|
@@ -249,7 +362,10 @@ declare function glaze(hueOrOptions: number | {
|
|
|
249
362
|
declare namespace glaze {
|
|
250
363
|
var configure: (config: GlazeConfig) => void;
|
|
251
364
|
var palette: (themes: PaletteInput) => {
|
|
252
|
-
tokens(options?:
|
|
365
|
+
tokens(options?: GlazeJsonOptions & {
|
|
366
|
+
prefix?: boolean | Record<string, string>;
|
|
367
|
+
}): Record<string, Record<string, string>>;
|
|
368
|
+
tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
|
|
253
369
|
json(options?: GlazeJsonOptions & {
|
|
254
370
|
prefix?: boolean | Record<string, string>;
|
|
255
371
|
}): Record<string, Record<string, Record<string, string>>>;
|
|
@@ -259,6 +375,8 @@ declare namespace glaze {
|
|
|
259
375
|
};
|
|
260
376
|
var from: (data: GlazeThemeExport) => GlazeTheme;
|
|
261
377
|
var color: (input: GlazeColorInput) => GlazeColorToken;
|
|
378
|
+
var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
|
|
379
|
+
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
|
|
262
380
|
var fromHex: (hex: string) => GlazeTheme;
|
|
263
381
|
var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
|
|
264
382
|
var getConfig: () => GlazeConfigResolved;
|
|
@@ -311,20 +429,20 @@ declare function parseHex(hex: string): [number, number, number] | null;
|
|
|
311
429
|
*/
|
|
312
430
|
declare function formatOkhsl(h: number, s: number, l: number): string;
|
|
313
431
|
/**
|
|
314
|
-
* Format OKHSL values as a CSS `rgb(R
|
|
432
|
+
* Format OKHSL values as a CSS `rgb(R G B)` string with rounded integer values.
|
|
315
433
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
316
434
|
*/
|
|
317
435
|
declare function formatRgb(h: number, s: number, l: number): string;
|
|
318
436
|
/**
|
|
319
|
-
* Format OKHSL values as a CSS `hsl(H
|
|
437
|
+
* Format OKHSL values as a CSS `hsl(H S% L%)` string.
|
|
320
438
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
321
439
|
*/
|
|
322
440
|
declare function formatHsl(h: number, s: number, l: number): string;
|
|
323
441
|
/**
|
|
324
|
-
* Format OKHSL values as a CSS `oklch(L
|
|
442
|
+
* Format OKHSL values as a CSS `oklch(L C H)` string.
|
|
325
443
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
326
444
|
*/
|
|
327
445
|
declare function formatOklch(h: number, s: number, l: number): string;
|
|
328
446
|
//#endregion
|
|
329
|
-
export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type MinContrast, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, contrastRatioFromLuminance, findLightnessForContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
|
|
447
|
+
export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type OkhslColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
|
|
330
448
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -62,7 +62,15 @@ interface GlazeOutputModes {
|
|
|
62
62
|
/** Include high-contrast variants (both light-HC and dark-HC). Default: false. */
|
|
63
63
|
highContrast?: boolean;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
/** Hex color string for DX hints. Runtime validation in `parseHex()`. */
|
|
66
|
+
type HexColor = `#${string}`;
|
|
67
|
+
/** Direct OKHSL color input. */
|
|
68
|
+
interface OkhslColor {
|
|
69
|
+
h: number;
|
|
70
|
+
s: number;
|
|
71
|
+
l: number;
|
|
72
|
+
}
|
|
73
|
+
interface RegularColorDef {
|
|
66
74
|
/**
|
|
67
75
|
* Lightness value (0–100).
|
|
68
76
|
* - Number: absolute lightness.
|
|
@@ -83,7 +91,60 @@ interface ColorDef {
|
|
|
83
91
|
contrast?: HCPair<MinContrast>;
|
|
84
92
|
/** Adaptation mode. Default: 'auto'. */
|
|
85
93
|
mode?: AdaptationMode;
|
|
94
|
+
/**
|
|
95
|
+
* Fixed opacity (0–1).
|
|
96
|
+
* Output includes alpha in the CSS value.
|
|
97
|
+
* Does not affect contrast resolution — a semi-transparent color
|
|
98
|
+
* has no fixed perceived lightness, so `contrast` and `opacity`
|
|
99
|
+
* should not be combined (a console.warn is emitted).
|
|
100
|
+
*/
|
|
101
|
+
opacity?: number;
|
|
86
102
|
}
|
|
103
|
+
/** Shadow tuning knobs. All values use the 0–1 scale (OKHSL). */
|
|
104
|
+
interface ShadowTuning {
|
|
105
|
+
/** Fraction of fg saturation kept in pigment (0-1). Default: 0.18. */
|
|
106
|
+
saturationFactor?: number;
|
|
107
|
+
/** Upper clamp on pigment saturation (0-1). Default: 0.25. */
|
|
108
|
+
maxSaturation?: number;
|
|
109
|
+
/** Multiplier for bg lightness → pigment lightness. Default: 0.25. */
|
|
110
|
+
lightnessFactor?: number;
|
|
111
|
+
/** [min, max] clamp for pigment lightness (0-1). Default: [0.05, 0.20]. */
|
|
112
|
+
lightnessBounds?: [number, number];
|
|
113
|
+
/**
|
|
114
|
+
* Target minimum gap between pigment lightness and bg lightness (0-1).
|
|
115
|
+
* Default: 0.05.
|
|
116
|
+
*/
|
|
117
|
+
minGapTarget?: number;
|
|
118
|
+
/** Asymptotic max alpha (0-1). Default: 0.6. */
|
|
119
|
+
alphaMax?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Blend weight (0-1) pulling pigment hue toward bg hue.
|
|
122
|
+
* 0 = pure fg hue, 1 = pure bg hue. Default: 0.2.
|
|
123
|
+
*/
|
|
124
|
+
bgHueBlend?: number;
|
|
125
|
+
}
|
|
126
|
+
interface ShadowColorDef {
|
|
127
|
+
type: 'shadow';
|
|
128
|
+
/**
|
|
129
|
+
* Background color name — the surface the shadow sits on.
|
|
130
|
+
* Must reference a non-shadow color in the same theme.
|
|
131
|
+
*/
|
|
132
|
+
bg: string;
|
|
133
|
+
/**
|
|
134
|
+
* Foreground color name for tinting and intensity modulation.
|
|
135
|
+
* Must reference a non-shadow color in the same theme.
|
|
136
|
+
* Omit for achromatic shadow at full user-specified intensity.
|
|
137
|
+
*/
|
|
138
|
+
fg?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Shadow intensity, 0-100.
|
|
141
|
+
* Supports [normal, highContrast] pair.
|
|
142
|
+
*/
|
|
143
|
+
intensity: HCPair<number>;
|
|
144
|
+
/** Override default tuning. Merged field-by-field with global `shadowTuning`. */
|
|
145
|
+
tuning?: ShadowTuning;
|
|
146
|
+
}
|
|
147
|
+
type ColorDef = RegularColorDef | ShadowColorDef;
|
|
87
148
|
type ColorMap = Record<string, ColorDef>;
|
|
88
149
|
/** Resolved color for a single scheme variant. */
|
|
89
150
|
interface ResolvedColorVariant {
|
|
@@ -93,6 +154,8 @@ interface ResolvedColorVariant {
|
|
|
93
154
|
s: number;
|
|
94
155
|
/** OKHSL lightness (0–1). */
|
|
95
156
|
l: number;
|
|
157
|
+
/** Opacity (0–1). Default: 1. */
|
|
158
|
+
alpha: number;
|
|
96
159
|
}
|
|
97
160
|
/** Fully resolved color across all scheme variants. */
|
|
98
161
|
interface ResolvedColor {
|
|
@@ -101,7 +164,8 @@ interface ResolvedColor {
|
|
|
101
164
|
dark: ResolvedColorVariant;
|
|
102
165
|
lightContrast: ResolvedColorVariant;
|
|
103
166
|
darkContrast: ResolvedColorVariant;
|
|
104
|
-
mode
|
|
167
|
+
/** Adaptation mode. Present only for regular colors, omitted for shadows. */
|
|
168
|
+
mode?: AdaptationMode;
|
|
105
169
|
}
|
|
106
170
|
interface GlazeConfig {
|
|
107
171
|
/** Dark scheme lightness window [lo, hi]. Default: [10, 90]. */
|
|
@@ -115,6 +179,8 @@ interface GlazeConfig {
|
|
|
115
179
|
};
|
|
116
180
|
/** Which scheme variants to include in exports. Default: both true. */
|
|
117
181
|
modes?: GlazeOutputModes;
|
|
182
|
+
/** Default tuning for all shadow colors. Per-color tuning merges field-by-field. */
|
|
183
|
+
shadowTuning?: ShadowTuning;
|
|
118
184
|
}
|
|
119
185
|
interface GlazeConfigResolved {
|
|
120
186
|
darkLightness: [number, number];
|
|
@@ -124,6 +190,7 @@ interface GlazeConfigResolved {
|
|
|
124
190
|
highContrast: string;
|
|
125
191
|
};
|
|
126
192
|
modes: Required<GlazeOutputModes>;
|
|
193
|
+
shadowTuning?: ShadowTuning;
|
|
127
194
|
}
|
|
128
195
|
/** Serialized theme configuration (no resolved values). */
|
|
129
196
|
interface GlazeThemeExport {
|
|
@@ -131,6 +198,16 @@ interface GlazeThemeExport {
|
|
|
131
198
|
saturation: number;
|
|
132
199
|
colors: ColorMap;
|
|
133
200
|
}
|
|
201
|
+
/** Input for `glaze.shadow()` standalone factory. */
|
|
202
|
+
interface GlazeShadowInput {
|
|
203
|
+
/** Background color — hex string or OKHSL { h, s (0-1), l (0-1) }. */
|
|
204
|
+
bg: HexColor | OkhslColor;
|
|
205
|
+
/** Foreground color for tinting + intensity modulation. */
|
|
206
|
+
fg?: HexColor | OkhslColor;
|
|
207
|
+
/** Intensity 0-100. */
|
|
208
|
+
intensity: number;
|
|
209
|
+
tuning?: ShadowTuning;
|
|
210
|
+
}
|
|
134
211
|
/** Input for `glaze.color()` standalone factory. */
|
|
135
212
|
interface GlazeColorInput {
|
|
136
213
|
hue: number;
|
|
@@ -145,6 +222,12 @@ interface GlazeColorToken {
|
|
|
145
222
|
resolve(): ResolvedColor;
|
|
146
223
|
/** Export as a flat token map (no color name key). */
|
|
147
224
|
token(options?: GlazeTokenOptions): Record<string, string>;
|
|
225
|
+
/**
|
|
226
|
+
* Export as a tasty style-to-state binding (no color name key).
|
|
227
|
+
* Uses `#name` keys and state aliases (`''`, `@dark`, etc.).
|
|
228
|
+
* @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
|
|
229
|
+
*/
|
|
230
|
+
tasty(options?: GlazeTokenOptions): Record<string, string>;
|
|
148
231
|
/** Export as a flat JSON map (no color name key). */
|
|
149
232
|
json(options?: GlazeJsonOptions): Record<string, string>;
|
|
150
233
|
}
|
|
@@ -173,8 +256,22 @@ interface GlazeTheme {
|
|
|
173
256
|
extend(options: GlazeExtendOptions): GlazeTheme;
|
|
174
257
|
/** Resolve all colors and return the result map. */
|
|
175
258
|
resolve(): Map<string, ResolvedColor>;
|
|
176
|
-
/**
|
|
177
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Export as a flat token map grouped by scheme variant.
|
|
261
|
+
*
|
|
262
|
+
* ```ts
|
|
263
|
+
* theme.tokens()
|
|
264
|
+
* // → { light: { surface: 'okhsl(...)' }, dark: { surface: 'okhsl(...)' } }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
tokens(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
|
|
268
|
+
/**
|
|
269
|
+
* Export as tasty style-to-state bindings.
|
|
270
|
+
* Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
|
|
271
|
+
* Spread into component styles or register as a recipe via `configure({ recipes })`.
|
|
272
|
+
* @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
|
|
273
|
+
*/
|
|
274
|
+
tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
|
|
178
275
|
/** Export as plain JSON. */
|
|
179
276
|
json(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
|
|
180
277
|
/** Export as CSS custom property declarations. */
|
|
@@ -218,8 +315,24 @@ interface GlazeCssResult {
|
|
|
218
315
|
darkContrast: string;
|
|
219
316
|
}
|
|
220
317
|
interface GlazePalette {
|
|
221
|
-
/**
|
|
222
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Export all themes as a flat token map grouped by scheme variant.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* palette.tokens({ prefix: true })
|
|
323
|
+
* // → { light: { 'primary-surface': 'okhsl(...)' }, dark: { 'primary-surface': 'okhsl(...)' } }
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
tokens(options?: GlazeJsonOptions & {
|
|
327
|
+
prefix?: boolean | Record<string, string>;
|
|
328
|
+
}): Record<string, Record<string, string>>;
|
|
329
|
+
/**
|
|
330
|
+
* Export all themes as tasty style-to-state bindings.
|
|
331
|
+
* Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
|
|
332
|
+
* Spread into component styles or register as a recipe via `configure({ recipes })`.
|
|
333
|
+
* @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
|
|
334
|
+
*/
|
|
335
|
+
tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
|
|
223
336
|
/** Export all themes as plain JSON. */
|
|
224
337
|
json(options?: GlazeJsonOptions & {
|
|
225
338
|
prefix?: boolean | Record<string, string>;
|
|
@@ -249,7 +362,10 @@ declare function glaze(hueOrOptions: number | {
|
|
|
249
362
|
declare namespace glaze {
|
|
250
363
|
var configure: (config: GlazeConfig) => void;
|
|
251
364
|
var palette: (themes: PaletteInput) => {
|
|
252
|
-
tokens(options?:
|
|
365
|
+
tokens(options?: GlazeJsonOptions & {
|
|
366
|
+
prefix?: boolean | Record<string, string>;
|
|
367
|
+
}): Record<string, Record<string, string>>;
|
|
368
|
+
tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
|
|
253
369
|
json(options?: GlazeJsonOptions & {
|
|
254
370
|
prefix?: boolean | Record<string, string>;
|
|
255
371
|
}): Record<string, Record<string, Record<string, string>>>;
|
|
@@ -259,6 +375,8 @@ declare namespace glaze {
|
|
|
259
375
|
};
|
|
260
376
|
var from: (data: GlazeThemeExport) => GlazeTheme;
|
|
261
377
|
var color: (input: GlazeColorInput) => GlazeColorToken;
|
|
378
|
+
var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
|
|
379
|
+
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
|
|
262
380
|
var fromHex: (hex: string) => GlazeTheme;
|
|
263
381
|
var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
|
|
264
382
|
var getConfig: () => GlazeConfigResolved;
|
|
@@ -311,20 +429,20 @@ declare function parseHex(hex: string): [number, number, number] | null;
|
|
|
311
429
|
*/
|
|
312
430
|
declare function formatOkhsl(h: number, s: number, l: number): string;
|
|
313
431
|
/**
|
|
314
|
-
* Format OKHSL values as a CSS `rgb(R
|
|
432
|
+
* Format OKHSL values as a CSS `rgb(R G B)` string with rounded integer values.
|
|
315
433
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
316
434
|
*/
|
|
317
435
|
declare function formatRgb(h: number, s: number, l: number): string;
|
|
318
436
|
/**
|
|
319
|
-
* Format OKHSL values as a CSS `hsl(H
|
|
437
|
+
* Format OKHSL values as a CSS `hsl(H S% L%)` string.
|
|
320
438
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
321
439
|
*/
|
|
322
440
|
declare function formatHsl(h: number, s: number, l: number): string;
|
|
323
441
|
/**
|
|
324
|
-
* Format OKHSL values as a CSS `oklch(L
|
|
442
|
+
* Format OKHSL values as a CSS `oklch(L C H)` string.
|
|
325
443
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
326
444
|
*/
|
|
327
445
|
declare function formatOklch(h: number, s: number, l: number): string;
|
|
328
446
|
//#endregion
|
|
329
|
-
export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type MinContrast, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, contrastRatioFromLuminance, findLightnessForContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
|
|
447
|
+
export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type OkhslColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
|
|
330
448
|
//# sourceMappingURL=index.d.mts.map
|