fashionable 0.0.0 → 0.2.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/LICENSE.md +21 -0
- package/README.md +276 -0
- package/dist/calc/index.d.mts +2 -0
- package/dist/calc/index.mjs +2 -0
- package/dist/data/index.d.mts +208 -0
- package/dist/data/index.mjs +696 -0
- package/dist/data/index.mjs.map +1 -0
- package/dist/declaration/index.d.mts +2 -0
- package/dist/declaration/index.mjs +74 -0
- package/dist/declaration/index.mjs.map +1 -0
- package/dist/fontFace/index.d.mts +2 -0
- package/dist/fontFace/index.mjs +102 -0
- package/dist/fontFace/index.mjs.map +1 -0
- package/dist/property/index.d.mts +2 -0
- package/dist/property/index.mjs +293 -0
- package/dist/property/index.mjs.map +1 -0
- package/dist/query/index.d.mts +2 -0
- package/dist/query/index.mjs +62 -0
- package/dist/query/index.mjs.map +1 -0
- package/dist/rule/index.d.mts +2 -0
- package/dist/rule/index.mjs +234 -0
- package/dist/rule/index.mjs.map +1 -0
- package/dist/selector/index.d.mts +2 -0
- package/dist/selector/index.mjs +178 -0
- package/dist/selector/index.mjs.map +1 -0
- package/dist/shared/calc-Cih4o2r7.mjs +1145 -0
- package/dist/shared/calc-Cih4o2r7.mjs.map +1 -0
- package/dist/shared/color-BvNJ2YqL.d.mts +590 -0
- package/dist/shared/color.internal-Dts5ycTm.mjs +450 -0
- package/dist/shared/color.internal-Dts5ycTm.mjs.map +1 -0
- package/dist/shared/declaration-1DlO_ltT.d.mts +166 -0
- package/dist/shared/declaration.internal-wLB4ssxC.mjs +73 -0
- package/dist/shared/declaration.internal-wLB4ssxC.mjs.map +1 -0
- package/dist/shared/equal-U9G5LhtL.mjs +71 -0
- package/dist/shared/equal-U9G5LhtL.mjs.map +1 -0
- package/dist/shared/fontFaceRule-C7nYgH6X.d.mts +294 -0
- package/dist/shared/fontFaceRule.internal-D5u48TUO.mjs +214 -0
- package/dist/shared/fontFaceRule.internal-D5u48TUO.mjs.map +1 -0
- package/dist/shared/format-B9jsmCER.mjs +53 -0
- package/dist/shared/format-B9jsmCER.mjs.map +1 -0
- package/dist/shared/index-BvtwY4FQ.d.mts +841 -0
- package/dist/shared/mediaQuery-BYR1z-iD.d.mts +145 -0
- package/dist/shared/mediaQuery.internal-B6iuMd75.mjs +100 -0
- package/dist/shared/mediaQuery.internal-B6iuMd75.mjs.map +1 -0
- package/dist/shared/mediaRule-BDB4WCYy.d.mts +558 -0
- package/dist/shared/precision.internal-0lv1nEpF.mjs +40 -0
- package/dist/shared/precision.internal-0lv1nEpF.mjs.map +1 -0
- package/dist/shared/propertyRule-BbkFh9b9.d.mts +466 -0
- package/dist/shared/propertyRule.internal-Bc_HrfcL.mjs +246 -0
- package/dist/shared/propertyRule.internal-Bc_HrfcL.mjs.map +1 -0
- package/dist/shared/render-BqcFH9Vr.mjs +9 -0
- package/dist/shared/render-BqcFH9Vr.mjs.map +1 -0
- package/dist/shared/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/shared/ruleSet.internal-DodzVMUU.mjs +218 -0
- package/dist/shared/ruleSet.internal-DodzVMUU.mjs.map +1 -0
- package/dist/shared/selector-HZY-W6l6.d.mts +346 -0
- package/dist/shared/selector.internal-ESe9s0IH.mjs +290 -0
- package/dist/shared/selector.internal-ESe9s0IH.mjs.map +1 -0
- package/dist/shared/utils-BKm298I-.d.mts +179 -0
- package/dist/stylesheet/index.d.mts +316 -0
- package/dist/stylesheet/index.mjs +296 -0
- package/dist/stylesheet/index.mjs.map +1 -0
- package/dist/utils.d.mts +2 -0
- package/dist/utils.mjs +131 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +96 -8
- package/index.js +0 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { Pipeable, dual, invariant } from "../utils.mjs";
|
|
2
|
+
import { i as equals$1, n as HashTypeId, r as combine, s as hashString, t as EqualTypeId } from "./equal-U9G5LhtL.mjs";
|
|
3
|
+
import { t as DEFAULT_FORMAT } from "./format-B9jsmCER.mjs";
|
|
4
|
+
import { C as EMPTY_REFS, S as toCalc, _ as nodeOf, a as multiply, b as serializeNode, f as identsOf, g as nodeHash, h as nodeEquals, i as mod, l as collectBindings, m as needsCalcWrap, n as add, o as sign, s as subtract, u as dimension, v as refsOf$1, w as unionRefs, x as substituteNode } from "./calc-Cih4o2r7.mjs";
|
|
5
|
+
import { i as toSpec } from "./precision.internal-0lv1nEpF.mjs";
|
|
6
|
+
//#region src/data/colorSpace.internal.ts
|
|
7
|
+
const ColorSpaceTypeId = Symbol.for("fashionable/data/colorSpace");
|
|
8
|
+
var ColorSpaceImpl = class {
|
|
9
|
+
token;
|
|
10
|
+
wrap;
|
|
11
|
+
[ColorSpaceTypeId] = ColorSpaceTypeId;
|
|
12
|
+
constructor(token, wrap) {
|
|
13
|
+
this.token = token;
|
|
14
|
+
this.wrap = wrap;
|
|
15
|
+
}
|
|
16
|
+
get [Symbol.toStringTag]() {
|
|
17
|
+
return `ColorSpace(${this.token})`;
|
|
18
|
+
}
|
|
19
|
+
get [Symbol.for("nodejs.util.inspect.custom")]() {
|
|
20
|
+
return this[Symbol.toStringTag];
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/** @internal */
|
|
24
|
+
const srgb$1 = new ColorSpaceImpl("srgb", "color");
|
|
25
|
+
/** @internal */
|
|
26
|
+
const srgbLinear = new ColorSpaceImpl("srgb-linear", "color");
|
|
27
|
+
/** @internal */
|
|
28
|
+
const displayP3 = new ColorSpaceImpl("display-p3", "color");
|
|
29
|
+
/** @internal */
|
|
30
|
+
const a98Rgb = new ColorSpaceImpl("a98-rgb", "color");
|
|
31
|
+
/** @internal */
|
|
32
|
+
const prophotoRgb = new ColorSpaceImpl("prophoto-rgb", "color");
|
|
33
|
+
/** @internal */
|
|
34
|
+
const rec2020 = new ColorSpaceImpl("rec2020", "color");
|
|
35
|
+
/** @internal */
|
|
36
|
+
const lab = new ColorSpaceImpl("lab", "function");
|
|
37
|
+
/** @internal */
|
|
38
|
+
const oklab = new ColorSpaceImpl("oklab", "function");
|
|
39
|
+
/** @internal */
|
|
40
|
+
const xyz = new ColorSpaceImpl("xyz", "color");
|
|
41
|
+
/** @internal */
|
|
42
|
+
const xyzD50 = new ColorSpaceImpl("xyz-d50", "color");
|
|
43
|
+
/** @internal */
|
|
44
|
+
const xyzD65 = new ColorSpaceImpl("xyz-d65", "color");
|
|
45
|
+
/** @internal */
|
|
46
|
+
const hsl = new ColorSpaceImpl("hsl", "function");
|
|
47
|
+
/** @internal */
|
|
48
|
+
const hwb = new ColorSpaceImpl("hwb", "function");
|
|
49
|
+
/** @internal */
|
|
50
|
+
const lch = new ColorSpaceImpl("lch", "function");
|
|
51
|
+
/** @internal */
|
|
52
|
+
const oklch$1 = new ColorSpaceImpl("oklch", "function");
|
|
53
|
+
/** @internal */
|
|
54
|
+
const dataOf = (space) => space;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/data/hueInterpolation.internal.ts
|
|
57
|
+
const HueInterpolationTypeId = Symbol.for("fashionable/data/hueInterpolation");
|
|
58
|
+
var HueInterpolationImpl = class {
|
|
59
|
+
strategy;
|
|
60
|
+
[HueInterpolationTypeId] = HueInterpolationTypeId;
|
|
61
|
+
constructor(strategy) {
|
|
62
|
+
this.strategy = strategy;
|
|
63
|
+
}
|
|
64
|
+
get [Symbol.toStringTag]() {
|
|
65
|
+
return `HueInterpolation(${this.strategy})`;
|
|
66
|
+
}
|
|
67
|
+
get [Symbol.for("nodejs.util.inspect.custom")]() {
|
|
68
|
+
return this[Symbol.toStringTag];
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/** @internal */
|
|
72
|
+
const shorter = new HueInterpolationImpl("shorter");
|
|
73
|
+
/** @internal */
|
|
74
|
+
const longer = new HueInterpolationImpl("longer");
|
|
75
|
+
/** @internal */
|
|
76
|
+
const increasing = new HueInterpolationImpl("increasing");
|
|
77
|
+
/** @internal */
|
|
78
|
+
const decreasing = new HueInterpolationImpl("decreasing");
|
|
79
|
+
/** @internal */
|
|
80
|
+
const strategyOf = (hue) => hue.strategy;
|
|
81
|
+
/** @internal */
|
|
82
|
+
const interpolate = (strategy, from, to, t) => {
|
|
83
|
+
const delta = subtract(to, from);
|
|
84
|
+
const shortest = subtract(mod(add(delta, 180), 360), 180);
|
|
85
|
+
const strat = strategyOf(strategy);
|
|
86
|
+
return add(from, multiply(strat === "increasing" ? mod(delta, 360) : strat === "decreasing" ? subtract(mod(delta, 360), 360) : strat === "longer" ? subtract(shortest, multiply(360, sign(shortest))) : shortest, t));
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/data/keywords.internal.ts
|
|
90
|
+
const NoneTypeId = Symbol.for("fashionable/data/keywords/none");
|
|
91
|
+
var NoneImpl = class extends Pipeable {
|
|
92
|
+
[NoneTypeId] = NoneTypeId;
|
|
93
|
+
get [Symbol.toStringTag]() {
|
|
94
|
+
return "Keyword(none)";
|
|
95
|
+
}
|
|
96
|
+
get [Symbol.for("nodejs.util.inspect.custom")]() {
|
|
97
|
+
return this[Symbol.toStringTag];
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/** @internal */
|
|
101
|
+
const none = new NoneImpl();
|
|
102
|
+
/** @internal */
|
|
103
|
+
const isNone = (u) => typeof u === "object" && u !== null && NoneTypeId in u;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/data/percentage.internal.ts
|
|
106
|
+
/** @internal */
|
|
107
|
+
const of = (value, precision) => dimension(value, "%", "percentage", precision);
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/data/color.internal.ts
|
|
110
|
+
const ColorTypeId = Symbol.for("fashionable/color");
|
|
111
|
+
const NONE_CHANNEL = { _tag: "NoneKeyword" };
|
|
112
|
+
const isNoneChannel = (channel) => channel === NONE_CHANNEL;
|
|
113
|
+
const channelsOf = (node) => node._tag === "Oklch" ? [
|
|
114
|
+
node.lightness,
|
|
115
|
+
node.chroma,
|
|
116
|
+
node.hue
|
|
117
|
+
] : [
|
|
118
|
+
node.red,
|
|
119
|
+
node.green,
|
|
120
|
+
node.blue
|
|
121
|
+
];
|
|
122
|
+
const mapChannel = (channel, f) => isNoneChannel(channel) ? channel : f(channel);
|
|
123
|
+
const mapColorNode = (node, f) => {
|
|
124
|
+
switch (node._tag) {
|
|
125
|
+
case "Oklch": return {
|
|
126
|
+
_tag: "Oklch",
|
|
127
|
+
lightness: mapChannel(node.lightness, f),
|
|
128
|
+
chroma: mapChannel(node.chroma, f),
|
|
129
|
+
hue: mapChannel(node.hue, f)
|
|
130
|
+
};
|
|
131
|
+
case "Srgb": return {
|
|
132
|
+
_tag: "Srgb",
|
|
133
|
+
red: mapChannel(node.red, f),
|
|
134
|
+
green: mapChannel(node.green, f),
|
|
135
|
+
blue: mapChannel(node.blue, f)
|
|
136
|
+
};
|
|
137
|
+
case "LightDark": return {
|
|
138
|
+
_tag: "LightDark",
|
|
139
|
+
light: mapColorNode(node.light, f),
|
|
140
|
+
dark: mapColorNode(node.dark, f)
|
|
141
|
+
};
|
|
142
|
+
case "ColorMix": return {
|
|
143
|
+
_tag: "ColorMix",
|
|
144
|
+
method: node.method,
|
|
145
|
+
color1: mapColorNode(node.color1, f),
|
|
146
|
+
percentage1: node.percentage1 === void 0 ? void 0 : f(node.percentage1),
|
|
147
|
+
color2: mapColorNode(node.color2, f),
|
|
148
|
+
percentage2: node.percentage2 === void 0 ? void 0 : f(node.percentage2)
|
|
149
|
+
};
|
|
150
|
+
case "Relative": return {
|
|
151
|
+
_tag: "Relative",
|
|
152
|
+
token: node.token,
|
|
153
|
+
wrap: node.wrap,
|
|
154
|
+
origin: mapColorNode(node.origin, f),
|
|
155
|
+
channels: [
|
|
156
|
+
mapChannel(node.channels[0], f),
|
|
157
|
+
mapChannel(node.channels[1], f),
|
|
158
|
+
mapChannel(node.channels[2], f)
|
|
159
|
+
],
|
|
160
|
+
alpha: node.alpha === void 0 ? void 0 : mapChannel(node.alpha, f)
|
|
161
|
+
};
|
|
162
|
+
case "ColorRef":
|
|
163
|
+
case "Named": return node;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const serializeCalcNode = (node, precision) => {
|
|
167
|
+
const wrap = needsCalcWrap(node);
|
|
168
|
+
const body = serializeNode(node, wrap, { precision });
|
|
169
|
+
return wrap ? `calc(${body})` : body;
|
|
170
|
+
};
|
|
171
|
+
const serializeChannel = (channel, precision) => isNoneChannel(channel) ? "none" : serializeCalcNode(channel, precision);
|
|
172
|
+
const serializeMethod = (method) => method.hue === void 0 ? `in ${method.colorspace}` : `in ${method.colorspace} ${method.hue} hue`;
|
|
173
|
+
const serializeMixArm = (color, percentage, precision) => {
|
|
174
|
+
const rendered = serializeColorNode(color, precision);
|
|
175
|
+
return percentage === void 0 ? rendered : `${rendered} ${serializeCalcNode(percentage, precision)}`;
|
|
176
|
+
};
|
|
177
|
+
const serializeColorNode = (node, precision) => {
|
|
178
|
+
if (node._tag === "Named") return node.name;
|
|
179
|
+
if (node._tag === "LightDark") return `light-dark(${serializeColorNode(node.light, precision)}, ${serializeColorNode(node.dark, precision)})`;
|
|
180
|
+
if (node._tag === "ColorMix") return `color-mix(${serializeMethod(node.method)}, ${serializeMixArm(node.color1, node.percentage1, precision)}, ${serializeMixArm(node.color2, node.percentage2, precision)})`;
|
|
181
|
+
if (node._tag === "ColorRef") return `var(--${node.name})`;
|
|
182
|
+
if (node._tag === "Relative") {
|
|
183
|
+
const origin = serializeColorNode(node.origin, precision);
|
|
184
|
+
const rendered = node.channels.map((channel) => serializeChannel(channel, precision)).join(" ");
|
|
185
|
+
const alpha = node.alpha === void 0 ? "" : ` / ${serializeChannel(node.alpha, precision)}`;
|
|
186
|
+
return node.wrap === "function" ? `${node.token}(from ${origin} ${rendered}${alpha})` : `color(from ${origin} ${node.token} ${rendered}${alpha})`;
|
|
187
|
+
}
|
|
188
|
+
const rendered = channelsOf(node).map((channel) => serializeChannel(channel, precision)).join(" ");
|
|
189
|
+
return node._tag === "Oklch" ? `oklch(${rendered})` : `color(srgb ${rendered})`;
|
|
190
|
+
};
|
|
191
|
+
const channelEquals = (a, b) => {
|
|
192
|
+
if (isNoneChannel(a) || isNoneChannel(b)) return a === b;
|
|
193
|
+
return nodeEquals(a, b);
|
|
194
|
+
};
|
|
195
|
+
const percentageEquals = (a, b) => a === void 0 || b === void 0 ? a === b : nodeEquals(a, b);
|
|
196
|
+
const alphaEquals = (a, b) => a === void 0 || b === void 0 ? a === b : channelEquals(a, b);
|
|
197
|
+
const colorNodeEquals = (a, b) => {
|
|
198
|
+
if (a._tag !== b._tag) return false;
|
|
199
|
+
if (a._tag === "Named") return a.name === b.name;
|
|
200
|
+
if (a._tag === "LightDark") {
|
|
201
|
+
const other = b;
|
|
202
|
+
return colorNodeEquals(a.light, other.light) && colorNodeEquals(a.dark, other.dark);
|
|
203
|
+
}
|
|
204
|
+
if (a._tag === "ColorMix") {
|
|
205
|
+
const other = b;
|
|
206
|
+
return a.method.colorspace === other.method.colorspace && a.method.hue === other.method.hue && colorNodeEquals(a.color1, other.color1) && percentageEquals(a.percentage1, other.percentage1) && colorNodeEquals(a.color2, other.color2) && percentageEquals(a.percentage2, other.percentage2);
|
|
207
|
+
}
|
|
208
|
+
if (a._tag === "ColorRef") return a.name === b.name;
|
|
209
|
+
if (a._tag === "Relative") {
|
|
210
|
+
const other = b;
|
|
211
|
+
return a.token === other.token && a.wrap === other.wrap && colorNodeEquals(a.origin, other.origin) && a.channels.every((channel, index) => channelEquals(channel, other.channels[index])) && alphaEquals(a.alpha, other.alpha);
|
|
212
|
+
}
|
|
213
|
+
const others = channelsOf(b);
|
|
214
|
+
return channelsOf(a).every((channel, index) => channelEquals(channel, others[index]));
|
|
215
|
+
};
|
|
216
|
+
const hashChannel = (channel) => isNoneChannel(channel) ? hashString("none") : nodeHash(channel);
|
|
217
|
+
const colorNodeHash = (node) => {
|
|
218
|
+
let h = hashString(node._tag);
|
|
219
|
+
if (node._tag === "Named") return combine(h, hashString(node.name));
|
|
220
|
+
if (node._tag === "ColorRef") return combine(h, hashString(node.name));
|
|
221
|
+
if (node._tag === "LightDark") {
|
|
222
|
+
h = combine(h, colorNodeHash(node.light));
|
|
223
|
+
return combine(h, colorNodeHash(node.dark));
|
|
224
|
+
}
|
|
225
|
+
if (node._tag === "ColorMix") {
|
|
226
|
+
h = combine(h, hashString(node.method.colorspace));
|
|
227
|
+
h = combine(h, node.method.hue === void 0 ? 0 : hashString(node.method.hue));
|
|
228
|
+
h = combine(h, colorNodeHash(node.color1));
|
|
229
|
+
h = combine(h, node.percentage1 === void 0 ? 0 : nodeHash(node.percentage1));
|
|
230
|
+
h = combine(h, colorNodeHash(node.color2));
|
|
231
|
+
return combine(h, node.percentage2 === void 0 ? 0 : nodeHash(node.percentage2));
|
|
232
|
+
}
|
|
233
|
+
if (node._tag === "Relative") {
|
|
234
|
+
h = combine(h, hashString(node.token));
|
|
235
|
+
h = combine(h, hashString(node.wrap));
|
|
236
|
+
h = combine(h, colorNodeHash(node.origin));
|
|
237
|
+
for (const channel of node.channels) h = combine(h, hashChannel(channel));
|
|
238
|
+
return combine(h, node.alpha === void 0 ? 0 : hashChannel(node.alpha));
|
|
239
|
+
}
|
|
240
|
+
for (const channel of channelsOf(node)) h = combine(h, hashChannel(channel));
|
|
241
|
+
return h;
|
|
242
|
+
};
|
|
243
|
+
var ColorImpl = class extends Pipeable {
|
|
244
|
+
[ColorTypeId] = ColorTypeId;
|
|
245
|
+
node;
|
|
246
|
+
refSet;
|
|
247
|
+
#hash;
|
|
248
|
+
constructor(node, refSet) {
|
|
249
|
+
super();
|
|
250
|
+
this.node = node;
|
|
251
|
+
this.refSet = refSet;
|
|
252
|
+
}
|
|
253
|
+
[EqualTypeId](that) {
|
|
254
|
+
return isColor(that) && colorNodeEquals(this.node, nodeOfColor(that));
|
|
255
|
+
}
|
|
256
|
+
[HashTypeId]() {
|
|
257
|
+
this.#hash ??= combine(hashString("fashionable/color"), colorNodeHash(this.node));
|
|
258
|
+
return this.#hash;
|
|
259
|
+
}
|
|
260
|
+
get [Symbol.toStringTag]() {
|
|
261
|
+
return `Color(${serializeColorNode(this.node, DEFAULT_FORMAT)})`;
|
|
262
|
+
}
|
|
263
|
+
get [Symbol.for("nodejs.util.inspect.custom")]() {
|
|
264
|
+
return this[Symbol.toStringTag];
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
/** @internal */
|
|
268
|
+
const isColor = (u) => typeof u === "object" && u !== null && ColorTypeId in u;
|
|
269
|
+
/** @internal */
|
|
270
|
+
const nodeOfColor = (color) => color.node;
|
|
271
|
+
/** @internal */
|
|
272
|
+
const refsOf = (color) => color.refSet;
|
|
273
|
+
const toChannel = (input) => {
|
|
274
|
+
if (isNone(input)) return {
|
|
275
|
+
node: NONE_CHANNEL,
|
|
276
|
+
refs: EMPTY_REFS
|
|
277
|
+
};
|
|
278
|
+
const calc = toCalc(input);
|
|
279
|
+
return {
|
|
280
|
+
node: nodeOf(calc),
|
|
281
|
+
refs: refsOf$1(calc)
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
/** @internal */
|
|
285
|
+
function oklch(lightness, chroma, hue) {
|
|
286
|
+
const l = toChannel(lightness);
|
|
287
|
+
const c = toChannel(chroma);
|
|
288
|
+
const h = toChannel(hue);
|
|
289
|
+
return new ColorImpl({
|
|
290
|
+
_tag: "Oklch",
|
|
291
|
+
lightness: l.node,
|
|
292
|
+
chroma: c.node,
|
|
293
|
+
hue: h.node
|
|
294
|
+
}, unionRefs(l.refs, c.refs, h.refs));
|
|
295
|
+
}
|
|
296
|
+
/** @internal */
|
|
297
|
+
function srgb(red, green, blue) {
|
|
298
|
+
const r = toChannel(red);
|
|
299
|
+
const g = toChannel(green);
|
|
300
|
+
const b = toChannel(blue);
|
|
301
|
+
return new ColorImpl({
|
|
302
|
+
_tag: "Srgb",
|
|
303
|
+
red: r.node,
|
|
304
|
+
green: g.node,
|
|
305
|
+
blue: b.node
|
|
306
|
+
}, unionRefs(r.refs, g.refs, b.refs));
|
|
307
|
+
}
|
|
308
|
+
const CSS_WIDE_KEYWORDS = /* @__PURE__ */ new Set([
|
|
309
|
+
"inherit",
|
|
310
|
+
"initial",
|
|
311
|
+
"unset",
|
|
312
|
+
"revert",
|
|
313
|
+
"revert-layer",
|
|
314
|
+
"default"
|
|
315
|
+
]);
|
|
316
|
+
/** @internal */
|
|
317
|
+
const named = (name) => {
|
|
318
|
+
invariant(name.length > 0, "Named color must be a non-empty string");
|
|
319
|
+
invariant(!CSS_WIDE_KEYWORDS.has(name.toLowerCase()), `Named color must not be a CSS-wide keyword, got '${name}'`);
|
|
320
|
+
return new ColorImpl({
|
|
321
|
+
_tag: "Named",
|
|
322
|
+
name
|
|
323
|
+
}, EMPTY_REFS);
|
|
324
|
+
};
|
|
325
|
+
/** @internal */
|
|
326
|
+
const transparent = named("transparent");
|
|
327
|
+
/** @internal */
|
|
328
|
+
const ref = (name) => {
|
|
329
|
+
invariant(name.length > 0, "Color reference name must be a non-empty string");
|
|
330
|
+
return new ColorImpl({
|
|
331
|
+
_tag: "ColorRef",
|
|
332
|
+
name
|
|
333
|
+
}, /* @__PURE__ */ new Set([name]));
|
|
334
|
+
};
|
|
335
|
+
/** @internal */
|
|
336
|
+
function lightDark(light, dark) {
|
|
337
|
+
return new ColorImpl({
|
|
338
|
+
_tag: "LightDark",
|
|
339
|
+
light: nodeOfColor(light),
|
|
340
|
+
dark: nodeOfColor(dark)
|
|
341
|
+
}, unionRefs(refsOf(light), refsOf(dark)));
|
|
342
|
+
}
|
|
343
|
+
const toArm = (arm) => {
|
|
344
|
+
if (isColor(arm)) return {
|
|
345
|
+
color: nodeOfColor(arm),
|
|
346
|
+
percentage: void 0,
|
|
347
|
+
refs: refsOf(arm)
|
|
348
|
+
};
|
|
349
|
+
const [color, percentage] = arm;
|
|
350
|
+
const pct = typeof percentage === "number" ? of(percentage) : percentage;
|
|
351
|
+
return {
|
|
352
|
+
color: nodeOfColor(color),
|
|
353
|
+
percentage: nodeOf(pct),
|
|
354
|
+
refs: unionRefs(refsOf(color), refsOf$1(pct))
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
/** @internal */
|
|
358
|
+
function mix(space, arg2, arg3, arg4) {
|
|
359
|
+
const hasHue = arg4 !== void 0;
|
|
360
|
+
const hue = hasHue ? strategyOf(arg2) : void 0;
|
|
361
|
+
const a1 = toArm(hasHue ? arg3 : arg2);
|
|
362
|
+
const a2 = toArm(hasHue ? arg4 : arg3);
|
|
363
|
+
return new ColorImpl({
|
|
364
|
+
_tag: "ColorMix",
|
|
365
|
+
method: {
|
|
366
|
+
colorspace: dataOf(space).token,
|
|
367
|
+
hue
|
|
368
|
+
},
|
|
369
|
+
color1: a1.color,
|
|
370
|
+
percentage1: a1.percentage,
|
|
371
|
+
color2: a2.color,
|
|
372
|
+
percentage2: a2.percentage
|
|
373
|
+
}, unionRefs(a1.refs, a2.refs));
|
|
374
|
+
}
|
|
375
|
+
const relative = (token, wrap, origin, channel1, channel2, channel3, alpha) => {
|
|
376
|
+
const c1 = toChannel(channel1);
|
|
377
|
+
const c2 = toChannel(channel2);
|
|
378
|
+
const c3 = toChannel(channel3);
|
|
379
|
+
const a = alpha === void 0 ? void 0 : toChannel(alpha);
|
|
380
|
+
return new ColorImpl({
|
|
381
|
+
_tag: "Relative",
|
|
382
|
+
token,
|
|
383
|
+
wrap,
|
|
384
|
+
origin: nodeOfColor(origin),
|
|
385
|
+
channels: [
|
|
386
|
+
c1.node,
|
|
387
|
+
c2.node,
|
|
388
|
+
c3.node
|
|
389
|
+
],
|
|
390
|
+
alpha: a === void 0 ? void 0 : a.node
|
|
391
|
+
}, unionRefs(refsOf(origin), c1.refs, c2.refs, c3.refs, a === void 0 ? EMPTY_REFS : a.refs));
|
|
392
|
+
};
|
|
393
|
+
/** @internal */
|
|
394
|
+
function from(origin, space, channel1, channel2, channel3, alpha) {
|
|
395
|
+
const { token, wrap } = dataOf(space);
|
|
396
|
+
return relative(token, wrap, origin, channel1, channel2, channel3, alpha);
|
|
397
|
+
}
|
|
398
|
+
const colorRefNames = (node) => {
|
|
399
|
+
switch (node._tag) {
|
|
400
|
+
case "ColorRef": return /* @__PURE__ */ new Set([node.name]);
|
|
401
|
+
case "LightDark": return unionRefs(colorRefNames(node.light), colorRefNames(node.dark));
|
|
402
|
+
case "ColorMix": return unionRefs(colorRefNames(node.color1), colorRefNames(node.color2));
|
|
403
|
+
case "Relative": return colorRefNames(node.origin);
|
|
404
|
+
case "Oklch":
|
|
405
|
+
case "Srgb":
|
|
406
|
+
case "Named": return EMPTY_REFS;
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
const identsOfChannel = (channel) => isNoneChannel(channel) ? EMPTY_REFS : identsOf(channel);
|
|
410
|
+
const colorChannels = (node) => {
|
|
411
|
+
switch (node._tag) {
|
|
412
|
+
case "Named":
|
|
413
|
+
case "ColorRef": return EMPTY_REFS;
|
|
414
|
+
case "Oklch": return unionRefs(identsOfChannel(node.lightness), identsOfChannel(node.chroma), identsOfChannel(node.hue));
|
|
415
|
+
case "Srgb": return unionRefs(identsOfChannel(node.red), identsOfChannel(node.green), identsOfChannel(node.blue));
|
|
416
|
+
case "LightDark": return unionRefs(colorChannels(node.light), colorChannels(node.dark));
|
|
417
|
+
case "ColorMix": return unionRefs(colorChannels(node.color1), node.percentage1 === void 0 ? EMPTY_REFS : identsOf(node.percentage1), colorChannels(node.color2), node.percentage2 === void 0 ? EMPTY_REFS : identsOf(node.percentage2));
|
|
418
|
+
case "Relative": return unionRefs(colorChannels(node.origin), identsOfChannel(node.channels[0]), identsOfChannel(node.channels[1]), identsOfChannel(node.channels[2]), node.alpha === void 0 ? EMPTY_REFS : identsOfChannel(node.alpha));
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
/** @internal */
|
|
422
|
+
const bind = dual(2, (color, bindings) => {
|
|
423
|
+
const collected = collectBindings(refsOf(color), bindings);
|
|
424
|
+
const node = mapColorNode(nodeOfColor(color), (channel) => substituteNode(channel, collected.nodeBindings));
|
|
425
|
+
return new ColorImpl(node, unionRefs(collected.refSet, colorRefNames(node)));
|
|
426
|
+
});
|
|
427
|
+
/** @internal */
|
|
428
|
+
function serialize(color, options) {
|
|
429
|
+
let node = nodeOfColor(color);
|
|
430
|
+
if (options?.bindings !== void 0) {
|
|
431
|
+
const collected = collectBindings(refsOf(color), options.bindings);
|
|
432
|
+
node = mapColorNode(node, (channel) => substituteNode(channel, collected.nodeBindings));
|
|
433
|
+
}
|
|
434
|
+
const precision = options?.precision === void 0 ? DEFAULT_FORMAT : toSpec(options.precision);
|
|
435
|
+
return serializeColorNode(node, precision);
|
|
436
|
+
}
|
|
437
|
+
/** @internal */
|
|
438
|
+
function refs(color) {
|
|
439
|
+
return refsOf(color);
|
|
440
|
+
}
|
|
441
|
+
/** @internal */
|
|
442
|
+
function channels(color) {
|
|
443
|
+
return colorChannels(nodeOfColor(color));
|
|
444
|
+
}
|
|
445
|
+
/** @internal */
|
|
446
|
+
const equals = dual(2, (self, that) => equals$1(self, that));
|
|
447
|
+
//#endregion
|
|
448
|
+
export { oklab as A, shorter as C, hwb as D, hsl as E, srgbLinear as F, xyz as I, xyzD50 as L, prophotoRgb as M, rec2020 as N, lab as O, srgb$1 as P, xyzD65 as R, longer as S, displayP3 as T, isNone as _, isColor as a, increasing as b, named as c, refs as d, refsOf as f, of as g, transparent as h, from as i, oklch$1 as j, lch as k, oklch as l, srgb as m, channels as n, lightDark as o, serialize as p, equals as r, mix as s, bind as t, ref as u, none as v, a98Rgb as w, interpolate as x, decreasing as y };
|
|
449
|
+
|
|
450
|
+
//# sourceMappingURL=color.internal-Dts5ycTm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.internal-Dts5ycTm.mjs","names":["srgb","oklch","Calc.subtract","Calc.mod","Calc.add","Calc.multiply","Calc.sign","Equal.hashString","Equal.combine","Equal.EqualTypeId","Equal.HashTypeId","#hash","calcRefsOf","percentageOf","spaceDataOf","Equal.equals"],"sources":["../../src/data/colorSpace.internal.ts","../../src/data/hueInterpolation.internal.ts","../../src/data/keywords.internal.ts","../../src/data/percentage.internal.ts","../../src/data/color.internal.ts"],"sourcesContent":["import type { ColorSpace } from './colorSpace.ts'\n\nexport const ColorSpaceTypeId = Symbol.for('fashionable/data/colorSpace')\nexport type ColorSpaceTypeId = typeof ColorSpaceTypeId\n\n/**\n * Phantom key holding a `ColorSpace`'s `Trait` parameter. The runtime value\n * never has a value here — traits are type-level brands, so a space is\n * identical at runtime whatever its traits (the curvy trait pattern).\n *\n * @internal\n */\nexport const ColorSpaceTraits: unique symbol = Symbol.for('fashionable/data/colorSpace/traits')\nexport type ColorSpaceTraits = typeof ColorSpaceTraits\n\n/**\n * How a relative color built in this space serializes: a named color function\n * (`oklch(from ...)`) or the `color()` wrapper with a colorspace token\n * (`color(from ... srgb ...)`).\n *\n * @internal\n */\nexport type Wrap = 'function' | 'color'\n\n/**\n * The erased runtime of a color space: the token that names it (`in <token>`\n * for `mix`, the destination for `from`) and how a `from` wraps. Polar-ness is\n * a type-level trait, so it carries no runtime data.\n *\n * @internal\n */\nexport interface ColorSpaceData {\n readonly token: string\n readonly wrap: Wrap\n}\n\nclass ColorSpaceImpl {\n readonly [ColorSpaceTypeId]: ColorSpaceTypeId = ColorSpaceTypeId\n\n constructor(\n readonly token: string,\n readonly wrap: Wrap,\n ) {}\n\n get [Symbol.toStringTag]() {\n return `ColorSpace(${this.token})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const srgb = new ColorSpaceImpl('srgb', 'color')\n/** @internal */\nexport const srgbLinear = new ColorSpaceImpl('srgb-linear', 'color')\n/** @internal */\nexport const displayP3 = new ColorSpaceImpl('display-p3', 'color')\n/** @internal */\nexport const a98Rgb = new ColorSpaceImpl('a98-rgb', 'color')\n/** @internal */\nexport const prophotoRgb = new ColorSpaceImpl('prophoto-rgb', 'color')\n/** @internal */\nexport const rec2020 = new ColorSpaceImpl('rec2020', 'color')\n/** @internal */\nexport const lab = new ColorSpaceImpl('lab', 'function')\n/** @internal */\nexport const oklab = new ColorSpaceImpl('oklab', 'function')\n/** @internal */\nexport const xyz = new ColorSpaceImpl('xyz', 'color')\n/** @internal */\nexport const xyzD50 = new ColorSpaceImpl('xyz-d50', 'color')\n/** @internal */\nexport const xyzD65 = new ColorSpaceImpl('xyz-d65', 'color')\n/** @internal */\nexport const hsl = new ColorSpaceImpl('hsl', 'function')\n/** @internal */\nexport const hwb = new ColorSpaceImpl('hwb', 'function')\n/** @internal */\nexport const lch = new ColorSpaceImpl('lch', 'function')\n/** @internal */\nexport const oklch = new ColorSpaceImpl('oklch', 'function')\n\n/** @internal */\nexport const dataOf = (space: ColorSpace<unknown>): ColorSpaceData =>\n space as unknown as ColorSpaceData\n","import { Calc } from '#calc'\nimport type { Input } from '#calc/calc'\nimport type { HueInterpolation } from './hueInterpolation.ts'\n\nexport const HueInterpolationTypeId = Symbol.for('fashionable/data/hueInterpolation')\nexport type HueInterpolationTypeId = typeof HueInterpolationTypeId\n\nclass HueInterpolationImpl {\n readonly [HueInterpolationTypeId]: HueInterpolationTypeId = HueInterpolationTypeId\n\n constructor(readonly strategy: string) {}\n\n get [Symbol.toStringTag]() {\n return `HueInterpolation(${this.strategy})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const shorter = new HueInterpolationImpl('shorter')\n\n/** @internal */\nexport const longer = new HueInterpolationImpl('longer')\n\n/** @internal */\nexport const increasing = new HueInterpolationImpl('increasing')\n\n/** @internal */\nexport const decreasing = new HueInterpolationImpl('decreasing')\n\n/** @internal */\nexport const strategyOf = (hue: HueInterpolation<string>): string =>\n (hue as unknown as HueInterpolationImpl).strategy\n\n/** @internal */\nexport const interpolate = (\n strategy: HueInterpolation<string>,\n from: Input<string>,\n to: Input<string>,\n t: Input<string>,\n): Calc.Calc<never> => {\n // CSS Color 4 hue fixup, branchless in degree-space (`mod` handles the\n // normalization): each strategy is a signed delta the browser adds to `from`\n // as `t` runs 0 to 1. `shorter` and `longer` are complementary arcs;\n // `increasing`/`decreasing` force the direction.\n const delta = Calc.subtract(to, from)\n const shortest = Calc.subtract(Calc.mod(Calc.add(delta, 180), 360), 180)\n const strat = strategyOf(strategy)\n const step =\n strat === 'increasing'\n ? Calc.mod(delta, 360)\n : strat === 'decreasing'\n ? Calc.subtract(Calc.mod(delta, 360), 360)\n : strat === 'longer'\n ? Calc.subtract(shortest, Calc.multiply(360, Calc.sign(shortest)))\n : shortest\n return Calc.add(from, Calc.multiply(step, t)) as unknown as Calc.Calc<never>\n}\n","import { Pipeable } from '#util'\nimport type { None } from './keywords.ts'\n\nexport const NoneTypeId = Symbol.for('fashionable/data/keywords/none')\nexport type NoneTypeId = typeof NoneTypeId\n\nclass NoneImpl extends Pipeable implements None {\n readonly [NoneTypeId]: NoneTypeId = NoneTypeId\n\n get [Symbol.toStringTag]() {\n return 'Keyword(none)'\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const none: None = new NoneImpl()\n\n/** @internal */\nexport const isNone = (u: unknown): u is None =>\n typeof u === 'object' && u !== null && NoneTypeId in u\n","import type { Calc } from '#calc/calc'\nimport { dimension } from '#calc/calc.internal'\nimport type { Precision } from '#calc/precision'\nimport type { Percent } from './units.ts'\n\n/** @internal */\nexport const of = (value: number, precision?: Precision): Calc<never, 'percentage', Percent> =>\n dimension(value, '%', 'percentage', precision)\n","import type { ApplyBindings, Bindings, Calc, Input, SerializeOptions } from '#calc/calc'\nimport {\n type CalcNode,\n collectBindings,\n identsOf,\n needsCalcWrap,\n nodeEquals,\n nodeHash,\n nodeOf,\n refsOf as calcRefsOf,\n serializeNode,\n substituteNode,\n toCalc,\n} from '#calc/calc.internal'\nimport { toSpec } from '#calc/precision.internal'\nimport * as Equal from '#internal/equal'\nimport { DEFAULT_FORMAT, type FormatSpec } from '#internal/format'\nimport { EMPTY_REFS, unionRefs } from '#internal/refs'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { Color, RelativeChannel } from './color.ts'\nimport { dataOf as spaceDataOf, type Wrap } from './colorSpace.internal.ts'\nimport type { ColorSpace } from './colorSpace.ts'\nimport { strategyOf } from './hueInterpolation.internal.ts'\nimport type { HueInterpolation } from './hueInterpolation.ts'\nimport { isNone } from './keywords.internal.ts'\nimport type { None } from './keywords.ts'\nimport { of as percentageOf } from './percentage.internal.ts'\nimport type { ChannelLeaf } from './units.ts'\n\nexport const ColorTypeId = Symbol.for('fashionable/color')\nexport type ColorTypeId = typeof ColorTypeId\n\n/**\n * A channel slot: a number expression, or CSS's missing-component\n * keyword. The `none` marker is a singleton, so channel operations\n * discriminate by reference.\n *\n * @internal\n */\nexport type ChannelNode = CalcNode | NoneChannel\n\ninterface NoneChannel {\n readonly _tag: 'NoneKeyword'\n}\n\nconst NONE_CHANNEL: NoneChannel = { _tag: 'NoneKeyword' }\n\nconst isNoneChannel = (channel: ChannelNode): channel is NoneChannel => channel === NONE_CHANNEL\n\n/** @internal */\nexport interface OklchNode {\n readonly _tag: 'Oklch'\n readonly lightness: ChannelNode\n readonly chroma: ChannelNode\n readonly hue: ChannelNode\n}\n\n/** @internal */\nexport interface SrgbNode {\n readonly _tag: 'Srgb'\n readonly red: ChannelNode\n readonly green: ChannelNode\n readonly blue: ChannelNode\n}\n\n/**\n * A named color (`transparent`, `rebeccapurple`): the name is the whole\n * value, so the node has no channels and nothing to bind.\n *\n * @internal\n */\nexport interface NamedColorNode {\n readonly _tag: 'Named'\n readonly name: string\n}\n\n/**\n * A scheme-conditional color: `light-dark(light, dark)`. Arms are whole\n * color nodes — positional, not commutative (the first slot is the\n * light scheme) — so the node operations recurse where the channel\n * functions stay flat.\n *\n * @internal\n */\nexport interface LightDarkNode {\n readonly _tag: 'LightDark'\n readonly light: ColorNode\n readonly dark: ColorNode\n}\n\n/**\n * The normalized interpolation method of a `color-mix()`: a colorspace\n * token plus, for polar spaces, an optional hue-interpolation strategy.\n * The type-level polar/rectangular split lives in `color.ts`; the node\n * carries the erased strings.\n *\n * @internal\n */\nexport interface MethodNode {\n readonly colorspace: string\n readonly hue: string | undefined\n}\n\n/**\n * A `color-mix(in method, c1 p1?, c2 p2?)`. The two arms are whole color\n * nodes, each with an optional percentage — a percentage-kind `CalcNode`,\n * never `none`, `undefined` when omitted. Arms are positional (they carry\n * their own percentages), so the node operations recurse, as `LightDark`\n * does.\n *\n * @internal\n */\nexport interface ColorMixNode {\n readonly _tag: 'ColorMix'\n readonly method: MethodNode\n readonly color1: ColorNode\n readonly percentage1: CalcNode | undefined\n readonly color2: ColorNode\n readonly percentage2: CalcNode | undefined\n}\n\n/**\n * A relative color: `oklch(from origin l c h [/ a])` or\n * `color(from origin srgb r g b [/ a])`. `token` names the destination space\n * and `wrap` selects its serialized form — a named function or the `color()`\n * wrapper — both read off the `ColorSpace` argument. `origin` is a whole color\n * node (recursed, as `LightDark` arms are). The three `channels` and the\n * optional `alpha` are calc slots whose expressions may read the origin's\n * channels through the `Channel` keywords — bare-identifier leaves that stay\n * put under bind and contribute no refs.\n *\n * @internal\n */\nexport interface RelativeNode {\n readonly _tag: 'Relative'\n readonly token: string\n readonly wrap: Wrap\n readonly origin: ColorNode\n readonly channels: readonly [ChannelNode, ChannelNode, ChannelNode]\n readonly alpha: ChannelNode | undefined\n}\n\n/**\n * A color-valued custom-property reference: `var(--name)` used as a whole\n * color. The reference is the whole value, so — like a `Named` — it has no\n * channels to descend into; it serializes `var(--name)` and reports `name` as\n * a ref. The channel-binding path cannot substitute a color into it, so its\n * ref rides through `bind` (restored structurally), the browser being the one\n * to resolve it.\n *\n * @internal\n */\nexport interface ColorRefNode {\n readonly _tag: 'ColorRef'\n readonly name: string\n}\n\n/** @internal */\nexport type ColorNode =\n | OklchNode\n | SrgbNode\n | LightDarkNode\n | NamedColorNode\n | ColorMixNode\n | RelativeNode\n | ColorRefNode\n\ntype ChannelFunctionNode = OklchNode | SrgbNode\n\nconst channelsOf = (node: ChannelFunctionNode): ReadonlyArray<ChannelNode> =>\n node._tag === 'Oklch'\n ? [node.lightness, node.chroma, node.hue]\n : [node.red, node.green, node.blue]\n\nconst mapChannel = (channel: ChannelNode, f: (channel: CalcNode) => CalcNode): ChannelNode =>\n isNoneChannel(channel) ? channel : f(channel)\n\nconst mapColorNode = (node: ColorNode, f: (channel: CalcNode) => CalcNode): ColorNode => {\n switch (node._tag) {\n case 'Oklch':\n return {\n _tag: 'Oklch',\n lightness: mapChannel(node.lightness, f),\n chroma: mapChannel(node.chroma, f),\n hue: mapChannel(node.hue, f),\n }\n case 'Srgb':\n return {\n _tag: 'Srgb',\n red: mapChannel(node.red, f),\n green: mapChannel(node.green, f),\n blue: mapChannel(node.blue, f),\n }\n case 'LightDark':\n return {\n _tag: 'LightDark',\n light: mapColorNode(node.light, f),\n dark: mapColorNode(node.dark, f),\n }\n case 'ColorMix':\n return {\n _tag: 'ColorMix',\n method: node.method,\n color1: mapColorNode(node.color1, f),\n percentage1: node.percentage1 === undefined ? undefined : f(node.percentage1),\n color2: mapColorNode(node.color2, f),\n percentage2: node.percentage2 === undefined ? undefined : f(node.percentage2),\n }\n case 'Relative':\n return {\n _tag: 'Relative',\n token: node.token,\n wrap: node.wrap,\n origin: mapColorNode(node.origin, f),\n channels: [\n mapChannel(node.channels[0], f),\n mapChannel(node.channels[1], f),\n mapChannel(node.channels[2], f),\n ],\n alpha: node.alpha === undefined ? undefined : mapChannel(node.alpha, f),\n }\n case 'ColorRef':\n case 'Named':\n return node\n }\n}\n\n// A single calc-expression slot — a channel or a percentage — wrapped in\n// `calc()` only when it is arithmetic; function forms and leaves stand alone.\nconst serializeCalcNode = (node: CalcNode, precision: FormatSpec): string => {\n const wrap = needsCalcWrap(node)\n const body = serializeNode(node, wrap, { precision })\n return wrap ? `calc(${body})` : body\n}\n\nconst serializeChannel = (channel: ChannelNode, precision: FormatSpec): string =>\n isNoneChannel(channel) ? 'none' : serializeCalcNode(channel, precision)\n\nconst serializeMethod = (method: MethodNode): string =>\n method.hue === undefined ? `in ${method.colorspace}` : `in ${method.colorspace} ${method.hue} hue`\n\nconst serializeMixArm = (\n color: ColorNode,\n percentage: CalcNode | undefined,\n precision: FormatSpec,\n): string => {\n const rendered = serializeColorNode(color, precision)\n return percentage === undefined\n ? rendered\n : `${rendered} ${serializeCalcNode(percentage, precision)}`\n}\n\nconst serializeColorNode = (node: ColorNode, precision: FormatSpec): string => {\n if (node._tag === 'Named') {\n return node.name\n }\n if (node._tag === 'LightDark') {\n return `light-dark(${serializeColorNode(node.light, precision)}, ${serializeColorNode(node.dark, precision)})`\n }\n if (node._tag === 'ColorMix') {\n return `color-mix(${serializeMethod(node.method)}, ${serializeMixArm(node.color1, node.percentage1, precision)}, ${serializeMixArm(node.color2, node.percentage2, precision)})`\n }\n if (node._tag === 'ColorRef') {\n return `var(--${node.name})`\n }\n if (node._tag === 'Relative') {\n const origin = serializeColorNode(node.origin, precision)\n const rendered = node.channels.map((channel) => serializeChannel(channel, precision)).join(' ')\n const alpha = node.alpha === undefined ? '' : ` / ${serializeChannel(node.alpha, precision)}`\n return node.wrap === 'function'\n ? `${node.token}(from ${origin} ${rendered}${alpha})`\n : `color(from ${origin} ${node.token} ${rendered}${alpha})`\n }\n const rendered = channelsOf(node)\n .map((channel) => serializeChannel(channel, precision))\n .join(' ')\n return node._tag === 'Oklch' ? `oklch(${rendered})` : `color(srgb ${rendered})`\n}\n\nconst channelEquals = (a: ChannelNode, b: ChannelNode): boolean => {\n if (isNoneChannel(a) || isNoneChannel(b)) {\n return a === b\n }\n return nodeEquals(a, b)\n}\n\nconst percentageEquals = (a: CalcNode | undefined, b: CalcNode | undefined): boolean =>\n a === undefined || b === undefined ? a === b : nodeEquals(a, b)\n\n// An optional channel — a relative color's alpha — where an omitted slot only\n// equals another omitted slot, never a present `none` or expression.\nconst alphaEquals = (a: ChannelNode | undefined, b: ChannelNode | undefined): boolean =>\n a === undefined || b === undefined ? a === b : channelEquals(a, b)\n\nconst colorNodeEquals = (a: ColorNode, b: ColorNode): boolean => {\n if (a._tag !== b._tag) {\n return false\n }\n if (a._tag === 'Named') {\n return a.name === (b as NamedColorNode).name\n }\n if (a._tag === 'LightDark') {\n const other = b as LightDarkNode\n return colorNodeEquals(a.light, other.light) && colorNodeEquals(a.dark, other.dark)\n }\n if (a._tag === 'ColorMix') {\n const other = b as ColorMixNode\n return (\n a.method.colorspace === other.method.colorspace &&\n a.method.hue === other.method.hue &&\n colorNodeEquals(a.color1, other.color1) &&\n percentageEquals(a.percentage1, other.percentage1) &&\n colorNodeEquals(a.color2, other.color2) &&\n percentageEquals(a.percentage2, other.percentage2)\n )\n }\n if (a._tag === 'ColorRef') {\n return a.name === (b as ColorRefNode).name\n }\n if (a._tag === 'Relative') {\n const other = b as RelativeNode\n return (\n a.token === other.token &&\n a.wrap === other.wrap &&\n colorNodeEquals(a.origin, other.origin) &&\n a.channels.every((channel, index) =>\n channelEquals(channel, other.channels[index] as ChannelNode),\n ) &&\n alphaEquals(a.alpha, other.alpha)\n )\n }\n const others = channelsOf(b as ChannelFunctionNode)\n return channelsOf(a).every((channel, index) =>\n channelEquals(channel, others[index] as ChannelNode),\n )\n}\n\nconst hashChannel = (channel: ChannelNode): number =>\n isNoneChannel(channel) ? Equal.hashString('none') : nodeHash(channel)\n\nconst colorNodeHash = (node: ColorNode): number => {\n let h = Equal.hashString(node._tag)\n if (node._tag === 'Named') {\n return Equal.combine(h, Equal.hashString(node.name))\n }\n if (node._tag === 'ColorRef') {\n return Equal.combine(h, Equal.hashString(node.name))\n }\n if (node._tag === 'LightDark') {\n h = Equal.combine(h, colorNodeHash(node.light))\n return Equal.combine(h, colorNodeHash(node.dark))\n }\n if (node._tag === 'ColorMix') {\n h = Equal.combine(h, Equal.hashString(node.method.colorspace))\n h = Equal.combine(h, node.method.hue === undefined ? 0 : Equal.hashString(node.method.hue))\n h = Equal.combine(h, colorNodeHash(node.color1))\n h = Equal.combine(h, node.percentage1 === undefined ? 0 : nodeHash(node.percentage1))\n h = Equal.combine(h, colorNodeHash(node.color2))\n return Equal.combine(h, node.percentage2 === undefined ? 0 : nodeHash(node.percentage2))\n }\n if (node._tag === 'Relative') {\n h = Equal.combine(h, Equal.hashString(node.token))\n h = Equal.combine(h, Equal.hashString(node.wrap))\n h = Equal.combine(h, colorNodeHash(node.origin))\n for (const channel of node.channels) {\n h = Equal.combine(h, hashChannel(channel))\n }\n return Equal.combine(h, node.alpha === undefined ? 0 : hashChannel(node.alpha))\n }\n for (const channel of channelsOf(node)) {\n h = Equal.combine(h, hashChannel(channel))\n }\n return h\n}\n\nclass ColorImpl extends Pipeable implements Color<string>, Equal.Equal {\n readonly [ColorTypeId]: ColorTypeId = ColorTypeId\n\n readonly node: ColorNode\n readonly refSet: ReadonlySet<string>\n #hash: number | undefined\n\n constructor(node: ColorNode, refSet: ReadonlySet<string>) {\n super()\n this.node = node\n this.refSet = refSet\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return isColor(that) && colorNodeEquals(this.node, nodeOfColor(that))\n }\n\n [Equal.HashTypeId](): number {\n this.#hash ??= Equal.combine(Equal.hashString('fashionable/color'), colorNodeHash(this.node))\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `Color(${serializeColorNode(this.node, DEFAULT_FORMAT)})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isColor = (u: unknown): u is Color<string> =>\n typeof u === 'object' && u !== null && ColorTypeId in u\n\n/** @internal */\nexport const nodeOfColor = (color: Color<string>): ColorNode => (color as ColorImpl).node\n\n/** @internal */\nexport const refsOf = <R extends string>(color: Color<R>): ReadonlySet<R> =>\n (color as unknown as ColorImpl).refSet as ReadonlySet<R>\n\ninterface ResolvedChannel {\n readonly node: ChannelNode\n readonly refs: ReadonlySet<string>\n}\n\n// The erased channel input the constructors funnel through `toChannel`: a\n// number, `none`, or any number-kind expression — including one branded with a\n// relative-color channel keyword. The public signatures pin the precise refs\n// and scope the keywords to the space; this stays wide enough to accept all.\ntype RelativeChannelInput = RelativeChannel<string, ChannelLeaf<string>>\n\nconst toChannel = (input: RelativeChannelInput): ResolvedChannel => {\n if (isNone(input)) {\n return { node: NONE_CHANNEL, refs: EMPTY_REFS }\n }\n const calc = toCalc(input)\n return { node: nodeOf(calc), refs: calcRefsOf(calc) }\n}\n\n/** @internal */\nexport function oklch<L extends string = never, C extends string = never, H extends string = never>(\n lightness: Input<L> | None,\n chroma: Input<C> | None,\n hue: Input<H> | None,\n): Color<L | C | H> {\n const l = toChannel(lightness)\n const c = toChannel(chroma)\n const h = toChannel(hue)\n return new ColorImpl(\n { _tag: 'Oklch', lightness: l.node, chroma: c.node, hue: h.node },\n unionRefs(l.refs, c.refs, h.refs),\n ) as Color<L | C | H>\n}\n\n/** @internal */\nexport function srgb<R extends string = never, G extends string = never, B extends string = never>(\n red: Input<R> | None,\n green: Input<G> | None,\n blue: Input<B> | None,\n): Color<R | G | B> {\n const r = toChannel(red)\n const g = toChannel(green)\n const b = toChannel(blue)\n return new ColorImpl(\n { _tag: 'Srgb', red: r.node, green: g.node, blue: b.node },\n unionRefs(r.refs, g.refs, b.refs),\n ) as Color<R | G | B>\n}\n\n// The CSS-wide keywords are whole-declaration values, not colors —\n// `light-dark(inherit, …)` is invalid CSS — so `named` rejects them\n// (the `PropertySyntax.keyword` posture).\nconst CSS_WIDE_KEYWORDS = new Set([\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'default',\n])\n\n/** @internal */\nexport const named = (name: string): Color<never> => {\n invariant(name.length > 0, 'Named color must be a non-empty string')\n invariant(\n !CSS_WIDE_KEYWORDS.has(name.toLowerCase()),\n `Named color must not be a CSS-wide keyword, got '${name}'`,\n )\n return new ColorImpl({ _tag: 'Named', name }, EMPTY_REFS) as Color<never>\n}\n\n/** @internal */\nexport const transparent: Color<never> = named('transparent')\n\n/** @internal */\nexport const ref = <Name extends string>(name: Name): Color<Name> => {\n invariant(name.length > 0, 'Color reference name must be a non-empty string')\n return new ColorImpl({ _tag: 'ColorRef', name }, new Set([name])) as Color<Name>\n}\n\n/** @internal */\nexport function lightDark<A extends string = never, B extends string = never>(\n light: Color<A>,\n dark: Color<B>,\n): Color<A | B> {\n return new ColorImpl(\n { _tag: 'LightDark', light: nodeOfColor(light), dark: nodeOfColor(dark) },\n unionRefs(refsOf(light), refsOf(dark)),\n ) as Color<A | B>\n}\n\n// The erased mix arm: a whole color, or a [color, weight] tuple whose weight is\n// a percentage-kind expression (a bare number reads as a percent).\ntype MixArmInput =\n | Color<string>\n | readonly [Color<string>, number | Calc<string, 'percentage', unknown>]\n\ninterface ResolvedArm {\n readonly color: ColorNode\n readonly percentage: CalcNode | undefined\n readonly refs: ReadonlySet<string>\n}\n\nconst toArm = (arm: MixArmInput): ResolvedArm => {\n if (isColor(arm)) {\n return { color: nodeOfColor(arm), percentage: undefined, refs: refsOf(arm) }\n }\n const [color, percentage] = arm\n const pct = typeof percentage === 'number' ? percentageOf(percentage) : percentage\n return {\n color: nodeOfColor(color),\n percentage: nodeOf(pct),\n refs: unionRefs(refsOf(color), calcRefsOf(pct)),\n }\n}\n\n/** @internal */\nexport function mix(\n space: ColorSpace<unknown>,\n arg2: HueInterpolation<string> | MixArmInput,\n arg3: MixArmInput,\n arg4?: MixArmInput,\n): Color<never> {\n // (space, color1, color2), or (space, hue, color1, color2) — the hue form is\n // the one with a fourth argument\n const hasHue = arg4 !== undefined\n const hue = hasHue ? strategyOf(arg2 as HueInterpolation<string>) : undefined\n const a1 = toArm((hasHue ? arg3 : arg2) as MixArmInput)\n const a2 = toArm((hasHue ? arg4 : arg3) as MixArmInput)\n return new ColorImpl(\n {\n _tag: 'ColorMix',\n method: { colorspace: spaceDataOf(space).token, hue },\n color1: a1.color,\n percentage1: a1.percentage,\n color2: a2.color,\n percentage2: a2.percentage,\n },\n unionRefs(a1.refs, a2.refs),\n ) as Color<never>\n}\n\nconst relative = (\n token: string,\n wrap: Wrap,\n origin: Color<string>,\n channel1: RelativeChannelInput,\n channel2: RelativeChannelInput,\n channel3: RelativeChannelInput,\n alpha: RelativeChannelInput | undefined,\n): Color<string> => {\n const c1 = toChannel(channel1)\n const c2 = toChannel(channel2)\n const c3 = toChannel(channel3)\n const a = alpha === undefined ? undefined : toChannel(alpha)\n return new ColorImpl(\n {\n _tag: 'Relative',\n token,\n wrap,\n origin: nodeOfColor(origin),\n channels: [c1.node, c2.node, c3.node],\n alpha: a === undefined ? undefined : a.node,\n },\n unionRefs(refsOf(origin), c1.refs, c2.refs, c3.refs, a === undefined ? EMPTY_REFS : a.refs),\n )\n}\n\n/** @internal */\nexport function from(\n origin: Color<string>,\n space: ColorSpace<unknown>,\n channel1: RelativeChannelInput,\n channel2: RelativeChannelInput,\n channel3: RelativeChannelInput,\n alpha?: RelativeChannelInput,\n): Color<never> {\n const { token, wrap } = spaceDataOf(space)\n return relative(token, wrap, origin, channel1, channel2, channel3, alpha) as Color<never>\n}\n\n// The color-valued reference names in a node — the `ColorRef` origins the\n// channel-binding path cannot substitute, so `bind` restores them structurally\n// rather than trust `collectBindings` to have kept them (it strips any bound\n// key, including a color-ref name a caller passed a value for).\nconst colorRefNames = (node: ColorNode): ReadonlySet<string> => {\n switch (node._tag) {\n case 'ColorRef':\n return new Set([node.name])\n case 'LightDark':\n return unionRefs(colorRefNames(node.light), colorRefNames(node.dark))\n case 'ColorMix':\n return unionRefs(colorRefNames(node.color1), colorRefNames(node.color2))\n case 'Relative':\n return colorRefNames(node.origin)\n case 'Oklch':\n case 'Srgb':\n case 'Named':\n return EMPTY_REFS\n }\n}\n\nconst identsOfChannel = (channel: ChannelNode): ReadonlySet<string> =>\n isNoneChannel(channel) ? EMPTY_REFS : identsOf(channel)\n\n// The channel-keyword tokens a color reads — each channel slot's calc tree\n// walked and sub-colors recursed, the `Color` counterpart to `Calc.channels`.\n// Only relative colors introduce keywords; other nodes carry them solely\n// through a nested relative origin or arm.\nconst colorChannels = (node: ColorNode): ReadonlySet<string> => {\n switch (node._tag) {\n case 'Named':\n case 'ColorRef':\n return EMPTY_REFS\n case 'Oklch':\n return unionRefs(\n identsOfChannel(node.lightness),\n identsOfChannel(node.chroma),\n identsOfChannel(node.hue),\n )\n case 'Srgb':\n return unionRefs(\n identsOfChannel(node.red),\n identsOfChannel(node.green),\n identsOfChannel(node.blue),\n )\n case 'LightDark':\n return unionRefs(colorChannels(node.light), colorChannels(node.dark))\n case 'ColorMix':\n return unionRefs(\n colorChannels(node.color1),\n node.percentage1 === undefined ? EMPTY_REFS : identsOf(node.percentage1),\n colorChannels(node.color2),\n node.percentage2 === undefined ? EMPTY_REFS : identsOf(node.percentage2),\n )\n case 'Relative':\n return unionRefs(\n colorChannels(node.origin),\n identsOfChannel(node.channels[0]),\n identsOfChannel(node.channels[1]),\n identsOfChannel(node.channels[2]),\n node.alpha === undefined ? EMPTY_REFS : identsOfChannel(node.alpha),\n )\n }\n}\n\n/** @internal */\nexport const bind: {\n <const B extends Bindings>(\n bindings: B,\n ): <Refs extends string>(color: Color<Refs>) => Color<ApplyBindings<Refs, B>>\n <Refs extends string, const B extends Bindings>(\n color: Color<Refs>,\n bindings: B,\n ): Color<ApplyBindings<Refs, B>>\n} = dual(2, (color: Color<string>, bindings: Record<string, Input<string>>): Color<string> => {\n const collected = collectBindings(refsOf(color), bindings)\n const node = mapColorNode(nodeOfColor(color), (channel) =>\n substituteNode(channel, collected.nodeBindings),\n )\n return new ColorImpl(node, unionRefs(collected.refSet, colorRefNames(node)))\n})\n\n/** @internal */\nexport function serialize<Refs extends string>(\n color: Color<Refs>,\n options?: SerializeOptions<Refs>,\n): string {\n let node = nodeOfColor(color)\n if (options?.bindings !== undefined) {\n const collected = collectBindings(\n refsOf(color),\n options.bindings as Record<string, Input<string> | undefined>,\n )\n node = mapColorNode(node, (channel) => substituteNode(channel, collected.nodeBindings))\n }\n const precision = options?.precision === undefined ? DEFAULT_FORMAT : toSpec(options.precision)\n return serializeColorNode(node, precision)\n}\n\n/** @internal */\nexport function refs<Refs extends string>(color: Color<Refs>): ReadonlySet<Refs> {\n return refsOf(color)\n}\n\n/** @internal */\nexport function channels(color: Color<string>): ReadonlySet<string> {\n return colorChannels(nodeOfColor(color))\n}\n\n/** @internal */\nexport const equals = dual<\n (that: Color<string>) => (self: Color<string>) => boolean,\n (self: Color<string>, that: Color<string>) => boolean\n>(2, (self: Color<string>, that: Color<string>): boolean => Equal.equals(self, that))\n"],"mappings":";;;;;;AAEA,MAAa,mBAAmB,OAAO,IAAI,6BAA6B;AAkCxE,IAAM,iBAAN,MAAqB;CAIR;CACA;CAJX,CAAU,oBAAsC;CAEhD,YACE,OACA,MACA;EAFS,KAAA,QAAA;EACA,KAAA,OAAA;CACR;CAEH,KAAK,OAAO,eAAe;EACzB,OAAO,cAAc,KAAK,MAAM;CAClC;CAEA,KAAK,OAAO,IAAI,4BAA4B,KAAK;EAC/C,OAAO,KAAK,OAAO;CACrB;AACF;;AAGA,MAAaA,SAAO,IAAI,eAAe,QAAQ,OAAO;;AAEtD,MAAa,aAAa,IAAI,eAAe,eAAe,OAAO;;AAEnE,MAAa,YAAY,IAAI,eAAe,cAAc,OAAO;;AAEjE,MAAa,SAAS,IAAI,eAAe,WAAW,OAAO;;AAE3D,MAAa,cAAc,IAAI,eAAe,gBAAgB,OAAO;;AAErE,MAAa,UAAU,IAAI,eAAe,WAAW,OAAO;;AAE5D,MAAa,MAAM,IAAI,eAAe,OAAO,UAAU;;AAEvD,MAAa,QAAQ,IAAI,eAAe,SAAS,UAAU;;AAE3D,MAAa,MAAM,IAAI,eAAe,OAAO,OAAO;;AAEpD,MAAa,SAAS,IAAI,eAAe,WAAW,OAAO;;AAE3D,MAAa,SAAS,IAAI,eAAe,WAAW,OAAO;;AAE3D,MAAa,MAAM,IAAI,eAAe,OAAO,UAAU;;AAEvD,MAAa,MAAM,IAAI,eAAe,OAAO,UAAU;;AAEvD,MAAa,MAAM,IAAI,eAAe,OAAO,UAAU;;AA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