tw-mrg 1.0.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 ADDED
@@ -0,0 +1,2897 @@
1
+ "use client";
2
+
3
+ // src/groups/types.ts
4
+ var SPECIFICITY = {
5
+ /** All sides (p-4, m-4, rounded) */
6
+ ALL: 1,
7
+ /** Axis (px-4, my-4, rounded-t) */
8
+ AXIS: 2,
9
+ /** Single side (pt-4, mr-4, rounded-tl) */
10
+ SIDE: 3,
11
+ /** Arbitrary values are highly specific */
12
+ ARBITRARY: 10
13
+ };
14
+ function prefix(groupId, specificity = 1) {
15
+ return { groupId, specificity };
16
+ }
17
+ function mergeConfigs(...configs) {
18
+ const merged = {
19
+ prefixes: {},
20
+ exactMatches: {},
21
+ patterns: [],
22
+ conflicts: {}
23
+ };
24
+ for (const config of configs) {
25
+ Object.assign(merged.prefixes, config.prefixes);
26
+ Object.assign(merged.exactMatches, config.exactMatches);
27
+ merged.patterns.push(...config.patterns);
28
+ for (const [key, values] of Object.entries(config.conflicts)) {
29
+ if (key in merged.conflicts) {
30
+ merged.conflicts[key] = [.../* @__PURE__ */ new Set([...merged.conflicts[key], ...values])];
31
+ } else {
32
+ merged.conflicts[key] = [...values];
33
+ }
34
+ }
35
+ }
36
+ return merged;
37
+ }
38
+ function generateConflicts(hierarchy, fullSideNames = false) {
39
+ const conflicts = {};
40
+ for (const [base, axes] of Object.entries(hierarchy)) {
41
+ const allGroups = [base];
42
+ const sideToAxis = /* @__PURE__ */ new Map();
43
+ for (const [axis, sides] of Object.entries(axes)) {
44
+ if (!sides || sides.length === 0) continue;
45
+ const axisGroup = `${base}-${axis}`;
46
+ allGroups.push(axisGroup);
47
+ for (const side of sides) {
48
+ const sideGroup = fullSideNames ? side : `${base}-${side}`;
49
+ allGroups.push(sideGroup);
50
+ sideToAxis.set(sideGroup, axisGroup);
51
+ }
52
+ }
53
+ conflicts[base] = [...allGroups];
54
+ for (const [axis, sides] of Object.entries(axes)) {
55
+ if (!sides || sides.length === 0) continue;
56
+ const axisGroup = `${base}-${axis}`;
57
+ const sideGroups = sides.map((s) => fullSideNames ? s : `${base}-${s}`);
58
+ conflicts[axisGroup] = [base, axisGroup, ...sideGroups];
59
+ }
60
+ for (const [axis, sides] of Object.entries(axes)) {
61
+ if (!sides || sides.length === 0) continue;
62
+ const axisGroup = `${base}-${axis}`;
63
+ for (const side of sides) {
64
+ const sideGroup = fullSideNames ? side : `${base}-${side}`;
65
+ conflicts[sideGroup] = [base, axisGroup, sideGroup];
66
+ }
67
+ }
68
+ }
69
+ return conflicts;
70
+ }
71
+ function simpleConflicts(...groupIds) {
72
+ const conflicts = {};
73
+ for (const id of groupIds) {
74
+ conflicts[id] = [id];
75
+ }
76
+ return conflicts;
77
+ }
78
+
79
+ // src/cache.ts
80
+ var LRUCache = class {
81
+ constructor(maxSize = 500) {
82
+ this.cache = /* @__PURE__ */ new Map();
83
+ this.maxSize = maxSize;
84
+ }
85
+ /** Gets a value, moving it to most recently used position. */
86
+ get(key) {
87
+ const value = this.cache.get(key);
88
+ if (value === void 0) {
89
+ return void 0;
90
+ }
91
+ this.cache.delete(key);
92
+ this.cache.set(key, value);
93
+ return value;
94
+ }
95
+ /** Sets a value, evicting the oldest entry if at capacity. */
96
+ set(key, value) {
97
+ this.cache.delete(key);
98
+ this.cache.set(key, value);
99
+ if (this.cache.size > this.maxSize) {
100
+ const oldestKey = this.cache.keys().next().value;
101
+ if (oldestKey !== void 0) {
102
+ this.cache.delete(oldestKey);
103
+ }
104
+ }
105
+ }
106
+ has(key) {
107
+ return this.cache.has(key);
108
+ }
109
+ clear() {
110
+ this.cache.clear();
111
+ }
112
+ get size() {
113
+ return this.cache.size;
114
+ }
115
+ };
116
+ var parseCache = null;
117
+ var mergeCache = null;
118
+ function getParseCache() {
119
+ if (parseCache === null) {
120
+ parseCache = new LRUCache(1e3);
121
+ }
122
+ return parseCache;
123
+ }
124
+ function clearCaches() {
125
+ parseCache?.clear();
126
+ mergeCache?.clear();
127
+ }
128
+ function getCacheStats() {
129
+ return {
130
+ parseSize: parseCache?.size ?? 0,
131
+ mergeSize: mergeCache?.size ?? 0
132
+ };
133
+ }
134
+
135
+ // src/groups/layout.ts
136
+ var LAYOUT_HIERARCHY = {
137
+ overflow: { x: [], y: [] },
138
+ overscroll: { x: [], y: [] }
139
+ };
140
+ var INSET_HIERARCHY = {
141
+ inset: { x: ["left", "right", "start", "end"], y: ["top", "bottom"] }
142
+ };
143
+ var layoutGroups = {
144
+ prefixes: {
145
+ // Aspect ratio
146
+ "aspect-": prefix("aspect-ratio"),
147
+ // Columns
148
+ "columns-": prefix("columns"),
149
+ // Container
150
+ "@container": prefix("container"),
151
+ // Position
152
+ "inset-": prefix("inset", SPECIFICITY.ALL),
153
+ "-inset-": prefix("inset", SPECIFICITY.ALL),
154
+ "inset-x-": prefix("inset-x", SPECIFICITY.AXIS),
155
+ "-inset-x-": prefix("inset-x", SPECIFICITY.AXIS),
156
+ "inset-y-": prefix("inset-y", SPECIFICITY.AXIS),
157
+ "-inset-y-": prefix("inset-y", SPECIFICITY.AXIS),
158
+ "top-": prefix("top", SPECIFICITY.SIDE),
159
+ "-top-": prefix("top", SPECIFICITY.SIDE),
160
+ "right-": prefix("right", SPECIFICITY.SIDE),
161
+ "-right-": prefix("right", SPECIFICITY.SIDE),
162
+ "bottom-": prefix("bottom", SPECIFICITY.SIDE),
163
+ "-bottom-": prefix("bottom", SPECIFICITY.SIDE),
164
+ "left-": prefix("left", SPECIFICITY.SIDE),
165
+ "-left-": prefix("left", SPECIFICITY.SIDE),
166
+ "start-": prefix("start", SPECIFICITY.SIDE),
167
+ "-start-": prefix("start", SPECIFICITY.SIDE),
168
+ "end-": prefix("end", SPECIFICITY.SIDE),
169
+ "-end-": prefix("end", SPECIFICITY.SIDE),
170
+ // Z-index
171
+ "z-": prefix("z-index"),
172
+ "-z-": prefix("z-index"),
173
+ // Float & Clear
174
+ "float-": prefix("float"),
175
+ "clear-": prefix("clear"),
176
+ // Object fit/position
177
+ "object-": prefix("object-fit"),
178
+ // Will be refined by exact matches
179
+ // Overflow
180
+ "overflow-": prefix("overflow", SPECIFICITY.ALL),
181
+ "overflow-x-": prefix("overflow-x", SPECIFICITY.AXIS),
182
+ "overflow-y-": prefix("overflow-y", SPECIFICITY.AXIS),
183
+ // Overscroll
184
+ "overscroll-": prefix("overscroll", SPECIFICITY.ALL),
185
+ "overscroll-x-": prefix("overscroll-x", SPECIFICITY.AXIS),
186
+ "overscroll-y-": prefix("overscroll-y", SPECIFICITY.AXIS)
187
+ },
188
+ exactMatches: {
189
+ // Aspect ratio
190
+ "aspect-auto": prefix("aspect-ratio"),
191
+ "aspect-square": prefix("aspect-ratio"),
192
+ "aspect-video": prefix("aspect-ratio"),
193
+ // Container
194
+ container: prefix("container"),
195
+ "@container": prefix("container"),
196
+ // Columns
197
+ "columns-auto": prefix("columns"),
198
+ // CSS Containment
199
+ "contain-none": prefix("contain"),
200
+ "contain-content": prefix("contain"),
201
+ "contain-strict": prefix("contain"),
202
+ "contain-size": prefix("contain"),
203
+ "contain-inline-size": prefix("contain"),
204
+ "contain-layout": prefix("contain"),
205
+ "contain-style": prefix("contain"),
206
+ "contain-paint": prefix("contain"),
207
+ // Field sizing (new in v4)
208
+ "field-sizing-content": prefix("field-sizing"),
209
+ "field-sizing-fixed": prefix("field-sizing"),
210
+ // Break before
211
+ "break-before-auto": prefix("break-before"),
212
+ "break-before-avoid": prefix("break-before"),
213
+ "break-before-all": prefix("break-before"),
214
+ "break-before-avoid-page": prefix("break-before"),
215
+ "break-before-page": prefix("break-before"),
216
+ "break-before-left": prefix("break-before"),
217
+ "break-before-right": prefix("break-before"),
218
+ "break-before-column": prefix("break-before"),
219
+ // Break after
220
+ "break-after-auto": prefix("break-after"),
221
+ "break-after-avoid": prefix("break-after"),
222
+ "break-after-all": prefix("break-after"),
223
+ "break-after-avoid-page": prefix("break-after"),
224
+ "break-after-page": prefix("break-after"),
225
+ "break-after-left": prefix("break-after"),
226
+ "break-after-right": prefix("break-after"),
227
+ "break-after-column": prefix("break-after"),
228
+ // Break inside
229
+ "break-inside-auto": prefix("break-inside"),
230
+ "break-inside-avoid": prefix("break-inside"),
231
+ "break-inside-avoid-page": prefix("break-inside"),
232
+ "break-inside-avoid-column": prefix("break-inside"),
233
+ // Color scheme
234
+ "scheme-normal": prefix("color-scheme"),
235
+ "scheme-dark": prefix("color-scheme"),
236
+ "scheme-light": prefix("color-scheme"),
237
+ "scheme-light-dark": prefix("color-scheme"),
238
+ "scheme-dark-light": prefix("color-scheme"),
239
+ "scheme-only-dark": prefix("color-scheme"),
240
+ "scheme-only-light": prefix("color-scheme"),
241
+ // Display
242
+ block: prefix("display"),
243
+ "inline-block": prefix("display"),
244
+ inline: prefix("display"),
245
+ flex: prefix("display"),
246
+ "inline-flex": prefix("display"),
247
+ table: prefix("display"),
248
+ "inline-table": prefix("display"),
249
+ "table-caption": prefix("display"),
250
+ "table-cell": prefix("display"),
251
+ "table-column": prefix("display"),
252
+ "table-column-group": prefix("display"),
253
+ "table-footer-group": prefix("display"),
254
+ "table-header-group": prefix("display"),
255
+ "table-row-group": prefix("display"),
256
+ "table-row": prefix("display"),
257
+ "flow-root": prefix("display"),
258
+ grid: prefix("display"),
259
+ "inline-grid": prefix("display"),
260
+ contents: prefix("display"),
261
+ "list-item": prefix("display"),
262
+ hidden: prefix("display"),
263
+ // Position
264
+ static: prefix("position"),
265
+ fixed: prefix("position"),
266
+ absolute: prefix("position"),
267
+ relative: prefix("position"),
268
+ sticky: prefix("position"),
269
+ // Visibility
270
+ visible: prefix("visibility"),
271
+ invisible: prefix("visibility"),
272
+ collapse: prefix("visibility"),
273
+ // Isolation
274
+ isolate: prefix("isolation"),
275
+ "isolation-auto": prefix("isolation"),
276
+ // Object fit
277
+ "object-contain": prefix("object-fit"),
278
+ "object-cover": prefix("object-fit"),
279
+ "object-fill": prefix("object-fit"),
280
+ "object-none": prefix("object-fit"),
281
+ "object-scale-down": prefix("object-fit"),
282
+ // Object position
283
+ "object-bottom": prefix("object-position"),
284
+ "object-center": prefix("object-position"),
285
+ "object-left": prefix("object-position"),
286
+ "object-left-bottom": prefix("object-position"),
287
+ "object-left-top": prefix("object-position"),
288
+ "object-right": prefix("object-position"),
289
+ "object-right-bottom": prefix("object-position"),
290
+ "object-right-top": prefix("object-position"),
291
+ "object-top": prefix("object-position"),
292
+ // Overflow exact
293
+ "overflow-auto": prefix("overflow", SPECIFICITY.ALL),
294
+ "overflow-hidden": prefix("overflow", SPECIFICITY.ALL),
295
+ "overflow-clip": prefix("overflow", SPECIFICITY.ALL),
296
+ "overflow-visible": prefix("overflow", SPECIFICITY.ALL),
297
+ "overflow-scroll": prefix("overflow", SPECIFICITY.ALL)
298
+ },
299
+ patterns: [],
300
+ conflicts: {
301
+ ...simpleConflicts(
302
+ "aspect-ratio",
303
+ "columns",
304
+ "container",
305
+ "display",
306
+ "position",
307
+ "visibility",
308
+ "isolation",
309
+ "float",
310
+ "clear",
311
+ "object-fit",
312
+ "object-position",
313
+ "z-index",
314
+ "contain",
315
+ "field-sizing",
316
+ "break-before",
317
+ "break-after",
318
+ "break-inside",
319
+ "color-scheme"
320
+ ),
321
+ ...generateConflicts(LAYOUT_HIERARCHY),
322
+ ...generateConflicts(INSET_HIERARCHY, true)
323
+ // Use full side names
324
+ }
325
+ };
326
+
327
+ // src/groups/spacing.ts
328
+ var SPACING_HIERARCHY = {
329
+ padding: { x: ["l", "r", "s", "e"], y: ["t", "b"] },
330
+ margin: { x: ["l", "r", "s", "e"], y: ["t", "b"] },
331
+ gap: { x: [], y: [] }
332
+ };
333
+ var spacingGroups = {
334
+ prefixes: {
335
+ // Padding
336
+ "p-": prefix("padding", SPECIFICITY.ALL),
337
+ "px-": prefix("padding-x", SPECIFICITY.AXIS),
338
+ "py-": prefix("padding-y", SPECIFICITY.AXIS),
339
+ "pt-": prefix("padding-t", SPECIFICITY.SIDE),
340
+ "pr-": prefix("padding-r", SPECIFICITY.SIDE),
341
+ "pb-": prefix("padding-b", SPECIFICITY.SIDE),
342
+ "pl-": prefix("padding-l", SPECIFICITY.SIDE),
343
+ "ps-": prefix("padding-s", SPECIFICITY.SIDE),
344
+ "pe-": prefix("padding-e", SPECIFICITY.SIDE),
345
+ // Margin
346
+ "m-": prefix("margin", SPECIFICITY.ALL),
347
+ "-m-": prefix("margin", SPECIFICITY.ALL),
348
+ "mx-": prefix("margin-x", SPECIFICITY.AXIS),
349
+ "-mx-": prefix("margin-x", SPECIFICITY.AXIS),
350
+ "my-": prefix("margin-y", SPECIFICITY.AXIS),
351
+ "-my-": prefix("margin-y", SPECIFICITY.AXIS),
352
+ "mt-": prefix("margin-t", SPECIFICITY.SIDE),
353
+ "-mt-": prefix("margin-t", SPECIFICITY.SIDE),
354
+ "mr-": prefix("margin-r", SPECIFICITY.SIDE),
355
+ "-mr-": prefix("margin-r", SPECIFICITY.SIDE),
356
+ "mb-": prefix("margin-b", SPECIFICITY.SIDE),
357
+ "-mb-": prefix("margin-b", SPECIFICITY.SIDE),
358
+ "ml-": prefix("margin-l", SPECIFICITY.SIDE),
359
+ "-ml-": prefix("margin-l", SPECIFICITY.SIDE),
360
+ "ms-": prefix("margin-s", SPECIFICITY.SIDE),
361
+ "-ms-": prefix("margin-s", SPECIFICITY.SIDE),
362
+ "me-": prefix("margin-e", SPECIFICITY.SIDE),
363
+ "-me-": prefix("margin-e", SPECIFICITY.SIDE),
364
+ // Gap
365
+ "gap-": prefix("gap", SPECIFICITY.ALL),
366
+ "gap-x-": prefix("gap-x", SPECIFICITY.AXIS),
367
+ "gap-y-": prefix("gap-y", SPECIFICITY.AXIS),
368
+ // Space between
369
+ "space-x-": prefix("space-x"),
370
+ "-space-x-": prefix("space-x"),
371
+ "space-y-": prefix("space-y"),
372
+ "-space-y-": prefix("space-y")
373
+ },
374
+ exactMatches: {
375
+ "space-x-reverse": prefix("space-x-reverse"),
376
+ "space-y-reverse": prefix("space-y-reverse")
377
+ },
378
+ patterns: [],
379
+ conflicts: {
380
+ ...generateConflicts(SPACING_HIERARCHY),
381
+ ...simpleConflicts("space-x", "space-y", "space-x-reverse", "space-y-reverse")
382
+ }
383
+ };
384
+
385
+ // src/groups/sizing.ts
386
+ var sizingGroups = {
387
+ prefixes: {
388
+ // Width
389
+ "w-": prefix("width"),
390
+ "min-w-": prefix("min-width"),
391
+ "max-w-": prefix("max-width"),
392
+ // Height
393
+ "h-": prefix("height"),
394
+ "min-h-": prefix("min-height"),
395
+ "max-h-": prefix("max-height"),
396
+ // Size (width + height shorthand)
397
+ "size-": prefix("size", SPECIFICITY.ALL)
398
+ },
399
+ exactMatches: {},
400
+ patterns: [],
401
+ conflicts: {
402
+ width: ["width"],
403
+ "min-width": ["min-width"],
404
+ "max-width": ["max-width"],
405
+ height: ["height"],
406
+ "min-height": ["min-height"],
407
+ "max-height": ["max-height"],
408
+ size: ["size", "width", "height"]
409
+ }
410
+ };
411
+
412
+ // src/groups/flexbox-grid.ts
413
+ var flexboxGridGroups = {
414
+ prefixes: {
415
+ // Flex basis
416
+ "basis-": prefix("flex-basis"),
417
+ // Order
418
+ "order-": prefix("order"),
419
+ "-order-": prefix("order"),
420
+ // Grid template
421
+ "grid-cols-": prefix("grid-template-columns"),
422
+ "grid-rows-": prefix("grid-template-rows"),
423
+ // Grid column
424
+ "col-": prefix("grid-column"),
425
+ "col-start-": prefix("grid-column-start"),
426
+ "col-end-": prefix("grid-column-end"),
427
+ // Grid row
428
+ "row-": prefix("grid-row"),
429
+ "row-start-": prefix("grid-row-start"),
430
+ "row-end-": prefix("grid-row-end"),
431
+ // Grid auto
432
+ "auto-cols-": prefix("grid-auto-columns"),
433
+ "auto-rows-": prefix("grid-auto-rows")
434
+ },
435
+ exactMatches: {
436
+ // Flex direction
437
+ "flex-row": prefix("flex-direction"),
438
+ "flex-row-reverse": prefix("flex-direction"),
439
+ "flex-col": prefix("flex-direction"),
440
+ "flex-col-reverse": prefix("flex-direction"),
441
+ // Flex wrap
442
+ "flex-wrap": prefix("flex-wrap"),
443
+ "flex-wrap-reverse": prefix("flex-wrap"),
444
+ "flex-nowrap": prefix("flex-wrap"),
445
+ // Flex
446
+ "flex-1": prefix("flex"),
447
+ "flex-auto": prefix("flex"),
448
+ "flex-initial": prefix("flex"),
449
+ "flex-none": prefix("flex"),
450
+ // Grow / Shrink
451
+ grow: prefix("flex-grow"),
452
+ "grow-0": prefix("flex-grow"),
453
+ shrink: prefix("flex-shrink"),
454
+ "shrink-0": prefix("flex-shrink"),
455
+ // Order
456
+ "order-none": prefix("order"),
457
+ "order-first": prefix("order"),
458
+ "order-last": prefix("order"),
459
+ // Grid auto flow
460
+ "grid-flow-row": prefix("grid-auto-flow"),
461
+ "grid-flow-col": prefix("grid-auto-flow"),
462
+ "grid-flow-dense": prefix("grid-auto-flow"),
463
+ "grid-flow-row-dense": prefix("grid-auto-flow"),
464
+ "grid-flow-col-dense": prefix("grid-auto-flow"),
465
+ // Justify content
466
+ "justify-normal": prefix("justify-content"),
467
+ "justify-start": prefix("justify-content"),
468
+ "justify-end": prefix("justify-content"),
469
+ "justify-center": prefix("justify-content"),
470
+ "justify-between": prefix("justify-content"),
471
+ "justify-around": prefix("justify-content"),
472
+ "justify-evenly": prefix("justify-content"),
473
+ "justify-stretch": prefix("justify-content"),
474
+ "justify-baseline": prefix("justify-content"),
475
+ // Safe alignment
476
+ "justify-start-safe": prefix("justify-content"),
477
+ "justify-end-safe": prefix("justify-content"),
478
+ "justify-center-safe": prefix("justify-content"),
479
+ // Justify items
480
+ "justify-items-start": prefix("justify-items"),
481
+ "justify-items-end": prefix("justify-items"),
482
+ "justify-items-center": prefix("justify-items"),
483
+ "justify-items-stretch": prefix("justify-items"),
484
+ // Safe alignment
485
+ "justify-items-start-safe": prefix("justify-items"),
486
+ "justify-items-end-safe": prefix("justify-items"),
487
+ "justify-items-center-safe": prefix("justify-items"),
488
+ // Justify self
489
+ "justify-self-auto": prefix("justify-self"),
490
+ "justify-self-start": prefix("justify-self"),
491
+ "justify-self-end": prefix("justify-self"),
492
+ "justify-self-center": prefix("justify-self"),
493
+ "justify-self-stretch": prefix("justify-self"),
494
+ // Safe alignment
495
+ "justify-self-start-safe": prefix("justify-self"),
496
+ "justify-self-end-safe": prefix("justify-self"),
497
+ "justify-self-center-safe": prefix("justify-self"),
498
+ // Align content
499
+ "content-normal": prefix("align-content"),
500
+ "content-center": prefix("align-content"),
501
+ "content-start": prefix("align-content"),
502
+ "content-end": prefix("align-content"),
503
+ "content-between": prefix("align-content"),
504
+ "content-around": prefix("align-content"),
505
+ "content-evenly": prefix("align-content"),
506
+ "content-baseline": prefix("align-content"),
507
+ "content-stretch": prefix("align-content"),
508
+ // Safe alignment
509
+ "content-start-safe": prefix("align-content"),
510
+ "content-end-safe": prefix("align-content"),
511
+ "content-center-safe": prefix("align-content"),
512
+ // Align items
513
+ "items-start": prefix("align-items"),
514
+ "items-end": prefix("align-items"),
515
+ "items-center": prefix("align-items"),
516
+ "items-baseline": prefix("align-items"),
517
+ "items-baseline-last": prefix("align-items"),
518
+ "items-stretch": prefix("align-items"),
519
+ // Safe alignment
520
+ "items-start-safe": prefix("align-items"),
521
+ "items-end-safe": prefix("align-items"),
522
+ "items-center-safe": prefix("align-items"),
523
+ // Align self
524
+ "self-auto": prefix("align-self"),
525
+ "self-start": prefix("align-self"),
526
+ "self-end": prefix("align-self"),
527
+ "self-center": prefix("align-self"),
528
+ "self-stretch": prefix("align-self"),
529
+ "self-baseline": prefix("align-self"),
530
+ // Safe alignment
531
+ "self-start-safe": prefix("align-self"),
532
+ "self-end-safe": prefix("align-self"),
533
+ "self-center-safe": prefix("align-self"),
534
+ // Place content
535
+ "place-content-center": prefix("place-content"),
536
+ "place-content-start": prefix("place-content"),
537
+ "place-content-end": prefix("place-content"),
538
+ "place-content-between": prefix("place-content"),
539
+ "place-content-around": prefix("place-content"),
540
+ "place-content-evenly": prefix("place-content"),
541
+ "place-content-baseline": prefix("place-content"),
542
+ "place-content-stretch": prefix("place-content"),
543
+ // Safe alignment
544
+ "place-content-start-safe": prefix("place-content"),
545
+ "place-content-end-safe": prefix("place-content"),
546
+ "place-content-center-safe": prefix("place-content"),
547
+ // Place items
548
+ "place-items-start": prefix("place-items"),
549
+ "place-items-end": prefix("place-items"),
550
+ "place-items-center": prefix("place-items"),
551
+ "place-items-baseline": prefix("place-items"),
552
+ "place-items-stretch": prefix("place-items"),
553
+ // Safe alignment
554
+ "place-items-start-safe": prefix("place-items"),
555
+ "place-items-end-safe": prefix("place-items"),
556
+ "place-items-center-safe": prefix("place-items"),
557
+ // Place self
558
+ "place-self-auto": prefix("place-self"),
559
+ "place-self-start": prefix("place-self"),
560
+ "place-self-end": prefix("place-self"),
561
+ "place-self-center": prefix("place-self"),
562
+ "place-self-stretch": prefix("place-self"),
563
+ // Safe alignment
564
+ "place-self-start-safe": prefix("place-self"),
565
+ "place-self-end-safe": prefix("place-self"),
566
+ "place-self-center-safe": prefix("place-self")
567
+ },
568
+ patterns: [
569
+ // Arbitrary flex values
570
+ { pattern: /^flex-\[/, groupId: "flex", specificity: 1 },
571
+ { pattern: /^grow-\[/, groupId: "flex-grow", specificity: 1 },
572
+ { pattern: /^shrink-\[/, groupId: "flex-shrink", specificity: 1 }
573
+ ],
574
+ conflicts: {
575
+ // Grid column/row have hierarchical conflicts
576
+ "grid-column": ["grid-column", "grid-column-start", "grid-column-end"],
577
+ "grid-row": ["grid-row", "grid-row-start", "grid-row-end"],
578
+ ...simpleConflicts(
579
+ "flex-basis",
580
+ "flex-direction",
581
+ "flex-wrap",
582
+ "flex",
583
+ "flex-grow",
584
+ "flex-shrink",
585
+ "order",
586
+ "grid-template-columns",
587
+ "grid-template-rows",
588
+ "grid-column-start",
589
+ "grid-column-end",
590
+ "grid-row-start",
591
+ "grid-row-end",
592
+ "grid-auto-flow",
593
+ "grid-auto-columns",
594
+ "grid-auto-rows",
595
+ "justify-content",
596
+ "justify-items",
597
+ "justify-self",
598
+ "align-content",
599
+ "align-items",
600
+ "align-self",
601
+ "place-content",
602
+ "place-items",
603
+ "place-self"
604
+ )
605
+ }
606
+ };
607
+
608
+ // src/groups/typography.ts
609
+ var typographyGroups = {
610
+ prefixes: {
611
+ // Letter spacing
612
+ "tracking-": prefix("letter-spacing"),
613
+ // Line height
614
+ "leading-": prefix("line-height"),
615
+ // Line clamp
616
+ "line-clamp-": prefix("line-clamp"),
617
+ // Text indent
618
+ "indent-": prefix("text-indent"),
619
+ // List image
620
+ "list-image-": prefix("list-image"),
621
+ // Text decoration
622
+ "decoration-": prefix("text-decoration-color"),
623
+ // Refined by exact matches
624
+ // Underline offset
625
+ "underline-offset-": prefix("text-underline-offset"),
626
+ // Content
627
+ "content-": prefix("content")
628
+ },
629
+ exactMatches: {
630
+ // Font family
631
+ "font-sans": prefix("font-family"),
632
+ "font-serif": prefix("font-family"),
633
+ "font-mono": prefix("font-family"),
634
+ // Font size
635
+ "text-xs": prefix("font-size"),
636
+ "text-sm": prefix("font-size"),
637
+ "text-base": prefix("font-size"),
638
+ "text-lg": prefix("font-size"),
639
+ "text-xl": prefix("font-size"),
640
+ "text-2xl": prefix("font-size"),
641
+ "text-3xl": prefix("font-size"),
642
+ "text-4xl": prefix("font-size"),
643
+ "text-5xl": prefix("font-size"),
644
+ "text-6xl": prefix("font-size"),
645
+ "text-7xl": prefix("font-size"),
646
+ "text-8xl": prefix("font-size"),
647
+ "text-9xl": prefix("font-size"),
648
+ // Font smoothing
649
+ antialiased: prefix("font-smoothing"),
650
+ "subpixel-antialiased": prefix("font-smoothing"),
651
+ // Font style
652
+ italic: prefix("font-style"),
653
+ "not-italic": prefix("font-style"),
654
+ // Font weight
655
+ "font-thin": prefix("font-weight"),
656
+ "font-extralight": prefix("font-weight"),
657
+ "font-light": prefix("font-weight"),
658
+ "font-normal": prefix("font-weight"),
659
+ "font-medium": prefix("font-weight"),
660
+ "font-semibold": prefix("font-weight"),
661
+ "font-bold": prefix("font-weight"),
662
+ "font-extrabold": prefix("font-weight"),
663
+ "font-black": prefix("font-weight"),
664
+ // Font variant numeric
665
+ "normal-nums": prefix("font-variant-numeric"),
666
+ ordinal: prefix("font-variant-numeric"),
667
+ "slashed-zero": prefix("font-variant-numeric"),
668
+ "lining-nums": prefix("font-variant-numeric"),
669
+ "oldstyle-nums": prefix("font-variant-numeric"),
670
+ "proportional-nums": prefix("font-variant-numeric"),
671
+ "tabular-nums": prefix("font-variant-numeric"),
672
+ "diagonal-fractions": prefix("font-variant-numeric"),
673
+ "stacked-fractions": prefix("font-variant-numeric"),
674
+ // Font stretch
675
+ "font-stretch-normal": prefix("font-stretch"),
676
+ "font-stretch-ultra-condensed": prefix("font-stretch"),
677
+ "font-stretch-extra-condensed": prefix("font-stretch"),
678
+ "font-stretch-condensed": prefix("font-stretch"),
679
+ "font-stretch-semi-condensed": prefix("font-stretch"),
680
+ "font-stretch-semi-expanded": prefix("font-stretch"),
681
+ "font-stretch-expanded": prefix("font-stretch"),
682
+ "font-stretch-extra-expanded": prefix("font-stretch"),
683
+ "font-stretch-ultra-expanded": prefix("font-stretch"),
684
+ // List style position
685
+ "list-inside": prefix("list-style-position"),
686
+ "list-outside": prefix("list-style-position"),
687
+ // List style type
688
+ "list-none": prefix("list-style-type"),
689
+ "list-disc": prefix("list-style-type"),
690
+ "list-decimal": prefix("list-style-type"),
691
+ // Text align
692
+ "text-left": prefix("text-align"),
693
+ "text-center": prefix("text-align"),
694
+ "text-right": prefix("text-align"),
695
+ "text-justify": prefix("text-align"),
696
+ "text-start": prefix("text-align"),
697
+ "text-end": prefix("text-align"),
698
+ // Text decoration
699
+ underline: prefix("text-decoration"),
700
+ overline: prefix("text-decoration"),
701
+ "line-through": prefix("text-decoration"),
702
+ "no-underline": prefix("text-decoration"),
703
+ // Text decoration style
704
+ "decoration-solid": prefix("text-decoration-style"),
705
+ "decoration-double": prefix("text-decoration-style"),
706
+ "decoration-dotted": prefix("text-decoration-style"),
707
+ "decoration-dashed": prefix("text-decoration-style"),
708
+ "decoration-wavy": prefix("text-decoration-style"),
709
+ // Text decoration thickness
710
+ "decoration-auto": prefix("text-decoration-thickness"),
711
+ "decoration-from-font": prefix("text-decoration-thickness"),
712
+ "decoration-0": prefix("text-decoration-thickness"),
713
+ "decoration-1": prefix("text-decoration-thickness"),
714
+ "decoration-2": prefix("text-decoration-thickness"),
715
+ "decoration-4": prefix("text-decoration-thickness"),
716
+ "decoration-8": prefix("text-decoration-thickness"),
717
+ // Text transform
718
+ uppercase: prefix("text-transform"),
719
+ lowercase: prefix("text-transform"),
720
+ capitalize: prefix("text-transform"),
721
+ "normal-case": prefix("text-transform"),
722
+ // Text overflow
723
+ truncate: prefix("text-overflow"),
724
+ "text-ellipsis": prefix("text-overflow"),
725
+ "text-clip": prefix("text-overflow"),
726
+ // Text wrap
727
+ "text-wrap": prefix("text-wrap"),
728
+ "text-nowrap": prefix("text-wrap"),
729
+ "text-balance": prefix("text-wrap"),
730
+ "text-pretty": prefix("text-wrap"),
731
+ // Vertical align
732
+ "align-baseline": prefix("vertical-align"),
733
+ "align-top": prefix("vertical-align"),
734
+ "align-middle": prefix("vertical-align"),
735
+ "align-bottom": prefix("vertical-align"),
736
+ "align-text-top": prefix("vertical-align"),
737
+ "align-text-bottom": prefix("vertical-align"),
738
+ "align-sub": prefix("vertical-align"),
739
+ "align-super": prefix("vertical-align"),
740
+ // Whitespace
741
+ "whitespace-normal": prefix("whitespace"),
742
+ "whitespace-nowrap": prefix("whitespace"),
743
+ "whitespace-pre": prefix("whitespace"),
744
+ "whitespace-pre-line": prefix("whitespace"),
745
+ "whitespace-pre-wrap": prefix("whitespace"),
746
+ "whitespace-break-spaces": prefix("whitespace"),
747
+ // Word break
748
+ "break-normal": prefix("word-break"),
749
+ "break-words": prefix("word-break"),
750
+ "break-all": prefix("word-break"),
751
+ "break-keep": prefix("word-break"),
752
+ // Hyphens
753
+ "hyphens-none": prefix("hyphens"),
754
+ "hyphens-manual": prefix("hyphens"),
755
+ "hyphens-auto": prefix("hyphens"),
756
+ // Overflow wrap
757
+ "wrap-normal": prefix("overflow-wrap"),
758
+ "wrap-break-word": prefix("overflow-wrap"),
759
+ "wrap-anywhere": prefix("overflow-wrap")
760
+ },
761
+ patterns: [
762
+ // Font family arbitrary
763
+ { pattern: /^font-\[/, groupId: "font-family", specificity: 1 },
764
+ // Font weight numeric
765
+ { pattern: /^font-\d+$/, groupId: "font-weight", specificity: 1 },
766
+ // Tracking arbitrary
767
+ { pattern: /^tracking-\[/, groupId: "letter-spacing", specificity: 1 },
768
+ // Leading arbitrary
769
+ { pattern: /^leading-\[/, groupId: "line-height", specificity: 1 },
770
+ // List style arbitrary
771
+ { pattern: /^list-\[/, groupId: "list-style-type", specificity: 1 },
772
+ // Decoration arbitrary
773
+ { pattern: /^decoration-\[/, groupId: "text-decoration-thickness", specificity: 1 }
774
+ ],
775
+ conflicts: {
776
+ "font-family": ["font-family"],
777
+ "font-size": ["font-size"],
778
+ "font-smoothing": ["font-smoothing"],
779
+ "font-style": ["font-style"],
780
+ "font-weight": ["font-weight"],
781
+ "font-variant-numeric": ["font-variant-numeric"],
782
+ "font-stretch": ["font-stretch"],
783
+ "letter-spacing": ["letter-spacing"],
784
+ "line-height": ["line-height"],
785
+ "line-clamp": ["line-clamp"],
786
+ "list-image": ["list-image"],
787
+ "list-style-position": ["list-style-position"],
788
+ "list-style-type": ["list-style-type"],
789
+ "text-align": ["text-align"],
790
+ "text-decoration": ["text-decoration"],
791
+ "text-decoration-color": ["text-decoration-color"],
792
+ "text-decoration-style": ["text-decoration-style"],
793
+ "text-decoration-thickness": ["text-decoration-thickness"],
794
+ "text-underline-offset": ["text-underline-offset"],
795
+ "text-transform": ["text-transform"],
796
+ "text-overflow": ["text-overflow"],
797
+ "text-wrap": ["text-wrap"],
798
+ "text-indent": ["text-indent"],
799
+ "vertical-align": ["vertical-align"],
800
+ whitespace: ["whitespace"],
801
+ "word-break": ["word-break"],
802
+ hyphens: ["hyphens"],
803
+ "overflow-wrap": ["overflow-wrap"],
804
+ content: ["content"]
805
+ }
806
+ };
807
+
808
+ // src/groups/colors.ts
809
+ var COLOR_NAMES = [
810
+ "slate",
811
+ "gray",
812
+ "zinc",
813
+ "neutral",
814
+ "stone",
815
+ "red",
816
+ "orange",
817
+ "amber",
818
+ "yellow",
819
+ "lime",
820
+ "green",
821
+ "emerald",
822
+ "teal",
823
+ "cyan",
824
+ "sky",
825
+ "blue",
826
+ "indigo",
827
+ "violet",
828
+ "purple",
829
+ "fuchsia",
830
+ "pink",
831
+ "rose"
832
+ ];
833
+ var SPECIAL_COLORS = ["inherit", "current", "transparent", "black", "white"];
834
+ function createColorPrefixes(prefixStr, groupId) {
835
+ const prefixes = {};
836
+ for (const color of COLOR_NAMES) {
837
+ prefixes[`${prefixStr}${color}-`] = prefix(groupId);
838
+ }
839
+ prefixes[`${prefixStr}[`] = prefix(groupId);
840
+ return prefixes;
841
+ }
842
+ function createSpecialColorMatches(prefixStr, groupId) {
843
+ const matches = {};
844
+ for (const color of SPECIAL_COLORS) {
845
+ matches[`${prefixStr}${color}`] = prefix(groupId);
846
+ }
847
+ return matches;
848
+ }
849
+ var COLOR_UTILITIES = [
850
+ ["text-", "text-color"],
851
+ ["bg-", "bg-color"],
852
+ ["border-", "border-color"],
853
+ ["outline-", "outline-color"],
854
+ ["ring-", "ring-color"],
855
+ ["ring-offset-", "ring-offset-color"],
856
+ ["divide-", "divide-color"],
857
+ ["accent-", "accent-color"],
858
+ ["caret-", "caret-color"],
859
+ ["fill-", "fill"],
860
+ ["stroke-", "stroke"],
861
+ ["shadow-", "box-shadow-color"],
862
+ ["placeholder-", "placeholder-color"],
863
+ ["from-", "gradient-from"],
864
+ ["via-", "gradient-via"],
865
+ ["to-", "gradient-to"]
866
+ ];
867
+ function generateAllColorPrefixes() {
868
+ const prefixes = {};
869
+ for (const [utilityPrefix, groupId] of COLOR_UTILITIES) {
870
+ Object.assign(prefixes, createColorPrefixes(utilityPrefix, groupId));
871
+ }
872
+ return prefixes;
873
+ }
874
+ var SPECIAL_COLOR_UTILITIES = [
875
+ ["text-", "text-color"],
876
+ ["bg-", "bg-color"],
877
+ ["border-", "border-color"],
878
+ ["outline-", "outline-color"],
879
+ ["ring-", "ring-color"]
880
+ ];
881
+ function generateSpecialColorMatches() {
882
+ const matches = {};
883
+ for (const [utilityPrefix, groupId] of SPECIAL_COLOR_UTILITIES) {
884
+ Object.assign(matches, createSpecialColorMatches(utilityPrefix, groupId));
885
+ }
886
+ return matches;
887
+ }
888
+ var colorGroups = {
889
+ prefixes: generateAllColorPrefixes(),
890
+ exactMatches: {
891
+ ...generateSpecialColorMatches(),
892
+ // Gradient stop reset
893
+ "via-none": prefix("gradient-via")
894
+ },
895
+ // No patterns needed - all handled by prefixes now
896
+ patterns: [],
897
+ conflicts: simpleConflicts(
898
+ "text-color",
899
+ "bg-color",
900
+ "border-color",
901
+ "outline-color",
902
+ "ring-color",
903
+ "ring-offset-color",
904
+ "divide-color",
905
+ "accent-color",
906
+ "caret-color",
907
+ "fill",
908
+ "stroke",
909
+ "box-shadow-color",
910
+ "placeholder-color",
911
+ "gradient-from",
912
+ "gradient-via",
913
+ "gradient-to"
914
+ )
915
+ };
916
+
917
+ // src/groups/backgrounds.ts
918
+ var backgroundGroups = {
919
+ prefixes: {
920
+ // Background image - gradient directions
921
+ "bg-gradient-to-": prefix("bg-image"),
922
+ // Background image - gradient types (v4)
923
+ "bg-linear-": prefix("bg-image"),
924
+ "-bg-linear-": prefix("bg-image"),
925
+ "bg-radial-": prefix("bg-image"),
926
+ "bg-conic-": prefix("bg-image"),
927
+ "-bg-conic-": prefix("bg-image")
928
+ },
929
+ exactMatches: {
930
+ // Background attachment
931
+ "bg-fixed": prefix("bg-attachment"),
932
+ "bg-local": prefix("bg-attachment"),
933
+ "bg-scroll": prefix("bg-attachment"),
934
+ // Background clip
935
+ "bg-clip-border": prefix("bg-clip"),
936
+ "bg-clip-padding": prefix("bg-clip"),
937
+ "bg-clip-content": prefix("bg-clip"),
938
+ "bg-clip-text": prefix("bg-clip"),
939
+ // Background origin
940
+ "bg-origin-border": prefix("bg-origin"),
941
+ "bg-origin-padding": prefix("bg-origin"),
942
+ "bg-origin-content": prefix("bg-origin"),
943
+ // Background position
944
+ "bg-bottom": prefix("bg-position"),
945
+ "bg-center": prefix("bg-position"),
946
+ "bg-left": prefix("bg-position"),
947
+ "bg-left-bottom": prefix("bg-position"),
948
+ "bg-left-top": prefix("bg-position"),
949
+ "bg-right": prefix("bg-position"),
950
+ "bg-right-bottom": prefix("bg-position"),
951
+ "bg-right-top": prefix("bg-position"),
952
+ "bg-top": prefix("bg-position"),
953
+ // Background repeat
954
+ "bg-repeat": prefix("bg-repeat"),
955
+ "bg-no-repeat": prefix("bg-repeat"),
956
+ "bg-repeat-x": prefix("bg-repeat"),
957
+ "bg-repeat-y": prefix("bg-repeat"),
958
+ "bg-repeat-round": prefix("bg-repeat"),
959
+ "bg-repeat-space": prefix("bg-repeat"),
960
+ // Background size
961
+ "bg-auto": prefix("bg-size"),
962
+ "bg-cover": prefix("bg-size"),
963
+ "bg-contain": prefix("bg-size"),
964
+ // Background image
965
+ "bg-none": prefix("bg-image")
966
+ },
967
+ patterns: [
968
+ // Background position arbitrary
969
+ { pattern: /^bg-\[position:/, groupId: "bg-position", specificity: 1 },
970
+ // Background size arbitrary
971
+ { pattern: /^bg-\[size:/, groupId: "bg-size", specificity: 1 },
972
+ // Background image url
973
+ { pattern: /^bg-\[url/, groupId: "bg-image", specificity: 1 }
974
+ ],
975
+ conflicts: {
976
+ "bg-attachment": ["bg-attachment"],
977
+ "bg-clip": ["bg-clip"],
978
+ "bg-origin": ["bg-origin"],
979
+ "bg-position": ["bg-position"],
980
+ "bg-repeat": ["bg-repeat"],
981
+ "bg-size": ["bg-size"],
982
+ "bg-image": ["bg-image"]
983
+ }
984
+ };
985
+
986
+ // src/groups/borders.ts
987
+ var BORDER_WIDTH_HIERARCHY = {
988
+ "border-width": { x: ["l", "r", "s", "e"], y: ["t", "b"] },
989
+ "border-spacing": { x: [], y: [] }
990
+ };
991
+ function borderRadiusConflicts() {
992
+ const base = "border-radius";
993
+ const sides = ["t", "r", "b", "l", "s", "e"];
994
+ const corners = {
995
+ tl: ["t", "l"],
996
+ tr: ["t", "r"],
997
+ br: ["b", "r"],
998
+ bl: ["b", "l"],
999
+ ss: ["s"],
1000
+ se: ["s", "e"],
1001
+ es: ["e", "s"],
1002
+ ee: ["e"]
1003
+ };
1004
+ const allGroups = [base, ...sides.map((s) => `${base}-${s}`), ...Object.keys(corners).map((c) => `${base}-${c}`)];
1005
+ const conflicts = {};
1006
+ conflicts[base] = allGroups;
1007
+ for (const side of sides) {
1008
+ const sideGroup = `${base}-${side}`;
1009
+ const cornersOnSide = Object.entries(corners).filter(([_, adjSides]) => adjSides.includes(side)).map(([corner]) => `${base}-${corner}`);
1010
+ conflicts[sideGroup] = [base, sideGroup, ...cornersOnSide];
1011
+ }
1012
+ for (const [corner, adjSides] of Object.entries(corners)) {
1013
+ const cornerGroup = `${base}-${corner}`;
1014
+ conflicts[cornerGroup] = [base, ...adjSides.map((s) => `${base}-${s}`), cornerGroup];
1015
+ }
1016
+ return conflicts;
1017
+ }
1018
+ var borderGroups = {
1019
+ prefixes: {
1020
+ // Border radius
1021
+ "rounded-": prefix("border-radius", SPECIFICITY.ALL),
1022
+ "rounded-t-": prefix("border-radius-t", SPECIFICITY.AXIS),
1023
+ "rounded-r-": prefix("border-radius-r", SPECIFICITY.AXIS),
1024
+ "rounded-b-": prefix("border-radius-b", SPECIFICITY.AXIS),
1025
+ "rounded-l-": prefix("border-radius-l", SPECIFICITY.AXIS),
1026
+ "rounded-tl-": prefix("border-radius-tl", SPECIFICITY.SIDE),
1027
+ "rounded-tr-": prefix("border-radius-tr", SPECIFICITY.SIDE),
1028
+ "rounded-br-": prefix("border-radius-br", SPECIFICITY.SIDE),
1029
+ "rounded-bl-": prefix("border-radius-bl", SPECIFICITY.SIDE),
1030
+ "rounded-s-": prefix("border-radius-s", SPECIFICITY.AXIS),
1031
+ "rounded-e-": prefix("border-radius-e", SPECIFICITY.AXIS),
1032
+ "rounded-ss-": prefix("border-radius-ss", SPECIFICITY.SIDE),
1033
+ "rounded-se-": prefix("border-radius-se", SPECIFICITY.SIDE),
1034
+ "rounded-es-": prefix("border-radius-es", SPECIFICITY.SIDE),
1035
+ "rounded-ee-": prefix("border-radius-ee", SPECIFICITY.SIDE),
1036
+ // Border width (handled by exact matches mostly, but prefix for arbitrary)
1037
+ "border-x-": prefix("border-width-x", SPECIFICITY.AXIS),
1038
+ "border-y-": prefix("border-width-y", SPECIFICITY.AXIS),
1039
+ "border-t-": prefix("border-width-t", SPECIFICITY.SIDE),
1040
+ "border-r-": prefix("border-width-r", SPECIFICITY.SIDE),
1041
+ "border-b-": prefix("border-width-b", SPECIFICITY.SIDE),
1042
+ "border-l-": prefix("border-width-l", SPECIFICITY.SIDE),
1043
+ "border-s-": prefix("border-width-s", SPECIFICITY.SIDE),
1044
+ "border-e-": prefix("border-width-e", SPECIFICITY.SIDE),
1045
+ // Border spacing
1046
+ "border-spacing-": prefix("border-spacing", SPECIFICITY.ALL),
1047
+ "border-spacing-x-": prefix("border-spacing-x", SPECIFICITY.AXIS),
1048
+ "border-spacing-y-": prefix("border-spacing-y", SPECIFICITY.AXIS),
1049
+ // Divide
1050
+ "divide-x-": prefix("divide-x"),
1051
+ "divide-y-": prefix("divide-y"),
1052
+ // Outline
1053
+ "outline-offset-": prefix("outline-offset"),
1054
+ // Ring
1055
+ "ring-offset-": prefix("ring-offset-width")
1056
+ },
1057
+ exactMatches: {
1058
+ // Border radius exact
1059
+ rounded: prefix("border-radius", SPECIFICITY.ALL),
1060
+ "rounded-none": prefix("border-radius", SPECIFICITY.ALL),
1061
+ "rounded-sm": prefix("border-radius", SPECIFICITY.ALL),
1062
+ "rounded-md": prefix("border-radius", SPECIFICITY.ALL),
1063
+ "rounded-lg": prefix("border-radius", SPECIFICITY.ALL),
1064
+ "rounded-xl": prefix("border-radius", SPECIFICITY.ALL),
1065
+ "rounded-2xl": prefix("border-radius", SPECIFICITY.ALL),
1066
+ "rounded-3xl": prefix("border-radius", SPECIFICITY.ALL),
1067
+ "rounded-full": prefix("border-radius", SPECIFICITY.ALL),
1068
+ "rounded-t": prefix("border-radius-t", SPECIFICITY.AXIS),
1069
+ "rounded-t-none": prefix("border-radius-t", SPECIFICITY.AXIS),
1070
+ "rounded-t-sm": prefix("border-radius-t", SPECIFICITY.AXIS),
1071
+ "rounded-t-md": prefix("border-radius-t", SPECIFICITY.AXIS),
1072
+ "rounded-t-lg": prefix("border-radius-t", SPECIFICITY.AXIS),
1073
+ "rounded-t-xl": prefix("border-radius-t", SPECIFICITY.AXIS),
1074
+ "rounded-t-2xl": prefix("border-radius-t", SPECIFICITY.AXIS),
1075
+ "rounded-t-3xl": prefix("border-radius-t", SPECIFICITY.AXIS),
1076
+ "rounded-t-full": prefix("border-radius-t", SPECIFICITY.AXIS),
1077
+ "rounded-r": prefix("border-radius-r", SPECIFICITY.AXIS),
1078
+ "rounded-b": prefix("border-radius-b", SPECIFICITY.AXIS),
1079
+ "rounded-l": prefix("border-radius-l", SPECIFICITY.AXIS),
1080
+ "rounded-s": prefix("border-radius-s", SPECIFICITY.AXIS),
1081
+ "rounded-e": prefix("border-radius-e", SPECIFICITY.AXIS),
1082
+ "rounded-tl": prefix("border-radius-tl", SPECIFICITY.SIDE),
1083
+ "rounded-tr": prefix("border-radius-tr", SPECIFICITY.SIDE),
1084
+ "rounded-br": prefix("border-radius-br", SPECIFICITY.SIDE),
1085
+ "rounded-bl": prefix("border-radius-bl", SPECIFICITY.SIDE),
1086
+ // Border width
1087
+ border: prefix("border-width", SPECIFICITY.ALL),
1088
+ "border-0": prefix("border-width", SPECIFICITY.ALL),
1089
+ "border-2": prefix("border-width", SPECIFICITY.ALL),
1090
+ "border-4": prefix("border-width", SPECIFICITY.ALL),
1091
+ "border-8": prefix("border-width", SPECIFICITY.ALL),
1092
+ "border-x": prefix("border-width-x", SPECIFICITY.AXIS),
1093
+ "border-x-0": prefix("border-width-x", SPECIFICITY.AXIS),
1094
+ "border-x-2": prefix("border-width-x", SPECIFICITY.AXIS),
1095
+ "border-x-4": prefix("border-width-x", SPECIFICITY.AXIS),
1096
+ "border-x-8": prefix("border-width-x", SPECIFICITY.AXIS),
1097
+ "border-y": prefix("border-width-y", SPECIFICITY.AXIS),
1098
+ "border-y-0": prefix("border-width-y", SPECIFICITY.AXIS),
1099
+ "border-y-2": prefix("border-width-y", SPECIFICITY.AXIS),
1100
+ "border-y-4": prefix("border-width-y", SPECIFICITY.AXIS),
1101
+ "border-y-8": prefix("border-width-y", SPECIFICITY.AXIS),
1102
+ "border-t": prefix("border-width-t", SPECIFICITY.SIDE),
1103
+ "border-t-0": prefix("border-width-t", SPECIFICITY.SIDE),
1104
+ "border-t-2": prefix("border-width-t", SPECIFICITY.SIDE),
1105
+ "border-t-4": prefix("border-width-t", SPECIFICITY.SIDE),
1106
+ "border-t-8": prefix("border-width-t", SPECIFICITY.SIDE),
1107
+ "border-r": prefix("border-width-r", SPECIFICITY.SIDE),
1108
+ "border-b": prefix("border-width-b", SPECIFICITY.SIDE),
1109
+ "border-l": prefix("border-width-l", SPECIFICITY.SIDE),
1110
+ "border-s": prefix("border-width-s", SPECIFICITY.SIDE),
1111
+ "border-e": prefix("border-width-e", SPECIFICITY.SIDE),
1112
+ // Border style
1113
+ "border-solid": prefix("border-style"),
1114
+ "border-dashed": prefix("border-style"),
1115
+ "border-dotted": prefix("border-style"),
1116
+ "border-double": prefix("border-style"),
1117
+ "border-hidden": prefix("border-style"),
1118
+ "border-none": prefix("border-style"),
1119
+ // Border collapse
1120
+ "border-collapse": prefix("border-collapse"),
1121
+ "border-separate": prefix("border-collapse"),
1122
+ // Divide style
1123
+ "divide-solid": prefix("divide-style"),
1124
+ "divide-dashed": prefix("divide-style"),
1125
+ "divide-dotted": prefix("divide-style"),
1126
+ "divide-double": prefix("divide-style"),
1127
+ "divide-none": prefix("divide-style"),
1128
+ // Divide reverse
1129
+ "divide-x-reverse": prefix("divide-x-reverse"),
1130
+ "divide-y-reverse": prefix("divide-y-reverse"),
1131
+ // Outline style
1132
+ outline: prefix("outline-style"),
1133
+ "outline-none": prefix("outline-style"),
1134
+ "outline-hidden": prefix("outline-style"),
1135
+ "outline-dashed": prefix("outline-style"),
1136
+ "outline-dotted": prefix("outline-style"),
1137
+ "outline-double": prefix("outline-style"),
1138
+ // Outline width (must be exact to avoid conflicting with outline-color)
1139
+ "outline-0": prefix("outline-width"),
1140
+ "outline-1": prefix("outline-width"),
1141
+ "outline-2": prefix("outline-width"),
1142
+ "outline-4": prefix("outline-width"),
1143
+ "outline-8": prefix("outline-width"),
1144
+ // Ring width
1145
+ ring: prefix("ring-width"),
1146
+ "ring-0": prefix("ring-width"),
1147
+ "ring-1": prefix("ring-width"),
1148
+ "ring-2": prefix("ring-width"),
1149
+ "ring-4": prefix("ring-width"),
1150
+ "ring-8": prefix("ring-width"),
1151
+ "ring-inset": prefix("ring-width")
1152
+ },
1153
+ patterns: [
1154
+ // Border width arbitrary
1155
+ { pattern: /^border-\[\d/, groupId: "border-width", specificity: SPECIFICITY.ALL },
1156
+ { pattern: /^border-\d+$/, groupId: "border-width", specificity: SPECIFICITY.ALL },
1157
+ // Rounded arbitrary
1158
+ { pattern: /^rounded-\[/, groupId: "border-radius", specificity: SPECIFICITY.ALL },
1159
+ // Outline width
1160
+ { pattern: /^outline-\d+$/, groupId: "outline-width", specificity: 1 },
1161
+ { pattern: /^outline-\[.*px/, groupId: "outline-width", specificity: 1 },
1162
+ // Ring arbitrary
1163
+ { pattern: /^ring-\[/, groupId: "ring-width", specificity: 1 },
1164
+ // Ring offset arbitrary
1165
+ { pattern: /^ring-offset-\d+$/, groupId: "ring-offset-width", specificity: 1 },
1166
+ { pattern: /^ring-offset-\[/, groupId: "ring-offset-width", specificity: 1 }
1167
+ ],
1168
+ conflicts: {
1169
+ ...borderRadiusConflicts(),
1170
+ ...generateConflicts(BORDER_WIDTH_HIERARCHY),
1171
+ ...simpleConflicts(
1172
+ "border-style",
1173
+ "border-collapse",
1174
+ "divide-x",
1175
+ "divide-y",
1176
+ "divide-style",
1177
+ "divide-x-reverse",
1178
+ "divide-y-reverse",
1179
+ "outline-style",
1180
+ "outline-width",
1181
+ "outline-offset",
1182
+ "ring-width",
1183
+ "ring-offset-width"
1184
+ )
1185
+ }
1186
+ };
1187
+
1188
+ // src/groups/effects.ts
1189
+ var effectsGroups = {
1190
+ prefixes: {
1191
+ // Opacity
1192
+ "opacity-": prefix("opacity"),
1193
+ // Inset shadow (arbitrary)
1194
+ "inset-shadow-": prefix("inset-shadow"),
1195
+ // Inset ring (arbitrary)
1196
+ "inset-ring-": prefix("inset-ring"),
1197
+ // Text shadow (arbitrary)
1198
+ "text-shadow-": prefix("text-shadow"),
1199
+ // Mix blend
1200
+ "mix-blend-": prefix("mix-blend-mode"),
1201
+ // Background blend
1202
+ "bg-blend-": prefix("bg-blend-mode"),
1203
+ // Filter values
1204
+ "brightness-": prefix("brightness"),
1205
+ "contrast-": prefix("contrast"),
1206
+ "saturate-": prefix("saturate"),
1207
+ "hue-rotate-": prefix("hue-rotate"),
1208
+ "-hue-rotate-": prefix("hue-rotate"),
1209
+ // Backdrop filter values
1210
+ "backdrop-brightness-": prefix("backdrop-brightness"),
1211
+ "backdrop-contrast-": prefix("backdrop-contrast"),
1212
+ "backdrop-saturate-": prefix("backdrop-saturate"),
1213
+ "backdrop-hue-rotate-": prefix("backdrop-hue-rotate"),
1214
+ "-backdrop-hue-rotate-": prefix("backdrop-hue-rotate"),
1215
+ "backdrop-opacity-": prefix("backdrop-opacity")
1216
+ },
1217
+ exactMatches: {
1218
+ // Box shadow
1219
+ shadow: prefix("box-shadow"),
1220
+ "shadow-sm": prefix("box-shadow"),
1221
+ "shadow-md": prefix("box-shadow"),
1222
+ "shadow-lg": prefix("box-shadow"),
1223
+ "shadow-xl": prefix("box-shadow"),
1224
+ "shadow-2xl": prefix("box-shadow"),
1225
+ "shadow-inner": prefix("box-shadow"),
1226
+ "shadow-none": prefix("box-shadow"),
1227
+ // Inset shadow
1228
+ "inset-shadow": prefix("inset-shadow"),
1229
+ "inset-shadow-xs": prefix("inset-shadow"),
1230
+ "inset-shadow-sm": prefix("inset-shadow"),
1231
+ "inset-shadow-md": prefix("inset-shadow"),
1232
+ "inset-shadow-lg": prefix("inset-shadow"),
1233
+ "inset-shadow-none": prefix("inset-shadow"),
1234
+ // Inset ring
1235
+ "inset-ring": prefix("inset-ring"),
1236
+ "inset-ring-0": prefix("inset-ring"),
1237
+ "inset-ring-1": prefix("inset-ring"),
1238
+ "inset-ring-2": prefix("inset-ring"),
1239
+ "inset-ring-4": prefix("inset-ring"),
1240
+ "inset-ring-8": prefix("inset-ring"),
1241
+ // Text shadow
1242
+ "text-shadow": prefix("text-shadow"),
1243
+ "text-shadow-sm": prefix("text-shadow"),
1244
+ "text-shadow-md": prefix("text-shadow"),
1245
+ "text-shadow-lg": prefix("text-shadow"),
1246
+ "text-shadow-none": prefix("text-shadow"),
1247
+ // Box decoration break
1248
+ "box-decoration-clone": prefix("box-decoration-break"),
1249
+ "box-decoration-slice": prefix("box-decoration-break"),
1250
+ // Filter
1251
+ filter: prefix("filter"),
1252
+ "filter-none": prefix("filter"),
1253
+ // Blur
1254
+ blur: prefix("blur"),
1255
+ "blur-none": prefix("blur"),
1256
+ "blur-sm": prefix("blur"),
1257
+ "blur-md": prefix("blur"),
1258
+ "blur-lg": prefix("blur"),
1259
+ "blur-xl": prefix("blur"),
1260
+ "blur-2xl": prefix("blur"),
1261
+ "blur-3xl": prefix("blur"),
1262
+ // Drop shadow
1263
+ "drop-shadow": prefix("drop-shadow"),
1264
+ "drop-shadow-sm": prefix("drop-shadow"),
1265
+ "drop-shadow-md": prefix("drop-shadow"),
1266
+ "drop-shadow-lg": prefix("drop-shadow"),
1267
+ "drop-shadow-xl": prefix("drop-shadow"),
1268
+ "drop-shadow-2xl": prefix("drop-shadow"),
1269
+ "drop-shadow-none": prefix("drop-shadow"),
1270
+ // Grayscale
1271
+ grayscale: prefix("grayscale"),
1272
+ "grayscale-0": prefix("grayscale"),
1273
+ // Invert
1274
+ invert: prefix("invert"),
1275
+ "invert-0": prefix("invert"),
1276
+ // Sepia
1277
+ sepia: prefix("sepia"),
1278
+ "sepia-0": prefix("sepia"),
1279
+ // Backdrop filter
1280
+ "backdrop-filter": prefix("backdrop-filter"),
1281
+ "backdrop-filter-none": prefix("backdrop-filter"),
1282
+ // Backdrop blur
1283
+ "backdrop-blur": prefix("backdrop-blur"),
1284
+ "backdrop-blur-none": prefix("backdrop-blur"),
1285
+ "backdrop-blur-sm": prefix("backdrop-blur"),
1286
+ "backdrop-blur-md": prefix("backdrop-blur"),
1287
+ "backdrop-blur-lg": prefix("backdrop-blur"),
1288
+ "backdrop-blur-xl": prefix("backdrop-blur"),
1289
+ "backdrop-blur-2xl": prefix("backdrop-blur"),
1290
+ "backdrop-blur-3xl": prefix("backdrop-blur"),
1291
+ // Backdrop grayscale
1292
+ "backdrop-grayscale": prefix("backdrop-grayscale"),
1293
+ "backdrop-grayscale-0": prefix("backdrop-grayscale"),
1294
+ // Backdrop invert
1295
+ "backdrop-invert": prefix("backdrop-invert"),
1296
+ "backdrop-invert-0": prefix("backdrop-invert"),
1297
+ // Backdrop sepia
1298
+ "backdrop-sepia": prefix("backdrop-sepia"),
1299
+ "backdrop-sepia-0": prefix("backdrop-sepia")
1300
+ },
1301
+ patterns: [
1302
+ // Shadow arbitrary
1303
+ { pattern: /^shadow-\[/, groupId: "box-shadow", specificity: 1 },
1304
+ // Inset shadow arbitrary
1305
+ { pattern: /^inset-shadow-\[/, groupId: "inset-shadow", specificity: 1 },
1306
+ // Inset ring arbitrary
1307
+ { pattern: /^inset-ring-\[/, groupId: "inset-ring", specificity: 1 },
1308
+ // Text shadow arbitrary
1309
+ { pattern: /^text-shadow-\[/, groupId: "text-shadow", specificity: 1 },
1310
+ // Blur arbitrary
1311
+ { pattern: /^blur-\[/, groupId: "blur", specificity: 1 },
1312
+ // Drop shadow arbitrary
1313
+ { pattern: /^drop-shadow-\[/, groupId: "drop-shadow", specificity: 1 },
1314
+ // Backdrop blur arbitrary
1315
+ { pattern: /^backdrop-blur-\[/, groupId: "backdrop-blur", specificity: 1 }
1316
+ ],
1317
+ conflicts: simpleConflicts(
1318
+ "box-shadow",
1319
+ "box-shadow-color",
1320
+ "inset-shadow",
1321
+ "inset-shadow-color",
1322
+ "inset-ring",
1323
+ "inset-ring-color",
1324
+ "text-shadow",
1325
+ "text-shadow-color",
1326
+ "box-decoration-break",
1327
+ "opacity",
1328
+ "mix-blend-mode",
1329
+ "bg-blend-mode",
1330
+ "filter",
1331
+ "blur",
1332
+ "brightness",
1333
+ "contrast",
1334
+ "drop-shadow",
1335
+ "grayscale",
1336
+ "hue-rotate",
1337
+ "invert",
1338
+ "saturate",
1339
+ "sepia",
1340
+ "backdrop-filter",
1341
+ "backdrop-blur",
1342
+ "backdrop-brightness",
1343
+ "backdrop-contrast",
1344
+ "backdrop-grayscale",
1345
+ "backdrop-hue-rotate",
1346
+ "backdrop-invert",
1347
+ "backdrop-opacity",
1348
+ "backdrop-saturate",
1349
+ "backdrop-sepia"
1350
+ )
1351
+ };
1352
+
1353
+ // src/groups/transforms.ts
1354
+ var transformGroups = {
1355
+ prefixes: {
1356
+ // Scale (2D)
1357
+ "scale-": prefix("scale", SPECIFICITY.ALL),
1358
+ "-scale-": prefix("scale", SPECIFICITY.ALL),
1359
+ "scale-x-": prefix("scale-x", SPECIFICITY.AXIS),
1360
+ "-scale-x-": prefix("scale-x", SPECIFICITY.AXIS),
1361
+ "scale-y-": prefix("scale-y", SPECIFICITY.AXIS),
1362
+ "-scale-y-": prefix("scale-y", SPECIFICITY.AXIS),
1363
+ // Scale (3D)
1364
+ "scale-z-": prefix("scale-z", SPECIFICITY.AXIS),
1365
+ "-scale-z-": prefix("scale-z", SPECIFICITY.AXIS),
1366
+ // Rotate (2D - default Z-axis)
1367
+ "rotate-": prefix("rotate"),
1368
+ "-rotate-": prefix("rotate"),
1369
+ // Rotate (3D axes)
1370
+ "rotate-x-": prefix("rotate-x"),
1371
+ "-rotate-x-": prefix("rotate-x"),
1372
+ "rotate-y-": prefix("rotate-y"),
1373
+ "-rotate-y-": prefix("rotate-y"),
1374
+ "rotate-z-": prefix("rotate-z"),
1375
+ "-rotate-z-": prefix("rotate-z"),
1376
+ // Translate (2D)
1377
+ "translate-": prefix("translate", SPECIFICITY.ALL),
1378
+ "-translate-": prefix("translate", SPECIFICITY.ALL),
1379
+ "translate-x-": prefix("translate-x", SPECIFICITY.AXIS),
1380
+ "-translate-x-": prefix("translate-x", SPECIFICITY.AXIS),
1381
+ "translate-y-": prefix("translate-y", SPECIFICITY.AXIS),
1382
+ "-translate-y-": prefix("translate-y", SPECIFICITY.AXIS),
1383
+ // Translate (3D)
1384
+ "translate-z-": prefix("translate-z", SPECIFICITY.AXIS),
1385
+ "-translate-z-": prefix("translate-z", SPECIFICITY.AXIS),
1386
+ // Skew
1387
+ "skew-x-": prefix("skew-x"),
1388
+ "-skew-x-": prefix("skew-x"),
1389
+ "skew-y-": prefix("skew-y"),
1390
+ "-skew-y-": prefix("skew-y"),
1391
+ // Transform origin
1392
+ "origin-": prefix("transform-origin"),
1393
+ // Perspective
1394
+ "perspective-": prefix("perspective"),
1395
+ // Perspective origin
1396
+ "perspective-origin-": prefix("perspective-origin")
1397
+ },
1398
+ exactMatches: {
1399
+ // Transform
1400
+ transform: prefix("transform"),
1401
+ "transform-cpu": prefix("transform"),
1402
+ "transform-gpu": prefix("transform"),
1403
+ "transform-none": prefix("transform"),
1404
+ // Transform style (3D)
1405
+ "transform-3d": prefix("transform-style"),
1406
+ "transform-flat": prefix("transform-style"),
1407
+ // Backface visibility
1408
+ "backface-visible": prefix("backface-visibility"),
1409
+ "backface-hidden": prefix("backface-visibility"),
1410
+ // Perspective none
1411
+ "perspective-none": prefix("perspective"),
1412
+ // Transform box
1413
+ "transform-box-content": prefix("transform-box"),
1414
+ "transform-box-border": prefix("transform-box"),
1415
+ "transform-box-fill": prefix("transform-box"),
1416
+ "transform-box-stroke": prefix("transform-box"),
1417
+ "transform-box-view": prefix("transform-box"),
1418
+ // Scale static
1419
+ "scale-none": prefix("scale", SPECIFICITY.ALL),
1420
+ "scale-3d": prefix("scale", SPECIFICITY.ALL),
1421
+ // Rotate static
1422
+ "rotate-none": prefix("rotate"),
1423
+ // Translate static
1424
+ "translate-none": prefix("translate", SPECIFICITY.ALL),
1425
+ "translate-full": prefix("translate", SPECIFICITY.ALL),
1426
+ "-translate-full": prefix("translate", SPECIFICITY.ALL),
1427
+ // Perspective origin positions
1428
+ "perspective-origin-center": prefix("perspective-origin"),
1429
+ "perspective-origin-top": prefix("perspective-origin"),
1430
+ "perspective-origin-top-right": prefix("perspective-origin"),
1431
+ "perspective-origin-right": prefix("perspective-origin"),
1432
+ "perspective-origin-bottom-right": prefix("perspective-origin"),
1433
+ "perspective-origin-bottom": prefix("perspective-origin"),
1434
+ "perspective-origin-bottom-left": prefix("perspective-origin"),
1435
+ "perspective-origin-left": prefix("perspective-origin"),
1436
+ "perspective-origin-top-left": prefix("perspective-origin")
1437
+ },
1438
+ patterns: [
1439
+ // Perspective arbitrary
1440
+ { pattern: /^perspective-\[/, groupId: "perspective", specificity: 1 }
1441
+ ],
1442
+ conflicts: {
1443
+ transform: ["transform"],
1444
+ "transform-style": ["transform-style"],
1445
+ "backface-visibility": ["backface-visibility"],
1446
+ perspective: ["perspective"],
1447
+ "perspective-origin": ["perspective-origin"],
1448
+ // Scale - 2D bidirectional (scale-z is independent 3D axis)
1449
+ scale: ["scale", "scale-x", "scale-y"],
1450
+ "scale-x": ["scale", "scale-x"],
1451
+ "scale-y": ["scale", "scale-y"],
1452
+ "scale-z": ["scale-z"],
1453
+ // Rotate - each axis is independent
1454
+ rotate: ["rotate"],
1455
+ "rotate-x": ["rotate-x"],
1456
+ "rotate-y": ["rotate-y"],
1457
+ "rotate-z": ["rotate-z"],
1458
+ // Translate - 2D bidirectional (translate-z is independent 3D axis)
1459
+ translate: ["translate", "translate-x", "translate-y"],
1460
+ "translate-x": ["translate", "translate-x"],
1461
+ "translate-y": ["translate", "translate-y"],
1462
+ "translate-z": ["translate-z"],
1463
+ ...simpleConflicts("skew-x", "skew-y", "transform-origin", "transform-box")
1464
+ }
1465
+ };
1466
+
1467
+ // src/groups/transitions.ts
1468
+ var transitionGroups = {
1469
+ prefixes: {
1470
+ // Duration
1471
+ "duration-": prefix("transition-duration"),
1472
+ // Delay
1473
+ "delay-": prefix("transition-delay")
1474
+ },
1475
+ exactMatches: {
1476
+ // Transition
1477
+ transition: prefix("transition"),
1478
+ "transition-none": prefix("transition"),
1479
+ "transition-all": prefix("transition"),
1480
+ "transition-colors": prefix("transition"),
1481
+ "transition-opacity": prefix("transition"),
1482
+ "transition-shadow": prefix("transition"),
1483
+ "transition-transform": prefix("transition"),
1484
+ // Timing function
1485
+ "ease-linear": prefix("transition-timing-function"),
1486
+ "ease-in": prefix("transition-timing-function"),
1487
+ "ease-out": prefix("transition-timing-function"),
1488
+ "ease-in-out": prefix("transition-timing-function"),
1489
+ // Transition behavior (new in v4)
1490
+ "transition-normal": prefix("transition-behavior"),
1491
+ "transition-discrete": prefix("transition-behavior"),
1492
+ // Animation
1493
+ "animate-none": prefix("animation"),
1494
+ "animate-spin": prefix("animation"),
1495
+ "animate-ping": prefix("animation"),
1496
+ "animate-pulse": prefix("animation"),
1497
+ "animate-bounce": prefix("animation")
1498
+ },
1499
+ patterns: [
1500
+ // Animate arbitrary
1501
+ { pattern: /^animate-\[/, groupId: "animation", specificity: 1 }
1502
+ ],
1503
+ conflicts: simpleConflicts(
1504
+ "transition",
1505
+ "transition-duration",
1506
+ "transition-timing-function",
1507
+ "transition-delay",
1508
+ "transition-behavior",
1509
+ "animation"
1510
+ )
1511
+ };
1512
+
1513
+ // src/groups/interactivity.ts
1514
+ var interactivityGroups = {
1515
+ prefixes: {
1516
+ // Cursor
1517
+ "cursor-": prefix("cursor"),
1518
+ // Scroll margin
1519
+ "scroll-m-": prefix("scroll-margin", SPECIFICITY.ALL),
1520
+ "scroll-mx-": prefix("scroll-margin-x", SPECIFICITY.AXIS),
1521
+ "scroll-my-": prefix("scroll-margin-y", SPECIFICITY.AXIS),
1522
+ "scroll-mt-": prefix("scroll-margin-t", SPECIFICITY.SIDE),
1523
+ "scroll-mr-": prefix("scroll-margin-r", SPECIFICITY.SIDE),
1524
+ "scroll-mb-": prefix("scroll-margin-b", SPECIFICITY.SIDE),
1525
+ "scroll-ml-": prefix("scroll-margin-l", SPECIFICITY.SIDE),
1526
+ "scroll-ms-": prefix("scroll-margin-s", SPECIFICITY.SIDE),
1527
+ "scroll-me-": prefix("scroll-margin-e", SPECIFICITY.SIDE),
1528
+ // Scroll padding
1529
+ "scroll-p-": prefix("scroll-padding", SPECIFICITY.ALL),
1530
+ "scroll-px-": prefix("scroll-padding-x", SPECIFICITY.AXIS),
1531
+ "scroll-py-": prefix("scroll-padding-y", SPECIFICITY.AXIS),
1532
+ "scroll-pt-": prefix("scroll-padding-t", SPECIFICITY.SIDE),
1533
+ "scroll-pr-": prefix("scroll-padding-r", SPECIFICITY.SIDE),
1534
+ "scroll-pb-": prefix("scroll-padding-b", SPECIFICITY.SIDE),
1535
+ "scroll-pl-": prefix("scroll-padding-l", SPECIFICITY.SIDE),
1536
+ "scroll-ps-": prefix("scroll-padding-s", SPECIFICITY.SIDE),
1537
+ "scroll-pe-": prefix("scroll-padding-e", SPECIFICITY.SIDE),
1538
+ // Will change
1539
+ "will-change-": prefix("will-change")
1540
+ },
1541
+ exactMatches: {
1542
+ // Appearance
1543
+ "appearance-none": prefix("appearance"),
1544
+ "appearance-auto": prefix("appearance"),
1545
+ // Pointer events
1546
+ "pointer-events-none": prefix("pointer-events"),
1547
+ "pointer-events-auto": prefix("pointer-events"),
1548
+ // Resize
1549
+ resize: prefix("resize"),
1550
+ "resize-none": prefix("resize"),
1551
+ "resize-y": prefix("resize"),
1552
+ "resize-x": prefix("resize"),
1553
+ // Scroll behavior
1554
+ "scroll-auto": prefix("scroll-behavior"),
1555
+ "scroll-smooth": prefix("scroll-behavior"),
1556
+ // Scroll snap align
1557
+ "snap-start": prefix("scroll-snap-align"),
1558
+ "snap-end": prefix("scroll-snap-align"),
1559
+ "snap-center": prefix("scroll-snap-align"),
1560
+ "snap-align-none": prefix("scroll-snap-align"),
1561
+ // Scroll snap stop
1562
+ "snap-normal": prefix("scroll-snap-stop"),
1563
+ "snap-always": prefix("scroll-snap-stop"),
1564
+ // Scroll snap type
1565
+ "snap-none": prefix("scroll-snap-type"),
1566
+ "snap-x": prefix("scroll-snap-type"),
1567
+ "snap-y": prefix("scroll-snap-type"),
1568
+ "snap-both": prefix("scroll-snap-type"),
1569
+ "snap-mandatory": prefix("scroll-snap-type"),
1570
+ "snap-proximity": prefix("scroll-snap-type"),
1571
+ // Touch action
1572
+ "touch-auto": prefix("touch-action"),
1573
+ "touch-none": prefix("touch-action"),
1574
+ "touch-pan-x": prefix("touch-action"),
1575
+ "touch-pan-left": prefix("touch-action"),
1576
+ "touch-pan-right": prefix("touch-action"),
1577
+ "touch-pan-y": prefix("touch-action"),
1578
+ "touch-pan-up": prefix("touch-action"),
1579
+ "touch-pan-down": prefix("touch-action"),
1580
+ "touch-pinch-zoom": prefix("touch-action"),
1581
+ "touch-manipulation": prefix("touch-action"),
1582
+ // User select
1583
+ "select-none": prefix("user-select"),
1584
+ "select-text": prefix("user-select"),
1585
+ "select-all": prefix("user-select"),
1586
+ "select-auto": prefix("user-select"),
1587
+ // Will change
1588
+ "will-change-auto": prefix("will-change"),
1589
+ "will-change-scroll": prefix("will-change"),
1590
+ "will-change-contents": prefix("will-change"),
1591
+ "will-change-transform": prefix("will-change")
1592
+ },
1593
+ patterns: [
1594
+ // Will change arbitrary
1595
+ { pattern: /^will-change-\[/, groupId: "will-change", specificity: 1 }
1596
+ ],
1597
+ conflicts: {
1598
+ appearance: ["appearance"],
1599
+ cursor: ["cursor"],
1600
+ "pointer-events": ["pointer-events"],
1601
+ resize: ["resize"],
1602
+ "scroll-behavior": ["scroll-behavior"],
1603
+ "scroll-margin": [
1604
+ "scroll-margin",
1605
+ "scroll-margin-x",
1606
+ "scroll-margin-y",
1607
+ "scroll-margin-t",
1608
+ "scroll-margin-r",
1609
+ "scroll-margin-b",
1610
+ "scroll-margin-l",
1611
+ "scroll-margin-s",
1612
+ "scroll-margin-e"
1613
+ ],
1614
+ "scroll-margin-x": ["scroll-margin-x", "scroll-margin-l", "scroll-margin-r", "scroll-margin-s", "scroll-margin-e"],
1615
+ "scroll-margin-y": ["scroll-margin-y", "scroll-margin-t", "scroll-margin-b"],
1616
+ "scroll-margin-t": ["scroll-margin-t"],
1617
+ "scroll-margin-r": ["scroll-margin-r"],
1618
+ "scroll-margin-b": ["scroll-margin-b"],
1619
+ "scroll-margin-l": ["scroll-margin-l"],
1620
+ "scroll-margin-s": ["scroll-margin-s"],
1621
+ "scroll-margin-e": ["scroll-margin-e"],
1622
+ "scroll-padding": [
1623
+ "scroll-padding",
1624
+ "scroll-padding-x",
1625
+ "scroll-padding-y",
1626
+ "scroll-padding-t",
1627
+ "scroll-padding-r",
1628
+ "scroll-padding-b",
1629
+ "scroll-padding-l",
1630
+ "scroll-padding-s",
1631
+ "scroll-padding-e"
1632
+ ],
1633
+ "scroll-padding-x": ["scroll-padding-x", "scroll-padding-l", "scroll-padding-r", "scroll-padding-s", "scroll-padding-e"],
1634
+ "scroll-padding-y": ["scroll-padding-y", "scroll-padding-t", "scroll-padding-b"],
1635
+ "scroll-padding-t": ["scroll-padding-t"],
1636
+ "scroll-padding-r": ["scroll-padding-r"],
1637
+ "scroll-padding-b": ["scroll-padding-b"],
1638
+ "scroll-padding-l": ["scroll-padding-l"],
1639
+ "scroll-padding-s": ["scroll-padding-s"],
1640
+ "scroll-padding-e": ["scroll-padding-e"],
1641
+ "scroll-snap-align": ["scroll-snap-align"],
1642
+ "scroll-snap-stop": ["scroll-snap-stop"],
1643
+ "scroll-snap-type": ["scroll-snap-type"],
1644
+ "touch-action": ["touch-action"],
1645
+ "user-select": ["user-select"],
1646
+ "will-change": ["will-change"]
1647
+ }
1648
+ };
1649
+
1650
+ // src/groups/svg.ts
1651
+ var svgGroups = {
1652
+ prefixes: {
1653
+ // Stroke width (numeric values like stroke-2)
1654
+ // Note: stroke-<color> is handled by colors.ts
1655
+ "stroke-": prefix("stroke-width"),
1656
+ // Stroke linecap
1657
+ "stroke-cap-": prefix("stroke-cap"),
1658
+ // Stroke linejoin
1659
+ "stroke-join-": prefix("stroke-join"),
1660
+ // Stroke dasharray
1661
+ "stroke-dash-": prefix("stroke-dash"),
1662
+ // Stroke dashoffset
1663
+ "stroke-offset-": prefix("stroke-offset"),
1664
+ // Stroke miterlimit
1665
+ "stroke-miter-": prefix("stroke-miter"),
1666
+ // Stroke opacity
1667
+ "stroke-opacity-": prefix("stroke-opacity"),
1668
+ // Paint order
1669
+ "paint-": prefix("paint-order"),
1670
+ // Vector effect
1671
+ "vector-": prefix("vector-effect")
1672
+ },
1673
+ exactMatches: {
1674
+ // Stroke linecap exact matches
1675
+ "stroke-cap-butt": prefix("stroke-cap"),
1676
+ "stroke-cap-round": prefix("stroke-cap"),
1677
+ "stroke-cap-square": prefix("stroke-cap"),
1678
+ // Stroke linejoin exact matches
1679
+ "stroke-join-miter": prefix("stroke-join"),
1680
+ "stroke-join-round": prefix("stroke-join"),
1681
+ "stroke-join-bevel": prefix("stroke-join"),
1682
+ // Paint order exact matches
1683
+ "paint-normal": prefix("paint-order"),
1684
+ "paint-stroke": prefix("paint-order"),
1685
+ "paint-fill": prefix("paint-order"),
1686
+ "paint-markers": prefix("paint-order"),
1687
+ "paint-stroke-fill": prefix("paint-order"),
1688
+ "paint-stroke-markers": prefix("paint-order"),
1689
+ "paint-fill-stroke": prefix("paint-order"),
1690
+ "paint-fill-markers": prefix("paint-order"),
1691
+ "paint-markers-stroke": prefix("paint-order"),
1692
+ "paint-markers-fill": prefix("paint-order"),
1693
+ "paint-stroke-fill-markers": prefix("paint-order"),
1694
+ "paint-stroke-markers-fill": prefix("paint-order"),
1695
+ "paint-fill-stroke-markers": prefix("paint-order"),
1696
+ "paint-fill-markers-stroke": prefix("paint-order"),
1697
+ "paint-markers-stroke-fill": prefix("paint-order"),
1698
+ "paint-markers-fill-stroke": prefix("paint-order"),
1699
+ // Vector effect exact matches
1700
+ "vector-none": prefix("vector-effect"),
1701
+ "vector-non-scaling-stroke": prefix("vector-effect"),
1702
+ "vector-non-scaling-size": prefix("vector-effect"),
1703
+ "vector-non-rotation": prefix("vector-effect"),
1704
+ "vector-fixed-position": prefix("vector-effect")
1705
+ },
1706
+ patterns: [
1707
+ // Stroke width numeric
1708
+ { pattern: /^stroke-\d+$/, groupId: "stroke-width", specificity: 1 },
1709
+ // Stroke width arbitrary
1710
+ { pattern: /^stroke-\[/, groupId: "stroke-width", specificity: 1 },
1711
+ // Stroke dasharray arbitrary
1712
+ { pattern: /^stroke-dash-\[/, groupId: "stroke-dash", specificity: 1 },
1713
+ // Stroke dashoffset arbitrary
1714
+ { pattern: /^stroke-offset-\[/, groupId: "stroke-offset", specificity: 1 },
1715
+ // Stroke miterlimit arbitrary
1716
+ { pattern: /^stroke-miter-\[/, groupId: "stroke-miter", specificity: 1 },
1717
+ // Stroke opacity arbitrary
1718
+ { pattern: /^stroke-opacity-\[/, groupId: "stroke-opacity", specificity: 1 }
1719
+ ],
1720
+ conflicts: simpleConflicts(
1721
+ "stroke-width",
1722
+ "stroke-cap",
1723
+ "stroke-join",
1724
+ "stroke-dash",
1725
+ "stroke-offset",
1726
+ "stroke-miter",
1727
+ "stroke-opacity",
1728
+ "paint-order",
1729
+ "vector-effect"
1730
+ )
1731
+ };
1732
+
1733
+ // src/groups/accessibility.ts
1734
+ var accessibilityGroups = {
1735
+ prefixes: {},
1736
+ exactMatches: {
1737
+ // Screen reader
1738
+ "sr-only": prefix("sr-only"),
1739
+ "not-sr-only": prefix("sr-only"),
1740
+ // Forced color adjust
1741
+ "forced-color-adjust-auto": prefix("forced-color-adjust"),
1742
+ "forced-color-adjust-none": prefix("forced-color-adjust")
1743
+ },
1744
+ patterns: [],
1745
+ conflicts: {
1746
+ "sr-only": ["sr-only"],
1747
+ "forced-color-adjust": ["forced-color-adjust"]
1748
+ }
1749
+ };
1750
+
1751
+ // src/groups/tables.ts
1752
+ var tableGroups = {
1753
+ prefixes: {},
1754
+ exactMatches: {
1755
+ // Table layout
1756
+ "table-auto": prefix("table-layout"),
1757
+ "table-fixed": prefix("table-layout"),
1758
+ // Caption side
1759
+ "caption-top": prefix("caption-side"),
1760
+ "caption-bottom": prefix("caption-side")
1761
+ },
1762
+ patterns: [],
1763
+ conflicts: {
1764
+ "table-layout": ["table-layout"],
1765
+ "caption-side": ["caption-side"]
1766
+ }
1767
+ };
1768
+
1769
+ // src/groups/masks.ts
1770
+ var maskGroups = {
1771
+ prefixes: {
1772
+ // Mask image (arbitrary)
1773
+ "mask-": prefix("mask-image"),
1774
+ // Mask size (arbitrary)
1775
+ "mask-size-": prefix("mask-size"),
1776
+ // Mask position (arbitrary)
1777
+ "mask-position-": prefix("mask-position")
1778
+ },
1779
+ exactMatches: {
1780
+ // Mask image
1781
+ "mask-none": prefix("mask-image"),
1782
+ // Mask shape functions
1783
+ "mask-circle": prefix("mask-image"),
1784
+ "mask-ellipse": prefix("mask-image"),
1785
+ "mask-no-clip": prefix("mask-clip"),
1786
+ // Mask radial positions
1787
+ "mask-radial-at-center": prefix("mask-image"),
1788
+ "mask-radial-at-top": prefix("mask-image"),
1789
+ "mask-radial-at-top-left": prefix("mask-image"),
1790
+ "mask-radial-at-top-right": prefix("mask-image"),
1791
+ "mask-radial-at-bottom": prefix("mask-image"),
1792
+ "mask-radial-at-bottom-left": prefix("mask-image"),
1793
+ "mask-radial-at-bottom-right": prefix("mask-image"),
1794
+ "mask-radial-at-left": prefix("mask-image"),
1795
+ "mask-radial-at-right": prefix("mask-image"),
1796
+ // Mask radial sizing
1797
+ "mask-radial-closest-corner": prefix("mask-image"),
1798
+ "mask-radial-closest-side": prefix("mask-image"),
1799
+ "mask-radial-farthest-corner": prefix("mask-image"),
1800
+ "mask-radial-farthest-side": prefix("mask-image"),
1801
+ // Mask composite
1802
+ "mask-add": prefix("mask-composite"),
1803
+ "mask-subtract": prefix("mask-composite"),
1804
+ "mask-intersect": prefix("mask-composite"),
1805
+ "mask-exclude": prefix("mask-composite"),
1806
+ // Mask mode
1807
+ "mask-alpha": prefix("mask-mode"),
1808
+ "mask-luminance": prefix("mask-mode"),
1809
+ "mask-match": prefix("mask-mode"),
1810
+ // Mask type
1811
+ "mask-type-alpha": prefix("mask-type"),
1812
+ "mask-type-luminance": prefix("mask-type"),
1813
+ // Mask size
1814
+ "mask-auto": prefix("mask-size"),
1815
+ "mask-cover": prefix("mask-size"),
1816
+ "mask-contain": prefix("mask-size"),
1817
+ // Mask position
1818
+ "mask-center": prefix("mask-position"),
1819
+ "mask-top": prefix("mask-position"),
1820
+ "mask-top-left": prefix("mask-position"),
1821
+ "mask-top-right": prefix("mask-position"),
1822
+ "mask-bottom": prefix("mask-position"),
1823
+ "mask-bottom-left": prefix("mask-position"),
1824
+ "mask-bottom-right": prefix("mask-position"),
1825
+ "mask-left": prefix("mask-position"),
1826
+ "mask-right": prefix("mask-position"),
1827
+ // Mask repeat
1828
+ "mask-repeat": prefix("mask-repeat"),
1829
+ "mask-no-repeat": prefix("mask-repeat"),
1830
+ "mask-repeat-x": prefix("mask-repeat"),
1831
+ "mask-repeat-y": prefix("mask-repeat"),
1832
+ "mask-repeat-round": prefix("mask-repeat"),
1833
+ "mask-repeat-space": prefix("mask-repeat"),
1834
+ // Mask clip
1835
+ "mask-clip-border": prefix("mask-clip"),
1836
+ "mask-clip-padding": prefix("mask-clip"),
1837
+ "mask-clip-content": prefix("mask-clip"),
1838
+ "mask-clip-fill": prefix("mask-clip"),
1839
+ "mask-clip-stroke": prefix("mask-clip"),
1840
+ "mask-clip-view": prefix("mask-clip"),
1841
+ // Mask origin
1842
+ "mask-origin-border": prefix("mask-origin"),
1843
+ "mask-origin-padding": prefix("mask-origin"),
1844
+ "mask-origin-content": prefix("mask-origin"),
1845
+ "mask-origin-fill": prefix("mask-origin"),
1846
+ "mask-origin-stroke": prefix("mask-origin"),
1847
+ "mask-origin-view": prefix("mask-origin")
1848
+ },
1849
+ patterns: [
1850
+ // Mask image arbitrary (gradients, urls, etc.)
1851
+ { pattern: /^mask-\[/, groupId: "mask-image", specificity: 1 },
1852
+ // Mask linear/radial/conic gradients
1853
+ { pattern: /^mask-linear-/, groupId: "mask-image", specificity: 1 },
1854
+ { pattern: /^mask-radial-/, groupId: "mask-image", specificity: 1 },
1855
+ { pattern: /^mask-conic-/, groupId: "mask-image", specificity: 1 }
1856
+ ],
1857
+ conflicts: simpleConflicts(
1858
+ "mask-image",
1859
+ "mask-composite",
1860
+ "mask-mode",
1861
+ "mask-type",
1862
+ "mask-size",
1863
+ "mask-position",
1864
+ "mask-repeat",
1865
+ "mask-clip",
1866
+ "mask-origin"
1867
+ )
1868
+ };
1869
+
1870
+ // src/groups/full.ts
1871
+ var _fullConfig = null;
1872
+ function getFullConfig() {
1873
+ if (_fullConfig === null) {
1874
+ _fullConfig = mergeConfigs(
1875
+ layoutGroups,
1876
+ spacingGroups,
1877
+ sizingGroups,
1878
+ flexboxGridGroups,
1879
+ typographyGroups,
1880
+ colorGroups,
1881
+ backgroundGroups,
1882
+ borderGroups,
1883
+ effectsGroups,
1884
+ transformGroups,
1885
+ transitionGroups,
1886
+ interactivityGroups,
1887
+ svgGroups,
1888
+ accessibilityGroups,
1889
+ tableGroups,
1890
+ maskGroups
1891
+ );
1892
+ }
1893
+ return _fullConfig;
1894
+ }
1895
+ var fullConfig = new Proxy({}, {
1896
+ get(_, prop) {
1897
+ return getFullConfig()[prop];
1898
+ },
1899
+ ownKeys() {
1900
+ return Reflect.ownKeys(getFullConfig());
1901
+ },
1902
+ getOwnPropertyDescriptor(_, prop) {
1903
+ return Object.getOwnPropertyDescriptor(getFullConfig(), prop);
1904
+ }
1905
+ });
1906
+
1907
+ // src/groups/minimal.ts
1908
+ var minimalConfig = mergeConfigs(
1909
+ layoutGroups,
1910
+ spacingGroups,
1911
+ sizingGroups,
1912
+ flexboxGridGroups,
1913
+ typographyGroups,
1914
+ colorGroups,
1915
+ borderGroups
1916
+ );
1917
+
1918
+ // src/trie.ts
1919
+ function createTrieNode() {
1920
+ return { children: /* @__PURE__ */ new Map(), entry: null };
1921
+ }
1922
+ var PrefixTrie = class {
1923
+ constructor() {
1924
+ this.root = createTrieNode();
1925
+ }
1926
+ insert(prefix2, entry) {
1927
+ let node = this.root;
1928
+ for (const char of prefix2) {
1929
+ if (!node.children.has(char)) {
1930
+ node.children.set(char, createTrieNode());
1931
+ }
1932
+ node = node.children.get(char);
1933
+ }
1934
+ node.entry = entry;
1935
+ }
1936
+ findLongestMatch(className) {
1937
+ let node = this.root;
1938
+ let lastMatch = null;
1939
+ let matchLength = 0;
1940
+ if (node.entry) {
1941
+ lastMatch = { entry: node.entry, matchLength: 0 };
1942
+ }
1943
+ for (const char of className) {
1944
+ const child = node.children.get(char);
1945
+ if (!child) break;
1946
+ node = child;
1947
+ matchLength++;
1948
+ if (node.entry) {
1949
+ lastMatch = { entry: node.entry, matchLength };
1950
+ }
1951
+ }
1952
+ return lastMatch;
1953
+ }
1954
+ };
1955
+
1956
+ // src/class-groups.ts
1957
+ var state = {
1958
+ mode: "full",
1959
+ config: fullConfig,
1960
+ prefixTrie: new PrefixTrie(),
1961
+ exactMatches: /* @__PURE__ */ new Map(),
1962
+ conflicts: {},
1963
+ conflictSets: /* @__PURE__ */ new Map(),
1964
+ initialized: false
1965
+ };
1966
+ function initializeClassifier(config) {
1967
+ state.prefixTrie = new PrefixTrie();
1968
+ state.exactMatches = /* @__PURE__ */ new Map();
1969
+ state.conflicts = config.conflicts;
1970
+ state.conflictSets = /* @__PURE__ */ new Map();
1971
+ for (const [prefix2, entry] of Object.entries(config.prefixes)) {
1972
+ state.prefixTrie.insert(prefix2, entry);
1973
+ }
1974
+ for (const [className, entry] of Object.entries(config.exactMatches)) {
1975
+ state.exactMatches.set(className, entry);
1976
+ }
1977
+ for (const [groupId, conflicts] of Object.entries(config.conflicts)) {
1978
+ state.conflictSets.set(groupId, new Set(conflicts));
1979
+ }
1980
+ state.config = config;
1981
+ state.initialized = true;
1982
+ }
1983
+ function setMergeMode(mode) {
1984
+ if (mode === state.mode && state.initialized) {
1985
+ return;
1986
+ }
1987
+ state.mode = mode;
1988
+ if (mode === false) {
1989
+ state.prefixTrie = new PrefixTrie();
1990
+ state.exactMatches = /* @__PURE__ */ new Map();
1991
+ state.conflicts = {};
1992
+ state.conflictSets = /* @__PURE__ */ new Map();
1993
+ state.initialized = true;
1994
+ return;
1995
+ }
1996
+ const config = mode === "minimal" ? minimalConfig : fullConfig;
1997
+ initializeClassifier(config);
1998
+ }
1999
+ function ensureInitialized() {
2000
+ if (!state.initialized) {
2001
+ setMergeMode(state.mode);
2002
+ }
2003
+ }
2004
+ function classifyClass(utility) {
2005
+ ensureInitialized();
2006
+ if (state.mode === false) {
2007
+ return { group: null, specificity: 1 };
2008
+ }
2009
+ const exactMatch = state.exactMatches.get(utility);
2010
+ if (exactMatch) {
2011
+ return { group: exactMatch.groupId, specificity: exactMatch.specificity };
2012
+ }
2013
+ const prefixMatch = state.prefixTrie.findLongestMatch(utility);
2014
+ if (prefixMatch) {
2015
+ return { group: prefixMatch.entry.groupId, specificity: prefixMatch.entry.specificity };
2016
+ }
2017
+ for (const { pattern, groupId, specificity } of state.config.patterns) {
2018
+ if (pattern.test(utility)) {
2019
+ return { group: groupId, specificity };
2020
+ }
2021
+ }
2022
+ return { group: null, specificity: 1 };
2023
+ }
2024
+ function getConflictingGroups(groupId) {
2025
+ ensureInitialized();
2026
+ return state.conflicts[groupId] ?? [];
2027
+ }
2028
+ function getMergeMode() {
2029
+ return state.mode;
2030
+ }
2031
+ function resetClassifier() {
2032
+ state = {
2033
+ mode: "full",
2034
+ config: fullConfig,
2035
+ prefixTrie: new PrefixTrie(),
2036
+ exactMatches: /* @__PURE__ */ new Map(),
2037
+ conflicts: {},
2038
+ conflictSets: /* @__PURE__ */ new Map(),
2039
+ initialized: false
2040
+ };
2041
+ }
2042
+
2043
+ // src/parser.ts
2044
+ function flattenClassValue(value) {
2045
+ if (value === null || value === void 0 || value === false || value === "") {
2046
+ return "";
2047
+ }
2048
+ if (typeof value === "string") {
2049
+ return value;
2050
+ }
2051
+ if (typeof value === "number" || typeof value === "bigint") {
2052
+ return String(value);
2053
+ }
2054
+ if (Array.isArray(value)) {
2055
+ if (value.length === 1) {
2056
+ return flattenClassValue(value[0]);
2057
+ }
2058
+ let result = "";
2059
+ for (const item of value) {
2060
+ const flattened = flattenClassValue(item);
2061
+ if (flattened) {
2062
+ result = result ? result + " " + flattened : flattened;
2063
+ }
2064
+ }
2065
+ return result;
2066
+ }
2067
+ if (typeof value === "object") {
2068
+ let result = "";
2069
+ for (const key in value) {
2070
+ if (Object.prototype.hasOwnProperty.call(value, key) && value[key]) {
2071
+ result = result ? result + " " + key : key;
2072
+ }
2073
+ }
2074
+ return result;
2075
+ }
2076
+ return "";
2077
+ }
2078
+ function flattenClassValues(...inputs) {
2079
+ if (inputs.length === 1) {
2080
+ return flattenClassValue(inputs[0]);
2081
+ }
2082
+ let result = "";
2083
+ for (const input of inputs) {
2084
+ const flattened = flattenClassValue(input);
2085
+ if (flattened) {
2086
+ result = result ? result + " " + flattened : flattened;
2087
+ }
2088
+ }
2089
+ return result;
2090
+ }
2091
+ var CLASS_SPLIT_REGEX = /\s+/;
2092
+ var ARBITRARY_VALUE_REGEX = /^\[([a-zA-Z-]+):(.+)\]$/;
2093
+ var ARBITRARY_CSS_VAR_REGEX = /^\[(--[a-zA-Z0-9-]+):(.+)\]$/;
2094
+ var POSTFIX_NUMBER_REGEX = /^[\d.]+$/;
2095
+ var POSTFIX_FRACTION_REGEX = /^\d+\/\d+$/;
2096
+ var POSTFIX_NAMED_REGEX = /^[a-z]+$/;
2097
+ function splitClasses(classString) {
2098
+ return classString.split(CLASS_SPLIT_REGEX).filter(Boolean);
2099
+ }
2100
+ function extractModifiers(className) {
2101
+ if (!className.includes("[")) {
2102
+ const colonIndex = className.indexOf(":");
2103
+ if (colonIndex === -1) {
2104
+ if (className.startsWith("!")) {
2105
+ return { modifiers: [], utility: className.slice(1), hasImportant: true };
2106
+ }
2107
+ return { modifiers: [], utility: className, hasImportant: false };
2108
+ }
2109
+ const parts2 = className.split(":");
2110
+ let utility2 = parts2[parts2.length - 1];
2111
+ const modifiers2 = parts2.slice(0, -1);
2112
+ let hasImportant2 = false;
2113
+ if (utility2.startsWith("!")) {
2114
+ utility2 = utility2.slice(1);
2115
+ hasImportant2 = true;
2116
+ }
2117
+ const importantIndex2 = modifiers2.indexOf("!");
2118
+ if (importantIndex2 !== -1) {
2119
+ modifiers2.splice(importantIndex2, 1);
2120
+ hasImportant2 = true;
2121
+ }
2122
+ return { modifiers: modifiers2, utility: utility2, hasImportant: hasImportant2 };
2123
+ }
2124
+ const parts = [];
2125
+ let current = "";
2126
+ let bracketDepth = 0;
2127
+ for (const char of className) {
2128
+ if (char === "[") {
2129
+ bracketDepth++;
2130
+ current += char;
2131
+ } else if (char === "]") {
2132
+ bracketDepth--;
2133
+ current += char;
2134
+ } else if (char === ":" && bracketDepth === 0) {
2135
+ if (current) {
2136
+ parts.push(current);
2137
+ }
2138
+ current = "";
2139
+ } else {
2140
+ current += char;
2141
+ }
2142
+ }
2143
+ if (current) {
2144
+ parts.push(current);
2145
+ }
2146
+ if (parts.length === 0) {
2147
+ return { modifiers: [], utility: "", hasImportant: false };
2148
+ }
2149
+ if (parts.length === 1) {
2150
+ const single = parts[0];
2151
+ if (single.startsWith("!")) {
2152
+ return { modifiers: [], utility: single.slice(1), hasImportant: true };
2153
+ }
2154
+ return { modifiers: [], utility: single, hasImportant: false };
2155
+ }
2156
+ let utility = parts[parts.length - 1];
2157
+ const modifiers = parts.slice(0, -1);
2158
+ let hasImportant = false;
2159
+ if (utility.startsWith("!")) {
2160
+ utility = utility.slice(1);
2161
+ hasImportant = true;
2162
+ }
2163
+ const importantIndex = modifiers.indexOf("!");
2164
+ if (importantIndex !== -1) {
2165
+ modifiers.splice(importantIndex, 1);
2166
+ hasImportant = true;
2167
+ }
2168
+ return { modifiers, utility, hasImportant };
2169
+ }
2170
+ function stripPostfixModifier(utility) {
2171
+ if (utility.includes("[")) {
2172
+ return utility;
2173
+ }
2174
+ const slashIndex = utility.lastIndexOf("/");
2175
+ if (slashIndex === -1) {
2176
+ return utility;
2177
+ }
2178
+ const afterSlash = utility.slice(slashIndex + 1);
2179
+ if (POSTFIX_NUMBER_REGEX.test(afterSlash) || POSTFIX_FRACTION_REGEX.test(afterSlash) || POSTFIX_NAMED_REGEX.test(afterSlash)) {
2180
+ return utility.slice(0, slashIndex);
2181
+ }
2182
+ return utility;
2183
+ }
2184
+ function parseClassBase(className, position) {
2185
+ const { modifiers, utility, hasImportant } = extractModifiers(className);
2186
+ let modifierKey;
2187
+ if (modifiers.length === 0) {
2188
+ modifierKey = "";
2189
+ } else if (modifiers.length === 1) {
2190
+ modifierKey = modifiers[0];
2191
+ } else {
2192
+ modifierKey = [...modifiers].sort().join(":");
2193
+ }
2194
+ const utilityForClassification = stripPostfixModifier(utility);
2195
+ const cssVarMatch = utilityForClassification.match(ARBITRARY_CSS_VAR_REGEX);
2196
+ if (cssVarMatch) {
2197
+ return {
2198
+ raw: className,
2199
+ modifiers,
2200
+ modifierKey,
2201
+ hasImportant,
2202
+ utility,
2203
+ utilityForClassification,
2204
+ isArbitrary: true,
2205
+ arbitraryProperty: cssVarMatch[1],
2206
+ position
2207
+ };
2208
+ }
2209
+ const arbitraryMatch = utilityForClassification.match(ARBITRARY_VALUE_REGEX);
2210
+ if (arbitraryMatch) {
2211
+ return {
2212
+ raw: className,
2213
+ modifiers,
2214
+ modifierKey,
2215
+ hasImportant,
2216
+ utility,
2217
+ utilityForClassification,
2218
+ isArbitrary: true,
2219
+ arbitraryProperty: arbitraryMatch[1],
2220
+ position
2221
+ };
2222
+ }
2223
+ return {
2224
+ raw: className,
2225
+ modifiers,
2226
+ modifierKey,
2227
+ hasImportant,
2228
+ utility,
2229
+ utilityForClassification,
2230
+ isArbitrary: false,
2231
+ position
2232
+ };
2233
+ }
2234
+ function parseClass(className, position) {
2235
+ const base = parseClassBase(className, position);
2236
+ if (base.isArbitrary) {
2237
+ const group2 = base.arbitraryProperty?.startsWith("--") ? "arbitrary-css-var" : `arbitrary-${base.arbitraryProperty}`;
2238
+ return {
2239
+ raw: base.raw,
2240
+ modifiers: base.modifiers,
2241
+ modifierKey: base.modifierKey,
2242
+ hasImportant: base.hasImportant,
2243
+ utility: base.utility,
2244
+ group: group2,
2245
+ isArbitrary: true,
2246
+ arbitraryProperty: base.arbitraryProperty,
2247
+ specificity: SPECIFICITY.ARBITRARY,
2248
+ position: base.position
2249
+ };
2250
+ }
2251
+ const { group, specificity } = classifyClass(base.utilityForClassification);
2252
+ return {
2253
+ raw: base.raw,
2254
+ modifiers: base.modifiers,
2255
+ modifierKey: base.modifierKey,
2256
+ hasImportant: base.hasImportant,
2257
+ utility: base.utility,
2258
+ group,
2259
+ isArbitrary: false,
2260
+ specificity,
2261
+ position: base.position
2262
+ };
2263
+ }
2264
+ function parseClasses(classString) {
2265
+ if (!classString) {
2266
+ return [];
2267
+ }
2268
+ const cache = getParseCache();
2269
+ const cached = cache.get(classString);
2270
+ if (cached !== void 0) {
2271
+ return cached;
2272
+ }
2273
+ const classes = splitClasses(classString);
2274
+ const tokens = new Array(classes.length);
2275
+ for (let i = 0; i < classes.length; i++) {
2276
+ tokens[i] = parseClass(classes[i], i);
2277
+ }
2278
+ cache.set(classString, tokens);
2279
+ return tokens;
2280
+ }
2281
+
2282
+ // src/resolver.ts
2283
+ function resolveCore(tokens, getConflicts, trackRemoved) {
2284
+ const kept = /* @__PURE__ */ new Set();
2285
+ if (tokens.length === 0) {
2286
+ return { kept, removed: trackRemoved ? [] : null };
2287
+ }
2288
+ if (tokens.length === 1) {
2289
+ kept.add(0);
2290
+ return { kept, removed: trackRemoved ? [] : null };
2291
+ }
2292
+ const seen = trackRemoved ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map();
2293
+ const removed = trackRemoved ? [] : null;
2294
+ for (let i = tokens.length - 1; i >= 0; i--) {
2295
+ const token = tokens[i];
2296
+ if (token.group === null) {
2297
+ kept.add(i);
2298
+ continue;
2299
+ }
2300
+ const baseKey = `${token.hasImportant ? "!" : ""}${token.modifierKey}:`;
2301
+ const ownKey = baseKey + token.group;
2302
+ const existing = seen.get(ownKey);
2303
+ if (existing !== void 0) {
2304
+ if (trackRemoved) {
2305
+ const existingWithToken = existing;
2306
+ removed.push({
2307
+ token,
2308
+ overriddenBy: existingWithToken.token,
2309
+ reason: `overridden by ${existingWithToken.token.raw}`
2310
+ });
2311
+ }
2312
+ continue;
2313
+ }
2314
+ let overridden = false;
2315
+ let overriddenByToken = null;
2316
+ const conflictGroups = getConflicts(token.group);
2317
+ for (const conflictGroup of conflictGroups) {
2318
+ if (conflictGroup === token.group) continue;
2319
+ const conflictKey = baseKey + conflictGroup;
2320
+ const conflictExisting = seen.get(conflictKey);
2321
+ if (conflictExisting !== void 0) {
2322
+ if (conflictExisting.specificity > token.specificity) {
2323
+ continue;
2324
+ } else {
2325
+ overridden = true;
2326
+ if (trackRemoved && "token" in conflictExisting) {
2327
+ overriddenByToken = conflictExisting.token;
2328
+ }
2329
+ break;
2330
+ }
2331
+ }
2332
+ }
2333
+ if (overridden) {
2334
+ if (trackRemoved && overriddenByToken !== null) {
2335
+ removed.push({
2336
+ token,
2337
+ overriddenBy: overriddenByToken,
2338
+ reason: `overridden by ${overriddenByToken.raw}`
2339
+ });
2340
+ }
2341
+ } else {
2342
+ kept.add(i);
2343
+ if (trackRemoved) {
2344
+ ;
2345
+ seen.set(ownKey, {
2346
+ token,
2347
+ specificity: token.specificity
2348
+ });
2349
+ } else {
2350
+ ;
2351
+ seen.set(ownKey, {
2352
+ specificity: token.specificity
2353
+ });
2354
+ }
2355
+ }
2356
+ }
2357
+ return { kept, removed };
2358
+ }
2359
+ function resolveConflicts(tokens) {
2360
+ if (tokens.length === 0) return { kept: [], removed: [] };
2361
+ if (tokens.length === 1) return { kept: [tokens[0]], removed: [] };
2362
+ const { kept, removed } = resolveCore(tokens, getConflictingGroups, true);
2363
+ return {
2364
+ kept: tokens.filter((_, i) => kept.has(i)),
2365
+ removed
2366
+ };
2367
+ }
2368
+ function resolveConflictsSimple(tokens) {
2369
+ if (tokens.length <= 1) return tokens;
2370
+ const { kept } = resolveCore(tokens, getConflictingGroups, false);
2371
+ return tokens.filter((_, i) => kept.has(i));
2372
+ }
2373
+ function resolveWithCustomConflicts(tokens, getConflicts) {
2374
+ if (tokens.length === 0) return /* @__PURE__ */ new Set();
2375
+ if (tokens.length === 1) return /* @__PURE__ */ new Set([0]);
2376
+ const { kept } = resolveCore(tokens, getConflicts, false);
2377
+ return kept;
2378
+ }
2379
+ function tokensToString(tokens) {
2380
+ if (tokens.length === 0) return "";
2381
+ if (tokens.length === 1) return tokens[0].raw;
2382
+ let result = tokens[0].raw;
2383
+ for (let i = 1; i < tokens.length; i++) {
2384
+ result += " " + tokens[i].raw;
2385
+ }
2386
+ return result;
2387
+ }
2388
+
2389
+ // src/create-tw.ts
2390
+ function createTw(config = {}) {
2391
+ if (config.cacheSize !== void 0 && config.cacheSize < 0) {
2392
+ throw new Error("tw-mrg: cacheSize must be non-negative");
2393
+ }
2394
+ const {
2395
+ prefix: prefix2 = "",
2396
+ cacheSize = 500,
2397
+ mode = "full",
2398
+ extend,
2399
+ override
2400
+ } = config;
2401
+ if (mode === false) {
2402
+ return function noMergeTw(...inputs) {
2403
+ return flattenClassValues(...inputs);
2404
+ };
2405
+ }
2406
+ const baseConfig = mode === "minimal" ? minimalConfig : fullConfig;
2407
+ const groupConfig = buildGroupConfig(baseConfig, extend, override);
2408
+ const trie = new PrefixTrie();
2409
+ const exactMatches = /* @__PURE__ */ new Map();
2410
+ for (const [pfx, entry] of Object.entries(groupConfig.prefixes)) {
2411
+ trie.insert(pfx, entry);
2412
+ }
2413
+ for (const [className, entry] of Object.entries(groupConfig.exactMatches)) {
2414
+ exactMatches.set(className, entry);
2415
+ }
2416
+ const cache = cacheSize > 0 ? new LRUCache(cacheSize) : null;
2417
+ function classifyUtility(utility) {
2418
+ const unprefixed = prefix2 && utility.startsWith(prefix2) ? utility.slice(prefix2.length) : utility;
2419
+ const exact = exactMatches.get(unprefixed);
2420
+ if (exact) {
2421
+ return { group: exact.groupId, specificity: exact.specificity };
2422
+ }
2423
+ const prefixMatch = trie.findLongestMatch(unprefixed);
2424
+ if (prefixMatch) {
2425
+ return {
2426
+ group: prefixMatch.entry.groupId,
2427
+ specificity: prefixMatch.entry.specificity
2428
+ };
2429
+ }
2430
+ for (const { pattern, groupId, specificity } of groupConfig.patterns) {
2431
+ if (pattern.test(unprefixed)) {
2432
+ return { group: groupId, specificity };
2433
+ }
2434
+ }
2435
+ return { group: null, specificity: 1 };
2436
+ }
2437
+ function getConflicts(groupId) {
2438
+ return groupConfig.conflicts[groupId] ?? [];
2439
+ }
2440
+ return function customTw(...inputs) {
2441
+ if (inputs.length === 0) return "";
2442
+ const classString = flattenClassValues(...inputs);
2443
+ if (!classString) return "";
2444
+ if (!classString.includes(" ")) return classString;
2445
+ if (cache) {
2446
+ const cached = cache.get(classString);
2447
+ if (cached !== void 0) return cached;
2448
+ }
2449
+ const classes = splitClasses(classString);
2450
+ const tokens = new Array(classes.length);
2451
+ for (let i = 0; i < classes.length; i++) {
2452
+ const parsed = parseClassBase(classes[i], i);
2453
+ if (parsed.isArbitrary) {
2454
+ const group = parsed.arbitraryProperty?.startsWith("--") ? "arbitrary-css-var" : `arbitrary-${parsed.arbitraryProperty}`;
2455
+ tokens[i] = {
2456
+ raw: parsed.raw,
2457
+ modifiers: parsed.modifiers,
2458
+ modifierKey: parsed.modifierKey,
2459
+ hasImportant: parsed.hasImportant,
2460
+ utility: parsed.utility,
2461
+ group,
2462
+ isArbitrary: true,
2463
+ arbitraryProperty: parsed.arbitraryProperty,
2464
+ specificity: SPECIFICITY.ARBITRARY,
2465
+ position: parsed.position
2466
+ };
2467
+ } else {
2468
+ const { group, specificity } = classifyUtility(
2469
+ parsed.utilityForClassification
2470
+ );
2471
+ tokens[i] = {
2472
+ raw: parsed.raw,
2473
+ modifiers: parsed.modifiers,
2474
+ modifierKey: parsed.modifierKey,
2475
+ hasImportant: parsed.hasImportant,
2476
+ utility: parsed.utility,
2477
+ group,
2478
+ isArbitrary: false,
2479
+ specificity,
2480
+ position: parsed.position
2481
+ };
2482
+ }
2483
+ }
2484
+ const kept = resolveWithCustomConflicts(tokens, getConflicts);
2485
+ let result = "";
2486
+ for (let i = 0; i < tokens.length; i++) {
2487
+ if (kept.has(i)) {
2488
+ result = result ? result + " " + tokens[i].raw : tokens[i].raw;
2489
+ }
2490
+ }
2491
+ if (cache) {
2492
+ cache.set(classString, result);
2493
+ }
2494
+ return result;
2495
+ };
2496
+ }
2497
+ function addClassGroups(config, classGroups, addSelfConflict) {
2498
+ for (const [id, patterns] of Object.entries(classGroups)) {
2499
+ for (const p of patterns) {
2500
+ if (p instanceof RegExp) {
2501
+ config.patterns.push({
2502
+ pattern: p,
2503
+ groupId: id,
2504
+ specificity: 1
2505
+ });
2506
+ } else {
2507
+ config.exactMatches[p] = { groupId: id, specificity: 1 };
2508
+ }
2509
+ }
2510
+ if (addSelfConflict && config.conflicts[id] === void 0) {
2511
+ config.conflicts[id] = [id];
2512
+ }
2513
+ }
2514
+ }
2515
+ function buildGroupConfig(base, extend, override) {
2516
+ const config = {
2517
+ prefixes: { ...base.prefixes },
2518
+ exactMatches: { ...base.exactMatches },
2519
+ patterns: [...base.patterns],
2520
+ conflicts: { ...base.conflicts }
2521
+ };
2522
+ if (override?.classGroups) {
2523
+ addClassGroups(config, override.classGroups, false);
2524
+ }
2525
+ if (extend?.classGroups) {
2526
+ addClassGroups(config, extend.classGroups, true);
2527
+ }
2528
+ if (extend?.conflictingClassGroups) {
2529
+ for (const [id, conflicts] of Object.entries(
2530
+ extend.conflictingClassGroups
2531
+ )) {
2532
+ const existing = config.conflicts[id];
2533
+ config.conflicts[id] = existing !== void 0 ? [.../* @__PURE__ */ new Set([...existing, ...conflicts])] : conflicts;
2534
+ }
2535
+ }
2536
+ if (override?.conflictingClassGroups) {
2537
+ Object.assign(config.conflicts, override.conflictingClassGroups);
2538
+ }
2539
+ if (extend?.prefixes) {
2540
+ for (const [pfx, entry] of Object.entries(extend.prefixes)) {
2541
+ config.prefixes[pfx] = {
2542
+ groupId: entry.groupId,
2543
+ specificity: entry.specificity ?? 1
2544
+ };
2545
+ }
2546
+ }
2547
+ return config;
2548
+ }
2549
+
2550
+ // src/tw.ts
2551
+ var twMerge = createTw({ mode: "full" });
2552
+ function tw(...inputs) {
2553
+ if (getMergeMode() === false) {
2554
+ return flattenClassValues(...inputs);
2555
+ }
2556
+ return twMerge(...inputs);
2557
+ }
2558
+
2559
+ // src/tw-join.ts
2560
+ function twJoin(...inputs) {
2561
+ return flattenClassValues(...inputs);
2562
+ }
2563
+
2564
+ // src/css-generator.ts
2565
+ import { __unstable__loadDesignSystem } from "tailwindcss";
2566
+ var designSystem = null;
2567
+ var initPromise = null;
2568
+ async function initCSSGenerator(options = {}) {
2569
+ if (designSystem) return;
2570
+ if (initPromise) return initPromise;
2571
+ const css = options.css ?? '@import "tailwindcss";';
2572
+ initPromise = (async () => {
2573
+ designSystem = await __unstable__loadDesignSystem(css);
2574
+ })();
2575
+ return initPromise;
2576
+ }
2577
+ function generateCSS(className) {
2578
+ if (!designSystem) return null;
2579
+ const [css] = designSystem.candidatesToCss([className]);
2580
+ return css ?? null;
2581
+ }
2582
+ function generateCSSBatch(classNames) {
2583
+ if (!designSystem) return classNames.map(() => null);
2584
+ return designSystem.candidatesToCss(classNames);
2585
+ }
2586
+ function isInitialized() {
2587
+ return designSystem !== null;
2588
+ }
2589
+ function getThemeValue(path) {
2590
+ if (!designSystem) return void 0;
2591
+ return designSystem.resolveThemeValue(path);
2592
+ }
2593
+ function isValidClass(className) {
2594
+ if (!designSystem) return false;
2595
+ const [css] = designSystem.candidatesToCss([className]);
2596
+ return css !== null;
2597
+ }
2598
+ function validateClasses(classNames) {
2599
+ if (!designSystem) return classNames.map(() => false);
2600
+ return designSystem.candidatesToCss(classNames).map((css) => css !== null);
2601
+ }
2602
+ function getClassOrder(classNames) {
2603
+ if (!designSystem) return classNames.map((c) => [c, null]);
2604
+ return designSystem.getClassOrder(classNames);
2605
+ }
2606
+ function canonicalizeClasses(classNames) {
2607
+ if (!designSystem) return classNames;
2608
+ return designSystem.canonicalizeCandidates(classNames);
2609
+ }
2610
+
2611
+ // src/style-injector.ts
2612
+ var styleElement = null;
2613
+ var injectedClasses = /* @__PURE__ */ new Set();
2614
+ var errorHandler = null;
2615
+ function setStyleInjectorErrorHandler(handler) {
2616
+ errorHandler = handler;
2617
+ }
2618
+ function getStyleElement() {
2619
+ if (typeof document === "undefined") return null;
2620
+ if (!styleElement) {
2621
+ styleElement = document.createElement("style");
2622
+ styleElement.id = "tw-mrg-styles";
2623
+ document.head.appendChild(styleElement);
2624
+ }
2625
+ return styleElement;
2626
+ }
2627
+ function injectCSS(className, cssRule) {
2628
+ if (injectedClasses.has(className)) return;
2629
+ const style = getStyleElement();
2630
+ if (!style) return;
2631
+ const sheet = style.sheet;
2632
+ if (sheet) {
2633
+ try {
2634
+ sheet.insertRule(cssRule, sheet.cssRules.length);
2635
+ injectedClasses.add(className);
2636
+ return;
2637
+ } catch (e) {
2638
+ errorHandler?.(
2639
+ e instanceof Error ? e : new Error(String(e)),
2640
+ "injectCSS"
2641
+ );
2642
+ }
2643
+ }
2644
+ style.textContent += cssRule + "\n";
2645
+ injectedClasses.add(className);
2646
+ }
2647
+ function injectCSSBatch(classNames, cssRules) {
2648
+ const style = getStyleElement();
2649
+ if (!style) return;
2650
+ const sheet = style.sheet;
2651
+ const useInsertRule = sheet !== null;
2652
+ const rulesToInject = [];
2653
+ for (let i = 0; i < classNames.length; i++) {
2654
+ const className = classNames[i];
2655
+ const css = cssRules[i];
2656
+ if (css && className && !injectedClasses.has(className)) {
2657
+ if (useInsertRule) {
2658
+ try {
2659
+ sheet.insertRule(css, sheet.cssRules.length);
2660
+ injectedClasses.add(className);
2661
+ } catch (e) {
2662
+ errorHandler?.(
2663
+ e instanceof Error ? e : new Error(String(e)),
2664
+ "injectCSSBatch"
2665
+ );
2666
+ rulesToInject.push(css);
2667
+ injectedClasses.add(className);
2668
+ }
2669
+ } else {
2670
+ rulesToInject.push(css);
2671
+ injectedClasses.add(className);
2672
+ }
2673
+ }
2674
+ }
2675
+ if (rulesToInject.length > 0) {
2676
+ style.textContent += rulesToInject.join("\n") + "\n";
2677
+ }
2678
+ }
2679
+ function hasInjectedClass(className) {
2680
+ return injectedClasses.has(className);
2681
+ }
2682
+ function clearInjectedStyles() {
2683
+ if (styleElement) {
2684
+ const sheet = styleElement.sheet;
2685
+ if (sheet) {
2686
+ while (sheet.cssRules.length > 0) {
2687
+ sheet.deleteRule(0);
2688
+ }
2689
+ }
2690
+ styleElement.textContent = "";
2691
+ }
2692
+ injectedClasses.clear();
2693
+ }
2694
+ function getInjectedClasses() {
2695
+ return Array.from(injectedClasses);
2696
+ }
2697
+
2698
+ // src/tw-prefix.ts
2699
+ var CLASS_SPLIT_REGEX2 = /\s+/;
2700
+ function twPrefix(modifierOrMap, classes) {
2701
+ let composed;
2702
+ let prefixedClassNames = null;
2703
+ if (typeof modifierOrMap === "object") {
2704
+ const allPrefixed = [];
2705
+ let result = "";
2706
+ for (const modifier in modifierOrMap) {
2707
+ if (Object.prototype.hasOwnProperty.call(modifierOrMap, modifier)) {
2708
+ const classString = modifierOrMap[modifier];
2709
+ if (classString) {
2710
+ const { str, classNames } = prefixClassesWithNames(modifier, classString);
2711
+ if (str) {
2712
+ result = result ? result + " " + str : str;
2713
+ for (const cls of classNames) {
2714
+ allPrefixed.push(cls);
2715
+ }
2716
+ }
2717
+ }
2718
+ }
2719
+ }
2720
+ composed = result;
2721
+ prefixedClassNames = allPrefixed;
2722
+ } else {
2723
+ const { str, classNames } = prefixClassesWithNames(modifierOrMap, classes ?? "");
2724
+ composed = str;
2725
+ prefixedClassNames = classNames;
2726
+ }
2727
+ if (typeof window !== "undefined" && isInitialized() && prefixedClassNames.length > 0) {
2728
+ const newClassNames = prefixedClassNames.filter((cls) => !hasInjectedClass(cls));
2729
+ if (newClassNames.length > 0) {
2730
+ const cssRules = generateCSSBatch(newClassNames);
2731
+ injectCSSBatch(newClassNames, cssRules);
2732
+ }
2733
+ }
2734
+ return composed;
2735
+ }
2736
+ function prefixClassesWithNames(modifier, classes) {
2737
+ const classList = classes.split(CLASS_SPLIT_REGEX2).filter(Boolean);
2738
+ if (classList.length === 0) return { str: "", classNames: [] };
2739
+ const classNames = new Array(classList.length);
2740
+ let str = "";
2741
+ for (let i = 0; i < classList.length; i++) {
2742
+ const prefixed = modifier + classList[i];
2743
+ classNames[i] = prefixed;
2744
+ str = str ? str + " " + prefixed : prefixed;
2745
+ }
2746
+ return { str, classNames };
2747
+ }
2748
+
2749
+ // src/tw-states.ts
2750
+ function twStates(config) {
2751
+ const { base, variants, defaultVariants, compoundVariants } = config;
2752
+ const variantKeys = variants ? Object.keys(variants) : [];
2753
+ const compoundVariantKeys = compoundVariants ? compoundVariants.map((compound) => {
2754
+ const keys = [];
2755
+ for (const key in compound) {
2756
+ if (Object.prototype.hasOwnProperty.call(compound, key) && key !== "class" && key !== "className") {
2757
+ keys.push(key);
2758
+ }
2759
+ }
2760
+ return keys;
2761
+ }) : null;
2762
+ return (props = {}) => {
2763
+ const { class: classFromProps, className, ...variantProps } = props;
2764
+ const classes = [];
2765
+ if (base) {
2766
+ classes.push(base);
2767
+ }
2768
+ if (variants) {
2769
+ for (const variantKey of variantKeys) {
2770
+ const value = variantProps[variantKey] ?? defaultVariants?.[variantKey];
2771
+ if (value !== null && value !== void 0) {
2772
+ const variantClasses = variants[variantKey][value];
2773
+ if (variantClasses) {
2774
+ classes.push(variantClasses);
2775
+ }
2776
+ }
2777
+ }
2778
+ }
2779
+ if (compoundVariants && compoundVariantKeys) {
2780
+ for (let i = 0; i < compoundVariants.length; i++) {
2781
+ const compound = compoundVariants[i];
2782
+ const keys = compoundVariantKeys[i];
2783
+ if (matchesCompoundVariantFast(compound, keys, variantProps, defaultVariants)) {
2784
+ const compoundClass = compound.class ?? compound.className;
2785
+ if (compoundClass) {
2786
+ classes.push(compoundClass);
2787
+ }
2788
+ }
2789
+ }
2790
+ }
2791
+ if (classFromProps) {
2792
+ classes.push(classFromProps);
2793
+ }
2794
+ if (className) {
2795
+ classes.push(className);
2796
+ }
2797
+ return tw(...classes);
2798
+ };
2799
+ }
2800
+ function matchesCompoundVariantFast(compound, keys, props, defaults) {
2801
+ for (const key of keys) {
2802
+ const value = compound[key];
2803
+ const actualValue = props[key] ?? defaults?.[key];
2804
+ if (normalizeValue(actualValue) !== normalizeValue(value)) {
2805
+ return false;
2806
+ }
2807
+ }
2808
+ return true;
2809
+ }
2810
+ function normalizeValue(value) {
2811
+ if (value === "true" || value === true) return true;
2812
+ if (value === "false" || value === false) return false;
2813
+ return value;
2814
+ }
2815
+
2816
+ // src/tw-debug.ts
2817
+ function twDebug(...inputs) {
2818
+ if (inputs.length === 0) {
2819
+ return { output: "", removed: [], kept: [] };
2820
+ }
2821
+ const classString = flattenClassValues(...inputs);
2822
+ if (!classString) {
2823
+ return { output: "", removed: [], kept: [] };
2824
+ }
2825
+ if (!classString.includes(" ")) {
2826
+ const tokens2 = parseClasses(classString);
2827
+ return {
2828
+ output: classString,
2829
+ removed: [],
2830
+ kept: tokens2.map((t) => ({
2831
+ class: t.raw,
2832
+ group: t.group
2833
+ }))
2834
+ };
2835
+ }
2836
+ const tokens = parseClasses(classString);
2837
+ const { kept, removed } = resolveConflicts(tokens);
2838
+ const removedClasses = removed.map((r) => ({
2839
+ class: r.token.raw,
2840
+ reason: r.reason,
2841
+ conflictsWith: r.overriddenBy.raw
2842
+ }));
2843
+ const keptClasses = kept.map((k) => ({
2844
+ class: k.raw,
2845
+ group: k.group
2846
+ }));
2847
+ return {
2848
+ output: tokensToString(kept),
2849
+ removed: removedClasses,
2850
+ kept: keptClasses
2851
+ };
2852
+ }
2853
+ export {
2854
+ LRUCache,
2855
+ SPECIFICITY,
2856
+ canonicalizeClasses,
2857
+ classifyClass,
2858
+ clearCaches,
2859
+ clearInjectedStyles,
2860
+ createTw,
2861
+ extractModifiers,
2862
+ flattenClassValue,
2863
+ flattenClassValues,
2864
+ fullConfig,
2865
+ generateCSS,
2866
+ generateCSSBatch,
2867
+ getCacheStats,
2868
+ getClassOrder,
2869
+ getConflictingGroups,
2870
+ getInjectedClasses,
2871
+ getMergeMode,
2872
+ getStyleElement,
2873
+ getThemeValue,
2874
+ hasInjectedClass,
2875
+ initCSSGenerator,
2876
+ injectCSS,
2877
+ injectCSSBatch,
2878
+ isInitialized,
2879
+ isValidClass,
2880
+ minimalConfig,
2881
+ parseClass,
2882
+ parseClassBase,
2883
+ parseClasses,
2884
+ resetClassifier,
2885
+ resolveConflicts,
2886
+ resolveConflictsSimple,
2887
+ setMergeMode,
2888
+ setStyleInjectorErrorHandler,
2889
+ splitClasses,
2890
+ tw,
2891
+ twDebug,
2892
+ twJoin,
2893
+ twPrefix,
2894
+ twStates,
2895
+ validateClasses
2896
+ };
2897
+ //# sourceMappingURL=index.js.map