@tenphi/glaze 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -26,6 +26,30 @@ interface FindLightnessForContrastOptions {
26
26
  epsilon?: number;
27
27
  /** Maximum binary-search iterations per branch. Default: 14. */
28
28
  maxIterations?: number;
29
+ /**
30
+ * Preferred search direction before auto-flip is considered.
31
+ *
32
+ * Theme resolution sets this from the requested lightness relative to
33
+ * the base color so `autoFlip: false` preserves the authored direction.
34
+ * When omitted, the solver falls back to the side whose extreme has
35
+ * higher contrast against the base.
36
+ */
37
+ initialDirection?: 'lighter' | 'darker';
38
+ /**
39
+ * Auto-flip lightness direction when contrast can't be met.
40
+ *
41
+ * When `true`, the solver searches the initial direction first. If that side
42
+ * doesn't reach the target, it tries the opposite direction and
43
+ * uses it when it passes. If neither side passes, it returns the
44
+ * extreme lightness of the initial direction.
45
+ *
46
+ * When `false`, only the initial direction is considered. If it
47
+ * doesn't reach the target, the result is pinned to the initial
48
+ * direction's extreme — never to the original preferred lightness.
49
+ *
50
+ * Default: false.
51
+ */
52
+ flip?: boolean;
29
53
  }
30
54
  interface FindLightnessForContrastResult {
31
55
  /** Chosen lightness in 0–1. */
@@ -36,6 +60,12 @@ interface FindLightnessForContrastResult {
36
60
  met: boolean;
37
61
  /** Which branch was selected. */
38
62
  branch: 'lighter' | 'darker' | 'preferred';
63
+ /**
64
+ * Whether the result was auto-flipped to the opposite direction.
65
+ * Only set when the initial direction failed and the opposite
66
+ * direction satisfied the target.
67
+ */
68
+ flipped?: boolean;
39
69
  }
40
70
  declare function resolveMinContrast(value: MinContrast$1): number;
41
71
  /**
@@ -62,6 +92,22 @@ interface FindValueForMixContrastOptions {
62
92
  epsilon?: number;
63
93
  /** Maximum binary-search iterations per branch. Default: 20. */
64
94
  maxIterations?: number;
95
+ /**
96
+ * Auto-flip mix direction when contrast can't be met.
97
+ *
98
+ * When `true`, the solver searches the initial direction first
99
+ * (the side whose extreme has higher contrast against the base).
100
+ * If that side doesn't reach the target, it tries the opposite
101
+ * direction and uses it when it passes. If neither side passes,
102
+ * it returns the extreme mix value of the initial direction.
103
+ *
104
+ * When `false`, only the initial direction is considered. If it
105
+ * doesn't reach the target, the result is pinned to the initial
106
+ * direction's extreme — never to the original preferred value.
107
+ *
108
+ * Default: false.
109
+ */
110
+ flip?: boolean;
65
111
  }
