@tenphi/glaze 1.3.1 → 1.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/dist/index.d.cts CHANGED
@@ -234,9 +234,10 @@ interface GlazeOutputModes {
234
234
  /**
235
235
  * Include high-contrast variants (both light-HC and dark-HC). Default: false.
236
236
  *
237
- * Inert while a global `contrastLevel` is set: a manual level has no separate
238
- * high-contrast tier, so this reads as "emit high-contrast variants when
239
- * contrast is automatic".
237
+ * Independent of `contrastLevel` — the level positions the normal variants
238
+ * while these stay the true high-contrast resolution, so the two compose. The
239
+ * exception is a global level of 100, where the normal variants already *are*
240
+ * the high-contrast ones: the tier would duplicate them and is dropped.
240
241
  * @see GlazeConfig.contrastLevel
241
242
  */
242
243
  highContrast?: boolean;
@@ -271,14 +272,44 @@ interface OklchColor {
271
272
  h: number;
272
273
  }
273
274
  interface RegularColorDef {
275
+ /**
276
+ * Seed this color from a literal color instead of from the theme.
277
+ *
278
+ * Accepts the same values as `glaze.color()` — hex, `rgb()`, `hsl()`,
279
+ * `okhsl()`, `okhst()`, `oklch()`, or a value object. It supplies three
280
+ * things at once: `hue`, `tone`, and — unlike every other color in a theme —
281
+ * an **absolute saturation** rather than a factor of the seed. That last
282
+ * part is the point: a color can now be more saturated than its theme, so
283
+ * honoring a brand color no longer means re-seeding the whole theme to reach
284
+ * it.
285
+ *
286
+ * The **light, normal-contrast** variant reproduces the value exactly
287
+ * (a local `lightTone: false`, matching the value-shorthand form of
288
+ * `glaze.color()`). Dark and high-contrast variants adapt as usual — they
289
+ * are where readability outranks fidelity, and a color pinned across every
290
+ * scheme would defeat both. A `contrast` floor still applies everywhere and
291
+ * still only moves the color when the authored value misses it.
292
+ *
293
+ * Sibling fields override what the value supplied, so
294
+ * `{ from: '#2F5BFF', hue: 300 }` keeps its saturation and tone but rotates
295
+ * the hue.
296
+ */
297
+ from?: GlazeColorValue;
274
298
  /**
275
299
  * Tone value (0–100, contrast-uniform — see `docs/okhst.md`).
276
300
  * - Number: absolute tone.
277
301
  * - String ('+N' / '-N'): relative to base color's tone (requires `base`).
278
302
  * - `'max'` / `'min'`: force to the scheme's tone extreme (no base needed).
303
+ *
304
+ * Defaults to the tone of `from` when that is set.
279
305
  */
280
306
  tone?: HCPair<ToneValue>;
281
- /** Saturation factor applied to the seed saturation (0–1, default: 1). */
307
+ /**
308
+ * Saturation factor applied to the seed saturation (0–1, default: 1).
309
+ *
310
+ * With `from`, an explicit value here is still a factor of the seed and
311
+ * overrides the absolute saturation the color carried.
312
+ */
282
313
  saturation?: number;
283
314
  /**
284
315
  * Hue override for this color.
@@ -542,15 +573,15 @@ interface GlazeConfig {
542
573
  shadowTuning?: ShadowTuning;
543
574
  /**
544
575
  * Manual contrast level — a 0–100 slider from normal contrast (`0`) to high
545
- * contrast (`100`), or `'auto'` (the default) to keep the two-tier
546
- * normal + high-contrast model.
576
+ * contrast (`100`), or `'auto'` (the default) to take the authored normal
577
+ * entries as-is.
547
578
  *
548
- * With a number, Glaze resolves the `light` / `dark` variants *at* that
549
- * level and stops emitting a separate high-contrast tier:
550
- * `lightContrast` / `darkContrast` mirror their normal counterparts and
551
- * `modes.highContrast` defaults to `false`. Level `0` is therefore "normal
552
- * contrast, no high-contrast tier"; `100` is "the high-contrast scheme as
553
- * the only scheme".
579
+ * With a number, Glaze resolves the `light` / `dark` variants *at* that level.
580
+ * That is all it does: `lightContrast` / `darkContrast` stay the true
581
+ * high-contrast resolution at every level, and `modes.highContrast` alone
582
+ * decides whether they are emitted. Level `0` therefore reproduces `'auto'`
583
+ * bit for bit. At `100` the normal variants *are* the high-contrast ones, so a
584
+ * separate tier would duplicate them and a global level of 100 drops it.
554
585
  *
555
586
  * The level interpolates all three things that make high contrast differ:
556
587
  * authored `[normal, highContrast]` pairs, the tone-window widening, and
@@ -600,8 +631,8 @@ interface GlazeConfigResolved {
600
631
  shadowTuning?: ShadowTuning;
601
632
  autoFlip: boolean;
602
633
  /**
603
- * Manual contrast level (0–100), or `'auto'` for the two-tier
604
- * normal + high-contrast model.
634
+ * Manual contrast level (0–100) for the normal variants, or `'auto'` to take
635
+ * the authored normal entries as-is.
605
636
  * @see GlazeConfig.contrastLevel
606
637
  */
607
638
  contrastLevel: number | 'auto';
@@ -631,8 +662,10 @@ interface GlazeConfigOverride {
631
662
  /** Whether to auto-flip tone when contrast can't be met. */
632
663
  autoFlip?: boolean;
633
664
  /**
634
- * Manual contrast level (0–100) for this instance, or `'auto'` to opt out
635
- * of a global level and keep the two-tier normal + high-contrast model.
665
+ * Manual contrast level (0–100) for this instance, or `'auto'` to opt out of a
666
+ * global level and take the authored normal entries as-is. Either way the
667
+ * instance keeps its high-contrast tier; a per-instance level never changes
668
+ * which modes are emitted.
636
669
  *
637
670
  * Only an instance-authored level is frozen into `.export()` snapshots — a
638
671
  * level inherited from the global config is treated as a live preference and
package/dist/index.d.mts CHANGED
@@ -234,9 +234,10 @@ interface GlazeOutputModes {
234
234
  /**
235
235
  * Include high-contrast variants (both light-HC and dark-HC). Default: false.
236
236
  *
237
- * Inert while a global `contrastLevel` is set: a manual level has no separate
238
- * high-contrast tier, so this reads as "emit high-contrast variants when
239
- * contrast is automatic".
237
+ * Independent of `contrastLevel` — the level positions the normal variants
238
+ * while these stay the true high-contrast resolution, so the two compose. The
239
+ * exception is a global level of 100, where the normal variants already *are*
240
+ * the high-contrast ones: the tier would duplicate them and is dropped.
240
241
  * @see GlazeConfig.contrastLevel
241
242
  */
242
243
  highContrast?: boolean;
@@ -271,14 +272,44 @@ interface OklchColor {
271
272
  h: number;
272
273
  }
273
274
  interface RegularColorDef {
275
+ /**
276
+ * Seed this color from a literal color instead of from the theme.
277
+ *
278
+ * Accepts the same values as `glaze.color()` — hex, `rgb()`, `hsl()`,
279
+ * `okhsl()`, `okhst()`, `oklch()`, or a value object. It supplies three
280
+ * things at once: `hue`, `tone`, and — unlike every other color in a theme —
281
+ * an **absolute saturation** rather than a factor of the seed. That last
282
+ * part is the point: a color can now be more saturated than its theme, so
283
+ * honoring a brand color no longer means re-seeding the whole theme to reach
284
+ * it.
285
+ *
286
+ * The **light, normal-contrast** variant reproduces the value exactly
287
+ * (a local `lightTone: false`, matching the value-shorthand form of
288
+ * `glaze.color()`). Dark and high-contrast variants adapt as usual — they
289
+ * are where readability outranks fidelity, and a color pinned across every
290
+ * scheme would defeat both. A `contrast` floor still applies everywhere and
291
+ * still only moves the color when the authored value misses it.
292
+ *
293
+ * Sibling fields override what the value supplied, so
294
+ * `{ from: '#2F5BFF', hue: 300 }` keeps its saturation and tone but rotates
295
+ * the hue.
296
+ */
297
+ from?: GlazeColorValue;
274
298
  /**
275
299
  * Tone value (0–100, contrast-uniform — see `docs/okhst.md`).
276
300
  * - Number: absolute tone.
277
301
  * - String ('+N' / '-N'): relative to base color's tone (requires `base`).
278
302
  * - `'max'` / `'min'`: force to the scheme's tone extreme (no base needed).
303
+ *
304
+ * Defaults to the tone of `from` when that is set.
279
305
  */
280
306
  tone?: HCPair<ToneValue>;
281
- /** Saturation factor applied to the seed saturation (0–1, default: 1). */
307
+ /**
308
+ * Saturation factor applied to the seed saturation (0–1, default: 1).
309
+ *
310
+ * With `from`, an explicit value here is still a factor of the seed and
311
+ * overrides the absolute saturation the color carried.
312
+ */
282
313
  saturation?: number;
283
314
  /**
284
315
  * Hue override for this color.
@@ -542,15 +573,15 @@ interface GlazeConfig {
542
573
  shadowTuning?: ShadowTuning;
543
574
  /**
544
575
  * Manual contrast level — a 0–100 slider from normal contrast (`0`) to high
545
- * contrast (`100`), or `'auto'` (the default) to keep the two-tier
546
- * normal + high-contrast model.
576
+ * contrast (`100`), or `'auto'` (the default) to take the authored normal
577
+ * entries as-is.
547
578
  *
548
- * With a number, Glaze resolves the `light` / `dark` variants *at* that
549
- * level and stops emitting a separate high-contrast tier:
550
- * `lightContrast` / `darkContrast` mirror their normal counterparts and
551
- * `modes.highContrast` defaults to `false`. Level `0` is therefore "normal
552
- * contrast, no high-contrast tier"; `100` is "the high-contrast scheme as
553
- * the only scheme".
579
+ * With a number, Glaze resolves the `light` / `dark` variants *at* that level.
580
+ * That is all it does: `lightContrast` / `darkContrast` stay the true
581
+ * high-contrast resolution at every level, and `modes.highContrast` alone
582
+ * decides whether they are emitted. Level `0` therefore reproduces `'auto'`
583
+ * bit for bit. At `100` the normal variants *are* the high-contrast ones, so a
584
+ * separate tier would duplicate them and a global level of 100 drops it.
554
585
  *
555
586
  * The level interpolates all three things that make high contrast differ:
556
587
  * authored `[normal, highContrast]` pairs, the tone-window widening, and
@@ -600,8 +631,8 @@ interface GlazeConfigResolved {
600
631
  shadowTuning?: ShadowTuning;
601
632
  autoFlip: boolean;
602
633
  /**
603
- * Manual contrast level (0–100), or `'auto'` for the two-tier
604
- * normal + high-contrast model.
634
+ * Manual contrast level (0–100) for the normal variants, or `'auto'` to take
635
+ * the authored normal entries as-is.
605
636
  * @see GlazeConfig.contrastLevel
606
637
  */
607
638
  contrastLevel: number | 'auto';
@@ -631,8 +662,10 @@ interface GlazeConfigOverride {
631
662
  /** Whether to auto-flip tone when contrast can't be met. */
632
663
  autoFlip?: boolean;
633
664
  /**
634
- * Manual contrast level (0–100) for this instance, or `'auto'` to opt out
635
- * of a global level and keep the two-tier normal + high-contrast model.
665
+ * Manual contrast level (0–100) for this instance, or `'auto'` to opt out of a
666
+ * global level and take the authored normal entries as-is. Either way the
667
+ * instance keeps its high-contrast tier; a per-instance level never changes
668
+ * which modes are emitted.
636
669
  *
637
670
  * Only an instance-authored level is frozen into `.export()` snapshots — a
638
671
  * level inherited from the global config is treated as a live preference and