rainbowindex 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/CHANGELOG.md +122 -0
- package/LICENSE +22 -0
- package/README.md +329 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.mjs +41 -0
- package/dist/chunk-5N4GPK26.mjs +2664 -0
- package/dist/chunk-KCSNR2TV.mjs +671 -0
- package/dist/chunk-PD4ZXGJ6.mjs +14 -0
- package/dist/chunk-RPXZ3O6R.mjs +10518 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +1258 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +289 -0
- package/dist/index.mjs +71 -0
- package/dist/optimize-6NWJVT6W.mjs +24 -0
- package/dist/safelist-DRk1XXxi.d.ts +239 -0
- package/dist/vite.d.ts +5 -0
- package/dist/vite.mjs +320 -0
- package/package.json +101 -4
|
@@ -0,0 +1,2664 @@
|
|
|
1
|
+
// src/theme/colors.ts
|
|
2
|
+
function isValidColorSuffix(n) {
|
|
3
|
+
return Number.isInteger(n) && n >= 1 && n <= 999;
|
|
4
|
+
}
|
|
5
|
+
var STOP_LO = 50;
|
|
6
|
+
var STOP_STEP = 50;
|
|
7
|
+
var L_PROFILE = [
|
|
8
|
+
0.9668,
|
|
9
|
+
// 50
|
|
10
|
+
0.936756,
|
|
11
|
+
// 100
|
|
12
|
+
0.905984,
|
|
13
|
+
// 150
|
|
14
|
+
0.87442,
|
|
15
|
+
// 200
|
|
16
|
+
0.841988,
|
|
17
|
+
// 250
|
|
18
|
+
0.808602,
|
|
19
|
+
// 300
|
|
20
|
+
0.774158,
|
|
21
|
+
// 350
|
|
22
|
+
0.73853,
|
|
23
|
+
// 400
|
|
24
|
+
0.701568,
|
|
25
|
+
// 450
|
|
26
|
+
0.663082,
|
|
27
|
+
// 500
|
|
28
|
+
0.622832,
|
|
29
|
+
// 550
|
|
30
|
+
0.580504,
|
|
31
|
+
// 600
|
|
32
|
+
0.535677,
|
|
33
|
+
// 650
|
|
34
|
+
0.487755,
|
|
35
|
+
// 700
|
|
36
|
+
0.435847,
|
|
37
|
+
// 750
|
|
38
|
+
0.378506,
|
|
39
|
+
// 800
|
|
40
|
+
0.313034,
|
|
41
|
+
// 850
|
|
42
|
+
0.232988,
|
|
43
|
+
// 900
|
|
44
|
+
0.045
|
|
45
|
+
// 950
|
|
46
|
+
];
|
|
47
|
+
var REF_CHROMA = 0.05;
|
|
48
|
+
var C_REF = [
|
|
49
|
+
0.006863863034589374,
|
|
50
|
+
// 50
|
|
51
|
+
0.01319862716849036,
|
|
52
|
+
// 100
|
|
53
|
+
0.019388384668336325,
|
|
54
|
+
// 150
|
|
55
|
+
0.025429811853816625,
|
|
56
|
+
// 200
|
|
57
|
+
0.03131716290796655,
|
|
58
|
+
// 250
|
|
59
|
+
0.03704281264548738,
|
|
60
|
+
// 300
|
|
61
|
+
0.04259815284255128,
|
|
62
|
+
// 350
|
|
63
|
+
0.04797259847240491,
|
|
64
|
+
// 400
|
|
65
|
+
0.053139652622711774,
|
|
66
|
+
// 450
|
|
67
|
+
0.05807254410984486,
|
|
68
|
+
// 500
|
|
69
|
+
0.057890440330825195,
|
|
70
|
+
// 550
|
|
71
|
+
0.05222950205066024,
|
|
72
|
+
// 600
|
|
73
|
+
0.04663166172903349,
|
|
74
|
+
// 650
|
|
75
|
+
0.04108661482545571,
|
|
76
|
+
// 700
|
|
77
|
+
0.035584106512529856,
|
|
78
|
+
// 750
|
|
79
|
+
0.030108630901677546,
|
|
80
|
+
// 800
|
|
81
|
+
0.02463007273923548,
|
|
82
|
+
// 850
|
|
83
|
+
0.01911062262055484,
|
|
84
|
+
// 900
|
|
85
|
+
0.013470720217073236
|
|
86
|
+
// 950
|
|
87
|
+
];
|
|
88
|
+
var H_DRIFT = [
|
|
89
|
+
-0.93815866691077,
|
|
90
|
+
// 50
|
|
91
|
+
-0.88308454198904,
|
|
92
|
+
// 100
|
|
93
|
+
-0.82986570023714,
|
|
94
|
+
// 150
|
|
95
|
+
-0.77925524218887,
|
|
96
|
+
// 200
|
|
97
|
+
-0.73231968077941,
|
|
98
|
+
// 250
|
|
99
|
+
-0.69055370894147,
|
|
100
|
+
// 300
|
|
101
|
+
-0.65608113228225,
|
|
102
|
+
// 350
|
|
103
|
+
-0.6319804472577,
|
|
104
|
+
// 400
|
|
105
|
+
-0.62282301825498,
|
|
106
|
+
// 450
|
|
107
|
+
-0.63542113918918,
|
|
108
|
+
// 500
|
|
109
|
+
-0.65047025648765,
|
|
110
|
+
// 550
|
|
111
|
+
-0.64293938410323,
|
|
112
|
+
// 600
|
|
113
|
+
-0.63626978185344,
|
|
114
|
+
// 650
|
|
115
|
+
-0.63057786221076,
|
|
116
|
+
// 700
|
|
117
|
+
-0.62611168444876,
|
|
118
|
+
// 750
|
|
119
|
+
-0.62332854799372,
|
|
120
|
+
// 800
|
|
121
|
+
-0.62317507759171,
|
|
122
|
+
// 850
|
|
123
|
+
-0.62789446720379,
|
|
124
|
+
// 900
|
|
125
|
+
-0.64378251527182
|
|
126
|
+
// 950
|
|
127
|
+
];
|
|
128
|
+
function sampleProfile(values, suffix, monotone) {
|
|
129
|
+
const last = values.length - 1;
|
|
130
|
+
const fx = (suffix - STOP_LO) / STOP_STEP;
|
|
131
|
+
if (fx <= 0) return values[0] + (values[1] - values[0]) * fx;
|
|
132
|
+
if (fx >= last) return values[last] + (values[last] - values[last - 1]) * (fx - last);
|
|
133
|
+
const i = Math.floor(fx);
|
|
134
|
+
const t = fx - i;
|
|
135
|
+
if (t === 0) return values[i];
|
|
136
|
+
const seg = values[i + 1] - values[i];
|
|
137
|
+
const tangent = (k) => {
|
|
138
|
+
if (k <= 0) return values[1] - values[0];
|
|
139
|
+
if (k >= last) return values[last] - values[last - 1];
|
|
140
|
+
return (values[k + 1] - values[k - 1]) / 2;
|
|
141
|
+
};
|
|
142
|
+
let m0 = tangent(i);
|
|
143
|
+
let m1 = tangent(i + 1);
|
|
144
|
+
if (monotone) {
|
|
145
|
+
if (seg === 0) {
|
|
146
|
+
m0 = 0;
|
|
147
|
+
m1 = 0;
|
|
148
|
+
} else {
|
|
149
|
+
const a = m0 / seg;
|
|
150
|
+
const b = m1 / seg;
|
|
151
|
+
const s = a * a + b * b;
|
|
152
|
+
if (s > 9) {
|
|
153
|
+
const tau = 3 / Math.sqrt(s);
|
|
154
|
+
m0 = tau * a * seg;
|
|
155
|
+
m1 = tau * b * seg;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const t2 = t * t;
|
|
160
|
+
const t3 = t2 * t;
|
|
161
|
+
return (2 * t3 - 3 * t2 + 1) * values[i] + (t3 - 2 * t2 + t) * m0 + (-2 * t3 + 3 * t2) * values[i + 1] + (t3 - t2) * m1;
|
|
162
|
+
}
|
|
163
|
+
function lightnessFromSuffix(suffix) {
|
|
164
|
+
return Math.min(0.98, Math.max(0.02, sampleProfile(L_PROFILE, suffix, true)));
|
|
165
|
+
}
|
|
166
|
+
var DEFAULT_COLORS = Object.freeze({
|
|
167
|
+
theme: {
|
|
168
|
+
type: "generative",
|
|
169
|
+
chroma: 0,
|
|
170
|
+
hue: 0,
|
|
171
|
+
parabolic: false,
|
|
172
|
+
chromaBoost: false
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
var DEFAULT_DARK_CONFIG = {
|
|
176
|
+
mode: "auto",
|
|
177
|
+
// 0 → dark keeps the light stop's chroma exactly (same tone in both modes).
|
|
178
|
+
// Raise it via `@color dark { chroma-boost }` for punchier dark-mode colors.
|
|
179
|
+
chromaBoost: 0,
|
|
180
|
+
hueShift: 0
|
|
181
|
+
};
|
|
182
|
+
var GAMUT_CLAMP_ITERATIONS = 20;
|
|
183
|
+
function oklchToOklab(l, c, h) {
|
|
184
|
+
const hRad = h * Math.PI / 180;
|
|
185
|
+
return [l, c * Math.cos(hRad), c * Math.sin(hRad)];
|
|
186
|
+
}
|
|
187
|
+
function oklabToLinearSrgb(l, a, b) {
|
|
188
|
+
const l_ = l + 0.3963377774 * a + 0.2158037573 * b;
|
|
189
|
+
const m_ = l - 0.1055613458 * a - 0.0638541728 * b;
|
|
190
|
+
const s_ = l - 0.0894841775 * a - 1.291485548 * b;
|
|
191
|
+
const lc = l_ * l_ * l_;
|
|
192
|
+
const mc = m_ * m_ * m_;
|
|
193
|
+
const sc = s_ * s_ * s_;
|
|
194
|
+
const r = 4.0767416621 * lc - 3.3077115913 * mc + 0.2309699292 * sc;
|
|
195
|
+
const g = -1.2684380046 * lc + 2.6097574011 * mc - 0.3413193965 * sc;
|
|
196
|
+
const bv = -0.0041960863 * lc - 0.7034186147 * mc + 1.707614701 * sc;
|
|
197
|
+
return [r, g, bv];
|
|
198
|
+
}
|
|
199
|
+
function isInSrgbGamut(l, c, h) {
|
|
200
|
+
const [la, a, b] = oklchToOklab(l, c, h);
|
|
201
|
+
const [r, g, bv] = oklabToLinearSrgb(la, a, b);
|
|
202
|
+
const eps = 1e-3;
|
|
203
|
+
return r >= -eps && r <= 1 + eps && g >= -eps && g <= 1 + eps && bv >= -eps && bv <= 1 + eps;
|
|
204
|
+
}
|
|
205
|
+
function gamutSafeChroma(l, requestedChroma, h) {
|
|
206
|
+
if (requestedChroma <= 0) return 0;
|
|
207
|
+
if (isInSrgbGamut(l, requestedChroma, h)) return requestedChroma;
|
|
208
|
+
let lo = 0;
|
|
209
|
+
let hi = requestedChroma;
|
|
210
|
+
for (let i = 0; i < GAMUT_CLAMP_ITERATIONS; i++) {
|
|
211
|
+
const mid = (lo + hi) / 2;
|
|
212
|
+
if (isInSrgbGamut(l, mid, h)) {
|
|
213
|
+
lo = mid;
|
|
214
|
+
} else {
|
|
215
|
+
hi = mid;
|
|
216
|
+
}
|
|
217
|
+
if (hi - lo < 5e-4) break;
|
|
218
|
+
}
|
|
219
|
+
return lo;
|
|
220
|
+
}
|
|
221
|
+
var APCA_MAIN_TRC = 2.4;
|
|
222
|
+
var APCA_NORM_BG = 0.56;
|
|
223
|
+
var APCA_NORM_TXT = 0.57;
|
|
224
|
+
var APCA_REV_TXT = 0.62;
|
|
225
|
+
var APCA_REV_BG = 0.65;
|
|
226
|
+
var APCA_BLK_THRS = 0.022;
|
|
227
|
+
var APCA_BLK_CLMP = Math.SQRT2;
|
|
228
|
+
var APCA_SCALE = 1.14;
|
|
229
|
+
var APCA_LO_BOW_OFFSET = 0.027;
|
|
230
|
+
var APCA_LO_WOB_OFFSET = 0.027;
|
|
231
|
+
var APCA_DELTA_Y_MIN = 5e-4;
|
|
232
|
+
var APCA_LO_CLIP = 0.1;
|
|
233
|
+
function linearToSrgb(c) {
|
|
234
|
+
const x = Math.max(0, Math.min(1, c));
|
|
235
|
+
return x <= 31308e-7 ? 12.92 * x : 1.055 * x ** (1 / 2.4) - 0.055;
|
|
236
|
+
}
|
|
237
|
+
function oklchToApcaY(l, c, h) {
|
|
238
|
+
const [la, a, b] = oklchToOklab(l, c, h);
|
|
239
|
+
const [lr, lg, lb] = oklabToLinearSrgb(la, a, b);
|
|
240
|
+
const r = linearToSrgb(lr);
|
|
241
|
+
const g = linearToSrgb(lg);
|
|
242
|
+
const bv = linearToSrgb(lb);
|
|
243
|
+
return 0.2126 * r ** APCA_MAIN_TRC + 0.7152 * g ** APCA_MAIN_TRC + 0.0722 * bv ** APCA_MAIN_TRC;
|
|
244
|
+
}
|
|
245
|
+
function apcaContrast(yText, yBg) {
|
|
246
|
+
if (yText < 0 || yBg < 0) return 0;
|
|
247
|
+
if (Math.max(yText, yBg) < APCA_BLK_THRS) return 0;
|
|
248
|
+
const txtY = yText < APCA_BLK_THRS ? yText + (APCA_BLK_THRS - yText) ** APCA_BLK_CLMP : yText;
|
|
249
|
+
const bgY = yBg < APCA_BLK_THRS ? yBg + (APCA_BLK_THRS - yBg) ** APCA_BLK_CLMP : yBg;
|
|
250
|
+
if (Math.abs(bgY - txtY) < APCA_DELTA_Y_MIN) return 0;
|
|
251
|
+
if (bgY > txtY) {
|
|
252
|
+
const sapc2 = (bgY ** APCA_NORM_BG - txtY ** APCA_NORM_TXT) * APCA_SCALE;
|
|
253
|
+
return sapc2 < APCA_LO_CLIP ? 0 : (sapc2 - APCA_LO_BOW_OFFSET) * 100;
|
|
254
|
+
}
|
|
255
|
+
const sapc = (bgY ** APCA_REV_BG - txtY ** APCA_REV_TXT) * APCA_SCALE;
|
|
256
|
+
return sapc > -APCA_LO_CLIP ? 0 : (sapc + APCA_LO_WOB_OFFSET) * 100;
|
|
257
|
+
}
|
|
258
|
+
var _stopMemo = /* @__PURE__ */ new WeakMap();
|
|
259
|
+
function generateStop(def, suffix) {
|
|
260
|
+
let bySuffix = _stopMemo.get(def);
|
|
261
|
+
if (!bySuffix) {
|
|
262
|
+
bySuffix = /* @__PURE__ */ new Map();
|
|
263
|
+
_stopMemo.set(def, bySuffix);
|
|
264
|
+
}
|
|
265
|
+
const cached = bySuffix.get(suffix);
|
|
266
|
+
if (cached) return cached;
|
|
267
|
+
const stop = computeStop(def, suffix);
|
|
268
|
+
bySuffix.set(suffix, stop);
|
|
269
|
+
return stop;
|
|
270
|
+
}
|
|
271
|
+
function computeStop(def, suffix) {
|
|
272
|
+
const roundedL = Math.round(lightnessFromSuffix(suffix) * 1e3) / 1e3;
|
|
273
|
+
const h = def.chroma > 0 ? def.hue + sampleProfile(H_DRIFT, suffix, false) : def.hue;
|
|
274
|
+
const roundedH = Math.round(h * 1e3) / 1e3;
|
|
275
|
+
const shapedChroma = def.parabolic === false ? def.chroma : def.chroma * sampleProfile(C_REF, suffix, false) / REF_CHROMA;
|
|
276
|
+
const safeC = gamutSafeChroma(roundedL, shapedChroma, roundedH);
|
|
277
|
+
const roundedC = Math.floor(safeC * 1e4) / 1e4;
|
|
278
|
+
return {
|
|
279
|
+
stop: suffix,
|
|
280
|
+
l: roundedL,
|
|
281
|
+
c: roundedC,
|
|
282
|
+
h: roundedH
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function formatOklch(l, c, h) {
|
|
286
|
+
return `oklch(${l} ${c} ${h})`;
|
|
287
|
+
}
|
|
288
|
+
function generateColorVariables(name, def, suffixes, darkConfig = DEFAULT_DARK_CONFIG, darkOverride) {
|
|
289
|
+
const vars = [];
|
|
290
|
+
const strategy = darkOverride?.strategy ?? "mirror";
|
|
291
|
+
for (const suffix of suffixes) {
|
|
292
|
+
const lightStop = generateStop(def, suffix);
|
|
293
|
+
const lightValue = formatOklch(lightStop.l, lightStop.c, lightStop.h);
|
|
294
|
+
if (darkConfig.mode === "off" || strategy === "fixed") {
|
|
295
|
+
if (darkConfig.mode === "off") {
|
|
296
|
+
vars.push(`--color-${name}-${suffix}: ${lightValue};`);
|
|
297
|
+
} else {
|
|
298
|
+
vars.push(`--color-${name}-${suffix}: light-dark(${lightValue}, ${lightValue});`);
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
const darkL = generateStop(def, 1e3 - suffix).l;
|
|
302
|
+
let extraChroma = 0;
|
|
303
|
+
let extraHue = 0;
|
|
304
|
+
if (darkOverride?.strategy === "shift") {
|
|
305
|
+
extraChroma = darkOverride.chromaDelta;
|
|
306
|
+
extraHue = darkOverride.hueDelta;
|
|
307
|
+
}
|
|
308
|
+
const darkH = lightStop.h + darkConfig.hueShift + extraHue;
|
|
309
|
+
const globalChromaBoost = def.chromaBoost !== false ? darkConfig.chromaBoost : 0;
|
|
310
|
+
const requestedChroma = lightStop.c + globalChromaBoost + extraChroma;
|
|
311
|
+
const darkC = Math.floor(gamutSafeChroma(darkL, requestedChroma, darkH) * 1e4) / 1e4;
|
|
312
|
+
const darkValue = formatOklch(darkL, darkC, darkH);
|
|
313
|
+
vars.push(`--color-${name}-${suffix}: light-dark(${lightValue}, ${darkValue});`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return vars;
|
|
317
|
+
}
|
|
318
|
+
var SEMANTIC_COLORS = Object.freeze([
|
|
319
|
+
"--color-paper: light-dark(oklch(1 0 0), oklch(0 0 0));",
|
|
320
|
+
"--color-ink: light-dark(oklch(0 0 0), oklch(1 0 0));"
|
|
321
|
+
]);
|
|
322
|
+
var DEFAULT_PALETTE_CONTRAST_LC = 60;
|
|
323
|
+
function checkPaletteContrast(colors, usedColorStops, options = {}) {
|
|
324
|
+
const minLc = options.minLc ?? DEFAULT_PALETTE_CONTRAST_LC;
|
|
325
|
+
const warnings = [];
|
|
326
|
+
const paperY = oklchToApcaY(1, 0, 0);
|
|
327
|
+
const inkY = oklchToApcaY(0, 0, 0);
|
|
328
|
+
for (const [name, def] of Object.entries(colors)) {
|
|
329
|
+
if (def.type !== "generative") continue;
|
|
330
|
+
const stops = usedColorStops.get(name);
|
|
331
|
+
if (!stops || stops.size === 0) continue;
|
|
332
|
+
const sorted = [...stops].sort((a, b) => a - b);
|
|
333
|
+
for (const suffix of sorted) {
|
|
334
|
+
const stop = generateStop(def, suffix);
|
|
335
|
+
const fgY = oklchToApcaY(stop.l, stop.c, stop.h);
|
|
336
|
+
const lcPaper = Math.abs(apcaContrast(fgY, paperY));
|
|
337
|
+
const lcInk = Math.abs(apcaContrast(fgY, inkY));
|
|
338
|
+
const best = Math.max(lcPaper, lcInk);
|
|
339
|
+
if (best < minLc) {
|
|
340
|
+
warnings.push(
|
|
341
|
+
`[RI-1106] @color "${name}-${suffix}" has low APCA contrast (best |Lc| ${best.toFixed(0)} < ${minLc}; paper ${lcPaper.toFixed(0)}, ink ${lcInk.toFixed(0)}). Stop is unsuitable as text on either --color-paper or --color-ink \u2014 use a darker (lower suffix) or lighter (higher suffix) variant for text roles.`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return warnings;
|
|
347
|
+
}
|
|
348
|
+
function generateAllColorVariables(colors = DEFAULT_COLORS, darkConfig = DEFAULT_DARK_CONFIG, usedColorStops) {
|
|
349
|
+
const allVars = [];
|
|
350
|
+
allVars.push(...SEMANTIC_COLORS);
|
|
351
|
+
for (const [name, def] of Object.entries(colors)) {
|
|
352
|
+
switch (def.type) {
|
|
353
|
+
case "generative": {
|
|
354
|
+
const suffixes = usedColorStops?.get(name);
|
|
355
|
+
if (!suffixes || suffixes.size === 0) break;
|
|
356
|
+
const sorted = [...suffixes].sort((a, b) => a - b);
|
|
357
|
+
allVars.push(...generateColorVariables(name, def, sorted, darkConfig, def.dark));
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
case "explicit": {
|
|
361
|
+
allVars.push(`--color-${name}: ${def.value};`);
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
case "pair": {
|
|
365
|
+
if (darkConfig.mode === "off") {
|
|
366
|
+
allVars.push(`--color-${name}: ${def.light};`);
|
|
367
|
+
} else {
|
|
368
|
+
allVars.push(`--color-${name}: light-dark(${def.light}, ${def.dark});`);
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
case "alias": {
|
|
373
|
+
const source = colors[def.source];
|
|
374
|
+
if (source && source.type === "generative") {
|
|
375
|
+
const suffixes = usedColorStops?.get(name);
|
|
376
|
+
if (!suffixes || suffixes.size === 0) break;
|
|
377
|
+
const sorted = [...suffixes].sort((a, b) => a - b);
|
|
378
|
+
for (const suffix of sorted) {
|
|
379
|
+
allVars.push(`--color-${name}-${suffix}: var(--color-${def.source}-${suffix});`);
|
|
380
|
+
}
|
|
381
|
+
} else if (source) {
|
|
382
|
+
allVars.push(`--color-${name}: var(--color-${def.source});`);
|
|
383
|
+
}
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return allVars;
|
|
389
|
+
}
|
|
390
|
+
function generateThemeOverrides(colors, usedThemeSuffixes) {
|
|
391
|
+
if (!Object.hasOwn(colors, "theme")) return [];
|
|
392
|
+
if (!usedThemeSuffixes || usedThemeSuffixes.size === 0) return [];
|
|
393
|
+
const sorted = [...usedThemeSuffixes].sort((a, b) => a - b);
|
|
394
|
+
const blocks = [];
|
|
395
|
+
for (const [name, def] of Object.entries(colors)) {
|
|
396
|
+
if (name === "theme") continue;
|
|
397
|
+
if (def.type !== "generative") continue;
|
|
398
|
+
if (!def.inline) continue;
|
|
399
|
+
const vars = [];
|
|
400
|
+
for (const suffix of sorted) {
|
|
401
|
+
vars.push(` --color-theme-${suffix}: var(--color-${name}-${suffix});`);
|
|
402
|
+
}
|
|
403
|
+
const safeName = name.replace(/[\\"'\]]/g, "");
|
|
404
|
+
if (!safeName) continue;
|
|
405
|
+
blocks.push(`[data-theme="${safeName}"] {
|
|
406
|
+
${vars.join("\n")}
|
|
407
|
+
}`);
|
|
408
|
+
}
|
|
409
|
+
return blocks;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// src/theme/index.ts
|
|
413
|
+
var DEFAULT_TEXT = {
|
|
414
|
+
"2xs": { fontSize: "0.625rem", lineHeight: "1.2" },
|
|
415
|
+
xs: { fontSize: "0.75rem", lineHeight: "1.3" },
|
|
416
|
+
sm: { fontSize: "0.875rem", lineHeight: "1.4" },
|
|
417
|
+
md: { fontSize: "1rem", lineHeight: "1.5" },
|
|
418
|
+
lg: { fontSize: "1.25rem", lineHeight: "1.4" },
|
|
419
|
+
xl: { fontSize: "1.5rem", lineHeight: "1.3" },
|
|
420
|
+
"2xl": { fontSize: "1.875rem", lineHeight: "1.2" },
|
|
421
|
+
"3xl": { fontSize: "2.25rem", lineHeight: "1.15" },
|
|
422
|
+
"4xl": { fontSize: "2.813rem", lineHeight: "1.1" },
|
|
423
|
+
"5xl": { fontSize: "3.5rem", lineHeight: "1.05" },
|
|
424
|
+
"6xl": { fontSize: "4.375rem", lineHeight: "1.05" },
|
|
425
|
+
"7xl": { fontSize: "5.5rem", lineHeight: "1" },
|
|
426
|
+
"8xl": { fontSize: "6.875rem", lineHeight: "1" },
|
|
427
|
+
"9xl": { fontSize: "8.5rem", lineHeight: "1" }
|
|
428
|
+
};
|
|
429
|
+
var DEFAULT_BREAKPOINTS = {
|
|
430
|
+
sm: "40rem",
|
|
431
|
+
md: "48rem",
|
|
432
|
+
lg: "64rem",
|
|
433
|
+
xl: "80rem"
|
|
434
|
+
};
|
|
435
|
+
var DEFAULT_ROUNDED_ROOF = "1.5rem";
|
|
436
|
+
var DEFAULT_ROUNDED = {
|
|
437
|
+
"2xs": "max(0px, calc(var(--rounded-roof) - var(--spacing) * 5))",
|
|
438
|
+
xs: "max(0px, calc(var(--rounded-roof) - var(--spacing) * 4))",
|
|
439
|
+
sm: "max(0px, calc(var(--rounded-roof) - var(--spacing) * 3))",
|
|
440
|
+
md: "max(0px, calc(var(--rounded-roof) - var(--spacing) * 2))",
|
|
441
|
+
lg: "max(0px, calc(var(--rounded-roof) - var(--spacing)))",
|
|
442
|
+
xl: "var(--rounded-roof)",
|
|
443
|
+
full: "calc(infinity * 1px)"
|
|
444
|
+
};
|
|
445
|
+
var CORNER_SHAPE_KEYWORDS = [
|
|
446
|
+
"round",
|
|
447
|
+
"scoop",
|
|
448
|
+
"bevel",
|
|
449
|
+
"notch",
|
|
450
|
+
"square",
|
|
451
|
+
"squircle"
|
|
452
|
+
];
|
|
453
|
+
var DEFAULT_CORNER_SCALE = {
|
|
454
|
+
round: 1,
|
|
455
|
+
square: 1,
|
|
456
|
+
notch: 1,
|
|
457
|
+
bevel: 0.8,
|
|
458
|
+
scoop: 1.2,
|
|
459
|
+
squircle: 1.6
|
|
460
|
+
};
|
|
461
|
+
var DEFAULT_SUPERELLIPSE_SCALE = 1.6;
|
|
462
|
+
var DEFAULT_SHADOWS = {
|
|
463
|
+
// Building blocks: colors
|
|
464
|
+
line: "light-dark(oklch(0 0 0 / 0.06), oklch(1 0 0 / 0.02))",
|
|
465
|
+
drop: "light-dark(oklch(0 0 0 / 0.06), oklch(0 0 0 / 0.18))",
|
|
466
|
+
"hi-1": "light-dark(transparent, oklch(1 0 0 / 0.01))",
|
|
467
|
+
"hi-2": "light-dark(transparent, oklch(1 0 0 / 0.02))",
|
|
468
|
+
"hi-3": "light-dark(transparent, oklch(1 0 0 / 0.04))",
|
|
469
|
+
"hi-4": "light-dark(transparent, oklch(1 0 0 / 0.06))",
|
|
470
|
+
"dark-line": "light-dark(transparent, oklch(0 0 0 / 0.14))",
|
|
471
|
+
// Building blocks: composed shadow layers
|
|
472
|
+
ring: "0 0 0 1px var(--shadow-line)",
|
|
473
|
+
"layer-1": "0 1px 1px -0.5px var(--shadow-drop)",
|
|
474
|
+
"layer-2": "0 3px 3px -1.5px var(--shadow-drop)",
|
|
475
|
+
"layer-3": "0 6px 6px -3px var(--shadow-drop)",
|
|
476
|
+
"layer-4": "0 12px 12px -6px var(--shadow-drop)",
|
|
477
|
+
"layer-5": "0 24px 24px -12px var(--shadow-drop)",
|
|
478
|
+
"layer-6": "0 48px 48px -24px var(--shadow-drop)",
|
|
479
|
+
"layer-7": "0 96px 96px -48px var(--shadow-drop)",
|
|
480
|
+
// Class-facing
|
|
481
|
+
px: "var(--shadow-ring)",
|
|
482
|
+
"2xs": "inset 0 1px 0 0 var(--shadow-hi-1), var(--shadow-ring), var(--shadow-layer-1)",
|
|
483
|
+
xs: "inset 0 1px 0 0 var(--shadow-hi-2), var(--shadow-ring), 0 0 0 1px var(--shadow-dark-line), var(--shadow-layer-1), var(--shadow-layer-2)",
|
|
484
|
+
sm: "inset 0 1px 0 0 var(--shadow-hi-2), var(--shadow-ring), 0 0 0 1px var(--shadow-dark-line), var(--shadow-layer-1), var(--shadow-layer-2), var(--shadow-layer-3)",
|
|
485
|
+
md: "inset 0 1px 0 0 var(--shadow-hi-3), var(--shadow-ring), 0 0 0 1px var(--shadow-dark-line), var(--shadow-layer-1), var(--shadow-layer-2), var(--shadow-layer-3), var(--shadow-layer-4)",
|
|
486
|
+
lg: "inset 0 1px 0 0 var(--shadow-hi-3), var(--shadow-ring), 0 0 0 1px var(--shadow-dark-line), var(--shadow-layer-1), var(--shadow-layer-2), var(--shadow-layer-3), var(--shadow-layer-4), var(--shadow-layer-5)",
|
|
487
|
+
xl: "inset 0 1px 0 0 var(--shadow-hi-4), var(--shadow-ring), 0 0 0 1px var(--shadow-dark-line), var(--shadow-layer-1), var(--shadow-layer-2), var(--shadow-layer-3), var(--shadow-layer-4), var(--shadow-layer-5), var(--shadow-layer-6)",
|
|
488
|
+
"2xl": "inset 0 1px 0 0 var(--shadow-hi-4), var(--shadow-ring), 0 0 0 1px var(--shadow-dark-line), var(--shadow-layer-1), var(--shadow-layer-2), var(--shadow-layer-3), var(--shadow-layer-4), var(--shadow-layer-5), var(--shadow-layer-6), var(--shadow-layer-7)",
|
|
489
|
+
none: "0 0 #0000"
|
|
490
|
+
};
|
|
491
|
+
var DEFAULT_WEIGHTS = {
|
|
492
|
+
thin: 100,
|
|
493
|
+
extralight: 200,
|
|
494
|
+
light: 300,
|
|
495
|
+
normal: 400,
|
|
496
|
+
medium: 500,
|
|
497
|
+
semibold: 600,
|
|
498
|
+
bold: 700,
|
|
499
|
+
extrabold: 800,
|
|
500
|
+
black: 900
|
|
501
|
+
};
|
|
502
|
+
var DEFAULT_EASING = {
|
|
503
|
+
in: "cubic-bezier(0.4, 0, 1, 1)",
|
|
504
|
+
out: "cubic-bezier(0, 0, 0.2, 1)",
|
|
505
|
+
"in-out": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
506
|
+
linear: "linear"
|
|
507
|
+
};
|
|
508
|
+
var DEFAULT_BLUR = {
|
|
509
|
+
xs: "2px",
|
|
510
|
+
sm: "4px",
|
|
511
|
+
DEFAULT: "8px",
|
|
512
|
+
md: "12px",
|
|
513
|
+
lg: "16px",
|
|
514
|
+
xl: "24px",
|
|
515
|
+
"2xl": "40px",
|
|
516
|
+
"3xl": "64px",
|
|
517
|
+
none: "0"
|
|
518
|
+
};
|
|
519
|
+
var DEFAULT_ANIMATIONS = {
|
|
520
|
+
spin: {
|
|
521
|
+
shorthand: "spin 1s linear infinite",
|
|
522
|
+
keyframes: `from { transform: rotate(0deg); }
|
|
523
|
+
to { transform: rotate(360deg); }`
|
|
524
|
+
},
|
|
525
|
+
pulse: {
|
|
526
|
+
shorthand: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
527
|
+
keyframes: `0%, 100% { opacity: 1; }
|
|
528
|
+
50% { opacity: 0.5; }`
|
|
529
|
+
},
|
|
530
|
+
bounce: {
|
|
531
|
+
shorthand: "bounce 1s infinite",
|
|
532
|
+
keyframes: `0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
|
|
533
|
+
50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }`
|
|
534
|
+
},
|
|
535
|
+
ping: {
|
|
536
|
+
shorthand: "ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",
|
|
537
|
+
keyframes: "75%, 100% { transform: scale(2); opacity: 0; }"
|
|
538
|
+
},
|
|
539
|
+
// Disclosure animations for the @rainbowindex/ui Accordion + Collapsible
|
|
540
|
+
// primitives. Both expand from 0 → the natural content size published by
|
|
541
|
+
// the package's `useCollapseSize` hook as `--ri-collapsible-content-height`
|
|
542
|
+
// (a single shared variable — the primitives do not emit separate accordion
|
|
543
|
+
// vs collapsible vars). The `auto` fallback keeps the keyframe valid on the
|
|
544
|
+
// first frame before the hook measures.
|
|
545
|
+
"accordion-down": {
|
|
546
|
+
shorthand: "accordion-down 0.2s ease-out",
|
|
547
|
+
keyframes: `from { height: 0; }
|
|
548
|
+
to { height: var(--ri-collapsible-content-height, auto); }`
|
|
549
|
+
},
|
|
550
|
+
"accordion-up": {
|
|
551
|
+
shorthand: "accordion-up 0.2s ease-out",
|
|
552
|
+
keyframes: `from { height: var(--ri-collapsible-content-height, auto); }
|
|
553
|
+
to { height: 0; }`
|
|
554
|
+
},
|
|
555
|
+
"collapsible-down": {
|
|
556
|
+
shorthand: "collapsible-down 0.2s ease-out",
|
|
557
|
+
keyframes: `from { height: 0; }
|
|
558
|
+
to { height: var(--ri-collapsible-content-height, auto); }`
|
|
559
|
+
},
|
|
560
|
+
"collapsible-up": {
|
|
561
|
+
shorthand: "collapsible-up 0.2s ease-out",
|
|
562
|
+
keyframes: `from { height: var(--ri-collapsible-content-height, auto); }
|
|
563
|
+
to { height: 0; }`
|
|
564
|
+
},
|
|
565
|
+
"caret-blink": {
|
|
566
|
+
shorthand: "caret-blink 1.25s ease-out infinite",
|
|
567
|
+
keyframes: `0%, 70%, 100% { opacity: 1; }
|
|
568
|
+
20%, 50% { opacity: 0; }`
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
var DEFAULT_FLUID = {
|
|
572
|
+
min: "20rem",
|
|
573
|
+
max: "80rem"
|
|
574
|
+
};
|
|
575
|
+
var DEFAULT_TRACKING = {
|
|
576
|
+
tighter: "-0.05em",
|
|
577
|
+
tight: "-0.025em",
|
|
578
|
+
normal: "0em",
|
|
579
|
+
wide: "0.025em",
|
|
580
|
+
wider: "0.05em",
|
|
581
|
+
widest: "0.1em"
|
|
582
|
+
};
|
|
583
|
+
var DEFAULT_LEADING = {
|
|
584
|
+
"3": "0.75rem",
|
|
585
|
+
"4": "1rem",
|
|
586
|
+
"5": "1.25rem",
|
|
587
|
+
"6": "1.5rem",
|
|
588
|
+
"7": "1.75rem",
|
|
589
|
+
"8": "2rem",
|
|
590
|
+
"9": "2.25rem",
|
|
591
|
+
"10": "2.5rem",
|
|
592
|
+
none: "1",
|
|
593
|
+
tight: "1.25",
|
|
594
|
+
snug: "1.375",
|
|
595
|
+
normal: "1.5",
|
|
596
|
+
relaxed: "1.625",
|
|
597
|
+
loose: "2"
|
|
598
|
+
};
|
|
599
|
+
var defaultTheme = Object.freeze({
|
|
600
|
+
spacing: {
|
|
601
|
+
base: "0.25rem"
|
|
602
|
+
},
|
|
603
|
+
colors: DEFAULT_COLORS,
|
|
604
|
+
text: DEFAULT_TEXT,
|
|
605
|
+
breakpoints: DEFAULT_BREAKPOINTS,
|
|
606
|
+
rounded: DEFAULT_ROUNDED,
|
|
607
|
+
shadows: DEFAULT_SHADOWS,
|
|
608
|
+
weights: DEFAULT_WEIGHTS,
|
|
609
|
+
easing: DEFAULT_EASING,
|
|
610
|
+
fluid: DEFAULT_FLUID,
|
|
611
|
+
animations: DEFAULT_ANIMATIONS,
|
|
612
|
+
blur: DEFAULT_BLUR
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// src/runtime.ts
|
|
616
|
+
var IS_PROD = typeof process !== "undefined" && process.env?.NODE_ENV === "production";
|
|
617
|
+
var IS_DEV = !IS_PROD;
|
|
618
|
+
function devWarn(message) {
|
|
619
|
+
if (!IS_PROD) console.warn(message);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// src/merge/props.ts
|
|
623
|
+
var BUILTIN_STATIC_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
624
|
+
// Grow/shrink
|
|
625
|
+
grow: ["flex-grow"],
|
|
626
|
+
"grow-0": ["flex-grow"],
|
|
627
|
+
shrink: ["flex-shrink"],
|
|
628
|
+
"shrink-0": ["flex-shrink"],
|
|
629
|
+
// Space-between reverse (scoped so it composes with space-x/space-y)
|
|
630
|
+
"space-x-reverse": ["~space:--ri-space-x-reverse"],
|
|
631
|
+
"space-y-reverse": ["~space:--ri-space-y-reverse"],
|
|
632
|
+
// Text overflow
|
|
633
|
+
"text-clip": ["text-overflow"],
|
|
634
|
+
"text-ellipsis": ["text-overflow"],
|
|
635
|
+
// Font variant numeric
|
|
636
|
+
"normal-nums": ["font-variant-numeric"],
|
|
637
|
+
ordinal: ["--ri-ordinal", "font-variant-numeric"],
|
|
638
|
+
"slashed-zero": ["--ri-slashed-zero", "font-variant-numeric"],
|
|
639
|
+
"lining-nums": ["--ri-numeric-figure", "font-variant-numeric"],
|
|
640
|
+
"oldstyle-nums": ["--ri-numeric-figure", "font-variant-numeric"],
|
|
641
|
+
"proportional-nums": ["--ri-numeric-spacing", "font-variant-numeric"],
|
|
642
|
+
"tabular-nums": ["--ri-numeric-spacing", "font-variant-numeric"],
|
|
643
|
+
"diagonal-fractions": ["--ri-numeric-fraction", "font-variant-numeric"],
|
|
644
|
+
"stacked-fractions": ["--ri-numeric-fraction", "font-variant-numeric"],
|
|
645
|
+
// Font style
|
|
646
|
+
italic: ["font-style"],
|
|
647
|
+
"not-italic": ["font-style"],
|
|
648
|
+
// Font smoothing
|
|
649
|
+
antialiased: ["-webkit-font-smoothing", "-moz-osx-font-smoothing"],
|
|
650
|
+
"subpixel-antialiased": ["-webkit-font-smoothing", "-moz-osx-font-smoothing"],
|
|
651
|
+
// List style position
|
|
652
|
+
"list-inside": ["list-style-position"],
|
|
653
|
+
"list-outside": ["list-style-position"],
|
|
654
|
+
// Decoration thickness keywords
|
|
655
|
+
"decoration-auto": ["text-decoration-thickness"],
|
|
656
|
+
"decoration-from-font": ["text-decoration-thickness"],
|
|
657
|
+
// Isolation
|
|
658
|
+
isolate: ["isolation"],
|
|
659
|
+
"isolation-auto": ["isolation"],
|
|
660
|
+
// Truncate (sets multiple)
|
|
661
|
+
truncate: ["overflow", "text-overflow", "white-space"],
|
|
662
|
+
// Pointer events
|
|
663
|
+
"pointer-events-none": ["pointer-events"],
|
|
664
|
+
"pointer-events-auto": ["pointer-events"],
|
|
665
|
+
// Transition property/behavior one-offs
|
|
666
|
+
"transition-none": ["transition-property"],
|
|
667
|
+
"transition-normal": ["transition-behavior"],
|
|
668
|
+
"transition-discrete": ["transition-behavior"],
|
|
669
|
+
// Transform style
|
|
670
|
+
"transform-flat": ["transform-style"],
|
|
671
|
+
"transform-3d": ["transform-style"],
|
|
672
|
+
// Translate/rotate/scale none
|
|
673
|
+
"translate-none": ["translate"],
|
|
674
|
+
"rotate-none": ["rotate"],
|
|
675
|
+
"scale-none": ["scale"],
|
|
676
|
+
// Perspective
|
|
677
|
+
"perspective-none": ["perspective"],
|
|
678
|
+
// Border width (static, directional — per-side logical props)
|
|
679
|
+
"border-t": ["border-block-start-width"],
|
|
680
|
+
"border-b": ["border-block-end-width"],
|
|
681
|
+
"border-l": ["border-inline-start-width"],
|
|
682
|
+
"border-r": ["border-inline-end-width"],
|
|
683
|
+
"border-s": ["border-inline-start-width"],
|
|
684
|
+
"border-e": ["border-inline-end-width"],
|
|
685
|
+
"border-bs": ["border-block-start-width"],
|
|
686
|
+
"border-be": ["border-block-end-width"],
|
|
687
|
+
"border-x": ["border-inline-width"],
|
|
688
|
+
"border-y": ["border-block-width"],
|
|
689
|
+
// Border collapse
|
|
690
|
+
"border-collapse": ["border-collapse"],
|
|
691
|
+
"border-separate": ["border-collapse"],
|
|
692
|
+
// Outline — bare `outline` is a 1px width (like `border`); outline-hidden sets the
|
|
693
|
+
// outline shorthand + offset (claiming all sub-properties); outline-none just sets style.
|
|
694
|
+
outline: ["outline-width"],
|
|
695
|
+
"outline-hidden": ["outline-style", "outline-width", "outline-color", "outline-offset"],
|
|
696
|
+
// Shadow / ring (static bare + reset forms; valued forms via PREFIX_PROPS).
|
|
697
|
+
// Each composable family claims box-shadow (shared) + its own slot var, so
|
|
698
|
+
// shadow/inset-shadow/ring/inset-ring coexist while same-family repeats dedupe.
|
|
699
|
+
shadow: ["box-shadow", "--ri-shadow"],
|
|
700
|
+
"shadow-none": ["box-shadow", "--ri-shadow"],
|
|
701
|
+
ring: ["box-shadow", "--ri-ring-shadow"],
|
|
702
|
+
"inset-ring": ["box-shadow", "--ri-inset-ring-shadow"],
|
|
703
|
+
"inset-shadow-none": ["box-shadow", "--ri-inset-shadow"],
|
|
704
|
+
// Box sizing
|
|
705
|
+
"box-border": ["box-sizing"],
|
|
706
|
+
"box-content": ["box-sizing"],
|
|
707
|
+
// Box decoration
|
|
708
|
+
"box-decoration-clone": ["-webkit-box-decoration-break", "box-decoration-break"],
|
|
709
|
+
"box-decoration-slice": ["-webkit-box-decoration-break", "box-decoration-break"],
|
|
710
|
+
// Table layout
|
|
711
|
+
"table-auto": ["table-layout"],
|
|
712
|
+
"table-fixed": ["table-layout"],
|
|
713
|
+
// Caption side
|
|
714
|
+
"caption-top": ["caption-side"],
|
|
715
|
+
"caption-bottom": ["caption-side"],
|
|
716
|
+
// Field sizing
|
|
717
|
+
"field-sizing-content": ["field-sizing"],
|
|
718
|
+
"field-sizing-fixed": ["field-sizing"],
|
|
719
|
+
// Flex basis
|
|
720
|
+
"basis-auto": ["flex-basis"],
|
|
721
|
+
"basis-full": ["flex-basis"],
|
|
722
|
+
// Background reset
|
|
723
|
+
"bg-none": ["background-image"],
|
|
724
|
+
// Divide-between reverse flags (scoped so they compose with divide-x/divide-y)
|
|
725
|
+
"divide-x-reverse": ["~divide:--ri-divide-x-reverse"],
|
|
726
|
+
"divide-y-reverse": ["~divide:--ri-divide-y-reverse"],
|
|
727
|
+
// Backdrop filter (static) — backdrop-blur-none resets all backdrop filters
|
|
728
|
+
"backdrop-blur-none": ["backdrop-filter"],
|
|
729
|
+
"backdrop-grayscale": ["--ri-backdrop-grayscale", "backdrop-filter"],
|
|
730
|
+
"backdrop-invert": ["--ri-backdrop-invert", "backdrop-filter"],
|
|
731
|
+
"backdrop-sepia": ["--ri-backdrop-sepia", "backdrop-filter"],
|
|
732
|
+
// Filter (static) — filter-none resets all filters
|
|
733
|
+
"filter-none": ["filter"],
|
|
734
|
+
"backdrop-filter-none": ["backdrop-filter"],
|
|
735
|
+
grayscale: ["--ri-grayscale", "filter"],
|
|
736
|
+
invert: ["--ri-invert", "filter"],
|
|
737
|
+
sepia: ["--ri-sepia", "filter"],
|
|
738
|
+
// Animation play state
|
|
739
|
+
"animate-running": ["animation-play-state"],
|
|
740
|
+
"animate-paused": ["animation-play-state"],
|
|
741
|
+
// Compositional animation effects (static)
|
|
742
|
+
"fade-in": ["--ri-enter-opacity"],
|
|
743
|
+
"fade-out": ["--ri-exit-opacity"],
|
|
744
|
+
"zoom-in": ["--ri-enter-scale"],
|
|
745
|
+
"zoom-out": ["--ri-exit-scale"],
|
|
746
|
+
"spin-in": ["--ri-enter-rotate"],
|
|
747
|
+
"spin-out": ["--ri-exit-rotate"],
|
|
748
|
+
"blur-in": ["--ri-enter-blur"],
|
|
749
|
+
"blur-out": ["--ri-exit-blur"],
|
|
750
|
+
// Mask reset
|
|
751
|
+
"mask-none": ["mask-image"],
|
|
752
|
+
// Mask type
|
|
753
|
+
"mask-type-alpha": ["mask-type"],
|
|
754
|
+
"mask-type-luminance": ["mask-type"],
|
|
755
|
+
// Mask radial shape
|
|
756
|
+
"mask-circle": ["--ri-mask-radial-shape"],
|
|
757
|
+
"mask-ellipse": ["--ri-mask-radial-shape"],
|
|
758
|
+
// Container
|
|
759
|
+
"@container": ["container-type"],
|
|
760
|
+
"@container-normal": ["container-type"],
|
|
761
|
+
// Anchor scope
|
|
762
|
+
"anchor-scope-all": ["anchor-scope"],
|
|
763
|
+
"anchor-scope-none": ["anchor-scope"],
|
|
764
|
+
// SR only (sets position, width, height, padding, margin, overflow, clip, white-space, border-width)
|
|
765
|
+
"sr-only": [
|
|
766
|
+
"position",
|
|
767
|
+
"width",
|
|
768
|
+
"height",
|
|
769
|
+
"padding",
|
|
770
|
+
"margin",
|
|
771
|
+
"overflow",
|
|
772
|
+
"clip-path",
|
|
773
|
+
"white-space",
|
|
774
|
+
"border-width"
|
|
775
|
+
],
|
|
776
|
+
"not-sr-only": [
|
|
777
|
+
"position",
|
|
778
|
+
"width",
|
|
779
|
+
"height",
|
|
780
|
+
"padding",
|
|
781
|
+
"margin",
|
|
782
|
+
"overflow",
|
|
783
|
+
"clip-path",
|
|
784
|
+
"white-space",
|
|
785
|
+
"border-width"
|
|
786
|
+
],
|
|
787
|
+
// Content
|
|
788
|
+
"content-none": ["content"],
|
|
789
|
+
// Accent color
|
|
790
|
+
"accent-auto": ["accent-color"],
|
|
791
|
+
// Caret color keywords
|
|
792
|
+
"caret-transparent": ["caret-color"],
|
|
793
|
+
"caret-current": ["caret-color"],
|
|
794
|
+
"caret-inherit": ["caret-color"],
|
|
795
|
+
// Forced color adjust
|
|
796
|
+
"forced-color-adjust-auto": ["forced-color-adjust"],
|
|
797
|
+
"forced-color-adjust-none": ["forced-color-adjust"],
|
|
798
|
+
// Backface visibility
|
|
799
|
+
"backface-hidden": ["backface-visibility"],
|
|
800
|
+
"backface-visible": ["backface-visibility"],
|
|
801
|
+
// Scroll snap strictness / stop
|
|
802
|
+
"snap-mandatory": ["--ri-snap-strictness"],
|
|
803
|
+
"snap-proximity": ["--ri-snap-strictness"],
|
|
804
|
+
"snap-normal": ["scroll-snap-stop"],
|
|
805
|
+
"snap-always": ["scroll-snap-stop"],
|
|
806
|
+
// Appearance
|
|
807
|
+
"appearance-none": ["appearance"],
|
|
808
|
+
"appearance-auto": ["appearance"],
|
|
809
|
+
// Word break exception — break-words wraps instead of breaking
|
|
810
|
+
"break-words": ["overflow-wrap"],
|
|
811
|
+
// Scroll behavior
|
|
812
|
+
"scroll-auto": ["scroll-behavior"],
|
|
813
|
+
"scroll-smooth": ["scroll-behavior"],
|
|
814
|
+
// SVG
|
|
815
|
+
"fill-none": ["fill"],
|
|
816
|
+
"stroke-none": ["stroke"]
|
|
817
|
+
});
|
|
818
|
+
function addAll(names, props) {
|
|
819
|
+
const frozen = Object.freeze(props);
|
|
820
|
+
for (const name of names) BUILTIN_STATIC_PROPS[name] = frozen;
|
|
821
|
+
}
|
|
822
|
+
addAll(
|
|
823
|
+
[
|
|
824
|
+
"block",
|
|
825
|
+
"inline-block",
|
|
826
|
+
"inline",
|
|
827
|
+
"flex",
|
|
828
|
+
"inline-flex",
|
|
829
|
+
"grid",
|
|
830
|
+
"inline-grid",
|
|
831
|
+
"contents",
|
|
832
|
+
"hidden",
|
|
833
|
+
"table",
|
|
834
|
+
"table-row",
|
|
835
|
+
"table-cell",
|
|
836
|
+
"inline-table",
|
|
837
|
+
"table-caption",
|
|
838
|
+
"table-column",
|
|
839
|
+
"table-column-group",
|
|
840
|
+
"table-footer-group",
|
|
841
|
+
"table-header-group",
|
|
842
|
+
"table-row-group",
|
|
843
|
+
"flow-root",
|
|
844
|
+
"list-item"
|
|
845
|
+
],
|
|
846
|
+
["display"]
|
|
847
|
+
);
|
|
848
|
+
addAll(["float-right", "float-left", "float-start", "float-end", "float-none"], ["float"]);
|
|
849
|
+
addAll(
|
|
850
|
+
["clear", "clear-left", "clear-right", "clear-both", "clear-start", "clear-end", "clear-none"],
|
|
851
|
+
["clear"]
|
|
852
|
+
);
|
|
853
|
+
addAll(["static", "relative", "absolute", "fixed", "sticky"], ["position"]);
|
|
854
|
+
addAll(["flex-row", "flex-row-reverse", "flex-col", "flex-col-reverse"], ["flex-direction"]);
|
|
855
|
+
addAll(["flex-wrap", "flex-wrap-reverse", "flex-nowrap"], ["flex-wrap"]);
|
|
856
|
+
addAll(["flex-auto", "flex-initial", "flex-none"], ["flex"]);
|
|
857
|
+
addAll(
|
|
858
|
+
[
|
|
859
|
+
"grid-flow-row",
|
|
860
|
+
"grid-flow-col",
|
|
861
|
+
"grid-flow-dense",
|
|
862
|
+
"grid-flow-row-dense",
|
|
863
|
+
"grid-flow-col-dense"
|
|
864
|
+
],
|
|
865
|
+
["grid-auto-flow"]
|
|
866
|
+
);
|
|
867
|
+
addAll(
|
|
868
|
+
[
|
|
869
|
+
"items-start",
|
|
870
|
+
"items-end",
|
|
871
|
+
"items-end-safe",
|
|
872
|
+
"items-center",
|
|
873
|
+
"items-center-safe",
|
|
874
|
+
"items-baseline",
|
|
875
|
+
"items-baseline-last",
|
|
876
|
+
"items-stretch"
|
|
877
|
+
],
|
|
878
|
+
["align-items"]
|
|
879
|
+
);
|
|
880
|
+
addAll(
|
|
881
|
+
[
|
|
882
|
+
"justify-normal",
|
|
883
|
+
"justify-start",
|
|
884
|
+
"justify-end",
|
|
885
|
+
"justify-end-safe",
|
|
886
|
+
"justify-center",
|
|
887
|
+
"justify-center-safe",
|
|
888
|
+
"justify-between",
|
|
889
|
+
"justify-around",
|
|
890
|
+
"justify-evenly",
|
|
891
|
+
"justify-stretch",
|
|
892
|
+
"justify-baseline"
|
|
893
|
+
],
|
|
894
|
+
["justify-content"]
|
|
895
|
+
);
|
|
896
|
+
addAll(
|
|
897
|
+
[
|
|
898
|
+
"self-auto",
|
|
899
|
+
"self-start",
|
|
900
|
+
"self-end",
|
|
901
|
+
"self-end-safe",
|
|
902
|
+
"self-center",
|
|
903
|
+
"self-center-safe",
|
|
904
|
+
"self-stretch",
|
|
905
|
+
"self-baseline",
|
|
906
|
+
"self-baseline-last"
|
|
907
|
+
],
|
|
908
|
+
["align-self"]
|
|
909
|
+
);
|
|
910
|
+
addAll(
|
|
911
|
+
[
|
|
912
|
+
"justify-items-normal",
|
|
913
|
+
"justify-items-start",
|
|
914
|
+
"justify-items-end",
|
|
915
|
+
"justify-items-end-safe",
|
|
916
|
+
"justify-items-center",
|
|
917
|
+
"justify-items-center-safe",
|
|
918
|
+
"justify-items-stretch"
|
|
919
|
+
],
|
|
920
|
+
["justify-items"]
|
|
921
|
+
);
|
|
922
|
+
addAll(
|
|
923
|
+
[
|
|
924
|
+
"justify-self-auto",
|
|
925
|
+
"justify-self-start",
|
|
926
|
+
"justify-self-end",
|
|
927
|
+
"justify-self-end-safe",
|
|
928
|
+
"justify-self-center",
|
|
929
|
+
"justify-self-center-safe",
|
|
930
|
+
"justify-self-stretch"
|
|
931
|
+
],
|
|
932
|
+
["justify-self"]
|
|
933
|
+
);
|
|
934
|
+
addAll(
|
|
935
|
+
[
|
|
936
|
+
"content-normal",
|
|
937
|
+
"content-start",
|
|
938
|
+
"content-end",
|
|
939
|
+
"content-end-safe",
|
|
940
|
+
"content-center",
|
|
941
|
+
"content-center-safe",
|
|
942
|
+
"content-between",
|
|
943
|
+
"content-around",
|
|
944
|
+
"content-evenly",
|
|
945
|
+
"content-baseline",
|
|
946
|
+
"content-stretch"
|
|
947
|
+
],
|
|
948
|
+
["align-content"]
|
|
949
|
+
);
|
|
950
|
+
addAll(
|
|
951
|
+
[
|
|
952
|
+
"place-content-normal",
|
|
953
|
+
"place-content-start",
|
|
954
|
+
"place-content-end",
|
|
955
|
+
"place-content-end-safe",
|
|
956
|
+
"place-content-center",
|
|
957
|
+
"place-content-center-safe",
|
|
958
|
+
"place-content-between",
|
|
959
|
+
"place-content-around",
|
|
960
|
+
"place-content-evenly",
|
|
961
|
+
"place-content-baseline",
|
|
962
|
+
"place-content-stretch"
|
|
963
|
+
],
|
|
964
|
+
["place-content"]
|
|
965
|
+
);
|
|
966
|
+
addAll(
|
|
967
|
+
[
|
|
968
|
+
"place-items-start",
|
|
969
|
+
"place-items-end",
|
|
970
|
+
"place-items-end-safe",
|
|
971
|
+
"place-items-center",
|
|
972
|
+
"place-items-center-safe",
|
|
973
|
+
"place-items-baseline",
|
|
974
|
+
"place-items-stretch"
|
|
975
|
+
],
|
|
976
|
+
["place-items"]
|
|
977
|
+
);
|
|
978
|
+
addAll(
|
|
979
|
+
[
|
|
980
|
+
"place-self-auto",
|
|
981
|
+
"place-self-start",
|
|
982
|
+
"place-self-end",
|
|
983
|
+
"place-self-end-safe",
|
|
984
|
+
"place-self-center",
|
|
985
|
+
"place-self-center-safe",
|
|
986
|
+
"place-self-stretch"
|
|
987
|
+
],
|
|
988
|
+
["place-self"]
|
|
989
|
+
);
|
|
990
|
+
addAll(
|
|
991
|
+
["text-left", "text-center", "text-right", "text-justify", "text-start", "text-end"],
|
|
992
|
+
["text-align"]
|
|
993
|
+
);
|
|
994
|
+
addAll(["text-wrap", "text-nowrap", "text-balance", "text-pretty"], ["text-wrap"]);
|
|
995
|
+
addAll(["hyphens-none", "hyphens-manual", "hyphens-auto"], ["hyphens"]);
|
|
996
|
+
addAll(["wrap-normal", "wrap-break-word", "wrap-anywhere"], ["overflow-wrap"]);
|
|
997
|
+
addAll(["uppercase", "lowercase", "capitalize", "normal-case"], ["text-transform"]);
|
|
998
|
+
addAll(
|
|
999
|
+
[
|
|
1000
|
+
"align-baseline",
|
|
1001
|
+
"align-top",
|
|
1002
|
+
"align-middle",
|
|
1003
|
+
"align-bottom",
|
|
1004
|
+
"align-text-top",
|
|
1005
|
+
"align-text-bottom",
|
|
1006
|
+
"align-sub",
|
|
1007
|
+
"align-super"
|
|
1008
|
+
],
|
|
1009
|
+
["vertical-align"]
|
|
1010
|
+
);
|
|
1011
|
+
addAll(["list-none", "list-disc", "list-decimal"], ["list-style-type"]);
|
|
1012
|
+
addAll(["underline", "overline", "line-through", "no-underline"], ["text-decoration-line"]);
|
|
1013
|
+
addAll(
|
|
1014
|
+
[
|
|
1015
|
+
"decoration-solid",
|
|
1016
|
+
"decoration-dashed",
|
|
1017
|
+
"decoration-dotted",
|
|
1018
|
+
"decoration-double",
|
|
1019
|
+
"decoration-wavy"
|
|
1020
|
+
],
|
|
1021
|
+
["text-decoration-style"]
|
|
1022
|
+
);
|
|
1023
|
+
addAll(
|
|
1024
|
+
[
|
|
1025
|
+
"whitespace-normal",
|
|
1026
|
+
"whitespace-nowrap",
|
|
1027
|
+
"whitespace-pre",
|
|
1028
|
+
"whitespace-pre-line",
|
|
1029
|
+
"whitespace-pre-wrap",
|
|
1030
|
+
"whitespace-break-spaces"
|
|
1031
|
+
],
|
|
1032
|
+
["white-space"]
|
|
1033
|
+
);
|
|
1034
|
+
addAll(
|
|
1035
|
+
["overflow-auto", "overflow-hidden", "overflow-clip", "overflow-visible", "overflow-scroll"],
|
|
1036
|
+
["overflow"]
|
|
1037
|
+
);
|
|
1038
|
+
addAll(
|
|
1039
|
+
[
|
|
1040
|
+
"overflow-x-auto",
|
|
1041
|
+
"overflow-x-hidden",
|
|
1042
|
+
"overflow-x-clip",
|
|
1043
|
+
"overflow-x-visible",
|
|
1044
|
+
"overflow-x-scroll"
|
|
1045
|
+
],
|
|
1046
|
+
["overflow-x"]
|
|
1047
|
+
);
|
|
1048
|
+
addAll(
|
|
1049
|
+
[
|
|
1050
|
+
"overflow-y-auto",
|
|
1051
|
+
"overflow-y-hidden",
|
|
1052
|
+
"overflow-y-clip",
|
|
1053
|
+
"overflow-y-visible",
|
|
1054
|
+
"overflow-y-scroll"
|
|
1055
|
+
],
|
|
1056
|
+
["overflow-y"]
|
|
1057
|
+
);
|
|
1058
|
+
addAll(["overscroll-auto", "overscroll-contain", "overscroll-none"], ["overscroll-behavior"]);
|
|
1059
|
+
addAll(
|
|
1060
|
+
["overscroll-x-auto", "overscroll-x-contain", "overscroll-x-none"],
|
|
1061
|
+
["overscroll-behavior-x"]
|
|
1062
|
+
);
|
|
1063
|
+
addAll(
|
|
1064
|
+
["overscroll-y-auto", "overscroll-y-contain", "overscroll-y-none"],
|
|
1065
|
+
["overscroll-behavior-y"]
|
|
1066
|
+
);
|
|
1067
|
+
addAll(["visible", "invisible", "collapse"], ["visibility"]);
|
|
1068
|
+
addAll(
|
|
1069
|
+
[
|
|
1070
|
+
"cursor-auto",
|
|
1071
|
+
"cursor-default",
|
|
1072
|
+
"cursor-pointer",
|
|
1073
|
+
"cursor-wait",
|
|
1074
|
+
"cursor-text",
|
|
1075
|
+
"cursor-move",
|
|
1076
|
+
"cursor-not-allowed",
|
|
1077
|
+
"cursor-none",
|
|
1078
|
+
"cursor-grab",
|
|
1079
|
+
"cursor-grabbing",
|
|
1080
|
+
"cursor-crosshair",
|
|
1081
|
+
"cursor-help",
|
|
1082
|
+
"cursor-context-menu",
|
|
1083
|
+
"cursor-cell",
|
|
1084
|
+
"cursor-vertical-text",
|
|
1085
|
+
"cursor-alias",
|
|
1086
|
+
"cursor-copy",
|
|
1087
|
+
"cursor-no-drop",
|
|
1088
|
+
"cursor-progress",
|
|
1089
|
+
"cursor-all-scroll",
|
|
1090
|
+
"cursor-col-resize",
|
|
1091
|
+
"cursor-row-resize",
|
|
1092
|
+
"cursor-n-resize",
|
|
1093
|
+
"cursor-e-resize",
|
|
1094
|
+
"cursor-s-resize",
|
|
1095
|
+
"cursor-w-resize",
|
|
1096
|
+
"cursor-ne-resize",
|
|
1097
|
+
"cursor-nw-resize",
|
|
1098
|
+
"cursor-se-resize",
|
|
1099
|
+
"cursor-sw-resize",
|
|
1100
|
+
"cursor-ew-resize",
|
|
1101
|
+
"cursor-ns-resize",
|
|
1102
|
+
"cursor-nesw-resize",
|
|
1103
|
+
"cursor-nwse-resize",
|
|
1104
|
+
"cursor-zoom-in",
|
|
1105
|
+
"cursor-zoom-out"
|
|
1106
|
+
],
|
|
1107
|
+
["cursor"]
|
|
1108
|
+
);
|
|
1109
|
+
addAll(["select-none", "select-text", "select-all", "select-auto"], ["user-select"]);
|
|
1110
|
+
addAll(
|
|
1111
|
+
[
|
|
1112
|
+
"transition",
|
|
1113
|
+
"transition-all",
|
|
1114
|
+
"transition-colors",
|
|
1115
|
+
"transition-opacity",
|
|
1116
|
+
"transition-shadow",
|
|
1117
|
+
"transition-transform"
|
|
1118
|
+
],
|
|
1119
|
+
["transition-property", "transition-timing-function", "transition-duration"]
|
|
1120
|
+
);
|
|
1121
|
+
addAll(["transform-none", "transform-gpu", "transform-cpu"], ["transform"]);
|
|
1122
|
+
addAll(
|
|
1123
|
+
["transform-content", "transform-border", "transform-fill", "transform-stroke", "transform-view"],
|
|
1124
|
+
["transform-box"]
|
|
1125
|
+
);
|
|
1126
|
+
addAll(
|
|
1127
|
+
[
|
|
1128
|
+
"origin-center",
|
|
1129
|
+
"origin-top",
|
|
1130
|
+
"origin-top-right",
|
|
1131
|
+
"origin-right",
|
|
1132
|
+
"origin-bottom-right",
|
|
1133
|
+
"origin-bottom",
|
|
1134
|
+
"origin-bottom-left",
|
|
1135
|
+
"origin-left",
|
|
1136
|
+
"origin-top-left"
|
|
1137
|
+
],
|
|
1138
|
+
["transform-origin"]
|
|
1139
|
+
);
|
|
1140
|
+
addAll(["border", "border-0", "border-2", "border-4", "border-8"], ["border-width"]);
|
|
1141
|
+
addAll(
|
|
1142
|
+
[
|
|
1143
|
+
"border-solid",
|
|
1144
|
+
"border-dashed",
|
|
1145
|
+
"border-dotted",
|
|
1146
|
+
"border-double",
|
|
1147
|
+
"border-hidden",
|
|
1148
|
+
"border-none"
|
|
1149
|
+
],
|
|
1150
|
+
["border-style"]
|
|
1151
|
+
);
|
|
1152
|
+
addAll(["rounded", "rounded-none", "rounded-full"], ["border-radius"]);
|
|
1153
|
+
addAll(
|
|
1154
|
+
[
|
|
1155
|
+
"corner-round",
|
|
1156
|
+
"corner-scoop",
|
|
1157
|
+
"corner-bevel",
|
|
1158
|
+
"corner-notch",
|
|
1159
|
+
"corner-square",
|
|
1160
|
+
"corner-squircle"
|
|
1161
|
+
],
|
|
1162
|
+
["corner-shape", "--ri-rounded-scale"]
|
|
1163
|
+
);
|
|
1164
|
+
addAll(
|
|
1165
|
+
["outline-none", "outline-solid", "outline-dashed", "outline-dotted", "outline-double"],
|
|
1166
|
+
["outline-style"]
|
|
1167
|
+
);
|
|
1168
|
+
addAll(["aspect-auto", "aspect-square", "aspect-video"], ["aspect-ratio"]);
|
|
1169
|
+
addAll(
|
|
1170
|
+
["object-contain", "object-cover", "object-fill", "object-none", "object-scale-down"],
|
|
1171
|
+
["object-fit"]
|
|
1172
|
+
);
|
|
1173
|
+
addAll(
|
|
1174
|
+
[
|
|
1175
|
+
"object-center",
|
|
1176
|
+
"object-top",
|
|
1177
|
+
"object-bottom",
|
|
1178
|
+
"object-left",
|
|
1179
|
+
"object-right",
|
|
1180
|
+
"object-top-left",
|
|
1181
|
+
"object-top-right",
|
|
1182
|
+
"object-bottom-left",
|
|
1183
|
+
"object-bottom-right"
|
|
1184
|
+
],
|
|
1185
|
+
["object-position"]
|
|
1186
|
+
);
|
|
1187
|
+
addAll(["bg-cover", "bg-contain", "bg-auto"], ["background-size"]);
|
|
1188
|
+
addAll(
|
|
1189
|
+
[
|
|
1190
|
+
"bg-center",
|
|
1191
|
+
"bg-top",
|
|
1192
|
+
"bg-top-left",
|
|
1193
|
+
"bg-top-right",
|
|
1194
|
+
"bg-bottom",
|
|
1195
|
+
"bg-bottom-left",
|
|
1196
|
+
"bg-bottom-right",
|
|
1197
|
+
"bg-left",
|
|
1198
|
+
"bg-right"
|
|
1199
|
+
],
|
|
1200
|
+
["background-position"]
|
|
1201
|
+
);
|
|
1202
|
+
addAll(
|
|
1203
|
+
["bg-repeat", "bg-no-repeat", "bg-repeat-x", "bg-repeat-y", "bg-repeat-round", "bg-repeat-space"],
|
|
1204
|
+
["background-repeat"]
|
|
1205
|
+
);
|
|
1206
|
+
addAll(["bg-fixed", "bg-local", "bg-scroll"], ["background-attachment"]);
|
|
1207
|
+
addAll(
|
|
1208
|
+
["bg-clip-border", "bg-clip-padding", "bg-clip-content", "bg-clip-text"],
|
|
1209
|
+
["background-clip"]
|
|
1210
|
+
);
|
|
1211
|
+
addAll(["bg-origin-border", "bg-origin-padding", "bg-origin-content"], ["background-origin"]);
|
|
1212
|
+
addAll(
|
|
1213
|
+
[
|
|
1214
|
+
"bg-blend-normal",
|
|
1215
|
+
"bg-blend-multiply",
|
|
1216
|
+
"bg-blend-screen",
|
|
1217
|
+
"bg-blend-overlay",
|
|
1218
|
+
"bg-blend-darken",
|
|
1219
|
+
"bg-blend-lighten",
|
|
1220
|
+
"bg-blend-color-dodge",
|
|
1221
|
+
"bg-blend-color-burn",
|
|
1222
|
+
"bg-blend-hard-light",
|
|
1223
|
+
"bg-blend-soft-light",
|
|
1224
|
+
"bg-blend-difference",
|
|
1225
|
+
"bg-blend-exclusion",
|
|
1226
|
+
"bg-blend-hue",
|
|
1227
|
+
"bg-blend-saturation",
|
|
1228
|
+
"bg-blend-color",
|
|
1229
|
+
"bg-blend-luminosity"
|
|
1230
|
+
],
|
|
1231
|
+
["background-blend-mode"]
|
|
1232
|
+
);
|
|
1233
|
+
addAll(
|
|
1234
|
+
[
|
|
1235
|
+
"divide-solid",
|
|
1236
|
+
"divide-dashed",
|
|
1237
|
+
"divide-dotted",
|
|
1238
|
+
"divide-double",
|
|
1239
|
+
"divide-hidden",
|
|
1240
|
+
"divide-none"
|
|
1241
|
+
],
|
|
1242
|
+
["~divide:border-style"]
|
|
1243
|
+
);
|
|
1244
|
+
addAll(
|
|
1245
|
+
[
|
|
1246
|
+
"animate-spin",
|
|
1247
|
+
"animate-pulse",
|
|
1248
|
+
"animate-bounce",
|
|
1249
|
+
"animate-ping",
|
|
1250
|
+
"animate-in",
|
|
1251
|
+
"animate-out",
|
|
1252
|
+
"animate-none",
|
|
1253
|
+
"animate-accordion-down",
|
|
1254
|
+
"animate-accordion-up",
|
|
1255
|
+
"animate-collapsible-down",
|
|
1256
|
+
"animate-collapsible-up",
|
|
1257
|
+
"animate-caret-blink"
|
|
1258
|
+
],
|
|
1259
|
+
["animation"]
|
|
1260
|
+
);
|
|
1261
|
+
addAll(["animate-infinite", "animate-once", "animate-twice"], ["animation-iteration-count"]);
|
|
1262
|
+
addAll(
|
|
1263
|
+
["animate-fill-none", "animate-fill-forwards", "animate-fill-both", "animate-fill-backwards"],
|
|
1264
|
+
["animation-fill-mode"]
|
|
1265
|
+
);
|
|
1266
|
+
addAll(
|
|
1267
|
+
["animate-normal", "animate-reverse", "animate-alternate", "animate-alternate-reverse"],
|
|
1268
|
+
["animation-direction"]
|
|
1269
|
+
);
|
|
1270
|
+
addAll(["mask-add", "mask-subtract", "mask-intersect", "mask-exclude"], ["mask-composite"]);
|
|
1271
|
+
addAll(
|
|
1272
|
+
[
|
|
1273
|
+
"mask-clip-border",
|
|
1274
|
+
"mask-clip-padding",
|
|
1275
|
+
"mask-clip-content",
|
|
1276
|
+
"mask-clip-fill",
|
|
1277
|
+
"mask-clip-stroke",
|
|
1278
|
+
"mask-clip-view",
|
|
1279
|
+
"mask-no-clip"
|
|
1280
|
+
],
|
|
1281
|
+
["mask-clip"]
|
|
1282
|
+
);
|
|
1283
|
+
addAll(["mask-alpha", "mask-luminance", "mask-match"], ["mask-mode"]);
|
|
1284
|
+
addAll(
|
|
1285
|
+
[
|
|
1286
|
+
"mask-origin-border",
|
|
1287
|
+
"mask-origin-padding",
|
|
1288
|
+
"mask-origin-content",
|
|
1289
|
+
"mask-origin-fill",
|
|
1290
|
+
"mask-origin-stroke",
|
|
1291
|
+
"mask-origin-view"
|
|
1292
|
+
],
|
|
1293
|
+
["mask-origin"]
|
|
1294
|
+
);
|
|
1295
|
+
addAll(
|
|
1296
|
+
[
|
|
1297
|
+
"mask-top-left",
|
|
1298
|
+
"mask-top",
|
|
1299
|
+
"mask-top-right",
|
|
1300
|
+
"mask-left",
|
|
1301
|
+
"mask-center",
|
|
1302
|
+
"mask-right",
|
|
1303
|
+
"mask-bottom-left",
|
|
1304
|
+
"mask-bottom",
|
|
1305
|
+
"mask-bottom-right"
|
|
1306
|
+
],
|
|
1307
|
+
["mask-position"]
|
|
1308
|
+
);
|
|
1309
|
+
addAll(
|
|
1310
|
+
[
|
|
1311
|
+
"mask-repeat",
|
|
1312
|
+
"mask-no-repeat",
|
|
1313
|
+
"mask-repeat-x",
|
|
1314
|
+
"mask-repeat-y",
|
|
1315
|
+
"mask-repeat-space",
|
|
1316
|
+
"mask-repeat-round"
|
|
1317
|
+
],
|
|
1318
|
+
["mask-repeat"]
|
|
1319
|
+
);
|
|
1320
|
+
addAll(["mask-auto", "mask-cover", "mask-contain"], ["mask-size"]);
|
|
1321
|
+
addAll(
|
|
1322
|
+
[
|
|
1323
|
+
"mask-radial-closest-corner",
|
|
1324
|
+
"mask-radial-closest-side",
|
|
1325
|
+
"mask-radial-farthest-corner",
|
|
1326
|
+
"mask-radial-farthest-side"
|
|
1327
|
+
],
|
|
1328
|
+
["--ri-mask-radial-size"]
|
|
1329
|
+
);
|
|
1330
|
+
addAll(
|
|
1331
|
+
[
|
|
1332
|
+
"mask-radial-at-top-left",
|
|
1333
|
+
"mask-radial-at-top",
|
|
1334
|
+
"mask-radial-at-top-right",
|
|
1335
|
+
"mask-radial-at-left",
|
|
1336
|
+
"mask-radial-at-center",
|
|
1337
|
+
"mask-radial-at-right",
|
|
1338
|
+
"mask-radial-at-bottom-left",
|
|
1339
|
+
"mask-radial-at-bottom",
|
|
1340
|
+
"mask-radial-at-bottom-right"
|
|
1341
|
+
],
|
|
1342
|
+
["--ri-mask-radial-position"]
|
|
1343
|
+
);
|
|
1344
|
+
addAll(
|
|
1345
|
+
[
|
|
1346
|
+
"position-area-top",
|
|
1347
|
+
"position-area-bottom",
|
|
1348
|
+
"position-area-left",
|
|
1349
|
+
"position-area-right",
|
|
1350
|
+
"position-area-center",
|
|
1351
|
+
"position-area-start",
|
|
1352
|
+
"position-area-end",
|
|
1353
|
+
"position-area-self-start",
|
|
1354
|
+
"position-area-self-end",
|
|
1355
|
+
"position-area-top-left",
|
|
1356
|
+
"position-area-top-center",
|
|
1357
|
+
"position-area-top-right",
|
|
1358
|
+
"position-area-bottom-left",
|
|
1359
|
+
"position-area-bottom-center",
|
|
1360
|
+
"position-area-bottom-right",
|
|
1361
|
+
"position-area-center-left",
|
|
1362
|
+
"position-area-center-right",
|
|
1363
|
+
"position-area-top-span-all",
|
|
1364
|
+
"position-area-bottom-span-all",
|
|
1365
|
+
"position-area-left-span-all",
|
|
1366
|
+
"position-area-right-span-all",
|
|
1367
|
+
"position-area-span-all"
|
|
1368
|
+
],
|
|
1369
|
+
["position-area"]
|
|
1370
|
+
);
|
|
1371
|
+
addAll(["resize", "resize-none", "resize-x", "resize-y"], ["resize"]);
|
|
1372
|
+
addAll(
|
|
1373
|
+
[
|
|
1374
|
+
"touch-auto",
|
|
1375
|
+
"touch-none",
|
|
1376
|
+
"touch-manipulation",
|
|
1377
|
+
"touch-pan-x",
|
|
1378
|
+
"touch-pan-left",
|
|
1379
|
+
"touch-pan-right",
|
|
1380
|
+
"touch-pan-y",
|
|
1381
|
+
"touch-pan-up",
|
|
1382
|
+
"touch-pan-down",
|
|
1383
|
+
"touch-pinch-zoom"
|
|
1384
|
+
],
|
|
1385
|
+
["touch-action"]
|
|
1386
|
+
);
|
|
1387
|
+
addAll(
|
|
1388
|
+
[
|
|
1389
|
+
"scheme-normal",
|
|
1390
|
+
"scheme-dark",
|
|
1391
|
+
"scheme-light",
|
|
1392
|
+
"scheme-light-dark",
|
|
1393
|
+
"scheme-only-dark",
|
|
1394
|
+
"scheme-only-light"
|
|
1395
|
+
],
|
|
1396
|
+
["color-scheme"]
|
|
1397
|
+
);
|
|
1398
|
+
addAll(["snap-none", "snap-x", "snap-y", "snap-both"], ["scroll-snap-type"]);
|
|
1399
|
+
addAll(["snap-align-none", "snap-start", "snap-center", "snap-end"], ["scroll-snap-align"]);
|
|
1400
|
+
addAll(
|
|
1401
|
+
[
|
|
1402
|
+
"contain-none",
|
|
1403
|
+
"contain-content",
|
|
1404
|
+
"contain-strict",
|
|
1405
|
+
"contain-size",
|
|
1406
|
+
"contain-inline-size",
|
|
1407
|
+
"contain-layout",
|
|
1408
|
+
"contain-paint",
|
|
1409
|
+
"contain-style"
|
|
1410
|
+
],
|
|
1411
|
+
["contain"]
|
|
1412
|
+
);
|
|
1413
|
+
addAll(["break-normal", "break-all", "break-keep"], ["word-break"]);
|
|
1414
|
+
addAll(["scrollbar-auto", "scrollbar-thin", "scrollbar-none"], ["scrollbar-width"]);
|
|
1415
|
+
addAll(
|
|
1416
|
+
["scrollbar-gutter-auto", "scrollbar-gutter-stable", "scrollbar-gutter-both"],
|
|
1417
|
+
["scrollbar-gutter"]
|
|
1418
|
+
);
|
|
1419
|
+
addAll(
|
|
1420
|
+
["will-change-auto", "will-change-scroll", "will-change-contents", "will-change-transform"],
|
|
1421
|
+
["will-change"]
|
|
1422
|
+
);
|
|
1423
|
+
addAll(
|
|
1424
|
+
[
|
|
1425
|
+
"mix-blend-normal",
|
|
1426
|
+
"mix-blend-multiply",
|
|
1427
|
+
"mix-blend-screen",
|
|
1428
|
+
"mix-blend-overlay",
|
|
1429
|
+
"mix-blend-darken",
|
|
1430
|
+
"mix-blend-lighten",
|
|
1431
|
+
"mix-blend-color-dodge",
|
|
1432
|
+
"mix-blend-color-burn",
|
|
1433
|
+
"mix-blend-hard-light",
|
|
1434
|
+
"mix-blend-soft-light",
|
|
1435
|
+
"mix-blend-difference",
|
|
1436
|
+
"mix-blend-exclusion",
|
|
1437
|
+
"mix-blend-hue",
|
|
1438
|
+
"mix-blend-saturation",
|
|
1439
|
+
"mix-blend-color",
|
|
1440
|
+
"mix-blend-luminosity",
|
|
1441
|
+
"mix-blend-plus-darker",
|
|
1442
|
+
"mix-blend-plus-lighter"
|
|
1443
|
+
],
|
|
1444
|
+
["mix-blend-mode"]
|
|
1445
|
+
);
|
|
1446
|
+
var PREFIX_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1447
|
+
// Spacing
|
|
1448
|
+
p: ["padding"],
|
|
1449
|
+
px: ["padding-inline"],
|
|
1450
|
+
py: ["padding-block"],
|
|
1451
|
+
pt: ["padding-block-start"],
|
|
1452
|
+
pb: ["padding-block-end"],
|
|
1453
|
+
pl: ["padding-inline-start"],
|
|
1454
|
+
pr: ["padding-inline-end"],
|
|
1455
|
+
ps: ["padding-inline-start"],
|
|
1456
|
+
pe: ["padding-inline-end"],
|
|
1457
|
+
pbs: ["padding-block-start"],
|
|
1458
|
+
pbe: ["padding-block-end"],
|
|
1459
|
+
m: ["margin"],
|
|
1460
|
+
mx: ["margin-inline"],
|
|
1461
|
+
my: ["margin-block"],
|
|
1462
|
+
mt: ["margin-block-start"],
|
|
1463
|
+
mb: ["margin-block-end"],
|
|
1464
|
+
ml: ["margin-inline-start"],
|
|
1465
|
+
mr: ["margin-inline-end"],
|
|
1466
|
+
ms: ["margin-inline-start"],
|
|
1467
|
+
me: ["margin-inline-end"],
|
|
1468
|
+
mbs: ["margin-block-start"],
|
|
1469
|
+
mbe: ["margin-block-end"],
|
|
1470
|
+
gap: ["gap"],
|
|
1471
|
+
"gap-x": ["column-gap"],
|
|
1472
|
+
"gap-y": ["row-gap"],
|
|
1473
|
+
"p-fluid": ["padding"],
|
|
1474
|
+
"px-fluid": ["padding-inline"],
|
|
1475
|
+
"py-fluid": ["padding-block"],
|
|
1476
|
+
"pt-fluid": ["padding-block-start"],
|
|
1477
|
+
"pb-fluid": ["padding-block-end"],
|
|
1478
|
+
"pl-fluid": ["padding-inline-start"],
|
|
1479
|
+
"pr-fluid": ["padding-inline-end"],
|
|
1480
|
+
"ps-fluid": ["padding-inline-start"],
|
|
1481
|
+
"pe-fluid": ["padding-inline-end"],
|
|
1482
|
+
"pbs-fluid": ["padding-block-start"],
|
|
1483
|
+
"pbe-fluid": ["padding-block-end"],
|
|
1484
|
+
"m-fluid": ["margin"],
|
|
1485
|
+
"mx-fluid": ["margin-inline"],
|
|
1486
|
+
"my-fluid": ["margin-block"],
|
|
1487
|
+
"mt-fluid": ["margin-block-start"],
|
|
1488
|
+
"mb-fluid": ["margin-block-end"],
|
|
1489
|
+
"ml-fluid": ["margin-inline-start"],
|
|
1490
|
+
"mr-fluid": ["margin-inline-end"],
|
|
1491
|
+
"ms-fluid": ["margin-inline-start"],
|
|
1492
|
+
"me-fluid": ["margin-inline-end"],
|
|
1493
|
+
"mbs-fluid": ["margin-block-start"],
|
|
1494
|
+
"mbe-fluid": ["margin-block-end"],
|
|
1495
|
+
"gap-fluid": ["gap"],
|
|
1496
|
+
"gap-x-fluid": ["column-gap"],
|
|
1497
|
+
"gap-y-fluid": ["row-gap"],
|
|
1498
|
+
"inset-fluid": ["inset"],
|
|
1499
|
+
"inset-x-fluid": ["inset-inline"],
|
|
1500
|
+
"inset-y-fluid": ["inset-block"],
|
|
1501
|
+
"top-fluid": ["inset-block-start"],
|
|
1502
|
+
"bottom-fluid": ["inset-block-end"],
|
|
1503
|
+
"left-fluid": ["inset-inline-start"],
|
|
1504
|
+
"right-fluid": ["inset-inline-end"],
|
|
1505
|
+
"start-fluid": ["inset-inline-start"],
|
|
1506
|
+
"end-fluid": ["inset-inline-end"],
|
|
1507
|
+
"space-x": ["~space:margin-inline-start", "~space:margin-inline-end"],
|
|
1508
|
+
"space-y": ["~space:margin-block-start", "~space:margin-block-end"],
|
|
1509
|
+
inset: ["inset"],
|
|
1510
|
+
"inset-x": ["inset-inline"],
|
|
1511
|
+
"inset-y": ["inset-block"],
|
|
1512
|
+
"inset-s": ["inset-inline-start"],
|
|
1513
|
+
"inset-e": ["inset-inline-end"],
|
|
1514
|
+
"inset-bs": ["inset-block-start"],
|
|
1515
|
+
"inset-be": ["inset-block-end"],
|
|
1516
|
+
top: ["inset-block-start"],
|
|
1517
|
+
bottom: ["inset-block-end"],
|
|
1518
|
+
left: ["inset-inline-start"],
|
|
1519
|
+
right: ["inset-inline-end"],
|
|
1520
|
+
start: ["inset-inline-start"],
|
|
1521
|
+
end: ["inset-inline-end"],
|
|
1522
|
+
// Sizing
|
|
1523
|
+
w: ["width"],
|
|
1524
|
+
h: ["height"],
|
|
1525
|
+
"min-w": ["min-width"],
|
|
1526
|
+
"max-w": ["max-width"],
|
|
1527
|
+
"min-h": ["min-height"],
|
|
1528
|
+
"max-h": ["max-height"],
|
|
1529
|
+
size: ["width", "height"],
|
|
1530
|
+
// Logical sizing — overloads the inline/block display prefixes. Bare
|
|
1531
|
+
// `inline`/`block` and `inline-block` etc. resolve as display via the
|
|
1532
|
+
// BUILTIN_STATIC_PROPS match, which runs before prefix resolution.
|
|
1533
|
+
inline: ["inline-size"],
|
|
1534
|
+
block: ["block-size"],
|
|
1535
|
+
"min-inline": ["min-inline-size"],
|
|
1536
|
+
"max-inline": ["max-inline-size"],
|
|
1537
|
+
"min-block": ["min-block-size"],
|
|
1538
|
+
"max-block": ["max-block-size"],
|
|
1539
|
+
// Layout
|
|
1540
|
+
z: ["z-index"],
|
|
1541
|
+
order: ["order"],
|
|
1542
|
+
"grid-cols": ["grid-template-columns"],
|
|
1543
|
+
"grid-rows": ["grid-template-rows"],
|
|
1544
|
+
"col-span": ["grid-column"],
|
|
1545
|
+
"col-start": ["grid-column-start"],
|
|
1546
|
+
"col-end": ["grid-column-end"],
|
|
1547
|
+
"row-span": ["grid-row"],
|
|
1548
|
+
"row-start": ["grid-row-start"],
|
|
1549
|
+
"row-end": ["grid-row-end"],
|
|
1550
|
+
// Bare grid-column / grid-row + flex-value prefixes (statics are matched first;
|
|
1551
|
+
// `flex`/`grow`/`shrink` are also display/flex-grow/flex-shrink statics).
|
|
1552
|
+
col: ["grid-column"],
|
|
1553
|
+
row: ["grid-row"],
|
|
1554
|
+
flex: ["flex"],
|
|
1555
|
+
grow: ["flex-grow"],
|
|
1556
|
+
shrink: ["flex-shrink"],
|
|
1557
|
+
"auto-cols": ["grid-auto-columns"],
|
|
1558
|
+
"auto-rows": ["grid-auto-rows"],
|
|
1559
|
+
columns: ["columns"],
|
|
1560
|
+
aspect: ["aspect-ratio"],
|
|
1561
|
+
// object-[v] / object-(--p) → object-position (object-fit + keyword statics
|
|
1562
|
+
// are matched first via BUILTIN_STATIC_PROPS).
|
|
1563
|
+
object: ["object-position"],
|
|
1564
|
+
// Typography
|
|
1565
|
+
"text-fluid": ["font-size", "line-height"],
|
|
1566
|
+
leading: ["line-height"],
|
|
1567
|
+
tracking: ["letter-spacing"],
|
|
1568
|
+
indent: ["text-indent"],
|
|
1569
|
+
tab: ["tab-size"],
|
|
1570
|
+
align: ["vertical-align"],
|
|
1571
|
+
"line-clamp": ["overflow", "display", "-webkit-box-orient", "-webkit-line-clamp"],
|
|
1572
|
+
"underline-offset": ["text-underline-offset"],
|
|
1573
|
+
"font-stretch": ["font-stretch"],
|
|
1574
|
+
"font-features": ["font-feature-settings"],
|
|
1575
|
+
"list-image": ["list-style-image"],
|
|
1576
|
+
// list-[<value>] / list-(--v) → list-style-type (keyword/position statics matched first)
|
|
1577
|
+
list: ["list-style-type"],
|
|
1578
|
+
// Flex basis
|
|
1579
|
+
basis: ["flex-basis"],
|
|
1580
|
+
// Perspective (functional): perspective-{n}, perspective-[arb]
|
|
1581
|
+
perspective: ["perspective"],
|
|
1582
|
+
"perspective-origin": ["perspective-origin"],
|
|
1583
|
+
// Transform axis variants — each sets its own CSS variable plus the shared
|
|
1584
|
+
// `transform` property, so rotate-x/y/z and skew-x/y compose (distinct slot vars).
|
|
1585
|
+
"rotate-x": ["transform", "--ri-rotate-x"],
|
|
1586
|
+
"rotate-y": ["transform", "--ri-rotate-y"],
|
|
1587
|
+
"rotate-z": ["transform", "--ri-rotate-z"],
|
|
1588
|
+
"scale-z": ["--ri-scale-z", "scale"],
|
|
1589
|
+
"translate-z": ["--ri-translate-z", "translate"],
|
|
1590
|
+
// Effects — composable shadow/ring families (shared box-shadow + slot var)
|
|
1591
|
+
shadow: ["box-shadow", "--ri-shadow"],
|
|
1592
|
+
"inset-shadow": ["box-shadow", "--ri-inset-shadow"],
|
|
1593
|
+
ring: ["box-shadow", "--ri-ring-shadow"],
|
|
1594
|
+
"inset-ring": ["box-shadow", "--ri-inset-ring-shadow"],
|
|
1595
|
+
// text-shadow is its own property (not part of the box-shadow composition)
|
|
1596
|
+
"text-shadow": ["text-shadow"],
|
|
1597
|
+
opacity: ["opacity"],
|
|
1598
|
+
blur: ["--ri-blur", "filter"],
|
|
1599
|
+
duration: ["transition-duration", "animation-duration"],
|
|
1600
|
+
delay: ["transition-delay", "animation-delay"],
|
|
1601
|
+
ease: ["transition-timing-function"],
|
|
1602
|
+
"translate-x": ["--ri-translate-x", "translate"],
|
|
1603
|
+
"translate-y": ["--ri-translate-y", "translate"],
|
|
1604
|
+
rotate: ["rotate"],
|
|
1605
|
+
"scale-x": ["--ri-scale-x", "scale"],
|
|
1606
|
+
"scale-y": ["--ri-scale-y", "scale"],
|
|
1607
|
+
scale: ["scale"],
|
|
1608
|
+
skew: ["transform", "--ri-skew-x", "--ri-skew-y"],
|
|
1609
|
+
"skew-x": ["transform", "--ri-skew-x"],
|
|
1610
|
+
"skew-y": ["transform", "--ri-skew-y"],
|
|
1611
|
+
transform: ["transform"],
|
|
1612
|
+
zoom: ["zoom"],
|
|
1613
|
+
filter: ["filter"],
|
|
1614
|
+
brightness: ["--ri-brightness", "filter"],
|
|
1615
|
+
contrast: ["--ri-contrast", "filter"],
|
|
1616
|
+
saturate: ["--ri-saturate", "filter"],
|
|
1617
|
+
grayscale: ["--ri-grayscale", "filter"],
|
|
1618
|
+
invert: ["--ri-invert", "filter"],
|
|
1619
|
+
sepia: ["--ri-sepia", "filter"],
|
|
1620
|
+
"hue-rotate": ["--ri-hue-rotate", "filter"],
|
|
1621
|
+
"drop-shadow": ["--ri-drop-shadow", "filter"],
|
|
1622
|
+
// Borders — these also appear in BUILTIN_STATIC_PROPS for the bare static
|
|
1623
|
+
// form (e.g. `border-t` → default 1px width). The prefix entries here handle
|
|
1624
|
+
// the dynamic form (e.g. `border-t-2`, `border-t-red-500`) via resolvePropsWith().
|
|
1625
|
+
"border-t": ["border-block-start-width"],
|
|
1626
|
+
"border-b": ["border-block-end-width"],
|
|
1627
|
+
"border-l": ["border-inline-start-width"],
|
|
1628
|
+
"border-r": ["border-inline-end-width"],
|
|
1629
|
+
"border-s": ["border-inline-start-width"],
|
|
1630
|
+
"border-e": ["border-inline-end-width"],
|
|
1631
|
+
"border-bs": ["border-block-start-width"],
|
|
1632
|
+
"border-be": ["border-block-end-width"],
|
|
1633
|
+
"border-x": ["border-inline-width"],
|
|
1634
|
+
"border-y": ["border-block-width"],
|
|
1635
|
+
// Table border-spacing — composable: shared border-spacing + per-axis slot var.
|
|
1636
|
+
"border-spacing": ["border-spacing", "--ri-border-spacing-x", "--ri-border-spacing-y"],
|
|
1637
|
+
"border-spacing-x": ["border-spacing", "--ri-border-spacing-x"],
|
|
1638
|
+
"border-spacing-y": ["border-spacing", "--ri-border-spacing-y"],
|
|
1639
|
+
rounded: ["border-radius"],
|
|
1640
|
+
"rounded-t": ["border-start-start-radius", "border-start-end-radius"],
|
|
1641
|
+
"rounded-b": ["border-end-start-radius", "border-end-end-radius"],
|
|
1642
|
+
"rounded-l": ["border-start-start-radius", "border-end-start-radius"],
|
|
1643
|
+
"rounded-r": ["border-start-end-radius", "border-end-end-radius"],
|
|
1644
|
+
"rounded-tl": ["border-start-start-radius"],
|
|
1645
|
+
"rounded-tr": ["border-start-end-radius"],
|
|
1646
|
+
"rounded-bl": ["border-end-start-radius"],
|
|
1647
|
+
"rounded-br": ["border-end-end-radius"],
|
|
1648
|
+
"rounded-s": ["border-start-start-radius", "border-end-start-radius"],
|
|
1649
|
+
"rounded-e": ["border-start-end-radius", "border-end-end-radius"],
|
|
1650
|
+
"rounded-bs": ["border-start-start-radius", "border-start-end-radius"],
|
|
1651
|
+
"rounded-be": ["border-end-start-radius", "border-end-end-radius"],
|
|
1652
|
+
"rounded-ss": ["border-start-start-radius"],
|
|
1653
|
+
"rounded-se": ["border-start-end-radius"],
|
|
1654
|
+
"rounded-es": ["border-end-start-radius"],
|
|
1655
|
+
"rounded-ee": ["border-end-end-radius"],
|
|
1656
|
+
// Arbitrary corner-shape: corner-[superellipse(2)], etc.
|
|
1657
|
+
corner: ["corner-shape", "--ri-rounded-scale"],
|
|
1658
|
+
"outline-offset": ["outline-offset"],
|
|
1659
|
+
outline: ["outline-width"],
|
|
1660
|
+
divide: ["~divide:border-color"],
|
|
1661
|
+
"divide-x": ["~divide:border-inline-start-width", "~divide:border-inline-end-width"],
|
|
1662
|
+
"divide-y": ["~divide:border-block-start-width", "~divide:border-block-end-width"],
|
|
1663
|
+
border: ["border-width"],
|
|
1664
|
+
// Gradients
|
|
1665
|
+
"bg-linear-to": ["background-image", "--ri-gradient-position"],
|
|
1666
|
+
"bg-linear": ["background-image", "--ri-gradient-position"],
|
|
1667
|
+
"bg-conic": ["background-image", "--ri-gradient-position"],
|
|
1668
|
+
"bg-radial": ["background-image", "--ri-gradient-position"],
|
|
1669
|
+
from: ["--ri-gradient-from", "--ri-gradient-stops"],
|
|
1670
|
+
via: ["--ri-gradient-via", "--ri-gradient-stops"],
|
|
1671
|
+
to: ["--ri-gradient-to", "--ri-gradient-stops"],
|
|
1672
|
+
"from-position": ["--ri-gradient-from-position"],
|
|
1673
|
+
"via-position": ["--ri-gradient-via-position"],
|
|
1674
|
+
"to-position": ["--ri-gradient-to-position"],
|
|
1675
|
+
// Animations
|
|
1676
|
+
"animate-duration": ["animation-duration"],
|
|
1677
|
+
"animate-delay": ["animation-delay"],
|
|
1678
|
+
"animate-ease": ["animation-timing-function"],
|
|
1679
|
+
"break-before": ["break-before"],
|
|
1680
|
+
"break-after": ["break-after"],
|
|
1681
|
+
"break-inside": ["break-inside"],
|
|
1682
|
+
content: ["content"],
|
|
1683
|
+
"fade-in": ["--ri-enter-opacity"],
|
|
1684
|
+
"fade-out": ["--ri-exit-opacity"],
|
|
1685
|
+
"zoom-in": ["--ri-enter-scale"],
|
|
1686
|
+
"zoom-out": ["--ri-exit-scale"],
|
|
1687
|
+
"spin-in": ["--ri-enter-rotate"],
|
|
1688
|
+
"spin-out": ["--ri-exit-rotate"],
|
|
1689
|
+
"blur-in": ["--ri-enter-blur"],
|
|
1690
|
+
"blur-out": ["--ri-exit-blur"],
|
|
1691
|
+
"slide-in-from-top": ["--ri-enter-translate-y"],
|
|
1692
|
+
"slide-in-from-bottom": ["--ri-enter-translate-y"],
|
|
1693
|
+
"slide-in-from-left": ["--ri-enter-translate-x"],
|
|
1694
|
+
"slide-in-from-right": ["--ri-enter-translate-x"],
|
|
1695
|
+
"slide-out-to-top": ["--ri-exit-translate-y"],
|
|
1696
|
+
"slide-out-to-bottom": ["--ri-exit-translate-y"],
|
|
1697
|
+
"slide-out-to-left": ["--ri-exit-translate-x"],
|
|
1698
|
+
"slide-out-to-right": ["--ri-exit-translate-x"],
|
|
1699
|
+
// Scroll margin/padding
|
|
1700
|
+
"scroll-m": ["scroll-margin"],
|
|
1701
|
+
"scroll-mx": ["scroll-margin-inline"],
|
|
1702
|
+
"scroll-my": ["scroll-margin-block"],
|
|
1703
|
+
"scroll-mt": ["scroll-margin-block-start"],
|
|
1704
|
+
"scroll-mb": ["scroll-margin-block-end"],
|
|
1705
|
+
"scroll-ml": ["scroll-margin-inline-start"],
|
|
1706
|
+
"scroll-mr": ["scroll-margin-inline-end"],
|
|
1707
|
+
"scroll-ms": ["scroll-margin-inline-start"],
|
|
1708
|
+
"scroll-me": ["scroll-margin-inline-end"],
|
|
1709
|
+
"scroll-mbs": ["scroll-margin-block-start"],
|
|
1710
|
+
"scroll-mbe": ["scroll-margin-block-end"],
|
|
1711
|
+
"scroll-p": ["scroll-padding"],
|
|
1712
|
+
"scroll-px": ["scroll-padding-inline"],
|
|
1713
|
+
"scroll-py": ["scroll-padding-block"],
|
|
1714
|
+
"scroll-pt": ["scroll-padding-block-start"],
|
|
1715
|
+
"scroll-pb": ["scroll-padding-block-end"],
|
|
1716
|
+
"scroll-pl": ["scroll-padding-inline-start"],
|
|
1717
|
+
"scroll-pr": ["scroll-padding-inline-end"],
|
|
1718
|
+
"scroll-ps": ["scroll-padding-inline-start"],
|
|
1719
|
+
"scroll-pe": ["scroll-padding-inline-end"],
|
|
1720
|
+
"scroll-pbs": ["scroll-padding-block-start"],
|
|
1721
|
+
"scroll-pbe": ["scroll-padding-block-end"],
|
|
1722
|
+
// Backdrop filter — each function gets a unique CSS variable so they coexist
|
|
1723
|
+
"backdrop-filter": ["backdrop-filter"],
|
|
1724
|
+
"backdrop-blur": ["--ri-backdrop-blur", "backdrop-filter"],
|
|
1725
|
+
"backdrop-brightness": ["--ri-backdrop-brightness", "backdrop-filter"],
|
|
1726
|
+
"backdrop-contrast": ["--ri-backdrop-contrast", "backdrop-filter"],
|
|
1727
|
+
"backdrop-saturate": ["--ri-backdrop-saturate", "backdrop-filter"],
|
|
1728
|
+
"backdrop-grayscale": ["--ri-backdrop-grayscale", "backdrop-filter"],
|
|
1729
|
+
"backdrop-invert": ["--ri-backdrop-invert", "backdrop-filter"],
|
|
1730
|
+
"backdrop-sepia": ["--ri-backdrop-sepia", "backdrop-filter"],
|
|
1731
|
+
"backdrop-opacity": ["--ri-backdrop-opacity", "backdrop-filter"],
|
|
1732
|
+
"backdrop-hue-rotate": ["--ri-backdrop-hue-rotate", "backdrop-filter"],
|
|
1733
|
+
// Mask
|
|
1734
|
+
mask: ["mask-image"],
|
|
1735
|
+
// Mask gradient families. The `*-from`/`*-to` prefixes are dual-mode
|
|
1736
|
+
// (position vs color), resolved in merge/index.ts; the arrays here are the
|
|
1737
|
+
// color-case defaults. Listing `mask-image` lets same-family from/to coexist
|
|
1738
|
+
// (each also owns a unique stop var) while same-end repeats dedupe.
|
|
1739
|
+
"mask-linear": ["mask-image", "--ri-mask-linear-position"],
|
|
1740
|
+
"mask-linear-from": ["mask-image", "--ri-mask-linear-from"],
|
|
1741
|
+
"mask-linear-to": ["mask-image", "--ri-mask-linear-to"],
|
|
1742
|
+
"mask-conic": ["mask-image", "--ri-mask-conic-position"],
|
|
1743
|
+
"mask-conic-from": ["mask-image", "--ri-mask-conic-from"],
|
|
1744
|
+
"mask-conic-to": ["mask-image", "--ri-mask-conic-to"],
|
|
1745
|
+
"mask-radial": ["mask-image"],
|
|
1746
|
+
"mask-radial-from": ["mask-image", "--ri-mask-radial-from"],
|
|
1747
|
+
"mask-radial-to": ["mask-image", "--ri-mask-radial-to"],
|
|
1748
|
+
"mask-t-from": ["mask-image", "--ri-mask-top-from"],
|
|
1749
|
+
"mask-t-to": ["mask-image", "--ri-mask-top-to"],
|
|
1750
|
+
"mask-r-from": ["mask-image", "--ri-mask-right-from"],
|
|
1751
|
+
"mask-r-to": ["mask-image", "--ri-mask-right-to"],
|
|
1752
|
+
"mask-b-from": ["mask-image", "--ri-mask-bottom-from"],
|
|
1753
|
+
"mask-b-to": ["mask-image", "--ri-mask-bottom-to"],
|
|
1754
|
+
"mask-l-from": ["mask-image", "--ri-mask-left-from"],
|
|
1755
|
+
"mask-l-to": ["mask-image", "--ri-mask-left-to"],
|
|
1756
|
+
"mask-x-from": ["mask-image", "mask-composite", "--ri-mask-right-from", "--ri-mask-left-from"],
|
|
1757
|
+
"mask-x-to": ["mask-image", "mask-composite", "--ri-mask-right-to", "--ri-mask-left-to"],
|
|
1758
|
+
"mask-y-from": ["mask-image", "mask-composite", "--ri-mask-top-from", "--ri-mask-bottom-from"],
|
|
1759
|
+
"mask-y-to": ["mask-image", "mask-composite", "--ri-mask-top-to", "--ri-mask-bottom-to"],
|
|
1760
|
+
"mask-position": ["mask-position"],
|
|
1761
|
+
"mask-size": ["mask-size"],
|
|
1762
|
+
// Background position/size (longer than the `bg` dual-mode prefix → matched first)
|
|
1763
|
+
"bg-position": ["background-position"],
|
|
1764
|
+
"bg-size": ["background-size"],
|
|
1765
|
+
// Color prefixes (dual-mode entries — resolved by special-case logic in resolveProps)
|
|
1766
|
+
text: ["color"],
|
|
1767
|
+
bg: ["background-color"],
|
|
1768
|
+
font: ["font-weight"],
|
|
1769
|
+
decoration: ["text-decoration-thickness"],
|
|
1770
|
+
accent: ["accent-color"],
|
|
1771
|
+
caret: ["caret-color"],
|
|
1772
|
+
// Composable scrollbar-color (shared scrollbar-color + per-part slot var).
|
|
1773
|
+
"scrollbar-thumb": ["scrollbar-color", "--ri-scrollbar-thumb"],
|
|
1774
|
+
"scrollbar-track": ["scrollbar-color", "--ri-scrollbar-track"],
|
|
1775
|
+
fill: ["fill"],
|
|
1776
|
+
stroke: ["stroke"],
|
|
1777
|
+
"stroke-cap": ["stroke-linecap"],
|
|
1778
|
+
"stroke-join": ["stroke-linejoin"],
|
|
1779
|
+
"stroke-dash": ["stroke-dasharray"],
|
|
1780
|
+
"stroke-offset": ["stroke-dashoffset"],
|
|
1781
|
+
"stroke-miter": ["stroke-miterlimit"],
|
|
1782
|
+
"stroke-opacity": ["stroke-opacity"],
|
|
1783
|
+
paint: ["paint-order"],
|
|
1784
|
+
vector: ["vector-effect"],
|
|
1785
|
+
// Anchor positioning
|
|
1786
|
+
"@anchor": ["anchor-name"],
|
|
1787
|
+
"@anchor-to": ["position-anchor"],
|
|
1788
|
+
"position-area": ["position-area"],
|
|
1789
|
+
"anchor-scope": ["anchor-scope"]
|
|
1790
|
+
});
|
|
1791
|
+
var BORDER_WIDTH_LONGHANDS = Object.freeze([
|
|
1792
|
+
"border-inline-width",
|
|
1793
|
+
"border-block-width",
|
|
1794
|
+
"border-block-start-width",
|
|
1795
|
+
"border-block-end-width",
|
|
1796
|
+
"border-inline-start-width",
|
|
1797
|
+
"border-inline-end-width"
|
|
1798
|
+
]);
|
|
1799
|
+
var BORDER_STYLE_LONGHANDS = Object.freeze([
|
|
1800
|
+
"border-inline-style",
|
|
1801
|
+
"border-block-style",
|
|
1802
|
+
"border-block-start-style",
|
|
1803
|
+
"border-block-end-style",
|
|
1804
|
+
"border-inline-start-style",
|
|
1805
|
+
"border-inline-end-style"
|
|
1806
|
+
]);
|
|
1807
|
+
var BORDER_COLOR_LONGHANDS = Object.freeze([
|
|
1808
|
+
"border-inline-color",
|
|
1809
|
+
"border-block-color",
|
|
1810
|
+
"border-block-start-color",
|
|
1811
|
+
"border-block-end-color",
|
|
1812
|
+
"border-inline-start-color",
|
|
1813
|
+
"border-inline-end-color"
|
|
1814
|
+
]);
|
|
1815
|
+
var OVERRIDES = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1816
|
+
padding: [
|
|
1817
|
+
"padding-inline",
|
|
1818
|
+
"padding-block",
|
|
1819
|
+
"padding-block-start",
|
|
1820
|
+
"padding-block-end",
|
|
1821
|
+
"padding-inline-start",
|
|
1822
|
+
"padding-inline-end"
|
|
1823
|
+
],
|
|
1824
|
+
"padding-inline": ["padding-inline-start", "padding-inline-end"],
|
|
1825
|
+
"padding-block": ["padding-block-start", "padding-block-end"],
|
|
1826
|
+
margin: [
|
|
1827
|
+
"margin-inline",
|
|
1828
|
+
"margin-block",
|
|
1829
|
+
"margin-block-start",
|
|
1830
|
+
"margin-block-end",
|
|
1831
|
+
"margin-inline-start",
|
|
1832
|
+
"margin-inline-end"
|
|
1833
|
+
],
|
|
1834
|
+
"margin-inline": ["margin-inline-start", "margin-inline-end"],
|
|
1835
|
+
"margin-block": ["margin-block-start", "margin-block-end"],
|
|
1836
|
+
gap: ["column-gap", "row-gap"],
|
|
1837
|
+
inset: [
|
|
1838
|
+
"inset-inline",
|
|
1839
|
+
"inset-block",
|
|
1840
|
+
"inset-block-start",
|
|
1841
|
+
"inset-block-end",
|
|
1842
|
+
"inset-inline-start",
|
|
1843
|
+
"inset-inline-end"
|
|
1844
|
+
],
|
|
1845
|
+
"inset-inline": ["inset-inline-start", "inset-inline-end"],
|
|
1846
|
+
"inset-block": ["inset-block-start", "inset-block-end"],
|
|
1847
|
+
"border-width": BORDER_WIDTH_LONGHANDS,
|
|
1848
|
+
"border-inline-width": ["border-inline-start-width", "border-inline-end-width"],
|
|
1849
|
+
"border-block-width": ["border-block-start-width", "border-block-end-width"],
|
|
1850
|
+
// Full `border` shorthand ([border:…] arbitrary properties / custom
|
|
1851
|
+
// utilities) — flattened to leaves like margin/padding above.
|
|
1852
|
+
border: [
|
|
1853
|
+
"border-width",
|
|
1854
|
+
"border-style",
|
|
1855
|
+
"border-color",
|
|
1856
|
+
...BORDER_WIDTH_LONGHANDS,
|
|
1857
|
+
...BORDER_STYLE_LONGHANDS,
|
|
1858
|
+
...BORDER_COLOR_LONGHANDS
|
|
1859
|
+
],
|
|
1860
|
+
"border-radius": [
|
|
1861
|
+
"border-start-start-radius",
|
|
1862
|
+
"border-start-end-radius",
|
|
1863
|
+
"border-end-start-radius",
|
|
1864
|
+
"border-end-end-radius"
|
|
1865
|
+
],
|
|
1866
|
+
overflow: ["overflow-x", "overflow-y"],
|
|
1867
|
+
"overscroll-behavior": ["overscroll-behavior-x", "overscroll-behavior-y"],
|
|
1868
|
+
"border-color": BORDER_COLOR_LONGHANDS,
|
|
1869
|
+
"border-inline-color": ["border-inline-start-color", "border-inline-end-color"],
|
|
1870
|
+
"border-block-color": ["border-block-start-color", "border-block-end-color"],
|
|
1871
|
+
"border-style": BORDER_STYLE_LONGHANDS,
|
|
1872
|
+
"scroll-margin": [
|
|
1873
|
+
"scroll-margin-inline",
|
|
1874
|
+
"scroll-margin-block",
|
|
1875
|
+
"scroll-margin-block-start",
|
|
1876
|
+
"scroll-margin-block-end",
|
|
1877
|
+
"scroll-margin-inline-start",
|
|
1878
|
+
"scroll-margin-inline-end"
|
|
1879
|
+
],
|
|
1880
|
+
"scroll-margin-inline": ["scroll-margin-inline-start", "scroll-margin-inline-end"],
|
|
1881
|
+
"scroll-margin-block": ["scroll-margin-block-start", "scroll-margin-block-end"],
|
|
1882
|
+
"scroll-padding": [
|
|
1883
|
+
"scroll-padding-inline",
|
|
1884
|
+
"scroll-padding-block",
|
|
1885
|
+
"scroll-padding-block-start",
|
|
1886
|
+
"scroll-padding-block-end",
|
|
1887
|
+
"scroll-padding-inline-start",
|
|
1888
|
+
"scroll-padding-inline-end"
|
|
1889
|
+
],
|
|
1890
|
+
"scroll-padding-inline": ["scroll-padding-inline-start", "scroll-padding-inline-end"],
|
|
1891
|
+
"scroll-padding-block": ["scroll-padding-block-start", "scroll-padding-block-end"],
|
|
1892
|
+
flex: ["flex-grow", "flex-shrink", "flex-basis"],
|
|
1893
|
+
transition: [
|
|
1894
|
+
"transition-property",
|
|
1895
|
+
"transition-duration",
|
|
1896
|
+
"transition-timing-function",
|
|
1897
|
+
"transition-delay"
|
|
1898
|
+
],
|
|
1899
|
+
animation: [
|
|
1900
|
+
"animation-name",
|
|
1901
|
+
"animation-duration",
|
|
1902
|
+
"animation-timing-function",
|
|
1903
|
+
"animation-delay",
|
|
1904
|
+
"animation-iteration-count",
|
|
1905
|
+
"animation-direction",
|
|
1906
|
+
"animation-fill-mode",
|
|
1907
|
+
"animation-play-state"
|
|
1908
|
+
],
|
|
1909
|
+
"text-decoration": [
|
|
1910
|
+
"text-decoration-line",
|
|
1911
|
+
"text-decoration-style",
|
|
1912
|
+
"text-decoration-color",
|
|
1913
|
+
"text-decoration-thickness"
|
|
1914
|
+
],
|
|
1915
|
+
outline: ["outline-width", "outline-style", "outline-color"],
|
|
1916
|
+
"grid-column": ["grid-column-start", "grid-column-end"],
|
|
1917
|
+
"grid-row": ["grid-row-start", "grid-row-end"],
|
|
1918
|
+
background: [
|
|
1919
|
+
"background-color",
|
|
1920
|
+
"background-image",
|
|
1921
|
+
"background-size",
|
|
1922
|
+
"background-position",
|
|
1923
|
+
"background-repeat",
|
|
1924
|
+
"background-attachment",
|
|
1925
|
+
"background-origin",
|
|
1926
|
+
"background-clip"
|
|
1927
|
+
],
|
|
1928
|
+
"place-items": ["align-items", "justify-items"],
|
|
1929
|
+
"place-content": ["align-content", "justify-content"],
|
|
1930
|
+
"place-self": ["align-self", "justify-self"],
|
|
1931
|
+
// filter-none / backdrop-blur-none reset all individual filter functions
|
|
1932
|
+
filter: [
|
|
1933
|
+
"--ri-blur",
|
|
1934
|
+
"--ri-brightness",
|
|
1935
|
+
"--ri-contrast",
|
|
1936
|
+
"--ri-saturate",
|
|
1937
|
+
"--ri-hue-rotate",
|
|
1938
|
+
"--ri-drop-shadow",
|
|
1939
|
+
"--ri-grayscale",
|
|
1940
|
+
"--ri-invert",
|
|
1941
|
+
"--ri-sepia"
|
|
1942
|
+
],
|
|
1943
|
+
"backdrop-filter": [
|
|
1944
|
+
"--ri-backdrop-blur",
|
|
1945
|
+
"--ri-backdrop-brightness",
|
|
1946
|
+
"--ri-backdrop-contrast",
|
|
1947
|
+
"--ri-backdrop-saturate",
|
|
1948
|
+
"--ri-backdrop-grayscale",
|
|
1949
|
+
"--ri-backdrop-invert",
|
|
1950
|
+
"--ri-backdrop-sepia",
|
|
1951
|
+
"--ri-backdrop-opacity",
|
|
1952
|
+
"--ri-backdrop-hue-rotate"
|
|
1953
|
+
]
|
|
1954
|
+
});
|
|
1955
|
+
Object.freeze(BUILTIN_STATIC_PROPS);
|
|
1956
|
+
Object.freeze(PREFIX_PROPS);
|
|
1957
|
+
Object.freeze(OVERRIDES);
|
|
1958
|
+
var RE_COLOR_SHADE = /^[a-z]+(?:-[a-z]+)*-\d{2,3}$/;
|
|
1959
|
+
var COLOR_FUNCTION_ALTERNATION = "oklch|oklab|rgb|rgba|hsl|hsla|hwb|lab|lch|color|light-dark";
|
|
1960
|
+
var RE_ARBITRARY_COLOR = new RegExp(`[#]|(?:${COLOR_FUNCTION_ALTERNATION})\\s*\\(`);
|
|
1961
|
+
var RE_ALPHA_SUFFIX = /\/[\w.%-]+$/;
|
|
1962
|
+
var SPECIAL_COLORS = Object.freeze(
|
|
1963
|
+
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1964
|
+
transparent: "transparent",
|
|
1965
|
+
current: "currentColor",
|
|
1966
|
+
inherit: "inherit",
|
|
1967
|
+
black: "oklch(0 0 0)",
|
|
1968
|
+
white: "oklch(1 0 0)",
|
|
1969
|
+
paper: "var(--color-paper)",
|
|
1970
|
+
ink: "var(--color-ink)"
|
|
1971
|
+
})
|
|
1972
|
+
);
|
|
1973
|
+
var SPECIAL_COLOR_NAMES = new Set(Object.keys(SPECIAL_COLORS));
|
|
1974
|
+
function isGradientPositionValue(value) {
|
|
1975
|
+
if (value.endsWith("%")) {
|
|
1976
|
+
const num = Number(value.slice(0, -1));
|
|
1977
|
+
return !Number.isNaN(num) && Number.isInteger(num) && num >= 0 && num <= 100;
|
|
1978
|
+
}
|
|
1979
|
+
if (value.startsWith("[") && value.endsWith("]") && !RE_ARBITRARY_COLOR.test(value)) {
|
|
1980
|
+
return true;
|
|
1981
|
+
}
|
|
1982
|
+
return false;
|
|
1983
|
+
}
|
|
1984
|
+
var MASK_STOP_NUMBER_RE = /^\d+(?:[._]\d+)?$/;
|
|
1985
|
+
var MASK_RADIAL_KEYWORD_RE = /\b(?:at|circle|ellipse|closest|farthest)\b/;
|
|
1986
|
+
function isMaskStopPositionValue(value) {
|
|
1987
|
+
if (MASK_STOP_NUMBER_RE.test(value)) return true;
|
|
1988
|
+
if (value.startsWith("(") && value.endsWith(")")) return true;
|
|
1989
|
+
if (value.endsWith("%")) {
|
|
1990
|
+
const num = Number(value.slice(0, -1));
|
|
1991
|
+
return !Number.isNaN(num);
|
|
1992
|
+
}
|
|
1993
|
+
if (value.startsWith("[")) return isGradientPositionValue(value);
|
|
1994
|
+
return false;
|
|
1995
|
+
}
|
|
1996
|
+
var MASK_RADIAL_SIZE_TOKEN_RE = /^-?(?:\d+\.?\d*|\.\d+)(?:%|[a-z]+)?$/i;
|
|
1997
|
+
function isMaskRadialSizeValue(value) {
|
|
1998
|
+
if (!(value.startsWith("[") && value.endsWith("]"))) return false;
|
|
1999
|
+
const inner = value.slice(1, -1);
|
|
2000
|
+
if (!inner) return false;
|
|
2001
|
+
if (MASK_RADIAL_KEYWORD_RE.test(inner)) return false;
|
|
2002
|
+
const tokens = inner.split("_").filter(Boolean);
|
|
2003
|
+
if (tokens.length === 0 || tokens.length > 2) return false;
|
|
2004
|
+
return tokens.every((token) => MASK_RADIAL_SIZE_TOKEN_RE.test(token));
|
|
2005
|
+
}
|
|
2006
|
+
function isColorValue(value, textSizes, colorNames) {
|
|
2007
|
+
if (value.startsWith("[color:") || value.startsWith("(color:")) return true;
|
|
2008
|
+
const alphaMatch = RE_ALPHA_SUFFIX.exec(value);
|
|
2009
|
+
const baseValue = alphaMatch ? value.slice(0, alphaMatch.index) : value;
|
|
2010
|
+
if (textSizes?.has(baseValue) === true) return false;
|
|
2011
|
+
if (colorNames?.has(baseValue) === true) return true;
|
|
2012
|
+
if (SPECIAL_COLOR_NAMES.has(baseValue)) return true;
|
|
2013
|
+
if (RE_COLOR_SHADE.test(baseValue)) return true;
|
|
2014
|
+
if (baseValue.startsWith("[") && RE_ARBITRARY_COLOR.test(baseValue)) return true;
|
|
2015
|
+
return false;
|
|
2016
|
+
}
|
|
2017
|
+
var RE_IMAGE_VALUE = /^(?:url|image|image-set|cross-fade|element|paint|(?:repeating-)?(?:linear|radial|conic)-gradient)\s*\(/i;
|
|
2018
|
+
function isImageValue(value) {
|
|
2019
|
+
if (value.startsWith("[image:") || value.startsWith("(image:")) return true;
|
|
2020
|
+
if (value.startsWith("[") || value.startsWith("(")) {
|
|
2021
|
+
return RE_IMAGE_VALUE.test(value.slice(1, -1));
|
|
2022
|
+
}
|
|
2023
|
+
return false;
|
|
2024
|
+
}
|
|
2025
|
+
function isFontFamilyValue(value) {
|
|
2026
|
+
if (value.startsWith("[family-name:") || value.startsWith("(family-name:")) return true;
|
|
2027
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
2028
|
+
const raw = value.slice(1, -1);
|
|
2029
|
+
return raw.includes(",") || raw.startsWith('"') || raw.startsWith("'");
|
|
2030
|
+
}
|
|
2031
|
+
return false;
|
|
2032
|
+
}
|
|
2033
|
+
var BUILTIN_STATIC_KEYS = new Set(Object.keys(BUILTIN_STATIC_PROPS));
|
|
2034
|
+
var PREFIX_PROP_KEYS = new Set(Object.keys(PREFIX_PROPS));
|
|
2035
|
+
var SORTED_PREFIXES = Object.keys(PREFIX_PROPS).sort((a, b) => b.length - a.length);
|
|
2036
|
+
function buildFirstSegmentMap(prefixes) {
|
|
2037
|
+
const map = /* @__PURE__ */ new Map();
|
|
2038
|
+
for (const prefix of prefixes) {
|
|
2039
|
+
const dashIdx = prefix.indexOf("-");
|
|
2040
|
+
const firstSeg = dashIdx === -1 ? prefix : prefix.slice(0, dashIdx);
|
|
2041
|
+
const existing = map.get(firstSeg);
|
|
2042
|
+
if (existing) {
|
|
2043
|
+
existing.push(prefix);
|
|
2044
|
+
} else {
|
|
2045
|
+
map.set(firstSeg, [prefix]);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
const frozen = /* @__PURE__ */ new Map();
|
|
2049
|
+
for (const [key, arr] of map) {
|
|
2050
|
+
frozen.set(key, Object.freeze(arr));
|
|
2051
|
+
}
|
|
2052
|
+
return frozen;
|
|
2053
|
+
}
|
|
2054
|
+
var PREFIX_FIRST_SEGMENT_MAP = buildFirstSegmentMap(SORTED_PREFIXES);
|
|
2055
|
+
|
|
2056
|
+
// src/brackets.ts
|
|
2057
|
+
function evictLRU(cache, maxSize) {
|
|
2058
|
+
if (cache.size < maxSize) return;
|
|
2059
|
+
const evictCount = maxSize >> 2;
|
|
2060
|
+
let count = 0;
|
|
2061
|
+
for (const key of cache.keys()) {
|
|
2062
|
+
if (count >= evictCount) break;
|
|
2063
|
+
cache.delete(key);
|
|
2064
|
+
count++;
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
function scanBracketAware(input, onChar, options) {
|
|
2068
|
+
const reverse = options?.reverse ?? false;
|
|
2069
|
+
let depth = 0;
|
|
2070
|
+
const start = reverse ? input.length - 1 : 0;
|
|
2071
|
+
const end = reverse ? -1 : input.length;
|
|
2072
|
+
const step = reverse ? -1 : 1;
|
|
2073
|
+
for (let i = start; i !== end; i += step) {
|
|
2074
|
+
const ch = input[i];
|
|
2075
|
+
if (reverse) {
|
|
2076
|
+
let bs = 0;
|
|
2077
|
+
while (i - 1 - bs >= 0 && input[i - 1 - bs] === "\\") bs++;
|
|
2078
|
+
if (bs > 0 && bs % 2 === 1) {
|
|
2079
|
+
i -= bs;
|
|
2080
|
+
continue;
|
|
2081
|
+
}
|
|
2082
|
+
} else {
|
|
2083
|
+
if (ch === "\\" && i + 1 < input.length) {
|
|
2084
|
+
i++;
|
|
2085
|
+
continue;
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
if (reverse) {
|
|
2089
|
+
if (ch === "]" || ch === ")") depth++;
|
|
2090
|
+
else if ((ch === "[" || ch === "(") && depth > 0) depth--;
|
|
2091
|
+
} else {
|
|
2092
|
+
if (ch === "[" || ch === "(") depth++;
|
|
2093
|
+
else if ((ch === "]" || ch === ")") && depth > 0) depth--;
|
|
2094
|
+
}
|
|
2095
|
+
if (onChar(ch, i, depth)) return;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
// src/merge/index.ts
|
|
2100
|
+
var DEFAULT_TEXT_SIZES = [
|
|
2101
|
+
"xs",
|
|
2102
|
+
"sm",
|
|
2103
|
+
"base",
|
|
2104
|
+
"lg",
|
|
2105
|
+
"xl",
|
|
2106
|
+
"2xl",
|
|
2107
|
+
"3xl",
|
|
2108
|
+
"4xl",
|
|
2109
|
+
"5xl"
|
|
2110
|
+
];
|
|
2111
|
+
var DEFAULT_FONT_FAMILIES = ["sans", "serif", "mono"];
|
|
2112
|
+
function stripTextModifier(value) {
|
|
2113
|
+
if (value.indexOf("/") === -1) return value;
|
|
2114
|
+
let slash = -1;
|
|
2115
|
+
scanBracketAware(value, (ch, i, depth) => {
|
|
2116
|
+
if (ch === "/" && depth === 0) {
|
|
2117
|
+
slash = i;
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
});
|
|
2121
|
+
return slash === -1 ? value : value.slice(0, slash);
|
|
2122
|
+
}
|
|
2123
|
+
var MASK_STOP_FAMILIES = [
|
|
2124
|
+
["mask-linear-from", ["linear"], "from"],
|
|
2125
|
+
["mask-linear-to", ["linear"], "to"],
|
|
2126
|
+
["mask-t-from", ["top"], "from"],
|
|
2127
|
+
["mask-t-to", ["top"], "to"],
|
|
2128
|
+
["mask-r-from", ["right"], "from"],
|
|
2129
|
+
["mask-r-to", ["right"], "to"],
|
|
2130
|
+
["mask-b-from", ["bottom"], "from"],
|
|
2131
|
+
["mask-b-to", ["bottom"], "to"],
|
|
2132
|
+
["mask-l-from", ["left"], "from"],
|
|
2133
|
+
["mask-l-to", ["left"], "to"],
|
|
2134
|
+
["mask-x-from", ["right", "left"], "from"],
|
|
2135
|
+
["mask-x-to", ["right", "left"], "to"],
|
|
2136
|
+
["mask-y-from", ["top", "bottom"], "from"],
|
|
2137
|
+
["mask-y-to", ["top", "bottom"], "to"],
|
|
2138
|
+
["mask-radial-from", ["radial"], "from"],
|
|
2139
|
+
["mask-radial-to", ["radial"], "to"],
|
|
2140
|
+
["mask-conic-from", ["conic"], "from"],
|
|
2141
|
+
["mask-conic-to", ["conic"], "to"]
|
|
2142
|
+
];
|
|
2143
|
+
var MASK_STOP_DUAL_MODES = {};
|
|
2144
|
+
for (const [prefix, sides, end] of MASK_STOP_FAMILIES) {
|
|
2145
|
+
const positionProps = ["mask-image"];
|
|
2146
|
+
if (sides.length > 1) positionProps.push("mask-composite");
|
|
2147
|
+
for (const side of sides) positionProps.push(`--ri-mask-${side}-${end}-position`);
|
|
2148
|
+
Object.freeze(positionProps);
|
|
2149
|
+
const colorProps = PREFIX_PROPS[prefix];
|
|
2150
|
+
MASK_STOP_DUAL_MODES[prefix] = {
|
|
2151
|
+
resolve: (value) => isMaskStopPositionValue(value) ? positionProps : colorProps
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
var TEXT_SIZE_PROPS = Object.freeze(["font-size", "line-height"]);
|
|
2155
|
+
var FONT_FAMILY_PROPS = Object.freeze([
|
|
2156
|
+
"font-family",
|
|
2157
|
+
"font-feature-settings",
|
|
2158
|
+
"font-variation-settings"
|
|
2159
|
+
]);
|
|
2160
|
+
var MASK_RADIAL_SIZE_PROPS = Object.freeze(["--ri-mask-radial-size"]);
|
|
2161
|
+
var BG_IMAGE_PROPS = Object.freeze(["background-image"]);
|
|
2162
|
+
var BORDER_COLOR_PROPS = Object.freeze(["border-color"]);
|
|
2163
|
+
var OUTLINE_COLOR_PROPS = Object.freeze(["outline-color"]);
|
|
2164
|
+
var OUTLINE_STYLE_PROPS = Object.freeze(["outline-style"]);
|
|
2165
|
+
var DECORATION_COLOR_PROPS = Object.freeze(["text-decoration-color"]);
|
|
2166
|
+
var RE_SIGNED_INT = /^-?\d+$/;
|
|
2167
|
+
var RE_UNSIGNED_INT = /^\d+$/;
|
|
2168
|
+
var WS_SPLIT_RE = /\s+/;
|
|
2169
|
+
function colorOrDefault(prefix, colorProps) {
|
|
2170
|
+
const defaultProps = PREFIX_PROPS[prefix];
|
|
2171
|
+
return {
|
|
2172
|
+
resolve: (value, _textSizes2, _fontFamilies2, colorNames) => isColorValue(value, void 0, colorNames) ? colorProps : defaultProps
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
var DUAL_MODE_PREFIXES = {
|
|
2176
|
+
...MASK_STOP_DUAL_MODES,
|
|
2177
|
+
// mask-radial-[<size>] sets the size var; mask-radial-[<value>] is a full image.
|
|
2178
|
+
"mask-radial": {
|
|
2179
|
+
resolve: (value) => isMaskRadialSizeValue(value) ? MASK_RADIAL_SIZE_PROPS : PREFIX_PROPS["mask-radial"]
|
|
2180
|
+
},
|
|
2181
|
+
text: {
|
|
2182
|
+
resolve: (value, textSizes, _fontFamilies2, colorNames) => {
|
|
2183
|
+
const base = stripTextModifier(value);
|
|
2184
|
+
if (textSizes.has(base) || base.startsWith("[") && !isColorValue(base, textSizes, colorNames)) {
|
|
2185
|
+
return TEXT_SIZE_PROPS;
|
|
2186
|
+
}
|
|
2187
|
+
return PREFIX_PROPS.text;
|
|
2188
|
+
}
|
|
2189
|
+
},
|
|
2190
|
+
font: {
|
|
2191
|
+
resolve: (value, _textSizes2, fontFamilies) => {
|
|
2192
|
+
if (fontFamilies.has(value) || isFontFamilyValue(value)) return FONT_FAMILY_PROPS;
|
|
2193
|
+
return PREFIX_PROPS.font;
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2196
|
+
border: {
|
|
2197
|
+
resolve: (value, _textSizes2, _fontFamilies2, colorNames) => isColorValue(value, void 0, colorNames) ? BORDER_COLOR_PROPS : PREFIX_PROPS.border
|
|
2198
|
+
},
|
|
2199
|
+
outline: {
|
|
2200
|
+
resolve: (value, _textSizes2, _fontFamilies2, colorNames) => {
|
|
2201
|
+
if (isColorValue(value, void 0, colorNames)) return OUTLINE_COLOR_PROPS;
|
|
2202
|
+
if (RE_SIGNED_INT.test(value) || value.startsWith("[") && !isColorValue(value))
|
|
2203
|
+
return PREFIX_PROPS.outline;
|
|
2204
|
+
return OUTLINE_STYLE_PROPS;
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
decoration: {
|
|
2208
|
+
resolve: (value, _textSizes2, _fontFamilies2, colorNames) => {
|
|
2209
|
+
if (value.startsWith("(length:") || value.startsWith("[length:"))
|
|
2210
|
+
return PREFIX_PROPS.decoration;
|
|
2211
|
+
if (value.startsWith("(")) return DECORATION_COLOR_PROPS;
|
|
2212
|
+
if (RE_UNSIGNED_INT.test(value) || value.startsWith("[") && !isColorValue(value))
|
|
2213
|
+
return PREFIX_PROPS.decoration;
|
|
2214
|
+
if (isColorValue(value, void 0, colorNames)) return DECORATION_COLOR_PROPS;
|
|
2215
|
+
return PREFIX_PROPS.decoration;
|
|
2216
|
+
}
|
|
2217
|
+
},
|
|
2218
|
+
bg: {
|
|
2219
|
+
// Image-first to mirror colorGenerator's dispatch: the engine emits
|
|
2220
|
+
// background-image for image-shaped values (bg-[url(#x)] contains "#",
|
|
2221
|
+
// so a color-first check would misclassify it) and background-color
|
|
2222
|
+
// for everything else — never the full `background` shorthand.
|
|
2223
|
+
resolve: (value) => isImageValue(value) ? BG_IMAGE_PROPS : PREFIX_PROPS.bg
|
|
2224
|
+
},
|
|
2225
|
+
shadow: colorOrDefault("shadow", Object.freeze(["--ri-shadow-color"])),
|
|
2226
|
+
"inset-shadow": colorOrDefault("inset-shadow", Object.freeze(["--ri-inset-shadow-color"])),
|
|
2227
|
+
ring: colorOrDefault("ring", Object.freeze(["--ri-ring-color"])),
|
|
2228
|
+
"inset-ring": colorOrDefault("inset-ring", Object.freeze(["--ri-inset-ring-color"])),
|
|
2229
|
+
"text-shadow": colorOrDefault("text-shadow", Object.freeze(["--ri-text-shadow-color"])),
|
|
2230
|
+
"drop-shadow": colorOrDefault("drop-shadow", Object.freeze(["--ri-drop-shadow-color"])),
|
|
2231
|
+
from: {
|
|
2232
|
+
resolve: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["from-position"] : PREFIX_PROPS.from
|
|
2233
|
+
},
|
|
2234
|
+
via: {
|
|
2235
|
+
resolve: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["via-position"] : PREFIX_PROPS.via
|
|
2236
|
+
},
|
|
2237
|
+
to: {
|
|
2238
|
+
resolve: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["to-position"] : PREFIX_PROPS.to
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2241
|
+
var DIRECTIONAL_BORDER_COLOR_PROPS = new Map(
|
|
2242
|
+
[
|
|
2243
|
+
"border-t",
|
|
2244
|
+
"border-b",
|
|
2245
|
+
"border-l",
|
|
2246
|
+
"border-r",
|
|
2247
|
+
"border-s",
|
|
2248
|
+
"border-e",
|
|
2249
|
+
"border-bs",
|
|
2250
|
+
"border-be",
|
|
2251
|
+
"border-x",
|
|
2252
|
+
"border-y"
|
|
2253
|
+
].map((prefix) => [prefix, Object.freeze([PREFIX_PROPS[prefix][0].replace("width", "color")])])
|
|
2254
|
+
);
|
|
2255
|
+
var _customStaticProps = {};
|
|
2256
|
+
var _textSizes = new Set(DEFAULT_TEXT_SIZES);
|
|
2257
|
+
var _fontFamilies = new Set(DEFAULT_FONT_FAMILIES);
|
|
2258
|
+
var _colorNames = /* @__PURE__ */ new Set();
|
|
2259
|
+
var _latestSnapshot = null;
|
|
2260
|
+
var RI_CACHE_MAX = 500;
|
|
2261
|
+
var RI_CACHE_KEY_MAX_LEN = 2048;
|
|
2262
|
+
var _riCache = /* @__PURE__ */ new Map();
|
|
2263
|
+
function resolvePropsWith(utility, customStaticProps, textSizes, fontFamilies, colorNames) {
|
|
2264
|
+
if (utility.charCodeAt(0) === 91) {
|
|
2265
|
+
const colonIdx = utility.indexOf(":");
|
|
2266
|
+
if (colonIdx !== -1) {
|
|
2267
|
+
const prop = utility.slice(1, colonIdx).trim();
|
|
2268
|
+
if (prop) return [prop];
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
let name = utility;
|
|
2272
|
+
if (name.charCodeAt(0) === 45 && name.length > 1) {
|
|
2273
|
+
const next = name.charCodeAt(1);
|
|
2274
|
+
if (next >= 97 && next <= 122) name = name.slice(1);
|
|
2275
|
+
}
|
|
2276
|
+
if (Object.hasOwn(customStaticProps, name)) return customStaticProps[name];
|
|
2277
|
+
const builtin = BUILTIN_STATIC_PROPS[name];
|
|
2278
|
+
if (builtin !== void 0) return builtin;
|
|
2279
|
+
const firstDash = name.indexOf("-");
|
|
2280
|
+
const firstSeg = firstDash === -1 ? name : name.slice(0, firstDash);
|
|
2281
|
+
const candidates = PREFIX_FIRST_SEGMENT_MAP.get(firstSeg);
|
|
2282
|
+
if (candidates) {
|
|
2283
|
+
for (const prefix of candidates) {
|
|
2284
|
+
if (!name.startsWith(prefix)) continue;
|
|
2285
|
+
const exact = name.length === prefix.length;
|
|
2286
|
+
if (!exact && name.charCodeAt(prefix.length) !== 45) continue;
|
|
2287
|
+
const value = exact ? "" : name.slice(prefix.length + 1);
|
|
2288
|
+
const dualMode = DUAL_MODE_PREFIXES[prefix];
|
|
2289
|
+
if (dualMode) {
|
|
2290
|
+
return dualMode.resolve(value, textSizes, fontFamilies, colorNames);
|
|
2291
|
+
}
|
|
2292
|
+
const directionalColor = DIRECTIONAL_BORDER_COLOR_PROPS.get(prefix);
|
|
2293
|
+
if (directionalColor && isColorValue(value, void 0, colorNames)) {
|
|
2294
|
+
return directionalColor;
|
|
2295
|
+
}
|
|
2296
|
+
return PREFIX_PROPS[prefix];
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
return null;
|
|
2300
|
+
}
|
|
2301
|
+
function resolveProps(utility) {
|
|
2302
|
+
return resolvePropsWith(utility, _customStaticProps, _textSizes, _fontFamilies, _colorNames);
|
|
2303
|
+
}
|
|
2304
|
+
function findVariantSplit(cls) {
|
|
2305
|
+
if (cls.indexOf(":") === -1) return -1;
|
|
2306
|
+
let lastColon = -1;
|
|
2307
|
+
scanBracketAware(
|
|
2308
|
+
cls,
|
|
2309
|
+
(ch, i, depth) => {
|
|
2310
|
+
if (ch === ":" && depth === 0) {
|
|
2311
|
+
lastColon = i;
|
|
2312
|
+
return true;
|
|
2313
|
+
}
|
|
2314
|
+
},
|
|
2315
|
+
{ reverse: true }
|
|
2316
|
+
);
|
|
2317
|
+
return lastColon;
|
|
2318
|
+
}
|
|
2319
|
+
function canonicalVariantPrefix(variantPrefix) {
|
|
2320
|
+
if (variantPrefix.indexOf(":") === variantPrefix.length - 1) return variantPrefix;
|
|
2321
|
+
const segments = [];
|
|
2322
|
+
let start = 0;
|
|
2323
|
+
scanBracketAware(variantPrefix, (ch, i, depth) => {
|
|
2324
|
+
if (ch === ":" && depth === 0) {
|
|
2325
|
+
segments.push(variantPrefix.slice(start, i));
|
|
2326
|
+
start = i + 1;
|
|
2327
|
+
}
|
|
2328
|
+
});
|
|
2329
|
+
if (segments.length < 2) return variantPrefix;
|
|
2330
|
+
segments.sort();
|
|
2331
|
+
return `${segments.join(":")}:`;
|
|
2332
|
+
}
|
|
2333
|
+
function mergeUncached(classes, resolve) {
|
|
2334
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
2335
|
+
const result = [];
|
|
2336
|
+
for (let i = classes.length - 1; i >= 0; i--) {
|
|
2337
|
+
const cls = classes[i];
|
|
2338
|
+
const splitIdx = findVariantSplit(cls);
|
|
2339
|
+
const utility = splitIdx === -1 ? cls : cls.slice(splitIdx + 1);
|
|
2340
|
+
const important = utility.charCodeAt(utility.length - 1) === 33;
|
|
2341
|
+
const cleanUtility = important ? utility.slice(0, -1) : utility;
|
|
2342
|
+
const props = resolve(cleanUtility);
|
|
2343
|
+
if (!props) {
|
|
2344
|
+
result.push(cls);
|
|
2345
|
+
continue;
|
|
2346
|
+
}
|
|
2347
|
+
let ns = splitIdx === -1 ? "" : canonicalVariantPrefix(cls.slice(0, splitIdx + 1));
|
|
2348
|
+
if (important) ns = `!${ns}`;
|
|
2349
|
+
let dominated = true;
|
|
2350
|
+
for (const prop of props) {
|
|
2351
|
+
if (!claimed.has(ns + prop)) {
|
|
2352
|
+
dominated = false;
|
|
2353
|
+
break;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
if (dominated) continue;
|
|
2357
|
+
for (const prop of props) {
|
|
2358
|
+
claimed.add(ns + prop);
|
|
2359
|
+
const longhands = OVERRIDES[prop];
|
|
2360
|
+
if (longhands !== void 0) {
|
|
2361
|
+
for (const lh of longhands) {
|
|
2362
|
+
claimed.add(ns + lh);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
result.push(cls);
|
|
2367
|
+
}
|
|
2368
|
+
result.reverse();
|
|
2369
|
+
return result.join(" ");
|
|
2370
|
+
}
|
|
2371
|
+
function lruGet(cache, key) {
|
|
2372
|
+
const cached = cache.get(key);
|
|
2373
|
+
if (cached !== void 0) {
|
|
2374
|
+
cache.delete(key);
|
|
2375
|
+
cache.set(key, cached);
|
|
2376
|
+
}
|
|
2377
|
+
return cached;
|
|
2378
|
+
}
|
|
2379
|
+
function lruPut(cache, key, value) {
|
|
2380
|
+
evictLRU(cache, RI_CACHE_MAX);
|
|
2381
|
+
cache.set(key, value);
|
|
2382
|
+
}
|
|
2383
|
+
function mergeClasses(classes, resolve, cache) {
|
|
2384
|
+
const cacheKey = classes.join("\0");
|
|
2385
|
+
const useCache = cacheKey.length <= RI_CACHE_KEY_MAX_LEN;
|
|
2386
|
+
if (useCache) {
|
|
2387
|
+
const cached = lruGet(cache, cacheKey);
|
|
2388
|
+
if (cached !== void 0) return cached;
|
|
2389
|
+
}
|
|
2390
|
+
const output = mergeUncached(classes, resolve);
|
|
2391
|
+
if (useCache) lruPut(cache, cacheKey, output);
|
|
2392
|
+
return output;
|
|
2393
|
+
}
|
|
2394
|
+
function mergeFrom(inputs, resolve, cache) {
|
|
2395
|
+
let allStrings = inputs.length > 0;
|
|
2396
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
2397
|
+
const input = inputs[i];
|
|
2398
|
+
if (typeof input !== "string" || input === "") {
|
|
2399
|
+
allStrings = false;
|
|
2400
|
+
break;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
if (allStrings) {
|
|
2404
|
+
const rawKey = inputs.join("\0");
|
|
2405
|
+
if (rawKey.length <= RI_CACHE_KEY_MAX_LEN) {
|
|
2406
|
+
const cached = lruGet(cache, rawKey);
|
|
2407
|
+
if (cached !== void 0) return cached;
|
|
2408
|
+
const classes2 = flattenInputs(inputs);
|
|
2409
|
+
const output = classes2.length === 0 ? "" : classes2.length === 1 ? classes2[0] : mergeUncached(classes2, resolve);
|
|
2410
|
+
lruPut(cache, rawKey, output);
|
|
2411
|
+
return output;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
const classes = flattenInputs(inputs);
|
|
2415
|
+
if (classes.length === 0) return "";
|
|
2416
|
+
if (classes.length === 1) return classes[0];
|
|
2417
|
+
return mergeClasses(classes, resolve, cache);
|
|
2418
|
+
}
|
|
2419
|
+
var _isSSR = null;
|
|
2420
|
+
function detectSSR() {
|
|
2421
|
+
if (_isSSR !== null) return _isSSR;
|
|
2422
|
+
_isSSR = typeof window === "undefined" && typeof process !== "undefined" && !!process.versions?.node;
|
|
2423
|
+
return _isSSR;
|
|
2424
|
+
}
|
|
2425
|
+
var WARNING_THROTTLE_MS = 6e4;
|
|
2426
|
+
var _ssrWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2427
|
+
var _classLenWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2428
|
+
var _depthWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2429
|
+
var _totalClassesWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2430
|
+
var _nonStringWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2431
|
+
function ri(...inputs) {
|
|
2432
|
+
if (detectSSR()) {
|
|
2433
|
+
const now = Date.now();
|
|
2434
|
+
if (now - _ssrWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2435
|
+
_ssrWarningLastMs = now;
|
|
2436
|
+
if (_latestSnapshot === null) {
|
|
2437
|
+
console.warn(
|
|
2438
|
+
"[RI-2004] ri() called in an SSR environment before any compilation has finalized. The default ri() export reads module-level state that has not been initialized. Custom utilities, text sizes, and font families will not be recognized. Use createRi(snapshot) for concurrent-safe class merging. See: https://rainbowindex.dev/docs/ssr"
|
|
2439
|
+
);
|
|
2440
|
+
} else {
|
|
2441
|
+
console.warn(
|
|
2442
|
+
"[RI-2004] The default ri() export uses module-level state and is not safe for concurrent SSR requests. Use createRi(snapshot) for isolation. See: https://rainbowindex.dev/docs/ssr\nThis warning repeats every 60 s until resolved. In production SSR, switch to createRi(snapshot) to prevent silent data corruption between concurrent requests."
|
|
2443
|
+
);
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
return mergeFrom(inputs, resolveProps, _riCache);
|
|
2448
|
+
}
|
|
2449
|
+
function createRi(snapshot) {
|
|
2450
|
+
const snap = snapshot ?? _latestSnapshot ?? {
|
|
2451
|
+
customStaticProps: _customStaticProps,
|
|
2452
|
+
textSizes: _textSizes,
|
|
2453
|
+
fontFamilies: _fontFamilies,
|
|
2454
|
+
colorNames: _colorNames
|
|
2455
|
+
};
|
|
2456
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2457
|
+
const resolve = (utility) => resolvePropsWith(
|
|
2458
|
+
utility,
|
|
2459
|
+
snap.customStaticProps,
|
|
2460
|
+
snap.textSizes,
|
|
2461
|
+
snap.fontFamilies,
|
|
2462
|
+
snap.colorNames
|
|
2463
|
+
);
|
|
2464
|
+
return function boundRi(...inputs) {
|
|
2465
|
+
return mergeFrom(inputs, resolve, cache);
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
var MAX_FLATTEN_DEPTH = 10;
|
|
2469
|
+
var MAX_CLASS_NAME_LENGTH = 500;
|
|
2470
|
+
var MAX_TOTAL_CLASSES = 1e4;
|
|
2471
|
+
function flattenInputs(inputs) {
|
|
2472
|
+
const result = [];
|
|
2473
|
+
const stack = [[inputs, 0, 0]];
|
|
2474
|
+
while (stack.length > 0) {
|
|
2475
|
+
const top = stack[stack.length - 1];
|
|
2476
|
+
const [arr, , depth] = top;
|
|
2477
|
+
if (top[1] >= arr.length) {
|
|
2478
|
+
stack.pop();
|
|
2479
|
+
continue;
|
|
2480
|
+
}
|
|
2481
|
+
const input = arr[top[1]++];
|
|
2482
|
+
if (!input) continue;
|
|
2483
|
+
if (Array.isArray(input)) {
|
|
2484
|
+
if (depth + 1 > MAX_FLATTEN_DEPTH) {
|
|
2485
|
+
const now = Date.now();
|
|
2486
|
+
if (now - _depthWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2487
|
+
_depthWarningLastMs = now;
|
|
2488
|
+
console.warn(
|
|
2489
|
+
`[RI-2011] ri() input nesting exceeds maximum depth of ${MAX_FLATTEN_DEPTH}. Deeply nested inputs are silently dropped. Flatten your class arrays to avoid this limit.`
|
|
2490
|
+
);
|
|
2491
|
+
}
|
|
2492
|
+
continue;
|
|
2493
|
+
}
|
|
2494
|
+
stack.push([input, 0, depth + 1]);
|
|
2495
|
+
} else if (typeof input !== "string") {
|
|
2496
|
+
if (IS_DEV) {
|
|
2497
|
+
const now = Date.now();
|
|
2498
|
+
if (now - _nonStringWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2499
|
+
_nonStringWarningLastMs = now;
|
|
2500
|
+
devWarn(
|
|
2501
|
+
`ri() inputs must be strings, arrays, or falsy \u2014 got ${typeof input}; value skipped. Object syntax ({ class: condition }) is not supported; use \`condition && "class"\` instead.`
|
|
2502
|
+
);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
} else {
|
|
2506
|
+
const trimmed = input.trim();
|
|
2507
|
+
if (trimmed) {
|
|
2508
|
+
for (const cls of splitBracketAware(trimmed)) {
|
|
2509
|
+
if (result.length >= MAX_TOTAL_CLASSES) {
|
|
2510
|
+
const now = Date.now();
|
|
2511
|
+
if (now - _totalClassesWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2512
|
+
_totalClassesWarningLastMs = now;
|
|
2513
|
+
console.warn(
|
|
2514
|
+
`[RI-2012] ri() input exceeds ${MAX_TOTAL_CLASSES} class limit. Excess classes are dropped to prevent memory exhaustion.`
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
return result;
|
|
2518
|
+
}
|
|
2519
|
+
if (cls.length <= MAX_CLASS_NAME_LENGTH) {
|
|
2520
|
+
result.push(cls);
|
|
2521
|
+
} else {
|
|
2522
|
+
const now = Date.now();
|
|
2523
|
+
if (now - _classLenWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2524
|
+
_classLenWarningLastMs = now;
|
|
2525
|
+
console.warn(
|
|
2526
|
+
`[RI-2006] Class name exceeds ${MAX_CLASS_NAME_LENGTH} character limit and was dropped: "${cls.slice(0, 40)}\u2026". This is a safety guard against adversarial input in SSR. If this is intentional, shorten the class name.`
|
|
2527
|
+
);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
return result;
|
|
2535
|
+
}
|
|
2536
|
+
function splitBracketAware(input) {
|
|
2537
|
+
if (!input.includes("[") && !input.includes("(")) {
|
|
2538
|
+
const trimmed = input.trim();
|
|
2539
|
+
return trimmed === "" ? [] : trimmed.split(WS_SPLIT_RE);
|
|
2540
|
+
}
|
|
2541
|
+
const result = [];
|
|
2542
|
+
let tokenStart = -1;
|
|
2543
|
+
let depth = 0;
|
|
2544
|
+
for (let i = 0; i < input.length; i++) {
|
|
2545
|
+
const ch = input[i];
|
|
2546
|
+
if (ch === "\\" && i + 1 < input.length) {
|
|
2547
|
+
if (tokenStart === -1) tokenStart = i;
|
|
2548
|
+
i++;
|
|
2549
|
+
continue;
|
|
2550
|
+
}
|
|
2551
|
+
if (ch === "[" || ch === "(") {
|
|
2552
|
+
depth++;
|
|
2553
|
+
if (tokenStart === -1) tokenStart = i;
|
|
2554
|
+
} else if (ch === "]" || ch === ")") {
|
|
2555
|
+
if (depth > 0) depth--;
|
|
2556
|
+
if (tokenStart === -1) tokenStart = i;
|
|
2557
|
+
} else if (depth === 0 && (ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f")) {
|
|
2558
|
+
if (tokenStart !== -1) {
|
|
2559
|
+
result.push(input.slice(tokenStart, i));
|
|
2560
|
+
tokenStart = -1;
|
|
2561
|
+
}
|
|
2562
|
+
} else {
|
|
2563
|
+
if (tokenStart === -1) tokenStart = i;
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
if (tokenStart !== -1) result.push(input.slice(tokenStart));
|
|
2567
|
+
return result;
|
|
2568
|
+
}
|
|
2569
|
+
function createCompilationContext() {
|
|
2570
|
+
return {
|
|
2571
|
+
customStaticProps: {},
|
|
2572
|
+
textSizes: new Set(DEFAULT_TEXT_SIZES),
|
|
2573
|
+
fontFamilies: new Set(DEFAULT_FONT_FAMILIES),
|
|
2574
|
+
colorNames: /* @__PURE__ */ new Set()
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
function registerCustomUtility(ctx, name, properties) {
|
|
2578
|
+
if (IS_DEV) {
|
|
2579
|
+
if (!name) {
|
|
2580
|
+
devWarn("[RI-1301] registerCustomUtility() called with empty name \u2014 skipping.");
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2583
|
+
if (properties.length === 0) {
|
|
2584
|
+
devWarn(
|
|
2585
|
+
`[RI-1302] registerCustomUtility("${name}") called with no CSS properties \u2014 the utility won't participate in conflict resolution.`
|
|
2586
|
+
);
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
ctx.customStaticProps[name] = properties;
|
|
2590
|
+
}
|
|
2591
|
+
function registerCustomTextSizes(ctx, sizes) {
|
|
2592
|
+
for (const s of sizes) ctx.textSizes.add(s);
|
|
2593
|
+
}
|
|
2594
|
+
function registerCustomFontFamilies(ctx, families) {
|
|
2595
|
+
for (const f of families) ctx.fontFamilies.add(f);
|
|
2596
|
+
}
|
|
2597
|
+
function registerColorNames(ctx, names) {
|
|
2598
|
+
for (const n of names) ctx.colorNames.add(n);
|
|
2599
|
+
}
|
|
2600
|
+
function snapshotCompilationContext(ctx) {
|
|
2601
|
+
return {
|
|
2602
|
+
customStaticProps: Object.fromEntries(
|
|
2603
|
+
Object.entries(ctx.customStaticProps).map(([k, v]) => [k, [...v]])
|
|
2604
|
+
),
|
|
2605
|
+
textSizes: new Set(ctx.textSizes),
|
|
2606
|
+
fontFamilies: new Set(ctx.fontFamilies),
|
|
2607
|
+
colorNames: new Set(ctx.colorNames)
|
|
2608
|
+
};
|
|
2609
|
+
}
|
|
2610
|
+
function finalizeCompilationContext(ctx) {
|
|
2611
|
+
const snapshot = snapshotCompilationContext(ctx);
|
|
2612
|
+
_customStaticProps = snapshot.customStaticProps;
|
|
2613
|
+
_textSizes = snapshot.textSizes;
|
|
2614
|
+
_fontFamilies = snapshot.fontFamilies;
|
|
2615
|
+
_colorNames = snapshot.colorNames;
|
|
2616
|
+
_riCache.clear();
|
|
2617
|
+
_latestSnapshot = snapshot;
|
|
2618
|
+
return snapshot;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
export {
|
|
2622
|
+
isValidColorSuffix,
|
|
2623
|
+
DEFAULT_COLORS,
|
|
2624
|
+
DEFAULT_DARK_CONFIG,
|
|
2625
|
+
checkPaletteContrast,
|
|
2626
|
+
generateAllColorVariables,
|
|
2627
|
+
generateThemeOverrides,
|
|
2628
|
+
DEFAULT_TEXT,
|
|
2629
|
+
DEFAULT_BREAKPOINTS,
|
|
2630
|
+
DEFAULT_ROUNDED_ROOF,
|
|
2631
|
+
DEFAULT_ROUNDED,
|
|
2632
|
+
CORNER_SHAPE_KEYWORDS,
|
|
2633
|
+
DEFAULT_CORNER_SCALE,
|
|
2634
|
+
DEFAULT_SUPERELLIPSE_SCALE,
|
|
2635
|
+
DEFAULT_SHADOWS,
|
|
2636
|
+
DEFAULT_WEIGHTS,
|
|
2637
|
+
DEFAULT_EASING,
|
|
2638
|
+
DEFAULT_BLUR,
|
|
2639
|
+
DEFAULT_ANIMATIONS,
|
|
2640
|
+
DEFAULT_FLUID,
|
|
2641
|
+
DEFAULT_TRACKING,
|
|
2642
|
+
DEFAULT_LEADING,
|
|
2643
|
+
defaultTheme,
|
|
2644
|
+
COLOR_FUNCTION_ALTERNATION,
|
|
2645
|
+
SPECIAL_COLORS,
|
|
2646
|
+
isMaskRadialSizeValue,
|
|
2647
|
+
RE_IMAGE_VALUE,
|
|
2648
|
+
isFontFamilyValue,
|
|
2649
|
+
BUILTIN_STATIC_KEYS,
|
|
2650
|
+
PREFIX_PROP_KEYS,
|
|
2651
|
+
buildFirstSegmentMap,
|
|
2652
|
+
IS_DEV,
|
|
2653
|
+
devWarn,
|
|
2654
|
+
DEFAULT_TEXT_SIZES,
|
|
2655
|
+
ri,
|
|
2656
|
+
createRi,
|
|
2657
|
+
createCompilationContext,
|
|
2658
|
+
registerCustomUtility,
|
|
2659
|
+
registerCustomTextSizes,
|
|
2660
|
+
registerCustomFontFamilies,
|
|
2661
|
+
registerColorNames,
|
|
2662
|
+
snapshotCompilationContext,
|
|
2663
|
+
finalizeCompilationContext
|
|
2664
|
+
};
|