@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.cjs
CHANGED
|
@@ -1979,15 +1979,18 @@ function resolveContrastSpec(spec, isHighContrast, polarity) {
|
|
|
1979
1979
|
/**
|
|
1980
1980
|
* Apply the relative-tone delta against a base, honoring `flip`.
|
|
1981
1981
|
*
|
|
1982
|
-
* When `flip` is on and `base + delta` falls outside `[0, 100]`,
|
|
1983
|
-
* delta to the other side of the base
|
|
1984
|
-
*
|
|
1982
|
+
* When `flip` is on and `base + delta` falls outside `[0, 100]`, try mirroring
|
|
1983
|
+
* the delta to the other side of the base. If the mirrored target is also out
|
|
1984
|
+
* of range, keep the original delta so the caller clamps on the authored side.
|
|
1985
|
+
* When off, the caller clamps as usual.
|
|
1985
1986
|
*/
|
|
1986
1987
|
function applyToneFlip(delta, baseTone, flip) {
|
|
1987
1988
|
if (!flip) return delta;
|
|
1988
1989
|
const target = baseTone + delta;
|
|
1989
1990
|
if (target >= 0 && target <= 100) return delta;
|
|
1990
|
-
|
|
1991
|
+
const mirrored = baseTone - delta;
|
|
1992
|
+
if (mirrored >= 0 && mirrored <= 100) return -delta;
|
|
1993
|
+
return delta;
|
|
1991
1994
|
}
|
|
1992
1995
|
function resolveRootColor(def, isHighContrast) {
|
|
1993
1996
|
const rawT = def.tone;
|