@mochi-css/react 3.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,1752 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ let react = require("react");
25
+ react = __toESM(react);
26
+ let clsx = require("clsx");
27
+ clsx = __toESM(clsx);
28
+
29
+ //#region ../vanilla/dist/index.mjs
30
+ const propertyUnits = {
31
+ animation: "ms",
32
+ animationDelay: "ms",
33
+ animationDuration: "ms",
34
+ animationRange: "px",
35
+ animationRangeCenter: "px",
36
+ animationRangeEnd: "px",
37
+ animationRangeStart: "px",
38
+ background: "px",
39
+ backgroundPosition: "px",
40
+ backgroundPositionBlock: "px",
41
+ backgroundPositionInline: "px",
42
+ backgroundPositionX: "px",
43
+ backgroundPositionY: "px",
44
+ backgroundSize: "px",
45
+ backgroundTbd: "px",
46
+ baselineShift: "px",
47
+ blockSize: "px",
48
+ blockStep: "px",
49
+ blockStepSize: "px",
50
+ border: "px",
51
+ borderBlock: "px",
52
+ borderBlockClip: "px",
53
+ borderBlockEnd: "px",
54
+ borderBlockEndClip: "px",
55
+ borderBlockEndRadius: "px",
56
+ borderBlockEndWidth: "px",
57
+ borderBlockStart: "px",
58
+ borderBlockStartClip: "px",
59
+ borderBlockStartRadius: "px",
60
+ borderBlockStartWidth: "px",
61
+ borderBlockWidth: "px",
62
+ borderBottom: "px",
63
+ borderBottomClip: "px",
64
+ borderBottomLeftRadius: "px",
65
+ borderBottomRadius: "px",
66
+ borderBottomRightRadius: "px",
67
+ borderBottomWidth: "px",
68
+ borderClip: "px",
69
+ borderEndEndRadius: "px",
70
+ borderEndStartRadius: "px",
71
+ borderImage: "%",
72
+ borderImageOutset: "px",
73
+ borderImageSlice: "%",
74
+ borderImageWidth: "px",
75
+ borderInline: "px",
76
+ borderInlineClip: "px",
77
+ borderInlineEnd: "px",
78
+ borderInlineEndClip: "px",
79
+ borderInlineEndRadius: "px",
80
+ borderInlineEndWidth: "px",
81
+ borderInlineStart: "px",
82
+ borderInlineStartClip: "px",
83
+ borderInlineStartRadius: "px",
84
+ borderInlineStartWidth: "px",
85
+ borderInlineWidth: "px",
86
+ borderLeft: "px",
87
+ borderLeftClip: "px",
88
+ borderLeftRadius: "px",
89
+ borderLeftWidth: "px",
90
+ borderLimit: "px",
91
+ borderRadius: "px",
92
+ borderRight: "px",
93
+ borderRightClip: "px",
94
+ borderRightRadius: "px",
95
+ borderRightWidth: "px",
96
+ borderSpacing: "px",
97
+ borderStartEndRadius: "px",
98
+ borderStartStartRadius: "px",
99
+ borderTop: "px",
100
+ borderTopClip: "px",
101
+ borderTopLeftRadius: "px",
102
+ borderTopRadius: "px",
103
+ borderTopRightRadius: "px",
104
+ borderTopWidth: "px",
105
+ borderWidth: "px",
106
+ bottom: "px",
107
+ boxShadow: "px",
108
+ boxShadowBlur: "px",
109
+ boxShadowOffset: "px",
110
+ boxShadowSpread: "px",
111
+ columnGap: "px",
112
+ columnHeight: "px",
113
+ columnRule: "px",
114
+ columnRuleEdgeInset: "px",
115
+ columnRuleEdgeInsetEnd: "px",
116
+ columnRuleEdgeInsetStart: "px",
117
+ columnRuleInset: "px",
118
+ columnRuleInsetEnd: "px",
119
+ columnRuleInsetStart: "px",
120
+ columnRuleInteriorInset: "px",
121
+ columnRuleInteriorInsetEnd: "px",
122
+ columnRuleInteriorInsetStart: "px",
123
+ columnRuleWidth: "px",
124
+ columns: "px",
125
+ columnWidth: "px",
126
+ containIntrinsicBlockSize: "px",
127
+ containIntrinsicHeight: "px",
128
+ containIntrinsicInlineSize: "px",
129
+ containIntrinsicSize: "px",
130
+ containIntrinsicWidth: "px",
131
+ corner: "px",
132
+ cornerBlockEnd: "px",
133
+ cornerBlockStart: "px",
134
+ cornerBottom: "px",
135
+ cornerBottomLeft: "px",
136
+ cornerBottomRight: "px",
137
+ cornerEndEnd: "px",
138
+ cornerEndStart: "px",
139
+ cornerInlineEnd: "px",
140
+ cornerInlineStart: "px",
141
+ cornerLeft: "px",
142
+ cornerRight: "px",
143
+ cornerStartEnd: "px",
144
+ cornerStartStart: "px",
145
+ cornerTop: "px",
146
+ cornerTopLeft: "px",
147
+ cornerTopRight: "px",
148
+ cx: "px",
149
+ cy: "px",
150
+ fillOpacity: "%",
151
+ fillPosition: "px",
152
+ fillSize: "px",
153
+ flex: "px",
154
+ flexBasis: "px",
155
+ floatOffset: "px",
156
+ floodOpacity: "%",
157
+ flowTolerance: "px",
158
+ font: "deg",
159
+ fontSize: "px",
160
+ fontStretch: "%",
161
+ fontStyle: "deg",
162
+ fontWidth: "%",
163
+ gap: "px",
164
+ grid: "px",
165
+ gridAutoColumns: "px",
166
+ gridAutoRows: "px",
167
+ gridColumnGap: "px",
168
+ gridGap: "px",
169
+ gridRowGap: "px",
170
+ gridTemplate: "px",
171
+ gridTemplateColumns: "px",
172
+ gridTemplateRows: "px",
173
+ height: "px",
174
+ hyphenateLimitZone: "px",
175
+ imageOrientation: "deg",
176
+ imageResolution: "dppx",
177
+ initialLetterWrap: "px",
178
+ inlineSize: "px",
179
+ inset: "px",
180
+ insetBlock: "px",
181
+ insetBlockEnd: "px",
182
+ insetBlockStart: "px",
183
+ insetInline: "px",
184
+ insetInlineEnd: "px",
185
+ insetInlineStart: "px",
186
+ interestDelay: "ms",
187
+ interestDelayEnd: "ms",
188
+ interestDelayStart: "ms",
189
+ itemFlow: "px",
190
+ left: "px",
191
+ letterSpacing: "px",
192
+ lineHeight: "px",
193
+ lineHeightStep: "px",
194
+ linePadding: "px",
195
+ margin: "px",
196
+ marginBlock: "px",
197
+ marginBlockEnd: "px",
198
+ marginBlockStart: "px",
199
+ marginBottom: "px",
200
+ marginInline: "px",
201
+ marginInlineEnd: "px",
202
+ marginInlineStart: "px",
203
+ marginLeft: "px",
204
+ marginRight: "px",
205
+ marginTop: "px",
206
+ mask: "px",
207
+ maskBorder: "%",
208
+ maskBorderOutset: "px",
209
+ maskBorderSlice: "%",
210
+ maskBorderWidth: "px",
211
+ maskPosition: "px",
212
+ maskSize: "px",
213
+ maxBlockSize: "px",
214
+ maxHeight: "px",
215
+ maxInlineSize: "px",
216
+ maxWidth: "px",
217
+ minBlockSize: "px",
218
+ minHeight: "px",
219
+ minInlineSize: "px",
220
+ minWidth: "px",
221
+ objectPosition: "px",
222
+ offset: "px",
223
+ offsetAnchor: "px",
224
+ offsetDistance: "px",
225
+ offsetPosition: "px",
226
+ offsetRotate: "deg",
227
+ opacity: "%",
228
+ outline: "px",
229
+ outlineOffset: "px",
230
+ outlineWidth: "px",
231
+ overflowClipMargin: "px",
232
+ overflowClipMarginBlock: "px",
233
+ overflowClipMarginBlockEnd: "px",
234
+ overflowClipMarginBlockStart: "px",
235
+ overflowClipMarginBottom: "px",
236
+ overflowClipMarginInline: "px",
237
+ overflowClipMarginInlineEnd: "px",
238
+ overflowClipMarginInlineStart: "px",
239
+ overflowClipMarginLeft: "px",
240
+ overflowClipMarginRight: "px",
241
+ overflowClipMarginTop: "px",
242
+ padding: "px",
243
+ paddingBlock: "px",
244
+ paddingBlockEnd: "px",
245
+ paddingBlockStart: "px",
246
+ paddingBottom: "px",
247
+ paddingInline: "px",
248
+ paddingInlineEnd: "px",
249
+ paddingInlineStart: "px",
250
+ paddingLeft: "px",
251
+ paddingRight: "px",
252
+ paddingTop: "px",
253
+ pause: "ms",
254
+ pauseAfter: "ms",
255
+ pauseBefore: "ms",
256
+ perspective: "px",
257
+ perspectiveOrigin: "px",
258
+ r: "px",
259
+ rest: "ms",
260
+ restAfter: "ms",
261
+ restBefore: "ms",
262
+ right: "px",
263
+ rotate: "deg",
264
+ rowGap: "px",
265
+ rowRule: "px",
266
+ rowRuleEdgeInset: "px",
267
+ rowRuleEdgeInsetEnd: "px",
268
+ rowRuleEdgeInsetStart: "px",
269
+ rowRuleInset: "px",
270
+ rowRuleInsetEnd: "px",
271
+ rowRuleInsetStart: "px",
272
+ rowRuleInteriorInset: "px",
273
+ rowRuleInteriorInsetEnd: "px",
274
+ rowRuleInteriorInsetStart: "px",
275
+ rowRuleWidth: "px",
276
+ rule: "px",
277
+ ruleEdgeInset: "px",
278
+ ruleInset: "px",
279
+ ruleInsetEnd: "px",
280
+ ruleInsetStart: "px",
281
+ ruleInteriorInset: "px",
282
+ ruleWidth: "px",
283
+ rx: "px",
284
+ ry: "px",
285
+ scale: "%",
286
+ scrollMargin: "px",
287
+ scrollMarginBlock: "px",
288
+ scrollMarginBlockEnd: "px",
289
+ scrollMarginBlockStart: "px",
290
+ scrollMarginBottom: "px",
291
+ scrollMarginInline: "px",
292
+ scrollMarginInlineEnd: "px",
293
+ scrollMarginInlineStart: "px",
294
+ scrollMarginLeft: "px",
295
+ scrollMarginRight: "px",
296
+ scrollMarginTop: "px",
297
+ scrollPadding: "px",
298
+ scrollPaddingBlock: "px",
299
+ scrollPaddingBlockEnd: "px",
300
+ scrollPaddingBlockStart: "px",
301
+ scrollPaddingBottom: "px",
302
+ scrollPaddingInline: "px",
303
+ scrollPaddingInlineEnd: "px",
304
+ scrollPaddingInlineStart: "px",
305
+ scrollPaddingLeft: "px",
306
+ scrollPaddingRight: "px",
307
+ scrollPaddingTop: "px",
308
+ shapeImageThreshold: "%",
309
+ shapeMargin: "px",
310
+ shapePadding: "px",
311
+ stopOpacity: "%",
312
+ strokeDasharray: "px",
313
+ strokeDashcorner: "px",
314
+ strokeDashCorner: "px",
315
+ strokeDashoffset: "px",
316
+ strokeOpacity: "%",
317
+ strokePosition: "px",
318
+ strokeSize: "px",
319
+ strokeWidth: "px",
320
+ tabSize: "px",
321
+ textDecoration: "px",
322
+ textDecorationInset: "px",
323
+ textDecorationThickness: "px",
324
+ textIndent: "px",
325
+ textShadow: "px",
326
+ textSizeAdjust: "%",
327
+ textUnderlineOffset: "px",
328
+ timelineTrigger: "px",
329
+ timelineTriggerExitRange: "px",
330
+ timelineTriggerExitRangeEnd: "px",
331
+ timelineTriggerExitRangeStart: "px",
332
+ timelineTriggerRange: "px",
333
+ timelineTriggerRangeEnd: "px",
334
+ timelineTriggerRangeStart: "px",
335
+ top: "px",
336
+ transformOrigin: "px",
337
+ transition: "ms",
338
+ transitionDelay: "ms",
339
+ transitionDuration: "ms",
340
+ translate: "px",
341
+ verticalAlign: "px",
342
+ viewTimeline: "px",
343
+ viewTimelineInset: "px",
344
+ voiceDuration: "ms",
345
+ voicePitch: "Hz",
346
+ voiceRange: "Hz",
347
+ voiceRate: "%",
348
+ width: "px",
349
+ wordSpacing: "px",
350
+ x: "px",
351
+ y: "px",
352
+ zoom: "%"
353
+ };
354
+ const knownPropertyNames = new Set([
355
+ "accentColor",
356
+ "alignContent",
357
+ "alignItems",
358
+ "alignSelf",
359
+ "alignmentBaseline",
360
+ "all",
361
+ "anchorName",
362
+ "anchorScope",
363
+ "animation",
364
+ "animationComposition",
365
+ "animationDelay",
366
+ "animationDirection",
367
+ "animationDuration",
368
+ "animationFillMode",
369
+ "animationIterationCount",
370
+ "animationName",
371
+ "animationPlayState",
372
+ "animationRange",
373
+ "animationRangeCenter",
374
+ "animationRangeEnd",
375
+ "animationRangeStart",
376
+ "animationTimeline",
377
+ "animationTimingFunction",
378
+ "animationTrigger",
379
+ "appearance",
380
+ "aspectRatio",
381
+ "backdropFilter",
382
+ "backfaceVisibility",
383
+ "background",
384
+ "backgroundAttachment",
385
+ "backgroundBlendMode",
386
+ "backgroundClip",
387
+ "backgroundColor",
388
+ "backgroundImage",
389
+ "backgroundOrigin",
390
+ "backgroundPosition",
391
+ "backgroundPositionBlock",
392
+ "backgroundPositionInline",
393
+ "backgroundPositionX",
394
+ "backgroundPositionY",
395
+ "backgroundRepeat",
396
+ "backgroundRepeatBlock",
397
+ "backgroundRepeatInline",
398
+ "backgroundRepeatX",
399
+ "backgroundRepeatY",
400
+ "backgroundSize",
401
+ "backgroundTbd",
402
+ "baselineShift",
403
+ "baselineSource",
404
+ "blockEllipsis",
405
+ "blockSize",
406
+ "blockStep",
407
+ "blockStepAlign",
408
+ "blockStepInsert",
409
+ "blockStepRound",
410
+ "blockStepSize",
411
+ "bookmarkLabel",
412
+ "bookmarkLevel",
413
+ "bookmarkState",
414
+ "border",
415
+ "borderBlock",
416
+ "borderBlockClip",
417
+ "borderBlockColor",
418
+ "borderBlockEnd",
419
+ "borderBlockEndClip",
420
+ "borderBlockEndColor",
421
+ "borderBlockEndRadius",
422
+ "borderBlockEndStyle",
423
+ "borderBlockEndWidth",
424
+ "borderBlockStart",
425
+ "borderBlockStartClip",
426
+ "borderBlockStartColor",
427
+ "borderBlockStartRadius",
428
+ "borderBlockStartStyle",
429
+ "borderBlockStartWidth",
430
+ "borderBlockStyle",
431
+ "borderBlockWidth",
432
+ "borderBottom",
433
+ "borderBottomClip",
434
+ "borderBottomColor",
435
+ "borderBottomLeftRadius",
436
+ "borderBottomRadius",
437
+ "borderBottomRightRadius",
438
+ "borderBottomStyle",
439
+ "borderBottomWidth",
440
+ "borderBoundary",
441
+ "borderClip",
442
+ "borderCollapse",
443
+ "borderColor",
444
+ "borderEndEndRadius",
445
+ "borderEndStartRadius",
446
+ "borderImage",
447
+ "borderImageOutset",
448
+ "borderImageRepeat",
449
+ "borderImageSlice",
450
+ "borderImageSource",
451
+ "borderImageWidth",
452
+ "borderInline",
453
+ "borderInlineClip",
454
+ "borderInlineColor",
455
+ "borderInlineEnd",
456
+ "borderInlineEndClip",
457
+ "borderInlineEndColor",
458
+ "borderInlineEndRadius",
459
+ "borderInlineEndStyle",
460
+ "borderInlineEndWidth",
461
+ "borderInlineStart",
462
+ "borderInlineStartClip",
463
+ "borderInlineStartColor",
464
+ "borderInlineStartRadius",
465
+ "borderInlineStartStyle",
466
+ "borderInlineStartWidth",
467
+ "borderInlineStyle",
468
+ "borderInlineWidth",
469
+ "borderLeft",
470
+ "borderLeftClip",
471
+ "borderLeftColor",
472
+ "borderLeftRadius",
473
+ "borderLeftStyle",
474
+ "borderLeftWidth",
475
+ "borderLimit",
476
+ "borderRadius",
477
+ "borderRight",
478
+ "borderRightClip",
479
+ "borderRightColor",
480
+ "borderRightRadius",
481
+ "borderRightStyle",
482
+ "borderRightWidth",
483
+ "borderShape",
484
+ "borderSpacing",
485
+ "borderStartEndRadius",
486
+ "borderStartStartRadius",
487
+ "borderStyle",
488
+ "borderTop",
489
+ "borderTopClip",
490
+ "borderTopColor",
491
+ "borderTopLeftRadius",
492
+ "borderTopRadius",
493
+ "borderTopRightRadius",
494
+ "borderTopStyle",
495
+ "borderTopWidth",
496
+ "borderWidth",
497
+ "bottom",
498
+ "boxDecorationBreak",
499
+ "boxShadow",
500
+ "boxShadowBlur",
501
+ "boxShadowColor",
502
+ "boxShadowOffset",
503
+ "boxShadowPosition",
504
+ "boxShadowSpread",
505
+ "boxSizing",
506
+ "boxSnap",
507
+ "breakAfter",
508
+ "breakBefore",
509
+ "breakInside",
510
+ "captionSide",
511
+ "caret",
512
+ "caretAnimation",
513
+ "caretColor",
514
+ "caretShape",
515
+ "clear",
516
+ "clip",
517
+ "clipPath",
518
+ "clipRule",
519
+ "color",
520
+ "colorAdjust",
521
+ "colorInterpolation",
522
+ "colorInterpolationFilters",
523
+ "colorScheme",
524
+ "columnCount",
525
+ "columnFill",
526
+ "columnGap",
527
+ "columnHeight",
528
+ "columnRule",
529
+ "columnRuleBreak",
530
+ "columnRuleColor",
531
+ "columnRuleEdgeInset",
532
+ "columnRuleEdgeInsetEnd",
533
+ "columnRuleEdgeInsetStart",
534
+ "columnRuleInset",
535
+ "columnRuleInsetEnd",
536
+ "columnRuleInsetStart",
537
+ "columnRuleInteriorInset",
538
+ "columnRuleInteriorInsetEnd",
539
+ "columnRuleInteriorInsetStart",
540
+ "columnRuleStyle",
541
+ "columnRuleWidth",
542
+ "columnSpan",
543
+ "columnWidth",
544
+ "columnWrap",
545
+ "columns",
546
+ "contain",
547
+ "containIntrinsicBlockSize",
548
+ "containIntrinsicHeight",
549
+ "containIntrinsicInlineSize",
550
+ "containIntrinsicSize",
551
+ "containIntrinsicWidth",
552
+ "container",
553
+ "containerName",
554
+ "containerType",
555
+ "content",
556
+ "contentVisibility",
557
+ "continue",
558
+ "copyInto",
559
+ "corner",
560
+ "cornerBlockEnd",
561
+ "cornerBlockEndShape",
562
+ "cornerBlockStart",
563
+ "cornerBlockStartShape",
564
+ "cornerBottom",
565
+ "cornerBottomLeft",
566
+ "cornerBottomLeftShape",
567
+ "cornerBottomRight",
568
+ "cornerBottomRightShape",
569
+ "cornerBottomShape",
570
+ "cornerEndEnd",
571
+ "cornerEndEndShape",
572
+ "cornerEndStart",
573
+ "cornerEndStartShape",
574
+ "cornerInlineEnd",
575
+ "cornerInlineEndShape",
576
+ "cornerInlineStart",
577
+ "cornerInlineStartShape",
578
+ "cornerLeft",
579
+ "cornerLeftShape",
580
+ "cornerRight",
581
+ "cornerRightShape",
582
+ "cornerShape",
583
+ "cornerStartEnd",
584
+ "cornerStartEndShape",
585
+ "cornerStartStart",
586
+ "cornerStartStartShape",
587
+ "cornerTop",
588
+ "cornerTopLeft",
589
+ "cornerTopLeftShape",
590
+ "cornerTopRight",
591
+ "cornerTopRightShape",
592
+ "cornerTopShape",
593
+ "counterIncrement",
594
+ "counterReset",
595
+ "counterSet",
596
+ "cue",
597
+ "cueAfter",
598
+ "cueBefore",
599
+ "cursor",
600
+ "cx",
601
+ "cy",
602
+ "d",
603
+ "direction",
604
+ "display",
605
+ "dominantBaseline",
606
+ "dynamicRangeLimit",
607
+ "emptyCells",
608
+ "eventTrigger",
609
+ "eventTriggerName",
610
+ "eventTriggerSource",
611
+ "fieldSizing",
612
+ "fill",
613
+ "fillBreak",
614
+ "fillColor",
615
+ "fillImage",
616
+ "fillOpacity",
617
+ "fillOrigin",
618
+ "fillPosition",
619
+ "fillRepeat",
620
+ "fillRule",
621
+ "fillSize",
622
+ "filter",
623
+ "flex",
624
+ "flexBasis",
625
+ "flexDirection",
626
+ "flexFlow",
627
+ "flexGrow",
628
+ "flexShrink",
629
+ "flexWrap",
630
+ "float",
631
+ "floatDefer",
632
+ "floatOffset",
633
+ "floatReference",
634
+ "floodColor",
635
+ "floodOpacity",
636
+ "flowFrom",
637
+ "flowInto",
638
+ "flowTolerance",
639
+ "font",
640
+ "fontFamily",
641
+ "fontFeatureSettings",
642
+ "fontKerning",
643
+ "fontLanguageOverride",
644
+ "fontOpticalSizing",
645
+ "fontPalette",
646
+ "fontSize",
647
+ "fontSizeAdjust",
648
+ "fontStretch",
649
+ "fontStyle",
650
+ "fontSynthesis",
651
+ "fontSynthesisPosition",
652
+ "fontSynthesisSmallCaps",
653
+ "fontSynthesisStyle",
654
+ "fontSynthesisWeight",
655
+ "fontVariant",
656
+ "fontVariantAlternates",
657
+ "fontVariantCaps",
658
+ "fontVariantEastAsian",
659
+ "fontVariantEmoji",
660
+ "fontVariantLigatures",
661
+ "fontVariantNumeric",
662
+ "fontVariantPosition",
663
+ "fontVariationSettings",
664
+ "fontWeight",
665
+ "fontWidth",
666
+ "footnoteDisplay",
667
+ "footnotePolicy",
668
+ "forcedColorAdjust",
669
+ "gap",
670
+ "glyphOrientationVertical",
671
+ "grid",
672
+ "gridArea",
673
+ "gridAutoColumns",
674
+ "gridAutoFlow",
675
+ "gridAutoRows",
676
+ "gridColumn",
677
+ "gridColumnEnd",
678
+ "gridColumnGap",
679
+ "gridColumnStart",
680
+ "gridGap",
681
+ "gridRow",
682
+ "gridRowEnd",
683
+ "gridRowGap",
684
+ "gridRowStart",
685
+ "gridTemplate",
686
+ "gridTemplateAreas",
687
+ "gridTemplateColumns",
688
+ "gridTemplateRows",
689
+ "hangingPunctuation",
690
+ "height",
691
+ "hyphenateCharacter",
692
+ "hyphenateLimitChars",
693
+ "hyphenateLimitLast",
694
+ "hyphenateLimitLines",
695
+ "hyphenateLimitZone",
696
+ "hyphens",
697
+ "imageOrientation",
698
+ "imageRendering",
699
+ "imageResolution",
700
+ "initialLetter",
701
+ "initialLetterAlign",
702
+ "initialLetterWrap",
703
+ "inlineSize",
704
+ "inlineSizing",
705
+ "inputSecurity",
706
+ "inset",
707
+ "insetBlock",
708
+ "insetBlockEnd",
709
+ "insetBlockStart",
710
+ "insetInline",
711
+ "insetInlineEnd",
712
+ "insetInlineStart",
713
+ "interactivity",
714
+ "interestDelay",
715
+ "interestDelayEnd",
716
+ "interestDelayStart",
717
+ "interpolateSize",
718
+ "isolation",
719
+ "itemCross",
720
+ "itemDirection",
721
+ "itemFlow",
722
+ "itemPack",
723
+ "itemTrack",
724
+ "itemWrap",
725
+ "justifyContent",
726
+ "justifyItems",
727
+ "justifySelf",
728
+ "left",
729
+ "letterSpacing",
730
+ "lightingColor",
731
+ "lineBreak",
732
+ "lineClamp",
733
+ "lineFitEdge",
734
+ "lineGrid",
735
+ "lineHeight",
736
+ "lineHeightStep",
737
+ "linePadding",
738
+ "lineSnap",
739
+ "linkParameters",
740
+ "listStyle",
741
+ "listStyleImage",
742
+ "listStylePosition",
743
+ "listStyleType",
744
+ "margin",
745
+ "marginBlock",
746
+ "marginBlockEnd",
747
+ "marginBlockStart",
748
+ "marginBottom",
749
+ "marginBreak",
750
+ "marginInline",
751
+ "marginInlineEnd",
752
+ "marginInlineStart",
753
+ "marginLeft",
754
+ "marginRight",
755
+ "marginTop",
756
+ "marginTrim",
757
+ "marker",
758
+ "markerEnd",
759
+ "markerMid",
760
+ "markerSide",
761
+ "markerStart",
762
+ "mask",
763
+ "maskBorder",
764
+ "maskBorderMode",
765
+ "maskBorderOutset",
766
+ "maskBorderRepeat",
767
+ "maskBorderSlice",
768
+ "maskBorderSource",
769
+ "maskBorderWidth",
770
+ "maskClip",
771
+ "maskComposite",
772
+ "maskImage",
773
+ "maskMode",
774
+ "maskOrigin",
775
+ "maskPosition",
776
+ "maskRepeat",
777
+ "maskSize",
778
+ "maskType",
779
+ "mathDepth",
780
+ "mathShift",
781
+ "mathStyle",
782
+ "maxBlockSize",
783
+ "maxHeight",
784
+ "maxInlineSize",
785
+ "maxLines",
786
+ "maxWidth",
787
+ "minBlockSize",
788
+ "minHeight",
789
+ "minInlineSize",
790
+ "minIntrinsicSizing",
791
+ "minWidth",
792
+ "mixBlendMode",
793
+ "navDown",
794
+ "navLeft",
795
+ "navRight",
796
+ "navUp",
797
+ "objectFit",
798
+ "objectPosition",
799
+ "objectViewBox",
800
+ "offset",
801
+ "offsetAnchor",
802
+ "offsetDistance",
803
+ "offsetPath",
804
+ "offsetPosition",
805
+ "offsetRotate",
806
+ "opacity",
807
+ "order",
808
+ "orphans",
809
+ "outline",
810
+ "outlineColor",
811
+ "outlineOffset",
812
+ "outlineStyle",
813
+ "outlineWidth",
814
+ "overflow",
815
+ "overflowAnchor",
816
+ "overflowBlock",
817
+ "overflowClipMargin",
818
+ "overflowClipMarginBlock",
819
+ "overflowClipMarginBlockEnd",
820
+ "overflowClipMarginBlockStart",
821
+ "overflowClipMarginBottom",
822
+ "overflowClipMarginInline",
823
+ "overflowClipMarginInlineEnd",
824
+ "overflowClipMarginInlineStart",
825
+ "overflowClipMarginLeft",
826
+ "overflowClipMarginRight",
827
+ "overflowClipMarginTop",
828
+ "overflowInline",
829
+ "overflowWrap",
830
+ "overflowX",
831
+ "overflowY",
832
+ "overlay",
833
+ "overscrollBehavior",
834
+ "overscrollBehaviorBlock",
835
+ "overscrollBehaviorInline",
836
+ "overscrollBehaviorX",
837
+ "overscrollBehaviorY",
838
+ "padding",
839
+ "paddingBlock",
840
+ "paddingBlockEnd",
841
+ "paddingBlockStart",
842
+ "paddingBottom",
843
+ "paddingInline",
844
+ "paddingInlineEnd",
845
+ "paddingInlineStart",
846
+ "paddingLeft",
847
+ "paddingRight",
848
+ "paddingTop",
849
+ "page",
850
+ "pageBreakAfter",
851
+ "pageBreakBefore",
852
+ "pageBreakInside",
853
+ "paintOrder",
854
+ "pause",
855
+ "pauseAfter",
856
+ "pauseBefore",
857
+ "perspective",
858
+ "perspectiveOrigin",
859
+ "placeContent",
860
+ "placeItems",
861
+ "placeSelf",
862
+ "pointerEvents",
863
+ "pointerTimeline",
864
+ "pointerTimelineAxis",
865
+ "pointerTimelineName",
866
+ "position",
867
+ "positionAnchor",
868
+ "positionArea",
869
+ "positionTry",
870
+ "positionTryFallbacks",
871
+ "positionTryOrder",
872
+ "positionVisibility",
873
+ "printColorAdjust",
874
+ "quotes",
875
+ "r",
876
+ "readingFlow",
877
+ "readingOrder",
878
+ "regionFragment",
879
+ "resize",
880
+ "rest",
881
+ "restAfter",
882
+ "restBefore",
883
+ "right",
884
+ "rotate",
885
+ "rowGap",
886
+ "rowRule",
887
+ "rowRuleBreak",
888
+ "rowRuleColor",
889
+ "rowRuleEdgeInset",
890
+ "rowRuleEdgeInsetEnd",
891
+ "rowRuleEdgeInsetStart",
892
+ "rowRuleInset",
893
+ "rowRuleInsetEnd",
894
+ "rowRuleInsetStart",
895
+ "rowRuleInteriorInset",
896
+ "rowRuleInteriorInsetEnd",
897
+ "rowRuleInteriorInsetStart",
898
+ "rowRuleStyle",
899
+ "rowRuleWidth",
900
+ "rubyAlign",
901
+ "rubyMerge",
902
+ "rubyOverhang",
903
+ "rubyPosition",
904
+ "rule",
905
+ "ruleBreak",
906
+ "ruleColor",
907
+ "ruleEdgeInset",
908
+ "ruleInset",
909
+ "ruleInsetEnd",
910
+ "ruleInsetStart",
911
+ "ruleInteriorInset",
912
+ "ruleOverlap",
913
+ "ruleStyle",
914
+ "ruleWidth",
915
+ "rx",
916
+ "ry",
917
+ "scale",
918
+ "scrollBehavior",
919
+ "scrollInitialTarget",
920
+ "scrollMargin",
921
+ "scrollMarginBlock",
922
+ "scrollMarginBlockEnd",
923
+ "scrollMarginBlockStart",
924
+ "scrollMarginBottom",
925
+ "scrollMarginInline",
926
+ "scrollMarginInlineEnd",
927
+ "scrollMarginInlineStart",
928
+ "scrollMarginLeft",
929
+ "scrollMarginRight",
930
+ "scrollMarginTop",
931
+ "scrollMarkerGroup",
932
+ "scrollPadding",
933
+ "scrollPaddingBlock",
934
+ "scrollPaddingBlockEnd",
935
+ "scrollPaddingBlockStart",
936
+ "scrollPaddingBottom",
937
+ "scrollPaddingInline",
938
+ "scrollPaddingInlineEnd",
939
+ "scrollPaddingInlineStart",
940
+ "scrollPaddingLeft",
941
+ "scrollPaddingRight",
942
+ "scrollPaddingTop",
943
+ "scrollSnapAlign",
944
+ "scrollSnapStop",
945
+ "scrollSnapType",
946
+ "scrollTargetGroup",
947
+ "scrollTimeline",
948
+ "scrollTimelineAxis",
949
+ "scrollTimelineName",
950
+ "scrollbarColor",
951
+ "scrollbarGutter",
952
+ "scrollbarWidth",
953
+ "shapeImageThreshold",
954
+ "shapeInside",
955
+ "shapeMargin",
956
+ "shapeOutside",
957
+ "shapePadding",
958
+ "shapeRendering",
959
+ "shapeSubtract",
960
+ "sliderOrientation",
961
+ "spatialNavigationAction",
962
+ "spatialNavigationContain",
963
+ "spatialNavigationFunction",
964
+ "speak",
965
+ "speakAs",
966
+ "stopColor",
967
+ "stopOpacity",
968
+ "stringSet",
969
+ "stroke",
970
+ "strokeAlign",
971
+ "strokeAlignment",
972
+ "strokeBreak",
973
+ "strokeColor",
974
+ "strokeDashCorner",
975
+ "strokeDashJustify",
976
+ "strokeDashadjust",
977
+ "strokeDasharray",
978
+ "strokeDashcorner",
979
+ "strokeDashoffset",
980
+ "strokeImage",
981
+ "strokeLinecap",
982
+ "strokeLinejoin",
983
+ "strokeMiterlimit",
984
+ "strokeOpacity",
985
+ "strokeOrigin",
986
+ "strokePosition",
987
+ "strokeRepeat",
988
+ "strokeSize",
989
+ "strokeWidth",
990
+ "tabSize",
991
+ "tableLayout",
992
+ "textAlign",
993
+ "textAlignAll",
994
+ "textAlignLast",
995
+ "textAnchor",
996
+ "textAutospace",
997
+ "textBox",
998
+ "textBoxEdge",
999
+ "textBoxTrim",
1000
+ "textCombineUpright",
1001
+ "textDecoration",
1002
+ "textDecorationColor",
1003
+ "textDecorationInset",
1004
+ "textDecorationLine",
1005
+ "textDecorationSkip",
1006
+ "textDecorationSkipBox",
1007
+ "textDecorationSkipInk",
1008
+ "textDecorationSkipSelf",
1009
+ "textDecorationSkipSpaces",
1010
+ "textDecorationStyle",
1011
+ "textDecorationThickness",
1012
+ "textEmphasis",
1013
+ "textEmphasisColor",
1014
+ "textEmphasisPosition",
1015
+ "textEmphasisSkip",
1016
+ "textEmphasisStyle",
1017
+ "textGroupAlign",
1018
+ "textIndent",
1019
+ "textJustify",
1020
+ "textOrientation",
1021
+ "textOverflow",
1022
+ "textRendering",
1023
+ "textShadow",
1024
+ "textSizeAdjust",
1025
+ "textSpacing",
1026
+ "textSpacingTrim",
1027
+ "textTransform",
1028
+ "textUnderlineOffset",
1029
+ "textUnderlinePosition",
1030
+ "textWrap",
1031
+ "textWrapMode",
1032
+ "textWrapStyle",
1033
+ "timelineScope",
1034
+ "timelineTrigger",
1035
+ "timelineTriggerExitRange",
1036
+ "timelineTriggerExitRangeEnd",
1037
+ "timelineTriggerExitRangeStart",
1038
+ "timelineTriggerName",
1039
+ "timelineTriggerRange",
1040
+ "timelineTriggerRangeEnd",
1041
+ "timelineTriggerRangeStart",
1042
+ "timelineTriggerSource",
1043
+ "top",
1044
+ "touchAction",
1045
+ "transform",
1046
+ "transformBox",
1047
+ "transformOrigin",
1048
+ "transformStyle",
1049
+ "transition",
1050
+ "transitionBehavior",
1051
+ "transitionDelay",
1052
+ "transitionDuration",
1053
+ "transitionProperty",
1054
+ "transitionTimingFunction",
1055
+ "translate",
1056
+ "triggerScope",
1057
+ "unicodeBidi",
1058
+ "userSelect",
1059
+ "vectorEffect",
1060
+ "verticalAlign",
1061
+ "viewTimeline",
1062
+ "viewTimelineAxis",
1063
+ "viewTimelineInset",
1064
+ "viewTimelineName",
1065
+ "viewTransitionClass",
1066
+ "viewTransitionGroup",
1067
+ "viewTransitionName",
1068
+ "viewTransitionScope",
1069
+ "visibility",
1070
+ "voiceBalance",
1071
+ "voiceDuration",
1072
+ "voiceFamily",
1073
+ "voicePitch",
1074
+ "voiceRange",
1075
+ "voiceRate",
1076
+ "voiceStress",
1077
+ "voiceVolume",
1078
+ "whiteSpace",
1079
+ "whiteSpaceCollapse",
1080
+ "whiteSpaceTrim",
1081
+ "widows",
1082
+ "width",
1083
+ "willChange",
1084
+ "wordBreak",
1085
+ "wordSpaceTransform",
1086
+ "wordSpacing",
1087
+ "wordWrap",
1088
+ "wrapAfter",
1089
+ "wrapBefore",
1090
+ "wrapFlow",
1091
+ "wrapInside",
1092
+ "wrapThrough",
1093
+ "writingMode",
1094
+ "x",
1095
+ "y",
1096
+ "zIndex",
1097
+ "zoom"
1098
+ ]);
1099
+ /**
1100
+ * Converts a camelCase string to kebab-case.
1101
+ */
1102
+ function camelToKebab(str) {
1103
+ return str.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
1104
+ }
1105
+ function getUnitForProperty(propertyName) {
1106
+ return propertyName in propertyUnits ? propertyUnits[propertyName] : void 0;
1107
+ }
1108
+ /**
1109
+ * Converts a CSS-like value to its string representation.
1110
+ * For properties with known units, numbers are automatically suffixed.
1111
+ */
1112
+ function formatValue(value, propertyName, maxDepth = 10) {
1113
+ if (maxDepth <= 0) return "";
1114
+ if (typeof value === "string") return value;
1115
+ if (typeof value === "number") {
1116
+ const unit = getUnitForProperty(propertyName);
1117
+ if (unit === "%") return `${value * 100}${unit}`;
1118
+ if (value === 0) return "0";
1119
+ return unit ? `${value}${unit}` : value.toString();
1120
+ }
1121
+ return formatValue(value.value, propertyName, maxDepth - 1);
1122
+ }
1123
+ /**
1124
+ * Checks if a property name is a CSS custom property (variable).
1125
+ */
1126
+ function isCssVariableName(key) {
1127
+ return key.startsWith("--");
1128
+ }
1129
+ /**
1130
+ * Converts a CSS-like value to a string for use as a CSS variable value.
1131
+ * @param value - The value to convert (string, number, or wrapped value)
1132
+ * @param maxDepth - Maximum recursion depth for evaluating the value
1133
+ * @returns The string representation
1134
+ */
1135
+ function asVar(value, maxDepth = 10) {
1136
+ if (maxDepth <= 0) return "";
1137
+ switch (typeof value) {
1138
+ case "string": return value;
1139
+ case "number": return value.toString();
1140
+ default: return asVar(value.value, maxDepth - 1);
1141
+ }
1142
+ }
1143
+ /**
1144
+ * Checks if a property name is a known CSS property.
1145
+ */
1146
+ function isKnownPropertyName(key) {
1147
+ return knownPropertyNames.has(key);
1148
+ }
1149
+ /**
1150
+ * Converts a value to a CSS property string.
1151
+ * Automatically appends units to numeric values for properties that require them.
1152
+ * @param value - The value to convert
1153
+ * @param key - The CSS property name
1154
+ * @returns The formatted CSS value string
1155
+ */
1156
+ function asKnownProp(value, key) {
1157
+ return formatValue(value, key);
1158
+ }
1159
+ /**
1160
+ * Checks if a key represents a nested CSS selector.
1161
+ */
1162
+ function isNestedSelector(key) {
1163
+ return key.includes("&");
1164
+ }
1165
+ /** Known at-rule prefixes that mochi-css recognizes */
1166
+ const AT_RULE_PREFIXES = [
1167
+ "@media ",
1168
+ "@container ",
1169
+ "@supports ",
1170
+ "@layer "
1171
+ ];
1172
+ /**
1173
+ * Checks if a key represents a CSS at-rule (media, container, supports, layer).
1174
+ */
1175
+ function isAtRuleKey(key) {
1176
+ return AT_RULE_PREFIXES.some((p) => key.startsWith(p));
1177
+ }
1178
+ /**
1179
+ * Immutable CSS selector builder that handles nested selectors and CSS at-rules.
1180
+ * Uses the `&` character as a placeholder for parent selector substitution.
1181
+ *
1182
+ * @example
1183
+ * const selector = new MochiSelector(['.button'])
1184
+ * selector.extend('&:hover').cssSelector // '.button:hover'
1185
+ * selector.wrap('@media (min-width: 768px)').atRules // ['@media (min-width: 768px)']
1186
+ */
1187
+ var MochiSelector = class MochiSelector$1 {
1188
+ /**
1189
+ * Creates a new MochiSelector instance.
1190
+ * @param cssSelectors - Array of CSS selectors (may contain `&` placeholders)
1191
+ * @param atRules - Array of full CSS at-rule strings e.g. `"@media (min-width: 768px)"`
1192
+ */
1193
+ constructor(cssSelectors = [], atRules = []) {
1194
+ this.cssSelectors = cssSelectors;
1195
+ this.atRules = atRules;
1196
+ }
1197
+ /**
1198
+ * Gets the combined CSS selector string.
1199
+ * Multiple selectors are joined with commas.
1200
+ * @returns The CSS selector, or "*" if no selectors are defined
1201
+ */
1202
+ get cssSelector() {
1203
+ if (this.cssSelectors.length === 0) return "*";
1204
+ return this.cssSelectors.join(", ");
1205
+ }
1206
+ /**
1207
+ * Substitutes all `&` placeholders with the given root selector.
1208
+ * @param root - The selector to replace `&` with
1209
+ * @returns A new MochiSelector with substituted selectors
1210
+ */
1211
+ substitute(root) {
1212
+ return new MochiSelector$1(this.cssSelectors.map((selector) => selector.replace(/&/g, root)), this.atRules);
1213
+ }
1214
+ /**
1215
+ * Extends this selector by nesting a child selector.
1216
+ * The `&` in the child selector is replaced with each parent selector.
1217
+ * @param child - The child selector pattern (must contain `&`)
1218
+ * @returns A new MochiSelector with the extended selectors
1219
+ * @example
1220
+ * new MochiSelector(['.btn']).extend('&:hover') // '.btn:hover'
1221
+ * new MochiSelector(['.btn']).extend('& .icon') // '.btn .icon'
1222
+ */
1223
+ extend(child) {
1224
+ if (!isNestedSelector(child)) return this;
1225
+ const children = MochiSelector$1.split(child);
1226
+ return new MochiSelector$1(this.cssSelectors.flatMap((parentSelector) => children.map((childSelector) => {
1227
+ return childSelector.replace(/&/g, parentSelector);
1228
+ })), this.atRules);
1229
+ }
1230
+ /**
1231
+ * Wraps this selector with a CSS at-rule.
1232
+ * @param atRule - The full at-rule string (e.g. `"@media (min-width: 768px)"`)
1233
+ * @returns A new MochiSelector with the added at-rule, or unchanged if not a known at-rule
1234
+ * @example
1235
+ * selector.wrap('@media (min-width: 768px)') // Adds media query
1236
+ * selector.wrap('@container sidebar (min-width: 300px)') // Adds container query
1237
+ */
1238
+ wrap(atRule) {
1239
+ if (!isAtRuleKey(atRule)) return this;
1240
+ return new MochiSelector$1(this.cssSelectors, [...this.atRules, atRule]);
1241
+ }
1242
+ /**
1243
+ * Splits a comma-separated selector string into individual selectors.
1244
+ * @param selector - The selector string to split
1245
+ * @returns Array of individual selector strings
1246
+ */
1247
+ static split(selector) {
1248
+ return [selector];
1249
+ }
1250
+ };
1251
+ /**
1252
+ * Hashing utilities for generating short, deterministic class names.
1253
+ * Uses djb2 algorithm for fast string hashing.
1254
+ * @module hash
1255
+ */
1256
+ /** Characters used for base-62 encoding (css-name safe variant of base-64) */
1257
+ const hashBase = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
1258
+ const base = 64;
1259
+ /**
1260
+ * Converts a number to a base-62 string representation.
1261
+ * @param num - The number to convert
1262
+ * @param maxLength - Optional maximum length of the output string
1263
+ * @returns Base-62 encoded string representation of the number
1264
+ */
1265
+ function numberToBase62(num, maxLength) {
1266
+ let out = "";
1267
+ while (num > 0 && out.length < (maxLength ?? Infinity)) {
1268
+ out = hashBase[num % base] + out;
1269
+ num = Math.floor(num / base);
1270
+ }
1271
+ return out.length > 0 ? out : "0";
1272
+ }
1273
+ /**
1274
+ * Generates a short hash string from input using the djb2 algorithm.
1275
+ * Used to create unique, deterministic CSS class names from style content.
1276
+ * @param input - The string to hash
1277
+ * @param length - Maximum length of the hash output (default: 8)
1278
+ * @returns A short, css-safe hash string
1279
+ * @example
1280
+ * shortHash("color: red;") // Returns something like "A1b2C3d4"
1281
+ */
1282
+ function shortHash(input, length = 8) {
1283
+ let h = 5381;
1284
+ for (let i = 0; i < input.length; i++) h = h * 33 ^ input.charCodeAt(i);
1285
+ h >>>= 0;
1286
+ return numberToBase62(h, length);
1287
+ }
1288
+ /**
1289
+ * String comparison utilities for deterministic sorting.
1290
+ * Used internally to ensure consistent CSS output order.
1291
+ * @module compare
1292
+ */
1293
+ /**
1294
+ * Compares two strings lexicographically.
1295
+ */
1296
+ function compareString(a, b) {
1297
+ return a < b ? -1 : a === b ? 0 : 1;
1298
+ }
1299
+ /**
1300
+ * Compares two tuples by their first element (string key).
1301
+ * Useful for sorting Object.entries() results.
1302
+ */
1303
+ function compareStringKey(a, b) {
1304
+ return compareString(a[0], b[0]);
1305
+ }
1306
+ /**
1307
+ * Creates a comparator function for objects with a specific string property.
1308
+ * @param name - The property name to compare by
1309
+ * @returns A comparator function that compares objects by the specified property
1310
+ * @example
1311
+ * const items = [{ key: 'b' }, { key: 'a' }]
1312
+ * items.sort(stringPropComparator('key')) // [{ key: 'a' }, { key: 'b' }]
1313
+ */
1314
+ function stringPropComparator(name) {
1315
+ return (a, b) => compareString(a[name], b[name]);
1316
+ }
1317
+ /**
1318
+ * Represents a single CSS rule block with properties and a selector.
1319
+ * Handles conversion to CSS string format and hash generation.
1320
+ */
1321
+ var CssObjectSubBlock = class CssObjectSubBlock$1 {
1322
+ /**
1323
+ * Creates a new CSS sub-block.
1324
+ * @param cssProps - Map of CSS property names (kebab-case) to values
1325
+ * @param selector - The selector this block applies to
1326
+ */
1327
+ constructor(cssProps, selector) {
1328
+ this.cssProps = cssProps;
1329
+ this.selector = selector;
1330
+ }
1331
+ /**
1332
+ * Computes a deterministic hash of this block's CSS content.
1333
+ * Used for generating unique class names.
1334
+ */
1335
+ get hash() {
1336
+ return shortHash(this.asCssString("&"));
1337
+ }
1338
+ /**
1339
+ * Converts this block to a CSS string.
1340
+ * Handles at-rule wrapping (media, container, supports, layer) if present.
1341
+ * Multiple at-rules are nested in order.
1342
+ * @param root - The root selector to substitute for `&`
1343
+ * @returns Formatted CSS string
1344
+ */
1345
+ asCssString(root) {
1346
+ const selector = this.selector.substitute(root);
1347
+ const atRules = selector.atRules;
1348
+ const innerIndent = " ".repeat(atRules.length);
1349
+ const props = Object.entries(this.cssProps).toSorted(compareStringKey).map(([k, v]) => `${innerIndent} ${k}: ${v};\n`).join("");
1350
+ let result = `${innerIndent}${selector.cssSelector} {\n${props}${innerIndent}}`;
1351
+ for (let i = atRules.length - 1; i >= 0; i--) {
1352
+ const outerIndent = " ".repeat(i);
1353
+ result = `${outerIndent}${atRules[i]} {\n${result}\n${outerIndent}}`;
1354
+ }
1355
+ return result;
1356
+ }
1357
+ /**
1358
+ * Parses StyleProps into an array of CSS sub-blocks.
1359
+ * Recursively processes nested selectors and media queries.
1360
+ * Output order is deterministic for consistent hash generation.
1361
+ *
1362
+ * @param props - The style properties to parse
1363
+ * @param selector - The parent selector context (defaults to `&`)
1364
+ * @returns Non-empty array of sub-blocks (main block first, then nested)
1365
+ */
1366
+ static fromProps(props, selector) {
1367
+ selector ??= new MochiSelector(["&"]);
1368
+ const cssProps = {};
1369
+ const propsToProcess = [];
1370
+ for (const [key, value] of Object.entries(props)) {
1371
+ if (value === void 0) continue;
1372
+ if (isCssVariableName(key)) {
1373
+ cssProps[key] = asVar(value);
1374
+ continue;
1375
+ }
1376
+ if (isKnownPropertyName(key)) {
1377
+ cssProps[camelToKebab(key)] = asKnownProp(value, key);
1378
+ continue;
1379
+ }
1380
+ if (isNestedSelector(key)) {
1381
+ propsToProcess.push({
1382
+ key,
1383
+ props: value,
1384
+ selector: selector.extend(key)
1385
+ });
1386
+ continue;
1387
+ }
1388
+ if (isAtRuleKey(key)) {
1389
+ propsToProcess.push({
1390
+ key,
1391
+ props: value,
1392
+ selector: selector.wrap(key)
1393
+ });
1394
+ continue;
1395
+ }
1396
+ if (process.env["NODE_ENV"] !== "production") console.warn(`[mochi-css] Unknown style property "${key}" will be ignored`);
1397
+ }
1398
+ return [new CssObjectSubBlock$1(cssProps, selector), ...propsToProcess.toSorted(stringPropComparator("key")).flatMap(({ props: props$1, selector: selector$1 }) => CssObjectSubBlock$1.fromProps(props$1, selector$1))];
1399
+ }
1400
+ };
1401
+ /**
1402
+ * Represents an abstract CSS block definition.
1403
+ * Contains one or more sub-blocks for nested selectors and media queries.
1404
+ */
1405
+ var CssObjectBlock = class {
1406
+ /** The generated unique class name for this block */
1407
+ className;
1408
+ /** All sub-blocks (main styles and nested/media rules) */
1409
+ subBlocks = [];
1410
+ /**
1411
+ * Creates a new CSS block from style properties.
1412
+ * Generates a unique class name based on the content hash, or uses the provided class name.
1413
+ * @param styles - The style properties to compile
1414
+ * @param className - Optional stable class name; if omitted, a content-hash-based name is generated
1415
+ */
1416
+ constructor(styles, className) {
1417
+ const blocks = CssObjectSubBlock.fromProps(styles);
1418
+ this.className = className ?? "c" + shortHash(blocks.map((b) => b.hash).join("+"));
1419
+ this.subBlocks = blocks;
1420
+ }
1421
+ /**
1422
+ * Gets the CSS class selector for this block.
1423
+ */
1424
+ get selector() {
1425
+ return `.${this.className}`;
1426
+ }
1427
+ /**
1428
+ * Converts style block to a CSS string.
1429
+ * @param root - The root selector to scope styles to
1430
+ * @returns Complete CSS string for this block
1431
+ */
1432
+ asCssString(root) {
1433
+ return this.subBlocks.map((b) => b.asCssString(new MochiSelector([root]).extend(`&.${this.className}`).cssSelector)).join("\n\n");
1434
+ }
1435
+ };
1436
+ /**
1437
+ * Complete CSS object representation with main and variant styles.
1438
+ *
1439
+ * @template V - The variant definitions type
1440
+ *
1441
+ * @example
1442
+ * const obj = new CSSObject({
1443
+ * color: 'blue',
1444
+ * variants: {
1445
+ * size: {
1446
+ * small: { fontSize: 12 },
1447
+ * large: { fontSize: 18 }
1448
+ * }
1449
+ * },
1450
+ * defaultVariants: { size: 'small' }
1451
+ * })
1452
+ * obj.asCssString() // Returns complete CSS with all variants
1453
+ */
1454
+ var CSSObject = class {
1455
+ /** The main style block (non-variant styles) */
1456
+ mainBlock;
1457
+ /** Compiled blocks for each variant option */
1458
+ variantBlocks;
1459
+ /** Default variant selections */
1460
+ variantDefaults;
1461
+ /** Compound variant conditions and their parsed sub-blocks */
1462
+ compoundVariants;
1463
+ /**
1464
+ * Creates a new CSSObject from style props.
1465
+ * Compiles main styles and all variant options into CSS blocks.
1466
+ * @param props - Base style props plus variant definitions
1467
+ * @param props.variants - Named variant groups, each mapping variant values to style props
1468
+ * @param props.defaultVariants - Default value for each variant when none is provided at runtime
1469
+ * @param props.compoundVariants - Style props applied when a specific combination of variants is active
1470
+ * @param className - Optional stable class name for the main block
1471
+ */
1472
+ constructor({ variants, defaultVariants, compoundVariants,...props }, className) {
1473
+ this.mainBlock = new CssObjectBlock(props, className);
1474
+ this.variantBlocks = {};
1475
+ this.variantDefaults = defaultVariants ?? {};
1476
+ this.compoundVariants = [];
1477
+ if (variants) for (const variantGroupName in variants) {
1478
+ this.variantBlocks[variantGroupName] = {};
1479
+ const variantGroup = variants[variantGroupName];
1480
+ for (const variantItemName in variantGroup) this.variantBlocks[variantGroupName][variantItemName] = new CssObjectBlock(variantGroup[variantItemName] ?? {});
1481
+ }
1482
+ if (compoundVariants) for (const compound of compoundVariants) {
1483
+ const { css: styles,...conditions } = compound;
1484
+ this.compoundVariants.push({
1485
+ conditions,
1486
+ subBlocks: CssObjectSubBlock.fromProps(styles)
1487
+ });
1488
+ }
1489
+ }
1490
+ /**
1491
+ * Serializes the entire CSS object to a CSS string.
1492
+ * Outputs main block first, then all variant blocks in sorted order.
1493
+ * @returns Complete CSS string ready for injection into a stylesheet
1494
+ */
1495
+ asCssString() {
1496
+ return [
1497
+ this.mainBlock.asCssString(this.mainBlock.selector),
1498
+ ...Object.entries(this.variantBlocks).toSorted(compareStringKey).flatMap(([_, b]) => Object.entries(b).toSorted(compareStringKey)).map(([_, b]) => b.asCssString(this.mainBlock.selector)),
1499
+ ...this.compoundVariants.flatMap(({ conditions, subBlocks }) => {
1500
+ const selectorParts = [];
1501
+ for (const [variantName, optionName] of Object.entries(conditions).toSorted(compareStringKey)) {
1502
+ const selector = this.variantBlocks[variantName]?.[optionName]?.selector;
1503
+ if (selector === void 0) return [];
1504
+ selectorParts.push(selector);
1505
+ }
1506
+ const combinedSelector = `${this.mainBlock.selector}${selectorParts.join("")}`;
1507
+ return subBlocks.map((b) => b.asCssString(combinedSelector));
1508
+ })
1509
+ ].join("\n\n");
1510
+ }
1511
+ };
1512
+ const MOCHI_CSS_TYPEOF = Symbol.for("mochi-css.MochiCSS");
1513
+ /**
1514
+ * Runtime representation of a CSS style definition with variant support.
1515
+ * Holds generated class names and provides methods to compute the final
1516
+ * className string based on selected variants.
1517
+ *
1518
+ * @template V - The variant definitions type mapping variant names to their options
1519
+ *
1520
+ * @example
1521
+ * const styles = MochiCSS.from(new CSSObject({
1522
+ * color: 'blue',
1523
+ * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }
1524
+ * }))
1525
+ * styles.variant({ size: 'large' }) // Returns combined class names
1526
+ */
1527
+ var MochiCSS = class MochiCSS$1 {
1528
+ $$typeof = MOCHI_CSS_TYPEOF;
1529
+ /**
1530
+ * Creates a new MochiCSS instance.
1531
+ * @param classNames - Base class names to always include
1532
+ * @param variantClassNames - Mapping of variant names to option class names
1533
+ * @param defaultVariants - Default variant selections when not specified
1534
+ */
1535
+ constructor(classNames, variantClassNames, defaultVariants) {
1536
+ this.classNames = classNames;
1537
+ this.variantClassNames = variantClassNames;
1538
+ this.defaultVariants = defaultVariants;
1539
+ }
1540
+ /**
1541
+ * Computes the final className string based on variant selections.
1542
+ * Compound variants are handled purely via CSS combined selectors,
1543
+ * so no runtime matching is needed here.
1544
+ * @param props - Variant selections
1545
+ * @returns Combined className string for use in components
1546
+ */
1547
+ variant(props) {
1548
+ const keys = new Set([...Object.keys(props), ...Object.keys(this.defaultVariants)].filter((k) => k in this.variantClassNames));
1549
+ return (0, clsx.default)(this.classNames, ...keys.values().map((k) => {
1550
+ const variantGroup = this.variantClassNames[k];
1551
+ if (!variantGroup) return false;
1552
+ const variantKey = ((k in props ? props[k] : void 0) ?? this.defaultVariants[k])?.toString();
1553
+ if (variantKey == null) return false;
1554
+ const selectedClassname = variantGroup[variantKey];
1555
+ if (selectedClassname !== void 0) return selectedClassname;
1556
+ const defaultKey = this.defaultVariants[k];
1557
+ if (defaultKey == null) return false;
1558
+ return variantGroup[defaultKey.toString()];
1559
+ }));
1560
+ }
1561
+ /**
1562
+ * Returns the CSS selector for this style (e.g. `.abc123`).
1563
+ * Useful for targeting this component from another style.
1564
+ */
1565
+ get selector() {
1566
+ return this.classNames.map((n) => `.${n}`).join();
1567
+ }
1568
+ toString() {
1569
+ return this.selector;
1570
+ }
1571
+ /**
1572
+ * Creates a MochiCSS instance from a CSSObject.
1573
+ * Extracts class names from the compiled CSS blocks.
1574
+ * @template V - The variant definitions type
1575
+ * @param object - The compiled CSSObject to extract from
1576
+ * @returns A new MochiCSS instance with the extracted class names
1577
+ */
1578
+ static from(object) {
1579
+ return new MochiCSS$1([object.mainBlock.className], Object.fromEntries(Object.entries(object.variantBlocks).map(([key, variantOptions]) => {
1580
+ return [key, Object.fromEntries(Object.entries(variantOptions).map(([optionKey, block]) => {
1581
+ return [optionKey, block.className];
1582
+ }))];
1583
+ })), object.variantDefaults);
1584
+ }
1585
+ };
1586
+ /**
1587
+ * Creates a CSS style definition.
1588
+ * The primary API for defining styles in Mochi-CSS.
1589
+ *
1590
+ * @template V - Tuple of variant definition types
1591
+ * @param props - One or more style objects or existing MochiCSS instances to merge
1592
+ * @returns A MochiCSS instance with all styles and variants combined
1593
+ *
1594
+ * @example
1595
+ * // Simple usage
1596
+ * const button = css({ padding: 8, borderRadius: 4 })
1597
+ *
1598
+ * @example
1599
+ * // With variants
1600
+ * const button = css({
1601
+ * padding: 8,
1602
+ * variants: {
1603
+ * size: {
1604
+ * small: { padding: 4 },
1605
+ * large: { padding: 16 }
1606
+ * }
1607
+ * },
1608
+ * defaultVariants: { size: 'small' }
1609
+ * })
1610
+ * button.variant({ size: 'large' }) // Get class names for large size
1611
+ *
1612
+ * @example
1613
+ * // Merging multiple styles
1614
+ * const combined = css(baseStyles, additionalStyles)
1615
+ */
1616
+ const emptyMochiCSS = new MochiCSS([], {}, {});
1617
+ /**
1618
+ * Merges multiple MochiCSS instances into a single one, combining their
1619
+ * class names, variant class names, and default variants.
1620
+ * @param instances - The MochiCSS instances to merge
1621
+ * @returns A new MochiCSS instance with all styles combined
1622
+ */
1623
+ function mergeMochiCss(instances) {
1624
+ if (instances.length === 0) return emptyMochiCSS;
1625
+ return new MochiCSS(instances.flatMap((c) => c.classNames), instances.reduce((a, b) => Object.assign(a, b.variantClassNames), {}), instances.reduce((a, b) => Object.assign(a, b.defaultVariants), {}));
1626
+ }
1627
+ function css(...props) {
1628
+ const cssToMerge = [];
1629
+ for (const p of props) {
1630
+ if (p == null) continue;
1631
+ if (typeof p === "string") {
1632
+ cssToMerge.push(new MochiCSS([p], {}, {}));
1633
+ continue;
1634
+ }
1635
+ if (typeof p !== "object") continue;
1636
+ if (p instanceof MochiCSS) cssToMerge.push(p);
1637
+ else cssToMerge.push(MochiCSS.from(new CSSObject(p)));
1638
+ }
1639
+ return mergeMochiCss(cssToMerge);
1640
+ }
1641
+ /**
1642
+ * Wraps a condition in parentheses if not already wrapped.
1643
+ */
1644
+ function wrapParens(condition) {
1645
+ const trimmed = condition.trim();
1646
+ if (trimmed.startsWith("(") && trimmed.endsWith(")")) return trimmed;
1647
+ return `(${trimmed})`;
1648
+ }
1649
+ function mediaFn(condition) {
1650
+ return `@media ${wrapParens(condition)}`;
1651
+ }
1652
+ mediaFn.and = function(...conditions) {
1653
+ return `@media ${conditions.map(wrapParens).join(" and ")}`;
1654
+ };
1655
+ mediaFn.or = function(...conditions) {
1656
+ return `@media ${conditions.map(wrapParens).join(", ")}`;
1657
+ };
1658
+ Object.defineProperties(mediaFn, {
1659
+ dark: {
1660
+ get: () => "@media (prefers-color-scheme: dark)",
1661
+ enumerable: true
1662
+ },
1663
+ light: {
1664
+ get: () => "@media (prefers-color-scheme: light)",
1665
+ enumerable: true
1666
+ },
1667
+ motion: {
1668
+ get: () => "@media (prefers-reduced-motion: no-preference)",
1669
+ enumerable: true
1670
+ },
1671
+ print: {
1672
+ get: () => "@media print",
1673
+ enumerable: true
1674
+ }
1675
+ });
1676
+ function containerFn(condition) {
1677
+ return `@container ${wrapParens(condition)}`;
1678
+ }
1679
+ containerFn.named = function(name, condition) {
1680
+ return `@container ${name} ${wrapParens(condition)}`;
1681
+ };
1682
+ function supportsFn(condition) {
1683
+ return `@supports ${wrapParens(condition)}`;
1684
+ }
1685
+ supportsFn.not = function(condition) {
1686
+ return `@supports not ${wrapParens(condition)}`;
1687
+ };
1688
+ supportsFn.and = function(...conditions) {
1689
+ return `@supports ${conditions.map(wrapParens).join(" and ")}`;
1690
+ };
1691
+ supportsFn.or = function(...conditions) {
1692
+ return `@supports ${conditions.map(wrapParens).join(" or ")}`;
1693
+ };
1694
+
1695
+ //#endregion
1696
+ //#region src/styled.ts
1697
+ /**
1698
+ * Creates a styled React component with CSS-in-JS support and variant props.
1699
+ * Similar to styled-components or Stitches, but with zero runtime overhead.
1700
+ *
1701
+ * @template T - The base element type or component type
1702
+ * @template V - The variant definitions tuple type
1703
+ * @param target - The HTML element tag name or React component to style
1704
+ * @param props - One or more style objects with optional variants
1705
+ * @returns A React functional component with merged props and variant support
1706
+ *
1707
+ * @remarks
1708
+ * Variant props are automatically stripped and never forwarded to the underlying
1709
+ * element or component. This prevents unknown prop warnings on DOM elements.
1710
+ * If the inner component has a prop with the same
1711
+ * name as a variant, it will not receive that prop.
1712
+ *
1713
+ * @example
1714
+ * const Button = styled('button', {
1715
+ * padding: 8,
1716
+ * borderRadius: 4,
1717
+ * variants: {
1718
+ * size: {
1719
+ * small: { padding: 4 },
1720
+ * large: { padding: 16 }
1721
+ * },
1722
+ * variant: {
1723
+ * primary: { backgroundColor: 'blue' },
1724
+ * secondary: { backgroundColor: 'gray' }
1725
+ * }
1726
+ * }
1727
+ * })
1728
+ *
1729
+ * // Usage: <Button size="large" variant="primary">Click me</Button>
1730
+ */
1731
+ function styled(target, ...props) {
1732
+ const styles = css(...props);
1733
+ const selector = styles.selector;
1734
+ const variantKeys = new Set(Object.keys(styles.variantClassNames));
1735
+ return Object.assign(({ className,...p }) => {
1736
+ const variantProps = {};
1737
+ const restProps = {};
1738
+ for (const [k, v] of Object.entries(p)) if (variantKeys.has(k)) variantProps[k] = v;
1739
+ else restProps[k] = v;
1740
+ return (0, react.createElement)(target, {
1741
+ className: (0, clsx.default)(styles.variant(variantProps), className),
1742
+ ...restProps
1743
+ });
1744
+ }, {
1745
+ toString: () => selector,
1746
+ selector
1747
+ });
1748
+ }
1749
+
1750
+ //#endregion
1751
+ exports.styled = styled;
1752
+ //# sourceMappingURL=index.js.map