@tenphi/glaze 1.1.0 → 1.1.1
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 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +5 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -261,7 +261,8 @@ interface RegularColorDef {
|
|
|
261
261
|
* Whether to flip out-of-bounds results to the opposite side instead of
|
|
262
262
|
* clamping to the extreme. Affects both:
|
|
263
263
|
* - relative `tone`: when `base ± delta` exceeds `[0, 100]`, mirror the
|
|
264
|
-
* delta to the other side of the base.
|
|
264
|
+
* delta to the other side of the base. If the mirrored target is also
|
|
265
|
+
* out of range, keep the original delta and clamp on the authored side.
|
|
265
266
|
* - `contrast`: when the requested direction can't meet the floor, try the
|
|
266
267
|
* opposite side (same as the global `autoFlip`).
|
|
267
268
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -261,7 +261,8 @@ interface RegularColorDef {
|
|
|
261
261
|
* Whether to flip out-of-bounds results to the opposite side instead of
|
|
262
262
|
* clamping to the extreme. Affects both:
|
|
263
263
|
* - relative `tone`: when `base ± delta` exceeds `[0, 100]`, mirror the
|
|
264
|
-
* delta to the other side of the base.
|
|
264
|
+
* delta to the other side of the base. If the mirrored target is also
|
|
265
|
+
* out of range, keep the original delta and clamp on the authored side.
|
|
265
266
|
* - `contrast`: when the requested direction can't meet the floor, try the
|
|
266
267
|
* opposite side (same as the global `autoFlip`).
|
|
267
268
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1977,15 +1977,18 @@ function resolveContrastSpec(spec, isHighContrast, polarity) {
|
|
|
1977
1977
|
/**
|
|
1978
1978
|
* Apply the relative-tone delta against a base, honoring `flip`.
|
|
1979
1979
|
*
|
|
1980
|
-
* When `flip` is on and `base + delta` falls outside `[0, 100]`,
|
|
1981
|
-
* delta to the other side of the base
|
|
1982
|
-
*
|
|
1980
|
+
* When `flip` is on and `base + delta` falls outside `[0, 100]`, try mirroring
|
|
1981
|
+
* the delta to the other side of the base. If the mirrored target is also out
|
|
1982
|
+
* of range, keep the original delta so the caller clamps on the authored side.
|
|
1983
|
+
* When off, the caller clamps as usual.
|
|
1983
1984
|
*/
|
|
1984
1985
|
function applyToneFlip(delta, baseTone, flip) {
|
|
1985
1986
|
if (!flip) return delta;
|
|
1986
1987
|
const target = baseTone + delta;
|
|
1987
1988
|
if (target >= 0 && target <= 100) return delta;
|
|
1988
|
-
|
|
1989
|
+
const mirrored = baseTone - delta;
|
|
1990
|
+
if (mirrored >= 0 && mirrored <= 100) return -delta;
|
|
1991
|
+
return delta;
|
|
1989
1992
|
}
|
|
1990
1993
|
function resolveRootColor(def, isHighContrast) {
|
|
1991
1994
|
const rawT = def.tone;
|