@barocss/kit 0.0.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -34,16 +34,221 @@ function property(name, initialValue, syntax, source) {
34
34
  }
35
35
  return atRule("property", name, nodes, source);
36
36
  }
37
+ let debugEnabled = false;
38
+ function setDebug(enabled) {
39
+ debugEnabled = enabled;
40
+ }
41
+ function isDebug() {
42
+ return debugEnabled;
43
+ }
44
+ function debugLog(...args) {
45
+ if (debugEnabled) console.log(...args);
46
+ }
47
+ function debugWarn(...args) {
48
+ if (debugEnabled) console.warn(...args);
49
+ }
50
+ class AstCache {
51
+ constructor() {
52
+ this.cache = /* @__PURE__ */ new Map();
53
+ this.maxSize = 1e3;
54
+ }
55
+ // Prevent memory leaks
56
+ set(key, ast) {
57
+ if (this.cache.size >= this.maxSize) {
58
+ const firstKey = this.cache.keys().next().value;
59
+ if (firstKey) {
60
+ this.cache.delete(firstKey);
61
+ }
62
+ }
63
+ this.cache.set(key, ast);
64
+ }
65
+ get(key) {
66
+ return this.cache.get(key);
67
+ }
68
+ has(key) {
69
+ return this.cache.has(key);
70
+ }
71
+ clear() {
72
+ this.cache.clear();
73
+ }
74
+ getStats() {
75
+ return {
76
+ size: this.cache.size,
77
+ maxSize: this.maxSize,
78
+ hitRate: this.cache.size / this.maxSize
79
+ };
80
+ }
81
+ }
82
+ const astCache = new AstCache();
83
+ class ParseResultCache {
84
+ constructor() {
85
+ this.cache = /* @__PURE__ */ new Map();
86
+ this.maxSize = 2e3;
87
+ }
88
+ // Prevent memory leaks
89
+ set(key, result) {
90
+ if (this.cache.size >= this.maxSize) {
91
+ const firstKey = this.cache.keys().next().value;
92
+ if (firstKey) {
93
+ this.cache.delete(firstKey);
94
+ }
95
+ }
96
+ this.cache.set(key, result);
97
+ }
98
+ get(key) {
99
+ return this.cache.get(key);
100
+ }
101
+ has(key) {
102
+ return this.cache.has(key);
103
+ }
104
+ clear() {
105
+ this.cache.clear();
106
+ }
107
+ getStats() {
108
+ return {
109
+ size: this.cache.size,
110
+ maxSize: this.maxSize,
111
+ hitRate: this.cache.size / this.maxSize
112
+ };
113
+ }
114
+ }
115
+ const parseResultCache = new ParseResultCache();
116
+ class UtilityCache {
117
+ constructor() {
118
+ this.cache = /* @__PURE__ */ new Map();
119
+ this.maxSize = 1e3;
120
+ }
121
+ // Prevent memory leaks
122
+ set(key, value) {
123
+ if (this.cache.size >= this.maxSize) {
124
+ const firstKey = this.cache.keys().next().value;
125
+ if (firstKey) {
126
+ this.cache.delete(firstKey);
127
+ }
128
+ }
129
+ this.cache.set(key, value);
130
+ }
131
+ get(key) {
132
+ return this.cache.get(key);
133
+ }
134
+ has(key) {
135
+ return this.cache.has(key);
136
+ }
137
+ clear() {
138
+ this.cache.clear();
139
+ }
140
+ getStats() {
141
+ return {
142
+ size: this.cache.size,
143
+ maxSize: this.maxSize,
144
+ hitRate: this.cache.size / this.maxSize
145
+ };
146
+ }
147
+ }
148
+ const utilityCache = new UtilityCache();
149
+ let resetContextCaches;
150
+ function setContextCacheReset(reset) {
151
+ resetContextCaches = reset;
152
+ }
153
+ function clearAllCaches() {
154
+ astCache.clear();
155
+ parseResultCache.clear();
156
+ utilityCache.clear();
157
+ resetContextCaches?.();
158
+ debugLog("[clearAllCaches] All caches cleared");
159
+ }
160
+ class WeakCache {
161
+ constructor() {
162
+ this.cache = /* @__PURE__ */ new WeakMap();
163
+ this.keyMap = /* @__PURE__ */ new Map();
164
+ this.maxSize = 1e3;
165
+ }
166
+ set(key, value) {
167
+ if (this.keyMap.size >= this.maxSize) {
168
+ const firstKey = this.keyMap.keys().next().value;
169
+ if (firstKey) {
170
+ const obj2 = this.keyMap.get(firstKey);
171
+ if (obj2) {
172
+ this.cache.delete(obj2);
173
+ }
174
+ this.keyMap.delete(firstKey);
175
+ }
176
+ }
177
+ const obj = { key };
178
+ this.cache.set(obj, value);
179
+ this.keyMap.set(key, obj);
180
+ }
181
+ get(key) {
182
+ const obj = this.keyMap.get(key);
183
+ if (obj) {
184
+ return this.cache.get(obj);
185
+ }
186
+ return void 0;
187
+ }
188
+ has(key) {
189
+ return this.keyMap.has(key);
190
+ }
191
+ clear() {
192
+ this.keyMap.clear();
193
+ }
194
+ getStats() {
195
+ return {
196
+ size: this.keyMap.size,
197
+ maxSize: this.maxSize,
198
+ hitRate: this.keyMap.size / this.maxSize
199
+ };
200
+ }
201
+ }
202
+ const states = /* @__PURE__ */ new WeakMap();
203
+ let cacheGeneration = 0;
204
+ setContextCacheReset(() => {
205
+ cacheGeneration += 1;
206
+ });
207
+ function initializeContextState(ctx, utilities, modifiers) {
208
+ states.set(ctx, {
209
+ utilities: [...utilities],
210
+ modifiers: [...modifiers],
211
+ astCache: new AstCache(),
212
+ parseResultCache: new ParseResultCache(),
213
+ utilityCache: new UtilityCache(),
214
+ failures: /* @__PURE__ */ new Set(),
215
+ cacheGeneration
216
+ });
217
+ }
218
+ function getContextState(ctx) {
219
+ const state = states.get(ctx);
220
+ if (state && state.cacheGeneration !== cacheGeneration) {
221
+ clearContextCaches(ctx);
222
+ state.cacheGeneration = cacheGeneration;
223
+ }
224
+ return state;
225
+ }
226
+ function clearContextCaches(ctx) {
227
+ const state = states.get(ctx);
228
+ if (!state) return;
229
+ state.astCache.clear();
230
+ state.parseResultCache.clear();
231
+ state.utilityCache.clear();
232
+ state.failures.clear();
233
+ }
37
234
  const utilityRegistry = [];
