@barocss/kit 0.10.0 → 0.10.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/dist/index.cjs +99 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +99 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1448,6 +1448,7 @@ function themeToCssVarsAll(theme) {
|
|
|
1448
1448
|
...spacingToCssVars(theme.spacing),
|
|
1449
1449
|
...containerToCssVars(theme.container),
|
|
1450
1450
|
...borderRadiusToCssVars(theme.borderRadius),
|
|
1451
|
+
...Object.fromEntries(Object.entries(theme.borderWidth ?? {}).filter(([k]) => k !== "DEFAULT").map(([k, v]) => [`--border-width-${escapeKey(k)}`, String(v)])),
|
|
1451
1452
|
...zIndexToCssVars(theme.zIndex),
|
|
1452
1453
|
...opacityToCssVars(theme.opacity),
|
|
1453
1454
|
...animationToCssVars({
|
|
@@ -6672,6 +6673,20 @@ var stopsDecls = (stop, color) => {
|
|
|
6672
6673
|
category: "background"
|
|
6673
6674
|
});
|
|
6674
6675
|
});
|
|
6676
|
+
var BG_HINTS = {
|
|
6677
|
+
position: "background-position",
|
|
6678
|
+
percentage: "background-position",
|
|
6679
|
+
size: "background-size",
|
|
6680
|
+
length: "background-size",
|
|
6681
|
+
"bg-size": "background-size",
|
|
6682
|
+
image: "background-image",
|
|
6683
|
+
url: "background-image"
|
|
6684
|
+
};
|
|
6685
|
+
function bgHint(value) {
|
|
6686
|
+
const m = /^([a-z-]+):(.+)$/.exec(value);
|
|
6687
|
+
const prop = m ? BG_HINTS[m[1]] : void 0;
|
|
6688
|
+
return m && prop ? [prop, m[2]] : null;
|
|
6689
|
+
}
|
|
6675
6690
|
/**
|
|
6676
6691
|
* background-size utility (arbitrary, custom property supported)
|
|
6677
6692
|
* bg-[length] → background-size: [length]
|
|
@@ -6689,7 +6704,8 @@ functionalUtility({
|
|
|
6689
6704
|
supportsOpacity: true,
|
|
6690
6705
|
handle: (value, context, token, extra) => {
|
|
6691
6706
|
if (value.startsWith("url(")) return [decl("background-image", value)];
|
|
6692
|
-
|
|
6707
|
+
const hinted = bgHint(value);
|
|
6708
|
+
if (hinted) return [decl(hinted[0], hinted[1])];
|
|
6693
6709
|
if (extra?.realThemeValue) return themeColorDecls("background-color", value, extra);
|
|
6694
6710
|
if (parseColor(value)) {
|
|
6695
6711
|
const parsedColor = parseColor(value);
|
|
@@ -6699,7 +6715,10 @@ functionalUtility({
|
|
|
6699
6715
|
if (parseLength(value)) return [decl("background-size", value)];
|
|
6700
6716
|
return null;
|
|
6701
6717
|
},
|
|
6702
|
-
handleCustomProperty: (value) =>
|
|
6718
|
+
handleCustomProperty: (value) => {
|
|
6719
|
+
const hinted = bgHint(value);
|
|
6720
|
+
return hinted ? [decl(hinted[0], `var(${hinted[1]})`)] : [decl("background-color", `var(${value})`)];
|
|
6721
|
+
},
|
|
6703
6722
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
6704
6723
|
category: "background"
|
|
6705
6724
|
});
|
|
@@ -6784,6 +6803,7 @@ functionalUtility({
|
|
|
6784
6803
|
category: "borders"
|
|
6785
6804
|
});
|
|
6786
6805
|
var borderStyleProperty = () => atRoot([property("--baro-border-style", "solid")]);
|
|
6806
|
+
var borderWidthRef = (value, extra) => extra?.themeKey && extra.themeKey !== "DEFAULT" ? `var(--border-width-${extra.themeKey.replace(".", "\\.")})` : value;
|
|
6787
6807
|
var withBorderStyle = (props, width) => [
|
|
6788
6808
|
borderStyleProperty(),
|
|
6789
6809
|
...props.map((prop) => decl(prop.replace("width", "style"), "var(--baro-border-style)")),
|
|
@@ -6803,8 +6823,8 @@ var withBorderStyle = (props, width) => [
|
|
|
6803
6823
|
], { category: "borders" });
|
|
6804
6824
|
});
|
|
6805
6825
|
[
|
|
6806
|
-
["border-x", ["border-
|
|
6807
|
-
["border-y", ["border-
|
|
6826
|
+
["border-x", ["border-inline-width"]],
|
|
6827
|
+
["border-y", ["border-block-width"]],
|
|
6808
6828
|
["border-bs", ["border-block-start-width"]],
|
|
6809
6829
|
["border-be", ["border-block-end-width"]],
|
|
6810
6830
|
["border-s", ["border-inline-start-width"]],
|
|
@@ -6836,10 +6856,11 @@ var withBorderStyle = (props, width) => [
|
|
|
6836
6856
|
return null;
|
|
6837
6857
|
},
|
|
6838
6858
|
handle: (value, ctx, token, extra) => {
|
|
6839
|
-
if (extra?.themeNamespace === "borderWidth") return withBorderStyle(propList, value);
|
|
6859
|
+
if (extra?.themeNamespace === "borderWidth") return withBorderStyle(propList, borderWidthRef(value, extra));
|
|
6840
6860
|
if (extra?.realThemeValue) return propList.flatMap((prop) => themeColorDecls(prop.replace("width", "color"), value, extra));
|
|
6841
6861
|
if (parseColor(value)) return propList.map((prop) => decl(prop.replace("width", "color"), value));
|
|
6842
6862
|
if (token.arbitrary) return withBorderStyle(propList, value);
|
|
6863
|
+
if (parseLength(value)) return withBorderStyle(propList, value);
|
|
6843
6864
|
return null;
|
|
6844
6865
|
},
|
|
6845
6866
|
handleCustomProperty: (value) => {
|
|
@@ -6885,8 +6906,10 @@ Object.entries({
|
|
|
6885
6906
|
name: `divide-${axis}`,
|
|
6886
6907
|
themeKeys: ["divideWidth", "borderWidth"],
|
|
6887
6908
|
supportsArbitrary: true,
|
|
6909
|
+
supportsCustomProperty: true,
|
|
6910
|
+
handleCustomProperty: (value) => divide(`var(${value.replace(/^length:/, "")})`),
|
|
6888
6911
|
handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}px` : null,
|
|
6889
|
-
handle: (value) => divide(value),
|
|
6912
|
+
handle: (value, _ctx, _token, extra) => divide(extra?.themeNamespace === "borderWidth" ? borderWidthRef(value, extra) : value),
|
|
6890
6913
|
description: `divide-${axis} width utility`,
|
|
6891
6914
|
category: "borders"
|
|
6892
6915
|
});
|
|
@@ -6898,7 +6921,7 @@ functionalUtility({
|
|
|
6898
6921
|
supportsCustomProperty: true,
|
|
6899
6922
|
supportsOpacity: true,
|
|
6900
6923
|
handle: (value, ctx, token, extra) => {
|
|
6901
|
-
if (extra?.themeNamespace === "borderWidth") return withBorderStyle(["border-width"], value);
|
|
6924
|
+
if (extra?.themeNamespace === "borderWidth") return withBorderStyle(["border-width"], borderWidthRef(value, extra));
|
|
6902
6925
|
if (extra?.realThemeValue) return themeColorDecls("border-color", value, extra);
|
|
6903
6926
|
if (token.arbitrary) {
|
|
6904
6927
|
if (parseLength(value)) return withBorderStyle(["border-width"], value);
|
|
@@ -7020,12 +7043,13 @@ functionalUtility({
|
|
|
7020
7043
|
supportsArbitrary: true,
|
|
7021
7044
|
supportsCustomProperty: true,
|
|
7022
7045
|
supportsOpacity: true,
|
|
7023
|
-
handle: (value, _ctx,
|
|
7046
|
+
handle: (value, _ctx, token, extra) => {
|
|
7047
|
+
if (token.prefix !== "divide") return null;
|
|
7024
7048
|
if (extra?.realThemeValue) return [rule(":where(& > :not(:last-child))", themeColorDecls("border-color", value, extra))];
|
|
7025
7049
|
if (parseColor(value)) return divideColor(value);
|
|
7026
7050
|
return null;
|
|
7027
7051
|
},
|
|
7028
|
-
handleCustomProperty: (value) => divideColor(`var(${value})`),
|
|
7052
|
+
handleCustomProperty: (value, _ctx, token) => token.prefix === "divide" ? divideColor(`var(${value})`) : [],
|
|
7029
7053
|
description: "divide-color utility (theme, alpha, arbitrary, custom property)",
|
|
7030
7054
|
category: "borders"
|
|
7031
7055
|
});
|
|
@@ -7429,6 +7453,8 @@ functionalUtility({
|
|
|
7429
7453
|
});
|
|
7430
7454
|
//#endregion
|
|
7431
7455
|
//#region src/presets/svg.ts
|
|
7456
|
+
var STROKE_WIDTH_HINT = /^(length|number|percentage):(.+)$/;
|
|
7457
|
+
var STROKE_LENGTH = /^(\d*\.)?\d+(px|em|rem|vh|vw|vmin|vmax|%|in|cm|mm|pt|pc|ex|ch|q|lh|rlh|svh|lvh|dvh|cqw|cqh)$/i;
|
|
7432
7458
|
staticUtility("fill-inherit", [["fill", "inherit"]], { category: "svg" });
|
|
7433
7459
|
staticUtility("fill-current", [["fill", "currentColor"]], { category: "svg" });
|
|
7434
7460
|
staticUtility("fill-transparent", [["fill", "transparent"]], { category: "svg" });
|
|
@@ -7458,11 +7484,17 @@ functionalUtility({
|
|
|
7458
7484
|
supportsCustomProperty: true,
|
|
7459
7485
|
handle: (value, ctx, token, extra) => {
|
|
7460
7486
|
if (parseNumber(value) || extra?.themeNamespace === "strokeWidth") return [decl("stroke-width", value)];
|
|
7487
|
+
if (token.arbitrary) {
|
|
7488
|
+
const hint = STROKE_WIDTH_HINT.exec(value);
|
|
7489
|
+
if (hint) return [decl("stroke-width", hint[2])];
|
|
7490
|
+
if (!parseColor(value) && (STROKE_LENGTH.test(value) || /^calc\(/.test(value))) return [decl("stroke-width", value)];
|
|
7491
|
+
}
|
|
7461
7492
|
if (extra?.realThemeValue) return [decl("stroke", `var(--color-${extra.realThemeValue})`)];
|
|
7462
7493
|
return [decl("stroke", value)];
|
|
7463
7494
|
},
|
|
7464
7495
|
handleCustomProperty: (value) => {
|
|
7465
|
-
|
|
7496
|
+
const hint = STROKE_WIDTH_HINT.exec(value);
|
|
7497
|
+
if (hint) return [decl("stroke-width", `var(${hint[2]})`)];
|
|
7466
7498
|
return [decl("stroke", `var(${value})`)];
|
|
7467
7499
|
},
|
|
7468
7500
|
description: "stroke utility (static, theme, arbitrary, custom property supported)",
|
|
@@ -7540,6 +7572,21 @@ staticModifier("prefers-contrast-less", ["&"], {
|
|
|
7540
7572
|
wrap: () => [atRule("media", "(prefers-contrast: less)", [], "media")],
|
|
7541
7573
|
source: "media"
|
|
7542
7574
|
});
|
|
7575
|
+
staticModifier("contrast-more", ["&"], {
|
|
7576
|
+
order: 5,
|
|
7577
|
+
wrap: () => [atRule("media", "(prefers-contrast: more)", [], "media")],
|
|
7578
|
+
source: "media"
|
|
7579
|
+
});
|
|
7580
|
+
staticModifier("contrast-less", ["&"], {
|
|
7581
|
+
order: 5,
|
|
7582
|
+
wrap: () => [atRule("media", "(prefers-contrast: less)", [], "media")],
|
|
7583
|
+
source: "media"
|
|
7584
|
+
});
|
|
7585
|
+
staticModifier("noscript", ["&"], {
|
|
7586
|
+
order: 5,
|
|
7587
|
+
wrap: () => [atRule("media", "(scripting: none)", [], "media")],
|
|
7588
|
+
source: "media"
|
|
7589
|
+
});
|
|
7543
7590
|
staticModifier("forced-colors", ["&"], {
|
|
7544
7591
|
order: 5,
|
|
7545
7592
|
wrap: () => [atRule("media", "(forced-colors: active)", [], "media")],
|
|
@@ -7785,6 +7832,30 @@ function negatedAtRuleOf(name, ctx) {
|
|
|
7785
7832
|
nodes: []
|
|
7786
7833
|
};
|
|
7787
7834
|
}
|
|
7835
|
+
/**
|
|
7836
|
+
* #354: the at-rule for `not-[@<name> <params>]` (`_` decoded to a space), as Tailwind 4.3.3 emits it:
|
|
7837
|
+
* `@media`/`@supports` → `not <params>` (a leading `not` is removed instead), `@container [name] <query>` →
|
|
7838
|
+
* `@container [name] not <query>`. Null for any other at-rule, an empty condition or a top-level comma list,
|
|
7839
|
+
* where Tailwind emits nothing or an invalid prelude.
|
|
7840
|
+
*/
|
|
7841
|
+
function negatedArbitraryAtRuleOf(value) {
|
|
7842
|
+
const m = /^@(media|supports|container)(?:\s+|(?=\()|$)([\s\S]*)$/.exec(decodeArbitrarySelector(value).trim());
|
|
7843
|
+
if (!m) return null;
|
|
7844
|
+
const name = m[1];
|
|
7845
|
+
let params = (m[2] ?? "").trim();
|
|
7846
|
+
let prefix = "";
|
|
7847
|
+
if (name === "container") {
|
|
7848
|
+
const n = /^(?!not\b)([a-zA-Z_-][a-zA-Z0-9_-]*)\s+([\s\S]*)$/.exec(params);
|
|
7849
|
+
if (n) {
|
|
7850
|
+
prefix = `${n[1]} `;
|
|
7851
|
+
params = n[2].trim();
|
|
7852
|
+
}
|
|
7853
|
+
}
|
|
7854
|
+
if (!params || hasTopLevelComma(params)) return null;
|
|
7855
|
+
const neg = /^not\s+/i.test(params) ? params.replace(/^not\s+/i, "") : `not ${params}`;
|
|
7856
|
+
if (!neg) return null;
|
|
7857
|
+
return atRule(name, `${prefix}${neg}`, [], name);
|
|
7858
|
+
}
|
|
7788
7859
|
//#endregion
|
|
7789
7860
|
//#region src/presets/variants/responsive.ts
|
|
7790
7861
|
functionalModifier((mod, context) => {
|
|
@@ -8034,7 +8105,11 @@ functionalModifier((mod, context) => /^not-(?!@)/.test(mod) && !!negatedAtRuleOf
|
|
|
8034
8105
|
const node = negatedAtRuleOf(mod.type.slice(4), context);
|
|
8035
8106
|
return node ? [node] : [];
|
|
8036
8107
|
});
|
|
8037
|
-
functionalModifier((mod) => /^not-\[
|
|
8108
|
+
functionalModifier((mod) => /^not-\[@.*\]$/.test(mod) && !!negatedArbitraryAtRuleOf(mod.slice(5, -1)), () => "&", (mod) => {
|
|
8109
|
+
const node = negatedArbitraryAtRuleOf(mod.type.slice(5, -1));
|
|
8110
|
+
return node ? [node] : [];
|
|
8111
|
+
});
|
|
8112
|
+
functionalModifier((mod) => /^not-\[(?!@).*\]$/.test(mod), ({ selector, mod }) => {
|
|
8038
8113
|
const m = /^not-\[(.+)\]$/.exec(mod.type);
|
|
8039
8114
|
if (m) {
|
|
8040
8115
|
if (!/^[a-zA-Z0-9_-]+(=.+)?$/.test(m[1])) return {
|
|
@@ -8055,7 +8130,7 @@ functionalModifier((mod) => /^not-\[.*\]$/.test(mod), ({ selector, mod }) => {
|
|
|
8055
8130
|
source: "attribute"
|
|
8056
8131
|
};
|
|
8057
8132
|
});
|
|
8058
|
-
functionalModifier((mod) => /^not-/.test(mod) && !mod.startsWith("not-@"), ({ selector, mod, context }) => {
|
|
8133
|
+
functionalModifier((mod) => /^not-/.test(mod) && !mod.startsWith("not-@") && !mod.startsWith("not-[@"), ({ selector, mod, context }) => {
|
|
8059
8134
|
const m = /^not-(.+)$/.exec(mod.type);
|
|
8060
8135
|
const inner = m ? negatableSelectorOf(m[1], context) : null;
|
|
8061
8136
|
if (m && !inner) return null;
|
|
@@ -8120,7 +8195,7 @@ functionalModifier((mod) => /^aria-/.test(mod), ({ selector, mod }) => {
|
|
|
8120
8195
|
source: "aria"
|
|
8121
8196
|
};
|
|
8122
8197
|
}, void 0);
|
|
8123
|
-
functionalModifier((mod) => mod.startsWith("not-") && !mod.startsWith("not-@"), ({ selector, mod, context }) => {
|
|
8198
|
+
functionalModifier((mod) => mod.startsWith("not-") && !mod.startsWith("not-@") && !mod.startsWith("not-[@"), ({ selector, mod, context }) => {
|
|
8124
8199
|
const pseudo = mod.type.replace("not-", "");
|
|
8125
8200
|
if (pseudo.startsWith("[")) {
|
|
8126
8201
|
const inner = pseudo.slice(1, -1);
|
|
@@ -8223,10 +8298,16 @@ functionalModifier((mod) => /^where-\[.*\]$/.test(mod), ({ selector, mod }) => {
|
|
|
8223
8298
|
}, void 0);
|
|
8224
8299
|
//#endregion
|
|
8225
8300
|
//#region src/presets/variants/at-rules.ts
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8301
|
+
function supportsCondition(value) {
|
|
8302
|
+
if (/^[\w-]*\s*\(/.test(value)) return value;
|
|
8303
|
+
let v = value.includes(":") ? value : `${value}: var(--tw)`;
|
|
8304
|
+
if (v[0] !== "(" || v[v.length - 1] !== ")") v = `(${v})`;
|
|
8305
|
+
return v;
|
|
8306
|
+
}
|
|
8307
|
+
functionalModifier((mod) => /^supports-(?:\[.+\]|[a-zA-Z-][a-zA-Z0-9-]*)$/.test(mod), void 0, (mod) => {
|
|
8308
|
+
const m = /^supports-(?:\[(.+)\]|([a-zA-Z-][a-zA-Z0-9-]*))$/.exec(mod.type);
|
|
8309
|
+
if (!m) return [];
|
|
8310
|
+
return [atRule("supports", supportsCondition(m[1] !== void 0 ? decodeArbitrarySelector(m[1]) : m[2]), [], "supports")];
|
|
8230
8311
|
});
|
|
8231
8312
|
functionalModifier((mod) => /^layer-\[.*\]$/.test(mod), void 0, (mod) => {
|
|
8232
8313
|
const m = /^layer-\[(.+)\]$/.exec(mod.type);
|
|
@@ -8254,6 +8335,7 @@ functionalModifier((mod) => /^(group|peer)-hover(\/[a-zA-Z0-9_-]+)?$/.test(mod),
|
|
|
8254
8335
|
}, () => [atRule("media", "(hover: hover)", [])]);
|
|
8255
8336
|
function negated(value, ctx) {
|
|
8256
8337
|
const v = value.slice(4);
|
|
8338
|
+
if (v.startsWith("[@")) return null;
|
|
8257
8339
|
if (v.startsWith("[") && v.endsWith("]")) return `:not(*:is(${decodeArbitrarySelector(v.slice(1, -1))}))`;
|
|
8258
8340
|
const inner = negatableSelectorOf(v, ctx);
|
|
8259
8341
|
return inner ? `:not(${inner})` : null;
|