windrunner 1.0.0 → 1.0.2
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 +8 -1
- package/dist/index.esm.js +260 -52
- package/dist/index.js +260 -52
- package/dist/index.min.js +3 -3
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -42,11 +42,18 @@ npm install windrunner
|
|
|
42
42
|
|
|
43
43
|
```html
|
|
44
44
|
<script type="module">
|
|
45
|
-
import { windrunner } from "https://cdn.jsdelivr.net/npm/windrunner@1.0.
|
|
45
|
+
import { windrunner } from "https://cdn.jsdelivr.net/npm/windrunner@1.0.1/dist/index.min.js";
|
|
46
46
|
windrunner({ autoStart: true });
|
|
47
47
|
</script>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### Live demo / Example landing page
|
|
51
|
+
|
|
52
|
+
Try the example landing page:
|
|
53
|
+
|
|
54
|
+
- CodeSandbox (example landing): https://xj6q66.csb.app
|
|
55
|
+
|
|
56
|
+
|
|
50
57
|
### React / Vue
|
|
51
58
|
|
|
52
59
|
```js
|
package/dist/index.esm.js
CHANGED
|
@@ -728,6 +728,7 @@ var theme = {
|
|
|
728
728
|
},
|
|
729
729
|
grayscale: {
|
|
730
730
|
0: "0",
|
|
731
|
+
50: "0.5",
|
|
731
732
|
DEFAULT: "100%"
|
|
732
733
|
},
|
|
733
734
|
gridAutoColumns: {
|
|
@@ -918,6 +919,7 @@ var theme = {
|
|
|
918
919
|
}),
|
|
919
920
|
invert: {
|
|
920
921
|
0: "0",
|
|
922
|
+
50: "0.5",
|
|
921
923
|
DEFAULT: "100%"
|
|
922
924
|
},
|
|
923
925
|
letterSpacing: {
|
|
@@ -1142,6 +1144,7 @@ var theme = {
|
|
|
1142
1144
|
scrollPadding: ({ theme: theme2 }) => theme2("spacing"),
|
|
1143
1145
|
sepia: {
|
|
1144
1146
|
0: "0",
|
|
1147
|
+
50: "0.5",
|
|
1145
1148
|
DEFAULT: "100%"
|
|
1146
1149
|
},
|
|
1147
1150
|
skew: {
|
|
@@ -1414,12 +1417,7 @@ function getConfigOptions(options = {}, pluginKeys = []) {
|
|
|
1414
1417
|
const newTheme = {};
|
|
1415
1418
|
const themeKeys = Object.keys(config_default.theme);
|
|
1416
1419
|
themeKeys.forEach((key) => {
|
|
1417
|
-
newTheme[key] = theme2[key]
|
|
1418
|
-
if (isFunction(newTheme[key])) {
|
|
1419
|
-
newTheme[key] = newTheme[key]({
|
|
1420
|
-
theme: (keyRef) => config_default.theme[keyRef]
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1420
|
+
newTheme[key] = Object.prototype.hasOwnProperty.call(theme2, key) ? theme2[key] : config_default.theme[key];
|
|
1423
1421
|
});
|
|
1424
1422
|
themeKeys.forEach((key) => {
|
|
1425
1423
|
if (isFunction(newTheme[key])) {
|
|
@@ -1643,6 +1641,65 @@ var BOX_SIZING_MAP = {
|
|
|
1643
1641
|
border: "box-sizing: border-box;",
|
|
1644
1642
|
content: "box-sizing: content-box;"
|
|
1645
1643
|
};
|
|
1644
|
+
var BREAK_AFTER_MAP = {
|
|
1645
|
+
auto: "break-after: auto;",
|
|
1646
|
+
avoid: "break-after: avoid;",
|
|
1647
|
+
"avoid-page": "break-after: avoid-page;",
|
|
1648
|
+
"avoid-column": "break-after: avoid-column;",
|
|
1649
|
+
page: "break-after: page;",
|
|
1650
|
+
all: "break-after: all;",
|
|
1651
|
+
left: "break-after: left;",
|
|
1652
|
+
right: "break-after: right;",
|
|
1653
|
+
recto: "break-after: recto;",
|
|
1654
|
+
verso: "break-after: verso;"
|
|
1655
|
+
};
|
|
1656
|
+
var BREAK_BEFORE_MAP = {
|
|
1657
|
+
auto: "break-before: auto;",
|
|
1658
|
+
avoid: "break-before: avoid;",
|
|
1659
|
+
"avoid-page": "break-before: avoid-page;",
|
|
1660
|
+
"avoid-column": "break-before: avoid-column;",
|
|
1661
|
+
page: "break-before: page;",
|
|
1662
|
+
left: "break-before: left;",
|
|
1663
|
+
right: "break-before: right;",
|
|
1664
|
+
recto: "break-before: recto;",
|
|
1665
|
+
verso: "break-before: verso;"
|
|
1666
|
+
};
|
|
1667
|
+
var BREAK_INSIDE_MAP = {
|
|
1668
|
+
auto: "break-inside: auto;",
|
|
1669
|
+
avoid: "break-inside: avoid;",
|
|
1670
|
+
"avoid-page": "break-inside: avoid-page;",
|
|
1671
|
+
"avoid-column": "break-inside: avoid-column;"
|
|
1672
|
+
};
|
|
1673
|
+
var BOX_DECORATION_BREAK_MAP = {
|
|
1674
|
+
slice: "box-decoration-break: slice;",
|
|
1675
|
+
clone: "box-decoration-break: clone;"
|
|
1676
|
+
};
|
|
1677
|
+
var HYPHENS_MAP = {
|
|
1678
|
+
none: "hyphens: none;",
|
|
1679
|
+
manual: "hyphens: manual;",
|
|
1680
|
+
auto: "hyphens: auto;"
|
|
1681
|
+
};
|
|
1682
|
+
var COLOR_SCHEME_MAP = {
|
|
1683
|
+
light: "color-scheme: light;",
|
|
1684
|
+
dark: "color-scheme: dark;",
|
|
1685
|
+
normal: "color-scheme: normal;"
|
|
1686
|
+
};
|
|
1687
|
+
var SCROLLBAR_COLOR_MAP = {
|
|
1688
|
+
auto: "scrollbar-color: auto;",
|
|
1689
|
+
transparent: "scrollbar-color: transparent;",
|
|
1690
|
+
current: "scrollbar-color: currentColor;"
|
|
1691
|
+
};
|
|
1692
|
+
var SCROLLBAR_WIDTH_MAP = {
|
|
1693
|
+
auto: "scrollbar-width: auto;",
|
|
1694
|
+
thin: "scrollbar-width: thin;",
|
|
1695
|
+
none: "scrollbar-width: none;"
|
|
1696
|
+
};
|
|
1697
|
+
var SCROLLBAR_GUTTER_MAP = {
|
|
1698
|
+
auto: "scrollbar-gutter: auto;",
|
|
1699
|
+
stable: "scrollbar-gutter: stable;",
|
|
1700
|
+
"stable-both-edges": "scrollbar-gutter: stable both-edges;",
|
|
1701
|
+
"both-edges": "scrollbar-gutter: both-edges;"
|
|
1702
|
+
};
|
|
1646
1703
|
var TABLE_LAYOUT_MAP = {
|
|
1647
1704
|
auto: "table-layout: auto;",
|
|
1648
1705
|
fixed: "table-layout: fixed;"
|
|
@@ -1799,6 +1856,16 @@ function buildLayoutDeclaration(baseToken, theme2) {
|
|
|
1799
1856
|
const val = resolveThemeValue(theme2.order || {}, baseToken.slice(6));
|
|
1800
1857
|
if (val !== void 0) return `order: ${val};`;
|
|
1801
1858
|
}
|
|
1859
|
+
if (baseToken.startsWith("break-after-")) return BREAK_AFTER_MAP[baseToken.slice(12)] ?? void 0;
|
|
1860
|
+
if (baseToken.startsWith("break-before-")) return BREAK_BEFORE_MAP[baseToken.slice(13)] ?? void 0;
|
|
1861
|
+
if (baseToken.startsWith("break-inside-")) return BREAK_INSIDE_MAP[baseToken.slice(13)] ?? void 0;
|
|
1862
|
+
if (baseToken.startsWith("box-decoration-break-")) return BOX_DECORATION_BREAK_MAP[baseToken.slice(21)] ?? void 0;
|
|
1863
|
+
if (baseToken.startsWith("hyphens-")) return HYPHENS_MAP[baseToken.slice(8)] ?? void 0;
|
|
1864
|
+
if (baseToken.startsWith("color-scheme-")) return COLOR_SCHEME_MAP[baseToken.slice(13)] ?? void 0;
|
|
1865
|
+
if (baseToken.startsWith("scrollbar-color-")) return SCROLLBAR_COLOR_MAP[baseToken.slice(16)] ?? void 0;
|
|
1866
|
+
if (baseToken.startsWith("scrollbar-width-")) return SCROLLBAR_WIDTH_MAP[baseToken.slice(16)] ?? void 0;
|
|
1867
|
+
if (baseToken.startsWith("scrollbar-gutter-")) return SCROLLBAR_GUTTER_MAP[baseToken.slice(17)] ?? void 0;
|
|
1868
|
+
if (baseToken.startsWith("scroll-behavior-")) return SCROLL_BEHAVIOR_MAP[baseToken.slice(16)] ?? void 0;
|
|
1802
1869
|
if (baseToken.startsWith("aspect-")) {
|
|
1803
1870
|
const val = resolveThemeValue(theme2.aspectRatio || {}, baseToken.slice(7));
|
|
1804
1871
|
if (val !== void 0) return `aspect-ratio: ${val};`;
|
|
@@ -1845,10 +1912,14 @@ function buildLayoutDeclaration(baseToken, theme2) {
|
|
|
1845
1912
|
if (val !== void 0) return `will-change: ${val};`;
|
|
1846
1913
|
}
|
|
1847
1914
|
if (baseToken.startsWith("content-")) {
|
|
1848
|
-
const
|
|
1849
|
-
if (
|
|
1850
|
-
|
|
1851
|
-
|
|
1915
|
+
const valueKey = baseToken.slice(8);
|
|
1916
|
+
if (valueKey.startsWith("[") && valueKey.endsWith("]")) {
|
|
1917
|
+
const arb = resolveArbitraryValue(valueKey);
|
|
1918
|
+
if (arb !== void 0) return `content: ${arb};`;
|
|
1919
|
+
} else {
|
|
1920
|
+
const val = resolveThemeValue(theme2.content || {}, valueKey);
|
|
1921
|
+
if (val !== void 0) return `content: "${val}";`;
|
|
1922
|
+
}
|
|
1852
1923
|
}
|
|
1853
1924
|
if (baseToken.startsWith("size-")) {
|
|
1854
1925
|
const val = resolveThemeValue(theme2.size || theme2.spacing || {}, baseToken.slice(5));
|
|
@@ -1931,6 +2002,12 @@ function buildGapDeclaration(baseToken, theme2) {
|
|
|
1931
2002
|
}
|
|
1932
2003
|
function buildDimensionDeclaration(baseToken, theme2) {
|
|
1933
2004
|
const patterns = [
|
|
2005
|
+
{ prefix: "min-inline-size-", prop: "min-inline-size", scale: theme2.minWidth || theme2.width || theme2.spacing || {} },
|
|
2006
|
+
{ prefix: "max-inline-size-", prop: "max-inline-size", scale: theme2.maxWidth || theme2.width || theme2.spacing || {} },
|
|
2007
|
+
{ prefix: "inline-size-", prop: "inline-size", scale: theme2.width || theme2.spacing || {} },
|
|
2008
|
+
{ prefix: "min-block-size-", prop: "min-block-size", scale: theme2.minHeight || theme2.height || theme2.spacing || {} },
|
|
2009
|
+
{ prefix: "max-block-size-", prop: "max-block-size", scale: theme2.maxHeight || theme2.height || theme2.spacing || {} },
|
|
2010
|
+
{ prefix: "block-size-", prop: "block-size", scale: theme2.height || theme2.spacing || {} },
|
|
1934
2011
|
{ prefix: "min-w-", prop: "min-width", scale: theme2.minWidth || theme2.width || {} },
|
|
1935
2012
|
{ prefix: "max-w-", prop: "max-width", scale: theme2.maxWidth || theme2.width || {} },
|
|
1936
2013
|
{ prefix: "min-h-", prop: "min-height", scale: theme2.minHeight || theme2.height || {} },
|
|
@@ -2002,6 +2079,7 @@ var JUSTIFY_CONTENT_MAP = {
|
|
|
2002
2079
|
stretch: "justify-content: stretch;"
|
|
2003
2080
|
};
|
|
2004
2081
|
var JUSTIFY_ITEMS_MAP = {
|
|
2082
|
+
normal: "justify-items: normal;",
|
|
2005
2083
|
start: "justify-items: start;",
|
|
2006
2084
|
end: "justify-items: end;",
|
|
2007
2085
|
center: "justify-items: center;",
|
|
@@ -2175,6 +2253,7 @@ var TEXT_TRANSFORM_MAP = {
|
|
|
2175
2253
|
};
|
|
2176
2254
|
var TEXT_OVERFLOW_MAP = {
|
|
2177
2255
|
truncate: "overflow: hidden; text-overflow: ellipsis; white-space: nowrap;",
|
|
2256
|
+
"overflow-ellipsis": "text-overflow: ellipsis;",
|
|
2178
2257
|
"text-ellipsis": "text-overflow: ellipsis;",
|
|
2179
2258
|
"text-clip": "text-overflow: clip;"
|
|
2180
2259
|
};
|
|
@@ -2196,6 +2275,35 @@ var FONT_STYLE_MAP = {
|
|
|
2196
2275
|
italic: "font-style: italic;",
|
|
2197
2276
|
"not-italic": "font-style: normal;"
|
|
2198
2277
|
};
|
|
2278
|
+
var FONT_STRETCH_MAP = {
|
|
2279
|
+
"ultra-condensed": "font-stretch: ultra-condensed;",
|
|
2280
|
+
"extra-condensed": "font-stretch: extra-condensed;",
|
|
2281
|
+
condensed: "font-stretch: condensed;",
|
|
2282
|
+
"semi-condensed": "font-stretch: semi-condensed;",
|
|
2283
|
+
normal: "font-stretch: normal;",
|
|
2284
|
+
"semi-expanded": "font-stretch: semi-expanded;",
|
|
2285
|
+
expanded: "font-stretch: expanded;",
|
|
2286
|
+
"extra-expanded": "font-stretch: extra-expanded;",
|
|
2287
|
+
"ultra-expanded": "font-stretch: ultra-expanded;"
|
|
2288
|
+
};
|
|
2289
|
+
var FONT_VARIANT_NUMERIC_MAP = {
|
|
2290
|
+
ordinal: "font-variant-numeric: ordinal;",
|
|
2291
|
+
"slashed-zero": "font-variant-numeric: slashed-zero;",
|
|
2292
|
+
"lining-nums": "font-variant-numeric: lining-nums;",
|
|
2293
|
+
"oldstyle-nums": "font-variant-numeric: oldstyle-nums;",
|
|
2294
|
+
"proportional-nums": "font-variant-numeric: proportional-nums;",
|
|
2295
|
+
"tabular-nums": "font-variant-numeric: tabular-nums;",
|
|
2296
|
+
"diagonal-fractions": "font-variant-numeric: diagonal-fractions;",
|
|
2297
|
+
"stacked-fractions": "font-variant-numeric: stacked-fractions;"
|
|
2298
|
+
};
|
|
2299
|
+
var LIST_STYLE_IMAGE_MAP = {
|
|
2300
|
+
none: "list-style-image: none;"
|
|
2301
|
+
};
|
|
2302
|
+
var HYPHENS_MAP2 = {
|
|
2303
|
+
none: "hyphens: none;",
|
|
2304
|
+
manual: "hyphens: manual;",
|
|
2305
|
+
auto: "hyphens: auto;"
|
|
2306
|
+
};
|
|
2199
2307
|
var FONT_SMOOTHING_MAP = {
|
|
2200
2308
|
antialiased: "-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;",
|
|
2201
2309
|
"subpixel-antialiased": "-webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto;"
|
|
@@ -2244,6 +2352,12 @@ function buildTypographyDeclaration(baseToken, theme2) {
|
|
|
2244
2352
|
return `font-family: ${fontFamily};`;
|
|
2245
2353
|
}
|
|
2246
2354
|
}
|
|
2355
|
+
if (baseToken.startsWith("font-stretch-")) {
|
|
2356
|
+
return FONT_STRETCH_MAP[baseToken.slice(13)] ?? void 0;
|
|
2357
|
+
}
|
|
2358
|
+
if (baseToken.startsWith("font-variant-numeric-")) {
|
|
2359
|
+
return FONT_VARIANT_NUMERIC_MAP[baseToken.slice(21)] ?? void 0;
|
|
2360
|
+
}
|
|
2247
2361
|
if (baseToken.startsWith("leading-")) {
|
|
2248
2362
|
const val = resolveThemeValue(theme2.lineHeight || {}, baseToken.slice(8));
|
|
2249
2363
|
if (val !== void 0) return `line-height: ${val};`;
|
|
@@ -2271,13 +2385,18 @@ function buildTypographyDeclaration(baseToken, theme2) {
|
|
|
2271
2385
|
if (baseToken.startsWith("list-")) {
|
|
2272
2386
|
const key = baseToken.slice(5);
|
|
2273
2387
|
if (LIST_STYLE_POSITION_MAP[key]) return LIST_STYLE_POSITION_MAP[key];
|
|
2388
|
+
if (LIST_STYLE_IMAGE_MAP[baseToken]) return LIST_STYLE_IMAGE_MAP[baseToken.slice(17)] ?? void 0;
|
|
2274
2389
|
const val = resolveThemeValue(theme2.listStyleType || {}, key);
|
|
2275
2390
|
if (val !== void 0) return `list-style-type: ${val};`;
|
|
2276
2391
|
}
|
|
2392
|
+
if (baseToken.startsWith("list-style-image-")) {
|
|
2393
|
+
return LIST_STYLE_IMAGE_MAP[baseToken.slice(17)] ?? void 0;
|
|
2394
|
+
}
|
|
2277
2395
|
if (baseToken.startsWith("whitespace-")) {
|
|
2278
2396
|
const key = baseToken.slice(11);
|
|
2279
2397
|
if (WHITESPACE_MAP[key]) return WHITESPACE_MAP[key];
|
|
2280
2398
|
}
|
|
2399
|
+
if (baseToken.startsWith("hyphens-")) return HYPHENS_MAP2[baseToken.slice(8)] ?? void 0;
|
|
2281
2400
|
if (baseToken === "text-wrap") return "text-wrap: wrap;";
|
|
2282
2401
|
if (baseToken === "text-nowrap") return "text-wrap: nowrap;";
|
|
2283
2402
|
if (baseToken === "text-balance") return "text-wrap: balance;";
|
|
@@ -2416,6 +2535,48 @@ var PERSPECTIVE_MAP = {
|
|
|
2416
2535
|
midrange: "perspective: 800px;",
|
|
2417
2536
|
distant: "perspective: 1200px;"
|
|
2418
2537
|
};
|
|
2538
|
+
var PERSPECTIVE_ORIGIN_MAP = {
|
|
2539
|
+
center: "perspective-origin: center;",
|
|
2540
|
+
top: "perspective-origin: top;",
|
|
2541
|
+
bottom: "perspective-origin: bottom;",
|
|
2542
|
+
left: "perspective-origin: left;",
|
|
2543
|
+
right: "perspective-origin: right;",
|
|
2544
|
+
"top-left": "perspective-origin: top left;",
|
|
2545
|
+
"top-right": "perspective-origin: top right;",
|
|
2546
|
+
"bottom-left": "perspective-origin: bottom left;",
|
|
2547
|
+
"bottom-right": "perspective-origin: bottom right;"
|
|
2548
|
+
};
|
|
2549
|
+
var MASK_CLIP_MAP = {
|
|
2550
|
+
"mask-clip-border": "mask-clip: border; -webkit-mask-clip: border;",
|
|
2551
|
+
"mask-clip-padding": "mask-clip: padding; -webkit-mask-clip: padding;",
|
|
2552
|
+
"mask-clip-content": "mask-clip: content; -webkit-mask-clip: content;",
|
|
2553
|
+
"mask-clip-text": "mask-clip: text; -webkit-mask-clip: text;"
|
|
2554
|
+
};
|
|
2555
|
+
var MASK_COMPOSITE_MAP = {
|
|
2556
|
+
"mask-composite-add": "mask-composite: add; -webkit-mask-composite: add;",
|
|
2557
|
+
"mask-composite-subtract": "mask-composite: subtract; -webkit-mask-composite: subtract;",
|
|
2558
|
+
"mask-composite-intersect": "mask-composite: intersect; -webkit-mask-composite: intersect;",
|
|
2559
|
+
"mask-composite-exclude": "mask-composite: exclude; -webkit-mask-composite: exclude;",
|
|
2560
|
+
"mask-composite-replace": "mask-composite: replace; -webkit-mask-composite: replace;",
|
|
2561
|
+
"mask-composite-xor": "mask-composite: xor; -webkit-mask-composite: xor;"
|
|
2562
|
+
};
|
|
2563
|
+
var MASK_MODE_MAP = {
|
|
2564
|
+
"mask-mode-alpha": "mask-mode: alpha; -webkit-mask-mode: alpha;",
|
|
2565
|
+
"mask-mode-luminance": "mask-mode: luminance; -webkit-mask-mode: luminance;",
|
|
2566
|
+
"mask-mode-match-source": "mask-mode: match-source; -webkit-mask-mode: match-source;"
|
|
2567
|
+
};
|
|
2568
|
+
var MASK_ORIGIN_MAP = {
|
|
2569
|
+
"mask-origin-border": "mask-origin: border-box; -webkit-mask-origin: border-box;",
|
|
2570
|
+
"mask-origin-padding": "mask-origin: padding-box; -webkit-mask-origin: padding-box;",
|
|
2571
|
+
"mask-origin-content": "mask-origin: content-box; -webkit-mask-origin: content-box;",
|
|
2572
|
+
"mask-origin-fill": "mask-origin: fill-box; -webkit-mask-origin: fill-box;",
|
|
2573
|
+
"mask-origin-stroke": "mask-origin: stroke-box; -webkit-mask-origin: stroke-box;",
|
|
2574
|
+
"mask-origin-view": "mask-origin: view-box; -webkit-mask-origin: view-box;"
|
|
2575
|
+
};
|
|
2576
|
+
var MASK_TYPE_MAP = {
|
|
2577
|
+
"mask-type-luminance": "mask-type: luminance; -webkit-mask-type: luminance;",
|
|
2578
|
+
"mask-type-alpha": "mask-type: alpha; -webkit-mask-type: alpha;"
|
|
2579
|
+
};
|
|
2419
2580
|
var MASK_LINEAR_MAP = {
|
|
2420
2581
|
"mask-linear-to-t": "mask-image: linear-gradient(to top, black, transparent); -webkit-mask-image: linear-gradient(to top, black, transparent);",
|
|
2421
2582
|
"mask-linear-to-tr": "mask-image: linear-gradient(to top right, black, transparent); -webkit-mask-image: linear-gradient(to top right, black, transparent);",
|
|
@@ -2540,11 +2701,14 @@ function buildShadowDeclaration(baseToken, theme2) {
|
|
|
2540
2701
|
}
|
|
2541
2702
|
if (!baseToken.startsWith("shadow-")) return void 0;
|
|
2542
2703
|
const valueKey = baseToken.slice(7);
|
|
2543
|
-
const
|
|
2544
|
-
if (
|
|
2704
|
+
const arb = resolveArbitraryValue(valueKey);
|
|
2705
|
+
if (arb !== void 0) return `box-shadow: ${arb};`;
|
|
2545
2706
|
const value = resolveThemeValue(theme2.boxShadow || {}, valueKey);
|
|
2546
|
-
if (value
|
|
2547
|
-
|
|
2707
|
+
if (value !== void 0) return `box-shadow: ${value};`;
|
|
2708
|
+
const colorScale = theme2.boxShadowColor || theme2.colors || {};
|
|
2709
|
+
const color = resolveColorWithOpacity(colorScale, valueKey);
|
|
2710
|
+
if (color !== void 0) return `--tw-shadow-color: ${color};`;
|
|
2711
|
+
return void 0;
|
|
2548
2712
|
}
|
|
2549
2713
|
function buildInsetShadowDeclaration(baseToken, theme2) {
|
|
2550
2714
|
if (baseToken === "inset-shadow") return INSET_SHADOW_SIZES.DEFAULT;
|
|
@@ -2612,7 +2776,10 @@ function buildRingOffsetDeclaration(baseToken, theme2) {
|
|
|
2612
2776
|
if (widthVal !== void 0) {
|
|
2613
2777
|
return `--tw-ring-offset-width: ${widthVal}; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color, #fff), var(--tw-ring-shadow, 0 0 #0000);`;
|
|
2614
2778
|
}
|
|
2615
|
-
|
|
2779
|
+
let color = resolveColorWithOpacity(theme2.ringOffsetColor || {}, key);
|
|
2780
|
+
if (color === void 0) {
|
|
2781
|
+
color = resolveColorWithOpacity(theme2.colors || {}, key);
|
|
2782
|
+
}
|
|
2616
2783
|
if (color !== void 0) return `--tw-ring-offset-color: ${color};`;
|
|
2617
2784
|
return void 0;
|
|
2618
2785
|
}
|
|
@@ -2733,6 +2900,12 @@ function buildTransformDeclaration(baseToken, theme2) {
|
|
|
2733
2900
|
const val = resolveThemeValue(theme2.transformOrigin || {}, normalized.slice(7));
|
|
2734
2901
|
if (val !== void 0) return `transform-origin: ${val};`;
|
|
2735
2902
|
}
|
|
2903
|
+
if (normalized.startsWith("perspective-origin-")) {
|
|
2904
|
+
const key = normalized.slice(19);
|
|
2905
|
+
if (PERSPECTIVE_ORIGIN_MAP[key]) return PERSPECTIVE_ORIGIN_MAP[key];
|
|
2906
|
+
const arb = resolveArbitraryValue(key);
|
|
2907
|
+
if (arb !== void 0) return `perspective-origin: ${arb};`;
|
|
2908
|
+
}
|
|
2736
2909
|
if (normalized.startsWith("perspective-")) {
|
|
2737
2910
|
const key = normalized.slice(12);
|
|
2738
2911
|
if (PERSPECTIVE_MAP[key]) return PERSPECTIVE_MAP[key];
|
|
@@ -2756,15 +2929,26 @@ function buildFilterDeclaration(baseToken, theme2) {
|
|
|
2756
2929
|
}
|
|
2757
2930
|
return theme2[key] || {};
|
|
2758
2931
|
};
|
|
2932
|
+
if (rest === "filter") {
|
|
2933
|
+
return `${prefix}: none;`;
|
|
2934
|
+
}
|
|
2759
2935
|
if (rest === "blur" || rest.startsWith("blur-")) {
|
|
2760
2936
|
const key = rest === "blur" ? "DEFAULT" : rest.slice(5);
|
|
2761
2937
|
const val = resolveThemeValue(getScale("blur"), key);
|
|
2762
2938
|
if (val !== void 0) return `${prefix}: blur(${val});`;
|
|
2763
2939
|
}
|
|
2940
|
+
if (rest === "brightness") {
|
|
2941
|
+
const val = resolveThemeValue(getScale("brightness"), "100") || resolveThemeValue(getScale("brightness"), "DEFAULT") || "1";
|
|
2942
|
+
return `${prefix}: brightness(${val});`;
|
|
2943
|
+
}
|
|
2764
2944
|
if (rest.startsWith("brightness-")) {
|
|
2765
2945
|
const val = resolveThemeValue(getScale("brightness"), rest.slice(11));
|
|
2766
2946
|
if (val !== void 0) return `${prefix}: brightness(${val});`;
|
|
2767
2947
|
}
|
|
2948
|
+
if (rest === "contrast") {
|
|
2949
|
+
const val = resolveThemeValue(getScale("contrast"), "100") || resolveThemeValue(getScale("contrast"), "DEFAULT") || "1";
|
|
2950
|
+
return `${prefix}: contrast(${val});`;
|
|
2951
|
+
}
|
|
2768
2952
|
if (rest.startsWith("contrast-")) {
|
|
2769
2953
|
const val = resolveThemeValue(getScale("contrast"), rest.slice(9));
|
|
2770
2954
|
if (val !== void 0) return `${prefix}: contrast(${val});`;
|
|
@@ -2774,6 +2958,10 @@ function buildFilterDeclaration(baseToken, theme2) {
|
|
|
2774
2958
|
const val = resolveThemeValue(getScale("grayscale"), key);
|
|
2775
2959
|
if (val !== void 0) return `${prefix}: grayscale(${val});`;
|
|
2776
2960
|
}
|
|
2961
|
+
if (rest === "hue-rotate") {
|
|
2962
|
+
const val = resolveThemeValue(getScale("hueRotate"), "0") || resolveThemeValue(getScale("hueRotate"), "DEFAULT") || "0deg";
|
|
2963
|
+
return `${prefix}: hue-rotate(${val});`;
|
|
2964
|
+
}
|
|
2777
2965
|
if (rest.startsWith("hue-rotate-")) {
|
|
2778
2966
|
const val = resolveThemeValue(getScale("hueRotate"), rest.slice(11));
|
|
2779
2967
|
if (val !== void 0) {
|
|
@@ -2786,6 +2974,10 @@ function buildFilterDeclaration(baseToken, theme2) {
|
|
|
2786
2974
|
const val = resolveThemeValue(getScale("invert"), key);
|
|
2787
2975
|
if (val !== void 0) return `${prefix}: invert(${val});`;
|
|
2788
2976
|
}
|
|
2977
|
+
if (rest === "saturate") {
|
|
2978
|
+
const val = resolveThemeValue(getScale("saturate"), "100") || resolveThemeValue(getScale("saturate"), "DEFAULT") || "1";
|
|
2979
|
+
return `${prefix}: saturate(${val});`;
|
|
2980
|
+
}
|
|
2789
2981
|
if (rest.startsWith("saturate-")) {
|
|
2790
2982
|
const val = resolveThemeValue(getScale("saturate"), rest.slice(9));
|
|
2791
2983
|
if (val !== void 0) return `${prefix}: saturate(${val});`;
|
|
@@ -2803,6 +2995,10 @@ function buildFilterDeclaration(baseToken, theme2) {
|
|
|
2803
2995
|
const val = resolveThemeValue(theme2.dropShadow || {}, rest.slice(12) || "DEFAULT");
|
|
2804
2996
|
if (val !== void 0) return `filter: drop-shadow(${val});`;
|
|
2805
2997
|
}
|
|
2998
|
+
if (isBackdrop && rest === "opacity") {
|
|
2999
|
+
const val = resolveThemeValue(theme2.backdropOpacity || theme2.opacity || {}, "DEFAULT") || "1";
|
|
3000
|
+
return `backdrop-filter: opacity(${val});`;
|
|
3001
|
+
}
|
|
2806
3002
|
if (isBackdrop && rest.startsWith("opacity-")) {
|
|
2807
3003
|
const val = resolveThemeValue(theme2.backdropOpacity || theme2.opacity || {}, rest.slice(8));
|
|
2808
3004
|
if (val !== void 0) return `backdrop-filter: opacity(${val});`;
|
|
@@ -2849,6 +3045,11 @@ function buildAnimationDeclaration(baseToken) {
|
|
|
2849
3045
|
return void 0;
|
|
2850
3046
|
}
|
|
2851
3047
|
function buildMaskDeclaration(baseToken) {
|
|
3048
|
+
if (MASK_CLIP_MAP[baseToken]) return MASK_CLIP_MAP[baseToken];
|
|
3049
|
+
if (MASK_COMPOSITE_MAP[baseToken]) return MASK_COMPOSITE_MAP[baseToken];
|
|
3050
|
+
if (MASK_MODE_MAP[baseToken]) return MASK_MODE_MAP[baseToken];
|
|
3051
|
+
if (MASK_ORIGIN_MAP[baseToken]) return MASK_ORIGIN_MAP[baseToken];
|
|
3052
|
+
if (MASK_TYPE_MAP[baseToken]) return MASK_TYPE_MAP[baseToken];
|
|
2852
3053
|
if (MASK_LINEAR_MAP[baseToken]) return MASK_LINEAR_MAP[baseToken];
|
|
2853
3054
|
if (MASK_REPEAT_MAP[baseToken]) return MASK_REPEAT_MAP[baseToken];
|
|
2854
3055
|
if (MASK_SIZE_MAP[baseToken]) return MASK_SIZE_MAP[baseToken];
|
|
@@ -2881,6 +3082,7 @@ function buildInteractivityDeclaration(baseToken, theme2) {
|
|
|
2881
3082
|
if (baseToken.startsWith("cursor-")) return CURSOR_MAP[baseToken.slice(7)] ?? void 0;
|
|
2882
3083
|
if (baseToken.startsWith("pointer-events-")) return POINTER_EVENTS_MAP[baseToken.slice(15)] ?? void 0;
|
|
2883
3084
|
if (baseToken.startsWith("select-")) return USER_SELECT_MAP[baseToken.slice(7)] ?? void 0;
|
|
3085
|
+
if (baseToken.startsWith("user-select-")) return USER_SELECT_MAP[baseToken.slice(12)] ?? void 0;
|
|
2884
3086
|
if (baseToken.startsWith("appearance-")) {
|
|
2885
3087
|
return APPEARANCE_MAP[baseToken.slice(11)] ? `appearance: ${baseToken.slice(11)};` : void 0;
|
|
2886
3088
|
}
|
|
@@ -2984,6 +3186,12 @@ function buildBlendingDeclaration(baseToken) {
|
|
|
2984
3186
|
}
|
|
2985
3187
|
|
|
2986
3188
|
// src/builders/space-divide.js
|
|
3189
|
+
function childScoped(declaration) {
|
|
3190
|
+
return { __childScoped: true, declaration };
|
|
3191
|
+
}
|
|
3192
|
+
function isChildScoped(result) {
|
|
3193
|
+
return result !== null && typeof result === "object" && result.__childScoped === true;
|
|
3194
|
+
}
|
|
2987
3195
|
function buildSpaceBetweenDeclaration(baseToken, theme2) {
|
|
2988
3196
|
const negative = baseToken.startsWith("-");
|
|
2989
3197
|
const normalized = negative ? baseToken.slice(1) : baseToken;
|
|
@@ -2994,22 +3202,22 @@ function buildSpaceBetweenDeclaration(baseToken, theme2) {
|
|
|
2994
3202
|
let val = resolveThemeValue(theme2.spacing || {}, matchX[1]);
|
|
2995
3203
|
if (val === void 0) return void 0;
|
|
2996
3204
|
if (negative && val !== "0") val = `-${val}`;
|
|
2997
|
-
return [
|
|
3205
|
+
return childScoped([
|
|
2998
3206
|
`--tw-space-x-reverse: 0;`,
|
|
2999
3207
|
`margin-inline-end: calc(${val} * var(--tw-space-x-reverse));`,
|
|
3000
3208
|
`margin-inline-start: calc(${val} * calc(1 - var(--tw-space-x-reverse)));`
|
|
3001
|
-
].join(" ");
|
|
3209
|
+
].join(" "));
|
|
3002
3210
|
}
|
|
3003
3211
|
const matchY = normalized.match(/^space-y-(.+)$/);
|
|
3004
3212
|
if (matchY) {
|
|
3005
3213
|
let val = resolveThemeValue(theme2.spacing || {}, matchY[1]);
|
|
3006
3214
|
if (val === void 0) return void 0;
|
|
3007
3215
|
if (negative && val !== "0") val = `-${val}`;
|
|
3008
|
-
return [
|
|
3216
|
+
return childScoped([
|
|
3009
3217
|
`--tw-space-y-reverse: 0;`,
|
|
3010
3218
|
`margin-bottom: calc(${val} * var(--tw-space-y-reverse));`,
|
|
3011
3219
|
`margin-top: calc(${val} * calc(1 - var(--tw-space-y-reverse)));`
|
|
3012
|
-
].join(" ");
|
|
3220
|
+
].join(" "));
|
|
3013
3221
|
}
|
|
3014
3222
|
return void 0;
|
|
3015
3223
|
}
|
|
@@ -3019,22 +3227,22 @@ function buildDivideDeclaration(baseToken, theme2) {
|
|
|
3019
3227
|
if (key === "x" || key === "x-reverse") {
|
|
3020
3228
|
if (key === "x-reverse") return "--tw-divide-x-reverse: 1;";
|
|
3021
3229
|
const val = resolveThemeValue(theme2.borderWidth || {}, "DEFAULT") || "1px";
|
|
3022
|
-
return `--tw-divide-x-reverse: 0; border-inline-end-width: calc(${val} * var(--tw-divide-x-reverse)); border-inline-start-width: calc(${val} * calc(1 - var(--tw-divide-x-reverse)))
|
|
3230
|
+
return childScoped(`--tw-divide-x-reverse: 0; border-inline-end-width: calc(${val} * var(--tw-divide-x-reverse)); border-inline-start-width: calc(${val} * calc(1 - var(--tw-divide-x-reverse)));`);
|
|
3023
3231
|
}
|
|
3024
3232
|
const matchX = key.match(/^x-(\d+)$/);
|
|
3025
3233
|
if (matchX) {
|
|
3026
3234
|
const val = resolveThemeValue(theme2.borderWidth || {}, matchX[1]);
|
|
3027
|
-
if (val !== void 0) return `--tw-divide-x-reverse: 0; border-inline-end-width: calc(${val} * var(--tw-divide-x-reverse)); border-inline-start-width: calc(${val} * calc(1 - var(--tw-divide-x-reverse)))
|
|
3235
|
+
if (val !== void 0) return childScoped(`--tw-divide-x-reverse: 0; border-inline-end-width: calc(${val} * var(--tw-divide-x-reverse)); border-inline-start-width: calc(${val} * calc(1 - var(--tw-divide-x-reverse)));`);
|
|
3028
3236
|
}
|
|
3029
3237
|
if (key === "y" || key === "y-reverse") {
|
|
3030
3238
|
if (key === "y-reverse") return "--tw-divide-y-reverse: 1;";
|
|
3031
3239
|
const val = resolveThemeValue(theme2.borderWidth || {}, "DEFAULT") || "1px";
|
|
3032
|
-
return `--tw-divide-y-reverse: 0; border-bottom-width: calc(${val} * var(--tw-divide-y-reverse)); border-top-width: calc(${val} * calc(1 - var(--tw-divide-y-reverse)))
|
|
3240
|
+
return childScoped(`--tw-divide-y-reverse: 0; border-bottom-width: calc(${val} * var(--tw-divide-y-reverse)); border-top-width: calc(${val} * calc(1 - var(--tw-divide-y-reverse)));`);
|
|
3033
3241
|
}
|
|
3034
3242
|
const matchY = key.match(/^y-(\d+)$/);
|
|
3035
3243
|
if (matchY) {
|
|
3036
3244
|
const val = resolveThemeValue(theme2.borderWidth || {}, matchY[1]);
|
|
3037
|
-
if (val !== void 0) return `--tw-divide-y-reverse: 0; border-bottom-width: calc(${val} * var(--tw-divide-y-reverse)); border-top-width: calc(${val} * calc(1 - var(--tw-divide-y-reverse)))
|
|
3245
|
+
if (val !== void 0) return childScoped(`--tw-divide-y-reverse: 0; border-bottom-width: calc(${val} * var(--tw-divide-y-reverse)); border-top-width: calc(${val} * calc(1 - var(--tw-divide-y-reverse)));`);
|
|
3038
3246
|
}
|
|
3039
3247
|
if (BORDER_STYLE_MAP[key]) return `border-style: ${BORDER_STYLE_MAP[key].replace("border-style: ", "").replace(";", "")};`;
|
|
3040
3248
|
if (key === "none") return "border-style: none;";
|
|
@@ -3044,10 +3252,10 @@ function buildDivideDeclaration(baseToken, theme2) {
|
|
|
3044
3252
|
if (key === "double") return "border-style: double;";
|
|
3045
3253
|
const colors = theme2.colors || {};
|
|
3046
3254
|
const color = resolveColorWithOpacity(theme2.divideColor || colors, key);
|
|
3047
|
-
if (color !== void 0) return `border-color: ${color}
|
|
3255
|
+
if (color !== void 0) return childScoped(`border-color: ${color};`);
|
|
3048
3256
|
if (key.startsWith("opacity-")) {
|
|
3049
3257
|
const val = resolveThemeValue(theme2.opacity || {}, key.slice(8));
|
|
3050
|
-
if (val !== void 0) return `--tw-divide-opacity: ${val}
|
|
3258
|
+
if (val !== void 0) return childScoped(`--tw-divide-opacity: ${val};`);
|
|
3051
3259
|
}
|
|
3052
3260
|
return void 0;
|
|
3053
3261
|
}
|
|
@@ -3191,8 +3399,8 @@ function resolveRuntimeContext(options = {}) {
|
|
|
3191
3399
|
return {
|
|
3192
3400
|
config,
|
|
3193
3401
|
theme: config.theme || {},
|
|
3194
|
-
screens: config.theme && config.theme.screens || {},
|
|
3195
|
-
containers: config.theme && config.theme.containers || {}
|
|
3402
|
+
screens: config.theme && config.theme.screens || config.screens || {},
|
|
3403
|
+
containers: config.theme && config.theme.containers || config.containers || {}
|
|
3196
3404
|
};
|
|
3197
3405
|
}
|
|
3198
3406
|
function getBaseTailwindOptions(options = {}) {
|
|
@@ -3241,28 +3449,22 @@ function compileRuntimeClassNameWithContext(className, context) {
|
|
|
3241
3449
|
const selector = `.${escapeCssIdentifier(parsed.original)}`;
|
|
3242
3450
|
const variantSelector = applyVariants(selector, parsed.variants);
|
|
3243
3451
|
if (!variantSelector) return "";
|
|
3244
|
-
const finalDeclaration = appendImportant(
|
|
3245
|
-
|
|
3246
|
-
|
|
3452
|
+
const finalDeclaration = appendImportant(
|
|
3453
|
+
isChildScoped(declaration) ? declaration.declaration : declaration,
|
|
3454
|
+
parsed.important
|
|
3455
|
+
);
|
|
3456
|
+
const scopedSelector = isChildScoped(declaration) ? `${variantSelector} > :not(:first-child)` : variantSelector;
|
|
3247
3457
|
const ruleBody = `${scopedSelector} { ${finalDeclaration} }`;
|
|
3458
|
+
let result = ruleBody;
|
|
3248
3459
|
if (parsed.breakpoint) {
|
|
3249
|
-
|
|
3250
|
-
}
|
|
3251
|
-
|
|
3252
|
-
return `@container (min-width: ${context.containers[parsed.containerBreakpoint]}) { ${ruleBody} }`;
|
|
3460
|
+
result = `@media (min-width: ${context.screens[parsed.breakpoint]}) { ${ruleBody} }`;
|
|
3461
|
+
} else if (parsed.containerBreakpoint) {
|
|
3462
|
+
result = `@container (min-width: ${context.containers[parsed.containerBreakpoint]}) { ${ruleBody} }`;
|
|
3253
3463
|
}
|
|
3254
|
-
return ruleBody;
|
|
3255
3464
|
if (parsed.starting) {
|
|
3256
|
-
|
|
3257
|
-
return `@starting-style { ${wrapped} }`;
|
|
3465
|
+
return `@starting-style { ${result} }`;
|
|
3258
3466
|
}
|
|
3259
|
-
|
|
3260
|
-
return `@media (min-width: ${context.screens[parsed.breakpoint]}) { ${rule} }`;
|
|
3261
|
-
}
|
|
3262
|
-
if (parsed.containerBreakpoint) {
|
|
3263
|
-
return `@container (min-width: ${context.containers[parsed.containerBreakpoint]}) { ${rule} }`;
|
|
3264
|
-
}
|
|
3265
|
-
return rule;
|
|
3467
|
+
return result;
|
|
3266
3468
|
}
|
|
3267
3469
|
function compileClass(className, options = {}) {
|
|
3268
3470
|
return compileRuntimeClassNameWithContext(className, resolveRuntimeContext(options));
|
|
@@ -3388,18 +3590,18 @@ function createWindrunner(options = {}) {
|
|
|
3388
3590
|
cache.set(className, cssRule);
|
|
3389
3591
|
return cssRule;
|
|
3390
3592
|
};
|
|
3391
|
-
const insertRule = (
|
|
3392
|
-
if (!
|
|
3593
|
+
const insertRule = (rule) => {
|
|
3594
|
+
if (!rule || insertedRules.has(rule)) return;
|
|
3393
3595
|
if (typeof document !== "object") return;
|
|
3394
3596
|
if (!styleElement) styleElement = findOrCreateRuntimeStyle(styleId);
|
|
3395
3597
|
if (styleElement) loadExistingRules(styleElement);
|
|
3396
|
-
if (insertedRules.has(
|
|
3397
|
-
insertedRules.add(
|
|
3598
|
+
if (insertedRules.has(rule)) return;
|
|
3599
|
+
insertedRules.add(rule);
|
|
3398
3600
|
if (!styleElement || !styleElement.sheet) return;
|
|
3399
3601
|
try {
|
|
3400
|
-
styleElement.sheet.insertRule(
|
|
3602
|
+
styleElement.sheet.insertRule(rule, styleElement.sheet.cssRules.length);
|
|
3401
3603
|
} catch {
|
|
3402
|
-
styleElement.appendChild(document.createTextNode(`${
|
|
3604
|
+
styleElement.appendChild(document.createTextNode(`${rule}
|
|
3403
3605
|
`));
|
|
3404
3606
|
}
|
|
3405
3607
|
};
|
|
@@ -3416,6 +3618,12 @@ function createWindrunner(options = {}) {
|
|
|
3416
3618
|
if (!element || !element.classList) return;
|
|
3417
3619
|
element.classList.forEach((className) => processClassName(className));
|
|
3418
3620
|
};
|
|
3621
|
+
const processElementTree = (element) => {
|
|
3622
|
+
if (!element || element.nodeType !== 1) return;
|
|
3623
|
+
processElement(element);
|
|
3624
|
+
const children = element.querySelectorAll ? element.querySelectorAll("[class]") : [];
|
|
3625
|
+
children.forEach((child) => processElement(child));
|
|
3626
|
+
};
|
|
3419
3627
|
const processClassList = (classList) => {
|
|
3420
3628
|
if (!classList) return [];
|
|
3421
3629
|
const values = typeof classList === "string" ? classList.split(/\s+/) : Array.isArray(classList) ? classList : typeof classList === "object" && typeof classList.forEach === "function" ? Array.from(classList) : [];
|
|
@@ -3423,13 +3631,13 @@ function createWindrunner(options = {}) {
|
|
|
3423
3631
|
};
|
|
3424
3632
|
const scan = (root = document) => {
|
|
3425
3633
|
if (typeof document !== "object" || !root) return;
|
|
3426
|
-
if (root.nodeType === 1
|
|
3634
|
+
if (root.nodeType === 1) processElementTree(root);
|
|
3427
3635
|
const elements = root.querySelectorAll ? root.querySelectorAll("[class]") : [];
|
|
3428
3636
|
elements.forEach((element) => processElement(element));
|
|
3429
3637
|
};
|
|
3430
3638
|
const flushQueue = () => {
|
|
3431
3639
|
scheduled = false;
|
|
3432
|
-
pendingElements.forEach((element) =>
|
|
3640
|
+
pendingElements.forEach((element) => processElementTree(element));
|
|
3433
3641
|
pendingElements.clear();
|
|
3434
3642
|
};
|
|
3435
3643
|
const flush = () => {
|