@tenphi/glaze 0.16.2 → 0.17.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.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +14 -14
- package/docs/methodology.md +3 -3
- package/docs/migration.md +6 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -248,7 +248,7 @@ interface RegularColorDef {
|
|
|
248
248
|
* Defaults to the global `autoFlip` config (default `true`). Set `false`
|
|
249
249
|
* to clamp instead.
|
|
250
250
|
*/
|
|
251
|
-
|
|
251
|
+
autoFlip?: boolean;
|
|
252
252
|
/**
|
|
253
253
|
* Fixed opacity (0–1).
|
|
254
254
|
* Output includes alpha in the CSS value.
|
|
@@ -565,7 +565,7 @@ interface GlazeColorInput {
|
|
|
565
565
|
saturationFactor?: number;
|
|
566
566
|
mode?: AdaptationMode;
|
|
567
567
|
/** Flip out-of-bounds results instead of clamping. Default: global `autoFlip`. */
|
|
568
|
-
|
|
568
|
+
autoFlip?: boolean;
|
|
569
569
|
/**
|
|
570
570
|
* Fixed opacity (0–1). Output includes alpha in the CSS value.
|
|
571
571
|
* Combining with `contrast` is not recommended (perceived tone
|
|
@@ -660,7 +660,7 @@ interface GlazeColorOverrides {
|
|
|
660
660
|
* `contrast`) to the opposite side instead of clamping. Defaults to
|
|
661
661
|
* the global `autoFlip`.
|
|
662
662
|
*/
|
|
663
|
-
|
|
663
|
+
autoFlip?: boolean;
|
|
664
664
|
/**
|
|
665
665
|
* Contrast floor. By default solved against the literal seed
|
|
666
666
|
* (the value itself); when `base` is set, solved against the base's
|
|
@@ -832,7 +832,7 @@ interface GlazeColorInputExport {
|
|
|
832
832
|
tone: HCPair<number | ExtremeValue>;
|
|
833
833
|
saturationFactor?: number;
|
|
834
834
|
mode?: AdaptationMode;
|
|
835
|
-
|
|
835
|
+
autoFlip?: boolean;
|
|
836
836
|
opacity?: number;
|
|
837
837
|
base?: GlazeColorTokenExport | GlazeColorValue;
|
|
838
838
|
contrast?: HCPair<ContrastSpec>;
|
|
@@ -850,7 +850,7 @@ interface GlazeColorOverridesExport {
|
|
|
850
850
|
tone?: HCPair<ToneValue>;
|
|
851
851
|
saturationFactor?: number;
|
|
852
852
|
mode?: AdaptationMode;
|
|
853
|
-
|
|
853
|
+
autoFlip?: boolean;
|
|
854
854
|
contrast?: HCPair<ContrastSpec>;
|
|
855
855
|
base?: GlazeColorTokenExport | GlazeColorValue;
|
|
856
856
|
opacity?: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -248,7 +248,7 @@ interface RegularColorDef {
|
|
|
248
248
|
* Defaults to the global `autoFlip` config (default `true`). Set `false`
|
|
249
249
|
* to clamp instead.
|
|
250
250
|
*/
|
|
251
|
-
|
|
251
|
+
autoFlip?: boolean;
|
|
252
252
|
/**
|
|
253
253
|
* Fixed opacity (0–1).
|
|
254
254
|
* Output includes alpha in the CSS value.
|
|
@@ -565,7 +565,7 @@ interface GlazeColorInput {
|
|
|
565
565
|
saturationFactor?: number;
|
|
566
566
|
mode?: AdaptationMode;
|
|
567
567
|
/** Flip out-of-bounds results instead of clamping. Default: global `autoFlip`. */
|
|
568
|
-
|
|
568
|
+
autoFlip?: boolean;
|
|
569
569
|
/**
|
|
570
570
|
* Fixed opacity (0–1). Output includes alpha in the CSS value.
|
|
571
571
|
* Combining with `contrast` is not recommended (perceived tone
|
|
@@ -660,7 +660,7 @@ interface GlazeColorOverrides {
|
|
|
660
660
|
* `contrast`) to the opposite side instead of clamping. Defaults to
|
|
661
661
|
* the global `autoFlip`.
|
|
662
662
|
*/
|
|
663
|
-
|
|
663
|
+
autoFlip?: boolean;
|
|
664
664
|
/**
|
|
665
665
|
* Contrast floor. By default solved against the literal seed
|
|
666
666
|
* (the value itself); when `base` is set, solved against the base's
|
|
@@ -832,7 +832,7 @@ interface GlazeColorInputExport {
|
|
|
832
832
|
tone: HCPair<number | ExtremeValue>;
|
|
833
833
|
saturationFactor?: number;
|
|
834
834
|
mode?: AdaptationMode;
|
|
835
|
-
|
|
835
|
+
autoFlip?: boolean;
|
|
836
836
|
opacity?: number;
|
|
837
837
|
base?: GlazeColorTokenExport | GlazeColorValue;
|
|
838
838
|
contrast?: HCPair<ContrastSpec>;
|
|
@@ -850,7 +850,7 @@ interface GlazeColorOverridesExport {
|
|
|
850
850
|
tone?: HCPair<ToneValue>;
|
|
851
851
|
saturationFactor?: number;
|
|
852
852
|
mode?: AdaptationMode;
|
|
853
|
-
|
|
853
|
+
autoFlip?: boolean;
|
|
854
854
|
contrast?: HCPair<ContrastSpec>;
|
|
855
855
|
base?: GlazeColorTokenExport | GlazeColorValue;
|
|
856
856
|
opacity?: number;
|
package/dist/index.mjs
CHANGED
|
@@ -1853,7 +1853,7 @@ function resolveDependentColor(name, def, ctx, isHighContrast, isDark, effective
|
|
|
1853
1853
|
if (!baseResolved) throw new Error(`glaze: base "${baseName}" not yet resolved for "${name}".`);
|
|
1854
1854
|
const mode = def.mode ?? "auto";
|
|
1855
1855
|
const satFactor = clamp(def.saturation ?? 1, 0, 1);
|
|
1856
|
-
const flip = def.
|
|
1856
|
+
const flip = def.autoFlip ?? ctx.config.autoFlip;
|
|
1857
1857
|
const pastel = effectivePastel;
|
|
1858
1858
|
const baseVariant = getSchemeVariant(baseResolved, isDark, isHighContrast);
|
|
1859
1859
|
const baseTone = baseVariant.t * 100;
|
|
@@ -2930,7 +2930,7 @@ function buildStandaloneValueDefs(main, options) {
|
|
|
2930
2930
|
tone: toneOption ?? seedTone,
|
|
2931
2931
|
contrast: options?.contrast,
|
|
2932
2932
|
mode: options?.mode ?? "auto",
|
|
2933
|
-
|
|
2933
|
+
autoFlip: options?.autoFlip,
|
|
2934
2934
|
opacity: options?.opacity,
|
|
2935
2935
|
pastel: options?.pastel,
|
|
2936
2936
|
role: options?.role,
|
|
@@ -3072,7 +3072,7 @@ function createColorToken(input, configOverride) {
|
|
|
3072
3072
|
tone: input.tone,
|
|
3073
3073
|
saturation: input.saturationFactor,
|
|
3074
3074
|
mode: input.mode ?? "auto",
|
|
3075
|
-
|
|
3075
|
+
autoFlip: input.autoFlip,
|
|
3076
3076
|
contrast: input.contrast,
|
|
3077
3077
|
opacity: input.opacity,
|
|
3078
3078
|
pastel: input.pastel,
|
|
@@ -3122,7 +3122,7 @@ function buildOverridesExport(options) {
|
|
|
3122
3122
|
if (options.tone !== void 0) out.tone = options.tone;
|
|
3123
3123
|
if (options.saturationFactor !== void 0) out.saturationFactor = options.saturationFactor;
|
|
3124
3124
|
if (options.mode !== void 0) out.mode = options.mode;
|
|
3125
|
-
if (options.
|
|
3125
|
+
if (options.autoFlip !== void 0) out.autoFlip = options.autoFlip;
|
|
3126
3126
|
if (options.contrast !== void 0) out.contrast = options.contrast;
|
|
3127
3127
|
if (options.opacity !== void 0) out.opacity = options.opacity;
|
|
3128
3128
|
if (options.name !== void 0) out.name = options.name;
|
|
@@ -3139,7 +3139,7 @@ function buildStructuredInputExport(input) {
|
|
|
3139
3139
|
};
|
|
3140
3140
|
if (input.saturationFactor !== void 0) out.saturationFactor = input.saturationFactor;
|
|
3141
3141
|
if (input.mode !== void 0) out.mode = input.mode;
|
|
3142
|
-
if (input.
|
|
3142
|
+
if (input.autoFlip !== void 0) out.autoFlip = input.autoFlip;
|
|
3143
3143
|
if (input.opacity !== void 0) out.opacity = input.opacity;
|
|
3144
3144
|
if (input.contrast !== void 0) out.contrast = input.contrast;
|
|
3145
3145
|
if (input.name !== void 0) out.name = input.name;
|
|
@@ -3161,7 +3161,7 @@ function rehydrateOverrides(data) {
|
|
|
3161
3161
|
if (data.tone !== void 0) out.tone = data.tone;
|
|
3162
3162
|
if (data.saturationFactor !== void 0) out.saturationFactor = data.saturationFactor;
|
|
3163
3163
|
if (data.mode !== void 0) out.mode = data.mode;
|
|
3164
|
-
if (data.
|
|
3164
|
+
if (data.autoFlip !== void 0) out.autoFlip = data.autoFlip;
|
|
3165
3165
|
if (data.contrast !== void 0) out.contrast = data.contrast;
|
|
3166
3166
|
if (data.opacity !== void 0) out.opacity = data.opacity;
|
|
3167
3167
|
if (data.name !== void 0) out.name = data.name;
|
|
@@ -3178,7 +3178,7 @@ function rehydrateStructuredInput(data) {
|
|
|
3178
3178
|
};
|
|
3179
3179
|
if (data.saturationFactor !== void 0) out.saturationFactor = data.saturationFactor;
|
|
3180
3180
|
if (data.mode !== void 0) out.mode = data.mode;
|
|
3181
|
-
if (data.
|
|
3181
|
+
if (data.autoFlip !== void 0) out.autoFlip = data.autoFlip;
|
|
3182
3182
|
if (data.opacity !== void 0) out.opacity = data.opacity;
|
|
3183
3183
|
if (data.contrast !== void 0) out.contrast = data.contrast;
|
|
3184
3184
|
if (data.name !== void 0) out.name = data.name;
|