@tenphi/glaze 0.0.0-snapshot.99c649d → 0.0.0-snapshot.9ff0fda

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.d.cts CHANGED
@@ -6,6 +6,7 @@
6
6
  * against a base color. Used by glaze when resolving dependent colors
7
7
  * with `contrast`.
8
8
  */
9
+ type LinearRgb = [number, number, number];
9
10
  type ContrastPreset = 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
10
11
  type MinContrast$1 = number | ContrastPreset;
11
12
  interface FindLightnessForContrastOptions {
@@ -42,6 +43,39 @@ declare function resolveMinContrast(value: MinContrast$1): number;
42
43
  * against a base color, staying as close to `preferredLightness` as possible.
43
44
  */
44
45
  declare function findLightnessForContrast(options: FindLightnessForContrastOptions): FindLightnessForContrastResult;
46
+ interface FindValueForMixContrastOptions {
47
+ /** Preferred mix parameter (0–1). */
48
+ preferredValue: number;
49
+ /** Base color as linear sRGB. */
50
+ baseLinearRgb: LinearRgb;
51
+ /** Target color as linear sRGB. */
52
+ targetLinearRgb: LinearRgb;
53
+ /** WCAG contrast target. */
54
+ contrast: MinContrast$1;
55
+ /**
56
+ * Compute the luminance of the mixed color at parameter t.
57
+ * For opaque: luminance of OKHSL-interpolated color.
58
+ * For transparent: luminance of alpha-composited color over base.
59
+ */
60
+ luminanceAtValue: (t: number) => number;
61
+ /** Convergence threshold. Default: 1e-4. */
62
+ epsilon?: number;
63
+ /** Maximum binary-search iterations per branch. Default: 20. */
64
+ maxIterations?: number;
65
+ }
66
+ interface FindValueForMixContrastResult {
67
+ /** Chosen mix parameter (0–1). */
68
+ value: number;
69
+ /** Achieved WCAG contrast ratio. */
70
+ contrast: number;
71
+ /** Whether the target was reached. */
72
+ met: boolean;
73
+ }
74
+ /**
75
+ * Find the mix parameter (ratio or opacity) that satisfies a WCAG 2 contrast
76
+ * target against a base color, staying as close to `preferredValue` as possible.
77
+ */
78
+ declare function findValueForMixContrast(options: FindValueForMixContrastOptions): FindValueForMixContrastResult;
45
79
  //#endregion
46
80
  //#region src/types.d.ts
47
81
  /** A value or [normal, high-contrast] pair. */
@@ -144,7 +178,41 @@ interface ShadowColorDef {
144
178
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
145
179
  tuning?: ShadowTuning;
146
180
  }
147
- type ColorDef = RegularColorDef | ShadowColorDef;
181
+ interface MixColorDef {
182
+ type: 'mix';
183
+ /** Background/base color name — the "from" color. */
184
+ base: string;
185
+ /** Target color name — the "to" color to mix toward. */
186
+ target: string;
187
+ /**
188
+ * Mix ratio 0–100 (0 = pure base, 100 = pure target).
189
+ * In 'transparent' blend mode, this controls the opacity of the target.
190
+ * Supports [normal, highContrast] pair.
191
+ */
192
+ value: HCPair<number>;
193
+ /**
194
+ * Blending mode. Default: 'opaque'.
195
+ * - 'opaque': produces a solid color by interpolating base and target.
196
+ * - 'transparent': produces the target color with alpha = value/100.
197
+ */
198
+ blend?: 'opaque' | 'transparent';
199
+ /**
200
+ * Interpolation color space for opaque blending. Default: 'okhsl'.
201
+ * - 'okhsl': perceptually uniform, consistent with Glaze's internal model.
202
+ * - 'srgb': linear sRGB interpolation, matches browser compositing.
203
+ *
204
+ * Ignored for 'transparent' blend (always composites in linear sRGB).
205
+ */
206
+ space?: 'okhsl' | 'srgb';
207
+ /**
208
+ * Minimum WCAG contrast between the base and the resulting color.
209
+ * In 'opaque' mode, adjusts the mix ratio to meet contrast.
210
+ * In 'transparent' mode, adjusts opacity to meet contrast against the composite.
211
+ * Supports [normal, highContrast] pair.
212
+ */
213
+ contrast?: HCPair<MinContrast>;
214
+ }
215
+ type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
148
216
  type ColorMap = Record<string, ColorDef>;
149
217
  /** Resolved color for a single scheme variant. */
150
218
  interface ResolvedColorVariant {
@@ -174,6 +242,13 @@ interface GlazeConfig {
174
242
  darkLightness?: [number, number];
175
243
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
176
244
  darkDesaturation?: number;
245
+ /**
246
+ * Möbius beta for dark auto-inversion (0–1).
247
+ * Lower values expand subtle near-white distinctions in dark mode.
248
+ * Set to 1 for linear (legacy) behavior. Default: 0.5.
249
+ * Accepts [normal, highContrast] pair for separate HC tuning.
250
+ */
251
+ darkCurve?: HCPair<number>;
177
252
  /** State alias names for token export. */
178
253
  states?: {
179
254
  dark?: string;
@@ -188,6 +263,7 @@ interface GlazeConfigResolved {
188
263
  lightLightness: [number, number];
189
264
  darkLightness: [number, number];
190
265
  darkDesaturation: number;
266
+ darkCurve: HCPair<number>;
191
267
  states: {
192
268
  dark: string;
193
269
  highContrast: string;
@@ -317,33 +393,64 @@ interface GlazeCssResult {
317
393
  lightContrast: string;
318
394
  darkContrast: string;
319
395
  }
396
+ /** Options for `glaze.palette()` creation. */
397
+ interface GlazePaletteOptions {
398
+ /**
399
+ * Name of the primary theme. The primary theme's tokens are duplicated
400
+ * without prefix in all exports, providing convenient short aliases
401
+ * alongside the prefixed versions. Can be overridden per-export.
402
+ *
403
+ * @example
404
+ * ```ts
405
+ * const palette = glaze.palette({ brand, accent }, { primary: 'brand' });
406
+ * palette.tokens()
407
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
408
+ * ```
409
+ */
410
+ primary?: string;
411
+ }
412
+ /** Options shared by palette `tokens()`, `tasty()`, and `css()` exports. */
413
+ interface GlazePaletteExportOptions {
414
+ /**
415
+ * Prefix mode. `true` uses `"<themeName>-"`, or provide a custom map.
416
+ * Defaults to `true` for palette export methods.
417
+ * Set to `false` explicitly to disable prefixing. Colliding keys
418
+ * produce a console.warn and the first-written value wins.
419
+ */
420
+ prefix?: boolean | Record<string, string>;
421
+ /**
422
+ * Override the palette-level primary theme for this export.
423
+ * Pass a theme name to set/change the primary, or `false` to disable it.
424
+ * When omitted, inherits the palette-level `primary`.
425
+ */
426
+ primary?: string | false;
427
+ }
320
428
  interface GlazePalette {
321
429
  /**
322
430
  * Export all themes as a flat token map grouped by scheme variant.
431
+ * Prefix defaults to `true` — all tokens are prefixed with the theme name.
432
+ * Inherits the palette-level `primary`; override per-call or pass `false` to disable.
323
433
  *
324
434
  * ```ts
325
- * palette.tokens({ prefix: true })
326
- * // → { light: { 'primary-surface': 'okhsl(...)' }, dark: { 'primary-surface': 'okhsl(...)' } }
435
+ * const palette = glaze.palette({ brand, accent }, { primary: 'brand' });
436
+ * palette.tokens()
437
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
327
438
  * ```
328
439
  */
329
- tokens(options?: GlazeJsonOptions & {
330
- prefix?: boolean | Record<string, string>;
331
- }): Record<string, Record<string, string>>;
440
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
332
441
  /**
333
442
  * Export all themes as tasty style-to-state bindings.
334
443
  * Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
335
- * Spread into component styles or register as a recipe via `configure({ recipes })`.
444
+ * Prefix defaults to `true`. Inherits the palette-level `primary`.
336
445
  * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
337
446
  */
338
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
339
- /** Export all themes as plain JSON. */
447
+ tasty(options?: GlazeTokenOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
448
+ /** Export all themes as plain JSON grouped by theme name. */
340
449
  json(options?: GlazeJsonOptions & {
341
450
  prefix?: boolean | Record<string, string>;
342
451
  }): Record<string, Record<string, Record<string, string>>>;
343
452
  /** Export all themes as CSS custom property declarations. */
344
- css(options?: GlazeCssOptions & {
345
- prefix?: boolean | Record<string, string>;
346
- }): GlazeCssResult;
453
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
347
454
  }
348
455
  //#endregion
349
456
  //#region src/glaze.d.ts
@@ -364,17 +471,13 @@ declare function glaze(hueOrOptions: number | {
364
471
  }, saturation?: number): GlazeTheme;
365
472
  declare namespace glaze {
366
473
  var configure: (config: GlazeConfig) => void;
367
- var palette: (themes: PaletteInput) => {
368
- tokens(options?: GlazeJsonOptions & {
369
- prefix?: boolean | Record<string, string>;
370
- }): Record<string, Record<string, string>>;
371
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
474
+ var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => {
475
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
476
+ tasty(options?: GlazeTokenOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
372
477
  json(options?: GlazeJsonOptions & {
373
478
  prefix?: boolean | Record<string, string>;
374
479
  }): Record<string, Record<string, Record<string, string>>>;
375
- css(options?: GlazeCssOptions & {
376
- prefix?: boolean | Record<string, string>;
377
- }): GlazeCssResult;
480
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
378
481
  };
379
482
  var from: (data: GlazeThemeExport) => GlazeTheme;
380
483
  var color: (input: GlazeColorInput) => GlazeColorToken;
@@ -394,6 +497,10 @@ declare namespace glaze {
394
497
  * computation for WCAG 2 contrast calculations, and multi-format output
395
498
  * (okhsl, rgb, hsl, oklch).
396
499
  */
500
+ /**
501
+ * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
502
+ */
503
+ declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
397
504
  /**
398
505
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
399
506
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
@@ -413,9 +520,11 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
413
520
  */
414
521
  declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
415
522
  /**
416
- * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
523
+ * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
524
+ * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
525
+ * This avoids over/under-estimating luminance for out-of-gamut OKHSL colors.
417
526
  */
418
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
527
+ declare function gamutClampedLuminance(linearRgb: [number, number, number]): number;
419
528
  /**
420
529
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
421
530
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
@@ -432,7 +541,8 @@ declare function parseHex(hex: string): [number, number, number] | null;
432
541
  */
433
542
  declare function formatOkhsl(h: number, s: number, l: number): string;
434
543
  /**
435
- * Format OKHSL values as a CSS `rgb(R G B)` string with rounded integer values.
544
+ * Format OKHSL values as a CSS `rgb(R G B)` string.
545
+ * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
436
546
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
437
547
  */
438
548
  declare function formatRgb(h: number, s: number, l: number): string;
@@ -447,5 +557,5 @@ declare function formatHsl(h: number, s: number, l: number): string;
447
557
  */
448
558
  declare function formatOklch(h: number, s: number, l: number): string;
449
559
  //#endregion
450
- 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 };
560
+ export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, gamutClampedLuminance, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
451
561
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -6,6 +6,7 @@
6
6
  * against a base color. Used by glaze when resolving dependent colors
7
7
  * with `contrast`.
8
8
  */
9
+ type LinearRgb = [number, number, number];
9
10
  type ContrastPreset = 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
10
11
  type MinContrast$1 = number | ContrastPreset;
11
12
  interface FindLightnessForContrastOptions {
@@ -42,6 +43,39 @@ declare function resolveMinContrast(value: MinContrast$1): number;
42
43
  * against a base color, staying as close to `preferredLightness` as possible.
43
44
  */
44
45
  declare function findLightnessForContrast(options: FindLightnessForContrastOptions): FindLightnessForContrastResult;
46
+ interface FindValueForMixContrastOptions {
47
+ /** Preferred mix parameter (0–1). */
48
+ preferredValue: number;
49
+ /** Base color as linear sRGB. */
50
+ baseLinearRgb: LinearRgb;
51
+ /** Target color as linear sRGB. */
52
+ targetLinearRgb: LinearRgb;
53
+ /** WCAG contrast target. */
54
+ contrast: MinContrast$1;
55
+ /**
56
+ * Compute the luminance of the mixed color at parameter t.
57
+ * For opaque: luminance of OKHSL-interpolated color.
58
+ * For transparent: luminance of alpha-composited color over base.
59
+ */
60
+ luminanceAtValue: (t: number) => number;
61
+ /** Convergence threshold. Default: 1e-4. */
62
+ epsilon?: number;
63
+ /** Maximum binary-search iterations per branch. Default: 20. */
64
+ maxIterations?: number;
65
+ }
66
+ interface FindValueForMixContrastResult {
67
+ /** Chosen mix parameter (0–1). */
68
+ value: number;
69
+ /** Achieved WCAG contrast ratio. */
70
+ contrast: number;
71
+ /** Whether the target was reached. */
72
+ met: boolean;
73
+ }
74
+ /**
75
+ * Find the mix parameter (ratio or opacity) that satisfies a WCAG 2 contrast
76
+ * target against a base color, staying as close to `preferredValue` as possible.
77
+ */
78
+ declare function findValueForMixContrast(options: FindValueForMixContrastOptions): FindValueForMixContrastResult;
45
79
  //#endregion
46
80
  //#region src/types.d.ts
47
81
  /** A value or [normal, high-contrast] pair. */
@@ -144,7 +178,41 @@ interface ShadowColorDef {
144
178
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
145
179
  tuning?: ShadowTuning;
146
180
  }
147
- type ColorDef = RegularColorDef | ShadowColorDef;
181
+ interface MixColorDef {
182
+ type: 'mix';
183
+ /** Background/base color name — the "from" color. */
184
+ base: string;
185
+ /** Target color name — the "to" color to mix toward. */
186
+ target: string;
187
+ /**
188
+ * Mix ratio 0–100 (0 = pure base, 100 = pure target).
189
+ * In 'transparent' blend mode, this controls the opacity of the target.
190
+ * Supports [normal, highContrast] pair.
191
+ */
192
+ value: HCPair<number>;
193
+ /**
194
+ * Blending mode. Default: 'opaque'.
195
+ * - 'opaque': produces a solid color by interpolating base and target.
196
+ * - 'transparent': produces the target color with alpha = value/100.
197
+ */
198
+ blend?: 'opaque' | 'transparent';
199
+ /**
200
+ * Interpolation color space for opaque blending. Default: 'okhsl'.
201
+ * - 'okhsl': perceptually uniform, consistent with Glaze's internal model.
202
+ * - 'srgb': linear sRGB interpolation, matches browser compositing.
203
+ *
204
+ * Ignored for 'transparent' blend (always composites in linear sRGB).
205
+ */
206
+ space?: 'okhsl' | 'srgb';
207
+ /**
208
+ * Minimum WCAG contrast between the base and the resulting color.
209
+ * In 'opaque' mode, adjusts the mix ratio to meet contrast.
210
+ * In 'transparent' mode, adjusts opacity to meet contrast against the composite.
211
+ * Supports [normal, highContrast] pair.
212
+ */
213
+ contrast?: HCPair<MinContrast>;
214
+ }
215
+ type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
148
216
  type ColorMap = Record<string, ColorDef>;
149
217
  /** Resolved color for a single scheme variant. */
150
218
  interface ResolvedColorVariant {
@@ -174,6 +242,13 @@ interface GlazeConfig {
174
242
  darkLightness?: [number, number];
175
243
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
176
244
  darkDesaturation?: number;
245
+ /**
246
+ * Möbius beta for dark auto-inversion (0–1).
247
+ * Lower values expand subtle near-white distinctions in dark mode.
248
+ * Set to 1 for linear (legacy) behavior. Default: 0.5.
249
+ * Accepts [normal, highContrast] pair for separate HC tuning.
250
+ */
251
+ darkCurve?: HCPair<number>;
177
252
  /** State alias names for token export. */
178
253
  states?: {
179
254
  dark?: string;
@@ -188,6 +263,7 @@ interface GlazeConfigResolved {
188
263
  lightLightness: [number, number];
189
264
  darkLightness: [number, number];
190
265
  darkDesaturation: number;
266
+ darkCurve: HCPair<number>;
191
267
  states: {
192
268
  dark: string;
193
269
  highContrast: string;
@@ -317,33 +393,64 @@ interface GlazeCssResult {
317
393
  lightContrast: string;
318
394
  darkContrast: string;
319
395
  }
396
+ /** Options for `glaze.palette()` creation. */
397
+ interface GlazePaletteOptions {
398
+ /**
399
+ * Name of the primary theme. The primary theme's tokens are duplicated
400
+ * without prefix in all exports, providing convenient short aliases
401
+ * alongside the prefixed versions. Can be overridden per-export.
402
+ *
403
+ * @example
404
+ * ```ts
405
+ * const palette = glaze.palette({ brand, accent }, { primary: 'brand' });
406
+ * palette.tokens()
407
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
408
+ * ```
409
+ */
410
+ primary?: string;
411
+ }
412
+ /** Options shared by palette `tokens()`, `tasty()`, and `css()` exports. */
413
+ interface GlazePaletteExportOptions {
414
+ /**
415
+ * Prefix mode. `true` uses `"<themeName>-"`, or provide a custom map.
416
+ * Defaults to `true` for palette export methods.
417
+ * Set to `false` explicitly to disable prefixing. Colliding keys
418
+ * produce a console.warn and the first-written value wins.
419
+ */
420
+ prefix?: boolean | Record<string, string>;
421
+ /**
422
+ * Override the palette-level primary theme for this export.
423
+ * Pass a theme name to set/change the primary, or `false` to disable it.
424
+ * When omitted, inherits the palette-level `primary`.
425
+ */
426
+ primary?: string | false;
427
+ }
320
428
  interface GlazePalette {
321
429
  /**
322
430
  * Export all themes as a flat token map grouped by scheme variant.
431
+ * Prefix defaults to `true` — all tokens are prefixed with the theme name.
432
+ * Inherits the palette-level `primary`; override per-call or pass `false` to disable.
323
433
  *
324
434
  * ```ts
325
- * palette.tokens({ prefix: true })
326
- * // → { light: { 'primary-surface': 'okhsl(...)' }, dark: { 'primary-surface': 'okhsl(...)' } }
435
+ * const palette = glaze.palette({ brand, accent }, { primary: 'brand' });
436
+ * palette.tokens()
437
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
327
438
  * ```
328
439
  */
329
- tokens(options?: GlazeJsonOptions & {
330
- prefix?: boolean | Record<string, string>;
331
- }): Record<string, Record<string, string>>;
440
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
332
441
  /**
333
442
  * Export all themes as tasty style-to-state bindings.
334
443
  * Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
335
- * Spread into component styles or register as a recipe via `configure({ recipes })`.
444
+ * Prefix defaults to `true`. Inherits the palette-level `primary`.
336
445
  * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
337
446
  */
338
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
339
- /** Export all themes as plain JSON. */
447
+ tasty(options?: GlazeTokenOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
448
+ /** Export all themes as plain JSON grouped by theme name. */
340
449
  json(options?: GlazeJsonOptions & {
341
450
  prefix?: boolean | Record<string, string>;
342
451
  }): Record<string, Record<string, Record<string, string>>>;
343
452
  /** Export all themes as CSS custom property declarations. */
344
- css(options?: GlazeCssOptions & {
345
- prefix?: boolean | Record<string, string>;
346
- }): GlazeCssResult;
453
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
347
454
  }
348
455
  //#endregion
349
456
  //#region src/glaze.d.ts
@@ -364,17 +471,13 @@ declare function glaze(hueOrOptions: number | {
364
471
  }, saturation?: number): GlazeTheme;
365
472
  declare namespace glaze {
366
473
  var configure: (config: GlazeConfig) => void;
367
- var palette: (themes: PaletteInput) => {
368
- tokens(options?: GlazeJsonOptions & {
369
- prefix?: boolean | Record<string, string>;
370
- }): Record<string, Record<string, string>>;
371
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
474
+ var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => {
475
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
476
+ tasty(options?: GlazeTokenOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
372
477
  json(options?: GlazeJsonOptions & {
373
478
  prefix?: boolean | Record<string, string>;
374
479
  }): Record<string, Record<string, Record<string, string>>>;
375
- css(options?: GlazeCssOptions & {
376
- prefix?: boolean | Record<string, string>;
377
- }): GlazeCssResult;
480
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
378
481
  };
379
482
  var from: (data: GlazeThemeExport) => GlazeTheme;
380
483
  var color: (input: GlazeColorInput) => GlazeColorToken;
@@ -394,6 +497,10 @@ declare namespace glaze {
394
497
  * computation for WCAG 2 contrast calculations, and multi-format output
395
498
  * (okhsl, rgb, hsl, oklch).
396
499
  */
500
+ /**
501
+ * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
502
+ */
503
+ declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
397
504
  /**
398
505
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
399
506
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
@@ -413,9 +520,11 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
413
520
  */
414
521
  declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
415
522
  /**
416
- * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
523
+ * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
524
+ * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
525
+ * This avoids over/under-estimating luminance for out-of-gamut OKHSL colors.
417
526
  */
418
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
527
+ declare function gamutClampedLuminance(linearRgb: [number, number, number]): number;
419
528
  /**
420
529
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
421
530
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
@@ -432,7 +541,8 @@ declare function parseHex(hex: string): [number, number, number] | null;
432
541
  */
433
542
  declare function formatOkhsl(h: number, s: number, l: number): string;
434
543
  /**
435
- * Format OKHSL values as a CSS `rgb(R G B)` string with rounded integer values.
544
+ * Format OKHSL values as a CSS `rgb(R G B)` string.
545
+ * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
436
546
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
437
547
  */
438
548
  declare function formatRgb(h: number, s: number, l: number): string;
@@ -447,5 +557,5 @@ declare function formatHsl(h: number, s: number, l: number): string;
447
557
  */
448
558
  declare function formatOklch(h: number, s: number, l: number): string;
449
559
  //#endregion
450
- 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 };
560
+ export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, gamutClampedLuminance, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
451
561
  //# sourceMappingURL=index.d.mts.map