windrunner 1.1.1 → 1.1.3
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/README.md +2 -2
- package/dist/index.d.ts +254 -9
- package/dist/index.esm.js +465 -498
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +467 -498
- package/dist/index.js.map +7 -0
- package/dist/index.min.js +4 -3
- package/dist/react.d.ts +69 -0
- package/dist/react.esm.js +4170 -0
- package/dist/react.esm.js.map +7 -0
- package/dist/react.js +4199 -0
- package/dist/react.js.map +7 -0
- package/package.json +13 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
// src/variants.js
|
|
2
|
-
var variants = {
|
|
3
|
-
accentColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
4
|
-
accessibility: ["hover", "focus"],
|
|
5
|
-
aspect: ["hover", "focus"],
|
|
6
|
-
backgroundColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
7
|
-
blur: ["hover", "focus"],
|
|
8
|
-
borderColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
9
|
-
boxShadow: ["hover", "focus"],
|
|
10
|
-
brightness: ["hover", "focus"],
|
|
11
|
-
caretColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
12
|
-
contrast: ["hover", "focus"],
|
|
13
|
-
dropShadow: ["hover", "focus"],
|
|
14
|
-
fill: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
15
|
-
flexBasis: ["hover", "focus"],
|
|
16
|
-
gradientColorStops: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
17
|
-
grayscale: ["hover", "focus"],
|
|
18
|
-
hueRotate: ["hover", "focus"],
|
|
19
|
-
insetRing: ["hover", "focus"],
|
|
20
|
-
insetShadow: ["hover", "focus"],
|
|
21
|
-
invert: ["hover", "focus"],
|
|
22
|
-
opacity: ["hover", "focus"],
|
|
23
|
-
outlineColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
24
|
-
outlineOffset: ["hover", "focus"],
|
|
25
|
-
outlineStyle: ["hover", "focus"],
|
|
26
|
-
outlineWidth: ["hover", "focus"],
|
|
27
|
-
placeholderColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
28
|
-
ringColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
29
|
-
ringOffsetColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
30
|
-
ringOffsetWidth: ["hover", "focus"],
|
|
31
|
-
ringWidth: ["hover", "focus"],
|
|
32
|
-
rotate: ["hover", "focus"],
|
|
33
|
-
saturate: ["hover", "focus"],
|
|
34
|
-
scale: ["hover", "focus"],
|
|
35
|
-
sepia: ["hover", "focus"],
|
|
36
|
-
skew: ["hover", "focus"],
|
|
37
|
-
stroke: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
38
|
-
strokeWidth: ["hover", "focus"],
|
|
39
|
-
textColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
40
|
-
textDecoration: ["focus", "hover"],
|
|
41
|
-
textDecorationColor: ["focus", "hover", "not-hover", "not-focus", "not-disabled"],
|
|
42
|
-
textDecorationStyle: ["focus", "hover"],
|
|
43
|
-
textDecorationThickness: ["focus", "hover"],
|
|
44
|
-
textShadowBlur: ["hover", "focus"],
|
|
45
|
-
textShadowColor: ["hover", "focus", "not-hover", "not-focus", "not-disabled"],
|
|
46
|
-
textShadowOpacity: ["hover", "focus"],
|
|
47
|
-
textShadowX: ["hover", "focus"],
|
|
48
|
-
textShadowY: ["hover", "focus"],
|
|
49
|
-
touchAction: ["hover", "focus"],
|
|
50
|
-
mask: ["hover", "focus"],
|
|
51
|
-
transform3d: ["hover", "focus"],
|
|
52
|
-
translate: ["hover", "focus"],
|
|
53
|
-
zIndex: ["hover", "focus"]
|
|
54
|
-
};
|
|
55
|
-
var variants_default = variants;
|
|
56
|
-
|
|
57
1
|
// src/theme.js
|
|
58
2
|
var theme = {
|
|
59
3
|
accentColor: ({ theme: theme2 }) => ({
|
|
@@ -1401,7 +1345,6 @@ var vars_default = vars;
|
|
|
1401
1345
|
|
|
1402
1346
|
// src/config.js
|
|
1403
1347
|
var configOptions = {
|
|
1404
|
-
variants: variants_default,
|
|
1405
1348
|
theme: theme_default,
|
|
1406
1349
|
vars: vars_default
|
|
1407
1350
|
};
|
|
@@ -1411,29 +1354,70 @@ var config_default = configOptions;
|
|
|
1411
1354
|
function isFunction(fn) {
|
|
1412
1355
|
return fn && {}.toString.call(fn) === "[object Function]";
|
|
1413
1356
|
}
|
|
1357
|
+
var configCache = /* @__PURE__ */ new WeakMap();
|
|
1358
|
+
var defaultContextCache = null;
|
|
1359
|
+
function createLazyTheme(userTheme = {}, userThemeExtend = {}) {
|
|
1360
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
1361
|
+
const defaultTheme = config_default.theme;
|
|
1362
|
+
return new Proxy({}, {
|
|
1363
|
+
get(_, key) {
|
|
1364
|
+
if (resolved.has(key)) {
|
|
1365
|
+
return resolved.get(key);
|
|
1366
|
+
}
|
|
1367
|
+
let value = Object.prototype.hasOwnProperty.call(userTheme, key) ? userTheme[key] : defaultTheme[key];
|
|
1368
|
+
if (isFunction(value)) {
|
|
1369
|
+
value = value({
|
|
1370
|
+
theme: (keyRef) => {
|
|
1371
|
+
if (resolved.has(keyRef)) return resolved.get(keyRef);
|
|
1372
|
+
return createLazyTheme(userTheme, userThemeExtend)[keyRef];
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
if (userThemeExtend[key]) {
|
|
1377
|
+
value = Object.assign({}, value, userThemeExtend[key]);
|
|
1378
|
+
}
|
|
1379
|
+
resolved.set(key, value);
|
|
1380
|
+
return value;
|
|
1381
|
+
},
|
|
1382
|
+
has(_, key) {
|
|
1383
|
+
return key in defaultTheme || key in userTheme;
|
|
1384
|
+
},
|
|
1385
|
+
ownKeys(_) {
|
|
1386
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(defaultTheme), ...Object.keys(userTheme)])];
|
|
1387
|
+
},
|
|
1388
|
+
getOwnPropertyDescriptor(_, key) {
|
|
1389
|
+
if (key in defaultTheme || key in userTheme) {
|
|
1390
|
+
return {
|
|
1391
|
+
enumerable: true,
|
|
1392
|
+
configurable: true
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1414
1398
|
function getConfigOptions(options = {}, pluginKeys = []) {
|
|
1399
|
+
if (!options || typeof options === "object" && Object.keys(options).length === 0) {
|
|
1400
|
+
if (!defaultContextCache) {
|
|
1401
|
+
defaultContextCache = {
|
|
1402
|
+
...config_default,
|
|
1403
|
+
theme: createLazyTheme({}, {})
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
return defaultContextCache;
|
|
1407
|
+
}
|
|
1408
|
+
if (configCache.has(options)) {
|
|
1409
|
+
return configCache.get(options);
|
|
1410
|
+
}
|
|
1415
1411
|
const { theme: theme2 = {} } = options;
|
|
1416
1412
|
const { extend: themeExtend = {} } = theme2;
|
|
1417
|
-
const
|
|
1418
|
-
const
|
|
1419
|
-
themeKeys.forEach((key) => {
|
|
1420
|
-
newTheme[key] = Object.prototype.hasOwnProperty.call(theme2, key) ? theme2[key] : config_default.theme[key];
|
|
1421
|
-
});
|
|
1422
|
-
themeKeys.forEach((key) => {
|
|
1423
|
-
if (isFunction(newTheme[key])) {
|
|
1424
|
-
newTheme[key] = newTheme[key]({
|
|
1425
|
-
theme: (keyRef) => newTheme[keyRef]
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
if (themeExtend[key]) {
|
|
1429
|
-
newTheme[key] = Object.assign({}, newTheme[key], themeExtend[key]);
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
return {
|
|
1413
|
+
const lazyTheme = createLazyTheme(theme2, themeExtend);
|
|
1414
|
+
const config = {
|
|
1433
1415
|
...config_default,
|
|
1434
1416
|
...options,
|
|
1435
|
-
theme:
|
|
1417
|
+
theme: lazyTheme
|
|
1436
1418
|
};
|
|
1419
|
+
configCache.set(options, config);
|
|
1420
|
+
return config;
|
|
1437
1421
|
}
|
|
1438
1422
|
|
|
1439
1423
|
// src/constants.js
|
|
@@ -1517,112 +1501,93 @@ function escapeCssIdentifier(value) {
|
|
|
1517
1501
|
}
|
|
1518
1502
|
function appendImportant(declaration, isImportant) {
|
|
1519
1503
|
if (!isImportant) return declaration;
|
|
1520
|
-
|
|
1521
|
-
|
|
1504
|
+
return declaration.replace(/([^;{}]+);/g, (match, decl) => {
|
|
1505
|
+
const trimmed = decl.trim();
|
|
1506
|
+
if (!trimmed || trimmed.includes("!important")) return match;
|
|
1507
|
+
return `${trimmed} !important;`;
|
|
1508
|
+
});
|
|
1522
1509
|
}
|
|
1523
1510
|
function splitByVariantDelimiter(token) {
|
|
1524
1511
|
const parts = [];
|
|
1525
|
-
let
|
|
1512
|
+
let start = 0;
|
|
1526
1513
|
let bracketDepth = 0;
|
|
1527
1514
|
for (let i = 0; i < token.length; i += 1) {
|
|
1528
1515
|
const char = token[i];
|
|
1529
|
-
if (char === "[")
|
|
1530
|
-
|
|
1531
|
-
if (char === "
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1516
|
+
if (char === "[") {
|
|
1517
|
+
bracketDepth += 1;
|
|
1518
|
+
} else if (char === "]") {
|
|
1519
|
+
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
1520
|
+
} else if (char === ":" && bracketDepth === 0) {
|
|
1521
|
+
parts.push(token.slice(start, i));
|
|
1522
|
+
start = i + 1;
|
|
1536
1523
|
}
|
|
1537
1524
|
}
|
|
1538
|
-
|
|
1525
|
+
parts.push(token.slice(start));
|
|
1539
1526
|
return parts;
|
|
1540
1527
|
}
|
|
1541
1528
|
|
|
1542
1529
|
// src/maps/layout.maps.js
|
|
1530
|
+
function createSimpleMap(prop, values, keyMap = {}) {
|
|
1531
|
+
const map = {};
|
|
1532
|
+
values.forEach((value) => {
|
|
1533
|
+
const key = keyMap[value] || value;
|
|
1534
|
+
map[key] = `${prop}: ${value};`;
|
|
1535
|
+
});
|
|
1536
|
+
return map;
|
|
1537
|
+
}
|
|
1543
1538
|
var DISPLAY_MAP = {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
fixed: "position: fixed;",
|
|
1569
|
-
absolute: "position: absolute;",
|
|
1570
|
-
relative: "position: relative;",
|
|
1571
|
-
sticky: "position: sticky;"
|
|
1539
|
+
...createSimpleMap("display", [
|
|
1540
|
+
"block",
|
|
1541
|
+
"inline",
|
|
1542
|
+
"inline-block",
|
|
1543
|
+
"flex",
|
|
1544
|
+
"inline-flex",
|
|
1545
|
+
"grid",
|
|
1546
|
+
"inline-grid",
|
|
1547
|
+
"contents",
|
|
1548
|
+
"flow-root",
|
|
1549
|
+
"list-item",
|
|
1550
|
+
"table",
|
|
1551
|
+
"inline-table",
|
|
1552
|
+
"table-caption",
|
|
1553
|
+
"table-cell",
|
|
1554
|
+
"table-column",
|
|
1555
|
+
"table-column-group",
|
|
1556
|
+
"table-footer-group",
|
|
1557
|
+
"table-header-group",
|
|
1558
|
+
"table-row-group",
|
|
1559
|
+
"table-row"
|
|
1560
|
+
]),
|
|
1561
|
+
hidden: "display: none;"
|
|
1562
|
+
// Special case
|
|
1572
1563
|
};
|
|
1564
|
+
var POSITION_MAP = createSimpleMap("position", [
|
|
1565
|
+
"static",
|
|
1566
|
+
"fixed",
|
|
1567
|
+
"absolute",
|
|
1568
|
+
"relative",
|
|
1569
|
+
"sticky"
|
|
1570
|
+
]);
|
|
1573
1571
|
var VISIBILITY_MAP = {
|
|
1574
|
-
|
|
1575
|
-
invisible: "visibility: hidden;"
|
|
1576
|
-
|
|
1577
|
-
};
|
|
1578
|
-
var OVERFLOW_MAP = {
|
|
1579
|
-
auto: "overflow: auto;",
|
|
1580
|
-
hidden: "overflow: hidden;",
|
|
1581
|
-
clip: "overflow: clip;",
|
|
1582
|
-
visible: "overflow: visible;",
|
|
1583
|
-
scroll: "overflow: scroll;"
|
|
1584
|
-
};
|
|
1585
|
-
var OVERFLOW_X_MAP = {
|
|
1586
|
-
auto: "overflow-x: auto;",
|
|
1587
|
-
hidden: "overflow-x: hidden;",
|
|
1588
|
-
clip: "overflow-x: clip;",
|
|
1589
|
-
visible: "overflow-x: visible;",
|
|
1590
|
-
scroll: "overflow-x: scroll;"
|
|
1591
|
-
};
|
|
1592
|
-
var OVERFLOW_Y_MAP = {
|
|
1593
|
-
auto: "overflow-y: auto;",
|
|
1594
|
-
hidden: "overflow-y: hidden;",
|
|
1595
|
-
clip: "overflow-y: clip;",
|
|
1596
|
-
visible: "overflow-y: visible;",
|
|
1597
|
-
scroll: "overflow-y: scroll;"
|
|
1598
|
-
};
|
|
1599
|
-
var OVERSCROLL_MAP = {
|
|
1600
|
-
auto: "overscroll-behavior: auto;",
|
|
1601
|
-
contain: "overscroll-behavior: contain;",
|
|
1602
|
-
none: "overscroll-behavior: none;"
|
|
1603
|
-
};
|
|
1604
|
-
var OVERSCROLL_X_MAP = {
|
|
1605
|
-
auto: "overscroll-behavior-x: auto;",
|
|
1606
|
-
contain: "overscroll-behavior-x: contain;",
|
|
1607
|
-
none: "overscroll-behavior-x: none;"
|
|
1608
|
-
};
|
|
1609
|
-
var OVERSCROLL_Y_MAP = {
|
|
1610
|
-
auto: "overscroll-behavior-y: auto;",
|
|
1611
|
-
contain: "overscroll-behavior-y: contain;",
|
|
1612
|
-
none: "overscroll-behavior-y: none;"
|
|
1572
|
+
...createSimpleMap("visibility", ["visible", "collapse"]),
|
|
1573
|
+
invisible: "visibility: hidden;"
|
|
1574
|
+
// Key differs from value
|
|
1613
1575
|
};
|
|
1576
|
+
var OVERFLOW_VALUES = ["auto", "hidden", "clip", "visible", "scroll"];
|
|
1577
|
+
var OVERFLOW_MAP = createSimpleMap("overflow", OVERFLOW_VALUES);
|
|
1578
|
+
var OVERFLOW_X_MAP = createSimpleMap("overflow-x", OVERFLOW_VALUES);
|
|
1579
|
+
var OVERFLOW_Y_MAP = createSimpleMap("overflow-y", OVERFLOW_VALUES);
|
|
1580
|
+
var OVERSCROLL_VALUES = ["auto", "contain", "none"];
|
|
1581
|
+
var OVERSCROLL_MAP = createSimpleMap("overscroll-behavior", OVERSCROLL_VALUES);
|
|
1582
|
+
var OVERSCROLL_X_MAP = createSimpleMap("overscroll-behavior-x", OVERSCROLL_VALUES);
|
|
1583
|
+
var OVERSCROLL_Y_MAP = createSimpleMap("overscroll-behavior-y", OVERSCROLL_VALUES);
|
|
1614
1584
|
var FLOAT_MAP = {
|
|
1615
|
-
|
|
1616
|
-
right: "float: right;",
|
|
1617
|
-
none: "float: none;",
|
|
1585
|
+
...createSimpleMap("float", ["left", "right", "none"]),
|
|
1618
1586
|
start: "float: inline-start;",
|
|
1619
1587
|
end: "float: inline-end;"
|
|
1620
1588
|
};
|
|
1621
1589
|
var CLEAR_MAP = {
|
|
1622
|
-
|
|
1623
|
-
right: "clear: right;",
|
|
1624
|
-
both: "clear: both;",
|
|
1625
|
-
none: "clear: none;",
|
|
1590
|
+
...createSimpleMap("clear", ["left", "right", "both", "none"]),
|
|
1626
1591
|
start: "clear: inline-start;",
|
|
1627
1592
|
end: "clear: inline-end;"
|
|
1628
1593
|
};
|
|
@@ -1630,13 +1595,13 @@ var ISOLATION_MAP = {
|
|
|
1630
1595
|
isolate: "isolation: isolate;",
|
|
1631
1596
|
"isolation-auto": "isolation: auto;"
|
|
1632
1597
|
};
|
|
1633
|
-
var OBJECT_FIT_MAP =
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
"scale-down"
|
|
1639
|
-
|
|
1598
|
+
var OBJECT_FIT_MAP = createSimpleMap("object-fit", [
|
|
1599
|
+
"contain",
|
|
1600
|
+
"cover",
|
|
1601
|
+
"fill",
|
|
1602
|
+
"none",
|
|
1603
|
+
"scale-down"
|
|
1604
|
+
]);
|
|
1640
1605
|
var TRANSFORM_STYLE_MAP = {
|
|
1641
1606
|
"transform-style-flat": "transform-style: flat;",
|
|
1642
1607
|
"transform-style-3d": "transform-style: preserve-3d;",
|
|
@@ -1654,81 +1619,64 @@ var BOX_SIZING_MAP = {
|
|
|
1654
1619
|
border: "box-sizing: border-box;",
|
|
1655
1620
|
content: "box-sizing: content-box;"
|
|
1656
1621
|
};
|
|
1622
|
+
var BREAK_AFTER_BEFORE_VALUES = [
|
|
1623
|
+
"auto",
|
|
1624
|
+
"avoid",
|
|
1625
|
+
"avoid-page",
|
|
1626
|
+
"avoid-column",
|
|
1627
|
+
"page",
|
|
1628
|
+
"left",
|
|
1629
|
+
"right",
|
|
1630
|
+
"recto",
|
|
1631
|
+
"verso"
|
|
1632
|
+
];
|
|
1657
1633
|
var BREAK_AFTER_MAP = {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
"avoid-page": "break-after: avoid-page;",
|
|
1661
|
-
"avoid-column": "break-after: avoid-column;",
|
|
1662
|
-
page: "break-after: page;",
|
|
1663
|
-
all: "break-after: all;",
|
|
1664
|
-
left: "break-after: left;",
|
|
1665
|
-
right: "break-after: right;",
|
|
1666
|
-
recto: "break-after: recto;",
|
|
1667
|
-
verso: "break-after: verso;"
|
|
1668
|
-
};
|
|
1669
|
-
var BREAK_BEFORE_MAP = {
|
|
1670
|
-
auto: "break-before: auto;",
|
|
1671
|
-
avoid: "break-before: avoid;",
|
|
1672
|
-
"avoid-page": "break-before: avoid-page;",
|
|
1673
|
-
"avoid-column": "break-before: avoid-column;",
|
|
1674
|
-
page: "break-before: page;",
|
|
1675
|
-
left: "break-before: left;",
|
|
1676
|
-
right: "break-before: right;",
|
|
1677
|
-
recto: "break-before: recto;",
|
|
1678
|
-
verso: "break-before: verso;"
|
|
1679
|
-
};
|
|
1680
|
-
var BREAK_INSIDE_MAP = {
|
|
1681
|
-
auto: "break-inside: auto;",
|
|
1682
|
-
avoid: "break-inside: avoid;",
|
|
1683
|
-
"avoid-page": "break-inside: avoid-page;",
|
|
1684
|
-
"avoid-column": "break-inside: avoid-column;"
|
|
1685
|
-
};
|
|
1686
|
-
var BOX_DECORATION_BREAK_MAP = {
|
|
1687
|
-
slice: "box-decoration-break: slice;",
|
|
1688
|
-
clone: "box-decoration-break: clone;"
|
|
1689
|
-
};
|
|
1690
|
-
var HYPHENS_MAP = {
|
|
1691
|
-
none: "hyphens: none;",
|
|
1692
|
-
manual: "hyphens: manual;",
|
|
1693
|
-
auto: "hyphens: auto;"
|
|
1694
|
-
};
|
|
1695
|
-
var COLOR_SCHEME_MAP = {
|
|
1696
|
-
light: "color-scheme: light;",
|
|
1697
|
-
dark: "color-scheme: dark;",
|
|
1698
|
-
normal: "color-scheme: normal;"
|
|
1699
|
-
};
|
|
1700
|
-
var SCROLLBAR_COLOR_MAP = {
|
|
1701
|
-
auto: "scrollbar-color: auto;",
|
|
1702
|
-
transparent: "scrollbar-color: transparent;",
|
|
1703
|
-
current: "scrollbar-color: currentColor;"
|
|
1704
|
-
};
|
|
1705
|
-
var SCROLLBAR_WIDTH_MAP = {
|
|
1706
|
-
auto: "scrollbar-width: auto;",
|
|
1707
|
-
thin: "scrollbar-width: thin;",
|
|
1708
|
-
none: "scrollbar-width: none;"
|
|
1634
|
+
...createSimpleMap("break-after", BREAK_AFTER_BEFORE_VALUES),
|
|
1635
|
+
all: "break-after: all;"
|
|
1709
1636
|
};
|
|
1637
|
+
var BREAK_BEFORE_MAP = createSimpleMap("break-before", BREAK_AFTER_BEFORE_VALUES);
|
|
1638
|
+
var BREAK_INSIDE_MAP = createSimpleMap("break-inside", [
|
|
1639
|
+
"auto",
|
|
1640
|
+
"avoid",
|
|
1641
|
+
"avoid-page",
|
|
1642
|
+
"avoid-column"
|
|
1643
|
+
]);
|
|
1644
|
+
var BOX_DECORATION_BREAK_MAP = createSimpleMap("box-decoration-break", [
|
|
1645
|
+
"slice",
|
|
1646
|
+
"clone"
|
|
1647
|
+
]);
|
|
1648
|
+
var HYPHENS_MAP = createSimpleMap("hyphens", ["none", "manual", "auto"]);
|
|
1649
|
+
var COLOR_SCHEME_MAP = createSimpleMap("color-scheme", [
|
|
1650
|
+
"light",
|
|
1651
|
+
"dark",
|
|
1652
|
+
"normal"
|
|
1653
|
+
]);
|
|
1654
|
+
var SCROLLBAR_COLOR_MAP = createSimpleMap("scrollbar-color", [
|
|
1655
|
+
"auto",
|
|
1656
|
+
"transparent",
|
|
1657
|
+
"current"
|
|
1658
|
+
]);
|
|
1659
|
+
var SCROLLBAR_WIDTH_MAP = createSimpleMap("scrollbar-width", [
|
|
1660
|
+
"auto",
|
|
1661
|
+
"thin",
|
|
1662
|
+
"none"
|
|
1663
|
+
]);
|
|
1710
1664
|
var SCROLLBAR_GUTTER_MAP = {
|
|
1711
1665
|
auto: "scrollbar-gutter: auto;",
|
|
1712
1666
|
stable: "scrollbar-gutter: stable;",
|
|
1713
1667
|
"stable-both-edges": "scrollbar-gutter: stable both-edges;",
|
|
1714
1668
|
"both-edges": "scrollbar-gutter: both-edges;"
|
|
1715
1669
|
};
|
|
1716
|
-
var TABLE_LAYOUT_MAP =
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
separate: "border-collapse: separate;"
|
|
1727
|
-
};
|
|
1728
|
-
var SCROLL_BEHAVIOR_MAP = {
|
|
1729
|
-
auto: "scroll-behavior: auto;",
|
|
1730
|
-
smooth: "scroll-behavior: smooth;"
|
|
1731
|
-
};
|
|
1670
|
+
var TABLE_LAYOUT_MAP = createSimpleMap("table-layout", ["auto", "fixed"]);
|
|
1671
|
+
var CAPTION_SIDE_MAP = createSimpleMap("caption-side", ["top", "bottom"]);
|
|
1672
|
+
var BORDER_COLLAPSE_MAP = createSimpleMap("border-collapse", [
|
|
1673
|
+
"collapse",
|
|
1674
|
+
"separate"
|
|
1675
|
+
]);
|
|
1676
|
+
var SCROLL_BEHAVIOR_MAP = createSimpleMap("scroll-behavior", [
|
|
1677
|
+
"auto",
|
|
1678
|
+
"smooth"
|
|
1679
|
+
]);
|
|
1732
1680
|
var SIDE_PROPS = {
|
|
1733
1681
|
"": [""],
|
|
1734
1682
|
t: ["-top"],
|
|
@@ -1759,71 +1707,69 @@ var ROUNDED_PROPS = {
|
|
|
1759
1707
|
};
|
|
1760
1708
|
|
|
1761
1709
|
// src/maps/interactivity.maps.js
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
"
|
|
1771
|
-
|
|
1772
|
-
"
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
"
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
"
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
"
|
|
1783
|
-
"
|
|
1784
|
-
"
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
var
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
"
|
|
1804
|
-
"pan-
|
|
1805
|
-
"pan-
|
|
1806
|
-
"pan-
|
|
1807
|
-
"pan-
|
|
1808
|
-
"pan-
|
|
1809
|
-
"
|
|
1810
|
-
|
|
1811
|
-
|
|
1710
|
+
function createSimpleMap2(prop, values) {
|
|
1711
|
+
const map = {};
|
|
1712
|
+
values.forEach((value) => {
|
|
1713
|
+
map[value] = `${prop}: ${value};`;
|
|
1714
|
+
});
|
|
1715
|
+
return map;
|
|
1716
|
+
}
|
|
1717
|
+
var CURSOR_MAP = createSimpleMap2("cursor", [
|
|
1718
|
+
"auto",
|
|
1719
|
+
"default",
|
|
1720
|
+
"pointer",
|
|
1721
|
+
"wait",
|
|
1722
|
+
"text",
|
|
1723
|
+
"move",
|
|
1724
|
+
"help",
|
|
1725
|
+
"not-allowed",
|
|
1726
|
+
"none",
|
|
1727
|
+
"context-menu",
|
|
1728
|
+
"progress",
|
|
1729
|
+
"cell",
|
|
1730
|
+
"crosshair",
|
|
1731
|
+
"vertical-text",
|
|
1732
|
+
"alias",
|
|
1733
|
+
"copy",
|
|
1734
|
+
"no-drop",
|
|
1735
|
+
"grab",
|
|
1736
|
+
"grabbing",
|
|
1737
|
+
"all-scroll",
|
|
1738
|
+
"zoom-in",
|
|
1739
|
+
"zoom-out"
|
|
1740
|
+
]);
|
|
1741
|
+
var POINTER_EVENTS_MAP = createSimpleMap2("pointer-events", ["none", "auto"]);
|
|
1742
|
+
var USER_SELECT_MAP = createSimpleMap2("user-select", [
|
|
1743
|
+
"none",
|
|
1744
|
+
"text",
|
|
1745
|
+
"all",
|
|
1746
|
+
"auto"
|
|
1747
|
+
]);
|
|
1748
|
+
var APPEARANCE_MAP = createSimpleMap2("appearance", ["none", "auto"]);
|
|
1749
|
+
var TOUCH_ACTION_MAP = createSimpleMap2("touch-action", [
|
|
1750
|
+
"auto",
|
|
1751
|
+
"none",
|
|
1752
|
+
"pan-x",
|
|
1753
|
+
"pan-left",
|
|
1754
|
+
"pan-right",
|
|
1755
|
+
"pan-y",
|
|
1756
|
+
"pan-up",
|
|
1757
|
+
"pan-down",
|
|
1758
|
+
"pinch-zoom",
|
|
1759
|
+
"manipulation"
|
|
1760
|
+
]);
|
|
1812
1761
|
var OUTLINE_STYLE_MAP = {
|
|
1813
1762
|
none: "outline: 2px solid transparent; outline-offset: 2px;",
|
|
1814
|
-
|
|
1815
|
-
dashed: "outline-style: dashed;",
|
|
1816
|
-
dotted: "outline-style: dotted;",
|
|
1817
|
-
double: "outline-style: double;"
|
|
1818
|
-
};
|
|
1819
|
-
var BORDER_STYLE_MAP = {
|
|
1820
|
-
solid: "border-style: solid;",
|
|
1821
|
-
dashed: "border-style: dashed;",
|
|
1822
|
-
dotted: "border-style: dotted;",
|
|
1823
|
-
double: "border-style: double;",
|
|
1824
|
-
hidden: "border-style: hidden;",
|
|
1825
|
-
none: "border-style: none;"
|
|
1763
|
+
...createSimpleMap2("outline-style", ["solid", "dashed", "dotted", "double"])
|
|
1826
1764
|
};
|
|
1765
|
+
var BORDER_STYLE_MAP = createSimpleMap2("border-style", [
|
|
1766
|
+
"solid",
|
|
1767
|
+
"dashed",
|
|
1768
|
+
"dotted",
|
|
1769
|
+
"double",
|
|
1770
|
+
"hidden",
|
|
1771
|
+
"none"
|
|
1772
|
+
]);
|
|
1827
1773
|
var TRANSITION_PROPERTY_MAP = {
|
|
1828
1774
|
none: "none",
|
|
1829
1775
|
all: "all",
|
|
@@ -3276,7 +3222,8 @@ function buildDivideDeclaration(baseToken, theme2) {
|
|
|
3276
3222
|
// src/plugins.js
|
|
3277
3223
|
var PluginRegistry = class {
|
|
3278
3224
|
constructor() {
|
|
3279
|
-
this.
|
|
3225
|
+
this.exactUtilities = /* @__PURE__ */ new Map();
|
|
3226
|
+
this.regexUtilities = [];
|
|
3280
3227
|
this.variants = /* @__PURE__ */ new Map();
|
|
3281
3228
|
}
|
|
3282
3229
|
/**
|
|
@@ -3285,7 +3232,11 @@ var PluginRegistry = class {
|
|
|
3285
3232
|
* @param {Function|string} handler - Function that returns CSS or CSS string
|
|
3286
3233
|
*/
|
|
3287
3234
|
addUtility(pattern, handler) {
|
|
3288
|
-
|
|
3235
|
+
if (pattern instanceof RegExp) {
|
|
3236
|
+
this.regexUtilities.push([pattern, handler]);
|
|
3237
|
+
} else {
|
|
3238
|
+
this.exactUtilities.set(pattern, handler);
|
|
3239
|
+
}
|
|
3289
3240
|
}
|
|
3290
3241
|
/**
|
|
3291
3242
|
* Register multiple utilities at once
|
|
@@ -3308,25 +3259,29 @@ var PluginRegistry = class {
|
|
|
3308
3259
|
* Register multiple variants at once
|
|
3309
3260
|
* @param {Object} variants - Object mapping names to handlers
|
|
3310
3261
|
*/
|
|
3311
|
-
addVariants(
|
|
3312
|
-
Object.entries(
|
|
3262
|
+
addVariants(variants) {
|
|
3263
|
+
Object.entries(variants).forEach(([name, handler]) => {
|
|
3313
3264
|
this.addVariant(name, handler);
|
|
3314
3265
|
});
|
|
3315
3266
|
}
|
|
3316
3267
|
/**
|
|
3317
3268
|
* Check if a token matches any custom utility pattern
|
|
3269
|
+
* Optimized: O(1) fast path for exact matches, O(n) only for regex patterns
|
|
3318
3270
|
* @param {string} token - The base token to match
|
|
3319
3271
|
* @returns {Object|null} - { handler, match } or null
|
|
3320
3272
|
*/
|
|
3321
3273
|
matchUtility(token) {
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3274
|
+
if (this.exactUtilities.has(token)) {
|
|
3275
|
+
return {
|
|
3276
|
+
handler: this.exactUtilities.get(token),
|
|
3277
|
+
match: [token]
|
|
3278
|
+
};
|
|
3279
|
+
}
|
|
3280
|
+
for (let i = 0; i < this.regexUtilities.length; i += 1) {
|
|
3281
|
+
const [pattern, handler] = this.regexUtilities[i];
|
|
3282
|
+
const match = pattern.exec(token);
|
|
3283
|
+
if (match) {
|
|
3284
|
+
return { handler, match };
|
|
3330
3285
|
}
|
|
3331
3286
|
}
|
|
3332
3287
|
return null;
|
|
@@ -3343,7 +3298,10 @@ var PluginRegistry = class {
|
|
|
3343
3298
|
* Get all registered utility patterns (for debugging)
|
|
3344
3299
|
*/
|
|
3345
3300
|
getUtilities() {
|
|
3346
|
-
return
|
|
3301
|
+
return [
|
|
3302
|
+
...Array.from(this.exactUtilities.keys()),
|
|
3303
|
+
...this.regexUtilities.map(([pattern]) => pattern)
|
|
3304
|
+
];
|
|
3347
3305
|
}
|
|
3348
3306
|
/**
|
|
3349
3307
|
* Get all registered variant names (for debugging)
|
|
@@ -3355,7 +3313,8 @@ var PluginRegistry = class {
|
|
|
3355
3313
|
* Clear all registered plugins
|
|
3356
3314
|
*/
|
|
3357
3315
|
clear() {
|
|
3358
|
-
this.
|
|
3316
|
+
this.exactUtilities.clear();
|
|
3317
|
+
this.regexUtilities = [];
|
|
3359
3318
|
this.variants.clear();
|
|
3360
3319
|
}
|
|
3361
3320
|
};
|
|
@@ -3560,8 +3519,26 @@ function extractPrefix(token) {
|
|
|
3560
3519
|
}
|
|
3561
3520
|
return prefix;
|
|
3562
3521
|
}
|
|
3522
|
+
var UNKNOWN_PREFIX_CACHE = /* @__PURE__ */ new Set();
|
|
3523
|
+
var MAX_UNKNOWN_CACHE_SIZE = 500;
|
|
3563
3524
|
function checkAllBuilders(baseToken, theme2) {
|
|
3564
|
-
|
|
3525
|
+
const prefix = extractPrefix(baseToken);
|
|
3526
|
+
if (UNKNOWN_PREFIX_CACHE.has(prefix)) {
|
|
3527
|
+
return void 0;
|
|
3528
|
+
}
|
|
3529
|
+
const result = buildLayoutDeclaration(baseToken, theme2) || buildPositionInsetDeclaration(baseToken, theme2) || buildSpacingDeclaration(baseToken, theme2) || buildSpaceBetweenDeclaration(baseToken, theme2) || buildGapDeclaration(baseToken, theme2) || buildDimensionDeclaration(baseToken, theme2) || buildFlexGridDeclaration(baseToken, theme2) || buildBorderDeclaration(baseToken, theme2) || buildBorderRadiusDeclaration(baseToken, theme2) || buildBorderSpacingDeclaration(baseToken, theme2) || buildDivideDeclaration(baseToken, theme2) || buildOpacityDeclaration(baseToken, theme2) || buildShadowDeclaration(baseToken, theme2) || buildInsetShadowDeclaration(baseToken, theme2) || buildInsetRingDeclaration(baseToken, theme2) || buildRingDeclaration(baseToken, theme2) || buildRingOffsetDeclaration(baseToken, theme2) || buildTextShadowDeclaration(baseToken, theme2) || buildTransitionDeclaration(baseToken) || buildTransformDeclaration(baseToken, theme2) || buildFilterDeclaration(baseToken, theme2) || buildBackgroundDeclaration(baseToken, theme2) || buildGradientDeclaration(baseToken, theme2) || buildColorDeclaration(baseToken, theme2) || buildTypographyDeclaration(baseToken, theme2) || buildBlendingDeclaration(baseToken) || buildInteractivityDeclaration(baseToken, theme2) || buildAnimationDeclaration(baseToken) || buildMaskDeclaration(baseToken) || buildContainerQueryDeclaration(baseToken) || buildScrollSnapDeclaration(baseToken) || buildAccessibilityDeclaration(baseToken) || buildZoomDeclaration(baseToken, theme2) || buildForcedColorDeclaration(baseToken);
|
|
3530
|
+
if (!result && prefix) {
|
|
3531
|
+
if (UNKNOWN_PREFIX_CACHE.size >= MAX_UNKNOWN_CACHE_SIZE) {
|
|
3532
|
+
const toRemove = Math.floor(MAX_UNKNOWN_CACHE_SIZE / 2);
|
|
3533
|
+
const iterator = UNKNOWN_PREFIX_CACHE.values();
|
|
3534
|
+
for (let i = 0; i < toRemove; i += 1) {
|
|
3535
|
+
const value = iterator.next().value;
|
|
3536
|
+
if (value) UNKNOWN_PREFIX_CACHE.delete(value);
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
UNKNOWN_PREFIX_CACHE.add(prefix);
|
|
3540
|
+
}
|
|
3541
|
+
return result;
|
|
3565
3542
|
}
|
|
3566
3543
|
function compileBaseToken(baseToken, theme2, pluginRegistry) {
|
|
3567
3544
|
if (pluginRegistry) {
|
|
@@ -3590,9 +3567,75 @@ function compileBaseToken(baseToken, theme2, pluginRegistry) {
|
|
|
3590
3567
|
}
|
|
3591
3568
|
return checkAllBuilders(baseToken, theme2);
|
|
3592
3569
|
}
|
|
3593
|
-
|
|
3570
|
+
var VARIANT_MAP = /* @__PURE__ */ new Map([
|
|
3571
|
+
// Dark mode
|
|
3572
|
+
["dark", (s) => `.dark ${s}`],
|
|
3573
|
+
// Pseudo-classes – interactive
|
|
3574
|
+
["hover", (s) => `${s}:hover`],
|
|
3575
|
+
["focus", (s) => `${s}:focus`],
|
|
3576
|
+
["focus-visible", (s) => `${s}:focus-visible`],
|
|
3577
|
+
["focus-within", (s) => `${s}:focus-within`],
|
|
3578
|
+
["active", (s) => `${s}:active`],
|
|
3579
|
+
["visited", (s) => `${s}:visited`],
|
|
3580
|
+
["disabled", (s) => `${s}:disabled`],
|
|
3581
|
+
["checked", (s) => `${s}:checked`],
|
|
3582
|
+
["indeterminate", (s) => `${s}:indeterminate`],
|
|
3583
|
+
["required", (s) => `${s}:required`],
|
|
3584
|
+
["valid", (s) => `${s}:valid`],
|
|
3585
|
+
["invalid", (s) => `${s}:invalid`],
|
|
3586
|
+
["target", (s) => `${s}:target`],
|
|
3587
|
+
["enabled", (s) => `${s}:enabled`],
|
|
3588
|
+
["default", (s) => `${s}:default`],
|
|
3589
|
+
["optional", (s) => `${s}:optional`],
|
|
3590
|
+
["user-valid", (s) => `${s}:user-valid`],
|
|
3591
|
+
["user-invalid", (s) => `${s}:user-invalid`],
|
|
3592
|
+
["in-range", (s) => `${s}:in-range`],
|
|
3593
|
+
["out-of-range", (s) => `${s}:out-of-range`],
|
|
3594
|
+
["placeholder-shown", (s) => `${s}:placeholder-shown`],
|
|
3595
|
+
["autofill", (s) => `${s}:autofill`],
|
|
3596
|
+
["details-content", (s) => `${s}:details-content`],
|
|
3597
|
+
["read-only", (s) => `${s}:read-only`],
|
|
3598
|
+
["open", (s) => `${s}[open]`],
|
|
3599
|
+
// Pseudo-elements
|
|
3600
|
+
["placeholder", (s) => `${s}::placeholder`],
|
|
3601
|
+
["backdrop", (s) => `${s}::backdrop`],
|
|
3602
|
+
["before", (s) => `${s}::before`],
|
|
3603
|
+
["after", (s) => `${s}::after`],
|
|
3604
|
+
["first-letter", (s) => `${s}::first-letter`],
|
|
3605
|
+
["first-line", (s) => `${s}::first-line`],
|
|
3606
|
+
["marker", (s) => `${s}::marker`],
|
|
3607
|
+
["selection", (s) => `${s}::selection`],
|
|
3608
|
+
["file", (s) => `${s}::file-selector-button`],
|
|
3609
|
+
// Structural pseudo-classes
|
|
3610
|
+
["first", (s) => `${s}:first-child`],
|
|
3611
|
+
["last", (s) => `${s}:last-child`],
|
|
3612
|
+
["odd", (s) => `${s}:nth-child(odd)`],
|
|
3613
|
+
["even", (s) => `${s}:nth-child(even)`],
|
|
3614
|
+
["first-of-type", (s) => `${s}:first-of-type`],
|
|
3615
|
+
["last-of-type", (s) => `${s}:last-of-type`],
|
|
3616
|
+
["only", (s) => `${s}:only-child`],
|
|
3617
|
+
["only-of-type", (s) => `${s}:only-of-type`],
|
|
3618
|
+
["empty", (s) => `${s}:empty`],
|
|
3619
|
+
// Group & peer variants
|
|
3620
|
+
["group-hover", (s) => `.group:hover ${s}`],
|
|
3621
|
+
["group-focus", (s) => `.group:focus ${s}`],
|
|
3622
|
+
["group-active", (s) => `.group:active ${s}`],
|
|
3623
|
+
["peer-hover", (s) => `.peer:hover ~ ${s}`],
|
|
3624
|
+
["peer-focus", (s) => `.peer:focus ~ ${s}`],
|
|
3625
|
+
["peer-checked", (s) => `.peer:checked ~ ${s}`],
|
|
3626
|
+
["peer-disabled", (s) => `.peer:disabled ~ ${s}`],
|
|
3627
|
+
// Negation variants
|
|
3628
|
+
["not-hover", (s) => `${s}:not(:hover)`],
|
|
3629
|
+
["not-focus", (s) => `${s}:not(:focus)`],
|
|
3630
|
+
["not-disabled", (s) => `${s}:not(:disabled)`],
|
|
3631
|
+
["not-checked", (s) => `${s}:not(:checked)`],
|
|
3632
|
+
// In-* variants (group-based)
|
|
3633
|
+
["in-hover", (s) => `.group:hover ${s}`],
|
|
3634
|
+
["in-focus", (s) => `.group:focus ${s}`]
|
|
3635
|
+
]);
|
|
3636
|
+
function applyVariants(selector, variants, pluginRegistry) {
|
|
3594
3637
|
let currentSelector = selector;
|
|
3595
|
-
for (const variant of
|
|
3638
|
+
for (const variant of variants) {
|
|
3596
3639
|
if (pluginRegistry) {
|
|
3597
3640
|
const customHandler = pluginRegistry.matchVariant(variant);
|
|
3598
3641
|
if (customHandler) {
|
|
@@ -3607,180 +3650,11 @@ function applyVariants(selector, variants2, pluginRegistry) {
|
|
|
3607
3650
|
}
|
|
3608
3651
|
}
|
|
3609
3652
|
}
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
currentSelector = `${currentSelector}:hover`;
|
|
3616
|
-
break;
|
|
3617
|
-
case "focus":
|
|
3618
|
-
currentSelector = `${currentSelector}:focus`;
|
|
3619
|
-
break;
|
|
3620
|
-
case "focus-visible":
|
|
3621
|
-
currentSelector = `${currentSelector}:focus-visible`;
|
|
3622
|
-
break;
|
|
3623
|
-
case "focus-within":
|
|
3624
|
-
currentSelector = `${currentSelector}:focus-within`;
|
|
3625
|
-
break;
|
|
3626
|
-
case "active":
|
|
3627
|
-
currentSelector = `${currentSelector}:active`;
|
|
3628
|
-
break;
|
|
3629
|
-
case "visited":
|
|
3630
|
-
currentSelector = `${currentSelector}:visited`;
|
|
3631
|
-
break;
|
|
3632
|
-
case "disabled":
|
|
3633
|
-
currentSelector = `${currentSelector}:disabled`;
|
|
3634
|
-
break;
|
|
3635
|
-
case "checked":
|
|
3636
|
-
currentSelector = `${currentSelector}:checked`;
|
|
3637
|
-
break;
|
|
3638
|
-
case "indeterminate":
|
|
3639
|
-
currentSelector = `${currentSelector}:indeterminate`;
|
|
3640
|
-
break;
|
|
3641
|
-
case "required":
|
|
3642
|
-
currentSelector = `${currentSelector}:required`;
|
|
3643
|
-
break;
|
|
3644
|
-
case "valid":
|
|
3645
|
-
currentSelector = `${currentSelector}:valid`;
|
|
3646
|
-
break;
|
|
3647
|
-
case "invalid":
|
|
3648
|
-
currentSelector = `${currentSelector}:invalid`;
|
|
3649
|
-
break;
|
|
3650
|
-
case "target":
|
|
3651
|
-
currentSelector = `${currentSelector}:target`;
|
|
3652
|
-
break;
|
|
3653
|
-
case "enabled":
|
|
3654
|
-
currentSelector = `${currentSelector}:enabled`;
|
|
3655
|
-
break;
|
|
3656
|
-
case "default":
|
|
3657
|
-
currentSelector = `${currentSelector}:default`;
|
|
3658
|
-
break;
|
|
3659
|
-
case "optional":
|
|
3660
|
-
currentSelector = `${currentSelector}:optional`;
|
|
3661
|
-
break;
|
|
3662
|
-
case "user-valid":
|
|
3663
|
-
currentSelector = `${currentSelector}:user-valid`;
|
|
3664
|
-
break;
|
|
3665
|
-
case "user-invalid":
|
|
3666
|
-
currentSelector = `${currentSelector}:user-invalid`;
|
|
3667
|
-
break;
|
|
3668
|
-
case "in-range":
|
|
3669
|
-
currentSelector = `${currentSelector}:in-range`;
|
|
3670
|
-
break;
|
|
3671
|
-
case "out-of-range":
|
|
3672
|
-
currentSelector = `${currentSelector}:out-of-range`;
|
|
3673
|
-
break;
|
|
3674
|
-
case "placeholder-shown":
|
|
3675
|
-
currentSelector = `${currentSelector}:placeholder-shown`;
|
|
3676
|
-
break;
|
|
3677
|
-
case "autofill":
|
|
3678
|
-
currentSelector = `${currentSelector}:autofill`;
|
|
3679
|
-
break;
|
|
3680
|
-
case "details-content":
|
|
3681
|
-
currentSelector = `${currentSelector}:details-content`;
|
|
3682
|
-
break;
|
|
3683
|
-
case "placeholder":
|
|
3684
|
-
currentSelector = `${currentSelector}::placeholder`;
|
|
3685
|
-
break;
|
|
3686
|
-
case "backdrop":
|
|
3687
|
-
currentSelector = `${currentSelector}::backdrop`;
|
|
3688
|
-
break;
|
|
3689
|
-
case "before":
|
|
3690
|
-
currentSelector = `${currentSelector}::before`;
|
|
3691
|
-
break;
|
|
3692
|
-
case "after":
|
|
3693
|
-
currentSelector = `${currentSelector}::after`;
|
|
3694
|
-
break;
|
|
3695
|
-
case "first-letter":
|
|
3696
|
-
currentSelector = `${currentSelector}::first-letter`;
|
|
3697
|
-
break;
|
|
3698
|
-
case "first-line":
|
|
3699
|
-
currentSelector = `${currentSelector}::first-line`;
|
|
3700
|
-
break;
|
|
3701
|
-
case "marker":
|
|
3702
|
-
currentSelector = `${currentSelector}::marker`;
|
|
3703
|
-
break;
|
|
3704
|
-
case "selection":
|
|
3705
|
-
currentSelector = `${currentSelector}::selection`;
|
|
3706
|
-
break;
|
|
3707
|
-
case "file":
|
|
3708
|
-
currentSelector = `${currentSelector}::file-selector-button`;
|
|
3709
|
-
break;
|
|
3710
|
-
case "first":
|
|
3711
|
-
currentSelector = `${currentSelector}:first-child`;
|
|
3712
|
-
break;
|
|
3713
|
-
case "last":
|
|
3714
|
-
currentSelector = `${currentSelector}:last-child`;
|
|
3715
|
-
break;
|
|
3716
|
-
case "odd":
|
|
3717
|
-
currentSelector = `${currentSelector}:nth-child(odd)`;
|
|
3718
|
-
break;
|
|
3719
|
-
case "even":
|
|
3720
|
-
currentSelector = `${currentSelector}:nth-child(even)`;
|
|
3721
|
-
break;
|
|
3722
|
-
case "first-of-type":
|
|
3723
|
-
currentSelector = `${currentSelector}:first-of-type`;
|
|
3724
|
-
break;
|
|
3725
|
-
case "last-of-type":
|
|
3726
|
-
currentSelector = `${currentSelector}:last-of-type`;
|
|
3727
|
-
break;
|
|
3728
|
-
case "only":
|
|
3729
|
-
currentSelector = `${currentSelector}:only-child`;
|
|
3730
|
-
break;
|
|
3731
|
-
case "only-of-type":
|
|
3732
|
-
currentSelector = `${currentSelector}:only-of-type`;
|
|
3733
|
-
break;
|
|
3734
|
-
case "empty":
|
|
3735
|
-
currentSelector = `${currentSelector}:empty`;
|
|
3736
|
-
break;
|
|
3737
|
-
case "read-only":
|
|
3738
|
-
currentSelector = `${currentSelector}:read-only`;
|
|
3739
|
-
break;
|
|
3740
|
-
case "open":
|
|
3741
|
-
currentSelector = `${currentSelector}[open]`;
|
|
3742
|
-
break;
|
|
3743
|
-
case "group-hover":
|
|
3744
|
-
currentSelector = `.group:hover ${currentSelector}`;
|
|
3745
|
-
break;
|
|
3746
|
-
case "group-focus":
|
|
3747
|
-
currentSelector = `.group:focus ${currentSelector}`;
|
|
3748
|
-
break;
|
|
3749
|
-
case "group-active":
|
|
3750
|
-
currentSelector = `.group:active ${currentSelector}`;
|
|
3751
|
-
break;
|
|
3752
|
-
case "peer-hover":
|
|
3753
|
-
currentSelector = `.peer:hover ~ ${currentSelector}`;
|
|
3754
|
-
break;
|
|
3755
|
-
case "peer-focus":
|
|
3756
|
-
currentSelector = `.peer:focus ~ ${currentSelector}`;
|
|
3757
|
-
break;
|
|
3758
|
-
case "peer-checked":
|
|
3759
|
-
currentSelector = `.peer:checked ~ ${currentSelector}`;
|
|
3760
|
-
break;
|
|
3761
|
-
case "peer-disabled":
|
|
3762
|
-
currentSelector = `.peer:disabled ~ ${currentSelector}`;
|
|
3763
|
-
break;
|
|
3764
|
-
case "not-hover":
|
|
3765
|
-
currentSelector = `${currentSelector}:not(:hover)`;
|
|
3766
|
-
break;
|
|
3767
|
-
case "not-focus":
|
|
3768
|
-
currentSelector = `${currentSelector}:not(:focus)`;
|
|
3769
|
-
break;
|
|
3770
|
-
case "not-disabled":
|
|
3771
|
-
currentSelector = `${currentSelector}:not(:disabled)`;
|
|
3772
|
-
break;
|
|
3773
|
-
case "not-checked":
|
|
3774
|
-
currentSelector = `${currentSelector}:not(:checked)`;
|
|
3775
|
-
break;
|
|
3776
|
-
case "in-hover":
|
|
3777
|
-
currentSelector = `.group:hover ${currentSelector}`;
|
|
3778
|
-
break;
|
|
3779
|
-
case "in-focus":
|
|
3780
|
-
currentSelector = `.group:focus ${currentSelector}`;
|
|
3781
|
-
break;
|
|
3782
|
-
default:
|
|
3783
|
-
return void 0;
|
|
3653
|
+
const builtinHandler = VARIANT_MAP.get(variant);
|
|
3654
|
+
if (builtinHandler) {
|
|
3655
|
+
currentSelector = builtinHandler(currentSelector);
|
|
3656
|
+
} else {
|
|
3657
|
+
return void 0;
|
|
3784
3658
|
}
|
|
3785
3659
|
}
|
|
3786
3660
|
return currentSelector;
|
|
@@ -3796,7 +3670,7 @@ function resolveRuntimeContext(options = {}) {
|
|
|
3796
3670
|
addUtility: (pattern, handler) => pluginRegistry.addUtility(pattern, handler),
|
|
3797
3671
|
addUtilities: (utilities) => pluginRegistry.addUtilities(utilities),
|
|
3798
3672
|
addVariant: (name, handler) => pluginRegistry.addVariant(name, handler),
|
|
3799
|
-
addVariants: (
|
|
3673
|
+
addVariants: (variants) => pluginRegistry.addVariants(variants),
|
|
3800
3674
|
theme: (key) => {
|
|
3801
3675
|
if (!key) return config.theme || {};
|
|
3802
3676
|
const keys = key.split(".");
|
|
@@ -3849,7 +3723,7 @@ function parseClass(className, screens = {}, containers = {}) {
|
|
|
3849
3723
|
const parts = splitByVariantDelimiter(normalized);
|
|
3850
3724
|
if (parts.length === 0) return null;
|
|
3851
3725
|
const baseToken = parts[parts.length - 1];
|
|
3852
|
-
const
|
|
3726
|
+
const variants = [];
|
|
3853
3727
|
let breakpoint = null;
|
|
3854
3728
|
let containerBreakpoint = null;
|
|
3855
3729
|
let starting = false;
|
|
@@ -3870,9 +3744,9 @@ function parseClass(className, screens = {}, containers = {}) {
|
|
|
3870
3744
|
breakpoint = part;
|
|
3871
3745
|
continue;
|
|
3872
3746
|
}
|
|
3873
|
-
|
|
3747
|
+
variants.push(part);
|
|
3874
3748
|
}
|
|
3875
|
-
const result = { original: token, baseToken, variants
|
|
3749
|
+
const result = { original: token, baseToken, variants, breakpoint, containerBreakpoint, important, starting };
|
|
3876
3750
|
if (parseCache.size >= PARSE_CACHE_MAX_SIZE) {
|
|
3877
3751
|
const firstKey = parseCache.keys().next().value;
|
|
3878
3752
|
parseCache.delete(firstKey);
|
|
@@ -3908,6 +3782,30 @@ function compileRuntimeClassNameWithContext(className, context) {
|
|
|
3908
3782
|
function compileClass(className, options = {}) {
|
|
3909
3783
|
return compileRuntimeClassNameWithContext(className, resolveRuntimeContext(options));
|
|
3910
3784
|
}
|
|
3785
|
+
function compileCriticalCss(classNames, options = {}) {
|
|
3786
|
+
const classList = typeof classNames === "string" ? classNames.split(/\s+/).filter(Boolean) : Array.isArray(classNames) ? classNames.flatMap(
|
|
3787
|
+
(str) => typeof str === "string" ? str.split(/\s+/).filter(Boolean) : []
|
|
3788
|
+
) : [];
|
|
3789
|
+
const context = resolveRuntimeContext(options);
|
|
3790
|
+
const cssRules = /* @__PURE__ */ new Set();
|
|
3791
|
+
classList.forEach((className) => {
|
|
3792
|
+
const css = compileRuntimeClassNameWithContext(className, context);
|
|
3793
|
+
if (css) {
|
|
3794
|
+
cssRules.add(css);
|
|
3795
|
+
}
|
|
3796
|
+
});
|
|
3797
|
+
return Array.from(cssRules).join("\n");
|
|
3798
|
+
}
|
|
3799
|
+
function extractClassNames(html) {
|
|
3800
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
3801
|
+
const classRegex = /class(?:Name)?=["']([^"']+)["']/g;
|
|
3802
|
+
let match;
|
|
3803
|
+
while ((match = classRegex.exec(html)) !== null) {
|
|
3804
|
+
const classes = match[1].split(/\s+/).filter(Boolean);
|
|
3805
|
+
classes.forEach((cls) => classSet.add(cls));
|
|
3806
|
+
}
|
|
3807
|
+
return Array.from(classSet);
|
|
3808
|
+
}
|
|
3911
3809
|
|
|
3912
3810
|
// src/preflight.js
|
|
3913
3811
|
var preflight = `
|
|
@@ -3981,6 +3879,9 @@ function createWindrunner(options = {}) {
|
|
|
3981
3879
|
const preflight2 = options.preflight !== false;
|
|
3982
3880
|
const compatMode = options.compatMode || "none";
|
|
3983
3881
|
const compatStyleId = options.compatStyleId || `${styleId}-full`;
|
|
3882
|
+
const maxCacheSize = options.maxCacheSize || 1e4;
|
|
3883
|
+
const onError = typeof options.onError === "function" ? options.onError : null;
|
|
3884
|
+
const onCompile = typeof options.onCompile === "function" ? options.onCompile : null;
|
|
3984
3885
|
const tailwindOptions = getBaseTailwindOptions(options);
|
|
3985
3886
|
const context = resolveRuntimeContext(tailwindOptions);
|
|
3986
3887
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -4026,6 +3927,10 @@ function createWindrunner(options = {}) {
|
|
|
4026
3927
|
const compileWithCache = (className) => {
|
|
4027
3928
|
if (cache.has(className)) return cache.get(className);
|
|
4028
3929
|
const cssRule = compileRuntimeClassNameWithContext(className, context);
|
|
3930
|
+
if (cache.size >= maxCacheSize) {
|
|
3931
|
+
const firstKey = cache.keys().next().value;
|
|
3932
|
+
cache.delete(firstKey);
|
|
3933
|
+
}
|
|
4029
3934
|
cache.set(className, cssRule);
|
|
4030
3935
|
return cssRule;
|
|
4031
3936
|
};
|
|
@@ -4048,8 +3953,19 @@ function createWindrunner(options = {}) {
|
|
|
4048
3953
|
const cssRule = compileWithCache(className);
|
|
4049
3954
|
if (!cssRule) {
|
|
4050
3955
|
ensureCompatStyle();
|
|
3956
|
+
if (onError) {
|
|
3957
|
+
const parsed = parseClass(className, context.screens, context.containers);
|
|
3958
|
+
const errorContext = {
|
|
3959
|
+
reason: parsed ? "unknown-utility" : "parse-error",
|
|
3960
|
+
baseToken: parsed ? parsed.baseToken : className,
|
|
3961
|
+
variants: parsed ? parsed.variants : void 0,
|
|
3962
|
+
details: parsed ? `Could not compile utility "${parsed.baseToken}"${parsed.variants.length ? ` with variants: ${parsed.variants.join(", ")}` : ""}` : `Failed to parse class name "${className}"`
|
|
3963
|
+
};
|
|
3964
|
+
onError(className, errorContext);
|
|
3965
|
+
}
|
|
4051
3966
|
} else {
|
|
4052
3967
|
insertRule(cssRule);
|
|
3968
|
+
if (onCompile) onCompile(className, cssRule);
|
|
4053
3969
|
}
|
|
4054
3970
|
return cssRule;
|
|
4055
3971
|
};
|
|
@@ -4070,9 +3986,39 @@ function createWindrunner(options = {}) {
|
|
|
4070
3986
|
};
|
|
4071
3987
|
const scan = (root = document) => {
|
|
4072
3988
|
if (typeof document !== "object" || !root) return;
|
|
4073
|
-
|
|
3989
|
+
const startTime = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
3990
|
+
const scannedElements = /* @__PURE__ */ new Set();
|
|
3991
|
+
const foundClasses = /* @__PURE__ */ new Set();
|
|
3992
|
+
const initialRuleCount = insertedRules.size;
|
|
3993
|
+
if (root.nodeType === 1) {
|
|
3994
|
+
processElementTree(root);
|
|
3995
|
+
if (root.classList) {
|
|
3996
|
+
scannedElements.add(root);
|
|
3997
|
+
root.classList.forEach((cls) => foundClasses.add(cls));
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4074
4000
|
const elements = root.querySelectorAll ? root.querySelectorAll("[class]") : [];
|
|
4075
|
-
elements.forEach((element) =>
|
|
4001
|
+
elements.forEach((element) => {
|
|
4002
|
+
processElement(element);
|
|
4003
|
+
scannedElements.add(element);
|
|
4004
|
+
if (element.classList) {
|
|
4005
|
+
element.classList.forEach((cls) => foundClasses.add(cls));
|
|
4006
|
+
}
|
|
4007
|
+
});
|
|
4008
|
+
if (typeof options.onScanComplete === "function") {
|
|
4009
|
+
const endTime = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
4010
|
+
const stats = {
|
|
4011
|
+
elementCount: scannedElements.size,
|
|
4012
|
+
classCount: foundClasses.size,
|
|
4013
|
+
ruleCount: insertedRules.size - initialRuleCount,
|
|
4014
|
+
duration: endTime - startTime
|
|
4015
|
+
};
|
|
4016
|
+
if (typeof requestAnimationFrame === "function") {
|
|
4017
|
+
requestAnimationFrame(() => options.onScanComplete(stats));
|
|
4018
|
+
} else {
|
|
4019
|
+
setTimeout(() => options.onScanComplete(stats), 0);
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4076
4022
|
};
|
|
4077
4023
|
const flushQueue = () => {
|
|
4078
4024
|
scheduled = false;
|
|
@@ -4105,12 +4051,18 @@ function createWindrunner(options = {}) {
|
|
|
4105
4051
|
});
|
|
4106
4052
|
scheduleFlush();
|
|
4107
4053
|
});
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4054
|
+
const observerConfig = options.observerOptions || {};
|
|
4055
|
+
const finalConfig = {
|
|
4056
|
+
childList: observerConfig.childList !== false,
|
|
4057
|
+
// default: true
|
|
4058
|
+
subtree: observerConfig.subtree !== false,
|
|
4059
|
+
// default: true
|
|
4060
|
+
attributes: observerConfig.attributes !== false,
|
|
4061
|
+
// default: true
|
|
4062
|
+
attributeFilter: observerConfig.attributeFilter || ["class"]
|
|
4063
|
+
// default: ["class"]
|
|
4064
|
+
};
|
|
4065
|
+
observer.observe(root, finalConfig);
|
|
4114
4066
|
};
|
|
4115
4067
|
const disconnect = () => {
|
|
4116
4068
|
pendingElements.clear();
|
|
@@ -4152,6 +4104,16 @@ function createWindrunner(options = {}) {
|
|
|
4152
4104
|
}
|
|
4153
4105
|
runStart();
|
|
4154
4106
|
};
|
|
4107
|
+
const clearCache = () => {
|
|
4108
|
+
cache.clear();
|
|
4109
|
+
};
|
|
4110
|
+
const getStats = () => ({
|
|
4111
|
+
cacheSize: cache.size,
|
|
4112
|
+
insertedRuleCount: insertedRules.size,
|
|
4113
|
+
pendingElementCount: pendingElements.size,
|
|
4114
|
+
isObserving: observer !== null,
|
|
4115
|
+
isCompatLoaded: compatLoaded
|
|
4116
|
+
});
|
|
4155
4117
|
return {
|
|
4156
4118
|
processClassName,
|
|
4157
4119
|
processClassList,
|
|
@@ -4161,6 +4123,8 @@ function createWindrunner(options = {}) {
|
|
|
4161
4123
|
flush,
|
|
4162
4124
|
start,
|
|
4163
4125
|
disconnect,
|
|
4126
|
+
clearCache,
|
|
4127
|
+
getStats,
|
|
4164
4128
|
isCompatLoaded: () => compatLoaded,
|
|
4165
4129
|
getCacheSize: () => cache.size,
|
|
4166
4130
|
getInsertedRuleCount: () => insertedRules.size
|
|
@@ -4175,10 +4139,13 @@ function windrunner(options = {}) {
|
|
|
4175
4139
|
}
|
|
4176
4140
|
export {
|
|
4177
4141
|
compileClass,
|
|
4142
|
+
compileCriticalCss,
|
|
4178
4143
|
createWindrunner,
|
|
4179
4144
|
defineResponsiveUtilities,
|
|
4180
4145
|
defineUtilities,
|
|
4146
|
+
extractClassNames,
|
|
4181
4147
|
parseClass,
|
|
4182
4148
|
plugin,
|
|
4183
4149
|
windrunner
|
|
4184
4150
|
};
|
|
4151
|
+
//# sourceMappingURL=index.esm.js.map
|