66
112
  interface FindValueForMixContrastResult {
67
113
  /** Chosen mix parameter (0–1). */
@@ -70,6 +116,12 @@ interface FindValueForMixContrastResult {
70
116
  contrast: number;
71
117
  /** Whether the target was reached. */
72
118
  met: boolean;
119
+ /**
120
+ * Whether the result was auto-flipped to the opposite direction.
121
+ * Only set when the initial direction failed and the opposite
122
+ * direction satisfied the target.
123
+ */
124
+ flipped?: boolean;
73
125
  }
74
126
  /**
75
127
  * Find the mix parameter (ratio or opacity) that satisfies a WCAG 2 contrast
@@ -104,6 +156,18 @@ interface OkhslColor {
104
156
  s: number;
105
157
  l: number;
106
158
  }
159
+ /** sRGB components in 0–255 (value-shorthand object form). */
160
+ interface RgbColor {
161
+ r: number;
162
+ g: number;
163
+ b: number;
164
+ }
165
+ /** OKLCh components matching CSS `oklch(L C H)` (L/C: 0–1, H: degrees). */
166
+ interface OklchColor {
167
+ l: number;
168
+ c: number;
169
+ h: number;
170
+ }
107
171
  interface RegularColorDef {
108
172
  /**
109
173
  * Lightness value (0–100).
@@ -273,6 +337,21 @@ interface GlazeConfig {
273
337
  modes?: GlazeOutputModes;
274
338
  /** Default tuning for all shadow colors. Per-color tuning merges field-by-field. */
275
339
  shadowTuning?: ShadowTuning;
340
+ /**
341
+ * Automatically flip lightness direction when contrast can't be met.
342
+ *
343
+ * When enabled (default `true`), the solver searches the requested
344
+ * lightness direction first. If that direction can't reach the target,
345
+ * it tries the opposite direction and uses it when it passes. If neither
346
+ * side passes, the lightness is pinned to the requested-direction
347
+ * extreme and a warning is emitted.
348
+ *
349
+ * Set to `false` for strict "no flip" behavior. The opposite
350
+ * direction is never considered: if the requested direction can't
351
+ * meet the target, the lightness is pinned to its extreme (never
352
+ * falls back to the originally requested lightness).
353
+ */
354
+ autoFlip?: boolean;
276
355
  }
277
356
  interface GlazeConfigResolved {
278
357
  lightLightness: [number, number];
@@ -285,6 +364,7 @@ interface GlazeConfigResolved {
285
364
  };
286
365
  modes: Required<GlazeOutputModes>;
287
366
  shadowTuning?: ShadowTuning;
367
+ autoFlip: boolean;
288
368
  }
289
369
  /** Serialized theme configuration (no resolved values). */
290
370
  interface GlazeThemeExport {
@@ -297,8 +377,8 @@ interface GlazeShadowInput {
297
377
  /**
298
378
  * Background color — accepts any `GlazeColorValue` form: hex
299
379
  * (`#rgb` / `#rrggbb` / `#rrggbbaa`), `rgb()` / `hsl()` / `okhsl()`
300
- * / `oklch()` strings, an `OkhslColor` object, or an `[r, g, b]`
301
- * (0–255) tuple. Alpha components are dropped with a warning.
380
+ * / `oklch()` strings, or literal objects (`{ r, g, b }`, `{ h, s, l }`,
381
+ * `{ l, c, h }`). Alpha components are dropped with a warning.
302
382
  */
303
383
  bg: GlazeColorValue;
304
384
  /**
@@ -349,14 +429,13 @@ interface GlazeColorInput {
349
429
  * `rgb()`, `hsl()`, `okhsl()`, `oklch()` (alpha components also dropped
350
430
  * with a warning).
351
431
  *
352
- * The OKHSL object form `{ h, s, l }` matches Glaze's native shape
353
- * (h: 0–360, s/l: 0–1). Passing 0–100 values for `s`/`l` throws with
354
- * a hint to use the structured `{ hue, saturation, lightness }` form.
355
- *
356
- * The tuple form is `[r, g, b]` in 0–255, matching `glaze.fromRgb`'s
357
- * range. Out-of-range or non-finite components throw.
432
+ * Literal object forms:
433
+ * - `{ h, s, l }` — OKHSL (h: 0–360, s/l: 0–1). Passing 0–100 for `s`/`l`
434
+ * throws with a hint to use the structured form.
435
+ * - `{ r, g, b }` — sRGB 0–255.
436
+ * - `{ l, c, h }` OKLCh (L/C: 0–1, H: degrees), same as `oklch()` strings.
358
437
  */
359
- type GlazeColorValue = string | OkhslColor | readonly [number, number, number];
438
+ type GlazeColorValue = string | OkhslColor | RgbColor | OklchColor;
360
439
  /** Optional overrides for `glaze.color(value, overrides?)`. */
361
440
  interface GlazeColorOverrides {
362
441
  /**
@@ -378,11 +457,11 @@ interface GlazeColorOverrides {
378
457
  /**
379
458
  * Adaptation mode. Defaults to `'auto'` for every input form, so
380
459
  * colors automatically adapt between light and dark like an ordinary
381
- * theme color. The default *scaling* snapshot differs by input form:
382
- * string inputs preserve their light lightness and extend the dark
383
- * window to `[lo, 100]` (`#000` `#fff` flip), while `OkhslColor`
384
- * and `[r, g, b]` tuple inputs snapshot the full `globalConfig.
385
- * lightLightness` / `globalConfig.darkLightness` windows.
460
+ * theme color. All value-shorthand inputs (strings and literal objects)
461
+ * preserve light lightness (`lightLightness: false`) and snapshot
462
+ * `globalConfig.darkLightness` on the dark side. Only the structured
463
+ * `{ hue, saturation, lightness }` form also snapshots
464
+ * `globalConfig.lightLightness`.
386
465
  *
387
466
  * Pass `'fixed'` explicitly to opt back into the legacy linear, non-
388
467
  * inverting mapping; pass `'static'` to pin the same lightness
@@ -398,7 +477,7 @@ interface GlazeColorOverrides {
398
477
  /**
399
478
  * Optional dependency on another color. Accepts either a
400
479
  * `GlazeColorToken` (returned by another `glaze.color()`) or a raw
401
- * `GlazeColorValue` (hex / `rgb()` / `OkhslColor` / `[r, g, b]`),
480
+ * `GlazeColorValue` (hex / CSS strings / `{ r, g, b }` / `{ h, s, l }` / …),
402
481
  * which is automatically wrapped in `glaze.color(value)`.
403
482
  *
404
483
  * When set:
@@ -436,17 +515,14 @@ interface GlazeColorOverrides {
436
515
  * `glaze.configure()` calls don't retroactively change already-created
437
516
  * tokens (and `token.export()` round-trips byte-for-byte):
438
517
  *
439
- * - **String inputs** (`'#1a1a1a'`, `'rgb(...)'`, `'okhsl(...)'`, ...):
518
+ * - **Value-shorthand** (hex / `rgb()` / `hsl()` / `okhsl()` / `oklch()`
519
+ * strings, `{ r, g, b }`, `{ h, s, l }`, `{ l, c, h }`):
440
520
  * - `lightLightness: false` — preserve input exactly.
441
- * - `darkLightness: [globalConfig.darkLightness[0], 100]` — extended
442
- * dark window so the auto-mode dark variant can Möbius-invert all
443
- * the way up to white.
521
+ * - `darkLightness: globalConfig.darkLightness` — snapshotted at create time.
444
522
  *
445
- * - **`OkhslColor` / `[r, g, b]` tuple / structured inputs**:
446
- * - `lightLightness: globalConfig.lightLightness` — same light window
447
- * theme colors use, snapshotted at create time.
448
- * - `darkLightness: globalConfig.darkLightness` — same dark window
449
- * theme colors use, snapshotted at create time.
523
+ * - **Structured inputs** (`{ hue, saturation, lightness, ... }`):
524
+ * - `lightLightness: globalConfig.lightLightness` — theme light window.
525
+ * - `darkLightness: globalConfig.darkLightness` theme dark window.
450
526
  *
451
527
  * Passing this object replaces both fields at once. To keep one
452
528
  * field's default while overriding the other, restate the default
@@ -454,18 +530,16 @@ interface GlazeColorOverrides {
454
530
  */
455
531
  interface GlazeColorScaling {
456
532
  /**
457
- * Light-mode lightness window. Snapshotted from `globalConfig` at
458
- * create time: `false` (preserve input) for string inputs, plain
459
- * `globalConfig.lightLightness` for object / tuple / structured
460
- * inputs. Pass `false` to preserve input lightness in light mode.
533
+ * Light-mode lightness window. Snapshotted at create time: `false`
534
+ * (preserve input) for value-shorthand inputs; plain
535
+ * `globalConfig.lightLightness` for structured inputs only. Pass
536
+ * `false` to preserve input lightness in light mode.
461
537
  */
462
538
  lightLightness?: false | [number, number];
463
539
  /**
464
540
  * Dark-mode lightness window. Snapshotted from `globalConfig` at
465
- * create time: extended `[globalConfig.darkLightness[0], 100]` for
466
- * string inputs, plain `globalConfig.darkLightness` for object /
467
- * tuple / structured inputs. Pass `false` to preserve input
468
- * lightness in dark mode too.
541
+ * create time for value-shorthand and structured inputs. Pass `false`
542
+ * to preserve input lightness in dark mode too.
469
543
  */
470
544
  darkLightness?: false | [number, number];
471
545
  }
@@ -528,6 +602,13 @@ interface GlazeColorTokenExport {
528
602
  overrides?: GlazeColorOverridesExport;
529
603
  /** Lightness scaling override, if any. */
530
604
  scaling?: GlazeColorScaling;
605
+ /**
606
+ * Auto-flip setting snapshotted at creation time from
607
+ * `globalConfig.autoFlip`. Only present when it differs from the
608
+ * global default (`true`). Rehydrated tokens use this value instead
609
+ * of whatever is current in `globalConfig`.
610
+ */
611
+ autoFlip?: boolean;
531
612
  }
532
613
  /**
533
614
  * Serializable shape of a structured `glaze.color({...})` input.
@@ -831,5 +912,5 @@ declare function formatHsl(h: number, s: number, l: number): string;
831
912
  */
832
913
  declare function formatOklch(h: number, s: number, l: number): string;
833
914
  //#endregion
834
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorScaling, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, 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, hslToSrgb, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
915
+ export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorScaling, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, 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 OklchColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type RgbColor, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
835
916
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -26,6 +26,30 @@ interface FindLightnessForContrastOptions {
26
26
  epsilon?: number;
27
27
  /** Maximum binary-search iterations per branch. Default: 14. */
28
28
  maxIterations?: number;
29
+ /**
30
+ * Preferred search direction before auto-flip is considered.
31
+ *
32
+ * Theme resolution sets this from the requested lightness relative to
33
+ * the base color so `autoFlip: false` preserves the authored direction.
34
+ * When omitted, the solver falls back to the side whose extreme has
35
+ * higher contrast against the base.
36
+ */
37
+ initialDirection?: 'lighter' | 'darker';
38
+ /**
39
+ * Auto-flip lightness direction when contrast can't be met.
40
+ *
41
+ * When `true`, the solver searches the initial direction first. If that side
42
+ * doesn't reach the target, it tries the opposite direction and
43
+ * uses it when it passes. If neither side passes, it returns the
44
+ * extreme lightness of the initial direction.
45
+ *
46
+ * When `false`, only the initial direction is considered. If it
47
+ * doesn't reach the target, the result is pinned to the initial
48
+ * direction's extreme — never to the original preferred lightness.
49
+ *
50
+ * Default: false.
51
+ */
52
+ flip?: boolean;
29
53
  }
30
54
  interface FindLightnessForContrastResult {
31
55
  /** Chosen lightness in 0–1. */
@@ -36,6 +60,12 @@ interface FindLightnessForContrastResult {
36
60
  met: boolean;
37
61
  /** Which branch was selected. */
38
62
  branch: 'lighter' | 'darker' | 'preferred';
63
+ /**
64
+ * Whether the result was auto-flipped to the opposite direction.
65
+ * Only set when the initial direction failed and the opposite
66
+ * direction satisfied the target.
67
+ */
68
+ flipped?: boolean;
39
69
  }
40
70
  declare function resolveMinContrast(value: MinContrast$1): number;
41
71
  /**
@@ -62,6 +92,22 @@ interface FindValueForMixContrastOptions {
62
92
  epsilon?: number;
63
93
  /** Maximum binary-search iterations per branch. Default: 20. */
64
94
  maxIterations?: number;
95
+ /**
96
+ * Auto-flip mix direction when contrast can't be met.
97
+ *
98
+ * When `true`, the solver searches the initial direction first
99
+ * (the side whose extreme has higher contrast against the base).
100
+ * If that side doesn't reach the target, it tries the opposite
101
+ * direction and uses it when it passes. If neither side passes,
102
+ * it returns the extreme mix value of the initial direction.
103
+ *
104
+ * When `false`, only the initial direction is considered. If it
105
+ * doesn't reach the target, the result is pinned to the initial
106
+ * direction's extreme — never to the original preferred value.
107
+ *
108
+ * Default: false.
109
+ */
110
+ flip?: boolean;
65
111
  }
66
112
  interface FindValueForMixContrastResult {
67
113
  /** Chosen mix parameter (0–1). */
@@ -70,6 +116,12 @@ interface FindValueForMixContrastResult {
70
116
  contrast: number;
71
117
  /** Whether the target was reached. */
72
118
  met: boolean;
119
+ /**
120
+ * Whether the result was auto-flipped to the opposite direction.
121
+ * Only set when the initial direction failed and the opposite
122
+ * direction satisfied the target.
123
+ */
124
+ flipped?: boolean;
73
125
  }
74
126
  /**
75
127
  * Find the mix parameter (ratio or opacity) that satisfies a WCAG 2 contrast
@@ -104,6 +156,18 @@ interface OkhslColor {
104
156
  s: number;
105
157
  l: number;
106
158
  }
159
+ /** sRGB components in 0–255 (value-shorthand object form). */
160
+ interface RgbColor {
161
+ r: number;
162
+ g: number;
163
+ b: number;
164
+ }
165
+ /** OKLCh components matching CSS `oklch(L C H)` (L/C: 0–1, H: degrees). */
166
+ interface OklchColor {
167
+ l: number;
168
+ c: number;
169
+ h: number;
170
+ }
107
171
  interface RegularColorDef {
108
172
  /**
109
173
  * Lightness value (0–100).
@@ -273,6 +337,21 @@ interface GlazeConfig {
273
337
  modes?: GlazeOutputModes;
274
338
  /** Default tuning for all shadow colors. Per-color tuning merges field-by-field. */
275
339
  shadowTuning?: ShadowTuning;
340
+ /**
341
+ * Automatically flip lightness direction when contrast can't be met.
342
+ *
343
+ * When enabled (default `true`), the solver searches the requested
344
+ * lightness direction first. If that direction can't reach the target,
345
+ * it tries the opposite direction and uses it when it passes. If neither
346
+ * side passes, the lightness is pinned to the requested-direction
347
+ * extreme and a warning is emitted.
348
+ *
349
+ * Set to `false` for strict "no flip" behavior. The opposite
350
+ * direction is never considered: if the requested direction can't
351
+ * meet the target, the lightness is pinned to its extreme (never
352
+ * falls back to the originally requested lightness).
353
+ */
354
+ autoFlip?: boolean;
276
355
  }
277
356
  interface GlazeConfigResolved {
278
357
  lightLightness: [number, number];
@@ -285,6 +364,7 @@ interface GlazeConfigResolved {
285
364
  };
286
365
  modes: Required<GlazeOutputModes>;
287
366
  shadowTuning?: ShadowTuning;
367
+ autoFlip: boolean;
288
368
  }
289
369
  /** Serialized theme configuration (no resolved values). */
290
370
  interface GlazeThemeExport {
@@ -297,8 +377,8 @@ interface GlazeShadowInput {
297
377
  /**
298
378
  * Background color — accepts any `GlazeColorValue` form: hex
299
379
  * (`#rgb` / `#rrggbb` / `#rrggbbaa`), `rgb()` / `hsl()` / `okhsl()`
300
- * / `oklch()` strings, an `OkhslColor` object, or an `[r, g, b]`
301
- * (0–255) tuple. Alpha components are dropped with a warning.
380
+ * / `oklch()` strings, or literal objects (`{ r, g, b }`, `{ h, s, l }`,
381
+ * `{ l, c, h }`). Alpha components are dropped with a warning.
302
382
  */
303
383
  bg: GlazeColorValue;
304
384
  /**
@@ -349,14 +429,13 @@ interface GlazeColorInput {
349
429
  * `rgb()`, `hsl()`, `okhsl()`, `oklch()` (alpha components also dropped
350
430
  * with a warning).
351
431
  *
352
- * The OKHSL object form `{ h, s, l }` matches Glaze's native shape
353
- * (h: 0–360, s/l: 0–1). Passing 0–100 values for `s`/`l` throws with
354
- * a hint to use the structured `{ hue, saturation, lightness }` form.
355
- *
356
- * The tuple form is `[r, g, b]` in 0–255, matching `glaze.fromRgb`'s
357
- * range. Out-of-range or non-finite components throw.
432
+ * Literal object forms:
433
+ * - `{ h, s, l }` — OKHSL (h: 0–360, s/l: 0–1). Passing 0–100 for `s`/`l`
434
+ * throws with a hint to use the structured form.
435
+ * - `{ r, g, b }` — sRGB 0–255.
436
+ * - `{ l, c, h }` OKLCh (L/C: 0–1, H: degrees), same as `oklch()` strings.
358
437
  */
359
- type GlazeColorValue = string | OkhslColor | readonly [number, number, number];
438
+ type GlazeColorValue = string | OkhslColor | RgbColor | OklchColor;
360
439
  /** Optional overrides for `glaze.color(value, overrides?)`. */
361
440
  interface GlazeColorOverrides {
362
441
  /**
@@ -378,11 +457,11 @@ interface GlazeColorOverrides {
378
457
  /**
379
458
  * Adaptation mode. Defaults to `'auto'` for every input form, so
380
459
  * colors automatically adapt between light and dark like an ordinary
381
- * theme color. The default *scaling* snapshot differs by input form:
382
- * string inputs preserve their light lightness and extend the dark
383
- * window to `[lo, 100]` (`#000` `#fff` flip), while `OkhslColor`
384
- * and `[r, g, b]` tuple inputs snapshot the full `globalConfig.
385
- * lightLightness` / `globalConfig.darkLightness` windows.
460
+ * theme color. All value-shorthand inputs (strings and literal objects)
461
+ * preserve light lightness (`lightLightness: false`) and snapshot
462
+ * `globalConfig.darkLightness` on the dark side. Only the structured
463
+ * `{ hue, saturation, lightness }` form also snapshots
464
+ * `globalConfig.lightLightness`.
386
465
  *
387
466
  * Pass `'fixed'` explicitly to opt back into the legacy linear, non-
388
467
  * inverting mapping; pass `'static'` to pin the same lightness
@@ -398,7 +477,7 @@ interface GlazeColorOverrides {
398
477
  /**
399
478
  * Optional dependency on another color. Accepts either a
400
479
  * `GlazeColorToken` (returned by another `glaze.color()`) or a raw
401
- * `GlazeColorValue` (hex / `rgb()` / `OkhslColor` / `[r, g, b]`),
480
+ * `GlazeColorValue` (hex / CSS strings / `{ r, g, b }` / `{ h, s, l }` / …),
402
481
  * which is automatically wrapped in `glaze.color(value)`.
403
482
  *
404
483
  * When set:
@@ -436,17 +515,14 @@ interface GlazeColorOverrides {
436
515
  * `glaze.configure()` calls don't retroactively change already-created
437
516
  * tokens (and `token.export()` round-trips byte-for-byte):
438
517
  *
439
- * - **String inputs** (`'#1a1a1a'`, `'rgb(...)'`, `'okhsl(...)'`, ...):
518
+ * - **Value-shorthand** (hex / `rgb()` / `hsl()` / `okhsl()` / `oklch()`
519
+ * strings, `{ r, g, b }`, `{ h, s, l }`, `{ l, c, h }`):
440
520
  * - `lightLightness: false` — preserve input exactly.
441
- * - `darkLightness: [globalConfig.darkLightness[0], 100]` — extended
442
- * dark window so the auto-mode dark variant can Möbius-invert all
443
- * the way up to white.
521
+ * - `darkLightness: globalConfig.darkLightness` — snapshotted at create time.
444
522
  *
445
- * - **`OkhslColor` / `[r, g, b]` tuple / structured inputs**:
446
- * - `lightLightness: globalConfig.lightLightness` — same light window
447
- * theme colors use, snapshotted at create time.
448
- * - `darkLightness: globalConfig.darkLightness` — same dark window
449
- * theme colors use, snapshotted at create time.
523
+ * - **Structured inputs** (`{ hue, saturation, lightness, ... }`):
524
+ * - `lightLightness: globalConfig.lightLightness` — theme light window.
525
+ * - `darkLightness: globalConfig.darkLightness` theme dark window.
450
526
  *
451
527
  * Passing this object replaces both fields at once. To keep one
452
528
  * field's default while overriding the other, restate the default
@@ -454,18 +530,16 @@ interface GlazeColorOverrides {
454
530
  */
455
531
  interface GlazeColorScaling {
456
532
  /**
457
- * Light-mode lightness window. Snapshotted from `globalConfig` at
458
- * create time: `false` (preserve input) for string inputs, plain
459
- * `globalConfig.lightLightness` for object / tuple / structured
460
- * inputs. Pass `false` to preserve input lightness in light mode.
533
+ * Light-mode lightness window. Snapshotted at create time: `false`
534
+ * (preserve input) for value-shorthand inputs; plain
535
+ * `globalConfig.lightLightness` for structured inputs only. Pass
536
+ * `false` to preserve input lightness in light mode.
461
537
  */
462
538
  lightLightness?: false | [number, number];
463
539
  /**
464
540
  * Dark-mode lightness window. Snapshotted from `globalConfig` at
465
- * create time: extended `[globalConfig.darkLightness[0], 100]` for
466
- * string inputs, plain `globalConfig.darkLightness` for object /
467
- * tuple / structured inputs. Pass `false` to preserve input
468
- * lightness in dark mode too.
541
+ * create time for value-shorthand and structured inputs. Pass `false`
542
+ * to preserve input lightness in dark mode too.
469
543
  */
470
544
  darkLightness?: false | [number, number];
471
545
  }
@@ -528,6 +602,13 @@ interface GlazeColorTokenExport {
528
602
  overrides?: GlazeColorOverridesExport;
529
603
  /** Lightness scaling override, if any. */
530
604
  scaling?: GlazeColorScaling;
605
+ /**
606
+ * Auto-flip setting snapshotted at creation time from
607
+ * `globalConfig.autoFlip`. Only present when it differs from the
608
+ * global default (`true`). Rehydrated tokens use this value instead
609
+ * of whatever is current in `globalConfig`.
610
+ */
611
+ autoFlip?: boolean;
531
612
  }
532
613
  /**
533
614
  * Serializable shape of a structured `glaze.color({...})` input.
@@ -831,5 +912,5 @@ declare function formatHsl(h: number, s: number, l: number): string;
831
912
  */
832
913
  declare function formatOklch(h: number, s: number, l: number): string;
833
914
  //#endregion
834
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorScaling, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, 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, hslToSrgb, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
915
+ export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorScaling, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, 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 OklchColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type RgbColor, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
835
916
  //# sourceMappingURL=index.d.mts.map