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