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