rainbowindex 0.2.2 → 0.4.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/CHANGELOG.md +70 -14
- package/LICENSE +1 -1
- package/README.md +23 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +1 -1
- package/dist/chunk-3HRMFZGE.mjs +19 -0
- package/dist/{chunk-FHATRQMN.mjs → chunk-4SVFFDS2.mjs} +495 -461
- package/dist/{chunk-SOMDX7V6.mjs → chunk-5Y7EXXLS.mjs} +320 -417
- package/dist/{chunk-W6XIBM4M.mjs → chunk-6DAHUFNU.mjs} +5278 -4928
- package/dist/{chunk-CUUW2K35.mjs → chunk-TLR6RP5L.mjs} +41 -120
- package/dist/chunk-YLB6FGIG.mjs +244 -0
- package/dist/cli.mjs +280 -277
- package/dist/{index-CfDtWufj.d.ts → context-ruu2x_jR.d.ts} +15 -70
- package/dist/editor.d.ts +106 -28
- package/dist/editor.mjs +44 -12
- package/dist/{index-DK6APAGD.d.ts → index-BB2HoeMj.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/safelist-D9-Plqta.d.ts +109 -0
- package/dist/vite.mjs +48 -27
- package/package.json +1 -1
- package/dist/chunk-KYDEHYIE.mjs +0 -691
- package/dist/safelist-CH3_PywB.d.ts +0 -43
|
@@ -625,6 +625,90 @@ function devWarn(message) {
|
|
|
625
625
|
}
|
|
626
626
|
|
|
627
627
|
// src/merge/props.ts
|
|
628
|
+
var PADDING_MAP = Object.freeze({
|
|
629
|
+
p: ["padding"],
|
|
630
|
+
px: ["padding-inline"],
|
|
631
|
+
py: ["padding-block"],
|
|
632
|
+
pt: ["padding-block-start"],
|
|
633
|
+
pb: ["padding-block-end"],
|
|
634
|
+
pl: ["padding-inline-start"],
|
|
635
|
+
pr: ["padding-inline-end"],
|
|
636
|
+
ps: ["padding-inline-start"],
|
|
637
|
+
pe: ["padding-inline-end"],
|
|
638
|
+
pbs: ["padding-block-start"],
|
|
639
|
+
pbe: ["padding-block-end"]
|
|
640
|
+
});
|
|
641
|
+
var MARGIN_MAP = Object.freeze({
|
|
642
|
+
m: ["margin"],
|
|
643
|
+
mx: ["margin-inline"],
|
|
644
|
+
my: ["margin-block"],
|
|
645
|
+
mt: ["margin-block-start"],
|
|
646
|
+
mb: ["margin-block-end"],
|
|
647
|
+
ml: ["margin-inline-start"],
|
|
648
|
+
mr: ["margin-inline-end"],
|
|
649
|
+
ms: ["margin-inline-start"],
|
|
650
|
+
me: ["margin-inline-end"],
|
|
651
|
+
mbs: ["margin-block-start"],
|
|
652
|
+
mbe: ["margin-block-end"]
|
|
653
|
+
});
|
|
654
|
+
var GAP_MAP = Object.freeze({
|
|
655
|
+
gap: ["gap"],
|
|
656
|
+
"gap-x": ["column-gap"],
|
|
657
|
+
"gap-y": ["row-gap"]
|
|
658
|
+
});
|
|
659
|
+
var INSET_MAP = Object.freeze({
|
|
660
|
+
inset: ["inset"],
|
|
661
|
+
"inset-x": ["inset-inline"],
|
|
662
|
+
"inset-y": ["inset-block"],
|
|
663
|
+
top: ["inset-block-start"],
|
|
664
|
+
bottom: ["inset-block-end"],
|
|
665
|
+
left: ["inset-inline-start"],
|
|
666
|
+
right: ["inset-inline-end"],
|
|
667
|
+
start: ["inset-inline-start"],
|
|
668
|
+
end: ["inset-inline-end"],
|
|
669
|
+
"inset-s": ["inset-inline-start"],
|
|
670
|
+
"inset-e": ["inset-inline-end"],
|
|
671
|
+
"inset-bs": ["inset-block-start"],
|
|
672
|
+
"inset-be": ["inset-block-end"]
|
|
673
|
+
});
|
|
674
|
+
var SCROLL_MARGIN_MAP = Object.freeze({
|
|
675
|
+
"scroll-m": ["scroll-margin"],
|
|
676
|
+
"scroll-mx": ["scroll-margin-inline"],
|
|
677
|
+
"scroll-my": ["scroll-margin-block"],
|
|
678
|
+
"scroll-mt": ["scroll-margin-block-start"],
|
|
679
|
+
"scroll-mb": ["scroll-margin-block-end"],
|
|
680
|
+
"scroll-ml": ["scroll-margin-inline-start"],
|
|
681
|
+
"scroll-mr": ["scroll-margin-inline-end"],
|
|
682
|
+
"scroll-ms": ["scroll-margin-inline-start"],
|
|
683
|
+
"scroll-me": ["scroll-margin-inline-end"],
|
|
684
|
+
"scroll-mbs": ["scroll-margin-block-start"],
|
|
685
|
+
"scroll-mbe": ["scroll-margin-block-end"]
|
|
686
|
+
});
|
|
687
|
+
var SCROLL_PADDING_MAP = Object.freeze({
|
|
688
|
+
"scroll-p": ["scroll-padding"],
|
|
689
|
+
"scroll-px": ["scroll-padding-inline"],
|
|
690
|
+
"scroll-py": ["scroll-padding-block"],
|
|
691
|
+
"scroll-pt": ["scroll-padding-block-start"],
|
|
692
|
+
"scroll-pb": ["scroll-padding-block-end"],
|
|
693
|
+
"scroll-pl": ["scroll-padding-inline-start"],
|
|
694
|
+
"scroll-pr": ["scroll-padding-inline-end"],
|
|
695
|
+
"scroll-ps": ["scroll-padding-inline-start"],
|
|
696
|
+
"scroll-pe": ["scroll-padding-inline-end"],
|
|
697
|
+
"scroll-pbs": ["scroll-padding-block-start"],
|
|
698
|
+
"scroll-pbe": ["scroll-padding-block-end"]
|
|
699
|
+
});
|
|
700
|
+
var BORDER_DIR_PROPS = Object.freeze({
|
|
701
|
+
"border-t": ["border-block-start-width"],
|
|
702
|
+
"border-b": ["border-block-end-width"],
|
|
703
|
+
"border-l": ["border-inline-start-width"],
|
|
704
|
+
"border-r": ["border-inline-end-width"],
|
|
705
|
+
"border-s": ["border-inline-start-width"],
|
|
706
|
+
"border-e": ["border-inline-end-width"],
|
|
707
|
+
"border-bs": ["border-block-start-width"],
|
|
708
|
+
"border-be": ["border-block-end-width"],
|
|
709
|
+
"border-x": ["border-inline-width"],
|
|
710
|
+
"border-y": ["border-block-width"]
|
|
711
|
+
});
|
|
628
712
|
var BUILTIN_STATIC_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
629
713
|
// Grow/shrink
|
|
630
714
|
grow: ["flex-grow"],
|
|
@@ -680,17 +764,9 @@ var BUILTIN_STATIC_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
680
764
|
"scale-none": ["scale"],
|
|
681
765
|
// Perspective
|
|
682
766
|
"perspective-none": ["perspective"],
|
|
683
|
-
// Border width (static, directional — per-side logical props
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
"border-l": ["border-inline-start-width"],
|
|
687
|
-
"border-r": ["border-inline-end-width"],
|
|
688
|
-
"border-s": ["border-inline-start-width"],
|
|
689
|
-
"border-e": ["border-inline-end-width"],
|
|
690
|
-
"border-bs": ["border-block-start-width"],
|
|
691
|
-
"border-be": ["border-block-end-width"],
|
|
692
|
-
"border-x": ["border-inline-width"],
|
|
693
|
-
"border-y": ["border-block-width"],
|
|
767
|
+
// Border width (static, directional — per-side logical props; the bare
|
|
768
|
+
// static forms claim the same properties as the dynamic prefix entries)
|
|
769
|
+
...BORDER_DIR_PROPS,
|
|
694
770
|
// Border collapse
|
|
695
771
|
"border-collapse": ["border-collapse"],
|
|
696
772
|
"border-separate": ["border-collapse"],
|
|
@@ -1448,82 +1524,26 @@ addAll(
|
|
|
1448
1524
|
],
|
|
1449
1525
|
["mix-blend-mode"]
|
|
1450
1526
|
);
|
|
1527
|
+
var FLUID_EXCLUDED_PREFIXES = /* @__PURE__ */ new Set(["inset-s", "inset-e", "inset-bs", "inset-be"]);
|
|
1528
|
+
var FLUID_SPACING_PROPS = (() => {
|
|
1529
|
+
const rows = {};
|
|
1530
|
+
for (const map of [PADDING_MAP, MARGIN_MAP, GAP_MAP, INSET_MAP]) {
|
|
1531
|
+
for (const [prefix, props] of Object.entries(map)) {
|
|
1532
|
+
if (FLUID_EXCLUDED_PREFIXES.has(prefix)) continue;
|
|
1533
|
+
rows[`${prefix}-fluid`] = props;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return Object.freeze(rows);
|
|
1537
|
+
})();
|
|
1451
1538
|
var PREFIX_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1452
|
-
// Spacing
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
pb: ["padding-block-end"],
|
|
1458
|
-
pl: ["padding-inline-start"],
|
|
1459
|
-
pr: ["padding-inline-end"],
|
|
1460
|
-
ps: ["padding-inline-start"],
|
|
1461
|
-
pe: ["padding-inline-end"],
|
|
1462
|
-
pbs: ["padding-block-start"],
|
|
1463
|
-
pbe: ["padding-block-end"],
|
|
1464
|
-
m: ["margin"],
|
|
1465
|
-
mx: ["margin-inline"],
|
|
1466
|
-
my: ["margin-block"],
|
|
1467
|
-
mt: ["margin-block-start"],
|
|
1468
|
-
mb: ["margin-block-end"],
|
|
1469
|
-
ml: ["margin-inline-start"],
|
|
1470
|
-
mr: ["margin-inline-end"],
|
|
1471
|
-
ms: ["margin-inline-start"],
|
|
1472
|
-
me: ["margin-inline-end"],
|
|
1473
|
-
mbs: ["margin-block-start"],
|
|
1474
|
-
mbe: ["margin-block-end"],
|
|
1475
|
-
gap: ["gap"],
|
|
1476
|
-
"gap-x": ["column-gap"],
|
|
1477
|
-
"gap-y": ["row-gap"],
|
|
1478
|
-
"p-fluid": ["padding"],
|
|
1479
|
-
"px-fluid": ["padding-inline"],
|
|
1480
|
-
"py-fluid": ["padding-block"],
|
|
1481
|
-
"pt-fluid": ["padding-block-start"],
|
|
1482
|
-
"pb-fluid": ["padding-block-end"],
|
|
1483
|
-
"pl-fluid": ["padding-inline-start"],
|
|
1484
|
-
"pr-fluid": ["padding-inline-end"],
|
|
1485
|
-
"ps-fluid": ["padding-inline-start"],
|
|
1486
|
-
"pe-fluid": ["padding-inline-end"],
|
|
1487
|
-
"pbs-fluid": ["padding-block-start"],
|
|
1488
|
-
"pbe-fluid": ["padding-block-end"],
|
|
1489
|
-
"m-fluid": ["margin"],
|
|
1490
|
-
"mx-fluid": ["margin-inline"],
|
|
1491
|
-
"my-fluid": ["margin-block"],
|
|
1492
|
-
"mt-fluid": ["margin-block-start"],
|
|
1493
|
-
"mb-fluid": ["margin-block-end"],
|
|
1494
|
-
"ml-fluid": ["margin-inline-start"],
|
|
1495
|
-
"mr-fluid": ["margin-inline-end"],
|
|
1496
|
-
"ms-fluid": ["margin-inline-start"],
|
|
1497
|
-
"me-fluid": ["margin-inline-end"],
|
|
1498
|
-
"mbs-fluid": ["margin-block-start"],
|
|
1499
|
-
"mbe-fluid": ["margin-block-end"],
|
|
1500
|
-
"gap-fluid": ["gap"],
|
|
1501
|
-
"gap-x-fluid": ["column-gap"],
|
|
1502
|
-
"gap-y-fluid": ["row-gap"],
|
|
1503
|
-
"inset-fluid": ["inset"],
|
|
1504
|
-
"inset-x-fluid": ["inset-inline"],
|
|
1505
|
-
"inset-y-fluid": ["inset-block"],
|
|
1506
|
-
"top-fluid": ["inset-block-start"],
|
|
1507
|
-
"bottom-fluid": ["inset-block-end"],
|
|
1508
|
-
"left-fluid": ["inset-inline-start"],
|
|
1509
|
-
"right-fluid": ["inset-inline-end"],
|
|
1510
|
-
"start-fluid": ["inset-inline-start"],
|
|
1511
|
-
"end-fluid": ["inset-inline-end"],
|
|
1539
|
+
// Spacing (family maps shared with utilities/spacing.ts — see header above)
|
|
1540
|
+
...PADDING_MAP,
|
|
1541
|
+
...MARGIN_MAP,
|
|
1542
|
+
...GAP_MAP,
|
|
1543
|
+
...FLUID_SPACING_PROPS,
|
|
1512
1544
|
"space-x": ["~space:margin-inline-start", "~space:margin-inline-end"],
|
|
1513
1545
|
"space-y": ["~space:margin-block-start", "~space:margin-block-end"],
|
|
1514
|
-
|
|
1515
|
-
"inset-x": ["inset-inline"],
|
|
1516
|
-
"inset-y": ["inset-block"],
|
|
1517
|
-
"inset-s": ["inset-inline-start"],
|
|
1518
|
-
"inset-e": ["inset-inline-end"],
|
|
1519
|
-
"inset-bs": ["inset-block-start"],
|
|
1520
|
-
"inset-be": ["inset-block-end"],
|
|
1521
|
-
top: ["inset-block-start"],
|
|
1522
|
-
bottom: ["inset-block-end"],
|
|
1523
|
-
left: ["inset-inline-start"],
|
|
1524
|
-
right: ["inset-inline-end"],
|
|
1525
|
-
start: ["inset-inline-start"],
|
|
1526
|
-
end: ["inset-inline-end"],
|
|
1546
|
+
...INSET_MAP,
|
|
1527
1547
|
// Sizing
|
|
1528
1548
|
w: ["width"],
|
|
1529
1549
|
h: ["height"],
|
|
@@ -1627,16 +1647,7 @@ var PREFIX_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
1627
1647
|
// Borders — these also appear in BUILTIN_STATIC_PROPS for the bare static
|
|
1628
1648
|
// form (e.g. `border-t` → default 1px width). The prefix entries here handle
|
|
1629
1649
|
// the dynamic form (e.g. `border-t-2`, `border-t-red-500`) via resolvePropsWith().
|
|
1630
|
-
|
|
1631
|
-
"border-b": ["border-block-end-width"],
|
|
1632
|
-
"border-l": ["border-inline-start-width"],
|
|
1633
|
-
"border-r": ["border-inline-end-width"],
|
|
1634
|
-
"border-s": ["border-inline-start-width"],
|
|
1635
|
-
"border-e": ["border-inline-end-width"],
|
|
1636
|
-
"border-bs": ["border-block-start-width"],
|
|
1637
|
-
"border-be": ["border-block-end-width"],
|
|
1638
|
-
"border-x": ["border-inline-width"],
|
|
1639
|
-
"border-y": ["border-block-width"],
|
|
1650
|
+
...BORDER_DIR_PROPS,
|
|
1640
1651
|
// Table border-spacing — composable: shared border-spacing + per-axis slot var.
|
|
1641
1652
|
"border-spacing": ["border-spacing", "--ri-border-spacing-x", "--ri-border-spacing-y"],
|
|
1642
1653
|
"border-spacing-x": ["border-spacing", "--ri-border-spacing-x"],
|
|
@@ -1701,29 +1712,9 @@ var PREFIX_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
1701
1712
|
"slide-out-to-bottom": ["--ri-exit-translate-y"],
|
|
1702
1713
|
"slide-out-to-left": ["--ri-exit-translate-x"],
|
|
1703
1714
|
"slide-out-to-right": ["--ri-exit-translate-x"],
|
|
1704
|
-
// Scroll margin/padding
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
"scroll-my": ["scroll-margin-block"],
|
|
1708
|
-
"scroll-mt": ["scroll-margin-block-start"],
|
|
1709
|
-
"scroll-mb": ["scroll-margin-block-end"],
|
|
1710
|
-
"scroll-ml": ["scroll-margin-inline-start"],
|
|
1711
|
-
"scroll-mr": ["scroll-margin-inline-end"],
|
|
1712
|
-
"scroll-ms": ["scroll-margin-inline-start"],
|
|
1713
|
-
"scroll-me": ["scroll-margin-inline-end"],
|
|
1714
|
-
"scroll-mbs": ["scroll-margin-block-start"],
|
|
1715
|
-
"scroll-mbe": ["scroll-margin-block-end"],
|
|
1716
|
-
"scroll-p": ["scroll-padding"],
|
|
1717
|
-
"scroll-px": ["scroll-padding-inline"],
|
|
1718
|
-
"scroll-py": ["scroll-padding-block"],
|
|
1719
|
-
"scroll-pt": ["scroll-padding-block-start"],
|
|
1720
|
-
"scroll-pb": ["scroll-padding-block-end"],
|
|
1721
|
-
"scroll-pl": ["scroll-padding-inline-start"],
|
|
1722
|
-
"scroll-pr": ["scroll-padding-inline-end"],
|
|
1723
|
-
"scroll-ps": ["scroll-padding-inline-start"],
|
|
1724
|
-
"scroll-pe": ["scroll-padding-inline-end"],
|
|
1725
|
-
"scroll-pbs": ["scroll-padding-block-start"],
|
|
1726
|
-
"scroll-pbe": ["scroll-padding-block-end"],
|
|
1715
|
+
// Scroll margin/padding (family maps shared with utilities/spacing.ts)
|
|
1716
|
+
...SCROLL_MARGIN_MAP,
|
|
1717
|
+
...SCROLL_PADDING_MAP,
|
|
1727
1718
|
// Backdrop filter — each function gets a unique CSS variable so they coexist
|
|
1728
1719
|
"backdrop-filter": ["backdrop-filter"],
|
|
1729
1720
|
"backdrop-blur": ["--ri-backdrop-blur", "backdrop-filter"],
|
|
@@ -1793,75 +1784,23 @@ var PREFIX_PROPS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
1793
1784
|
"position-area": ["position-area"],
|
|
1794
1785
|
"anchor-scope": ["anchor-scope"]
|
|
1795
1786
|
});
|
|
1796
|
-
var
|
|
1797
|
-
"
|
|
1798
|
-
"border-block-width",
|
|
1799
|
-
"border-block-start-width",
|
|
1800
|
-
"border-block-end-width",
|
|
1801
|
-
"border-inline-start-width",
|
|
1802
|
-
"border-inline-end-width"
|
|
1803
|
-
]);
|
|
1804
|
-
var BORDER_STYLE_LONGHANDS = Object.freeze([
|
|
1805
|
-
"border-inline-style",
|
|
1806
|
-
"border-block-style",
|
|
1807
|
-
"border-block-start-style",
|
|
1808
|
-
"border-block-end-style",
|
|
1809
|
-
"border-inline-start-style",
|
|
1810
|
-
"border-inline-end-style"
|
|
1811
|
-
]);
|
|
1812
|
-
var BORDER_COLOR_LONGHANDS = Object.freeze([
|
|
1813
|
-
"border-inline-color",
|
|
1814
|
-
"border-block-color",
|
|
1815
|
-
"border-block-start-color",
|
|
1816
|
-
"border-block-end-color",
|
|
1817
|
-
"border-inline-start-color",
|
|
1818
|
-
"border-inline-end-color"
|
|
1819
|
-
]);
|
|
1820
|
-
var OVERRIDES = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1821
|
-
padding: [
|
|
1822
|
-
"padding-inline",
|
|
1823
|
-
"padding-block",
|
|
1824
|
-
"padding-block-start",
|
|
1825
|
-
"padding-block-end",
|
|
1826
|
-
"padding-inline-start",
|
|
1827
|
-
"padding-inline-end"
|
|
1828
|
-
],
|
|
1787
|
+
var DIRECT_OVERRIDES = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1788
|
+
padding: ["padding-inline", "padding-block"],
|
|
1829
1789
|
"padding-inline": ["padding-inline-start", "padding-inline-end"],
|
|
1830
1790
|
"padding-block": ["padding-block-start", "padding-block-end"],
|
|
1831
|
-
margin: [
|
|
1832
|
-
"margin-inline",
|
|
1833
|
-
"margin-block",
|
|
1834
|
-
"margin-block-start",
|
|
1835
|
-
"margin-block-end",
|
|
1836
|
-
"margin-inline-start",
|
|
1837
|
-
"margin-inline-end"
|
|
1838
|
-
],
|
|
1791
|
+
margin: ["margin-inline", "margin-block"],
|
|
1839
1792
|
"margin-inline": ["margin-inline-start", "margin-inline-end"],
|
|
1840
1793
|
"margin-block": ["margin-block-start", "margin-block-end"],
|
|
1841
1794
|
gap: ["column-gap", "row-gap"],
|
|
1842
|
-
inset: [
|
|
1843
|
-
"inset-inline",
|
|
1844
|
-
"inset-block",
|
|
1845
|
-
"inset-block-start",
|
|
1846
|
-
"inset-block-end",
|
|
1847
|
-
"inset-inline-start",
|
|
1848
|
-
"inset-inline-end"
|
|
1849
|
-
],
|
|
1795
|
+
inset: ["inset-inline", "inset-block"],
|
|
1850
1796
|
"inset-inline": ["inset-inline-start", "inset-inline-end"],
|
|
1851
1797
|
"inset-block": ["inset-block-start", "inset-block-end"],
|
|
1852
|
-
"border-width":
|
|
1798
|
+
"border-width": ["border-inline-width", "border-block-width"],
|
|
1853
1799
|
"border-inline-width": ["border-inline-start-width", "border-inline-end-width"],
|
|
1854
1800
|
"border-block-width": ["border-block-start-width", "border-block-end-width"],
|
|
1855
1801
|
// Full `border` shorthand ([border:…] arbitrary properties / custom
|
|
1856
|
-
// utilities) —
|
|
1857
|
-
border: [
|
|
1858
|
-
"border-width",
|
|
1859
|
-
"border-style",
|
|
1860
|
-
"border-color",
|
|
1861
|
-
...BORDER_WIDTH_LONGHANDS,
|
|
1862
|
-
...BORDER_STYLE_LONGHANDS,
|
|
1863
|
-
...BORDER_COLOR_LONGHANDS
|
|
1864
|
-
],
|
|
1802
|
+
// utilities) — the closure reaches every width/style/color leaf.
|
|
1803
|
+
border: ["border-width", "border-style", "border-color"],
|
|
1865
1804
|
"border-radius": [
|
|
1866
1805
|
"border-start-start-radius",
|
|
1867
1806
|
"border-start-end-radius",
|
|
@@ -1870,28 +1809,23 @@ var OVERRIDES = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
1870
1809
|
],
|
|
1871
1810
|
overflow: ["overflow-x", "overflow-y"],
|
|
1872
1811
|
"overscroll-behavior": ["overscroll-behavior-x", "overscroll-behavior-y"],
|
|
1873
|
-
"border-color":
|
|
1812
|
+
"border-color": ["border-inline-color", "border-block-color"],
|
|
1874
1813
|
"border-inline-color": ["border-inline-start-color", "border-inline-end-color"],
|
|
1875
1814
|
"border-block-color": ["border-block-start-color", "border-block-end-color"],
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
"
|
|
1880
|
-
"
|
|
1881
|
-
"
|
|
1882
|
-
"
|
|
1883
|
-
"
|
|
1815
|
+
// Unlike width/color, the style intermediates have no OVERRIDES entries of
|
|
1816
|
+
// their own (nothing claims them alone), so this entry stays flat.
|
|
1817
|
+
"border-style": [
|
|
1818
|
+
"border-inline-style",
|
|
1819
|
+
"border-block-style",
|
|
1820
|
+
"border-block-start-style",
|
|
1821
|
+
"border-block-end-style",
|
|
1822
|
+
"border-inline-start-style",
|
|
1823
|
+
"border-inline-end-style"
|
|
1884
1824
|
],
|
|
1825
|
+
"scroll-margin": ["scroll-margin-inline", "scroll-margin-block"],
|
|
1885
1826
|
"scroll-margin-inline": ["scroll-margin-inline-start", "scroll-margin-inline-end"],
|
|
1886
1827
|
"scroll-margin-block": ["scroll-margin-block-start", "scroll-margin-block-end"],
|
|
1887
|
-
"scroll-padding": [
|
|
1888
|
-
"scroll-padding-inline",
|
|
1889
|
-
"scroll-padding-block",
|
|
1890
|
-
"scroll-padding-block-start",
|
|
1891
|
-
"scroll-padding-block-end",
|
|
1892
|
-
"scroll-padding-inline-start",
|
|
1893
|
-
"scroll-padding-inline-end"
|
|
1894
|
-
],
|
|
1828
|
+
"scroll-padding": ["scroll-padding-inline", "scroll-padding-block"],
|
|
1895
1829
|
"scroll-padding-inline": ["scroll-padding-inline-start", "scroll-padding-inline-end"],
|
|
1896
1830
|
"scroll-padding-block": ["scroll-padding-block-start", "scroll-padding-block-end"],
|
|
1897
1831
|
flex: ["flex-grow", "flex-shrink", "flex-basis"],
|
|
@@ -1957,6 +1891,22 @@ var OVERRIDES = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
1957
1891
|
"--ri-backdrop-hue-rotate"
|
|
1958
1892
|
]
|
|
1959
1893
|
});
|
|
1894
|
+
var OVERRIDES = (() => {
|
|
1895
|
+
const closed = /* @__PURE__ */ Object.create(null);
|
|
1896
|
+
for (const key of Object.keys(DIRECT_OVERRIDES)) {
|
|
1897
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1898
|
+
const stack = [...DIRECT_OVERRIDES[key]];
|
|
1899
|
+
while (stack.length > 0) {
|
|
1900
|
+
const prop = stack.pop();
|
|
1901
|
+
if (prop === void 0 || seen.has(prop)) continue;
|
|
1902
|
+
seen.add(prop);
|
|
1903
|
+
const next = DIRECT_OVERRIDES[prop];
|
|
1904
|
+
if (next !== void 0) stack.push(...next);
|
|
1905
|
+
}
|
|
1906
|
+
closed[key] = Object.freeze([...seen]);
|
|
1907
|
+
}
|
|
1908
|
+
return closed;
|
|
1909
|
+
})();
|
|
1960
1910
|
Object.freeze(BUILTIN_STATIC_PROPS);
|
|
1961
1911
|
Object.freeze(PREFIX_PROPS);
|
|
1962
1912
|
Object.freeze(OVERRIDES);
|
|
@@ -2059,16 +2009,6 @@ function buildFirstSegmentMap(prefixes) {
|
|
|
2059
2009
|
var PREFIX_FIRST_SEGMENT_MAP = buildFirstSegmentMap(SORTED_PREFIXES);
|
|
2060
2010
|
|
|
2061
2011
|
// src/brackets.ts
|
|
2062
|
-
function evictLRU(cache, maxSize) {
|
|
2063
|
-
if (cache.size < maxSize) return;
|
|
2064
|
-
const evictCount = maxSize >> 2;
|
|
2065
|
-
let count = 0;
|
|
2066
|
-
for (const key of cache.keys()) {
|
|
2067
|
-
if (count >= evictCount) break;
|
|
2068
|
-
cache.delete(key);
|
|
2069
|
-
count++;
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
2012
|
function scanBracketAware(input, onChar, options) {
|
|
2073
2013
|
const reverse = options?.reverse ?? false;
|
|
2074
2014
|
let depth = 0;
|
|
@@ -2101,7 +2041,7 @@ function scanBracketAware(input, onChar, options) {
|
|
|
2101
2041
|
}
|
|
2102
2042
|
}
|
|
2103
2043
|
|
|
2104
|
-
// src/merge/
|
|
2044
|
+
// src/merge/resolve.ts
|
|
2105
2045
|
var DEFAULT_TEXT_SIZES = [
|
|
2106
2046
|
"xs",
|
|
2107
2047
|
"sm",
|
|
@@ -2152,9 +2092,7 @@ for (const [prefix, sides, end] of MASK_STOP_FAMILIES) {
|
|
|
2152
2092
|
for (const side of sides) positionProps.push(`--ri-mask-${side}-${end}-position`);
|
|
2153
2093
|
Object.freeze(positionProps);
|
|
2154
2094
|
const colorProps = PREFIX_PROPS[prefix];
|
|
2155
|
-
MASK_STOP_DUAL_MODES[prefix] =
|
|
2156
|
-
resolve: (value) => isMaskStopPositionValue(value) ? positionProps : colorProps
|
|
2157
|
-
};
|
|
2095
|
+
MASK_STOP_DUAL_MODES[prefix] = (value) => isMaskStopPositionValue(value) ? positionProps : colorProps;
|
|
2158
2096
|
}
|
|
2159
2097
|
var TEXT_SIZE_PROPS = Object.freeze(["font-size", "line-height"]);
|
|
2160
2098
|
var FONT_FAMILY_PROPS = Object.freeze([
|
|
@@ -2170,78 +2108,55 @@ var OUTLINE_STYLE_PROPS = Object.freeze(["outline-style"]);
|
|
|
2170
2108
|
var DECORATION_COLOR_PROPS = Object.freeze(["text-decoration-color"]);
|
|
2171
2109
|
var RE_SIGNED_INT = /^-?\d+$/;
|
|
2172
2110
|
var RE_UNSIGNED_INT = /^\d+$/;
|
|
2173
|
-
var WS_SPLIT_RE = /\s+/;
|
|
2174
2111
|
function colorOrDefault(prefix, colorProps) {
|
|
2175
2112
|
const defaultProps = PREFIX_PROPS[prefix];
|
|
2176
|
-
return
|
|
2177
|
-
resolve: (value, _textSizes2, _fontFamilies2, colorNames) => isColorValue(value, void 0, colorNames) ? colorProps : defaultProps
|
|
2178
|
-
};
|
|
2113
|
+
return (value, _textSizes2, _fontFamilies2, colorNames) => isColorValue(value, void 0, colorNames) ? colorProps : defaultProps;
|
|
2179
2114
|
}
|
|
2180
2115
|
var DUAL_MODE_PREFIXES = {
|
|
2181
2116
|
...MASK_STOP_DUAL_MODES,
|
|
2182
2117
|
// mask-radial-[<size>] sets the size var; mask-radial-[<value>] is a full image.
|
|
2183
|
-
"mask-radial":
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
const base = stripTextModifier(value);
|
|
2189
|
-
if (textSizes.has(base) || base.startsWith("[") && !isColorValue(base, textSizes, colorNames)) {
|
|
2190
|
-
return TEXT_SIZE_PROPS;
|
|
2191
|
-
}
|
|
2192
|
-
return PREFIX_PROPS.text;
|
|
2118
|
+
"mask-radial": (value) => isMaskRadialSizeValue(value) ? MASK_RADIAL_SIZE_PROPS : PREFIX_PROPS["mask-radial"],
|
|
2119
|
+
text: (value, textSizes, _fontFamilies2, colorNames) => {
|
|
2120
|
+
const base = stripTextModifier(value);
|
|
2121
|
+
if (textSizes.has(base) || base.startsWith("[") && !isColorValue(base, textSizes, colorNames)) {
|
|
2122
|
+
return TEXT_SIZE_PROPS;
|
|
2193
2123
|
}
|
|
2124
|
+
return PREFIX_PROPS.text;
|
|
2194
2125
|
},
|
|
2195
|
-
font: {
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
return PREFIX_PROPS.font;
|
|
2199
|
-
}
|
|
2200
|
-
},
|
|
2201
|
-
border: {
|
|
2202
|
-
resolve: (value, _textSizes2, _fontFamilies2, colorNames) => isColorValue(value, void 0, colorNames) ? BORDER_COLOR_PROPS : PREFIX_PROPS.border
|
|
2126
|
+
font: (value, _textSizes2, fontFamilies) => {
|
|
2127
|
+
if (fontFamilies.has(value) || isFontFamilyValue(value)) return FONT_FAMILY_PROPS;
|
|
2128
|
+
return PREFIX_PROPS.font;
|
|
2203
2129
|
},
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
}
|
|
2130
|
+
border: (value, _textSizes2, _fontFamilies2, colorNames) => isColorValue(value, void 0, colorNames) ? BORDER_COLOR_PROPS : PREFIX_PROPS.border,
|
|
2131
|
+
outline: (value, _textSizes2, _fontFamilies2, colorNames) => {
|
|
2132
|
+
if (isColorValue(value, void 0, colorNames)) return OUTLINE_COLOR_PROPS;
|
|
2133
|
+
if (RE_SIGNED_INT.test(value) || value.startsWith("[") && !isColorValue(value))
|
|
2134
|
+
return PREFIX_PROPS.outline;
|
|
2135
|
+
return OUTLINE_STYLE_PROPS;
|
|
2211
2136
|
},
|
|
2212
|
-
decoration: {
|
|
2213
|
-
|
|
2214
|
-
if (value.startsWith("(length:") || value.startsWith("[length:"))
|
|
2215
|
-
return PREFIX_PROPS.decoration;
|
|
2216
|
-
if (value.startsWith("(")) return DECORATION_COLOR_PROPS;
|
|
2217
|
-
if (RE_UNSIGNED_INT.test(value) || value.startsWith("[") && !isColorValue(value))
|
|
2218
|
-
return PREFIX_PROPS.decoration;
|
|
2219
|
-
if (isColorValue(value, void 0, colorNames)) return DECORATION_COLOR_PROPS;
|
|
2137
|
+
decoration: (value, _textSizes2, _fontFamilies2, colorNames) => {
|
|
2138
|
+
if (value.startsWith("(length:") || value.startsWith("[length:"))
|
|
2220
2139
|
return PREFIX_PROPS.decoration;
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
// so a color-first check would misclassify it) and background-color
|
|
2227
|
-
// for everything else — never the full `background` shorthand.
|
|
2228
|
-
resolve: (value) => isImageValue(value) ? BG_IMAGE_PROPS : PREFIX_PROPS.bg
|
|
2140
|
+
if (value.startsWith("(")) return DECORATION_COLOR_PROPS;
|
|
2141
|
+
if (RE_UNSIGNED_INT.test(value) || value.startsWith("[") && !isColorValue(value))
|
|
2142
|
+
return PREFIX_PROPS.decoration;
|
|
2143
|
+
if (isColorValue(value, void 0, colorNames)) return DECORATION_COLOR_PROPS;
|
|
2144
|
+
return PREFIX_PROPS.decoration;
|
|
2229
2145
|
},
|
|
2146
|
+
// Image-first to mirror colorGenerator's dispatch: the engine emits
|
|
2147
|
+
// background-image for image-shaped values (bg-[url(#x)] contains "#",
|
|
2148
|
+
// so a color-first check would misclassify it) and background-color
|
|
2149
|
+
// for everything else — never the full `background` shorthand.
|
|
2150
|
+
bg: (value) => isImageValue(value) ? BG_IMAGE_PROPS : PREFIX_PROPS.bg,
|
|
2230
2151
|
shadow: colorOrDefault("shadow", Object.freeze(["--ri-shadow-color"])),
|
|
2231
2152
|
"inset-shadow": colorOrDefault("inset-shadow", Object.freeze(["--ri-inset-shadow-color"])),
|
|
2232
2153
|
ring: colorOrDefault("ring", Object.freeze(["--ri-ring-color"])),
|
|
2233
2154
|
"inset-ring": colorOrDefault("inset-ring", Object.freeze(["--ri-inset-ring-color"])),
|
|
2234
2155
|
"text-shadow": colorOrDefault("text-shadow", Object.freeze(["--ri-text-shadow-color"])),
|
|
2235
2156
|
"drop-shadow": colorOrDefault("drop-shadow", Object.freeze(["--ri-drop-shadow-color"])),
|
|
2236
|
-
from:
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
via: {
|
|
2240
|
-
resolve: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["via-position"] : PREFIX_PROPS.via
|
|
2241
|
-
},
|
|
2242
|
-
to: {
|
|
2243
|
-
resolve: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["to-position"] : PREFIX_PROPS.to
|
|
2244
|
-
}
|
|
2157
|
+
from: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["from-position"] : PREFIX_PROPS.from,
|
|
2158
|
+
via: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["via-position"] : PREFIX_PROPS.via,
|
|
2159
|
+
to: (value) => isGradientPositionValue(value) ? PREFIX_PROPS["to-position"] : PREFIX_PROPS.to
|
|
2245
2160
|
};
|
|
2246
2161
|
var DIRECTIONAL_BORDER_COLOR_PROPS = new Map(
|
|
2247
2162
|
[
|
|
@@ -2257,14 +2172,6 @@ var DIRECTIONAL_BORDER_COLOR_PROPS = new Map(
|
|
|
2257
2172
|
"border-y"
|
|
2258
2173
|
].map((prefix) => [prefix, Object.freeze([PREFIX_PROPS[prefix][0].replace("width", "color")])])
|
|
2259
2174
|
);
|
|
2260
|
-
var _customStaticProps = {};
|
|
2261
|
-
var _textSizes = new Set(DEFAULT_TEXT_SIZES);
|
|
2262
|
-
var _fontFamilies = new Set(DEFAULT_FONT_FAMILIES);
|
|
2263
|
-
var _colorNames = /* @__PURE__ */ new Set();
|
|
2264
|
-
var _latestSnapshot = null;
|
|
2265
|
-
var RI_CACHE_MAX = 500;
|
|
2266
|
-
var RI_CACHE_KEY_MAX_LEN = 2048;
|
|
2267
|
-
var _riCache = /* @__PURE__ */ new Map();
|
|
2268
2175
|
function resolvePropsWith(utility, customStaticProps, textSizes, fontFamilies, colorNames) {
|
|
2269
2176
|
if (utility.charCodeAt(0) === 91) {
|
|
2270
2177
|
const colonIdx = utility.indexOf(":");
|
|
@@ -2292,7 +2199,7 @@ function resolvePropsWith(utility, customStaticProps, textSizes, fontFamilies, c
|
|
|
2292
2199
|
const value = exact ? "" : name.slice(prefix.length + 1);
|
|
2293
2200
|
const dualMode = DUAL_MODE_PREFIXES[prefix];
|
|
2294
2201
|
if (dualMode) {
|
|
2295
|
-
return dualMode
|
|
2202
|
+
return dualMode(value, textSizes, fontFamilies, colorNames);
|
|
2296
2203
|
}
|
|
2297
2204
|
const directionalColor = DIRECTIONAL_BORDER_COLOR_PROPS.get(prefix);
|
|
2298
2205
|
if (directionalColor && isColorValue(value, void 0, colorNames)) {
|
|
@@ -2303,9 +2210,91 @@ function resolvePropsWith(utility, customStaticProps, textSizes, fontFamilies, c
|
|
|
2303
2210
|
}
|
|
2304
2211
|
return null;
|
|
2305
2212
|
}
|
|
2213
|
+
|
|
2214
|
+
// src/merge/context.ts
|
|
2215
|
+
var _customStaticProps = {};
|
|
2216
|
+
var _textSizes = new Set(DEFAULT_TEXT_SIZES);
|
|
2217
|
+
var _fontFamilies = new Set(DEFAULT_FONT_FAMILIES);
|
|
2218
|
+
var _colorNames = /* @__PURE__ */ new Set();
|
|
2219
|
+
var _latestSnapshot = null;
|
|
2220
|
+
function hasFinalizedSnapshot() {
|
|
2221
|
+
return _latestSnapshot !== null;
|
|
2222
|
+
}
|
|
2223
|
+
var defaultRiCache = /* @__PURE__ */ new Map();
|
|
2306
2224
|
function resolveProps(utility) {
|
|
2307
2225
|
return resolvePropsWith(utility, _customStaticProps, _textSizes, _fontFamilies, _colorNames);
|
|
2308
2226
|
}
|
|
2227
|
+
function resolverFor(snapshot) {
|
|
2228
|
+
const snap = snapshot ?? _latestSnapshot ?? {
|
|
2229
|
+
customStaticProps: _customStaticProps,
|
|
2230
|
+
textSizes: _textSizes,
|
|
2231
|
+
fontFamilies: _fontFamilies,
|
|
2232
|
+
colorNames: _colorNames
|
|
2233
|
+
};
|
|
2234
|
+
return (utility) => resolvePropsWith(
|
|
2235
|
+
utility,
|
|
2236
|
+
snap.customStaticProps,
|
|
2237
|
+
snap.textSizes,
|
|
2238
|
+
snap.fontFamilies,
|
|
2239
|
+
snap.colorNames
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
function createCompilationContext() {
|
|
2243
|
+
return {
|
|
2244
|
+
customStaticProps: {},
|
|
2245
|
+
textSizes: new Set(DEFAULT_TEXT_SIZES),
|
|
2246
|
+
fontFamilies: new Set(DEFAULT_FONT_FAMILIES),
|
|
2247
|
+
colorNames: /* @__PURE__ */ new Set()
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
function registerCustomUtility(ctx, name, properties) {
|
|
2251
|
+
if (IS_DEV) {
|
|
2252
|
+
if (!name) {
|
|
2253
|
+
devWarn("[RI-1301] registerCustomUtility() called with empty name \u2014 skipping.");
|
|
2254
|
+
return;
|
|
2255
|
+
}
|
|
2256
|
+
if (properties.length === 0) {
|
|
2257
|
+
devWarn(
|
|
2258
|
+
`[RI-1302] registerCustomUtility("${name}") called with no CSS properties \u2014 the utility won't participate in conflict resolution.`
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
ctx.customStaticProps[name] = properties;
|
|
2263
|
+
}
|
|
2264
|
+
function registerCustomTextSizes(ctx, sizes) {
|
|
2265
|
+
for (const s of sizes) ctx.textSizes.add(s);
|
|
2266
|
+
}
|
|
2267
|
+
function registerCustomFontFamilies(ctx, families) {
|
|
2268
|
+
for (const f of families) ctx.fontFamilies.add(f);
|
|
2269
|
+
}
|
|
2270
|
+
function registerColorNames(ctx, names) {
|
|
2271
|
+
for (const n of names) ctx.colorNames.add(n);
|
|
2272
|
+
}
|
|
2273
|
+
function snapshotCompilationContext(ctx) {
|
|
2274
|
+
return {
|
|
2275
|
+
customStaticProps: Object.fromEntries(
|
|
2276
|
+
Object.entries(ctx.customStaticProps).map(([k, v]) => [k, [...v]])
|
|
2277
|
+
),
|
|
2278
|
+
textSizes: new Set(ctx.textSizes),
|
|
2279
|
+
fontFamilies: new Set(ctx.fontFamilies),
|
|
2280
|
+
colorNames: new Set(ctx.colorNames)
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
function finalizeCompilationContext(ctx) {
|
|
2284
|
+
const snapshot = snapshotCompilationContext(ctx);
|
|
2285
|
+
_customStaticProps = snapshot.customStaticProps;
|
|
2286
|
+
_textSizes = snapshot.textSizes;
|
|
2287
|
+
_fontFamilies = snapshot.fontFamilies;
|
|
2288
|
+
_colorNames = snapshot.colorNames;
|
|
2289
|
+
defaultRiCache.clear();
|
|
2290
|
+
_latestSnapshot = snapshot;
|
|
2291
|
+
return snapshot;
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
// src/merge/index.ts
|
|
2295
|
+
var RI_CACHE_MAX = 500;
|
|
2296
|
+
var RI_CACHE_KEY_MAX_LEN = 2048;
|
|
2297
|
+
var WS_SPLIT_RE = /\s+/;
|
|
2309
2298
|
function findVariantSplit(cls) {
|
|
2310
2299
|
if (cls.indexOf(":") === -1) return -1;
|
|
2311
2300
|
let lastColon = -1;
|
|
@@ -2387,6 +2376,16 @@ function mergeUncached(classes, resolve, trace) {
|
|
|
2387
2376
|
result.reverse();
|
|
2388
2377
|
return result.join(" ");
|
|
2389
2378
|
}
|
|
2379
|
+
function evictLRU(cache, maxSize) {
|
|
2380
|
+
if (cache.size < maxSize) return;
|
|
2381
|
+
const evictCount = maxSize >> 2;
|
|
2382
|
+
let count = 0;
|
|
2383
|
+
for (const key of cache.keys()) {
|
|
2384
|
+
if (count >= evictCount) break;
|
|
2385
|
+
cache.delete(key);
|
|
2386
|
+
count++;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2390
2389
|
function lruGet(cache, key) {
|
|
2391
2390
|
const cached = cache.get(key);
|
|
2392
2391
|
if (cached !== void 0) {
|
|
@@ -2442,80 +2441,51 @@ function detectSSR() {
|
|
|
2442
2441
|
return _isSSR;
|
|
2443
2442
|
}
|
|
2444
2443
|
var WARNING_THROTTLE_MS = 6e4;
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
var _totalClassesWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2449
|
-
var _nonStringWarningLastMs = Number.NEGATIVE_INFINITY;
|
|
2450
|
-
function ri(...inputs) {
|
|
2451
|
-
if (detectSSR()) {
|
|
2444
|
+
function throttledWarn(message, emit = console.warn) {
|
|
2445
|
+
let last = Number.NEGATIVE_INFINITY;
|
|
2446
|
+
return (...args) => {
|
|
2452
2447
|
const now = Date.now();
|
|
2453
|
-
if (now -
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
console.warn(
|
|
2457
|
-
"[RI-2004] ri() called in an SSR environment before any compilation has finalized. The default ri() export reads module-level state that has not been initialized. Custom utilities, text sizes, and font families will not be recognized. Use createRi(snapshot) for concurrent-safe class merging. See: https://rainbowindex.dev/docs/ssr"
|
|
2458
|
-
);
|
|
2459
|
-
} else {
|
|
2460
|
-
console.warn(
|
|
2461
|
-
"[RI-2004] The default ri() export uses module-level state and is not safe for concurrent SSR requests. Use createRi(snapshot) for isolation. See: https://rainbowindex.dev/docs/ssr\nThis warning repeats every 60 s until resolved. In production SSR, switch to createRi(snapshot) to prevent silent data corruption between concurrent requests."
|
|
2462
|
-
);
|
|
2463
|
-
}
|
|
2448
|
+
if (now - last >= WARNING_THROTTLE_MS) {
|
|
2449
|
+
last = now;
|
|
2450
|
+
emit(message(...args));
|
|
2464
2451
|
}
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
var warnSSRUsage = throttledWarn(
|
|
2455
|
+
() => !hasFinalizedSnapshot() ? (
|
|
2456
|
+
// No compilation has ever finalized — module-level state is uninitialized
|
|
2457
|
+
// defaults. In SSR this almost certainly means ri() is being called without
|
|
2458
|
+
// a preceding compile pass, which will produce incorrect merge results
|
|
2459
|
+
// for custom utilities, text sizes, and font families.
|
|
2460
|
+
"[RI-2004] ri() called in an SSR environment before any compilation has finalized. The default ri() export reads module-level state that has not been initialized. Custom utilities, text sizes, and font families will not be recognized. Use createRi(snapshot) for concurrent-safe class merging. See: https://rainbowindex.dev/docs/ssr"
|
|
2461
|
+
) : "[RI-2004] The default ri() export uses module-level state and is not safe for concurrent SSR requests. Use createRi(snapshot) for isolation. See: https://rainbowindex.dev/docs/ssr\nThis warning repeats every 60 s until resolved. In production SSR, switch to createRi(snapshot) to prevent silent data corruption between concurrent requests."
|
|
2462
|
+
);
|
|
2463
|
+
var warnFlattenDepth = throttledWarn(
|
|
2464
|
+
() => `[RI-2011] ri() input nesting exceeds maximum depth of ${MAX_FLATTEN_DEPTH}. Deeply nested inputs are silently dropped. Flatten your class arrays to avoid this limit.`
|
|
2465
|
+
);
|
|
2466
|
+
var warnTotalClasses = throttledWarn(
|
|
2467
|
+
() => `[RI-2012] ri() input exceeds ${MAX_TOTAL_CLASSES} class limit. Excess classes are dropped to prevent memory exhaustion.`
|
|
2468
|
+
);
|
|
2469
|
+
var warnClassLength = throttledWarn(
|
|
2470
|
+
(cls) => `[RI-2006] Class name exceeds ${MAX_CLASS_NAME_LENGTH} character limit and was dropped: "${cls.slice(0, 40)}\u2026". This is a safety guard against adversarial input in SSR. If this is intentional, shorten the class name.`
|
|
2471
|
+
);
|
|
2472
|
+
var warnNonStringInput = throttledWarn(
|
|
2473
|
+
(input) => `ri() inputs must be strings, arrays, or falsy \u2014 got ${typeof input}; value skipped. Object syntax ({ class: condition }) is not supported; use \`condition && "class"\` instead.`,
|
|
2474
|
+
devWarn
|
|
2475
|
+
);
|
|
2476
|
+
function ri(...inputs) {
|
|
2477
|
+
if (detectSSR()) {
|
|
2478
|
+
warnSSRUsage();
|
|
2465
2479
|
}
|
|
2466
|
-
return mergeFrom(inputs, resolveProps,
|
|
2480
|
+
return mergeFrom(inputs, resolveProps, defaultRiCache);
|
|
2467
2481
|
}
|
|
2468
2482
|
function createRi(snapshot) {
|
|
2469
|
-
const
|
|
2470
|
-
customStaticProps: _customStaticProps,
|
|
2471
|
-
textSizes: _textSizes,
|
|
2472
|
-
fontFamilies: _fontFamilies,
|
|
2473
|
-
colorNames: _colorNames
|
|
2474
|
-
};
|
|
2483
|
+
const resolve = resolverFor(snapshot);
|
|
2475
2484
|
const cache = /* @__PURE__ */ new Map();
|
|
2476
|
-
const resolve = (utility) => resolvePropsWith(
|
|
2477
|
-
utility,
|
|
2478
|
-
snap.customStaticProps,
|
|
2479
|
-
snap.textSizes,
|
|
2480
|
-
snap.fontFamilies,
|
|
2481
|
-
snap.colorNames
|
|
2482
|
-
);
|
|
2483
2485
|
return function boundRi(...inputs) {
|
|
2484
2486
|
return mergeFrom(inputs, resolve, cache);
|
|
2485
2487
|
};
|
|
2486
2488
|
}
|
|
2487
|
-
function analyzeMerge(classes, snapshot) {
|
|
2488
|
-
const snap = snapshot ?? _latestSnapshot ?? {
|
|
2489
|
-
customStaticProps: _customStaticProps,
|
|
2490
|
-
textSizes: _textSizes,
|
|
2491
|
-
fontFamilies: _fontFamilies,
|
|
2492
|
-
colorNames: _colorNames
|
|
2493
|
-
};
|
|
2494
|
-
const resolve = (utility) => resolvePropsWith(
|
|
2495
|
-
utility,
|
|
2496
|
-
snap.customStaticProps,
|
|
2497
|
-
snap.textSizes,
|
|
2498
|
-
snap.fontFamilies,
|
|
2499
|
-
snap.colorNames
|
|
2500
|
-
);
|
|
2501
|
-
const trace = { claimers: /* @__PURE__ */ new Map(), dropped: [] };
|
|
2502
|
-
const output = mergeUncached(classes, resolve, trace);
|
|
2503
|
-
trace.dropped.sort((a, b) => a.index - b.index);
|
|
2504
|
-
const droppedIndexes = new Set(trace.dropped.map((d) => d.index));
|
|
2505
|
-
const kept = [];
|
|
2506
|
-
for (let i = 0; i < classes.length; i++) {
|
|
2507
|
-
if (!droppedIndexes.has(i)) kept.push(i);
|
|
2508
|
-
}
|
|
2509
|
-
return {
|
|
2510
|
-
output,
|
|
2511
|
-
kept,
|
|
2512
|
-
dropped: trace.dropped.map((d) => ({
|
|
2513
|
-
index: d.index,
|
|
2514
|
-
className: classes[d.index],
|
|
2515
|
-
overriddenBy: d.overriddenBy
|
|
2516
|
-
}))
|
|
2517
|
-
};
|
|
2518
|
-
}
|
|
2519
2489
|
var MAX_FLATTEN_DEPTH = 10;
|
|
2520
2490
|
var MAX_CLASS_NAME_LENGTH = 500;
|
|
2521
2491
|
var MAX_TOTAL_CLASSES = 1e4;
|
|
@@ -2533,50 +2503,26 @@ function flattenInputs(inputs) {
|
|
|
2533
2503
|
if (!input) continue;
|
|
2534
2504
|
if (Array.isArray(input)) {
|
|
2535
2505
|
if (depth + 1 > MAX_FLATTEN_DEPTH) {
|
|
2536
|
-
|
|
2537
|
-
if (now - _depthWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2538
|
-
_depthWarningLastMs = now;
|
|
2539
|
-
console.warn(
|
|
2540
|
-
`[RI-2011] ri() input nesting exceeds maximum depth of ${MAX_FLATTEN_DEPTH}. Deeply nested inputs are silently dropped. Flatten your class arrays to avoid this limit.`
|
|
2541
|
-
);
|
|
2542
|
-
}
|
|
2506
|
+
warnFlattenDepth();
|
|
2543
2507
|
continue;
|
|
2544
2508
|
}
|
|
2545
2509
|
stack.push([input, 0, depth + 1]);
|
|
2546
2510
|
} else if (typeof input !== "string") {
|
|
2547
2511
|
if (IS_DEV) {
|
|
2548
|
-
|
|
2549
|
-
if (now - _nonStringWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2550
|
-
_nonStringWarningLastMs = now;
|
|
2551
|
-
devWarn(
|
|
2552
|
-
`ri() inputs must be strings, arrays, or falsy \u2014 got ${typeof input}; value skipped. Object syntax ({ class: condition }) is not supported; use \`condition && "class"\` instead.`
|
|
2553
|
-
);
|
|
2554
|
-
}
|
|
2512
|
+
warnNonStringInput(input);
|
|
2555
2513
|
}
|
|
2556
2514
|
} else {
|
|
2557
2515
|
const trimmed = input.trim();
|
|
2558
2516
|
if (trimmed) {
|
|
2559
2517
|
for (const cls of splitBracketAware(trimmed)) {
|
|
2560
2518
|
if (result.length >= MAX_TOTAL_CLASSES) {
|
|
2561
|
-
|
|
2562
|
-
if (now - _totalClassesWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2563
|
-
_totalClassesWarningLastMs = now;
|
|
2564
|
-
console.warn(
|
|
2565
|
-
`[RI-2012] ri() input exceeds ${MAX_TOTAL_CLASSES} class limit. Excess classes are dropped to prevent memory exhaustion.`
|
|
2566
|
-
);
|
|
2567
|
-
}
|
|
2519
|
+
warnTotalClasses();
|
|
2568
2520
|
return result;
|
|
2569
2521
|
}
|
|
2570
2522
|
if (cls.length <= MAX_CLASS_NAME_LENGTH) {
|
|
2571
2523
|
result.push(cls);
|
|
2572
2524
|
} else {
|
|
2573
|
-
|
|
2574
|
-
if (now - _classLenWarningLastMs >= WARNING_THROTTLE_MS) {
|
|
2575
|
-
_classLenWarningLastMs = now;
|
|
2576
|
-
console.warn(
|
|
2577
|
-
`[RI-2006] Class name exceeds ${MAX_CLASS_NAME_LENGTH} character limit and was dropped: "${cls.slice(0, 40)}\u2026". This is a safety guard against adversarial input in SSR. If this is intentional, shorten the class name.`
|
|
2578
|
-
);
|
|
2579
|
-
}
|
|
2525
|
+
warnClassLength(cls);
|
|
2580
2526
|
}
|
|
2581
2527
|
}
|
|
2582
2528
|
}
|
|
@@ -2617,57 +2563,6 @@ function splitBracketAware(input) {
|
|
|
2617
2563
|
if (tokenStart !== -1) result.push(input.slice(tokenStart));
|
|
2618
2564
|
return result;
|
|
2619
2565
|
}
|
|
2620
|
-
function createCompilationContext() {
|
|
2621
|
-
return {
|
|
2622
|
-
customStaticProps: {},
|
|
2623
|
-
textSizes: new Set(DEFAULT_TEXT_SIZES),
|
|
2624
|
-
fontFamilies: new Set(DEFAULT_FONT_FAMILIES),
|
|
2625
|
-
colorNames: /* @__PURE__ */ new Set()
|
|
2626
|
-
};
|
|
2627
|
-
}
|
|
2628
|
-
function registerCustomUtility(ctx, name, properties) {
|
|
2629
|
-
if (IS_DEV) {
|
|
2630
|
-
if (!name) {
|
|
2631
|
-
devWarn("[RI-1301] registerCustomUtility() called with empty name \u2014 skipping.");
|
|
2632
|
-
return;
|
|
2633
|
-
}
|
|
2634
|
-
if (properties.length === 0) {
|
|
2635
|
-
devWarn(
|
|
2636
|
-
`[RI-1302] registerCustomUtility("${name}") called with no CSS properties \u2014 the utility won't participate in conflict resolution.`
|
|
2637
|
-
);
|
|
2638
|
-
}
|
|
2639
|
-
}
|
|
2640
|
-
ctx.customStaticProps[name] = properties;
|
|
2641
|
-
}
|
|
2642
|
-
function registerCustomTextSizes(ctx, sizes) {
|
|
2643
|
-
for (const s of sizes) ctx.textSizes.add(s);
|
|
2644
|
-
}
|
|
2645
|
-
function registerCustomFontFamilies(ctx, families) {
|
|
2646
|
-
for (const f of families) ctx.fontFamilies.add(f);
|
|
2647
|
-
}
|
|
2648
|
-
function registerColorNames(ctx, names) {
|
|
2649
|
-
for (const n of names) ctx.colorNames.add(n);
|
|
2650
|
-
}
|
|
2651
|
-
function snapshotCompilationContext(ctx) {
|
|
2652
|
-
return {
|
|
2653
|
-
customStaticProps: Object.fromEntries(
|
|
2654
|
-
Object.entries(ctx.customStaticProps).map(([k, v]) => [k, [...v]])
|
|
2655
|
-
),
|
|
2656
|
-
textSizes: new Set(ctx.textSizes),
|
|
2657
|
-
fontFamilies: new Set(ctx.fontFamilies),
|
|
2658
|
-
colorNames: new Set(ctx.colorNames)
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
function finalizeCompilationContext(ctx) {
|
|
2662
|
-
const snapshot = snapshotCompilationContext(ctx);
|
|
2663
|
-
_customStaticProps = snapshot.customStaticProps;
|
|
2664
|
-
_textSizes = snapshot.textSizes;
|
|
2665
|
-
_fontFamilies = snapshot.fontFamilies;
|
|
2666
|
-
_colorNames = snapshot.colorNames;
|
|
2667
|
-
_riCache.clear();
|
|
2668
|
-
_latestSnapshot = snapshot;
|
|
2669
|
-
return snapshot;
|
|
2670
|
-
}
|
|
2671
2566
|
|
|
2672
2567
|
export {
|
|
2673
2568
|
isValidColorSuffix,
|
|
@@ -2698,6 +2593,13 @@ export {
|
|
|
2698
2593
|
DEFAULT_TRACKING,
|
|
2699
2594
|
DEFAULT_LEADING,
|
|
2700
2595
|
defaultTheme,
|
|
2596
|
+
PADDING_MAP,
|
|
2597
|
+
MARGIN_MAP,
|
|
2598
|
+
GAP_MAP,
|
|
2599
|
+
INSET_MAP,
|
|
2600
|
+
SCROLL_MARGIN_MAP,
|
|
2601
|
+
SCROLL_PADDING_MAP,
|
|
2602
|
+
BORDER_DIR_PROPS,
|
|
2701
2603
|
COLOR_FUNCTION_ALTERNATION,
|
|
2702
2604
|
SPECIAL_COLORS,
|
|
2703
2605
|
isMaskRadialSizeValue,
|
|
@@ -2709,14 +2611,15 @@ export {
|
|
|
2709
2611
|
IS_DEV,
|
|
2710
2612
|
devWarn,
|
|
2711
2613
|
DEFAULT_TEXT_SIZES,
|
|
2712
|
-
|
|
2713
|
-
createRi,
|
|
2714
|
-
analyzeMerge,
|
|
2614
|
+
resolverFor,
|
|
2715
2615
|
createCompilationContext,
|
|
2716
2616
|
registerCustomUtility,
|
|
2717
2617
|
registerCustomTextSizes,
|
|
2718
2618
|
registerCustomFontFamilies,
|
|
2719
2619
|
registerColorNames,
|
|
2720
2620
|
snapshotCompilationContext,
|
|
2721
|
-
finalizeCompilationContext
|
|
2621
|
+
finalizeCompilationContext,
|
|
2622
|
+
mergeUncached,
|
|
2623
|
+
ri,
|
|
2624
|
+
createRi
|
|
2722
2625
|
};
|