38
- function registerUtility(util) {
39
- utilityRegistry.push(util);
235
+ function registerUtility(util, ctx) {
236
+ const state = ctx && getContextState(ctx);
237
+ if (ctx && !state) throw new Error("Utility registration requires a context from createContext");
238
+ (state?.utilities || utilityRegistry).push(util);
239
+ if (ctx) {
240
+ clearContextCaches(ctx);
241
+ } else {
242
+ parseResultCache.clear();
243
+ utilityCache.clear();
244
+ }
40
245
  }
41
- function getUtility() {
42
- return utilityRegistry;
246
+ function getUtility(ctx) {
247
+ return ctx && getContextState(ctx)?.utilities || utilityRegistry;
43
248
  }
44
249
  const modifierRegistry = [];
45
- function staticModifier(name, selectors, options = {}) {
46
- modifierRegistry.push({
250
+ function staticModifier(name, selectors, options = {}, ctx) {
251
+ registerModifier({
47
252
  match: (mod) => mod === name,
48
253
  modifySelector: ({ ..._rest }) => {
49
254
  return selectors.map((sel) => ({
@@ -52,13 +257,19 @@ function staticModifier(name, selectors, options = {}) {
52
257
  }));
53
258
  },
54
259
  ...options
55
- });
260
+ }, ctx);
56
261
  }
57
- function functionalModifier(match, modifySelector, wrap, options = {}) {
58
- modifierRegistry.push({ match, modifySelector, wrap, ...options });
262
+ function functionalModifier(match, modifySelector, wrap, options = {}, ctx) {
263
+ registerModifier({ match, modifySelector, wrap, ...options }, ctx);
59
264
  }
60
- function getModifier() {
61
- return modifierRegistry;
265
+ function registerModifier(modifier, ctx) {
266
+ const state = ctx && getContextState(ctx);
267
+ if (ctx && !state) throw new Error("Modifier registration requires a context from createContext");
268
+ (state?.modifiers || modifierRegistry).push(modifier);
269
+ if (ctx) clearContextCaches(ctx);
270
+ }
271
+ function getModifier(ctx) {
272
+ return ctx && getContextState(ctx)?.modifiers || modifierRegistry;
62
273
  }
63
274
  const ESCAPE_REGEX = /[^A-Za-z0-9_-]/g;
64
275
  function escapeClassName(className) {
@@ -97,7 +308,7 @@ function escapeClassName(className) {
97
308
  return "\\" + c;
98
309
  });
99
310
  }
100
- function staticUtility(name, decls, opts) {
311
+ function staticUtility(name, decls, opts, ctx) {
101
312
  registerUtility({
102
313
  name,
103
314
  match: (className) => {
@@ -124,13 +335,13 @@ function staticUtility(name, decls, opts) {
124
335
  description: opts?.description,
125
336
  category: opts?.category,
126
337
  priority: opts?.priority
127
- });
338
+ }, ctx);
128
339
  }
129
- function functionalUtility(opts) {
340
+ function functionalUtility(opts, ctx) {
130
341
  registerUtility({
131
342
  name: opts.name,
132
343
  match: (className) => className.startsWith(opts.name + "-"),
133
- handler: (value, ctx, token, _options) => {
344
+ handler: (value, ctx2, token, _options) => {
134
345
  let finalValue = value;
135
346
  const parsedUtility = token;
136
347
  const extra = {
@@ -144,9 +355,9 @@ function functionalUtility(opts) {
144
355
  }
145
356
  }
146
357
  if (opts.supportsArbitrary && parsedUtility.arbitrary) {
147
- const processedValue = finalValue.replace(/_/g, " ");
358
+ const processedValue = normalizeMathSpacing(expandThemeFunctions(finalValue.replace(/_/g, " ")));
148
359
  if (opts.handle) {
149
- const result = opts.handle(processedValue, ctx, token, extra);
360
+ const result = opts.handle(processedValue, ctx2, token, extra);
150
361
  if (result) return result;
151
362
  }
152
363
  if (opts.prop) {
@@ -156,12 +367,12 @@ function functionalUtility(opts) {
156
367
  }
157
368
  if (opts.supportsCustomProperty && parsedUtility.customProperty) {
158
369
  if (opts.handleCustomProperty) {
159
- const result = opts.handleCustomProperty(finalValue, ctx, token, extra);
370
+ const result = opts.handleCustomProperty(finalValue, ctx2, token, extra);
160
371
  return result;
161
372
  }
162
373
  const customValue = `var(${finalValue})`;
163
374
  if (opts.handle) {
164
- const result = opts.handle(customValue, ctx, token, extra);
375
+ const result = opts.handle(customValue, ctx2, token, extra);
165
376
  if (result) return result;
166
377
  }
167
378
  if (opts.prop) {
@@ -170,12 +381,12 @@ function functionalUtility(opts) {
170
381
  return [];
171
382
  }
172
383
  let themeValue;
173
- if (opts.themeKey && ctx.theme) {
174
- themeValue = ctx.theme(opts.themeKey, finalValue);
384
+ if (opts.themeKey && ctx2.theme) {
385
+ themeValue = ctx2.theme(opts.themeKey, finalValue);
175
386
  }
176
- if (!themeValue && opts.themeKeys && ctx.theme) {
387
+ if (!themeValue && opts.themeKeys && ctx2.theme) {
177
388
  for (const key of opts.themeKeys) {
178
- themeValue = ctx.theme(key, finalValue);
389
+ themeValue = ctx2.theme(key, finalValue);
179
390
  if (themeValue !== void 0) break;
180
391
  }
181
392
  }
@@ -186,7 +397,7 @@ function functionalUtility(opts) {
186
397
  return [decl(opts.prop, finalValue)];
187
398
  }
188
399
  if (opts.handle) {
189
- const result = opts.handle(finalValue, ctx, token, extra);
400
+ const result = opts.handle(finalValue, ctx2, token, extra);
190
401
  if (result) return result;
191
402
  }
192
403
  return [];
@@ -195,16 +406,18 @@ function functionalUtility(opts) {
195
406
  finalValue = value;
196
407
  }
197
408
  if (parsedUtility.negative && opts.supportsNegative && opts.handleNegativeBareValue) {
198
- const bare = opts.handleNegativeBareValue({ value: String(finalValue).replace(/^-/, ""), ctx, token, extra });
409
+ const bare = opts.handleNegativeBareValue({ value: String(finalValue).replace(/^-/, ""), ctx: ctx2, token, extra });
199
410
  if (bare == null) return [];
200
411
  finalValue = bare;
201
412
  } else if (opts.handleBareValue) {
202
- const bare = opts.handleBareValue({ value: finalValue, ctx, token, extra });
413
+ const bare = opts.handleBareValue({ value: finalValue, ctx: ctx2, token, extra });
203
414
  if (bare == null) return [];
204
415
  finalValue = bare;
416
+ } else if (!/^-?(\d|\.\d)/.test(String(finalValue))) {
417
+ return [];
205
418
  }
206
419
  if (opts.handle) {
207
- const result = opts.handle(finalValue, ctx, token, extra);
420
+ const result = opts.handle(finalValue, ctx2, token, extra);
208
421
  if (result) return result;
209
422
  }
210
423
  if (opts.prop) {
@@ -215,7 +428,63 @@ function functionalUtility(opts) {
215
428
  description: opts.description,
216
429
  category: opts.category,
217
430
  priority: opts.priority
218
- });
431
+ }, ctx);
432
+ }
433
+ const MATH_FNS = /* @__PURE__ */ new Set(["calc", "min", "max", "clamp"]);
434
+ function expandThemeFunctions(value) {
435
+ return value.replace(/--spacing\(\s*([^()]+?)\s*\)/g, "calc(var(--spacing) * $1)");
436
+ }
437
+ const arbitraryPropertyRegistration = {
438
+ name: "[arbitrary-property]",
439
+ match: () => false,
440
+ handler: (value, _ctx, token) => {
441
+ const prop = token.property;
442
+ if (!prop || !value) return [];
443
+ return [decl(prop, normalizeMathSpacing(expandThemeFunctions(value.replace(/_/g, " "))))];
444
+ }
445
+ };
446
+ function normalizeMathSpacing(value) {
447
+ if (!/(calc|min|max|clamp)\(/.test(value)) return value;
448
+ const stack = [];
449
+ let out = "";
450
+ for (let i = 0; i < value.length; i++) {
451
+ const ch = value[i];
452
+ if (ch === "(") {
453
+ const name = (/([a-z-]*)$/i.exec(out)?.[1] ?? "").toLowerCase();
454
+ const inMath2 = stack.length > 0 && stack[stack.length - 1];
455
+ stack.push(MATH_FNS.has(name) || name === "" && inMath2);
456
+ out += ch;
457
+ continue;
458
+ }
459
+ if (ch === ")") {
460
+ stack.pop();
461
+ out += ch;
462
+ continue;
463
+ }
464
+ const inMath = stack.length > 0 && stack[stack.length - 1];
465
+ if (!inMath) {
466
+ out += ch;
467
+ continue;
468
+ }
469
+ if (ch === ",") {
470
+ out = out.trimEnd() + ", ";
471
+ while (value[i + 1] === " ") i++;
472
+ continue;
473
+ }
474
+ if ("+-*/".includes(ch)) {
475
+ const prev = out.trimEnd();
476
+ const p = prev[prev.length - 1] ?? "";
477
+ const binary = /[\w%)]/.test(p);
478
+ const exponent = (ch === "+" || ch === "-") && /\de$/i.test(prev) && prev.length === out.length && /\d/.test(value[i + 1] ?? "");
479
+ if (binary && !exponent) {
480
+ out = prev + " " + ch + " ";
481
+ while (value[i + 1] === " ") i++;
482
+ continue;
483
+ }
484
+ }
485
+ out += ch;
486
+ }
487
+ return out;
219
488
  }
220
489
  function tokenize(className) {
221
490
  const tokens = [];
@@ -236,175 +505,29 @@ function tokenize(className) {
236
505
  start,
237
506
  end: i
238
507
  });
239
- }
240
- current = "";
241
- start = i + 1;
242
- } else {
243
- current += char;
244
- }
245
- }
246
- if (current) {
247
- tokens.push({
248
- value: current,
249
- start,
250
- end: className.length
251
- });
252
- }
253
- return tokens;
254
- }
255
- class AstCache {
256
- constructor() {
257
- this.cache = /* @__PURE__ */ new Map();
258
- this.maxSize = 1e3;
259
- }
260
- // Prevent memory leaks
261
- set(key, ast) {
262
- if (this.cache.size >= this.maxSize) {
263
- const firstKey = this.cache.keys().next().value;
264
- if (firstKey) {
265
- this.cache.delete(firstKey);
266
- }
267
- }
268
- this.cache.set(key, ast);
269
- }
270
- get(key) {
271
- return this.cache.get(key);
272
- }
273
- has(key) {
274
- return this.cache.has(key);
275
- }
276
- clear() {
277
- this.cache.clear();
278
- }
279
- getStats() {
280
- return {
281
- size: this.cache.size,
282
- maxSize: this.maxSize,
283
- hitRate: this.cache.size / this.maxSize
284
- };
285
- }
286
- }
287
- const astCache = new AstCache();
288
- class ParseResultCache {
289
- constructor() {
290
- this.cache = /* @__PURE__ */ new Map();
291
- this.maxSize = 2e3;
292
- }
293
- // Prevent memory leaks
294
- set(key, result) {
295
- if (this.cache.size >= this.maxSize) {
296
- const firstKey = this.cache.keys().next().value;
297
- if (firstKey) {
298
- this.cache.delete(firstKey);
299
- }
300
- }
301
- this.cache.set(key, result);
302
- }
303
- get(key) {
304
- return this.cache.get(key);
305
- }
306
- has(key) {
307
- return this.cache.has(key);
308
- }
309
- clear() {
310
- this.cache.clear();
311
- }
312
- getStats() {
313
- return {
314
- size: this.cache.size,
315
- maxSize: this.maxSize,
316
- hitRate: this.cache.size / this.maxSize
317
- };
318
- }
319
- }
320
- const parseResultCache = new ParseResultCache();
321
- class UtilityCache {
322
- constructor() {
323
- this.cache = /* @__PURE__ */ new Map();
324
- this.maxSize = 1e3;
325
- }
326
- // Prevent memory leaks
327
- set(key, value) {
328
- if (this.cache.size >= this.maxSize) {
329
- const firstKey = this.cache.keys().next().value;
330
- if (firstKey) {
331
- this.cache.delete(firstKey);
332
- }
333
- }
334
- this.cache.set(key, value);
335
- }
336
- get(key) {
337
- return this.cache.get(key);
338
- }
339
- has(key) {
340
- return this.cache.has(key);
341
- }
342
- clear() {
343
- this.cache.clear();
344
- }
345
- getStats() {
346
- return {
347
- size: this.cache.size,
348
- maxSize: this.maxSize,
349
- hitRate: this.cache.size / this.maxSize
350
- };
351
- }
352
- }
353
- const utilityCache = new UtilityCache();
354
- function clearAllCaches() {
355
- astCache.clear();
356
- parseResultCache.clear();
357
- utilityCache.clear();
358
- console.log("[clearAllCaches] All caches cleared");
359
- }
360
- class WeakCache {
361
- constructor() {
362
- this.cache = /* @__PURE__ */ new WeakMap();
363
- this.keyMap = /* @__PURE__ */ new Map();
364
- this.maxSize = 1e3;
365
- }
366
- set(key, value) {
367
- if (this.keyMap.size >= this.maxSize) {
368
- const firstKey = this.keyMap.keys().next().value;
369
- if (firstKey) {
370
- const obj2 = this.keyMap.get(firstKey);
371
- if (obj2) {
372
- this.cache.delete(obj2);
373
- }
374
- this.keyMap.delete(firstKey);
375
- }
376
- }
377
- const obj = { key };
378
- this.cache.set(obj, value);
379
- this.keyMap.set(key, obj);
380
- }
381
- get(key) {
382
- const obj = this.keyMap.get(key);
383
- if (obj) {
384
- return this.cache.get(obj);
385
- }
386
- return void 0;
387
- }
388
- has(key) {
389
- return this.keyMap.has(key);
390
- }
391
- clear() {
392
- this.keyMap.clear();
508
+ }
509
+ current = "";
510
+ start = i + 1;
511
+ } else {
512
+ current += char;
513
+ }
393
514
  }
394
- getStats() {
395
- return {
396
- size: this.keyMap.size,
397
- maxSize: this.maxSize,
398
- hitRate: this.keyMap.size / this.maxSize
399
- };
515
+ if (current) {
516
+ tokens.push({
517
+ value: current,
518
+ start,
519
+ end: className.length
520
+ });
400
521
  }
522
+ return tokens;
401
523
  }
402
- function isUtilityPrefix(str) {
403
- if (utilityCache.has(str)) {
404
- return utilityCache.get(str);
524
+ function isUtilityPrefix(str, ctx) {
525
+ const cache = ctx && getContextState(ctx)?.utilityCache || utilityCache;
526
+ if (cache.has(str)) {
527
+ return cache.get(str);
405
528
  }
406
- const utilities = getUtility();
407
- const modifiers = getModifier();
529
+ const utilities = getUtility(ctx);
530
+ const modifiers = getModifier(ctx);
408
531
  const candidateUtilities = utilities.filter((util) => {
409
532
  const prefix = util.name;
410
533
  return str.startsWith(prefix + "-") || str === prefix || str.startsWith(prefix);
@@ -416,52 +539,66 @@ function isUtilityPrefix(str) {
416
539
  });
417
540
  const isModifier = candidateModifiers.some((mod) => mod.match(str, {}));
418
541
  const result = isUtility && !isModifier;
419
- utilityCache.set(str, result);
542
+ cache.set(str, result);
420
543
  return result;
421
544
  }
422
- function parseClassName(className) {
423
- if (parseResultCache.has(className)) {
424
- return parseResultCache.get(className);
545
+ function parseClassName(className, ctx) {
546
+ const cache = ctx && getContextState(ctx)?.parseResultCache || parseResultCache;
547
+ if (cache.has(className)) {
548
+ return cache.get(className);
425
549
  }
426
550
  let important = false;
427
551
  let realClassName = className;
428
552
  if (className.startsWith("!")) {
429
553
  important = true;
430
554
  realClassName = className.slice(1);
555
+ } else if (className.length > 1 && className.endsWith("!")) {
556
+ important = true;
557
+ realClassName = className.slice(0, -1);
431
558
  }
432
559
  const tokens = tokenize(realClassName);
433
- const result = parseTokens(tokens);
560
+ const result = parseTokens(tokens, ctx);
434
561
  if (result.utility) {
435
562
  result.utility.important = important;
436
563
  }
437
- parseResultCache.set(className, result);
564
+ cache.set(className, result);
438
565
  return result;
439
566
  }
440
- function parseTokens(tokens) {
567
+ function parseTokens(tokens, ctx) {
441
568
  const modifiers = [];
442
569
  let utility = null;
443
570
  if (tokens.length === 0) {
444
571
  return { modifiers, utility: null };
445
572
  }
573
+ if (tokens.length > 1) {
574
+ const utilityIndex = isUtilityPrefix(tokens[0].value, ctx) ? 0 : tokens.length - 1;
575
+ if (tokens.some((t, i) => i !== utilityIndex && !isSafeVariantToken(t.value))) {
576
+ return { modifiers, utility: null };
577
+ }
578
+ }
579
+ const utilityToken = tokens.length > 1 && !isUtilityPrefix(tokens[0].value, ctx) ? tokens[tokens.length - 1] : tokens[0];
580
+ if (!isStructureSafeValue(utilityToken.value)) {
581
+ return { modifiers, utility: null };
582
+ }
446
583
  if (tokens.length === 1) {
447
- utility = parseUtility(tokens[0].value);
584
+ utility = parseUtility(tokens[0].value, ctx);
448
585
  } else if (tokens.length === 2) {
449
586
  const firstToken = tokens[0];
450
587
  const secondToken = tokens[1];
451
- const isFirstUtility = isUtilityPrefix(firstToken.value);
588
+ const isFirstUtility = isUtilityPrefix(firstToken.value, ctx);
452
589
  if (isFirstUtility) {
453
- utility = parseUtility(firstToken.value);
590
+ utility = parseUtility(firstToken.value, ctx);
454
591
  const parsed = parseModifier(secondToken.value);
455
592
  if (parsed) modifiers.push(parsed);
456
593
  } else {
457
594
  const parsed = parseModifier(firstToken.value);
458
595
  if (parsed) modifiers.push(parsed);
459
- utility = parseUtility(secondToken.value);
596
+ utility = parseUtility(secondToken.value, ctx);
460
597
  }
461
598
  } else {
462
- const isFirstUtility = isUtilityPrefix(tokens[0].value);
599
+ const isFirstUtility = isUtilityPrefix(tokens[0].value, ctx);
463
600
  if (isFirstUtility) {
464
- utility = parseUtility(tokens[0].value);
601
+ utility = parseUtility(tokens[0].value, ctx);
465
602
  for (let i = 1; i < tokens.length; i++) {
466
603
  const parsed = parseModifier(tokens[i].value);
467
604
  if (parsed) modifiers.push(parsed);
@@ -471,11 +608,84 @@ function parseTokens(tokens) {
471
608
  const parsed = parseModifier(tokens[i].value);
472
609
  if (parsed) modifiers.push(parsed);
473
610
  }
474
- utility = parseUtility(tokens[tokens.length - 1].value);
611
+ utility = parseUtility(tokens[tokens.length - 1].value, ctx);
475
612
  }
476
613
  }
477
614
  return { modifiers, utility };
478
615
  }
616
+ const FUNCTIONAL_VALUE_VARIANT = /^-?(?:(?:group|peer)-)?(?:has|not)-\[(.*)\](?:\/[\w-]+)?$/;
617
+ function isSafeVariantToken(value) {
618
+ if (hasCommentToken(value)) return false;
619
+ const m = FUNCTIONAL_VALUE_VARIANT.exec(value);
620
+ if (m) return isSafeVariantValue(m[1], true);
621
+ return isSafeVariantValue(value);
622
+ }
623
+ function hasCommentToken(value) {
624
+ return value.includes("/*") || value.includes("*/");
625
+ }
626
+ function isStructureSafeValue(value) {
627
+ if (hasCommentToken(value)) return false;
628
+ return isSafeVariantValue(value, true);
629
+ }
630
+ function hasUnquotedAt(value) {
631
+ let quote = "";
632
+ for (let i = 0; i < value.length; i++) {
633
+ const c = value[i];
634
+ if (c === "\\") {
635
+ i++;
636
+ continue;
637
+ }
638
+ if (quote) {
639
+ if (c === quote) quote = "";
640
+ continue;
641
+ }
642
+ if (c === '"' || c === "'") quote = c;
643
+ else if (c === "@") return true;
644
+ }
645
+ return false;
646
+ }
647
+ function isSafeVariantValue(value, allowTopLevelComma = false) {
648
+ const stack = [];
649
+ let quote = "";
650
+ let parenDepth = 0;
651
+ for (let i = 0; i < value.length; i++) {
652
+ const c = value[i];
653
+ if (c === "\\") {
654
+ i++;
655
+ continue;
656
+ }
657
+ if (quote) {
658
+ if (c === quote) quote = "";
659
+ continue;
660
+ }
661
+ switch (c) {
662
+ case '"':
663
+ case "'":
664
+ quote = c;
665
+ break;
666
+ case "(":
667
+ stack.push(")");
668
+ parenDepth++;
669
+ break;
670
+ case "[":
671
+ stack.push("]");
672
+ break;
673
+ case ")":
674
+ case "]":
675
+ if (stack.pop() !== c) return false;
676
+ if (c === ")") parenDepth--;
677
+ break;
678
+ case "{":
679
+ case "}":
680
+ case ";":
681
+ return false;
682
+ case ",":
683
+ if (parenDepth === 0 && !allowTopLevelComma) return false;
684
+ break;
685
+ }
686
+ }
687
+ return stack.length === 0 && !quote;
688
+ }
479
689
  function parseModifier(value) {
480
690
  let negative = false;
481
691
  let modStr = value;
@@ -491,7 +701,7 @@ function parseModifier(value) {
491
701
  function nameSort(a, b) {
492
702
  return b.name.length - a.name.length;
493
703
  }
494
- function parseUtility(value) {
704
+ function parseUtility(value, ctx) {
495
705
  let prefix = "";
496
706
  let utilityValue = "";
497
707
  let arbitrary = false;
@@ -500,6 +710,11 @@ function parseUtility(value) {
500
710
  let opacity = "";
501
711
  let category = "";
502
712
  let priority = 0;
713
+ const prop = /^\[(--[a-zA-Z_][a-zA-Z0-9_-]*|-?[a-z][a-z-]*):(.+)\]$/.exec(value);
714
+ if (prop) {
715
+ if (!isStructureSafeValue(prop[2]) || hasUnquotedAt(prop[2])) return { prefix: "", value: "" };
716
+ return { prefix: "", value: prop[2], arbitrary: true, property: prop[1] };
717
+ }
503
718
  if (value.startsWith("-")) {
504
719
  negative = true;
505
720
  }
@@ -518,8 +733,7 @@ function parseUtility(value) {
518
733
  utilityValue = utilityValue.replace(/\)$/, "");
519
734
  customProperty = true;
520
735
  } else {
521
- const utilities = getUtility();
522
- const sortedUtilities = utilities.sort(nameSort);
736
+ const sortedUtilities = [...getUtility(ctx)].sort(nameSort);
523
737
  let matchedUtility = sortedUtilities.find((p) => value === p.name);
524
738
  if (matchedUtility) {
525
739
  prefix = matchedUtility.name;
@@ -556,6 +770,7 @@ function parseUtility(value) {
556
770
  priority
557
771
  };
558
772
  }
773
+ const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? ""));
559
774
  const importantPrefix = "!important";
560
775
  function astToCss(ast, baseSelector, opts, _indent = "") {
561
776
  const minify = opts?.minify;
@@ -564,7 +779,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
564
779
  const important = opts?.important ?? false;
565
780
  const importantString = important ? ` ${importantPrefix}` : "";
566
781
  if (!ast || ast.length === 0) {
567
- console.warn("[astToCss] Empty AST received:", { ast, baseSelector, minify });
782
+ debugWarn("[astToCss] Empty AST received:", { ast, baseSelector, minify });
568
783
  return "";
569
784
  }
570
785
  const dedupedAst = [];
@@ -586,6 +801,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
586
801
  switch (node.type) {
587
802
  case "decl": {
588
803
  const value = node.value;
804
+ if (!isSafeDecl(node.prop, value)) return "";
589
805
  if (node.prop.startsWith("--")) {
590
806
  if (minify) {
591
807
  const css = `${node.prop}: ${value}${importantString};`;
@@ -693,13 +909,13 @@ ${astToCss(
693
909
  case "raw":
694
910
  return `${indent}${node.value}`;
695
911
  default:
696
- console.warn("[astToCss] Unknown node type:", node);
912
+ debugWarn("[astToCss] Unknown node type:", node);
697
913
  return "";
698
914
  }
699
915
  }).filter(Boolean).join(minify ? "" : "\n");
700
916
  const finalResult = result + (minify ? "" : "\n");
701
917
  if (!finalResult || finalResult.trim() === "") {
702
- console.warn("[astToCss] Empty result generated:", {
918
+ debugWarn("[astToCss] Empty result generated:", {
703
919
  ast,
704
920
  baseSelector,
705
921
  minify,
@@ -710,27 +926,266 @@ ${astToCss(
710
926
  }
711
927
  return finalResult;
712
928
  }
713
- function rootToCss(nodes) {
714
- const result = nodes.map((node) => {
715
- const list = [];
716
- if (node.type === "decl") {
717
- list.push(`${node.prop}: ${node.value};`);
718
- } else if (node.type === "at-rule") {
719
- list.push(
720
- `@${node.name} ${node.params} {
721
- ${node.nodes.map((node2) => {
722
- if (node2.type === "decl") {
723
- return ` ${node2.prop}: ${node2.value};`;
724
- }
725
- }).join("\n")}
726
- }`
727
- );
728
- }
729
- return list.join("\n");
730
- }).join("\n");
731
- return result;
929
+ function rootToCss(nodes, opts) {
930
+ const minify = opts?.minify === true;
931
+ const result = nodes.map((node) => {
932
+ const list = [];
933
+ if (node.type === "decl") {
934
+ if (isSafeDecl(node.prop, node.value)) {
935
+ list.push(minify ? `${node.prop}:${node.value};` : `${node.prop}: ${node.value};`);
936
+ }
937
+ } else if (node.type === "at-rule") {
938
+ if (minify) {
939
+ const body = node.nodes.filter((child) => child.type === "decl" && isSafeDecl(child.prop, child.value)).map((child) => child.type === "decl" ? `${child.prop}:${child.value};` : "").join("");
940
+ list.push(`@${node.name} ${node.params}{${body}}`);
941
+ } else {
942
+ list.push(
943
+ `@${node.name} ${node.params} {
944
+ ${node.nodes.map((node2) => {
945
+ if (node2.type === "decl" && isSafeDecl(node2.prop, node2.value)) {
946
+ return ` ${node2.prop}: ${node2.value};`;
947
+ }
948
+ }).join("\n")}
949
+ }`
950
+ );
951
+ }
952
+ }
953
+ return list.join(minify ? "" : "\n");
954
+ }).join(minify ? "" : "\n");
955
+ return result;
956
+ }
957
+ function normalizePrefix(prefix) {
958
+ let p = prefix.trim();
959
+ if (!p.startsWith("--")) p = `--${p}`;
960
+ if (!p.endsWith("-")) p = `${p}-`;
961
+ return p;
962
+ }
963
+ function escapeKey(key) {
964
+ return key.replace(".", "\\.");
965
+ }
966
+ function colorsToCssVars(colors) {
967
+ if (!colors) return {};
968
+ const result = {};
969
+ function walk(obj, prefix = []) {
970
+ for (const key in obj) {
971
+ const value = obj[key];
972
+ if (typeof value === "object" && value !== null) {
973
+ walk(value, [...prefix, key]);
974
+ } else {
975
+ const varName2 = "--color-" + [...prefix, key].join("-");
976
+ result[varName2] = value;
977
+ }
978
+ }
979
+ }
980
+ walk(colors);
981
+ return result;
982
+ }
983
+ function boxShadowToCssVars(boxShadow) {
984
+ if (!boxShadow) return {};
985
+ const result = {};
986
+ for (const key in boxShadow) {
987
+ result[`--shadow-${key}`] = boxShadow[key];
988
+ }
989
+ return result;
990
+ }
991
+ function fontSizeToCssVars(fontSize) {
992
+ if (!fontSize) return {};
993
+ const result = {};
994
+ for (const key in fontSize) {
995
+ const value = fontSize[key];
996
+ if (Array.isArray(value)) {
997
+ result[`--text-${key}`] = value[0];
998
+ if (value[1]) result[`--text-${key}--line-height`] = value[1];
999
+ } else {
1000
+ result[`--text-${key}`] = value;
1001
+ }
1002
+ }
1003
+ return result;
1004
+ }
1005
+ function fontWeightToCssVars(fontWeight) {
1006
+ if (!fontWeight) return {};
1007
+ const result = {};
1008
+ for (const key in fontWeight) {
1009
+ result[`--font-weight-${key}`] = fontWeight[key];
1010
+ }
1011
+ return result;
1012
+ }
1013
+ function fontFamilyToCssVars(fontFamily) {
1014
+ if (!fontFamily) return {};
1015
+ const result = {};
1016
+ for (const key in fontFamily) {
1017
+ const value = fontFamily[key];
1018
+ if (Array.isArray(value)) {
1019
+ result[`--font-${key}`] = value.join(", ");
1020
+ } else {
1021
+ result[`--font-${key}`] = value;
1022
+ }
1023
+ }
1024
+ return result;
1025
+ }
1026
+ function letterSpacingToCssVars(letterSpacing) {
1027
+ if (!letterSpacing) return {};
1028
+ const result = {};
1029
+ for (const key in letterSpacing) {
1030
+ result[`--letter-spacing-${key}`] = letterSpacing[key];
1031
+ }
1032
+ return result;
1033
+ }
1034
+ function spacingToCssVars(spacing) {
1035
+ if (!spacing) return {};
1036
+ const result = {};
1037
+ for (const key in spacing) {
1038
+ result[`--spacing-${escapeKey(key)}`] = spacing[key];
1039
+ }
1040
+ return result;
1041
+ }
1042
+ function borderRadiusToCssVars(borderRadius) {
1043
+ if (!borderRadius) return {};
1044
+ const result = {};
1045
+ for (const key in borderRadius) {
1046
+ result[`--radius-${escapeKey(key)}`] = borderRadius[key];
1047
+ }
1048
+ return result;
1049
+ }
1050
+ function zIndexToCssVars(zIndex) {
1051
+ if (!zIndex) return {};
1052
+ const result = {};
1053
+ for (const key in zIndex) {
1054
+ result[`--z-${escapeKey(key)}`] = String(zIndex[key]);
1055
+ }
1056
+ return result;
1057
+ }
1058
+ function opacityToCssVars(opacity) {
1059
+ if (!opacity) return {};
1060
+ const result = {};
1061
+ for (const key in opacity) {
1062
+ result[`--opacity-${escapeKey(key)}`] = String(opacity[key]);
1063
+ }
1064
+ return result;
1065
+ }
1066
+ function animationToCssVars(animations) {
1067
+ if (!animations) return {};
1068
+ const result = {};
1069
+ for (const key in animations) {
1070
+ result[`--animate-${escapeKey(key)}`] = animations[key];
1071
+ }
1072
+ return result;
1073
+ }
1074
+ function keyframesToCss(keyframes) {
1075
+ if (!keyframes) return "";
1076
+ let css = "";
1077
+ for (const name in keyframes) {
1078
+ const frames = keyframes[name];
1079
+ css += `@keyframes ${name} {
1080
+ `;
1081
+ for (const step in frames) {
1082
+ css += ` ${step} {`;
1083
+ const props = frames[step];
1084
+ for (const prop in props) {
1085
+ css += ` ${prop}: ${props[prop]};`;
1086
+ }
1087
+ css += " }\n";
1088
+ }
1089
+ css += "}\n";
1090
+ }
1091
+ return css;
1092
+ }
1093
+ function transitionTimingFunctionToCssVars(transition) {
1094
+ const result = {};
1095
+ for (const key in transition) {
1096
+ if (key === "DEFAULT") {
1097
+ result[`--default-transition-timing-function`] = transition[key];
1098
+ } else {
1099
+ result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
1100
+ if (key !== "linear") result[`--ease-${escapeKey(key)}`] = transition[key];
1101
+ }
1102
+ }
1103
+ return result;
1104
+ }
1105
+ function transitionDurationToCssVars(transitionDuration) {
1106
+ const result = {};
1107
+ for (const key in transitionDuration) {
1108
+ if (key === "DEFAULT") {
1109
+ result[`--default-transition-duration`] = transitionDuration[key];
1110
+ } else {
1111
+ result[`--transition-duration-${escapeKey(key)}`] = transitionDuration[key];
1112
+ }
1113
+ }
1114
+ return result;
1115
+ }
1116
+ function transitionDelayToCssVars(transitionDelay) {
1117
+ const result = {};
1118
+ for (const key in transitionDelay) {
1119
+ if (key === "DEFAULT") {
1120
+ result[`--default-transition-delay`] = transitionDelay[key];
1121
+ } else {
1122
+ result[`--transition-delay-${escapeKey(key)}`] = transitionDelay[key];
1123
+ }
1124
+ }
1125
+ return result;
1126
+ }
1127
+ function blurToCssVars(blur) {
1128
+ const result = {};
1129
+ for (const key in blur) {
1130
+ if (key === "DEFAULT") {
1131
+ result[`--default-blur`] = blur[key];
1132
+ } else {
1133
+ result[`--blur-${escapeKey(key)}`] = blur[key];
1134
+ }
1135
+ }
1136
+ return result;
1137
+ }
1138
+ function containerToCssVars(container) {
1139
+ const result = {};
1140
+ for (const key in container) {
1141
+ result[`--container-${escapeKey(key)}`] = container[key];
1142
+ }
1143
+ return result;
1144
+ }
1145
+ function themeToCssVarsAll(theme) {
1146
+ return {
1147
+ ...colorsToCssVars(theme.colors),
1148
+ ...boxShadowToCssVars(theme.boxShadow),
1149
+ ...fontSizeToCssVars(theme.fontSize),
1150
+ ...fontWeightToCssVars(theme.fontWeight),
1151
+ ...fontFamilyToCssVars(theme.fontFamily),
1152
+ ...letterSpacingToCssVars(theme.letterSpacing),
1153
+ "--spacing": theme.spacing["1"],
1154
+ ...spacingToCssVars(theme.spacing),
1155
+ ...containerToCssVars(theme.container),
1156
+ ...borderRadiusToCssVars(theme.borderRadius),
1157
+ ...zIndexToCssVars(theme.zIndex),
1158
+ ...opacityToCssVars(theme.opacity),
1159
+ ...animationToCssVars(theme.animations),
1160
+ ...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
1161
+ ...transitionDurationToCssVars(theme.transitionDuration),
1162
+ ...transitionDelayToCssVars(theme.transitionDelay),
1163
+ ...blurToCssVars(theme.blur),
1164
+ ...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
1165
+ // keyframes handled separately
1166
+ };
1167
+ }
1168
+ function toCssVarsBlock(vars, extra = "") {
1169
+ return ":root,:host {\n" + Object.entries(vars).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
732
1170
  }
733
- const failureCache = /* @__PURE__ */ new Map();
1171
+ const BARO_VAR = /--baro-/g;
1172
+ const PREFIXED_KEYS = /* @__PURE__ */ new Set(["prop", "value", "params", "selector", "nodes", "items"]);
1173
+ function applyVarPrefix(ast, ctx) {
1174
+ const configured = ctx?.config("cssVarPrefix");
1175
+ if (typeof configured !== "string" || !configured.trim()) return ast;
1176
+ const prefix = normalizePrefix(configured);
1177
+ if (prefix === "--baro-") return ast;
1178
+ const walk = (node) => {
1179
+ if (typeof node === "string") return node.includes("--baro-") ? node.replace(BARO_VAR, prefix) : node;
1180
+ if (Array.isArray(node)) return node.map(walk);
1181
+ if (!node || typeof node !== "object") return node;
1182
+ const out = {};
1183
+ for (const [k, val] of Object.entries(node)) out[k] = PREFIXED_KEYS.has(k) ? walk(val) : val;
1184
+ return out;
1185
+ };
1186
+ return walk(ast);
1187
+ }
1188
+ const failureCache = /* @__PURE__ */ new Set();
734
1189
  function collectDeclPaths(nodes = [], path = []) {
735
1190
  let result = [];
736
1191
  for (const node of nodes) {
@@ -885,8 +1340,8 @@ function extractAtRootNodes(nodes, parent, atRootNodes = []) {
885
1340
  if (node.type === "at-root") {
886
1341
  atRootNodes.push(node);
887
1342
  delete nodes[i];
888
- } else if (node.type === "rule" || node.type === "style-rule") {
889
- extractAtRootNodes(node.nodes, node, atRootNodes);
1343
+ } else if (node.type === "rule" || node.type === "style-rule" || node.type === "at-rule") {
1344
+ extractAtRootNodes(node.nodes ?? [], node, atRootNodes);
890
1345
  }
891
1346
  }
892
1347
  if (parent) {
@@ -894,45 +1349,50 @@ function extractAtRootNodes(nodes, parent, atRootNodes = []) {
894
1349
  }
895
1350
  }
896
1351
  function parseClassToAst(fullClassName, ctx) {
897
- if (failureCache.has(fullClassName)) {
1352
+ const state = getContextState(ctx);
1353
+ const failures = state?.failures || failureCache;
1354
+ const cache = state?.astCache || astCache;
1355
+ if (failures.has(fullClassName)) {
898
1356
  return [];
899
1357
  }
900
- const contextHash = JSON.stringify({
901
- darkMode: ctx.config("darkMode"),
902
- darkModeSelector: ctx.config("darkModeSelector"),
903
- theme: ctx.theme
904
- });
905
- const cacheKey = `${fullClassName}:${contextHash}`;
906
- if (astCache.has(cacheKey)) {
907
- return astCache.get(cacheKey);
1358
+ if (cache.has(fullClassName)) {
1359
+ return cache.get(fullClassName);
908
1360
  }
909
- const { modifiers, utility } = parseClassName(fullClassName);
1361
+ const { modifiers, utility } = parseClassName(fullClassName, ctx);
910
1362
  if (!utility) {
911
- console.warn(`[BAROCSS] Invalid class name format: "${fullClassName}"`);
912
- failureCache.set(fullClassName, true);
1363
+ debugWarn(`[BAROCSS] Invalid class name format: "${fullClassName}"`);
1364
+ failures.add(fullClassName);
913
1365
  return [];
914
1366
  }
915
- const utilReg = getUtility().find((u) => {
1367
+ const utilRegs = utility.property ? [arbitraryPropertyRegistration] : getUtility(ctx).filter((u) => {
916
1368
  const fullClassName2 = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
917
1369
  return u.match(fullClassName2);
918
1370
  });
919
- if (!utilReg) {
1371
+ if (utilRegs.length === 0) {
920
1372
  const utilityName = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
921
- console.warn(`[BAROCSS] Unknown utility class: "${utilityName}" in "${fullClassName}"`);
922
- failureCache.set(fullClassName, true);
1373
+ debugWarn(`[BAROCSS] Unknown utility class: "${utilityName}" in "${fullClassName}"`);
1374
+ failures.add(fullClassName);
923
1375
  return [];
924
1376
  }
925
1377
  let value = utility.value;
926
1378
  if (utility.negative && value) value = "-" + value;
927
- let ast = utilReg.handler(value, ctx, utility, utilReg) || [];
1379
+ let ast = [];
1380
+ for (const utilReg of utilRegs) {
1381
+ ast = utilReg.handler(value, ctx, utility, utilReg) || [];
1382
+ if (ast.length > 0) break;
1383
+ }
928
1384
  const wrappers = [];
929
1385
  const selector = "&";
930
1386
  for (let i = 0; i < modifiers.length; i++) {
931
1387
  const variant = modifiers[i];
932
- const plugin = getModifier().find((p) => p.match(variant.type, ctx));
1388
+ const plugin = getModifier(ctx).find((p) => p.match(variant.type, ctx));
933
1389
  if (!plugin) {
934
- console.warn(`[BAROCSS] Unknown variant: "${variant.type}" in "${fullClassName}"`);
935
- continue;
1390
+ debugWarn(`[BAROCSS] Unknown variant: "${variant.type}" in "${fullClassName}"`);
1391
+ failures.add(fullClassName);
1392
+ return [];
1393
+ }
1394
+ if (plugin.astHandler) {
1395
+ ast = plugin.astHandler(ast, variant, ctx, modifiers, i);
936
1396
  }
937
1397
  if (plugin.wrap) {
938
1398
  const items = plugin.wrap(variant, ctx);
@@ -940,7 +1400,6 @@ function parseClassToAst(fullClassName, ctx) {
940
1400
  type: "wrap",
941
1401
  items
942
1402
  });
943
- continue;
944
1403
  }
945
1404
  if (plugin.modifySelector) {
946
1405
  const result = plugin.modifySelector({
@@ -951,9 +1410,10 @@ function parseClassToAst(fullClassName, ctx) {
951
1410
  variantChain: modifiers,
952
1411
  index: i
953
1412
  });
1413
+ if (plugin.wrap && (result === "&" || typeof result === "object" && !Array.isArray(result) && result.selector === "&" || Array.isArray(result) && result.length === 1 && result[0].selector === "&")) continue;
954
1414
  if (typeof result === "string" && result.includes("&")) {
955
1415
  wrappers.push({ type: "rule", selector: result });
956
- } else if (typeof result === "object" && result.selector) {
1416
+ } else if (typeof result === "object" && !Array.isArray(result) && result.selector) {
957
1417
  const wrappingType = result.wrappingType || "rule";
958
1418
  wrappers.push({
959
1419
  type: wrappingType,
@@ -977,10 +1437,7 @@ function parseClassToAst(fullClassName, ctx) {
977
1437
  for (let i = wrappers.length - 1; i >= 0; i--) {
978
1438
  const wrap = wrappers[i];
979
1439
  if (wrap.type === "wrap") {
980
- ast = wrap.items.map((item) => ({
981
- ...item,
982
- nodes: Array.isArray(ast) ? ast : [ast]
983
- }));
1440
+ ast = wrap.items.map((item) => item.type === "rule" || item.type === "style-rule" || item.type === "at-rule" || item.type === "at-root" ? { ...item, nodes: [...item.nodes || [], ...ast] } : item);
984
1441
  } else if (wrap.type === "style-rule") {
985
1442
  ast = [
986
1443
  {
@@ -1013,13 +1470,20 @@ function parseClassToAst(fullClassName, ctx) {
1013
1470
  }
1014
1471
  const atRootNodes = [];
1015
1472
  extractAtRootNodes(ast, void 0, atRootNodes);
1016
- ast = [...atRootNodes, ...ast].filter(Boolean);
1017
- astCache.set(cacheKey, ast);
1473
+ ast = applyVarPrefix([...atRootNodes, ...ast].filter(Boolean), ctx);
1474
+ cache.set(fullClassName, ast);
1018
1475
  return ast;
1019
1476
  }
1020
- function clearAstCache() {
1021
- clearAllCaches();
1022
- failureCache.clear();
1477
+ function clearAstCache(ctx) {
1478
+ if (ctx) {
1479
+ clearContextCaches(ctx);
1480
+ } else {
1481
+ clearAllCaches();
1482
+ failureCache.clear();
1483
+ }
1484
+ }
1485
+ function getAstCacheStats(ctx) {
1486
+ return (ctx && getContextState(ctx)?.astCache || astCache).getStats();
1023
1487
  }
1024
1488
  function generateCss(classList, ctx, opts) {
1025
1489
  const seen = /* @__PURE__ */ new Set();
@@ -1033,7 +1497,7 @@ function generateCss(classList, ctx, opts) {
1033
1497
  return true;
1034
1498
  }).map((cls) => {
1035
1499
  const ast = parseClassToAst(cls, ctx);
1036
- const parsedResult = parseResultCache.get(cls);
1500
+ const parsedResult = (getContextState(ctx)?.parseResultCache || parseResultCache).get(cls);
1037
1501
  const cleanAst = optimizeAst(ast);
1038
1502
  cleanAst.forEach((node) => {
1039
1503
  if (node.type === "at-root") {
@@ -1041,42 +1505,42 @@ function generateCss(classList, ctx, opts) {
1041
1505
  }
1042
1506
  });
1043
1507
  const hasStyleRule = cleanAst.some((node) => node.type === "style-rule");
1044
- const css = astToCss(cleanAst, hasStyleRule ? void 0 : cls, {
1508
+ const css = astToCss(cleanAst.filter((node) => node.type !== "at-root"), hasStyleRule ? void 0 : cls, {
1045
1509
  minify: opts?.minify,
1046
1510
  important: parsedResult?.utility?.important ?? false
1047
1511
  });
1048
- const rootCss = rootToCss(allAtRootNodes);
1049
- const result = `${rootCss ? `:root,:host {${rootCss}}` : ""}${css}`;
1512
+ const result = css;
1050
1513
  if (!result || result.trim() === "") {
1051
- console.warn("[generateCss] Empty CSS generated for class:", {
1514
+ debugWarn("[generateCss] Empty CSS generated for class:", {
1052
1515
  class: cls,
1053
1516
  ast: cleanAst,
1054
1517
  hasStyleRule,
1055
1518
  css,
1056
- rootCss,
1057
1519
  result
1058
1520
  });
1059
1521
  }
1060
1522
  return result;
1061
1523
  }).join(opts?.minify ? "" : "\n");
1524
+ const rootRules = [...new Set(allAtRootNodes.filter((node) => node.type === "at-rule").map((node) => rootToCss([node], { minify: opts?.minify })))];
1525
+ const rootDeclarations = [...new Set(allAtRootNodes.filter((node) => node.type === "decl").map((node) => rootToCss([node], { minify: opts?.minify })).filter((decl2) => decl2 !== ""))];
1526
+ const rootCss = [
1527
+ ...rootRules,
1528
+ ...rootDeclarations.length ? [`:root,:host${opts?.minify ? "" : " "}{${rootDeclarations.join(opts?.minify ? "" : "\n")}}`] : []
1529
+ ].join(opts?.minify ? "" : "\n");
1062
1530
  if (allAtRootNodes.length > 0) {
1063
- console.log("[generateCss] All collected atRoot nodes:", allAtRootNodes);
1531
+ debugLog("[generateCss] All collected atRoot nodes:", allAtRootNodes);
1064
1532
  }
1065
1533
  if (!results || results.trim() === "") {
1066
- console.warn("[generateCss] Empty final result:", {
1534
+ debugWarn("[generateCss] Empty final result:", {
1067
1535
  classList,
1068
1536
  results,
1069
1537
  allAtRootNodes
1070
1538
  });
1071
1539
  }
1072
- return results;
1540
+ return `${rootCss}${rootCss && results ? opts?.minify ? "" : "\n" : ""}${results}`;
1073
1541
  }
1074
1542
  function generateCssRules(classList, ctx, opts) {
1075
1543
  const seen = /* @__PURE__ */ new Set();
1076
- const options = {
1077
- minify: opts?.minify,
1078
- dedup: opts?.dedup
1079
- };
1080
1544
  return classList.split(/\s+/).filter((cls) => {
1081
1545
  if (!cls) return false;
1082
1546
  if (opts?.dedup) {
@@ -1086,6 +1550,11 @@ function generateCssRules(classList, ctx, opts) {
1086
1550
  return true;
1087
1551
  }).map((cls) => {
1088
1552
  const ast = parseClassToAst(cls, ctx);
1553
+ const parsedResult = (getContextState(ctx)?.parseResultCache || parseResultCache).get(cls);
1554
+ const options = {
1555
+ minify: opts?.minify,
1556
+ important: parsedResult?.utility?.important ?? false
1557
+ };
1089
1558
  const cleanAst = optimizeAst(ast);
1090
1559
  const allAtRootNodes = cleanAst.filter(
1091
1560
  (node) => node.type === "at-root" && !node.source
@@ -1199,13 +1668,13 @@ class IncrementalParser {
1199
1668
  return null;
1200
1669
  }
1201
1670
  try {
1202
- const parseResult = parseClassName(className);
1671
+ const parseResult = parseClassName(className, this.ctx);
1203
1672
  if (!parseResult.utility) {
1204
1673
  return null;
1205
1674
  }
1206
1675
  const ast = parseClassToAst(className, this.ctx);
1207
1676
  if (ast.length === 0) {
1208
- console.warn("[IncrementalParser] ast is empty", className);
1677
+ debugWarn("[IncrementalParser] ast is empty", className);
1209
1678
  return null;
1210
1679
  }
1211
1680
  const rules = generateCssRules(className, this.ctx, { dedup: false });
@@ -1226,7 +1695,7 @@ class IncrementalParser {
1226
1695
  rootCssList: rule2.rootCssList
1227
1696
  };
1228
1697
  } catch (error) {
1229
- console.warn("[IncrementalParser] Failed to process class:", className, error);
1698
+ debugWarn("[IncrementalParser] Failed to process class:", className, error);
1230
1699
  return null;
1231
1700
  }
1232
1701
  }
@@ -1332,7 +1801,7 @@ class IncrementalParser {
1332
1801
  processedClasses: this.processedClasses.size,
1333
1802
  pendingClasses: this.pendingClasses.size,
1334
1803
  cacheStats: {
1335
- ast: astCache.getStats(),
1804
+ ast: (getContextState(this.ctx)?.astCache || astCache).getStats(),
1336
1805
  css: {}
1337
1806
  // No CSS cache, so return empty object
1338
1807
  }
@@ -1377,237 +1846,19 @@ class IncrementalParser {
1377
1846
  * This method is used by ChangeDetector for scan operations
1378
1847
  */
1379
1848
  processClassesSync(classes) {
1380
- this.applyClasses(classes);
1381
- }
1382
- /**
1383
- * Returns all currently processed class names
1384
- *
1385
- * This method is useful for debugging and monitoring purposes,
1386
- * providing visibility into which classes have been processed.
1387
- *
1388
- * @returns Array of all processed class names
1389
- */
1390
- getProcessedClasses() {
1391
- return Array.from(this.processedClasses);
1392
- }
1393
- }
1394
- function normalizePrefix(prefix) {
1395
- let p = prefix.trim();
1396
- if (!p.startsWith("--")) p = `--${p}`;
1397
- if (!p.endsWith("-")) p = `${p}-`;
1398
- return p;
1399
- }
1400
- function setVarPrefix(prefix) {
1401
- if (typeof prefix !== "string" || prefix.trim() === "") {
1402
- return;
1403
- }
1404
- normalizePrefix(prefix);
1405
- }
1406
- function escapeKey(key) {
1407
- return key.replace(".", "\\.");
1408
- }
1409
- function colorsToCssVars(colors) {
1410
- if (!colors) return {};
1411
- const result = {};
1412
- function walk(obj, prefix = []) {
1413
- for (const key in obj) {
1414
- const value = obj[key];
1415
- if (typeof value === "object" && value !== null) {
1416
- walk(value, [...prefix, key]);
1417
- } else {
1418
- const varName2 = "--color-" + [...prefix, key].join("-");
1419
- result[varName2] = value;
1420
- }
1421
- }
1422
- }
1423
- walk(colors);
1424
- return result;
1425
- }
1426
- function boxShadowToCssVars(boxShadow) {
1427
- if (!boxShadow) return {};
1428
- const result = {};
1429
- for (const key in boxShadow) {
1430
- result[`--shadow-${key}`] = boxShadow[key];
1431
- }
1432
- return result;
1433
- }
1434
- function fontSizeToCssVars(fontSize) {
1435
- if (!fontSize) return {};
1436
- const result = {};
1437
- for (const key in fontSize) {
1438
- const value = fontSize[key];
1439
- if (Array.isArray(value)) {
1440
- result[`--text-${key}`] = value[0];
1441
- if (value[1]) result[`--text-${key}--line-height`] = value[1];
1442
- } else {
1443
- result[`--text-${key}`] = value;
1444
- }
1445
- }
1446
- return result;
1447
- }
1448
- function fontWeightToCssVars(fontWeight) {
1449
- if (!fontWeight) return {};
1450
- const result = {};
1451
- for (const key in fontWeight) {
1452
- result[`--font-weight-${key}`] = fontWeight[key];
1453
- }
1454
- return result;
1455
- }
1456
- function fontFamilyToCssVars(fontFamily) {
1457
- if (!fontFamily) return {};
1458
- const result = {};
1459
- for (const key in fontFamily) {
1460
- const value = fontFamily[key];
1461
- if (Array.isArray(value)) {
1462
- result[`--font-${key}`] = value.join(", ");
1463
- } else {
1464
- result[`--font-${key}`] = value;
1465
- }
1466
- }
1467
- return result;
1468
- }
1469
- function letterSpacingToCssVars(letterSpacing) {
1470
- if (!letterSpacing) return {};
1471
- const result = {};
1472
- for (const key in letterSpacing) {
1473
- result[`--letter-spacing-${key}`] = letterSpacing[key];
1474
- }
1475
- return result;
1476
- }
1477
- function spacingToCssVars(spacing) {
1478
- if (!spacing) return {};
1479
- const result = {};
1480
- for (const key in spacing) {
1481
- result[`--spacing-${escapeKey(key)}`] = spacing[key];
1482
- }
1483
- return result;
1484
- }
1485
- function borderRadiusToCssVars(borderRadius) {
1486
- if (!borderRadius) return {};
1487
- const result = {};
1488
- for (const key in borderRadius) {
1489
- result[`--radius-${escapeKey(key)}`] = borderRadius[key];
1490
- }
1491
- return result;
1492
- }
1493
- function zIndexToCssVars(zIndex) {
1494
- if (!zIndex) return {};
1495
- const result = {};
1496
- for (const key in zIndex) {
1497
- result[`--z-${escapeKey(key)}`] = String(zIndex[key]);
1498
- }
1499
- return result;
1500
- }
1501
- function opacityToCssVars(opacity) {
1502
- if (!opacity) return {};
1503
- const result = {};
1504
- for (const key in opacity) {
1505
- result[`--opacity-${escapeKey(key)}`] = String(opacity[key]);
1506
- }
1507
- return result;
1508
- }
1509
- function animationToCssVars(animations) {
1510
- if (!animations) return {};
1511
- const result = {};
1512
- for (const key in animations) {
1513
- result[`--animate-${escapeKey(key)}`] = animations[key];
1514
- }
1515
- return result;
1516
- }
1517
- function keyframesToCss(keyframes) {
1518
- if (!keyframes) return "";
1519
- let css = "";
1520
- for (const name in keyframes) {
1521
- const frames = keyframes[name];
1522
- css += `@keyframes ${name} {
1523
- `;
1524
- for (const step in frames) {
1525
- css += ` ${step} {`;
1526
- const props = frames[step];
1527
- for (const prop in props) {
1528
- css += ` ${prop}: ${props[prop]};`;
1529
- }
1530
- css += " }\n";
1531
- }
1532
- css += "}\n";
1533
- }
1534
- return css;
1535
- }
1536
- function transitionTimingFunctionToCssVars(transition) {
1537
- const result = {};
1538
- for (const key in transition) {
1539
- if (key === "DEFAULT") {
1540
- result[`--default-transition-timing-function`] = transition[key];
1541
- } else {
1542
- result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
1543
- }
1544
- }
1545
- return result;
1546
- }
1547
- function transitionDurationToCssVars(transitionDuration) {
1548
- const result = {};
1549
- for (const key in transitionDuration) {
1550
- if (key === "DEFAULT") {
1551
- result[`--default-transition-duration`] = transitionDuration[key];
1552
- } else {
1553
- result[`--transition-duration-${escapeKey(key)}`] = transitionDuration[key];
1554
- }
1555
- }
1556
- return result;
1557
- }
1558
- function transitionDelayToCssVars(transitionDelay) {
1559
- const result = {};
1560
- for (const key in transitionDelay) {
1561
- if (key === "DEFAULT") {
1562
- result[`--default-transition-delay`] = transitionDelay[key];
1563
- } else {
1564
- result[`--transition-delay-${escapeKey(key)}`] = transitionDelay[key];
1565
- }
1566
- }
1567
- return result;
1568
- }
1569
- function blurToCssVars(blur) {
1570
- const result = {};
1571
- for (const key in blur) {
1572
- if (key === "DEFAULT") {
1573
- result[`--default-blur`] = blur[key];
1574
- } else {
1575
- result[`--blur-${escapeKey(key)}`] = blur[key];
1576
- }
1577
- }
1578
- return result;
1579
- }
1580
- function containerToCssVars(container) {
1581
- const result = {};
1582
- for (const key in container) {
1583
- result[`--container-${escapeKey(key)}`] = container[key];
1584
- }
1585
- return result;
1586
- }
1587
- function themeToCssVarsAll(theme) {
1588
- return {
1589
- ...colorsToCssVars(theme.colors),
1590
- ...boxShadowToCssVars(theme.boxShadow),
1591
- ...fontSizeToCssVars(theme.fontSize),
1592
- ...fontWeightToCssVars(theme.fontWeight),
1593
- ...fontFamilyToCssVars(theme.fontFamily),
1594
- ...letterSpacingToCssVars(theme.letterSpacing),
1595
- "--spacing": theme.spacing["1"],
1596
- ...spacingToCssVars(theme.spacing),
1597
- ...containerToCssVars(theme.container),
1598
- ...borderRadiusToCssVars(theme.borderRadius),
1599
- ...zIndexToCssVars(theme.zIndex),
1600
- ...opacityToCssVars(theme.opacity),
1601
- ...animationToCssVars(theme.animations),
1602
- ...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
1603
- ...transitionDurationToCssVars(theme.transitionDuration),
1604
- ...transitionDelayToCssVars(theme.transitionDelay),
1605
- ...blurToCssVars(theme.blur)
1606
- // keyframes handled separately
1607
- };
1608
- }
1609
- function toCssVarsBlock(vars, extra = "") {
1610
- return ":root,:host {\n" + Object.entries(vars).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
1849
+ this.applyClasses(classes);
1850
+ }
1851
+ /**
1852
+ * Returns all currently processed class names
1853
+ *
1854
+ * This method is useful for debugging and monitoring purposes,
1855
+ * providing visibility into which classes have been processed.
1856
+ *
1857
+ * @returns Array of all processed class names
1858
+ */
1859
+ getProcessedClasses() {
1860
+ return Array.from(this.processedClasses);
1861
+ }
1611
1862
  }
1612
1863
  const preflightMinimalCSS = `
1613
1864
  /* BaroCSS Preflight - Minimal Reset */
@@ -1739,6 +1990,10 @@ select {
1739
1990
  html {
1740
1991
  line-height: 1.15;
1741
1992
  -webkit-text-size-adjust: 100%;
1993
+ /* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
1994
+ font-family: var(--default-font-family, var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
1995
+ font-feature-settings: var(--default-font-feature-settings, normal);
1996
+ font-variation-settings: var(--default-font-variation-settings, normal);
1742
1997
  }
1743
1998
 
1744
1999
  /* Remove the gray background on active links in IE 10 */
@@ -1904,6 +2159,60 @@ textarea {
1904
2159
  [type="search"]::-webkit-search-decoration {
1905
2160
  -webkit-appearance: none;
1906
2161
  }
2162
+
2163
+ /* Tailwind 4.1.13 monospace stack for code-like elements */
2164
+ code,
2165
+ kbd,
2166
+ samp,
2167
+ pre {
2168
+ font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
2169
+ font-feature-settings: var(--default-mono-font-feature-settings, normal);
2170
+ font-variation-settings: var(--default-mono-font-variation-settings, normal);
2171
+ font-size: 1em;
2172
+ }
2173
+
2174
+ /* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
2175
+ button,
2176
+ input,
2177
+ select,
2178
+ optgroup,
2179
+ textarea,
2180
+ ::file-selector-button {
2181
+ font: inherit;
2182
+ font-feature-settings: inherit;
2183
+ font-variation-settings: inherit;
2184
+ letter-spacing: inherit;
2185
+ color: inherit;
2186
+ border-radius: 0;
2187
+ background-color: transparent;
2188
+ opacity: 1;
2189
+ }
2190
+
2191
+ :where(select:is([multiple], [size])) optgroup {
2192
+ font-weight: bolder;
2193
+ }
2194
+
2195
+ :where(select:is([multiple], [size])) optgroup option {
2196
+ padding-inline-start: 20px;
2197
+ }
2198
+
2199
+ ::file-selector-button {
2200
+ margin-inline-end: 4px;
2201
+ }
2202
+
2203
+ ::placeholder {
2204
+ opacity: 1;
2205
+ }
2206
+
2207
+ @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
2208
+ ::placeholder {
2209
+ color: color-mix(in oklab, currentcolor 50%, transparent);
2210
+ }
2211
+ }
2212
+
2213
+ textarea {
2214
+ resize: vertical;
2215
+ }
1907
2216
  `;
1908
2217
  const preflightFullCSS = `
1909
2218
  /* BaroCSS Preflight - Full Reset */
@@ -1916,10 +2225,14 @@ const preflightFullCSS = `
1916
2225
  box-sizing: border-box;
1917
2226
  }
1918
2227
 
1919
- /* Remove default margin and padding */
2228
+ /* Remove default margin and padding; reset border to Tailwind v4's universal
2229
+ \`border: 0 solid\` so a bare border/border-t (width set by the utility, style
2230
+ otherwise \`none\`) renders. Width 0 keeps borders invisible until a utility
2231
+ sets one. */
1920
2232
  * {
1921
2233
  margin: 0;
1922
2234
  padding: 0;
2235
+ border: 0 solid;
1923
2236
  }
1924
2237
 
1925
2238
  /* Set core body defaults */
@@ -1980,6 +2293,10 @@ html {
1980
2293
  line-height: 1.15;
1981
2294
  -webkit-text-size-adjust: 100%;
1982
2295
  -ms-text-size-adjust: 100%;
2296
+ /* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
2297
+ font-family: var(--default-font-family, var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
2298
+ font-feature-settings: var(--default-font-feature-settings, normal);
2299
+ font-variation-settings: var(--default-font-variation-settings, normal);
1983
2300
  }
1984
2301
 
1985
2302
  /* Remove the gray background on active links in IE 10 */
@@ -2165,7 +2482,9 @@ code,
2165
2482
  kbd,
2166
2483
  pre,
2167
2484
  samp {
2168
- font-family: monospace, monospace;
2485
+ font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
2486
+ font-feature-settings: var(--default-mono-font-feature-settings, normal);
2487
+ font-variation-settings: var(--default-mono-font-variation-settings, normal);
2169
2488
  font-size: 1em;
2170
2489
  }
2171
2490
 
@@ -2267,6 +2586,49 @@ template {
2267
2586
  page-break-after: avoid;
2268
2587
  }
2269
2588
  }
2589
+
2590
+ /* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
2591
+ button,
2592
+ input,
2593
+ select,
2594
+ optgroup,
2595
+ textarea,
2596
+ ::file-selector-button {
2597
+ font: inherit;
2598
+ font-feature-settings: inherit;
2599
+ font-variation-settings: inherit;
2600
+ letter-spacing: inherit;
2601
+ color: inherit;
2602
+ border-radius: 0;
2603
+ background-color: transparent;
2604
+ opacity: 1;
2605
+ }
2606
+
2607
+ :where(select:is([multiple], [size])) optgroup {
2608
+ font-weight: bolder;
2609
+ }
2610
+
2611
+ :where(select:is([multiple], [size])) optgroup option {
2612
+ padding-inline-start: 20px;
2613
+ }
2614
+
2615
+ ::file-selector-button {
2616
+ margin-inline-end: 4px;
2617
+ }
2618
+
2619
+ ::placeholder {
2620
+ opacity: 1;
2621
+ }
2622
+
2623
+ @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
2624
+ ::placeholder {
2625
+ color: color-mix(in oklab, currentcolor 50%, transparent);
2626
+ }
2627
+ }
2628
+
2629
+ textarea {
2630
+ resize: vertical;
2631
+ }
2270
2632
  `;
2271
2633
  function getPreflightCSS(level = true) {
2272
2634
  if (level === "minimal") {
@@ -2310,7 +2672,7 @@ function deepMerge(base, override) {
2310
2672
  }
2311
2673
  return result;
2312
2674
  }
2313
- let staticInProgress;
2675
+ const themeLookupsInProgress = /* @__PURE__ */ new WeakMap();
2314
2676
  function themeGetter(themeObj, ...path) {
2315
2677
  const theme = (...args) => themeGetter(themeObj, ...args);
2316
2678
  let keys = [];
@@ -2330,26 +2692,28 @@ function themeGetter(themeObj, ...path) {
2330
2692
  }
2331
2693
  }
2332
2694
  if (keys.length === 0) return void 0;
2333
- staticInProgress = staticInProgress || /* @__PURE__ */ new Set();
2334
- const pathKey = keys.join(".");
2335
- if (staticInProgress?.has(pathKey)) return void 0;
2336
- staticInProgress?.add(pathKey);
2337
- let value = themeObj[keys[0]];
2338
- if (typeof value === "function") {
2339
- value = value(theme);
2340
- }
2341
- for (let i = 1; i < keys.length; i++) {
2342
- if (value == null) {
2343
- staticInProgress?.delete(pathKey);
2344
- return void 0;
2345
- }
2346
- value = value[keys[i]];
2695
+ let inProgress = themeLookupsInProgress.get(themeObj);
2696
+ if (!inProgress) {
2697
+ inProgress = /* @__PURE__ */ new Set();
2698
+ themeLookupsInProgress.set(themeObj, inProgress);
2347
2699
  }
2348
- staticInProgress?.delete(pathKey);
2349
- if (typeof value === "function") {
2350
- return void 0;
2700
+ const pathKey = keys.join(".");
2701
+ if (inProgress.has(pathKey)) return void 0;
2702
+ inProgress.add(pathKey);
2703
+ try {
2704
+ let value = themeObj[keys[0]];
2705
+ if (typeof value === "function") {
2706
+ value = value(theme);
2707
+ }
2708
+ for (let i = 1; i < keys.length; i++) {
2709
+ if (value == null) return void 0;
2710
+ value = value[keys[i]];
2711
+ }
2712
+ if (typeof value === "function") return void 0;
2713
+ return value;
2714
+ } finally {
2715
+ inProgress.delete(pathKey);
2351
2716
  }
2352
- return value;
2353
2717
  }
2354
2718
  function configGetter(config, ...path) {
2355
2719
  let keys = [];
@@ -2389,6 +2753,7 @@ ${keyframesToCss(theme.keyframes || {})}
2389
2753
  return result;
2390
2754
  }
2391
2755
  function createContext(configObj) {
2756
+ if (configObj.debug !== void 0) setDebug(!!configObj.debug);
2392
2757
  const configWithDefaults = {
2393
2758
  presets: [
2394
2759
  { theme: defaultTheme },
@@ -2397,11 +2762,7 @@ function createContext(configObj) {
2397
2762
  ],
2398
2763
  ...configObj
2399
2764
  };
2400
- setVarPrefix(configWithDefaults.cssVarPrefix || "--bcss-");
2401
2765
  const themeObj = resolveTheme(configWithDefaults);
2402
- if (configObj.clearCacheOnContextChange !== false) {
2403
- clearAllCaches();
2404
- }
2405
2766
  const ctx = {
2406
2767
  hasPreset: (category, preset) => {
2407
2768
  const result = hasPreset(themeObj, category, preset);
@@ -2435,24 +2796,30 @@ function createContext(configObj) {
2435
2796
  ...values
2436
2797
  };
2437
2798
  } else ;
2799
+ clearContextCaches(ctx);
2438
2800
  },
2439
2801
  getPreflightCSS: (level = true) => {
2440
2802
  return getPreflightCSS(level);
2441
2803
  }
2442
2804
  };
2805
+ initializeContextState(ctx, getUtility(), getModifier());
2443
2806
  return ctx;
2444
2807
  }
2445
2808
  function jsonToAst(input, ctx) {
2446
- let utilReg = getUtility().find((u) => u.name === input.utility.name);
2809
+ const unsafeVariant = (input.variants || []).some(
2810
+ (v) => typeof v === "string" ? !isSafeVariantToken(v) : !isSafeVariantValue(v.name || "") || !isSafeVariantValue(v.value || "") || hasCommentToken(v.name || "") || hasCommentToken(v.value || "")
2811
+ );
2812
+ if (unsafeVariant) return [];
2813
+ let utilReg = getUtility(ctx).find((u) => u.name === input.utility.name);
2447
2814
  if (input.utility.value && !input.utility.arbitrary && !input.utility.customProperty) {
2448
2815
  const fullName = `${input.utility.name}-${input.utility.value}`;
2449
- const exactMatch = getUtility().find((u) => u.name === fullName);
2816
+ const exactMatch = getUtility(ctx).find((u) => u.name === fullName);
2450
2817
  if (exactMatch) {
2451
2818
  utilReg = exactMatch;
2452
2819
  }
2453
2820
  }
2454
2821
  if (!utilReg) {
2455
- console.warn(`[jsonToAst] Unknown utility: "${input.utility.name}"`);
2822
+ debugWarn(`[jsonToAst] Unknown utility: "${input.utility.name}"`);
2456
2823
  return [];
2457
2824
  }
2458
2825
  const parsedUtility = {
@@ -2497,18 +2864,13 @@ function jsonToAst(input, ctx) {
2497
2864
  matchKey = `${variantName}-[${variantValue}]`;
2498
2865
  parsedModifier.type = matchKey;
2499
2866
  }
2500
- const plugin = getModifier().find((p) => p.match(matchKey, ctx));
2867
+ const plugin = getModifier(ctx).find((p) => p.match(matchKey, ctx));
2501
2868
  if (!plugin) {
2502
- console.warn(`[jsonToAst] Unknown variant: "${matchKey}"`);
2869
+ debugWarn(`[jsonToAst] Unknown variant: "${matchKey}"`);
2503
2870
  continue;
2504
2871
  }
2505
- if (plugin.wrap) {
2506
- const items = plugin.wrap(parsedModifier, ctx);
2507
- wrappers.push({
2508
- type: "wrap",
2509
- items
2510
- });
2511
- continue;
2872
+ if (plugin.astHandler) {
2873
+ ast = plugin.astHandler(ast, parsedModifier, ctx, [], i);
2512
2874
  }
2513
2875
  if (plugin.modifySelector) {
2514
2876
  const result = plugin.modifySelector({
@@ -2521,7 +2883,9 @@ function jsonToAst(input, ctx) {
2521
2883
  // We might need to pass the full chain if needed
2522
2884
  index: i
2523
2885
  });
2524
- if (typeof result === "string" && result.includes("&")) {
2886
+ const identityWithWrap = plugin.wrap && (result === "&" || typeof result === "object" && !Array.isArray(result) && result.selector === "&" || Array.isArray(result) && result.length === 1 && result[0].selector === "&");
2887
+ if (identityWithWrap) ;
2888
+ else if (typeof result === "string" && result.includes("&")) {
2525
2889
  wrappers.push({ type: "rule", selector: result });
2526
2890
  } else if (typeof result === "object" && !Array.isArray(result) && result.selector) {
2527
2891
  const r = result;
@@ -2545,14 +2909,14 @@ function jsonToAst(input, ctx) {
2545
2909
  });
2546
2910
  }
2547
2911
  }
2912
+ if (plugin.wrap) {
2913
+ wrappers.push({ type: "wrap", items: plugin.wrap(parsedModifier, ctx) });
2914
+ }
2548
2915
  }
2549
2916
  for (let i = 0; i < wrappers.length; i++) {
2550
2917
  const wrap = wrappers[i];
2551
2918
  if (wrap.type === "wrap") {
2552
- ast = wrap.items.map((item) => ({
2553
- ...item,
2554
- nodes: Array.isArray(ast) ? ast : [ast]
2555
- }));
2919
+ ast = wrap.items.map((item) => item.type === "rule" || item.type === "style-rule" || item.type === "at-rule" || item.type === "at-root" ? { ...item, nodes: [...item.nodes || [], ...ast] } : item);
2556
2920
  } else if (wrap.type === "style-rule") {
2557
2921
  ast = [
2558
2922
  {
@@ -2584,7 +2948,7 @@ function jsonToAst(input, ctx) {
2584
2948
  }
2585
2949
  }
2586
2950
  }
2587
- return ast;
2951
+ return applyVarPrefix(ast, ctx);
2588
2952
  }
2589
2953
  function generateCssFromJson(inputs, ctx, opts) {
2590
2954
  const allAtRootNodes = [];
@@ -2848,6 +3212,30 @@ function parseColor(input) {
2848
3212
  }
2849
3213
  return null;
2850
3214
  }
3215
+ const COLOR_KEYWORDS = /* @__PURE__ */ new Set(["inherit", "currentcolor", "transparent"]);
3216
+ function themeColorDecls(prop, value, extra) {
3217
+ const key = String(extra.realThemeValue);
3218
+ const ref = COLOR_KEYWORDS.has(value.toLowerCase()) || value.startsWith("var(") || !/^[\w-]+$/.test(key) ? value : `var(--color-${key})`;
3219
+ if (!extra.opacity) return [decl(prop, ref)];
3220
+ const alpha = normalizeAlpha(String(extra.opacity));
3221
+ const supports = (amount) => atRule("supports", "(color:color-mix(in lab, red, red))", [decl(prop, `color-mix(in oklab, ${ref} ${amount}, transparent)`)]);
3222
+ if (alpha.isVar) return [decl(prop, value), supports(alpha.amount)];
3223
+ return [decl(prop, `color-mix(in srgb, ${value} ${alpha.amount}, transparent)`), supports(alpha.amount)];
3224
+ }
3225
+ function normalizeAlpha(raw2) {
3226
+ let v = raw2.trim();
3227
+ const bracketed = v.startsWith("[") && v.endsWith("]");
3228
+ if (bracketed) v = v.slice(1, -1).trim();
3229
+ if (v.startsWith("(") && v.endsWith(")")) v = `var(${v.slice(1, -1).trim()})`;
3230
+ if (v.startsWith("var(")) return { amount: v, isVar: true };
3231
+ if (v.endsWith("%")) return { amount: v, isVar: false };
3232
+ const n = Number(v);
3233
+ if (v !== "" && Number.isFinite(n)) {
3234
+ const pct = bracketed && n <= 1 ? n * 100 : n;
3235
+ return { amount: `${+pct.toFixed(4)}%`, isVar: false };
3236
+ }
3237
+ return { amount: v, isVar: false };
3238
+ }
2851
3239
  staticUtility("accent-inherit", [["accent-color", "inherit"]], { category: "interactivity" });
2852
3240
  staticUtility("accent-current", [["accent-color", "currentColor"]], { category: "interactivity" });
2853
3241
  staticUtility("accent-transparent", [["accent-color", "transparent"]], { category: "interactivity" });
@@ -3050,10 +3438,10 @@ staticUtility("touch-pan-up", [["touch-action", "pan-up"]], { category: "interac
3050
3438
  staticUtility("touch-pan-down", [["touch-action", "pan-down"]], { category: "interactivity" });
3051
3439
  staticUtility("touch-pinch-zoom", [["touch-action", "pinch-zoom"]], { category: "interactivity" });
3052
3440
  staticUtility("touch-manipulation", [["touch-action", "manipulation"]], { category: "interactivity" });
3053
- staticUtility("select-none", [["user-select", "none"]], { category: "interactivity" });
3054
- staticUtility("select-text", [["user-select", "text"]], { category: "interactivity" });
3055
- staticUtility("select-all", [["user-select", "all"]], { category: "interactivity" });
3056
- staticUtility("select-auto", [["user-select", "auto"]], { category: "interactivity" });
3441
+ staticUtility("select-none", [["-webkit-user-select", "none"], ["user-select", "none"]], { category: "interactivity" });
3442
+ staticUtility("select-text", [["-webkit-user-select", "text"], ["user-select", "text"]], { category: "interactivity" });
3443
+ staticUtility("select-all", [["-webkit-user-select", "all"], ["user-select", "all"]], { category: "interactivity" });
3444
+ staticUtility("select-auto", [["-webkit-user-select", "auto"], ["user-select", "auto"]], { category: "interactivity" });
3057
3445
  staticUtility("will-change-auto", [["will-change", "auto"]], { category: "interactivity" });
3058
3446
  staticUtility("will-change-scroll", [["will-change", "scroll-position"]], { category: "interactivity" });
3059
3447
  staticUtility("will-change-contents", [["will-change", "contents"]], { category: "interactivity" });
@@ -3071,7 +3459,7 @@ const defaultDuration = "var(--default-transition-duration)";
3071
3459
  staticUtility("transition", [
3072
3460
  [
3073
3461
  "transition-property",
3074
- "color, background-color, border-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter"
3462
+ "color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events"
3075
3463
  ],
3076
3464
  ["transition-timing-function", defaultTiming],
3077
3465
  ["transition-duration", defaultDuration]
@@ -3084,7 +3472,7 @@ staticUtility("transition-all", [
3084
3472
  staticUtility("transition-colors", [
3085
3473
  [
3086
3474
  "transition-property",
3087
- "color, background-color, border-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
3475
+ "color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
3088
3476
  ],
3089
3477
  ["transition-timing-function", defaultTiming],
3090
3478
  ["transition-duration", defaultDuration]
@@ -3274,6 +3662,7 @@ const filters$1 = () => {
3274
3662
  filters$1()
3275
3663
  ], { category: "effects" });
3276
3664
  });
3665
+ staticUtility("blur", [decl("--baro-blur", "blur(8px)"), filters$1()], { category: "effects" });
3277
3666
  staticUtility("blur-none", [decl("--baro-blur", ""), filters$1()], { category: "effects" });
3278
3667
  functionalUtility({
3279
3668
  name: "blur",
@@ -3512,6 +3901,7 @@ functionalUtility({
3512
3901
  { category: "effects" }
3513
3902
  );
3514
3903
  });
3904
+ staticUtility("backdrop-blur", [decl("--baro-backdrop-blur", "blur(8px)"), ...filters()], { category: "effects" });
3515
3905
  staticUtility(
3516
3906
  "backdrop-blur-none",
3517
3907
  [decl("--baro-backdrop-blur", ""), ...filters()],
@@ -3740,56 +4130,52 @@ functionalUtility({
3740
4130
  description: "sepia filter utility (static, number, arbitrary, custom property supported)",
3741
4131
  category: "effects"
3742
4132
  });
4133
+ const SHADOW_COMPOSITE = "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)";
4134
+ const ringShadowProperties = () => atRoot([
4135
+ property("--baro-shadow", "0 0 #0000"),
4136
+ property("--baro-inset-shadow", "0 0 #0000"),
4137
+ property("--baro-inset-ring-shadow", "0 0 #0000"),
4138
+ property("--baro-ring-offset-shadow", "0 0 #0000"),
4139
+ property("--baro-ring-shadow", "0 0 #0000"),
4140
+ property("--baro-ring-offset-width", "0px", "<length>"),
4141
+ property("--baro-ring-offset-color", "#fff")
4142
+ ]);
4143
+ const shadowLayer = (value) => [
4144
+ ringShadowProperties(),
4145
+ decl("--baro-shadow", value),
4146
+ decl("box-shadow", SHADOW_COMPOSITE)
4147
+ ];
3743
4148
  [
3744
4149
  ["shadow-2xs", "var(--shadow-2xs)"],
3745
4150
  ["shadow-xs", "var(--shadow-xs)"],
3746
4151
  ["shadow-sm", "var(--shadow-sm)"],
3747
- ["shadow", "var(--shadow-default)"],
4152
+ ["shadow", "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"],
3748
4153
  ["shadow-md", "var(--shadow-md)"],
3749
4154
  ["shadow-lg", "var(--shadow-lg)"],
3750
4155
  ["shadow-xl", "var(--shadow-xl)"],
3751
4156
  ["shadow-2xl", "var(--shadow-2xl)"],
3752
4157
  ["shadow-none", "0 0 #0000"]
3753
4158
  ].forEach(([name, value]) => {
3754
- staticUtility(name, [["box-shadow", value]], { category: "effects" });
4159
+ staticUtility(name, [
4160
+ ringShadowProperties,
4161
+ ["--baro-shadow", value],
4162
+ ["box-shadow", SHADOW_COMPOSITE]
4163
+ ], { category: "effects" });
3755
4164
  });
3756
4165
  [
3757
- [
3758
- "inset-shadow-2xs",
3759
- "inset 0 1px 2px var(--baro-inset-shadow-color, #0000000d)"
3760
- ],
3761
- [
3762
- "inset-shadow-xs",
3763
- "inset 0 2px 4px var(--baro-inset-shadow-color, #0000000d)"
3764
- ],
3765
- [
3766
- "inset-shadow-sm",
3767
- "inset 0 2px 4px var(--baro-inset-shadow-color, #0000000d)"
3768
- ],
3769
- [
3770
- "inset-shadow-md",
3771
- "inset 0 4px 6px -1px var(--baro-inset-shadow-color, #0000000d)"
3772
- ],
3773
- [
3774
- "inset-shadow-lg",
3775
- "inset 0 10px 15px -3px var(--baro-inset-shadow-color, #0000000d)"
3776
- ],
3777
- [
3778
- "inset-shadow-xl",
3779
- "inset 0 20px 25px -5px var(--baro-inset-shadow-color, #0000000d)"
3780
- ],
3781
- [
3782
- "inset-shadow-2xl",
3783
- "inset 0 25px 50px -12px var(--baro-inset-shadow-color, #0000000d)"
3784
- ],
4166
+ ["inset-shadow-2xs", "inset 0 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4167
+ ["inset-shadow-xs", "inset 0 1px 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4168
+ ["inset-shadow-sm", "inset 0 2px 4px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4169
+ ["inset-shadow-md", "inset 0 4px 6px -1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4170
+ ["inset-shadow-lg", "inset 0 10px 15px -3px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4171
+ ["inset-shadow-xl", "inset 0 20px 25px -5px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4172
+ ["inset-shadow-2xl", "inset 0 25px 50px -12px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
3785
4173
  ["inset-shadow-none", "0 0 #0000"]
3786
4174
  ].forEach(([name, value]) => {
3787
4175
  staticUtility(name, [
4176
+ ringShadowProperties,
3788
4177
  ["--baro-inset-shadow", value],
3789
- [
3790
- "box-shadow",
3791
- "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
3792
- ]
4178
+ ["box-shadow", SHADOW_COMPOSITE]
3793
4179
  ], { category: "effects" });
3794
4180
  });
3795
4181
  function createShadowThemeColor(key, main, opacity, realThemeValue) {
@@ -3854,9 +4240,9 @@ functionalUtility({
3854
4240
  )
3855
4241
  ];
3856
4242
  }
3857
- return [decl("box-shadow", main)];
4243
+ return [decl("--baro-shadow-color", main)];
3858
4244
  }
3859
- return [decl("box-shadow", main)];
4245
+ return shadowLayer(main);
3860
4246
  }
3861
4247
  if (main === "inherit" || main === "current" || main === "transparent") {
3862
4248
  return [
@@ -3865,7 +4251,7 @@ functionalUtility({
3865
4251
  }
3866
4252
  return null;
3867
4253
  },
3868
- handleCustomProperty: (value) => [decl("box-shadow", `var(${value})`)]
4254
+ handleCustomProperty: (value) => shadowLayer(`var(${value})`)
3869
4255
  });
3870
4256
  functionalUtility({
3871
4257
  name: "inset-shadow",
@@ -3924,22 +4310,39 @@ functionalUtility({
3924
4310
  ["ring-8", "8px"]
3925
4311
  ].forEach(([name, px]) => {
3926
4312
  staticUtility(name, [
3927
- ["--baro-ring-inset", ""],
3928
- ["--baro-ring-offset-width", "0px"],
3929
- ["--baro-ring-offset-color", "#fff"],
3930
- ["--baro-ring-color", "rgb(59 130 246 / 0.5)"],
3931
- // default blue-500/50
4313
+ ringShadowProperties,
4314
+ // Like Tailwind, ring-N does not set the offset vars (they come from @property defaults and ring-offset-*),
4315
+ // so `ring-N ring-offset-M` composes the same in either rule order.
4316
+ // No hardcoded ring color: Tailwind v4's default ring color is currentColor (via the var() fallback below).
3932
4317
  [
3933
4318
  "--baro-ring-shadow",
3934
- `var(--baro-ring-inset) 0 0 0 calc(${px} + var(--baro-ring-offset-width)) var(--baro-ring-color, currentcolor)`
4319
+ ringShadowValue(px)
3935
4320
  ],
3936
- ["--baro-ring-offset-shadow", `0 0 #0000`],
3937
4321
  [
3938
4322
  "box-shadow",
3939
4323
  "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
3940
4324
  ]
3941
4325
  ]);
3942
4326
  });
4327
+ function ringShadowValue(width) {
4328
+ return `var(--baro-ring-inset,) 0 0 0 calc(${width} + var(--baro-ring-offset-width)) var(--baro-ring-color, currentcolor)`;
4329
+ }
4330
+ [
4331
+ ["ring-offset-0", "0px"],
4332
+ ["ring-offset-1", "1px"],
4333
+ ["ring-offset-2", "2px"],
4334
+ ["ring-offset-4", "4px"],
4335
+ ["ring-offset-8", "8px"]
4336
+ ].forEach(([name, px]) => {
4337
+ staticUtility(name, [
4338
+ ["--baro-ring-offset-width", px],
4339
+ ["--baro-ring-offset-color", "#fff"],
4340
+ [
4341
+ "--baro-ring-offset-shadow",
4342
+ `var(--baro-ring-inset,) 0 0 0 var(--baro-ring-offset-width) var(--baro-ring-offset-color)`
4343
+ ]
4344
+ ], { category: "effects" });
4345
+ });
3943
4346
  [
3944
4347
  ["inset-ring", "1px"],
3945
4348
  ["inset-ring-0", "0px"],
@@ -3949,20 +4352,11 @@ functionalUtility({
3949
4352
  ["inset-ring-8", "8px"]
3950
4353
  ].forEach(([name, px]) => {
3951
4354
  staticUtility(name, [
3952
- ["--baro-ring-inset", "inset"],
3953
- ["--baro-ring-offset-width", "0px"],
3954
- ["--baro-ring-offset-color", "#fff"],
3955
- ["--baro-inset-ring-color", "rgb(59 130 246 / 0.5)"],
3956
- [
3957
- "--baro-inset-ring-shadow",
3958
- `var(--baro-ring-inset) 0 0 0 calc(${px} + var(--baro-ring-offset-width)) var(--baro-inset-ring-color, currentcolor)`
3959
- ],
3960
- ["--baro-ring-offset-shadow", `0 0 #0000`],
3961
- [
3962
- "box-shadow",
3963
- "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
3964
- ]
3965
- ]);
4355
+ // Tailwind 4.1.13: only the inset-ring layer; the colour defaults to currentcolor via the var() fallback.
4356
+ ringShadowProperties,
4357
+ ["--baro-inset-ring-shadow", `inset 0 0 0 ${px} var(--baro-inset-ring-color, currentcolor)`],
4358
+ ["box-shadow", SHADOW_COMPOSITE]
4359
+ ], { category: "effects" });
3966
4360
  });
3967
4361
  staticUtility("ring-inset", [["--baro-ring-inset", "inset"]], { category: "effects" });
3968
4362
  function createRingColorDecls(key, main, opacity, realThemeValue) {
@@ -4036,7 +4430,15 @@ functionalUtility({
4036
4430
  decl("--baro-ring-color", fallback)
4037
4431
  ];
4038
4432
  }
4039
- return [decl("box-shadow", main)];
4433
+ if (!parseColor(main) && /^(-?(\d+\.?\d*|\.\d+)(px|rem|em|%|vw|vh|vmin|vmax|ch|ex|pt|cm|mm|in|pc)|0|(length:.+)|calc\(.+\))$/i.test(main)) {
4434
+ const width = main.startsWith("length:") ? main.slice(7) : main;
4435
+ return [
4436
+ ringShadowProperties(),
4437
+ decl("--baro-ring-shadow", ringShadowValue(width)),
4438
+ decl("box-shadow", SHADOW_COMPOSITE)
4439
+ ];
4440
+ }
4441
+ return [parseColor(main) ? decl("--baro-ring-color", main) : decl("box-shadow", main)];
4040
4442
  }
4041
4443
  if (main === "inherit" || main === "current" || main === "transparent") {
4042
4444
  return [
@@ -4278,6 +4680,30 @@ functionalUtility({
4278
4680
  description: "mask-size utility (static, arbitrary, custom property supported)",
4279
4681
  category: "effects"
4280
4682
  });
4683
+ const maskProperties = () => atRoot([
4684
+ property("--baro-mask-linear", "linear-gradient(#fff, #fff)"),
4685
+ property("--baro-mask-radial", "linear-gradient(#fff, #fff)"),
4686
+ property("--baro-mask-conic", "linear-gradient(#fff, #fff)"),
4687
+ property("--baro-mask-linear-position", "0deg"),
4688
+ property("--baro-mask-linear-from-position", "0%"),
4689
+ property("--baro-mask-linear-to-position", "100%"),
4690
+ property("--baro-mask-linear-from-color", "black"),
4691
+ property("--baro-mask-linear-to-color", "transparent")
4692
+ ]);
4693
+ functionalUtility({
4694
+ name: "mask-linear-from",
4695
+ handleBareValue: ({ value }) => /^(?:100|[1-9]?\d)%$/.test(value) ? value : null,
4696
+ handle: (value) => [
4697
+ decl("mask-image", "var(--baro-mask-linear), var(--baro-mask-radial), var(--baro-mask-conic)"),
4698
+ decl("mask-composite", "intersect"),
4699
+ decl("--baro-mask-linear-stops", "var(--baro-mask-linear-position), var(--baro-mask-linear-from-color) var(--baro-mask-linear-from-position), var(--baro-mask-linear-to-color) var(--baro-mask-linear-to-position)"),
4700
+ decl("--baro-mask-linear", "linear-gradient(var(--baro-mask-linear-stops))"),
4701
+ decl("--baro-mask-linear-from-position", value),
4702
+ maskProperties()
4703
+ ],
4704
+ category: "effects"
4705
+ });
4706
+ staticUtility("mask-none", [["mask-image", "none"]], { category: "effects" });
4281
4707
  functionalUtility({
4282
4708
  name: "mask",
4283
4709
  supportsArbitrary: true,
@@ -4313,7 +4739,7 @@ functionalUtility({
4313
4739
  category: "layout"
4314
4740
  });
4315
4741
  staticUtility("aspect-square", [["aspect-ratio", "1 / 1"]], { category: "layout" });
4316
- staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-ratio-video)"]], { category: "layout" });
4742
+ staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-video)"]], { category: "layout" });
4317
4743
  staticUtility("aspect-auto", [["aspect-ratio", "auto"]], { category: "layout" });
4318
4744
  functionalUtility({
4319
4745
  name: "aspect",
@@ -4397,10 +4823,10 @@ staticUtility("sr-only", [
4397
4823
  ["position", "absolute"],
4398
4824
  ["width", "1px"],
4399
4825
  ["height", "1px"],
4400
- ["margin", "-1px"],
4401
4826
  ["padding", "0"],
4827
+ ["margin", "-1px"],
4402
4828
  ["overflow", "hidden"],
4403
- ["clip", "rect(0, 0, 0, 0)"],
4829
+ ["clip-path", "inset(50%)"],
4404
4830
  ["white-space", "nowrap"],
4405
4831
  ["border-width", "0"]
4406
4832
  ], { category: "layout" });
@@ -4408,12 +4834,39 @@ staticUtility("not-sr-only", [
4408
4834
  ["position", "static"],
4409
4835
  ["width", "auto"],
4410
4836
  ["height", "auto"],
4411
- ["margin", "0"],
4412
4837
  ["padding", "0"],
4838
+ ["margin", "0"],
4413
4839
  ["overflow", "visible"],
4414
- ["clip", "auto"],
4840
+ ["clip-path", "none"],
4415
4841
  ["white-space", "normal"]
4416
4842
  ], { category: "layout" });
4843
+ staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
4844
+ staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
4845
+ registerUtility({
4846
+ name: "@container",
4847
+ match: (className) => /^@container\/[a-zA-Z0-9_-]+$/.test(className),
4848
+ handler: (_value, _ctx, token) => {
4849
+ const name = /^@container\/([a-zA-Z0-9_-]+)$/.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`)?.[1];
4850
+ return name ? [decl("container-type", "inline-size"), decl("container-name", name)] : null;
4851
+ },
4852
+ category: "layout"
4853
+ });
4854
+ const toRem = (v) => {
4855
+ const m = /^(-?\d*\.?\d+)(rem|px|em)$/.exec(v.trim());
4856
+ if (!m) return Number.NaN;
4857
+ return m[2] === "px" ? Number(m[1]) / 16 : Number(m[1]);
4858
+ };
4859
+ registerUtility({
4860
+ name: "container",
4861
+ match: (className) => className === "container",
4862
+ handler: (_value, ctx) => {
4863
+ const bps = ctx.theme("breakpoints") || ctx.config("theme.breakpoints") || {};
4864
+ const values = Object.values(bps).filter((v) => typeof v === "string" && !Number.isNaN(toRem(v)));
4865
+ values.sort((a, b) => toRem(a) - toRem(b));
4866
+ return [decl("width", "100%"), ...values.map((v) => atRule("media", `(width >= ${v})`, [decl("max-width", v)]))];
4867
+ },
4868
+ category: "layout"
4869
+ });
4417
4870
  staticUtility("float-right", [["float", "right"]], { category: "layout" });
4418
4871
  staticUtility("float-left", [["float", "left"]], { category: "layout" });
4419
4872
  staticUtility("float-start", [["float", "inline-start"]], { category: "layout" });
@@ -4529,7 +4982,7 @@ functionalUtility({
4529
4982
  // gap-x-[10vw]
4530
4983
  supportsCustomProperty: true,
4531
4984
  // gap-x-(--my-gap-x)
4532
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
4985
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
4533
4986
  handle: (value) => {
4534
4987
  if (typeof value === "string") return [decl("column-gap", value)];
4535
4988
  return null;
@@ -4545,7 +4998,7 @@ functionalUtility({
4545
4998
  // gap-y-[10vw]
4546
4999
  supportsCustomProperty: true,
4547
5000
  // gap-y-(--my-gap-y)
4548
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5001
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
4549
5002
  handle: (value) => {
4550
5003
  if (typeof value === "string") return [decl("row-gap", value)];
4551
5004
  return null;
@@ -4561,7 +5014,7 @@ functionalUtility({
4561
5014
  // gap-[10vw]
4562
5015
  supportsCustomProperty: true,
4563
5016
  // gap-(--my-gap)
4564
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5017
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
4565
5018
  handle: (value) => {
4566
5019
  if (typeof value === "string") return [decl("gap", value)];
4567
5020
  return null;
@@ -4620,6 +5073,31 @@ staticUtility("flex-nowrap", [["flex-wrap", "nowrap"]], { category: "flex-grid"
4620
5073
  staticUtility("flex-auto", [["flex", "1 1 auto"]], { category: "flex-grid" });
4621
5074
  staticUtility("flex-initial", [["flex", "0 1 auto"]], { category: "flex-grid" });
4622
5075
  staticUtility("flex-none", [["flex", "none"]], { category: "flex-grid" });
5076
+ staticUtility("flex-grow", [["flex-grow", "1"]], { category: "flex-grid" });
5077
+ functionalUtility({
5078
+ name: "flex-grow",
5079
+ prop: "flex-grow",
5080
+ supportsArbitrary: true,
5081
+ // grow-[25vw], grow-[2], grow-[var(--factor)], etc.
5082
+ supportsCustomProperty: true,
5083
+ // grow-(--my-grow)
5084
+ handleBareValue: ({ value }) => parseNumber(value),
5085
+ handle: (value) => [decl("flex-grow", value)],
5086
+ description: "flex-grow utility (number, arbitrary, custom property supported)",
5087
+ category: "flex-grid"
5088
+ });
5089
+ staticUtility("flex-shrink", [["flex-shrink", "1"]], { category: "flex-grid" });
5090
+ functionalUtility({
5091
+ name: "flex-shrink",
5092
+ prop: "flex-shrink",
5093
+ supportsArbitrary: true,
5094
+ // shrink-[2], shrink-[calc(100vw-var(--sidebar))], etc.
5095
+ supportsCustomProperty: true,
5096
+ // shrink-(--my-shrink)
5097
+ handleBareValue: ({ value }) => parseNumber(value),
5098
+ description: "flex-shrink utility (number, arbitrary, custom property supported)",
5099
+ category: "flex-grid"
5100
+ });
4623
5101
  functionalUtility({
4624
5102
  name: "flex",
4625
5103
  supportsArbitrary: true,
@@ -4853,7 +5331,7 @@ functionalUtility({
4853
5331
  // gap-x-[10vw]
4854
5332
  supportsCustomProperty: true,
4855
5333
  // gap-x-(--my-gap-x)
4856
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5334
+ handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
4857
5335
  handle: (value) => {
4858
5336
  if (typeof value === "string") return [decl("column-gap", value)];
4859
5337
  return null;
@@ -4869,7 +5347,7 @@ functionalUtility({
4869
5347
  // gap-y-[10vw]
4870
5348
  supportsCustomProperty: true,
4871
5349
  // gap-y-(--my-gap-y)
4872
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5350
+ handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
4873
5351
  handle: (value) => {
4874
5352
  if (typeof value === "string") return [decl("row-gap", value)];
4875
5353
  return null;
@@ -4885,7 +5363,7 @@ functionalUtility({
4885
5363
  // gap-[10vw]
4886
5364
  supportsCustomProperty: true,
4887
5365
  // gap-(--my-gap)
4888
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5366
+ handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
4889
5367
  handle: (value) => {
4890
5368
  if (typeof value === "string") return [decl("gap", value)];
4891
5369
  return null;
@@ -4913,11 +5391,11 @@ staticUtility("justify-items-center-safe", [["justify-items", "safe center"]], {
4913
5391
  staticUtility("justify-items-stretch", [["justify-items", "stretch"]], { category: "flex-grid" });
4914
5392
  staticUtility("justify-items-normal", [["justify-items", "normal"]], { category: "flex-grid" });
4915
5393
  staticUtility("justify-self-auto", [["justify-self", "auto"]], { category: "flex-grid" });
4916
- staticUtility("justify-self-start", [["justify-self", "start"]], { category: "flex-grid" });
5394
+ staticUtility("justify-self-start", [["justify-self", "flex-start"]], { category: "flex-grid" });
4917
5395
  staticUtility("justify-self-center", [["justify-self", "center"]], { category: "flex-grid" });
4918
5396
  staticUtility("justify-self-center-safe", [["justify-self", "safe center"]], { category: "flex-grid" });
4919
- staticUtility("justify-self-end", [["justify-self", "end"]], { category: "flex-grid" });
4920
- staticUtility("justify-self-end-safe", [["justify-self", "safe end"]], { category: "flex-grid" });
5397
+ staticUtility("justify-self-end", [["justify-self", "flex-end"]], { category: "flex-grid" });
5398
+ staticUtility("justify-self-end-safe", [["justify-self", "safe flex-end"]], { category: "flex-grid" });
4921
5399
  staticUtility("justify-self-stretch", [["justify-self", "stretch"]], { category: "flex-grid" });
4922
5400
  staticUtility("content-normal", [["align-content", "normal"]], { category: "flex-grid" });
4923
5401
  staticUtility("content-center", [["align-content", "center"]], { category: "flex-grid" });
@@ -5052,7 +5530,7 @@ functionalUtility({
5052
5530
  prop,
5053
5531
  supportsArbitrary: true,
5054
5532
  supportsCustomProperty: true,
5055
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5533
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
5056
5534
  description: `${name} utility (number, arbitrary, custom property supported)`,
5057
5535
  category: "spacing"
5058
5536
  });
@@ -5077,144 +5555,48 @@ functionalUtility({
5077
5555
  supportsNegative: true,
5078
5556
  supportsArbitrary: true,
5079
5557
  supportsCustomProperty: true,
5080
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5081
- handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})`,
5558
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
5559
+ handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
5082
5560
  description: `${name} margin utility (number, negative, arbitrary, custom property, auto, px supported)`,
5083
5561
  category: "spacing"
5084
5562
  });
5085
5563
  });
5086
- staticUtility("space-x-px", [
5087
- [
5088
- "& > :not([hidden]) ~ :not([hidden])",
5089
- [
5090
- ["--baro-space-x-reverse", "0"],
5091
- [
5092
- "margin-inline-start",
5093
- "calc(1px * calc(1 - var(--baro-space-x-reverse)))"
5094
- ],
5095
- ["margin-inline-end", "calc(1px * var(--baro-space-x-reverse))"]
5096
- ]
5097
- ]
5098
- ], { category: "spacing" });
5099
- staticUtility("-space-x-px", [
5100
- [
5101
- "& > :not([hidden]) ~ :not([hidden])",
5102
- [
5103
- ["--baro-space-x-reverse", "0"],
5104
- [
5105
- "margin-inline-start",
5106
- "calc(-1px * calc(1 - var(--baro-space-x-reverse)))"
5107
- ],
5108
- ["margin-inline-end", "calc(-1px * var(--baro-space-x-reverse))"]
5109
- ]
5110
- ]
5111
- ], { category: "spacing" });
5112
- staticUtility("space-x-reverse", [
5113
- ["& > :not([hidden]) ~ :not([hidden])", [["--baro-space-x-reverse", "1"]]]
5114
- ], { category: "spacing" });
5115
- functionalUtility({
5116
- name: "space-x",
5117
- supportsNegative: true,
5118
- supportsArbitrary: true,
5119
- supportsCustomProperty: true,
5120
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5121
- handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})`,
5122
- handle: (value, ctx, token) => {
5123
- let v = value;
5124
- if (typeof v === "number" || /^-?\d+(\.\d+)?$/.test(v)) {
5125
- v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
5126
- }
5127
- return [
5128
- rule("& > :not([hidden]) ~ :not([hidden])", [
5129
- decl("--baro-space-x-reverse", "0"),
5130
- decl(
5131
- "margin-inline-start",
5132
- `calc(${v} * calc(1 - var(--baro-space-x-reverse)))`
5133
- ),
5134
- decl("margin-inline-end", `calc(${v} * var(--baro-space-x-reverse))`)
5135
- ])
5136
- ];
5137
- },
5138
- handleCustomProperty: (value) => [
5139
- rule("& > :not([hidden]) ~ :not([hidden])", [
5140
- decl("--baro-space-x-reverse", "0"),
5141
- decl(
5142
- "margin-inline-start",
5143
- `calc(var(${value}) * calc(1 - var(--baro-space-x-reverse)))`
5144
- ),
5145
- decl(
5146
- "margin-inline-end",
5147
- `calc(var(${value}) * var(--baro-space-x-reverse))`
5148
- )
5149
- ])
5150
- ],
5151
- description: "space-x utility (number, negative, px, arbitrary, custom property, reverse supported)",
5152
- category: "spacing"
5153
- });
5154
- staticUtility("space-y-px", [
5155
- [
5156
- "& > :not([hidden]) ~ :not([hidden])",
5157
- [
5158
- ["--baro-space-y-reverse", "0"],
5159
- ["margin-block-start", "calc(1px * calc(1 - var(--baro-space-y-reverse)))"],
5160
- ["margin-block-end", "calc(1px * var(--baro-space-y-reverse))"]
5161
- ]
5162
- ]
5163
- ], { category: "spacing" });
5164
- staticUtility("-space-y-px", [
5165
- [
5166
- "& > :not([hidden]) ~ :not([hidden])",
5167
- [
5168
- ["--baro-space-y-reverse", "0"],
5169
- [
5170
- "margin-block-start",
5171
- "calc(-1px * calc(1 - var(--baro-space-y-reverse)))"
5172
- ],
5173
- ["margin-block-end", "calc(-1px * var(--baro-space-y-reverse))"]
5174
- ]
5175
- ]
5176
- ], { category: "spacing" });
5177
- staticUtility("space-y-reverse", [
5178
- ["& > :not([hidden]) ~ :not([hidden])", [["--baro-space-y-reverse", "1"]]]
5179
- ], { category: "spacing" });
5180
- functionalUtility({
5181
- name: "space-y",
5182
- supportsNegative: true,
5183
- supportsArbitrary: true,
5184
- supportsCustomProperty: true,
5185
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5186
- handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})`,
5187
- handle: (value, ctx, token) => {
5188
- let v = value;
5189
- if (typeof v === "number" || /^-?\d+(\.\d+)?$/.test(v)) {
5190
- v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
5191
- }
5192
- return [
5193
- rule("& > :not([hidden]) ~ :not([hidden])", [
5194
- decl("--baro-space-y-reverse", "0"),
5195
- decl(
5196
- "margin-block-start",
5197
- `calc(${v} * calc(1 - var(--baro-space-y-reverse)))`
5198
- ),
5199
- decl("margin-block-end", `calc(${v} * var(--baro-space-y-reverse))`)
5200
- ])
5201
- ];
5202
- },
5203
- handleCustomProperty: (value) => [
5204
- rule("& > :not([hidden]) ~ :not([hidden])", [
5205
- decl("--baro-space-y-reverse", "0"),
5206
- decl(
5207
- "margin-block-start",
5208
- `calc(var(${value}) * calc(1 - var(--baro-space-y-reverse)))`
5209
- ),
5210
- decl(
5211
- "margin-block-end",
5212
- `calc(var(${value}) * var(--baro-space-y-reverse))`
5213
- )
5214
- ])
5215
- ],
5216
- description: "space-y utility (number, negative, px, arbitrary, custom property, reverse supported)",
5217
- category: "spacing"
5564
+ const SPACE_SELECTOR = ":where(& > :not(:last-child))";
5565
+ ["x", "y"].forEach((axis) => {
5566
+ const name = `space-${axis}`;
5567
+ const rev = `--baro-space-${axis}-reverse`;
5568
+ const [start, end] = axis === "x" ? ["margin-inline-start", "margin-inline-end"] : ["margin-block-start", "margin-block-end"];
5569
+ const reverseProperty = () => atRoot([property(rev, "0")]);
5570
+ const spaceRule = (v) => rule(SPACE_SELECTOR, [
5571
+ decl(rev, "0"),
5572
+ decl(start, `calc(${v} * var(${rev}))`),
5573
+ decl(end, `calc(${v} * calc(1 - var(${rev})))`)
5574
+ ]);
5575
+ const body = (v) => [reverseProperty(), spaceRule(v)];
5576
+ staticUtility(`${name}-px`, [reverseProperty, () => spaceRule("1px")], { category: "spacing" });
5577
+ staticUtility(`-${name}-px`, [reverseProperty, () => spaceRule("-1px")], { category: "spacing" });
5578
+ staticUtility(`${name}-reverse`, [
5579
+ reverseProperty,
5580
+ () => rule(SPACE_SELECTOR, [decl(rev, "1")])
5581
+ ], { category: "spacing" });
5582
+ functionalUtility({
5583
+ name,
5584
+ supportsNegative: true,
5585
+ supportsArbitrary: true,
5586
+ supportsCustomProperty: true,
5587
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
5588
+ handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
5589
+ handle: (value, _ctx, token) => {
5590
+ let v = String(value);
5591
+ if (/^-?\d+(\.\d+)?$/.test(v)) {
5592
+ v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
5593
+ }
5594
+ return body(v);
5595
+ },
5596
+ handleCustomProperty: (value) => body(`var(${value})`),
5597
+ description: `${name} utility (number, negative, px, arbitrary, custom property, reverse supported)`,
5598
+ category: "spacing"
5599
+ });
5218
5600
  });
5219
5601
  [
5220
5602
  ["w-auto", "auto"],
@@ -5441,6 +5823,9 @@ functionalUtility({
5441
5823
  });
5442
5824
  [
5443
5825
  ["max-w-none", "none"],
5826
+ ["max-w-min", "min-content"],
5827
+ ["max-w-max", "max-content"],
5828
+ ["max-w-fit", "fit-content"],
5444
5829
  ["max-w-xs", "var(--container-xs)"],
5445
5830
  ["max-w-sm", "var(--container-sm)"],
5446
5831
  ["max-w-md", "var(--container-md)"],
@@ -5471,22 +5856,23 @@ functionalUtility({
5471
5856
  description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
5472
5857
  category: "sizing"
5473
5858
  });
5474
- staticUtility("font-sans", [["font-family", "var(--font-family-sans)"]], { category: "typography" });
5475
- staticUtility("font-serif", [["font-family", "var(--font-family-serif)"]], { category: "typography" });
5476
- staticUtility("font-mono", [["font-family", "var(--font-family-mono)"]], { category: "typography" });
5477
- staticUtility("text-xs", [["font-size", "var(--text-xs)"], ["line-height", "var(--text-xs--line-height)"]], { category: "typography" });
5478
- staticUtility("text-sm", [["font-size", "var(--text-sm)"], ["line-height", "var(--text-sm--line-height)"]], { category: "typography" });
5479
- staticUtility("text-base", [["font-size", "var(--text-base)"], ["line-height", "var(--text-base--line-height)"]], { category: "typography" });
5480
- staticUtility("text-lg", [["font-size", "var(--text-lg)"], ["line-height", "var(--text-lg--line-height)"]], { category: "typography" });
5481
- staticUtility("text-xl", [["font-size", "var(--text-xl)"], ["line-height", "var(--text-xl--line-height)"]], { category: "typography" });
5482
- staticUtility("text-2xl", [["font-size", "var(--text-2xl)"], ["line-height", "var(--text-2xl--line-height)"]], { category: "typography" });
5483
- staticUtility("text-3xl", [["font-size", "var(--text-3xl)"], ["line-height", "var(--text-3xl--line-height)"]], { category: "typography" });
5484
- staticUtility("text-4xl", [["font-size", "var(--text-4xl)"], ["line-height", "var(--text-4xl--line-height)"]], { category: "typography" });
5485
- staticUtility("text-5xl", [["font-size", "var(--text-5xl)"], ["line-height", "var(--text-5xl--line-height)"]], { category: "typography" });
5486
- staticUtility("text-6xl", [["font-size", "var(--text-6xl)"], ["line-height", "var(--text-6xl--line-height)"]], { category: "typography" });
5487
- staticUtility("text-7xl", [["font-size", "var(--text-7xl)"], ["line-height", "var(--text-7xl--line-height)"]], { category: "typography" });
5488
- staticUtility("text-8xl", [["font-size", "var(--text-8xl)"], ["line-height", "var(--text-8xl--line-height)"]], { category: "typography" });
5489
- staticUtility("text-9xl", [["font-size", "var(--text-9xl)"], ["line-height", "var(--text-9xl--line-height)"]], { category: "typography" });
5859
+ const leadingProperty = () => atRoot([property("--baro-leading")]);
5860
+ staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
5861
+ staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
5862
+ staticUtility("font-mono", [["font-family", "var(--font-mono)"]], { category: "typography" });
5863
+ staticUtility("text-xs", [["font-size", "var(--text-xs)"], ["line-height", "var(--baro-leading, var(--text-xs--line-height))"]], { category: "typography" });
5864
+ staticUtility("text-sm", [["font-size", "var(--text-sm)"], ["line-height", "var(--baro-leading, var(--text-sm--line-height))"]], { category: "typography" });
5865
+ staticUtility("text-base", [["font-size", "var(--text-base)"], ["line-height", "var(--baro-leading, var(--text-base--line-height))"]], { category: "typography" });
5866
+ staticUtility("text-lg", [["font-size", "var(--text-lg)"], ["line-height", "var(--baro-leading, var(--text-lg--line-height))"]], { category: "typography" });
5867
+ staticUtility("text-xl", [["font-size", "var(--text-xl)"], ["line-height", "var(--baro-leading, var(--text-xl--line-height))"]], { category: "typography" });
5868
+ staticUtility("text-2xl", [["font-size", "var(--text-2xl)"], ["line-height", "var(--baro-leading, var(--text-2xl--line-height))"]], { category: "typography" });
5869
+ staticUtility("text-3xl", [["font-size", "var(--text-3xl)"], ["line-height", "var(--baro-leading, var(--text-3xl--line-height))"]], { category: "typography" });
5870
+ staticUtility("text-4xl", [["font-size", "var(--text-4xl)"], ["line-height", "var(--baro-leading, var(--text-4xl--line-height))"]], { category: "typography" });
5871
+ staticUtility("text-5xl", [["font-size", "var(--text-5xl)"], ["line-height", "var(--baro-leading, var(--text-5xl--line-height))"]], { category: "typography" });
5872
+ staticUtility("text-6xl", [["font-size", "var(--text-6xl)"], ["line-height", "var(--baro-leading, var(--text-6xl--line-height))"]], { category: "typography" });
5873
+ staticUtility("text-7xl", [["font-size", "var(--text-7xl)"], ["line-height", "var(--baro-leading, var(--text-7xl--line-height))"]], { category: "typography" });
5874
+ staticUtility("text-8xl", [["font-size", "var(--text-8xl)"], ["line-height", "var(--baro-leading, var(--text-8xl--line-height))"]], { category: "typography" });
5875
+ staticUtility("text-9xl", [["font-size", "var(--text-9xl)"], ["line-height", "var(--baro-leading, var(--text-9xl--line-height))"]], { category: "typography" });
5490
5876
  staticUtility("font-thin", [["font-weight", "var(--font-weight-thin)"]], { category: "typography" });
5491
5877
  staticUtility("font-extralight", [["font-weight", "var(--font-weight-extralight)"]], { category: "typography" });
5492
5878
  staticUtility("font-light", [["font-weight", "var(--font-weight-light)"]], { category: "typography" });
@@ -5532,12 +5918,12 @@ functionalUtility({
5532
5918
  description: "letter-spacing utility (theme, arbitrary, custom property supported)",
5533
5919
  category: "typography"
5534
5920
  });
5535
- staticUtility("leading-none", [["line-height", "var(--line-height-none)"]], { category: "typography" });
5536
- staticUtility("leading-tight", [["line-height", "var(--line-height-tight)"]], { category: "typography" });
5537
- staticUtility("leading-snug", [["line-height", "var(--line-height-snug)"]], { category: "typography" });
5538
- staticUtility("leading-normal", [["line-height", "var(--line-height-normal)"]], { category: "typography" });
5539
- staticUtility("leading-relaxed", [["line-height", "var(--line-height-relaxed)"]], { category: "typography" });
5540
- staticUtility("leading-loose", [["line-height", "var(--line-height-loose)"]], { category: "typography" });
5921
+ staticUtility("leading-none", [["--baro-leading", "var(--leading-none, 1)"], ["line-height", "var(--leading-none, 1)"], leadingProperty()], { category: "typography" });
5922
+ staticUtility("leading-tight", [["--baro-leading", "var(--leading-tight, 1.25)"], ["line-height", "var(--leading-tight, 1.25)"], leadingProperty()], { category: "typography" });
5923
+ staticUtility("leading-snug", [["--baro-leading", "var(--leading-snug, 1.375)"], ["line-height", "var(--leading-snug, 1.375)"], leadingProperty()], { category: "typography" });
5924
+ staticUtility("leading-normal", [["--baro-leading", "var(--leading-normal, 1.5)"], ["line-height", "var(--leading-normal, 1.5)"], leadingProperty()], { category: "typography" });
5925
+ staticUtility("leading-relaxed", [["--baro-leading", "var(--leading-relaxed, 1.625)"], ["line-height", "var(--leading-relaxed, 1.625)"], leadingProperty()], { category: "typography" });
5926
+ staticUtility("leading-loose", [["--baro-leading", "var(--leading-loose, 2)"], ["line-height", "var(--leading-loose, 2)"], leadingProperty()], { category: "typography" });
5541
5927
  functionalUtility({
5542
5928
  name: "leading",
5543
5929
  prop: "line-height",
@@ -5545,6 +5931,8 @@ functionalUtility({
5545
5931
  supportsArbitrary: true,
5546
5932
  supportsCustomProperty: true,
5547
5933
  handleBareValue: ({ value }) => parseNumber(value),
5934
+ handle: (value) => [decl("--baro-leading", value), decl("line-height", value), leadingProperty()],
5935
+ handleCustomProperty: (value) => [decl("--baro-leading", `var(${value})`), decl("line-height", `var(${value})`), leadingProperty()],
5548
5936
  description: "line-height utility (theme, number, arbitrary, custom property supported)",
5549
5937
  category: "typography"
5550
5938
  });
@@ -5554,6 +5942,17 @@ staticUtility("text-right", [["text-align", "right"]], { category: "typography"
5554
5942
  staticUtility("text-justify", [["text-align", "justify"]], { category: "typography" });
5555
5943
  staticUtility("text-start", [["text-align", "start"]], { category: "typography" });
5556
5944
  staticUtility("text-end", [["text-align", "end"]], { category: "typography" });
5945
+ const FONT_SIZE_HINTS = /* @__PURE__ */ new Set(["length", "size", "percentage", "absolute-size", "relative-size"]);
5946
+ const FONT_SIZE_KEYWORDS = /^(xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller)$/;
5947
+ const LENGTH_RE = /^-?(\d+\.?\d*|\.\d+)(px|r?em|r?lh|r?cap|r?ch|r?ex|r?ic|%|vh|vw|vmin|vmax|[sdl]v[hwib]|v[ib]|cq[whib]|cqmin|cqmax|pt|pc|in|cm|mm|q)$/i;
5948
+ function textArbitraryKind(raw2) {
5949
+ const hint = /^([a-z-]+):(.+)$/.exec(raw2);
5950
+ if (hint && (hint[1] === "color" || FONT_SIZE_HINTS.has(hint[1]))) {
5951
+ return { fontSize: hint[1] !== "color", value: hint[2] };
5952
+ }
5953
+ const fontSize = raw2 === "0" || LENGTH_RE.test(raw2) || FONT_SIZE_KEYWORDS.test(raw2) || /^(calc|min|max|clamp)\(/.test(raw2);
5954
+ return { fontSize, value: raw2 };
5955
+ }
5557
5956
  staticUtility("text-inherit", [["color", "inherit"]], { category: "typography" });
5558
5957
  staticUtility("text-current", [["color", "currentColor"]], { category: "typography" });
5559
5958
  staticUtility("text-transparent", [["color", "transparent"]], { category: "typography" });
@@ -5567,27 +5966,14 @@ functionalUtility({
5567
5966
  supportsCustomProperty: true,
5568
5967
  supportsOpacity: true,
5569
5968
  handle: (value, ctx, token, extra) => {
5570
- if (extra?.realThemeValue) {
5571
- if (extra.opacity) {
5572
- return [
5573
- atRule("supports", `(color:color-mix(in lab, red, red))`, [
5574
- decl("color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
5575
- ]),
5576
- decl("color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
5577
- ];
5578
- }
5579
- return [decl("color", value)];
5580
- }
5581
- if (parseLength(value)) {
5582
- return [decl("font-size", value)];
5583
- }
5584
- return [decl("color", value)];
5969
+ if (extra?.realThemeValue) return themeColorDecls("color", value, extra);
5970
+ const kind = textArbitraryKind(value);
5971
+ return [decl(kind.fontSize ? "font-size" : "color", kind.value)];
5585
5972
  },
5973
+ // Tailwind 4: text-(--x) is a colour; text-(length:--x) is a font-size.
5586
5974
  handleCustomProperty: (value) => {
5587
- if (value.startsWith("color:")) {
5588
- return [decl("color", `var(${value.replace("color:", "")})`)];
5589
- }
5590
- return [decl("font-size", `var(${value})`)];
5975
+ const kind = textArbitraryKind(value);
5976
+ return [decl(kind.fontSize ? "font-size" : "color", `var(${kind.value})`)];
5591
5977
  },
5592
5978
  description: "text color utility (theme, arbitrary, custom property supported)",
5593
5979
  category: "typography"
@@ -5603,7 +5989,7 @@ functionalUtility({
5603
5989
  if (Array.isArray(themeValue)) {
5604
5990
  return [
5605
5991
  decl("font-size", themeValue[0]),
5606
- decl("line-height", themeValue[1])
5992
+ decl("line-height", `var(--baro-leading, ${themeValue[1]})`)
5607
5993
  ];
5608
5994
  } else {
5609
5995
  return [decl("font-size", themeValue)];
@@ -5717,17 +6103,7 @@ functionalUtility({
5717
6103
  supportsCustomProperty: true,
5718
6104
  supportsOpacity: true,
5719
6105
  handle: (value, ctx, token, extra) => {
5720
- if (extra?.realThemeValue) {
5721
- if (extra.opacity) {
5722
- return [
5723
- atRule("supports", `(color:color-mix(in lab, red, red))`, [
5724
- decl("text-decoration-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
5725
- ]),
5726
- decl("text-decoration-color", value)
5727
- ];
5728
- }
5729
- return [decl("text-decoration-color", value)];
5730
- }
6106
+ if (extra?.realThemeValue) return themeColorDecls("text-decoration-color", value, extra);
5731
6107
  return [decl("text-decoration-color", value)];
5732
6108
  },
5733
6109
  handleCustomProperty: (value) => [decl("text-decoration-color", `var(${value})`)],
@@ -5751,7 +6127,7 @@ functionalUtility({
5751
6127
  prop: "text-decoration-thickness",
5752
6128
  supportsArbitrary: true,
5753
6129
  supportsCustomProperty: true,
5754
- handleBareValue: ({ value }) => `${value}px`,
6130
+ handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
5755
6131
  description: "text-decoration-thickness utility (arbitrary, custom property supported)",
5756
6132
  category: "typography"
5757
6133
  });
@@ -5766,7 +6142,7 @@ functionalUtility({
5766
6142
  prop: "text-underline-offset",
5767
6143
  supportsArbitrary: true,
5768
6144
  supportsCustomProperty: true,
5769
- handleBareValue: ({ value }) => `${value}px`,
6145
+ handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
5770
6146
  description: "text-underline-offset utility (arbitrary, custom property supported)",
5771
6147
  category: "typography"
5772
6148
  });
@@ -5780,8 +6156,8 @@ functionalUtility({
5780
6156
  supportsNegative: true,
5781
6157
  supportsArbitrary: true,
5782
6158
  supportsCustomProperty: true,
5783
- handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
5784
- handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})`,
6159
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
6160
+ handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
5785
6161
  description: "text-indent utility (spacing, negative, arbitrary, custom property supported)",
5786
6162
  category: "typography"
5787
6163
  });
@@ -5804,14 +6180,14 @@ functionalUtility({
5804
6180
  staticUtility("hyphens-none", [["hyphens", "none"]], { category: "typography" });
5805
6181
  staticUtility("hyphens-manual", [["hyphens", "manual"]], { category: "typography" });
5806
6182
  staticUtility("hyphens-auto", [["hyphens", "auto"]], { category: "typography" });
5807
- staticUtility("content-none", [["content", "none"]], { category: "typography" });
6183
+ staticUtility("content-none", [["--baro-content", "none"], ["content", "none"]], { category: "typography" });
5808
6184
  functionalUtility({
5809
6185
  name: "content",
5810
6186
  prop: "content",
5811
6187
  supportsArbitrary: true,
5812
6188
  supportsCustomProperty: true,
5813
- handle: (value) => [decl("content", `"${value}"`)],
5814
- handleCustomProperty: (value) => [decl("content", `var(${value})`)],
6189
+ handle: (value) => [decl("--baro-content", `"${value}"`), decl("content", "var(--baro-content)")],
6190
+ handleCustomProperty: (value) => [decl("--baro-content", `var(${value})`), decl("content", "var(--baro-content)")],
5815
6191
  description: "content utility (arbitrary, custom property supported)",
5816
6192
  category: "typography"
5817
6193
  });
@@ -5821,7 +6197,8 @@ const gradientStopProperties = () => {
5821
6197
  property("--baro-gradient-from", "#0000", "<color>"),
5822
6198
  property("--baro-gradient-via", "#0000", "<color>"),
5823
6199
  property("--baro-gradient-to", "#0000", "<color>"),
5824
- property("--baro-gradient-stops", "transparent"),
6200
+ property("--baro-gradient-stops"),
6201
+ property("--baro-gradient-via-stops"),
5825
6202
  property("--baro-gradient-from-position", "0%", "<length-percentage>"),
5826
6203
  property("--baro-gradient-via-position", "50%", "<length-percentage>"),
5827
6204
  property("--baro-gradient-to-position", "100%", "<length-percentage>")
@@ -5878,19 +6255,18 @@ functionalUtility({
5878
6255
  supportsCustomProperty: true,
5879
6256
  description: "background-size utility (arbitrary, custom property supported)",
5880
6257
  category: "background"
5881
- });
5882
- const positionValue = (position) => {
5883
- return [
5884
- decl("--baro-gradient-position", position),
5885
- styleRule("@supports (background-image: linear-gradient(in lab, red, red))", [
5886
- decl("--baro-gradient-position", `${position} in oklab`)
5887
- ]),
5888
- decl(
5889
- "background-image",
5890
- `linear-gradient(${position}, var(--baro-gradient-stops))`
5891
- )
5892
- ];
5893
- };
6258
+ });
6259
+ const positionValue = (position) => [
6260
+ decl("--baro-gradient-position", position),
6261
+ atRule("supports", "(background-image: linear-gradient(in lab, red, red))", [
6262
+ decl("--baro-gradient-position", `${position} in oklab`)
6263
+ ]),
6264
+ decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
6265
+ ];
6266
+ const legacyPositionValue = (position) => [
6267
+ decl("--baro-gradient-position", `${position} in oklab`),
6268
+ decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
6269
+ ];
5894
6270
  [
5895
6271
  ["bg-linear-to-t", positionValue("to top")],
5896
6272
  ["bg-linear-to-tr", positionValue("to top right")],
@@ -5901,14 +6277,14 @@ const positionValue = (position) => {
5901
6277
  ["bg-linear-to-l", positionValue("to left")],
5902
6278
  ["bg-linear-to-tl", positionValue("to top left")],
5903
6279
  // fallback , legacy CSS compatibility
5904
- ["bg-gradient-to-t", positionValue("to top")],
5905
- ["bg-gradient-to-tr", positionValue("to top right")],
5906
- ["bg-gradient-to-r", positionValue("to right")],
5907
- ["bg-gradient-to-br", positionValue("to bottom right")],
5908
- ["bg-gradient-to-b", positionValue("to bottom")],
5909
- ["bg-gradient-to-bl", positionValue("to bottom left")],
5910
- ["bg-gradient-to-l", positionValue("to left")],
5911
- ["bg-gradient-to-tl", positionValue("to top left")]
6280
+ ["bg-gradient-to-t", legacyPositionValue("to top")],
6281
+ ["bg-gradient-to-tr", legacyPositionValue("to top right")],
6282
+ ["bg-gradient-to-r", legacyPositionValue("to right")],
6283
+ ["bg-gradient-to-br", legacyPositionValue("to bottom right")],
6284
+ ["bg-gradient-to-b", legacyPositionValue("to bottom")],
6285
+ ["bg-gradient-to-bl", legacyPositionValue("to bottom left")],
6286
+ ["bg-gradient-to-l", legacyPositionValue("to left")],
6287
+ ["bg-gradient-to-tl", legacyPositionValue("to top left")]
5912
6288
  ].forEach(([name, value]) => {
5913
6289
  staticUtility(name, value, { category: "background", priority: 1e3 });
5914
6290
  });
@@ -5919,12 +6295,7 @@ functionalUtility({
5919
6295
  supportsCustomProperty: true,
5920
6296
  handle: (value, context, token) => {
5921
6297
  if (parseNumber(value)) {
5922
- return [
5923
- decl(
5924
- "background-image",
5925
- `linear-gradient(${value}deg in oklab, var(--baro-gradient-stops))`
5926
- )
5927
- ];
6298
+ return positionValue(`${value}deg`);
5928
6299
  }
5929
6300
  if (token.arbitrary) {
5930
6301
  return [
@@ -5953,79 +6324,60 @@ functionalUtility({
5953
6324
  description: "linear-gradient background-image utility (angle, arbitrary, custom property supported)",
5954
6325
  category: "background"
5955
6326
  });
5956
- staticUtility("bg-radial", [
5957
- ["background-image", "radial-gradient(in oklab, var(--baro-gradient-stops))"]
5958
- ], { category: "background" });
6327
+ const gradientImage = (fn, position, fallback) => [
6328
+ decl("--baro-gradient-position", position),
6329
+ decl("background-image", `${fn}(var(--baro-gradient-stops${fallback ? `,${fallback}` : ""}))`)
6330
+ ];
6331
+ staticUtility("bg-radial", gradientImage("radial-gradient", "in oklab"), { category: "background" });
5959
6332
  functionalUtility({
5960
6333
  name: "bg-radial",
5961
6334
  prop: "background-image",
5962
6335
  supportsArbitrary: true,
5963
6336
  supportsCustomProperty: true,
5964
- handle: (value, context, token) => {
5965
- if (token.arbitrary) {
5966
- return [
5967
- decl(
5968
- "background-image",
5969
- `radial-gradient(var(--baro-gradient-stops, ${value}))`
5970
- )
5971
- ];
5972
- }
5973
- if (token.customProperty) {
5974
- return [
5975
- decl(
5976
- "background-image",
5977
- `radial-gradient(var(--baro-gradient-stops, var(${value})))`
5978
- )
5979
- ];
5980
- }
6337
+ handle: (value, _context, token) => {
6338
+ if (token.arbitrary) return gradientImage("radial-gradient", value, value);
6339
+ if (token.customProperty) return gradientImage("radial-gradient", `var(${value})`, `var(${value})`);
5981
6340
  return null;
5982
6341
  },
5983
- handleCustomProperty: (value) => [
5984
- decl(
5985
- "background-image",
5986
- `radial-gradient(var(--baro-gradient-stops, var(${value})))`
5987
- )
5988
- ],
6342
+ handleCustomProperty: (value) => gradientImage("radial-gradient", `var(${value})`, `var(${value})`),
5989
6343
  description: "radial-gradient background-image utility (arbitrary, custom property supported)",
5990
6344
  category: "background"
5991
6345
  });
5992
- staticUtility("bg-conic", [
5993
- [
5994
- "background-image",
5995
- "conic-gradient(from 0deg in oklab, var(--baro-gradient-stops))"
5996
- ]
5997
- ], { category: "background" });
6346
+ staticUtility("bg-conic", gradientImage("conic-gradient", "in oklab"), { category: "background" });
5998
6347
  functionalUtility({
5999
6348
  name: "bg-conic",
6000
6349
  prop: "background-image",
6001
6350
  supportsArbitrary: true,
6002
6351
  supportsCustomProperty: true,
6003
- handle: (value, context, token) => {
6004
- if (parseNumber(value)) {
6005
- return [
6006
- decl(
6007
- "background-image",
6008
- `conic-gradient(from ${value}deg in oklab, var(--baro-gradient-stops))`
6009
- )
6010
- ];
6011
- }
6012
- if (token.arbitrary) {
6013
- return [decl("background-image", `${value}`)];
6014
- }
6015
- if (token.customProperty) {
6016
- return [
6017
- decl(
6018
- "background-image",
6019
- `conic-gradient(var(--baro-gradient-stops, var(${value})))`
6020
- )
6021
- ];
6352
+ handle: (value, _context, token) => {
6353
+ if (!token.arbitrary && !token.customProperty && parseNumber(value)) {
6354
+ return gradientImage("conic-gradient", `from ${value}deg in oklab`);
6022
6355
  }
6356
+ if (token.arbitrary) return gradientImage("conic-gradient", value, value);
6357
+ if (token.customProperty) return gradientImage("conic-gradient", `var(${value})`, `var(${value})`);
6023
6358
  return null;
6024
6359
  },
6025
- handleCustomProperty: (value) => [decl("background-image", `var(${value})`)],
6360
+ handleCustomProperty: (value) => gradientImage("conic-gradient", `var(${value})`, `var(${value})`),
6026
6361
  description: "conic-gradient background-image utility (angle, arbitrary, custom property supported)",
6027
6362
  category: "background"
6028
6363
  });
6364
+ const G = "--baro-gradient";
6365
+ const stopsDecls = (stop, color) => {
6366
+ const colorDecls = typeof color === "string" ? [decl(`${G}-${stop}`, color)] : color;
6367
+ if (stop === "via") {
6368
+ return [
6369
+ gradientStopProperties(),
6370
+ ...colorDecls,
6371
+ decl(`${G}-via-stops`, `var(${G}-position), var(${G}-from) var(${G}-from-position), var(${G}-via) var(${G}-via-position), var(${G}-to) var(${G}-to-position)`),
6372
+ decl(`${G}-stops`, `var(${G}-via-stops)`)
6373
+ ];
6374
+ }
6375
+ return [
6376
+ gradientStopProperties(),
6377
+ ...colorDecls,
6378
+ decl(`${G}-stops`, `var(${G}-via-stops, var(${G}-position), var(${G}-from) var(${G}-from-position), var(${G}-to) var(${G}-to-position))`)
6379
+ ];
6380
+ };
6029
6381
  ["from", "via", "to"].forEach((stop) => {
6030
6382
  functionalUtility({
6031
6383
  name: stop,
@@ -6033,72 +6385,18 @@ functionalUtility({
6033
6385
  supportsArbitrary: true,
6034
6386
  supportsCustomProperty: true,
6035
6387
  supportsOpacity: true,
6036
- handle: (value, context, token, extra) => {
6388
+ handle: (value, _context, _token, extra) => {
6037
6389
  if (extra?.realThemeValue) {
6038
- if (stop === "from") {
6039
- let color = value;
6040
- if (extra?.opacity) {
6041
- color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
6042
- }
6043
- return [
6044
- gradientStopProperties(),
6045
- decl(`--baro-gradient-from`, color),
6046
- // decl(`--baro-gradient-to`, "var(--baro-gradient-to, transparent)"),
6047
- decl(`--baro-gradient-stops`, "var(--baro-gradient-from),var(--baro-gradient-to)")
6048
- ];
6049
- }
6050
- if (stop === "via") {
6051
- let color = value;
6052
- if (extra?.opacity) {
6053
- color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
6054
- }
6055
- return [
6056
- gradientStopProperties(),
6057
- decl(`--baro-gradient-to`, color),
6058
- decl(`--baro-gradient-stops`, `var(--baro-gradient-from), ${value} var(--baro-gradient-via-position), var(--baro-gradient-to)`)
6059
- // via 포함 stops
6060
- ];
6061
- }
6062
- if (stop === "to") {
6063
- let color = value;
6064
- if (extra?.opacity) {
6065
- color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
6066
- }
6067
- return [
6068
- gradientStopProperties(),
6069
- decl(`--baro-gradient-to`, color)
6070
- ];
6071
- }
6390
+ return stopsDecls(stop, themeColorDecls(`${G}-${stop}`, value, extra));
6072
6391
  }
6073
6392
  if (parseLength(value)) {
6074
- return [decl(`--baro-gradient-${stop}-position`, value)];
6393
+ return [gradientStopProperties(), decl(`${G}-${stop}-position`, value)];
6075
6394
  }
6076
6395
  if (parseNumber(value)) {
6077
- return [decl(`--baro-gradient-${stop}-position`, `${value}%`)];
6396
+ return [gradientStopProperties(), decl(`${G}-${stop}-position`, `${value}%`)];
6078
6397
  }
6079
6398
  if (parseColor(value)) {
6080
- if (stop === "from") {
6081
- return [
6082
- gradientStopProperties(),
6083
- decl(`--baro-gradient-from`, value),
6084
- decl(`--baro-gradient-to`, "transparent"),
6085
- decl(`--baro-gradient-stops`, "var(--baro-gradient-from),var(--baro-gradient-to)")
6086
- ];
6087
- }
6088
- if (stop === "via") {
6089
- return [
6090
- gradientStopProperties(),
6091
- decl(`--baro-gradient-to`, value),
6092
- decl(`--baro-gradient-stops`, `var(--baro-gradient-from), ${value} var(--baro-gradient-via-position), var(--baro-gradient-to)`)
6093
- // via 포함 stops
6094
- ];
6095
- }
6096
- if (stop === "to") {
6097
- return [
6098
- gradientStopProperties(),
6099
- decl(`--baro-gradient-to`, value)
6100
- ];
6101
- }
6399
+ return stopsDecls(stop, value);
6102
6400
  }
6103
6401
  return null;
6104
6402
  },
@@ -6133,20 +6431,7 @@ functionalUtility({
6133
6431
  if (value.startsWith("length:")) {
6134
6432
  return [decl("background-size", value.replace("length:", ""))];
6135
6433
  }
6136
- if (extra?.realThemeValue) {
6137
- if (extra.opacity) {
6138
- return [
6139
- atRule("supports", `(color:color-mix(in lab, red, red))`, [
6140
- decl(
6141
- "background-color",
6142
- `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`
6143
- )
6144
- ]),
6145
- decl("background-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
6146
- ];
6147
- }
6148
- return [decl("background-color", value)];
6149
- }
6434
+ if (extra?.realThemeValue) return themeColorDecls("background-color", value, extra);
6150
6435
  if (parseColor(value)) {
6151
6436
  const parsedColor = parseColor(value);
6152
6437
  if (value.startsWith("color:")) {
@@ -6159,18 +6444,20 @@ functionalUtility({
6159
6444
  }
6160
6445
  return null;
6161
6446
  },
6162
- handleCustomProperty: (value) => [decl("background-size", `var(${value})`)],
6447
+ handleCustomProperty: (value) => value.startsWith("length:") ? [decl("background-size", `var(${value.slice(7)})`)] : [decl("background-color", `var(${value})`)],
6163
6448
  description: "background-size utility (arbitrary, custom property supported)",
6164
6449
  category: "background"
6165
6450
  });
6166
6451
  staticUtility("rounded-none", [["border-radius", "0px"]], { category: "borders" });
6167
6452
  staticUtility("rounded-sm", [["border-radius", "var(--radius-sm)"]], { category: "borders" });
6168
- staticUtility("rounded", [["border-radius", "var(--radius)"]], { category: "borders" });
6453
+ staticUtility("rounded", [["border-radius", "0.25rem"]], { category: "borders" });
6169
6454
  staticUtility("rounded-md", [["border-radius", "var(--radius-md)"]], { category: "borders" });
6170
6455
  staticUtility("rounded-lg", [["border-radius", "var(--radius-lg)"]], { category: "borders" });
6171
6456
  staticUtility("rounded-xl", [["border-radius", "var(--radius-xl)"]], { category: "borders" });
6172
6457
  staticUtility("rounded-2xl", [["border-radius", "var(--radius-2xl)"]], { category: "borders" });
6173
6458
  staticUtility("rounded-3xl", [["border-radius", "var(--radius-3xl)"]], { category: "borders" });
6459
+ staticUtility("rounded-4xl", [["border-radius", "var(--radius-4xl)"]], { category: "borders" });
6460
+ staticUtility("rounded-xs", [["border-radius", "var(--radius-xs)"]], { category: "borders" });
6174
6461
  staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "borders" });
6175
6462
  [
6176
6463
  ["rounded-t", ["border-top-left-radius", "border-top-right-radius"]],
@@ -6185,12 +6472,14 @@ staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "border
6185
6472
  const propList = props;
6186
6473
  staticUtility(`${name}-none`, propList.map((prop) => [prop, "0px"]), { category: "borders" });
6187
6474
  staticUtility(`${name}-sm`, propList.map((prop) => [prop, "var(--radius-sm)"]), { category: "borders" });
6188
- staticUtility(`${name}`, propList.map((prop) => [prop, "var(--radius)"]), { category: "borders" });
6475
+ staticUtility(`${name}`, propList.map((prop) => [prop, "0.25rem"]), { category: "borders" });
6189
6476
  staticUtility(`${name}-md`, propList.map((prop) => [prop, "var(--radius-md)"]), { category: "borders" });
6190
6477
  staticUtility(`${name}-lg`, propList.map((prop) => [prop, "var(--radius-lg)"]), { category: "borders" });
6191
6478
  staticUtility(`${name}-xl`, propList.map((prop) => [prop, "var(--radius-xl)"]), { category: "borders" });
6192
6479
  staticUtility(`${name}-2xl`, propList.map((prop) => [prop, "var(--radius-2xl)"]), { category: "borders" });
6193
6480
  staticUtility(`${name}-3xl`, propList.map((prop) => [prop, "var(--radius-3xl)"]), { category: "borders" });
6481
+ staticUtility(`${name}-4xl`, propList.map((prop) => [prop, "var(--radius-4xl)"]), { category: "borders" });
6482
+ staticUtility(`${name}-xs`, propList.map((prop) => [prop, "var(--radius-xs)"]), { category: "borders" });
6194
6483
  staticUtility(`${name}-full`, propList.map((prop) => [prop, "9999px"]), { category: "borders" });
6195
6484
  functionalUtility({
6196
6485
  name,
@@ -6221,11 +6510,15 @@ functionalUtility({
6221
6510
  description: "border-radius utility (spacing, arbitrary, custom property support)",
6222
6511
  category: "borders"
6223
6512
  });
6224
- staticUtility("border-0", [["border-width", "0px"]], { category: "borders" });
6225
- staticUtility("border-2", [["border-width", "2px"]], { category: "borders" });
6226
- staticUtility("border-4", [["border-width", "4px"]], { category: "borders" });
6227
- staticUtility("border-8", [["border-width", "8px"]], { category: "borders" });
6228
- staticUtility("border", [["border-width", "1px"]], { category: "borders" });
6513
+ const borderStyleProperty = () => atRoot([property("--baro-border-style", "solid")]);
6514
+ const withBorderStyle = (props, width) => [
6515
+ borderStyleProperty(),
6516
+ ...props.map((prop) => decl(prop.replace("width", "style"), "var(--baro-border-style)")),
6517
+ ...props.map((prop) => decl(prop, width))
6518
+ ];
6519
+ [["border-0", "0px"], ["border-2", "2px"], ["border-4", "4px"], ["border-8", "8px"], ["border", "1px"]].forEach(([name, width]) => {
6520
+ staticUtility(name, [borderStyleProperty, ["border-style", "var(--baro-border-style)"], ["border-width", width]], { category: "borders" });
6521
+ });
6229
6522
  [
6230
6523
  ["border-x", ["border-left-width", "border-right-width"]],
6231
6524
  ["border-y", ["border-top-width", "border-bottom-width"]],
@@ -6235,11 +6528,16 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
6235
6528
  ["border-l", ["border-left-width"]]
6236
6529
  ].forEach(([name, props]) => {
6237
6530
  const propList = props;
6238
- staticUtility(`${name}-0`, propList.map((prop) => [prop, "0px"]));
6239
- staticUtility(`${name}-2`, propList.map((prop) => [prop, "2px"]));
6240
- staticUtility(`${name}-4`, propList.map((prop) => [prop, "4px"]));
6241
- staticUtility(`${name}-8`, propList.map((prop) => [prop, "8px"]));
6242
- staticUtility(`${name}`, propList.map((prop) => [prop, "1px"]));
6531
+ const styled = (width) => [
6532
+ borderStyleProperty,
6533
+ ...propList.map((prop) => [prop.replace("width", "style"), "var(--baro-border-style)"]),
6534
+ ...propList.map((prop) => [prop, width])
6535
+ ];
6536
+ staticUtility(`${name}-0`, styled("0px"));
6537
+ staticUtility(`${name}-2`, styled("2px"));
6538
+ staticUtility(`${name}-4`, styled("4px"));
6539
+ staticUtility(`${name}-8`, styled("8px"));
6540
+ staticUtility(`${name}`, styled("1px"));
6243
6541
  functionalUtility({
6244
6542
  name,
6245
6543
  themeKeys: ["borderWidth", "colors"],
@@ -6251,18 +6549,19 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
6251
6549
  }
6252
6550
  return null;
6253
6551
  },
6254
- handle: (value, ctx, token) => {
6552
+ handle: (value, ctx, token, extra) => {
6553
+ if (extra?.realThemeValue) return propList.flatMap((prop) => themeColorDecls(prop.replace("width", "color"), value, extra));
6255
6554
  if (parseColor(value)) {
6256
6555
  return propList.map((prop) => decl(prop.replace("width", "color"), value));
6257
6556
  }
6258
6557
  if (token.arbitrary) {
6259
- return propList.map((prop) => decl(prop, value));
6558
+ return withBorderStyle(propList, value);
6260
6559
  }
6261
6560
  return null;
6262
6561
  },
6263
6562
  handleCustomProperty: (value) => {
6264
6563
  if (value.startsWith("length:")) {
6265
- return propList.map((prop) => decl(prop, `var(${value.replace("length:", "")})`));
6564
+ return withBorderStyle(propList, `var(${value.replace("length:", "")})`);
6266
6565
  }
6267
6566
  return propList.map((prop) => decl(prop.replace("width", "color"), `var(${value})`));
6268
6567
  },
@@ -6273,12 +6572,35 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
6273
6572
  staticUtility("border-inherit", [["border-color", "inherit"]], { category: "borders" });
6274
6573
  staticUtility("border-current", [["border-color", "currentColor"]], { category: "borders" });
6275
6574
  staticUtility("border-transparent", [["border-color", "transparent"]], { category: "borders" });
6276
- staticUtility("border-solid", [["border-style", "solid"]], { category: "borders" });
6277
- staticUtility("border-dashed", [["border-style", "dashed"]], { category: "borders" });
6278
- staticUtility("border-dotted", [["border-style", "dotted"]], { category: "borders" });
6279
- staticUtility("border-double", [["border-style", "double"]], { category: "borders" });
6280
- staticUtility("border-hidden", [["border-style", "hidden"]], { category: "borders" });
6281
- staticUtility("border-none", [["border-style", "none"]], { category: "borders" });
6575
+ staticUtility("border-solid", [["--baro-border-style", "solid"], ["border-style", "solid"]], { category: "borders" });
6576
+ staticUtility("border-dashed", [["--baro-border-style", "dashed"], ["border-style", "dashed"]], { category: "borders" });
6577
+ staticUtility("border-dotted", [["--baro-border-style", "dotted"], ["border-style", "dotted"]], { category: "borders" });
6578
+ staticUtility("border-double", [["--baro-border-style", "double"], ["border-style", "double"]], { category: "borders" });
6579
+ staticUtility("border-hidden", [["--baro-border-style", "hidden"], ["border-style", "hidden"]], { category: "borders" });
6580
+ staticUtility("border-none", [["--baro-border-style", "none"], ["border-style", "none"]], { category: "borders" });
6581
+ const divideSides = { x: ["border-inline-start", "border-inline-end", "border-inline-style"], y: ["border-top", "border-bottom", "border-bottom-style", "border-top-style"] };
6582
+ Object.entries(divideSides).forEach(([axis, [start, end, ...styles]]) => {
6583
+ const rev = `--baro-divide-${axis}-reverse`;
6584
+ const divide = (width) => [
6585
+ borderStyleProperty(),
6586
+ rule(":where(& > :not(:last-child))", [
6587
+ decl(rev, "0"),
6588
+ ...styles.map((s) => decl(s, "var(--baro-border-style)")),
6589
+ decl(`${start}-width`, `calc(${width} * var(${rev}))`),
6590
+ decl(`${end}-width`, `calc(${width} * calc(1 - var(${rev})))`)
6591
+ ])
6592
+ ];
6593
+ staticUtility(`divide-${axis}`, divide("1px"), { category: "borders" });
6594
+ staticUtility(`divide-${axis}-reverse`, [rule(":where(& > :not(:last-child))", [decl(rev, "1")])], { category: "borders" });
6595
+ functionalUtility({
6596
+ name: `divide-${axis}`,
6597
+ supportsArbitrary: true,
6598
+ handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}px` : null,
6599
+ handle: (value) => divide(value),
6600
+ description: `divide-${axis} width utility`,
6601
+ category: "borders"
6602
+ });
6603
+ });
6282
6604
  functionalUtility({
6283
6605
  name: "border",
6284
6606
  themeKeys: ["colors", "borderWidth"],
@@ -6286,25 +6608,15 @@ functionalUtility({
6286
6608
  supportsCustomProperty: true,
6287
6609
  supportsOpacity: true,
6288
6610
  handle: (value, ctx, token, extra) => {
6289
- if (extra?.realThemeValue) {
6290
- if (extra.opacity) {
6291
- return [
6292
- atRule("supports", `(color:color-mix(in lab, red, red))`, [
6293
- decl("border-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
6294
- ]),
6295
- decl("border-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
6296
- ];
6297
- }
6298
- return [decl("border-color", value)];
6299
- }
6611
+ if (extra?.realThemeValue) return themeColorDecls("border-color", value, extra);
6300
6612
  if (token.arbitrary) {
6301
6613
  if (parseLength(value)) {
6302
- return [decl("border-width", value)];
6614
+ return withBorderStyle(["border-width"], value);
6303
6615
  }
6304
6616
  return [decl("border-color", value)];
6305
6617
  }
6306
6618
  if (parseNumber(value)) {
6307
- return [decl("border-width", `${value}px`)];
6619
+ return withBorderStyle(["border-width"], `${value}px`);
6308
6620
  }
6309
6621
  if (parseColor(value)) {
6310
6622
  return [decl("border-color", value)];
@@ -6313,26 +6625,35 @@ functionalUtility({
6313
6625
  },
6314
6626
  handleCustomProperty: (value) => {
6315
6627
  if (value.startsWith("length:")) {
6316
- return [decl("border-width", `var(${value.replace("length:", "")})`)];
6628
+ return withBorderStyle(["border-width"], `var(${value.replace("length:", "")})`);
6317
6629
  }
6318
6630
  return [decl("border-color", `var(${value})`)];
6319
6631
  },
6320
6632
  description: "border-width utility (number, arbitrary, custom property support)",
6321
6633
  category: "borders"
6322
6634
  });
6323
- staticUtility("outline-0", [["outline-width", "0px"]], { category: "borders" });
6324
- staticUtility("outline-1", [["outline-width", "1px"]], { category: "borders" });
6325
- staticUtility("outline-2", [["outline-width", "2px"]], { category: "borders" });
6326
- staticUtility("outline-4", [["outline-width", "4px"]], { category: "borders" });
6327
- staticUtility("outline-8", [["outline-width", "8px"]], { category: "borders" });
6635
+ const outlineStyleProperty = () => atRoot([property("--baro-outline-style", "solid")]);
6636
+ const withOutlineStyle = (width) => [
6637
+ outlineStyleProperty(),
6638
+ decl("outline-style", "var(--baro-outline-style)"),
6639
+ decl("outline-width", width)
6640
+ ];
6641
+ [["outline-0", "0px"], ["outline-1", "1px"], ["outline-2", "2px"], ["outline-4", "4px"], ["outline-8", "8px"]].forEach(([name, width]) => {
6642
+ staticUtility(name, [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", width]], { category: "borders" });
6643
+ });
6328
6644
  staticUtility("outline-inherit", [["outline-color", "inherit"]], { category: "borders" });
6329
6645
  staticUtility("outline-current", [["outline-color", "currentColor"]], { category: "borders" });
6330
6646
  staticUtility("outline-transparent", [["outline-color", "transparent"]], { category: "borders" });
6331
- staticUtility("outline-none", [["outline", "2px solid transparent"], ["outline-offset", "2px"]], { category: "borders" });
6332
- staticUtility("outline", [["outline-style", "solid"]], { category: "borders" });
6333
- staticUtility("outline-dashed", [["outline-style", "dashed"]], { category: "borders" });
6334
- staticUtility("outline-dotted", [["outline-style", "dotted"]], { category: "borders" });
6335
- staticUtility("outline-double", [["outline-style", "double"]], { category: "borders" });
6647
+ staticUtility("outline-none", [["--baro-outline-style", "none"], ["outline-style", "none"]], { category: "borders" });
6648
+ staticUtility("outline-hidden", [
6649
+ ["--baro-outline-style", "none"],
6650
+ ["outline-style", "none"],
6651
+ atRule("media", "(forced-colors: active)", [decl("outline", "2px solid transparent"), decl("outline-offset", "2px")])
6652
+ ], { category: "borders" });
6653
+ staticUtility("outline", [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", "1px"]], { category: "borders" });
6654
+ ["solid", "dashed", "dotted", "double"].forEach((style) => {
6655
+ staticUtility(`outline-${style}`, [["--baro-outline-style", style], ["outline-style", style]], { category: "borders" });
6656
+ });
6336
6657
  staticUtility("outline-offset-0", [["outline-offset", "0px"]], { category: "borders" });
6337
6658
  staticUtility("outline-offset-1", [["outline-offset", "1px"]], { category: "borders" });
6338
6659
  staticUtility("outline-offset-2", [["outline-offset", "2px"]], { category: "borders" });
@@ -6357,16 +6678,18 @@ functionalUtility({
6357
6678
  themeKeys: ["colors", "borderWidth"],
6358
6679
  supportsArbitrary: true,
6359
6680
  supportsCustomProperty: true,
6360
- handle: (value, ctx, token) => {
6681
+ supportsOpacity: true,
6682
+ handle: (value, ctx, token, extra) => {
6683
+ if (extra?.realThemeValue) return themeColorDecls("outline-color", value, extra);
6361
6684
  if (parseColor(value)) {
6362
6685
  return [decl("outline-color", value)];
6363
6686
  }
6364
6687
  if (parseNumber(value)) {
6365
- return [decl("outline-width", `${value}px`)];
6688
+ return withOutlineStyle(`${value}px`);
6366
6689
  }
6367
6690
  if (token.arbitrary) {
6368
6691
  if (parseLength(value)) {
6369
- return [decl("outline-width", value)];
6692
+ return withOutlineStyle(value);
6370
6693
  }
6371
6694
  return [decl("outline-color", value)];
6372
6695
  }
@@ -6377,7 +6700,7 @@ functionalUtility({
6377
6700
  return [decl("outline-color", value.replace("color:", ""))];
6378
6701
  }
6379
6702
  if (value.startsWith("length:")) {
6380
- return [decl("outline-width", `var(${value.replace("length:", "")})`)];
6703
+ return withOutlineStyle(`var(${value.replace("length:", "")})`);
6381
6704
  }
6382
6705
  return [decl("outline-color", `var(${value})`)];
6383
6706
  },
@@ -6398,6 +6721,40 @@ functionalUtility({
6398
6721
  description: "outline-width utility (number, arbitrary, custom property support)",
6399
6722
  category: "borders"
6400
6723
  });
6724
+ const divideColor = (value) => [rule(":where(& > :not(:last-child))", [decl("border-color", value)])];
6725
+ staticUtility("divide-inherit", divideColor("inherit"), { category: "borders" });
6726
+ staticUtility("divide-current", divideColor("currentColor"), { category: "borders" });
6727
+ staticUtility("divide-transparent", divideColor("transparent"), { category: "borders" });
6728
+ functionalUtility({
6729
+ name: "divide",
6730
+ themeKeys: ["colors"],
6731
+ supportsArbitrary: true,
6732
+ supportsCustomProperty: true,
6733
+ supportsOpacity: true,
6734
+ handle: (value, _ctx, _token, extra) => {
6735
+ if (extra?.realThemeValue) {
6736
+ return [rule(":where(& > :not(:last-child))", themeColorDecls("border-color", value, extra))];
6737
+ }
6738
+ if (parseColor(value)) return divideColor(value);
6739
+ return null;
6740
+ },
6741
+ handleCustomProperty: (value) => divideColor(`var(${value})`),
6742
+ description: "divide-color utility (theme, alpha, arbitrary, custom property)",
6743
+ category: "borders"
6744
+ });
6745
+ const ROTATE_SKEW = "var(--baro-rotate-x,) var(--baro-rotate-y,) var(--baro-rotate-z,) var(--baro-skew-x,) var(--baro-skew-y,)";
6746
+ const rotateAxis = (axis, fn) => [decl(`--baro-rotate-${axis}`, fn), decl("transform", ROTATE_SKEW)];
6747
+ const skewAxis = (axis, fn) => [decl(`--baro-skew-${axis}`, fn), decl("transform", ROTATE_SKEW)];
6748
+ const scaleProperties = () => atRoot([
6749
+ property("--baro-scale-x", "1"),
6750
+ property("--baro-scale-y", "1"),
6751
+ property("--baro-scale-z", "1")
6752
+ ]);
6753
+ const scaleAxis = (axis, v) => [
6754
+ scaleProperties(),
6755
+ decl(`--baro-scale-${axis}`, v),
6756
+ decl("scale", axis === "z" ? "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)" : "var(--baro-scale-x) var(--baro-scale-y)")
6757
+ ];
6401
6758
  staticUtility("transform-none", [["transform", "none"]], {
6402
6759
  category: "transform"
6403
6760
  });
@@ -6406,7 +6763,7 @@ staticUtility(
6406
6763
  [
6407
6764
  [
6408
6765
  "transform",
6409
- "translateZ(0) var(--baro-rotate-x) var(--baro-rotate-y) var(--baro-rotate-z) var(--baro-skew-x) var(--baro-skew-y)"
6766
+ `translateZ(0) ${ROTATE_SKEW}`
6410
6767
  ]
6411
6768
  ],
6412
6769
  { category: "transform" }
@@ -6414,7 +6771,7 @@ staticUtility(
6414
6771
  staticUtility("transform-cpu", [
6415
6772
  [
6416
6773
  "transform",
6417
- "var(--baro-rotate-x) var(--baro-rotate-y) var(--baro-rotate-z) var(--baro-skew-x) var(--baro-skew-y)"
6774
+ ROTATE_SKEW
6418
6775
  ]
6419
6776
  ]);
6420
6777
  staticUtility("transform-3d", [["transform-style", "preserve-3d"]], {
@@ -6543,13 +6900,11 @@ functionalUtility({
6543
6900
  if (parseNumber(value) || negative) {
6544
6901
  const deg = `${Math.abs(Number(value))}deg`;
6545
6902
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6546
- return [decl("transform", `rotateX(${sign}${deg}) var(--baro-rotate-y)`)];
6903
+ return rotateAxis("x", `rotateX(${sign}${deg})`);
6547
6904
  }
6548
- return [decl("transform", `rotateX(${value}) var(--baro-rotate-y)`)];
6905
+ return rotateAxis("x", `rotateX(${value})`);
6549
6906
  },
6550
- handleCustomProperty: (value) => [
6551
- decl("transform", `rotateX(var(${value})) var(--baro-rotate-y)`)
6552
- ],
6907
+ handleCustomProperty: (value) => rotateAxis("x", `rotateX(var(${value}))`),
6553
6908
  description: "rotate-x utility (named, arbitrary, custom property supported)",
6554
6909
  category: "transform"
6555
6910
  });
@@ -6563,13 +6918,11 @@ functionalUtility({
6563
6918
  if (parseNumber(value) || negative) {
6564
6919
  const deg = `${Math.abs(Number(value))}deg`;
6565
6920
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6566
- return [decl("transform", `var(--baro-rotate-x) rotateY(${sign}${deg})`)];
6921
+ return rotateAxis("y", `rotateY(${sign}${deg})`);
6567
6922
  }
6568
- return [decl("transform", `var(--baro-rotate-x) rotateY(${value})`)];
6923
+ return rotateAxis("y", `rotateY(${value})`);
6569
6924
  },
6570
- handleCustomProperty: (value) => [
6571
- decl("transform", `var(--baro-rotate-x) rotateY(var(${value}))`)
6572
- ],
6925
+ handleCustomProperty: (value) => rotateAxis("y", `rotateY(var(${value}))`),
6573
6926
  description: "rotate-y utility (named, arbitrary, custom property supported)",
6574
6927
  category: "transform"
6575
6928
  });
@@ -6583,26 +6936,11 @@ functionalUtility({
6583
6936
  if (parseNumber(value) || negative) {
6584
6937
  const deg = `${Math.abs(Number(value))}deg`;
6585
6938
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6586
- return [
6587
- decl(
6588
- "transform",
6589
- `var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${sign}${deg})`
6590
- )
6591
- ];
6939
+ return rotateAxis("z", `rotateZ(${sign}${deg})`);
6592
6940
  }
6593
- return [
6594
- decl(
6595
- "transform",
6596
- `var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${value})`
6597
- )
6598
- ];
6941
+ return rotateAxis("z", `rotateZ(${value})`);
6599
6942
  },
6600
- handleCustomProperty: (value) => [
6601
- decl(
6602
- "transform",
6603
- `var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(var(${value}))`
6604
- )
6605
- ],
6943
+ handleCustomProperty: (value) => rotateAxis("z", `rotateZ(var(${value}))`),
6606
6944
  description: "rotate-z utility (named, arbitrary, custom property supported)",
6607
6945
  category: "transform"
6608
6946
  });
@@ -6629,7 +6967,7 @@ functionalUtility({
6629
6967
  staticUtility("scale-none", [["scale", "none"]], { category: "transform" });
6630
6968
  staticUtility(
6631
6969
  "scale-3d",
6632
- [["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
6970
+ [scaleProperties, ["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
6633
6971
  { category: "transform" }
6634
6972
  );
6635
6973
  functionalUtility({
@@ -6640,18 +6978,16 @@ functionalUtility({
6640
6978
  supportsNegative: true,
6641
6979
  handle: (value, ctx, { negative, arbitrary }) => {
6642
6980
  if (arbitrary) {
6643
- return [decl("scale", `${value}`)];
6981
+ return scaleAxis("x", value);
6644
6982
  }
6645
6983
  if (parseNumber(value) || negative) {
6646
6984
  const pct = `${Math.abs(Number(value))}%`;
6647
6985
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6648
- return [decl("scale", `calc(${pct} * ${sign}1) var(--baro-scale-y)`)];
6986
+ return scaleAxis("x", `calc(${pct} * ${sign}1)`);
6649
6987
  }
6650
- return [decl("scale", `${value} var(--baro-scale-y)`)];
6988
+ return scaleAxis("x", value);
6651
6989
  },
6652
- handleCustomProperty: (value) => [
6653
- decl("scale", `var(${value}) var(--baro-scale-y)`)
6654
- ],
6990
+ handleCustomProperty: (value) => scaleAxis("x", `var(${value})`),
6655
6991
  description: "scale-x utility (named, arbitrary, custom property supported)",
6656
6992
  category: "transform"
6657
6993
  });
@@ -6663,18 +6999,16 @@ functionalUtility({
6663
6999
  supportsNegative: true,
6664
7000
  handle: (value, ctx, { negative, arbitrary }) => {
6665
7001
  if (arbitrary) {
6666
- return [decl("scale", `var(--baro-scale-x) ${value}`)];
7002
+ return scaleAxis("y", value);
6667
7003
  }
6668
7004
  if (parseNumber(value) || negative) {
6669
7005
  const pct = `${Math.abs(Number(value))}%`;
6670
7006
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6671
- return [decl("scale", `var(--baro-scale-x) calc(${pct} * ${sign}1)`)];
7007
+ return scaleAxis("y", `calc(${pct} * ${sign}1)`);
6672
7008
  }
6673
- return [decl("scale", `var(--baro-scale-x) ${value}`)];
7009
+ return scaleAxis("y", value);
6674
7010
  },
6675
- handleCustomProperty: (value) => [
6676
- decl("scale", `var(--baro-scale-x) var(${value})`)
6677
- ],
7011
+ handleCustomProperty: (value) => scaleAxis("y", `var(${value})`),
6678
7012
  description: "scale-y utility (named, arbitrary, custom property supported)",
6679
7013
  category: "transform"
6680
7014
  });
@@ -6686,25 +7020,16 @@ functionalUtility({
6686
7020
  supportsNegative: true,
6687
7021
  handle: (value, ctx, { negative, arbitrary }) => {
6688
7022
  if (arbitrary) {
6689
- return [
6690
- decl("scale", `var(--baro-scale-x) var(--baro-scale-y) ${value}`)
6691
- ];
7023
+ return scaleAxis("z", value);
6692
7024
  }
6693
7025
  if (parseNumber(value) || negative) {
6694
7026
  const pct = `${Math.abs(Number(value))}%`;
6695
7027
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6696
- return [
6697
- decl(
6698
- "scale",
6699
- `var(--baro-scale-x) var(--baro-scale-y) calc(${pct} * ${sign}1)`
6700
- )
6701
- ];
7028
+ return scaleAxis("z", `calc(${pct} * ${sign}1)`);
6702
7029
  }
6703
- return [decl("scale", `var(--baro-scale-x) var(--baro-scale-y) ${value}`)];
7030
+ return scaleAxis("z", value);
6704
7031
  },
6705
- handleCustomProperty: (value) => [
6706
- decl("scale", `var(--baro-scale-x) var(--baro-scale-y) var(${value})`)
6707
- ],
7032
+ handleCustomProperty: (value) => scaleAxis("z", `var(${value})`),
6708
7033
  description: "scale-z utility (named, arbitrary, custom property supported)",
6709
7034
  category: "transform"
6710
7035
  });
@@ -6743,11 +7068,11 @@ functionalUtility({
6743
7068
  if (parseNumber(value) || negative) {
6744
7069
  const deg = `${Math.abs(Number(value))}deg`;
6745
7070
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6746
- return [decl("transform", `skewX(${sign}${deg})`)];
7071
+ return skewAxis("x", `skewX(${sign}${deg})`);
6747
7072
  }
6748
- return [decl("transform", `skewX(${value})`)];
7073
+ return skewAxis("x", `skewX(${value})`);
6749
7074
  },
6750
- handleCustomProperty: (value) => [decl("transform", `skewX(var(${value}))`)],
7075
+ handleCustomProperty: (value) => skewAxis("x", `skewX(var(${value}))`),
6751
7076
  description: "skew-x utility (named, arbitrary, custom property supported)",
6752
7077
  category: "transform"
6753
7078
  });
@@ -6761,11 +7086,11 @@ functionalUtility({
6761
7086
  if (parseNumber(value) || negative) {
6762
7087
  const deg = `${Math.abs(Number(value))}deg`;
6763
7088
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6764
- return [decl("transform", `skewY(${sign}${deg})`)];
7089
+ return skewAxis("y", `skewY(${sign}${deg})`);
6765
7090
  }
6766
- return [decl("transform", `skewY(${value})`)];
7091
+ return skewAxis("y", `skewY(${value})`);
6767
7092
  },
6768
- handleCustomProperty: (value) => [decl("transform", `skewY(var(${value}))`)],
7093
+ handleCustomProperty: (value) => skewAxis("y", `skewY(var(${value}))`),
6769
7094
  description: "skew-y utility (named, arbitrary, custom property supported)",
6770
7095
  category: "transform"
6771
7096
  });
@@ -6779,12 +7104,14 @@ functionalUtility({
6779
7104
  if (parseNumber(value) || negative) {
6780
7105
  const deg = `${Math.abs(Number(value))}deg`;
6781
7106
  const sign = negative || String(value).startsWith("-") ? "-" : "";
6782
- return [decl("transform", `skewX(${sign}${deg}) skewY(${sign}${deg})`)];
7107
+ return [decl("--baro-skew-x", `skewX(${sign}${deg})`), decl("--baro-skew-y", `skewY(${sign}${deg})`), decl("transform", ROTATE_SKEW)];
6783
7108
  }
6784
- return [decl("transform", `skewX(${value}) skewY(${value})`)];
7109
+ return [decl("--baro-skew-x", `skewX(${value})`), decl("--baro-skew-y", `skewY(${value})`), decl("transform", ROTATE_SKEW)];
6785
7110
  },
6786
7111
  handleCustomProperty: (value) => [
6787
- decl("transform", `skewX(var(${value})) skewY(var(${value}))`)
7112
+ decl("--baro-skew-x", `skewX(var(${value}))`),
7113
+ decl("--baro-skew-y", `skewY(var(${value}))`),
7114
+ decl("transform", ROTATE_SKEW)
6788
7115
  ],
6789
7116
  description: "skew utility (named, arbitrary, custom property supported)",
6790
7117
  category: "transform"
@@ -6829,6 +7156,22 @@ const translateProperties = () => atRoot([
6829
7156
  property("--baro-translate-y", "0"),
6830
7157
  property("--baro-translate-z", "0")
6831
7158
  ]);
7159
+ const translateAxis = (axis, v) => [
7160
+ translateProperties(),
7161
+ decl(`--baro-translate-${axis}`, v),
7162
+ decl(
7163
+ "translate",
7164
+ axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
7165
+ )
7166
+ ];
7167
+ const staticTranslateAxis = (axis, v) => [
7168
+ translateProperties,
7169
+ [`--baro-translate-${axis}`, v],
7170
+ [
7171
+ "translate",
7172
+ axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
7173
+ ]
7174
+ ];
6832
7175
  staticUtility("translate-none", [["translate", "none"]], {
6833
7176
  category: "transform"
6834
7177
  });
@@ -6860,52 +7203,52 @@ staticUtility(
6860
7203
  );
6861
7204
  staticUtility(
6862
7205
  "translate-x-px",
6863
- [["translate", "1px var(--baro-translate-y)"]],
7206
+ staticTranslateAxis("x", "1px"),
6864
7207
  { category: "transform" }
6865
7208
  );
6866
7209
  staticUtility(
6867
7210
  "-translate-x-px",
6868
- [["translate", "-1px var(--baro-translate-y)"]],
7211
+ staticTranslateAxis("x", "-1px"),
6869
7212
  { category: "transform" }
6870
7213
  );
6871
7214
  staticUtility(
6872
7215
  "translate-x-full",
6873
- [["translate", "100% var(--baro-translate-y)"]],
7216
+ staticTranslateAxis("x", "100%"),
6874
7217
  { category: "transform" }
6875
7218
  );
6876
7219
  staticUtility(
6877
7220
  "-translate-x-full",
6878
- [["translate", "-100% var(--baro-translate-y)"]],
7221
+ staticTranslateAxis("x", "-100%"),
6879
7222
  { category: "transform" }
6880
7223
  );
6881
7224
  staticUtility(
6882
7225
  "translate-y-px",
6883
- [["translate", "var(--baro-translate-x) 1px"]],
7226
+ staticTranslateAxis("y", "1px"),
6884
7227
  { category: "transform" }
6885
7228
  );
6886
7229
  staticUtility(
6887
7230
  "-translate-y-px",
6888
- [["translate", "var(--baro-translate-x) -1px"]],
7231
+ staticTranslateAxis("y", "-1px"),
6889
7232
  { category: "transform" }
6890
7233
  );
6891
7234
  staticUtility(
6892
7235
  "translate-y-full",
6893
- [["translate", "var(--baro-translate-x) 100%"]],
7236
+ staticTranslateAxis("y", "100%"),
6894
7237
  { category: "transform" }
6895
7238
  );
6896
7239
  staticUtility(
6897
7240
  "-translate-y-full",
6898
- [["translate", "var(--baro-translate-x) -100%"]],
7241
+ staticTranslateAxis("y", "-100%"),
6899
7242
  { category: "transform" }
6900
7243
  );
6901
7244
  staticUtility(
6902
7245
  "translate-z-px",
6903
- [["translate", "var(--baro-translate-x) var(--baro-translate-y) 1px"]],
7246
+ staticTranslateAxis("z", "1px"),
6904
7247
  { category: "transform" }
6905
7248
  );
6906
7249
  staticUtility(
6907
7250
  "-translate-z-px",
6908
- [["translate", "var(--baro-translate-x) var(--baro-translate-y) -1px"]],
7251
+ staticTranslateAxis("z", "-1px"),
6909
7252
  { category: "transform" }
6910
7253
  );
6911
7254
  functionalUtility({
@@ -6915,19 +7258,17 @@ functionalUtility({
6915
7258
  supportsArbitrary: true,
6916
7259
  supportsCustomProperty: true,
6917
7260
  handle: (value, ctx, { negative }) => {
6918
- if (parseFractionOrNumber(value)) {
7261
+ if (value.includes("/") && parseFractionOrNumber(value)) {
6919
7262
  const v = `calc(${value} * 100%)`;
6920
- return [decl("translate", `${v} var(--baro-translate-y)`)];
7263
+ return translateAxis("x", v);
6921
7264
  }
6922
7265
  if (parseNumber(value) || negative) {
6923
7266
  const v = `calc(var(--spacing) * ${value})`;
6924
- return [decl("translate", `${v} var(--baro-translate-y)`)];
7267
+ return translateAxis("x", v);
6925
7268
  }
6926
- return [decl("translate", `${value} var(--baro-translate-y)`)];
7269
+ return translateAxis("x", value);
6927
7270
  },
6928
- handleCustomProperty: (value) => [
6929
- decl("translate", `var(${value}) var(--baro-translate-y)`)
6930
- ],
7271
+ handleCustomProperty: (value) => translateAxis("x", `var(${value})`),
6931
7272
  description: "translate-x utility (spacing, fraction, arbitrary, custom property, negative)",
6932
7273
  category: "transform"
6933
7274
  });
@@ -6938,19 +7279,17 @@ functionalUtility({
6938
7279
  supportsArbitrary: true,
6939
7280
  supportsCustomProperty: true,
6940
7281
  handle: (value, ctx, { negative }) => {
6941
- if (parseFractionOrNumber(value)) {
7282
+ if (value.includes("/") && parseFractionOrNumber(value)) {
6942
7283
  const v = `calc(${value} * 100%)`;
6943
- return [decl("translate", `var(--baro-translate-x) ${v}`)];
7284
+ return translateAxis("y", v);
6944
7285
  }
6945
7286
  if (parseNumber(value) || negative) {
6946
7287
  const v = `calc(var(--spacing) * ${value})`;
6947
- return [decl("translate", `var(--baro-translate-x) ${v}`)];
7288
+ return translateAxis("y", v);
6948
7289
  }
6949
- return [decl("translate", `var(--baro-translate-x) ${value}`)];
7290
+ return translateAxis("y", value);
6950
7291
  },
6951
- handleCustomProperty: (value) => [
6952
- decl("translate", `var(--baro-translate-x) var(${value})`)
6953
- ],
7292
+ handleCustomProperty: (value) => translateAxis("y", `var(${value})`),
6954
7293
  description: "translate-y utility (spacing, fraction, arbitrary, custom property, negative)",
6955
7294
  category: "transform"
6956
7295
  });
@@ -6961,37 +7300,17 @@ functionalUtility({
6961
7300
  supportsArbitrary: true,
6962
7301
  supportsCustomProperty: true,
6963
7302
  handle: (value, ctx, { negative }) => {
6964
- if (parseFractionOrNumber(value)) {
7303
+ if (value.includes("/") && parseFractionOrNumber(value)) {
6965
7304
  const v = `calc(${value} * 100%)`;
6966
- return [
6967
- decl(
6968
- "translate",
6969
- `var(--baro-translate-x) var(--baro-translate-y) ${v}`
6970
- )
6971
- ];
7305
+ return translateAxis("z", v);
6972
7306
  }
6973
7307
  if (parseNumber(value) || negative) {
6974
7308
  const v = `calc(var(--spacing) * ${value})`;
6975
- return [
6976
- decl(
6977
- "translate",
6978
- `var(--baro-translate-x) var(--baro-translate-y) ${v}`
6979
- )
6980
- ];
7309
+ return translateAxis("z", v);
6981
7310
  }
6982
- return [
6983
- decl(
6984
- "translate",
6985
- `var(--baro-translate-x) var(--baro-translate-y) ${value}`
6986
- )
6987
- ];
7311
+ return translateAxis("z", value);
6988
7312
  },
6989
- handleCustomProperty: (value) => [
6990
- decl(
6991
- "translate",
6992
- `var(--baro-translate-x) var(--baro-translate-y) var(${value})`
6993
- )
6994
- ],
7313
+ handleCustomProperty: (value) => translateAxis("z", `var(${value})`),
6995
7314
  description: "translate-z utility (spacing, fraction, arbitrary, custom property, negative)",
6996
7315
  category: "transform"
6997
7316
  });
@@ -7002,7 +7321,7 @@ functionalUtility({
7002
7321
  supportsArbitrary: true,
7003
7322
  supportsCustomProperty: true,
7004
7323
  handle: (value, ctx, { negative }) => {
7005
- if (parseFractionOrNumber(value)) {
7324
+ if (value.includes("/") && parseFractionOrNumber(value)) {
7006
7325
  const v = `calc(${value} * 100%)`;
7007
7326
  return [decl("translate", `${v} ${v}`)];
7008
7327
  }
@@ -7068,7 +7387,11 @@ functionalUtility({
7068
7387
  });
7069
7388
  staticUtility("forced-color-adjust-auto", [["forced-color-adjust", "auto"]], { category: "accessibility" });
7070
7389
  staticUtility("forced-color-adjust-none", [["forced-color-adjust", "none"]], { category: "accessibility" });
7071
- staticModifier("hover", ["&:hover"], { order: 50, source: "pseudo" });
7390
+ staticModifier("hover", ["&:hover"], {
7391
+ order: 50,
7392
+ source: "pseudo",
7393
+ wrap: () => [atRule("media", "(hover: hover)", [])]
7394
+ });
7072
7395
  staticModifier("focus", ["&:focus"], { order: 50, source: "pseudo" });
7073
7396
  staticModifier("active", ["&:active"], { order: 50, source: "pseudo" });
7074
7397
  staticModifier("visited", ["&:visited"], { order: 50, source: "pseudo" });
@@ -7163,8 +7486,13 @@ staticModifier("rtl", ["&[dir=rtl]"], { order: 20, source: "attribute" });
7163
7486
  staticModifier("ltr", ["&[dir=ltr]"], { order: 20, source: "attribute" });
7164
7487
  staticModifier("inert", ["&[inert]"], { order: 40, source: "attribute" });
7165
7488
  staticModifier("open", ["&:is([open], :popover-open, :open)"], { order: 40, source: "attribute" });
7166
- staticModifier("before", ["&::before"], { source: "pseudo" });
7167
- staticModifier("after", ["&::after"], { source: "pseudo" });
7489
+ const withPseudoContent = (ast) => [
7490
+ atRoot([property("--baro-content", '""')]),
7491
+ ...ast,
7492
+ decl("content", "var(--baro-content)")
7493
+ ];
7494
+ staticModifier("before", ["&::before"], { source: "pseudo", astHandler: withPseudoContent });
7495
+ staticModifier("after", ["&::after"], { source: "pseudo", astHandler: withPseudoContent });
7168
7496
  staticModifier("placeholder", [
7169
7497
  "&::placeholder",
7170
7498
  "&::-webkit-input-placeholder",
@@ -7197,9 +7525,6 @@ function createContainerParams(type, value, name) {
7197
7525
  const condition = type === "min" ? "width >=" : "width <";
7198
7526
  return name ? `${name} (${condition} ${value})` : `(${condition} ${value})`;
7199
7527
  }
7200
- function getThemeSize(ctx, key) {
7201
- return ctx.theme("container." + key) || ctx.theme("breakpoint." + key);
7202
- }
7203
7528
  function createContainerRule(params, ast) {
7204
7529
  return {
7205
7530
  type: "at-rule",
@@ -7219,6 +7544,35 @@ function getDefaultBreakpoint(breakpoint) {
7219
7544
  };
7220
7545
  return defaults[breakpoint] || `(min-width: ${breakpoint})`;
7221
7546
  }
7547
+ function decodeArbitrarySelector(value) {
7548
+ return value.replace(/\\_|_/g, (m) => m === "_" ? " " : "_");
7549
+ }
7550
+ function attributeVariantSelector(variant) {
7551
+ const bracket = /^(data|aria)-\[([a-zA-Z0-9_-]+)(?:=([^\]]+))?\]$/.exec(variant);
7552
+ if (bracket) {
7553
+ const [, kind, key, raw2] = bracket;
7554
+ if (raw2 === void 0) return `[${kind}-${key}]`;
7555
+ const value = /^(["']).*\1$/.test(raw2) ? raw2 : `"${decodeArbitrarySelector(raw2)}"`;
7556
+ return `[${kind}-${key}=${value}]`;
7557
+ }
7558
+ const bare = /^data-([a-zA-Z0-9_-]+)$/.exec(variant);
7559
+ return bare ? `[data-${bare[1]}]` : void 0;
7560
+ }
7561
+ function functionalArgument(value) {
7562
+ const v = decodeArbitrarySelector(value);
7563
+ return /^[>+~]/.test(v.trim()) || !hasTopLevelComma(v) ? v : `*:is(${v})`;
7564
+ }
7565
+ function hasTopLevelComma(value) {
7566
+ let depth = 0;
7567
+ for (let i = 0; i < value.length; i++) {
7568
+ const c = value[i];
7569
+ if (c === "\\") i++;
7570
+ else if (c === "(" || c === "[") depth++;
7571
+ else if (c === ")" || c === "]") depth--;
7572
+ else if (c === "," && depth === 0) return true;
7573
+ }
7574
+ return false;
7575
+ }
7222
7576
  functionalModifier(
7223
7577
  (mod, context) => {
7224
7578
  const breakpoints = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
@@ -7249,7 +7603,7 @@ functionalModifier(
7249
7603
  const breakpoints = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
7250
7604
  if (Object.keys(breakpoints).includes(breakpoint)) {
7251
7605
  let mediaQuery = context.theme(`breakpoints.${breakpoint}`) || getDefaultBreakpoint(breakpoint);
7252
- if (/^\d+(px|em|rem)?$/.test(mediaQuery)) {
7606
+ if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
7253
7607
  mediaQuery = `(min-width: ${mediaQuery})`;
7254
7608
  }
7255
7609
  return [atRule("media", mediaQuery, [], "responsive")];
@@ -7268,6 +7622,8 @@ functionalModifier(
7268
7622
  if (value) {
7269
7623
  mediaQuery = `(width < ${value})`;
7270
7624
  }
7625
+ } else if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
7626
+ mediaQuery = `(width < ${mediaQuery})`;
7271
7627
  }
7272
7628
  return [atRule("media", mediaQuery, [], "responsive")];
7273
7629
  }
@@ -7336,132 +7692,137 @@ functionalModifier(
7336
7692
  return result;
7337
7693
  }
7338
7694
  );
7695
+ const SIZE_VARIANT = /^@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
7339
7696
  functionalModifier(
7340
- (mod) => /^@container\/([a-zA-Z0-9_-]+)$/.test(mod),
7341
- void 0,
7342
- (mod, context) => {
7343
- const containerMatch = /^@container\/([a-zA-Z0-9_-]+)$/.exec(mod.type);
7344
- if (containerMatch) {
7345
- const name = containerMatch[1];
7346
- const params = name;
7347
- return [createContainerRule(params, [])];
7348
- }
7349
- return [];
7350
- }
7351
- );
7352
- functionalModifier(
7353
- (mod) => /^@container\/([a-zA-Z0-9_-]+)\s+\(([^)]+)\)$/.test(mod),
7697
+ (mod) => SIZE_VARIANT.test(mod) && !/^@container(?:\/|$)/.test(mod),
7354
7698
  void 0,
7355
7699
  (mod, context) => {
7356
- const containerSizeMatch = /^@container\/([a-zA-Z0-9_-]+)\s+\(([^)]+)\)$/.exec(mod.type);
7357
- if (containerSizeMatch) {
7358
- const [, name, size] = containerSizeMatch;
7359
- const params = createContainerParams("min", size, name);
7360
- return [createContainerRule(params, [])];
7361
- }
7362
- return [];
7700
+ const m = SIZE_VARIANT.exec(mod.type);
7701
+ if (!m) return [];
7702
+ const [, type, size, name] = m;
7703
+ const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
7704
+ if (!value) return [];
7705
+ return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
7363
7706
  }
7364
7707
  );
7708
+ const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
7365
7709
  functionalModifier(
7366
- (mod) => /^@(sm|md|lg|xl|2xl)\/([a-zA-Z0-9_-]+)$/.test(mod),
7367
- void 0,
7368
- (mod, context) => {
7369
- const namedSizeMatch = /^@(sm|md|lg|xl|2xl)\/([a-zA-Z0-9_-]+)$/.exec(mod.type);
7370
- if (namedSizeMatch) {
7371
- const [, size, name] = namedSizeMatch;
7372
- const sizeValue = getThemeSize(context, size) || size;
7373
- const params = createContainerParams("min", sizeValue, name);
7374
- return [createContainerRule(params, [])];
7375
- }
7376
- return [];
7377
- }
7710
+ (mod) => /^has-\[.*\]$/.test(mod) && !startsAtRule(mod.slice(5)),
7711
+ ({ selector, mod }) => {
7712
+ const m = /^has-\[(.+)\]$/.exec(mod.type);
7713
+ return m ? {
7714
+ selector: `&:has(${functionalArgument(m[1])})`,
7715
+ flatten: false,
7716
+ wrappingType: "rule",
7717
+ source: "attribute"
7718
+ } : {
7719
+ selector,
7720
+ source: "attribute"
7721
+ };
7722
+ },
7723
+ void 0
7378
7724
  );
7379
7725
  functionalModifier(
7380
- (mod) => /^@(sm|md|lg|xl|2xl)$/.test(mod),
7381
- void 0,
7382
- (mod, context) => {
7383
- const themeSizeMatch = /^@(sm|md|lg|xl|2xl)$/.exec(mod.type);
7384
- if (themeSizeMatch) {
7385
- const size = themeSizeMatch[1];
7386
- const sizeValue = getThemeSize(context, size) || size;
7387
- const params = createContainerParams("min", sizeValue);
7388
- return [createContainerRule(params, [])];
7389
- }
7390
- return [];
7391
- }
7726
+ (mod) => /^has-(data|aria)-/.test(mod) && !!attributeVariantSelector(mod.slice(4)),
7727
+ ({ mod }) => ({
7728
+ selector: `&:has(*${attributeVariantSelector(mod.type.slice(4))})`,
7729
+ flatten: false,
7730
+ wrappingType: "rule",
7731
+ source: "attribute"
7732
+ }),
7733
+ void 0
7392
7734
  );
7735
+ function innerCompound(variant, ctx) {
7736
+ const attr = attributeVariantSelector(variant);
7737
+ if (attr) return { compound: attr };
7738
+ if (/^(has|in|not|group|peer)-|[^a-z0-9-]/.test(variant)) return void 0;
7739
+ const inner = getModifier(ctx).find((m) => m.match(variant, ctx));
7740
+ if (!inner?.modifySelector || inner.astHandler) return void 0;
7741
+ const out = inner.modifySelector({ selector: "&", fullClassName: "", mod: { type: variant }, context: ctx });
7742
+ const list = typeof out === "string" ? [{ selector: out }] : Array.isArray(out) ? out : [out];
7743
+ if (list.length !== 1) return void 0;
7744
+ const sel = list[0].selector;
7745
+ if (!/^&[:[]/.test(sel) || sel.slice(1).includes("&") || /[\s,>+~]/.test(sel.replace(/\([^()]*\)/g, ""))) return void 0;
7746
+ return { compound: sel.slice(1), inner };
7747
+ }
7748
+ function resolveHasIn(mod, ctx) {
7749
+ const m = /^(has|in)-(.+)$/.exec(mod);
7750
+ if (!m) return void 0;
7751
+ const [, kind, v] = m;
7752
+ if (kind === "in" && /^\[.+\]$/.test(v)) {
7753
+ if (startsAtRule(v.slice(1))) return void 0;
7754
+ const sel = decodeArbitrarySelector(v.slice(1, -1));
7755
+ return { kind, compound: sel.startsWith("&") ? sel.slice(1) : `:is(${sel})` };
7756
+ }
7757
+ if (kind === "has" && (v.startsWith("[") || /^(data|aria)-/.test(v))) return void 0;
7758
+ const r = innerCompound(v, ctx);
7759
+ return r && { kind, ...r };
7760
+ }
7761
+ const hasInSelector = ({ selector, mod, context }) => {
7762
+ const r = resolveHasIn(mod.type, context);
7763
+ if (!r) return { selector };
7764
+ return {
7765
+ selector: r.kind === "has" ? `&:has(*${r.compound})` : `:where(*${r.compound}) &`,
7766
+ flatten: false,
7767
+ wrappingType: "rule",
7768
+ source: "attribute"
7769
+ };
7770
+ };
7393
7771
  functionalModifier(
7394
- (mod) => /^@max-(sm|md|lg|xl|2xl)$/.test(mod),
7395
- void 0,
7396
- (mod, context) => {
7397
- const themeSizeMatch = /^@max-(sm|md|lg|xl|2xl)$/.exec(mod.type);
7398
- if (themeSizeMatch) {
7399
- const size = themeSizeMatch[1];
7400
- const sizeValue = getThemeSize(context, size) || size;
7401
- const params = createContainerParams("max", sizeValue);
7402
- return [createContainerRule(params, [])];
7403
- }
7404
- return [];
7405
- }
7772
+ (mod, ctx) => !!resolveHasIn(mod, ctx)?.inner?.wrap,
7773
+ hasInSelector,
7774
+ (mod, context) => resolveHasIn(mod.type, context).inner.wrap({ ...mod, type: mod.type.replace(/^(has|in)-/, "") }, context)
7406
7775
  );
7407
7776
  functionalModifier(
7408
- (mod) => /^@(min|max)-\[.*\]$/.test(mod),
7409
- void 0,
7410
- (mod, context) => {
7411
- const arbitraryMatch = /^@(min|max)-\[(.+)\]$/.exec(mod.type);
7412
- if (arbitraryMatch) {
7413
- const [, type, value] = arbitraryMatch;
7414
- const params = createContainerParams(type, value);
7415
- return [createContainerRule(params, [])];
7416
- }
7417
- return [];
7418
- }
7777
+ (mod, ctx) => {
7778
+ const r = resolveHasIn(mod, ctx);
7779
+ return !!r && !r.inner?.wrap;
7780
+ },
7781
+ hasInSelector
7419
7782
  );
7783
+ function resolveGroupHas(mod, ctx) {
7784
+ const m = /^(group|peer)-has-(.+?)(?:\/([a-zA-Z0-9_-]+))?$/.exec(mod);
7785
+ if (!m) return void 0;
7786
+ const kind = m[1];
7787
+ const v = m[2];
7788
+ const base = m[3] ? `.${kind}\\/${m[3]}` : `.${kind}`;
7789
+ if (/^\[.+\]$/.test(v)) {
7790
+ if (startsAtRule(v.slice(1))) return void 0;
7791
+ const sel = decodeArbitrarySelector(v.slice(1, -1));
7792
+ return { kind, base, v, arg: /^[>+~]/.test(sel.trim()) ? sel : `*:is(${sel})` };
7793
+ }
7794
+ const r = innerCompound(v, ctx);
7795
+ return r && { kind, base, v, arg: `*${r.compound}`, inner: r.inner };
7796
+ }
7797
+ const groupHasSelector = ({ selector, mod, context }) => {
7798
+ const r = resolveGroupHas(mod.type, context);
7799
+ if (!r) return { selector };
7800
+ const tail = r.kind === "group" ? " *" : " ~ *";
7801
+ return { selector: `&:is(:where(${r.base}):has(${r.arg})${tail})`, wrappingType: "rule", source: r.kind };
7802
+ };
7420
7803
  functionalModifier(
7421
- (mod) => /^@(min|max)-\[.*\]\/([a-zA-Z0-9_-]+)$/.test(mod),
7422
- void 0,
7804
+ (mod, ctx) => !!resolveGroupHas(mod, ctx)?.inner?.wrap,
7805
+ groupHasSelector,
7423
7806
  (mod, context) => {
7424
- const arbitraryNamedMatch = /^@(min|max)-\[(.+)\]\/([a-zA-Z0-9_-]+)$/.exec(mod.type);
7425
- if (arbitraryNamedMatch) {
7426
- const [, type, value, name] = arbitraryNamedMatch;
7427
- const params = createContainerParams(type, value, name);
7428
- return [createContainerRule(params, [])];
7429
- }
7430
- return [];
7807
+ const r = resolveGroupHas(mod.type, context);
7808
+ return r.inner.wrap({ ...mod, type: r.v }, context);
7431
7809
  }
7432
7810
  );
7433
7811
  functionalModifier(
7434
- (mod) => /^has-\[.*\]$/.test(mod),
7435
- ({ selector, mod }) => {
7436
- const m = /^has-\[(.+)\]$/.exec(mod.type);
7437
- if (m && m[1].startsWith(".")) {
7438
- return {
7439
- selector: `&:has(${m[1]})`,
7440
- flatten: false,
7441
- wrappingType: "rule",
7442
- source: "attribute"
7443
- };
7444
- }
7445
- return m ? {
7446
- selector: `&:has(${m[1]})`,
7447
- flatten: false,
7448
- wrappingType: "rule",
7449
- source: "attribute"
7450
- } : {
7451
- selector,
7452
- source: "attribute"
7453
- };
7812
+ (mod, ctx) => {
7813
+ const r = resolveGroupHas(mod, ctx);
7814
+ return !!r && !r.inner?.wrap;
7454
7815
  },
7455
- void 0
7816
+ groupHasSelector
7456
7817
  );
7457
7818
  functionalModifier(
7458
7819
  (mod) => /^not-\[.*\]$/.test(mod),
7459
7820
  ({ selector, mod }) => {
7460
7821
  const m = /^not-\[(.+)\]$/.exec(mod.type);
7461
7822
  if (m) {
7462
- if (m[1].startsWith(".")) {
7823
+ if (!/^[a-zA-Z0-9_-]+(=.+)?$/.test(m[1])) {
7463
7824
  return {
7464
- selector: `&:not(${m[1]})`,
7825
+ selector: `&:not(${functionalArgument(m[1])})`,
7465
7826
  flatten: false,
7466
7827
  wrappingType: "rule",
7467
7828
  source: "attribute"
@@ -7494,27 +7855,14 @@ functionalModifier(
7494
7855
  );
7495
7856
  functionalModifier(
7496
7857
  (mod) => mod === "*",
7497
- ({ selector, fullClassName, variantChain }) => {
7498
- const isSingle = !variantChain || variantChain.length === 1;
7499
- return {
7500
- selector: `:is(.${escapeClassName(fullClassName)} > *)`,
7501
- flatten: true,
7502
- wrappingType: isSingle ? "rule" : "style-rule",
7503
- source: "universal"
7504
- };
7858
+ () => {
7859
+ return { selector: ":is(& > *)", wrappingType: "rule", source: "universal" };
7505
7860
  },
7506
7861
  void 0
7507
7862
  );
7508
7863
  functionalModifier(
7509
7864
  (mod) => mod === "**",
7510
- ({ selector, fullClassName }) => {
7511
- return {
7512
- selector: `:is(.${escapeClassName(fullClassName)} *)`,
7513
- flatten: false,
7514
- wrappingType: "style-rule",
7515
- source: "universal"
7516
- };
7517
- },
7865
+ () => ({ selector: ":is(& *)", wrappingType: "rule", source: "universal" }),
7518
7866
  void 0
7519
7867
  );
7520
7868
  functionalModifier(
@@ -7522,17 +7870,14 @@ functionalModifier(
7522
7870
  ({ selector, mod }) => {
7523
7871
  const m = /^\[(.+)\]$/.exec(mod.type);
7524
7872
  if (!m) return { selector };
7525
- const inner = m[1].trim();
7873
+ const inner = decodeArbitrarySelector(m[1]).trim();
7526
7874
  if (/^[a-zA-Z0-9_-]+(=.+)?$/.test(inner)) {
7527
7875
  return { selector: `&[${inner}]`, wrappingType: "rule", source: "attribute" };
7528
7876
  }
7529
- if (inner === "&>*") {
7530
- return { selector: `${inner}`, wrappingType: "style-rule", source: "peer" };
7531
- }
7532
7877
  if (inner.startsWith("&")) {
7533
7878
  return { selector: `${inner}`, wrappingType: "rule", source: "pseudo" };
7534
7879
  }
7535
- return { selector: `${inner} &`.trim(), wrappingType: "rule", source: "base" };
7880
+ return { selector: `&:is(${inner})`, wrappingType: "rule", source: "base" };
7536
7881
  },
7537
7882
  void 0
7538
7883
  );
@@ -7576,7 +7921,7 @@ functionalModifier(
7576
7921
  };
7577
7922
  } else {
7578
7923
  return {
7579
- selector: `&:not(${inner})`,
7924
+ selector: `&:not(${functionalArgument(inner)})`,
7580
7925
  source: "attribute"
7581
7926
  };
7582
7927
  }
@@ -7727,29 +8072,56 @@ functionalModifier(
7727
8072
  return m ? [atRule("scope", m[1], [])] : [];
7728
8073
  }
7729
8074
  );
8075
+ const atRuleHas = (mod) => /^(group|peer)-has-\[/.test(mod) && startsAtRule(mod.slice(mod.indexOf("[") + 1));
8076
+ function splitGroupName(kind, variant) {
8077
+ const named = /^(.+)\/([a-zA-Z0-9_-]+)$/.exec(variant);
8078
+ return named ? [named[1], `.${kind}\\/${named[2]}`] : [variant, `.${kind}`];
8079
+ }
8080
+ functionalModifier(
8081
+ (mod) => /^(group|peer)-hover(\/[a-zA-Z0-9_-]+)?$/.test(mod),
8082
+ ({ mod }) => {
8083
+ const kind = mod.type.startsWith("group") ? "group" : "peer";
8084
+ const [, base] = splitGroupName(kind, mod.type.slice(kind.length + 1));
8085
+ const tail = kind === "group" ? " *" : " ~ *";
8086
+ return { selector: `&:is(:where(${base}):hover${tail})`, wrappingType: "rule", source: kind };
8087
+ },
8088
+ () => [atRule("media", "(hover: hover)", [])]
8089
+ );
8090
+ function negated(value) {
8091
+ const v = value.slice(4);
8092
+ return v.startsWith("[") && v.endsWith("]") ? `:not(*:is(${decodeArbitrarySelector(v.slice(1, -1))}))` : `:not(:${v})`;
8093
+ }
7730
8094
  functionalModifier(
7731
- (mod) => /^group-(.+)$/.test(mod),
8095
+ (mod) => /^group-(.+)$/.test(mod) && !atRuleHas(mod),
7732
8096
  ({ selector, mod }) => {
7733
- const m = /^group-(.+)$/.exec(mod.type);
8097
+ const raw2 = /^group-(.+)$/.exec(mod.type);
8098
+ const [variant, base] = splitGroupName("group", raw2?.[1] ?? "");
8099
+ const m = raw2 ? [raw2[0], variant] : null;
8100
+ const g = `:where(${base})`;
8101
+ const attr = m ? attributeVariantSelector(m[1]) : void 0;
8102
+ if (attr) return { selector: `&:is(${g}${attr} *)`, wrappingType: "rule", source: "group" };
7734
8103
  if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
7735
8104
  const value = m?.[1].slice(1, -1).replace(/_/g, "");
7736
8105
  return {
7737
- selector: `&:is(:where(.group):is(${value}) *)`,
8106
+ selector: `&:is(${g}:is(${value}) *)`,
7738
8107
  wrappingType: "rule",
7739
8108
  source: "group"
7740
8109
  };
7741
8110
  }
8111
+ if (m?.[1]?.startsWith("not-")) {
8112
+ return { selector: `&:is(${g}${negated(m[1])} *)`, wrappingType: "rule", source: "group" };
8113
+ }
7742
8114
  if (m?.[1]?.startsWith("has-")) {
7743
8115
  const pattern = /^has-\[([a-zA-Z0-9_-]+)\]$/.exec(m?.[1]);
7744
8116
  if (pattern) {
7745
8117
  const value = pattern[1];
7746
8118
  return {
7747
- selector: `&:is(:where(.group):has(:is(${value})) *)`,
8119
+ selector: `&:is(${g}:has(:is(${value})) *)`,
7748
8120
  source: "group"
7749
8121
  };
7750
8122
  }
7751
8123
  return {
7752
- selector: `&:is(:where(.group):has(:is(${m?.[1].slice(4, -1)})) *)`,
8124
+ selector: `&:is(${g}:has(${functionalArgument(m[1].slice(5, -1))}) *)`,
7753
8125
  source: "group"
7754
8126
  };
7755
8127
  }
@@ -7759,19 +8131,19 @@ functionalModifier(
7759
8131
  const value = pattern[1];
7760
8132
  if (pattern[2]) {
7761
8133
  return {
7762
- selector: `&:is(:where(.group)[aria-${value}="${pattern[2]}"] *)`,
8134
+ selector: `&:is(${g}[aria-${value}="${pattern[2]}"] *)`,
7763
8135
  source: "group"
7764
8136
  };
7765
8137
  } else {
7766
8138
  return {
7767
- selector: `&:is(:where(.group)[aria-${value}] *)`,
8139
+ selector: `&:is(${g}[aria-${value}] *)`,
7768
8140
  source: "group"
7769
8141
  };
7770
8142
  }
7771
8143
  }
7772
8144
  }
7773
8145
  return m ? {
7774
- selector: `&:is(:where(.group):${m[1]} *)`,
8146
+ selector: `&:is(${g}:${m[1]} *)`,
7775
8147
  wrappingType: "rule",
7776
8148
  source: "group"
7777
8149
  } : {
@@ -7782,27 +8154,35 @@ functionalModifier(
7782
8154
  void 0
7783
8155
  );
7784
8156
  functionalModifier(
7785
- (mod) => /^peer-(.+)$/.test(mod),
8157
+ (mod) => /^peer-(.+)$/.test(mod) && !atRuleHas(mod),
7786
8158
  ({ selector, mod }) => {
7787
- const m = /^peer-(.+)$/.exec(mod.type);
8159
+ const raw2 = /^peer-(.+)$/.exec(mod.type);
8160
+ const [variant, base] = splitGroupName("peer", raw2?.[1] ?? "");
8161
+ const m = raw2 ? [raw2[0], variant] : null;
8162
+ const g = `:where(${base})`;
8163
+ const attr = m ? attributeVariantSelector(m[1]) : void 0;
8164
+ if (attr) return { selector: `&:is(${g}${attr} ~ *)`, wrappingType: "rule", source: "peer" };
7788
8165
  if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
7789
8166
  const value2 = m?.[1].slice(1, -1).replace(/_/g, "");
7790
8167
  return {
7791
- selector: `&:is(:where(.peer):is(${value2})~*)`,
8168
+ selector: `&:is(${g}:is(${value2})~*)`,
7792
8169
  wrappingType: "rule",
7793
8170
  source: "peer"
7794
8171
  };
7795
8172
  }
7796
8173
  const value = m?.[1];
8174
+ if (value?.startsWith("has-[") && value.endsWith("]")) {
8175
+ return { selector: `&:is(${g}:has(${functionalArgument(value.slice(5, -1))}) ~ *)`, source: "peer" };
8176
+ }
7797
8177
  if (value?.startsWith("has-")) {
7798
8178
  return {
7799
- selector: `&:is(:where(.peer):has(:${value.slice(4)})~*)`,
8179
+ selector: `&:is(${g}:has(:${value.slice(4)})~*)`,
7800
8180
  source: "peer"
7801
8181
  };
7802
8182
  }
7803
8183
  if (value?.startsWith("not-")) {
7804
8184
  return {
7805
- selector: `&:is(:where(.peer):not(:${value.slice(4)})~*)`,
8185
+ selector: `&:is(${g}${negated(value)} ~ *)`,
7806
8186
  source: "peer"
7807
8187
  };
7808
8188
  }
@@ -7811,7 +8191,7 @@ functionalModifier(
7811
8191
  if (pattern) {
7812
8192
  const key = pattern[1];
7813
8193
  return {
7814
- selector: `&:is(:where(.peer)[aria-${key}]~*)`,
8194
+ selector: `&:is(${g}[aria-${key}]~*)`,
7815
8195
  source: "peer"
7816
8196
  };
7817
8197
  }
@@ -7821,19 +8201,19 @@ functionalModifier(
7821
8201
  const value2 = pattern[2];
7822
8202
  if (pattern[2]) {
7823
8203
  return {
7824
- selector: `&:is(:where(.peer)[aria-${key}="${value2}"]~*)`,
8204
+ selector: `&:is(${g}[aria-${key}="${value2}"]~*)`,
7825
8205
  source: "peer"
7826
8206
  };
7827
8207
  } else {
7828
8208
  return {
7829
- selector: `&:is(:where(.peer)[aria-${key}]~*)`,
8209
+ selector: `&:is(${g}[aria-${key}]~*)`,
7830
8210
  source: "peer"
7831
8211
  };
7832
8212
  }
7833
8213
  }
7834
8214
  }
7835
8215
  return m ? {
7836
- selector: `&:is(:where(.peer):${value}~*)`,
8216
+ selector: `&:is(${g}:${value}~*)`,
7837
8217
  source: "peer"
7838
8218
  } : {
7839
8219
  selector,
@@ -7890,6 +8270,7 @@ export {
7890
8270
  ParseResultCache,
7891
8271
  UtilityCache,
7892
8272
  WeakCache,
8273
+ arbitraryPropertyRegistration,
7893
8274
  astCache,
7894
8275
  astToCss,
7895
8276
  atRoot,
@@ -7905,28 +8286,39 @@ export {
7905
8286
  deepMerge,
7906
8287
  defaultConfig,
7907
8288
  escapeClassName,
8289
+ expandThemeFunctions,
7908
8290
  functionalModifier,
7909
8291
  functionalUtility,
7910
8292
  generateCss,
7911
8293
  generateCssFromJson,
7912
8294
  generateCssRules,
8295
+ getAstCacheStats,
7913
8296
  getModifier,
7914
8297
  getPreflightCSS,
7915
8298
  getUtility,
8299
+ hasCommentToken,
7916
8300
  hasPreset,
8301
+ isDebug,
8302
+ isSafeVariantToken,
8303
+ isSafeVariantValue,
8304
+ isStructureSafeValue,
7917
8305
  jsonToAst,
7918
8306
  mergeAstTreeList,
7919
8307
  modifierRegistry,
8308
+ normalizeMathSpacing,
7920
8309
  optimizeAst,
7921
8310
  parseClassName,
7922
8311
  parseClassToAst,
7923
8312
  parseResultCache,
7924
8313
  property,
7925
8314
  raw,
8315
+ registerModifier,
7926
8316
  registerUtility,
7927
8317
  resolveTheme,
7928
8318
  rootToCss,
7929
8319
  rule,
8320
+ setContextCacheReset,
8321
+ setDebug,
7930
8322
  staticModifier,
7931
8323
  staticUtility,
7932
8324
  styleRule,