boss-css 0.0.22 → 0.0.24
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/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +14 -24
- package/dist/_virtual/_rolldown/runtime.mjs +14 -0
- package/dist/ai/server.cjs +15 -16
- package/dist/ai/server.mjs +4 -6
- package/dist/ai/skills.cjs +2 -3
- package/dist/ai/skills.mjs +1 -2
- package/dist/api/browser.cjs +11 -12
- package/dist/api/browser.mjs +1 -3
- package/dist/api/config.cjs +6 -7
- package/dist/api/config.mjs +1 -3
- package/dist/api/css.cjs +1 -3
- package/dist/api/css.mjs +1 -2
- package/dist/api/dictionary.cjs +1 -3
- package/dist/api/dictionary.mjs +1 -2
- package/dist/api/file/dts.cjs +2 -4
- package/dist/api/file/dts.mjs +1 -3
- package/dist/api/file/file.cjs +4 -6
- package/dist/api/file/file.mjs +1 -3
- package/dist/api/file/js.cjs +6 -8
- package/dist/api/file/js.mjs +2 -4
- package/dist/api/file/text.cjs +2 -4
- package/dist/api/file/text.mjs +1 -3
- package/dist/api/names.cjs +1 -3
- package/dist/api/names.mjs +1 -3
- package/dist/api/noopCss.cjs +2 -3
- package/dist/api/noopCss.mjs +1 -2
- package/dist/api/propTree.cjs +1 -3
- package/dist/api/propTree.mjs +1 -2
- package/dist/api/server.cjs +15 -16
- package/dist/api/server.mjs +1 -3
- package/dist/cli/build.cjs +1 -1
- package/dist/cli/build.mjs +2 -3
- package/dist/cli/index.cjs +5 -7
- package/dist/cli/index.mjs +1 -3
- package/dist/cli/tasks/build.cjs +4 -7
- package/dist/cli/tasks/build.mjs +1 -4
- package/dist/cli/tasks/choose.cjs +3 -6
- package/dist/cli/tasks/choose.mjs +1 -4
- package/dist/cli/tasks/compile.cjs +3 -6
- package/dist/cli/tasks/compile.mjs +1 -4
- package/dist/cli/tasks/dev.cjs +8 -11
- package/dist/cli/tasks/dev.mjs +2 -5
- package/dist/cli/tasks/init.cjs +39 -42
- package/dist/cli/tasks/init.mjs +12 -15
- package/dist/cli/tasks/watch.cjs +3 -6
- package/dist/cli/tasks/watch.mjs +1 -4
- package/dist/cli/templates/init.cjs +1 -3
- package/dist/cli/templates/init.mjs +1 -2
- package/dist/cli/types.cjs +2 -4
- package/dist/cli/types.mjs +2 -4
- package/dist/cli/utils.cjs +2 -4
- package/dist/cli/utils.mjs +1 -3
- package/dist/compile/classname-strategy.cjs +3 -5
- package/dist/compile/classname-strategy.mjs +1 -3
- package/dist/compile/classname.cjs +6 -8
- package/dist/compile/classname.mjs +5 -7
- package/dist/compile/index.cjs +18 -20
- package/dist/compile/index.mjs +6 -8
- package/dist/compile/jsx.cjs +8 -10
- package/dist/compile/jsx.mjs +6 -8
- package/dist/compile/prepared.cjs +3 -5
- package/dist/compile/prepared.mjs +1 -3
- package/dist/compile/runtime.cjs +4 -5
- package/dist/compile/runtime.mjs +1 -3
- package/dist/compile/transform.cjs +7 -9
- package/dist/compile/transform.mjs +3 -5
- package/dist/cx/index.cjs +6 -7
- package/dist/cx/index.mjs +3 -5
- package/dist/detect-fw/index.cjs +6 -7
- package/dist/detect-fw/index.mjs +1 -3
- package/dist/dev/client.cjs +2 -3
- package/dist/dev/client.mjs +1 -2
- package/dist/dev/plugin/browser.cjs +2 -3
- package/dist/dev/plugin/browser.mjs +1 -2
- package/dist/dev/plugin/server.cjs +13 -14
- package/dist/dev/plugin/server.mjs +3 -5
- package/dist/dev/port.cjs +3 -5
- package/dist/dev/port.mjs +1 -3
- package/dist/dev/runtime.cjs +3 -5
- package/dist/dev/runtime.mjs +1 -3
- package/dist/dev/server.cjs +12 -13
- package/dist/dev/server.mjs +15 -17
- package/dist/dev/shared.cjs +1 -3
- package/dist/dev/shared.mjs +1 -2
- package/dist/devtools-app/index.mjs +2 -2
- package/dist/eslint-plugin/index.cjs +10 -13
- package/dist/eslint-plugin/index.mjs +1 -4
- package/dist/eslint-plugin/rules/classnames-only.cjs +4 -6
- package/dist/eslint-plugin/rules/classnames-only.mjs +1 -3
- package/dist/eslint-plugin/rules/format-classnames.cjs +8 -10
- package/dist/eslint-plugin/rules/format-classnames.mjs +1 -3
- package/dist/eslint-plugin/rules/no-unknown-classes.cjs +5 -7
- package/dist/eslint-plugin/rules/no-unknown-classes.mjs +1 -3
- package/dist/eslint-plugin/rules/prefer-classnames.cjs +5 -7
- package/dist/eslint-plugin/rules/prefer-classnames.mjs +1 -3
- package/dist/eslint-plugin/rules/prefer-token-values.cjs +6 -8
- package/dist/eslint-plugin/rules/prefer-token-values.mjs +1 -3
- package/dist/eslint-plugin/rules/prefer-unitless-values.cjs +7 -9
- package/dist/eslint-plugin/rules/prefer-unitless-values.mjs +1 -3
- package/dist/eslint-plugin/rules/props-only.cjs +5 -7
- package/dist/eslint-plugin/rules/props-only.mjs +1 -3
- package/dist/eslint-plugin/rules/redundant-cx.cjs +3 -5
- package/dist/eslint-plugin/rules/redundant-cx.mjs +1 -3
- package/dist/eslint-plugin/rules/require-prop-functions.cjs +6 -8
- package/dist/eslint-plugin/rules/require-prop-functions.mjs +1 -3
- package/dist/eslint-plugin/utils/api.cjs +3 -5
- package/dist/eslint-plugin/utils/api.mjs +1 -3
- package/dist/eslint-plugin/utils/ast.cjs +1 -3
- package/dist/eslint-plugin/utils/ast.mjs +1 -2
- package/dist/eslint-plugin/utils/boss-classes.cjs +5 -7
- package/dist/eslint-plugin/utils/boss-classes.mjs +1 -3
- package/dist/eslint-plugin/utils/context.cjs +1 -3
- package/dist/eslint-plugin/utils/context.mjs +1 -2
- package/dist/eslint-plugin/utils/defaults.cjs +1 -3
- package/dist/eslint-plugin/utils/defaults.mjs +1 -2
- package/dist/eslint-plugin/utils/format.cjs +1 -3
- package/dist/eslint-plugin/utils/format.mjs +1 -2
- package/dist/eslint-plugin/utils/order.cjs +3 -5
- package/dist/eslint-plugin/utils/order.mjs +1 -3
- package/dist/eslint-plugin/utils/property-order.cjs +1 -3
- package/dist/eslint-plugin/utils/property-order.mjs +1 -2
- package/dist/eslint-plugin/utils/static.cjs +1 -3
- package/dist/eslint-plugin/utils/static.mjs +1 -2
- package/dist/fontsource/directory.cjs +1 -3
- package/dist/fontsource/directory.mjs +1 -2
- package/dist/fontsource/server.cjs +12 -13
- package/dist/fontsource/server.mjs +2 -4
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +1 -2
- package/dist/log/browser.cjs +2 -4
- package/dist/log/browser.mjs +1 -3
- package/dist/log/server.cjs +6 -8
- package/dist/log/server.mjs +1 -3
- package/dist/merge/index.cjs +21 -284
- package/dist/merge/index.mjs +18 -282
- package/dist/native/browser.cjs +3 -4
- package/dist/native/browser.mjs +1 -3
- package/dist/native/server.cjs +7 -8
- package/dist/native/server.mjs +1 -3
- package/dist/native/styleTypes.cjs +5 -7
- package/dist/native/styleTypes.mjs +1 -3
- package/dist/parser/classname/server.cjs +17 -19
- package/dist/parser/classname/server.mjs +11 -13
- package/dist/parser/jsx/browser.cjs +7 -8
- package/dist/parser/jsx/browser.mjs +1 -3
- package/dist/parser/jsx/extractCode.cjs +2 -4
- package/dist/parser/jsx/extractCode.mjs +2 -3
- package/dist/parser/jsx/extractPrepared.cjs +3 -5
- package/dist/parser/jsx/extractPrepared.mjs +1 -3
- package/dist/parser/jsx/extractProps.cjs +3 -5
- package/dist/parser/jsx/extractProps.mjs +1 -3
- package/dist/parser/jsx/isDOMProp.cjs +3 -5
- package/dist/parser/jsx/isDOMProp.mjs +1 -3
- package/dist/parser/jsx/native.cjs +6 -7
- package/dist/parser/jsx/native.d.cts +2 -2
- package/dist/parser/jsx/native.d.mts +2 -2
- package/dist/parser/jsx/native.mjs +1 -3
- package/dist/parser/jsx/runtime.cjs +3 -3
- package/dist/parser/jsx/runtime.mjs +1 -2
- package/dist/parser/jsx/server.cjs +16 -17
- package/dist/parser/jsx/server.mjs +3 -5
- package/dist/postcss/index.cjs +2 -5
- package/dist/postcss/index.mjs +1 -4
- package/dist/prop/at/runtime-only.cjs +8 -9
- package/dist/prop/at/runtime-only.mjs +6 -8
- package/dist/prop/at/server.cjs +27 -28
- package/dist/prop/at/server.mjs +17 -19
- package/dist/prop/at/shared.cjs +1 -3
- package/dist/prop/at/shared.mjs +1 -2
- package/dist/prop/bosswind/browser.cjs +4 -5
- package/dist/prop/bosswind/browser.mjs +1 -3
- package/dist/prop/bosswind/runtime-only.cjs +4 -5
- package/dist/prop/bosswind/runtime-only.mjs +1 -3
- package/dist/prop/bosswind/selectors.cjs +1 -3
- package/dist/prop/bosswind/selectors.mjs +1 -2
- package/dist/prop/bosswind/server.cjs +12 -12
- package/dist/prop/bosswind/server.mjs +6 -7
- package/dist/prop/bosswind/shared.cjs +59 -9
- package/dist/prop/bosswind/shared.mjs +57 -8
- package/dist/prop/bosswind/tailwind-theme.cjs +2 -38
- package/dist/prop/bosswind/tailwind-theme.mjs +2 -37
- package/dist/prop/child/runtime-only.cjs +2 -3
- package/dist/prop/child/runtime-only.mjs +1 -2
- package/dist/prop/child/server.cjs +10 -11
- package/dist/prop/child/server.mjs +2 -4
- package/dist/prop/css/getDtsTemplate.cjs +7 -6
- package/dist/prop/css/getDtsTemplate.mjs +5 -4
- package/dist/prop/css/runtime-only.cjs +4 -5
- package/dist/prop/css/runtime-only.mjs +1 -3
- package/dist/prop/css/server.cjs +12 -13
- package/dist/prop/css/server.mjs +4 -6
- package/dist/prop/pseudo/runtime-only.cjs +3 -5
- package/dist/prop/pseudo/runtime-only.mjs +1 -3
- package/dist/prop/pseudo/server.cjs +19 -20
- package/dist/prop/pseudo/server.mjs +11 -13
- package/dist/prop/pseudo/shared.cjs +1 -3
- package/dist/prop/pseudo/shared.mjs +1 -2
- package/dist/reset/server.cjs +10 -11
- package/dist/reset/server.mjs +2 -4
- package/dist/runtime/index.cjs +5 -6
- package/dist/runtime/index.mjs +1 -3
- package/dist/runtime/preact.cjs +3 -3
- package/dist/runtime/preact.mjs +1 -2
- package/dist/runtime/qwik.cjs +3 -4
- package/dist/runtime/qwik.mjs +1 -3
- package/dist/runtime/react.cjs +3 -3
- package/dist/runtime/react.mjs +1 -2
- package/dist/runtime/solid.cjs +3 -4
- package/dist/runtime/solid.mjs +1 -3
- package/dist/runtime/stencil.cjs +4 -5
- package/dist/runtime/stencil.mjs +1 -3
- package/dist/runtime/style.cjs +2 -3
- package/dist/runtime/style.mjs +1 -2
- package/dist/shared/boundaries.cjs +4 -6
- package/dist/shared/boundaries.mjs +1 -3
- package/dist/shared/customCss.cjs +1 -3
- package/dist/shared/customCss.mjs +1 -2
- package/dist/shared/debug.cjs +2 -4
- package/dist/shared/debug.mjs +2 -3
- package/dist/shared/file.cjs +3 -5
- package/dist/shared/file.mjs +1 -3
- package/dist/shared/framework.cjs +1 -3
- package/dist/shared/framework.mjs +1 -2
- package/dist/shared/json.cjs +1 -3
- package/dist/shared/json.mjs +1 -2
- package/dist/shared/types.cjs +1 -3
- package/dist/shared/types.mjs +1 -2
- package/dist/strategy/classic/runtime-only.cjs +15 -16
- package/dist/strategy/classic/runtime-only.mjs +3 -5
- package/dist/strategy/classname-first/browser.cjs +7 -8
- package/dist/strategy/classname-first/browser.mjs +1 -3
- package/dist/strategy/classname-first/runtime-only.cjs +13 -14
- package/dist/strategy/classname-first/runtime-only.mjs +1 -3
- package/dist/strategy/classname-first/server.cjs +9 -11
- package/dist/strategy/classname-first/server.mjs +3 -5
- package/dist/strategy/classname-only/server.cjs +8 -10
- package/dist/strategy/classname-only/server.mjs +2 -4
- package/dist/strategy/inline-first/browser.cjs +6 -7
- package/dist/strategy/inline-first/browser.mjs +1 -3
- package/dist/strategy/inline-first/runtime-only.cjs +12 -13
- package/dist/strategy/inline-first/runtime-only.mjs +1 -3
- package/dist/strategy/inline-first/server.cjs +9 -11
- package/dist/strategy/inline-first/server.mjs +3 -5
- package/dist/strategy/runtime/runtime-only.cjs +6 -8
- package/dist/strategy/runtime/runtime-only.mjs +1 -4
- package/dist/strategy/runtime/server.cjs +11 -12
- package/dist/strategy/runtime/server.mjs +2 -4
- package/dist/strategy/runtime-only/css.cjs +5 -6
- package/dist/strategy/runtime-only/css.mjs +4 -5
- package/dist/tasks/build.cjs +8 -10
- package/dist/tasks/build.mjs +1 -3
- package/dist/tasks/compile.cjs +2 -4
- package/dist/tasks/compile.mjs +1 -3
- package/dist/tasks/postcss.cjs +11 -13
- package/dist/tasks/postcss.mjs +1 -3
- package/dist/tasks/session.cjs +4 -6
- package/dist/tasks/session.mjs +1 -3
- package/dist/tasks/watch.cjs +7 -9
- package/dist/tasks/watch.mjs +1 -3
- package/dist/transform/cache.cjs +1 -3
- package/dist/transform/cache.mjs +1 -2
- package/dist/transform/processFile.cjs +4 -6
- package/dist/transform/processFile.mjs +1 -3
- package/dist/use/token/browser.cjs +4 -5
- package/dist/use/token/browser.mjs +1 -3
- package/dist/use/token/normalize.cjs +1 -3
- package/dist/use/token/normalize.mjs +1 -2
- package/dist/use/token/propMap.cjs +1 -3
- package/dist/use/token/propMap.mjs +1 -2
- package/dist/use/token/runtime-only.cjs +5 -6
- package/dist/use/token/runtime-only.mjs +1 -3
- package/dist/use/token/server.cjs +13 -14
- package/dist/use/token/server.mjs +4 -6
- package/dist/use/token/vars.cjs +2 -4
- package/dist/use/token/vars.mjs +1 -3
- package/package.json +23 -23
- package/dist/_virtual/rolldown_runtime.mjs +0 -20
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_tailwind_theme = require("./tailwind-theme.cjs");
|
|
4
|
+
const require_shared = require("./shared.cjs");
|
|
4
5
|
let ts_deepmerge = require("ts-deepmerge");
|
|
5
|
-
|
|
6
6
|
//#region src/prop/bosswind/server.ts
|
|
7
|
-
var server_exports = /* @__PURE__ */
|
|
7
|
+
var server_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
8
8
|
name: () => name,
|
|
9
9
|
onBoot: () => onBoot,
|
|
10
10
|
onPropTree: () => onPropTree,
|
|
@@ -75,6 +75,7 @@ const onBoot = async (api) => {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
const onReady = async (api) => {
|
|
78
|
+
require_shared.ensureBosswindSizeBaseVar(api, typeof api.tokens === "function" ? api.tokens({}) : api.tokens);
|
|
78
79
|
const flex = api.dictionary.get("flex");
|
|
79
80
|
if (flex) flex.single = true;
|
|
80
81
|
const grid = api.dictionary.get("grid");
|
|
@@ -94,15 +95,14 @@ const onPropTree = async (api, { tree, parser }) => {
|
|
|
94
95
|
Object.keys(tree).forEach((key) => delete tree[key]);
|
|
95
96
|
Object.assign(tree, next);
|
|
96
97
|
};
|
|
97
|
-
|
|
98
98
|
//#endregion
|
|
99
99
|
exports.name = name;
|
|
100
100
|
exports.onBoot = onBoot;
|
|
101
101
|
exports.onPropTree = onPropTree;
|
|
102
102
|
exports.onReady = onReady;
|
|
103
|
-
Object.defineProperty(exports,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
103
|
+
Object.defineProperty(exports, "server_exports", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function() {
|
|
106
|
+
return server_exports;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { __exportAll } from "../../_virtual/
|
|
2
|
-
import
|
|
3
|
-
import { bosswindProps, getBosswindDefaults, getBosswindFontSizeKeys, getBosswindMeta, registerBosswindDictionary, rewriteBosswindTree } from "./shared.mjs";
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import theme$1 from "./tailwind-theme.mjs";
|
|
3
|
+
import { bosswindProps, ensureBosswindSizeBaseVar, getBosswindDefaults, getBosswindFontSizeKeys, getBosswindMeta, registerBosswindDictionary, rewriteBosswindTree } from "./shared.mjs";
|
|
4
4
|
import { merge } from "ts-deepmerge";
|
|
5
|
-
|
|
6
5
|
//#region src/prop/bosswind/server.ts
|
|
7
6
|
var server_exports = /* @__PURE__ */ __exportAll({
|
|
8
7
|
name: () => name,
|
|
@@ -12,7 +11,7 @@ var server_exports = /* @__PURE__ */ __exportAll({
|
|
|
12
11
|
});
|
|
13
12
|
const name = "bosswind";
|
|
14
13
|
let needsRuntime = false;
|
|
15
|
-
const theme =
|
|
14
|
+
const theme = theme$1;
|
|
16
15
|
const defaults = getBosswindDefaults(theme);
|
|
17
16
|
const fontSizeKeys = getBosswindFontSizeKeys(theme);
|
|
18
17
|
const bosswindTokens = {
|
|
@@ -75,6 +74,7 @@ const onBoot = async (api) => {
|
|
|
75
74
|
});
|
|
76
75
|
};
|
|
77
76
|
const onReady = async (api) => {
|
|
77
|
+
ensureBosswindSizeBaseVar(api, typeof api.tokens === "function" ? api.tokens({}) : api.tokens);
|
|
78
78
|
const flex = api.dictionary.get("flex");
|
|
79
79
|
if (flex) flex.single = true;
|
|
80
80
|
const grid = api.dictionary.get("grid");
|
|
@@ -94,6 +94,5 @@ const onPropTree = async (api, { tree, parser }) => {
|
|
|
94
94
|
Object.keys(tree).forEach((key) => delete tree[key]);
|
|
95
95
|
Object.assign(tree, next);
|
|
96
96
|
};
|
|
97
|
-
|
|
98
97
|
//#endregion
|
|
99
|
-
export { name, onBoot, onPropTree, onReady, server_exports };
|
|
98
|
+
export { name, onBoot, onPropTree, onReady, server_exports };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const require_normalize = require("../../use/token/normalize.cjs");
|
|
2
|
+
const require_propMap = require("../../use/token/propMap.cjs");
|
|
3
|
+
const require_selectors = require("./selectors.cjs");
|
|
3
4
|
//#region src/prop/bosswind/shared.ts
|
|
4
5
|
const toDashCase = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5
6
|
const displayKeywords = new Map([
|
|
@@ -80,6 +81,7 @@ const aliasMap = new Map([
|
|
|
80
81
|
["z", ["zIndex"]],
|
|
81
82
|
["aspect", ["aspectRatio"]]
|
|
82
83
|
]);
|
|
84
|
+
const sizeBaseAliasNames = new Set(Array.from(aliasMap.entries()).filter(([, targets]) => targets.length > 0 && targets.every((target) => require_propMap.getTokenGroupForProp(target) === "size")).map(([name]) => name));
|
|
83
85
|
const textAlias = "text";
|
|
84
86
|
const bgAlias = "bg";
|
|
85
87
|
const borderAlias = "border";
|
|
@@ -141,6 +143,33 @@ const isLengthLike = (value) => {
|
|
|
141
143
|
if (value.startsWith("calc(") || value.startsWith("clamp(") || value.startsWith("min(") || value.startsWith("max(")) return true;
|
|
142
144
|
return /^-?\d+(?:\.\d+)?(px|rem|em|vh|vw|vmin|vmax|ch|ex|%|pt|pc|mm|cm|in)$/.test(value);
|
|
143
145
|
};
|
|
146
|
+
const isScalableBosswindSizeValue = (value) => {
|
|
147
|
+
return typeof value === "number" || typeof value === "string" && isNumericString(value);
|
|
148
|
+
};
|
|
149
|
+
const isBosswindSizeProp = (prop) => require_propMap.getTokenGroupForProp(prop) === "size";
|
|
150
|
+
const shouldScaleBosswindSizeProp = (prop, value) => {
|
|
151
|
+
return isBosswindSizeProp(prop) && isScalableBosswindSizeValue(value);
|
|
152
|
+
};
|
|
153
|
+
const resolveBosswindTokens = (tokens) => {
|
|
154
|
+
if (!tokens || typeof tokens !== "object") return null;
|
|
155
|
+
return require_normalize.normalizeTokens(tokens);
|
|
156
|
+
};
|
|
157
|
+
const getBosswindSizeBaseValue = (tokens) => {
|
|
158
|
+
const sizeGroup = resolveBosswindTokens(tokens)?.size;
|
|
159
|
+
if (!sizeGroup || typeof sizeGroup !== "object" || Array.isArray(sizeGroup)) return null;
|
|
160
|
+
const baseValue = sizeGroup.base;
|
|
161
|
+
return baseValue === void 0 ? null : baseValue;
|
|
162
|
+
};
|
|
163
|
+
const getBosswindSizeBaseVarName = (api) => `--${api.selectorPrefix ?? ""}size-base`;
|
|
164
|
+
const ensureBosswindSizeBaseVar = (api, tokens) => {
|
|
165
|
+
const baseValue = getBosswindSizeBaseValue(tokens);
|
|
166
|
+
if (baseValue === null || baseValue === void 0) return;
|
|
167
|
+
api.css?.addRoot?.(`${getBosswindSizeBaseVarName(api)}: ${api.dictionary.toValue(baseValue)};`);
|
|
168
|
+
};
|
|
169
|
+
const toBosswindSizeBaseCalc = (api, value) => {
|
|
170
|
+
if ((typeof value === "number" ? value : Number(value)) === 0) return 0;
|
|
171
|
+
return `calc(${String(value)} * var(${getBosswindSizeBaseVarName(api)}))`;
|
|
172
|
+
};
|
|
144
173
|
const readTokenGroup = (value) => {
|
|
145
174
|
if (typeof value === "function" && value.IS_TOKEN_FN) {
|
|
146
175
|
const [group, ...rest] = String(value()).replace("$$.token.", "").split(".");
|
|
@@ -769,12 +798,22 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
769
798
|
usedBosswind = true;
|
|
770
799
|
if (value === null || value === true) return;
|
|
771
800
|
const targets = aliasMap.get(name) || [];
|
|
772
|
-
const
|
|
801
|
+
const shouldScale = sizeBaseAliasNames.has(name) && isScalableBosswindSizeValue(value) && targets.every((target) => isBosswindSizeProp(target));
|
|
802
|
+
const resolvedValue = shouldScale ? toBosswindSizeBaseCalc(api, value) : value;
|
|
803
|
+
if (shouldScale) ensureBosswindSizeBaseVar(api, tokens);
|
|
773
804
|
targets.forEach((target) => {
|
|
774
|
-
|
|
805
|
+
const selectorValue = prop.selectorValue !== void 0 ? prop.selectorValue : value;
|
|
806
|
+
output[target] = shouldScale ? cloneProp(prop, resolvedValue, getSelectorName(name), selectorValue) : cloneProp(prop, resolvedValue, getSelectorName(name));
|
|
775
807
|
});
|
|
776
808
|
return;
|
|
777
809
|
}
|
|
810
|
+
if (shouldScaleBosswindSizeProp(name, value)) {
|
|
811
|
+
usedBosswind = true;
|
|
812
|
+
ensureBosswindSizeBaseVar(api, tokens);
|
|
813
|
+
const selectorValue = prop.selectorValue !== void 0 ? prop.selectorValue : value;
|
|
814
|
+
output[name] = cloneProp(prop, toBosswindSizeBaseCalc(api, value), getSelectorName(name), selectorValue);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
778
817
|
output[name] = prop;
|
|
779
818
|
});
|
|
780
819
|
return output;
|
|
@@ -924,12 +963,23 @@ const rewriteBosswindInput = (api, input, config) => {
|
|
|
924
963
|
}
|
|
925
964
|
if (aliasMap.has(name)) {
|
|
926
965
|
if (value === null || value === true) return;
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
966
|
+
const targets = aliasMap.get(name) || [];
|
|
967
|
+
const shouldScale = sizeBaseAliasNames.has(name) && isScalableBosswindSizeValue(value) && targets.every((target) => isBosswindSizeProp(target));
|
|
968
|
+
const resolvedValue = shouldScale ? toBosswindSizeBaseCalc(api, value) : value;
|
|
969
|
+
if (shouldScale) ensureBosswindSizeBaseVar(api, api.tokens);
|
|
970
|
+
targets.forEach((target) => {
|
|
971
|
+
output[target] = resolvedValue;
|
|
972
|
+
if (shouldScale) setSelector(target, getSelectorName(name), value);
|
|
973
|
+
else setSelector(target, getSelectorName(name));
|
|
930
974
|
});
|
|
931
975
|
return;
|
|
932
976
|
}
|
|
977
|
+
if (shouldScaleBosswindSizeProp(name, value)) {
|
|
978
|
+
ensureBosswindSizeBaseVar(api, api.tokens);
|
|
979
|
+
output[name] = toBosswindSizeBaseCalc(api, value);
|
|
980
|
+
setSelector(name, getSelectorName(name), value);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
933
983
|
output[name] = value;
|
|
934
984
|
});
|
|
935
985
|
require_selectors.setBosswindSelectorMap(output, selectorMap);
|
|
@@ -949,12 +999,12 @@ const getBosswindFontSizeKeys = (theme) => {
|
|
|
949
999
|
const fontSize = theme.fontSize;
|
|
950
1000
|
return fontSize ? Object.keys(fontSize) : [];
|
|
951
1001
|
};
|
|
952
|
-
|
|
953
1002
|
//#endregion
|
|
954
1003
|
exports.bosswindProps = bosswindProps;
|
|
1004
|
+
exports.ensureBosswindSizeBaseVar = ensureBosswindSizeBaseVar;
|
|
955
1005
|
exports.getBosswindDefaults = getBosswindDefaults;
|
|
956
1006
|
exports.getBosswindFontSizeKeys = getBosswindFontSizeKeys;
|
|
957
1007
|
exports.getBosswindMeta = getBosswindMeta;
|
|
958
1008
|
exports.registerBosswindDictionary = registerBosswindDictionary;
|
|
959
1009
|
exports.rewriteBosswindInput = rewriteBosswindInput;
|
|
960
|
-
exports.rewriteBosswindTree = rewriteBosswindTree;
|
|
1010
|
+
exports.rewriteBosswindTree = rewriteBosswindTree;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { normalizeTokens } from "../../use/token/normalize.mjs";
|
|
2
|
+
import { getTokenGroupForProp } from "../../use/token/propMap.mjs";
|
|
1
3
|
import { setBosswindSelectorMap } from "./selectors.mjs";
|
|
2
|
-
|
|
3
4
|
//#region src/prop/bosswind/shared.ts
|
|
4
5
|
const toDashCase = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5
6
|
const displayKeywords = new Map([
|
|
@@ -80,6 +81,7 @@ const aliasMap = new Map([
|
|
|
80
81
|
["z", ["zIndex"]],
|
|
81
82
|
["aspect", ["aspectRatio"]]
|
|
82
83
|
]);
|
|
84
|
+
const sizeBaseAliasNames = new Set(Array.from(aliasMap.entries()).filter(([, targets]) => targets.length > 0 && targets.every((target) => getTokenGroupForProp(target) === "size")).map(([name]) => name));
|
|
83
85
|
const textAlias = "text";
|
|
84
86
|
const bgAlias = "bg";
|
|
85
87
|
const borderAlias = "border";
|
|
@@ -141,6 +143,33 @@ const isLengthLike = (value) => {
|
|
|
141
143
|
if (value.startsWith("calc(") || value.startsWith("clamp(") || value.startsWith("min(") || value.startsWith("max(")) return true;
|
|
142
144
|
return /^-?\d+(?:\.\d+)?(px|rem|em|vh|vw|vmin|vmax|ch|ex|%|pt|pc|mm|cm|in)$/.test(value);
|
|
143
145
|
};
|
|
146
|
+
const isScalableBosswindSizeValue = (value) => {
|
|
147
|
+
return typeof value === "number" || typeof value === "string" && isNumericString(value);
|
|
148
|
+
};
|
|
149
|
+
const isBosswindSizeProp = (prop) => getTokenGroupForProp(prop) === "size";
|
|
150
|
+
const shouldScaleBosswindSizeProp = (prop, value) => {
|
|
151
|
+
return isBosswindSizeProp(prop) && isScalableBosswindSizeValue(value);
|
|
152
|
+
};
|
|
153
|
+
const resolveBosswindTokens = (tokens) => {
|
|
154
|
+
if (!tokens || typeof tokens !== "object") return null;
|
|
155
|
+
return normalizeTokens(tokens);
|
|
156
|
+
};
|
|
157
|
+
const getBosswindSizeBaseValue = (tokens) => {
|
|
158
|
+
const sizeGroup = resolveBosswindTokens(tokens)?.size;
|
|
159
|
+
if (!sizeGroup || typeof sizeGroup !== "object" || Array.isArray(sizeGroup)) return null;
|
|
160
|
+
const baseValue = sizeGroup.base;
|
|
161
|
+
return baseValue === void 0 ? null : baseValue;
|
|
162
|
+
};
|
|
163
|
+
const getBosswindSizeBaseVarName = (api) => `--${api.selectorPrefix ?? ""}size-base`;
|
|
164
|
+
const ensureBosswindSizeBaseVar = (api, tokens) => {
|
|
165
|
+
const baseValue = getBosswindSizeBaseValue(tokens);
|
|
166
|
+
if (baseValue === null || baseValue === void 0) return;
|
|
167
|
+
api.css?.addRoot?.(`${getBosswindSizeBaseVarName(api)}: ${api.dictionary.toValue(baseValue)};`);
|
|
168
|
+
};
|
|
169
|
+
const toBosswindSizeBaseCalc = (api, value) => {
|
|
170
|
+
if ((typeof value === "number" ? value : Number(value)) === 0) return 0;
|
|
171
|
+
return `calc(${String(value)} * var(${getBosswindSizeBaseVarName(api)}))`;
|
|
172
|
+
};
|
|
144
173
|
const readTokenGroup = (value) => {
|
|
145
174
|
if (typeof value === "function" && value.IS_TOKEN_FN) {
|
|
146
175
|
const [group, ...rest] = String(value()).replace("$$.token.", "").split(".");
|
|
@@ -769,12 +798,22 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
769
798
|
usedBosswind = true;
|
|
770
799
|
if (value === null || value === true) return;
|
|
771
800
|
const targets = aliasMap.get(name) || [];
|
|
772
|
-
const
|
|
801
|
+
const shouldScale = sizeBaseAliasNames.has(name) && isScalableBosswindSizeValue(value) && targets.every((target) => isBosswindSizeProp(target));
|
|
802
|
+
const resolvedValue = shouldScale ? toBosswindSizeBaseCalc(api, value) : value;
|
|
803
|
+
if (shouldScale) ensureBosswindSizeBaseVar(api, tokens);
|
|
773
804
|
targets.forEach((target) => {
|
|
774
|
-
|
|
805
|
+
const selectorValue = prop.selectorValue !== void 0 ? prop.selectorValue : value;
|
|
806
|
+
output[target] = shouldScale ? cloneProp(prop, resolvedValue, getSelectorName(name), selectorValue) : cloneProp(prop, resolvedValue, getSelectorName(name));
|
|
775
807
|
});
|
|
776
808
|
return;
|
|
777
809
|
}
|
|
810
|
+
if (shouldScaleBosswindSizeProp(name, value)) {
|
|
811
|
+
usedBosswind = true;
|
|
812
|
+
ensureBosswindSizeBaseVar(api, tokens);
|
|
813
|
+
const selectorValue = prop.selectorValue !== void 0 ? prop.selectorValue : value;
|
|
814
|
+
output[name] = cloneProp(prop, toBosswindSizeBaseCalc(api, value), getSelectorName(name), selectorValue);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
778
817
|
output[name] = prop;
|
|
779
818
|
});
|
|
780
819
|
return output;
|
|
@@ -924,12 +963,23 @@ const rewriteBosswindInput = (api, input, config) => {
|
|
|
924
963
|
}
|
|
925
964
|
if (aliasMap.has(name)) {
|
|
926
965
|
if (value === null || value === true) return;
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
966
|
+
const targets = aliasMap.get(name) || [];
|
|
967
|
+
const shouldScale = sizeBaseAliasNames.has(name) && isScalableBosswindSizeValue(value) && targets.every((target) => isBosswindSizeProp(target));
|
|
968
|
+
const resolvedValue = shouldScale ? toBosswindSizeBaseCalc(api, value) : value;
|
|
969
|
+
if (shouldScale) ensureBosswindSizeBaseVar(api, api.tokens);
|
|
970
|
+
targets.forEach((target) => {
|
|
971
|
+
output[target] = resolvedValue;
|
|
972
|
+
if (shouldScale) setSelector(target, getSelectorName(name), value);
|
|
973
|
+
else setSelector(target, getSelectorName(name));
|
|
930
974
|
});
|
|
931
975
|
return;
|
|
932
976
|
}
|
|
977
|
+
if (shouldScaleBosswindSizeProp(name, value)) {
|
|
978
|
+
ensureBosswindSizeBaseVar(api, api.tokens);
|
|
979
|
+
output[name] = toBosswindSizeBaseCalc(api, value);
|
|
980
|
+
setSelector(name, getSelectorName(name), value);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
933
983
|
output[name] = value;
|
|
934
984
|
});
|
|
935
985
|
setBosswindSelectorMap(output, selectorMap);
|
|
@@ -949,6 +999,5 @@ const getBosswindFontSizeKeys = (theme) => {
|
|
|
949
999
|
const fontSize = theme.fontSize;
|
|
950
1000
|
return fontSize ? Object.keys(fontSize) : [];
|
|
951
1001
|
};
|
|
952
|
-
|
|
953
1002
|
//#endregion
|
|
954
|
-
export { bosswindProps, getBosswindDefaults, getBosswindFontSizeKeys, getBosswindMeta, registerBosswindDictionary, rewriteBosswindInput, rewriteBosswindTree };
|
|
1003
|
+
export { bosswindProps, ensureBosswindSizeBaseVar, getBosswindDefaults, getBosswindFontSizeKeys, getBosswindMeta, registerBosswindDictionary, rewriteBosswindInput, rewriteBosswindTree };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/prop/bosswind/tailwind-theme.ts
|
|
3
2
|
const theme = {
|
|
4
3
|
animation: {
|
|
@@ -270,41 +269,8 @@ const theme = {
|
|
|
270
269
|
"in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
271
270
|
},
|
|
272
271
|
size: {
|
|
273
|
-
|
|
274
|
-
"1": 3,
|
|
275
|
-
"2": 6,
|
|
276
|
-
"3": 9,
|
|
277
|
-
"4": 12,
|
|
278
|
-
"5": 15,
|
|
279
|
-
"6": 18,
|
|
280
|
-
"7": 21,
|
|
281
|
-
"8": 24,
|
|
282
|
-
"9": 27,
|
|
283
|
-
"10": 30,
|
|
284
|
-
"11": 33,
|
|
285
|
-
"12": 36,
|
|
286
|
-
"14": 42,
|
|
287
|
-
"16": 48,
|
|
288
|
-
"20": 60,
|
|
289
|
-
"24": 72,
|
|
290
|
-
"28": 84,
|
|
291
|
-
"32": 96,
|
|
292
|
-
"36": 108,
|
|
293
|
-
"40": 120,
|
|
294
|
-
"44": 132,
|
|
295
|
-
"48": 144,
|
|
296
|
-
"52": 156,
|
|
297
|
-
"56": 168,
|
|
298
|
-
"60": 180,
|
|
299
|
-
"64": 192,
|
|
300
|
-
"72": 216,
|
|
301
|
-
"80": 240,
|
|
302
|
-
"96": 288,
|
|
272
|
+
base: 3,
|
|
303
273
|
px: 1,
|
|
304
|
-
"0.5": 1.5,
|
|
305
|
-
"1.5": 4.5,
|
|
306
|
-
"2.5": 7.5,
|
|
307
|
-
"3.5": 10.5,
|
|
308
274
|
"1/2": "50%",
|
|
309
275
|
"1/3": "33.333333%",
|
|
310
276
|
"2/3": "66.666667%",
|
|
@@ -697,7 +663,5 @@ const theme = {
|
|
|
697
663
|
fr: "minmax(0, 1fr)"
|
|
698
664
|
}
|
|
699
665
|
};
|
|
700
|
-
var tailwind_theme_default = theme;
|
|
701
|
-
|
|
702
666
|
//#endregion
|
|
703
|
-
exports.default =
|
|
667
|
+
exports.default = theme;
|
|
@@ -269,41 +269,8 @@ const theme = {
|
|
|
269
269
|
"in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
270
270
|
},
|
|
271
271
|
size: {
|
|
272
|
-
|
|
273
|
-
"1": 3,
|
|
274
|
-
"2": 6,
|
|
275
|
-
"3": 9,
|
|
276
|
-
"4": 12,
|
|
277
|
-
"5": 15,
|
|
278
|
-
"6": 18,
|
|
279
|
-
"7": 21,
|
|
280
|
-
"8": 24,
|
|
281
|
-
"9": 27,
|
|
282
|
-
"10": 30,
|
|
283
|
-
"11": 33,
|
|
284
|
-
"12": 36,
|
|
285
|
-
"14": 42,
|
|
286
|
-
"16": 48,
|
|
287
|
-
"20": 60,
|
|
288
|
-
"24": 72,
|
|
289
|
-
"28": 84,
|
|
290
|
-
"32": 96,
|
|
291
|
-
"36": 108,
|
|
292
|
-
"40": 120,
|
|
293
|
-
"44": 132,
|
|
294
|
-
"48": 144,
|
|
295
|
-
"52": 156,
|
|
296
|
-
"56": 168,
|
|
297
|
-
"60": 180,
|
|
298
|
-
"64": 192,
|
|
299
|
-
"72": 216,
|
|
300
|
-
"80": 240,
|
|
301
|
-
"96": 288,
|
|
272
|
+
base: 3,
|
|
302
273
|
px: 1,
|
|
303
|
-
"0.5": 1.5,
|
|
304
|
-
"1.5": 4.5,
|
|
305
|
-
"2.5": 7.5,
|
|
306
|
-
"3.5": 10.5,
|
|
307
274
|
"1/2": "50%",
|
|
308
275
|
"1/3": "33.333333%",
|
|
309
276
|
"2/3": "66.666667%",
|
|
@@ -696,7 +663,5 @@ const theme = {
|
|
|
696
663
|
fr: "minmax(0, 1fr)"
|
|
697
664
|
}
|
|
698
665
|
};
|
|
699
|
-
var tailwind_theme_default = theme;
|
|
700
|
-
|
|
701
666
|
//#endregion
|
|
702
|
-
export {
|
|
667
|
+
export { theme as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/prop/child/runtime-only.ts
|
|
3
3
|
const name = "child";
|
|
4
4
|
const createChildContext = (selector) => {
|
|
@@ -11,8 +11,7 @@ const onInit = (api) => {
|
|
|
11
11
|
description: "Arbitrary selector nesting"
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
-
|
|
15
14
|
//#endregion
|
|
16
15
|
exports.createChildContext = createChildContext;
|
|
17
16
|
exports.name = name;
|
|
18
|
-
exports.onInit = onInit;
|
|
17
|
+
exports.onInit = onInit;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_prop_pseudo_server = require("../pseudo/server.cjs");
|
|
4
4
|
//#region src/prop/child/server.ts
|
|
5
|
-
var server_exports = /* @__PURE__ */
|
|
5
|
+
var server_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
6
6
|
dependencies: () => dependencies,
|
|
7
7
|
name: () => name,
|
|
8
8
|
onBoot: () => onBoot,
|
|
@@ -68,15 +68,14 @@ const onProp = async (api, { prop, contexts, preferVariables, file }) => {
|
|
|
68
68
|
contexts.pop();
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
|
|
72
71
|
//#endregion
|
|
73
72
|
exports.dependencies = dependencies;
|
|
74
73
|
exports.name = name;
|
|
75
74
|
exports.onBoot = onBoot;
|
|
76
75
|
exports.onProp = onProp;
|
|
77
|
-
Object.defineProperty(exports,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
76
|
+
Object.defineProperty(exports, "server_exports", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return server_exports;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { __exportAll } from "../../_virtual/
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { dependencies as dependencies$1 } from "../pseudo/server.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/prop/child/server.ts
|
|
5
4
|
var server_exports = /* @__PURE__ */ __exportAll({
|
|
6
5
|
dependencies: () => dependencies,
|
|
@@ -68,6 +67,5 @@ const onProp = async (api, { prop, contexts, preferVariables, file }) => {
|
|
|
68
67
|
contexts.pop();
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
|
-
|
|
72
70
|
//#endregion
|
|
73
|
-
export { dependencies, name, onBoot, onProp, server_exports };
|
|
71
|
+
export { dependencies, name, onBoot, onProp, server_exports };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let node_fs_promises = require("node:fs/promises");
|
|
3
|
-
node_fs_promises =
|
|
3
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises);
|
|
4
4
|
let node_module = require("node:module");
|
|
5
|
-
|
|
6
5
|
//#region src/prop/css/getDtsTemplate.ts
|
|
7
6
|
const baseInterfaces = [
|
|
8
7
|
"StandardLonghandProperties",
|
|
@@ -19,6 +18,8 @@ const baseInterfaces = [
|
|
|
19
18
|
"SvgPropertiesHyphen"
|
|
20
19
|
];
|
|
21
20
|
const lcfirst = (str) => str.charAt(0).toLowerCase() + str.slice(1);
|
|
21
|
+
const isIdentifier = (str) => /^[$A-Z_a-z][$\w]*$/.test(str);
|
|
22
|
+
const formatDeclarationName = (str) => isIdentifier(str) ? str : JSON.stringify(str);
|
|
22
23
|
let cachedTemplate = null;
|
|
23
24
|
async function getDtsTemplate() {
|
|
24
25
|
if (cachedTemplate) return cachedTemplate;
|
|
@@ -44,13 +45,14 @@ async function getDtsTemplate() {
|
|
|
44
45
|
if (!match) continue;
|
|
45
46
|
const [, _name, values] = match;
|
|
46
47
|
const name = lcfirst(_name);
|
|
48
|
+
const declarationName = formatDeclarationName(name);
|
|
47
49
|
csstypeObject[name] = {
|
|
48
50
|
description: csstypeObject[name]?.description || comment.join("\n"),
|
|
49
51
|
types: csstypeObject[name]?.types || values.trim().split("|").map((a) => a.trim()).filter((a) => a),
|
|
50
52
|
iface
|
|
51
53
|
};
|
|
52
54
|
csstypeTemplate.push([`css:${name}:description`, ""]);
|
|
53
|
-
csstypeTemplate.push([`css:${name}:declaration`,
|
|
55
|
+
csstypeTemplate.push([`css:${name}:declaration`, ` ${declarationName}?: $$PropValues | ${values.trim()}`]);
|
|
54
56
|
comment = [];
|
|
55
57
|
} else if (csstypeTemplate.at(-1)?.[0] === null) {
|
|
56
58
|
const last = csstypeTemplate.at(-1);
|
|
@@ -60,6 +62,5 @@ async function getDtsTemplate() {
|
|
|
60
62
|
})();
|
|
61
63
|
return cachedTemplate;
|
|
62
64
|
}
|
|
63
|
-
|
|
64
65
|
//#endregion
|
|
65
|
-
exports.default = getDtsTemplate;
|
|
66
|
+
exports.default = getDtsTemplate;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
|
-
|
|
4
3
|
//#region src/prop/css/getDtsTemplate.ts
|
|
5
4
|
const baseInterfaces = [
|
|
6
5
|
"StandardLonghandProperties",
|
|
@@ -17,6 +16,8 @@ const baseInterfaces = [
|
|
|
17
16
|
"SvgPropertiesHyphen"
|
|
18
17
|
];
|
|
19
18
|
const lcfirst = (str) => str.charAt(0).toLowerCase() + str.slice(1);
|
|
19
|
+
const isIdentifier = (str) => /^[$A-Z_a-z][$\w]*$/.test(str);
|
|
20
|
+
const formatDeclarationName = (str) => isIdentifier(str) ? str : JSON.stringify(str);
|
|
20
21
|
let cachedTemplate = null;
|
|
21
22
|
async function getDtsTemplate() {
|
|
22
23
|
if (cachedTemplate) return cachedTemplate;
|
|
@@ -42,13 +43,14 @@ async function getDtsTemplate() {
|
|
|
42
43
|
if (!match) continue;
|
|
43
44
|
const [, _name, values] = match;
|
|
44
45
|
const name = lcfirst(_name);
|
|
46
|
+
const declarationName = formatDeclarationName(name);
|
|
45
47
|
csstypeObject[name] = {
|
|
46
48
|
description: csstypeObject[name]?.description || comment.join("\n"),
|
|
47
49
|
types: csstypeObject[name]?.types || values.trim().split("|").map((a) => a.trim()).filter((a) => a),
|
|
48
50
|
iface
|
|
49
51
|
};
|
|
50
52
|
csstypeTemplate.push([`css:${name}:description`, ""]);
|
|
51
|
-
csstypeTemplate.push([`css:${name}:declaration`,
|
|
53
|
+
csstypeTemplate.push([`css:${name}:declaration`, ` ${declarationName}?: $$PropValues | ${values.trim()}`]);
|
|
52
54
|
comment = [];
|
|
53
55
|
} else if (csstypeTemplate.at(-1)?.[0] === null) {
|
|
54
56
|
const last = csstypeTemplate.at(-1);
|
|
@@ -58,6 +60,5 @@ async function getDtsTemplate() {
|
|
|
58
60
|
})();
|
|
59
61
|
return cachedTemplate;
|
|
60
62
|
}
|
|
61
|
-
|
|
62
63
|
//#endregion
|
|
63
|
-
export { getDtsTemplate as default };
|
|
64
|
+
export { getDtsTemplate as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_names = require("../../api/names.cjs");
|
|
3
|
+
const require_shared = require("../pseudo/shared.cjs");
|
|
4
4
|
//#region src/prop/css/runtime-only.ts
|
|
5
5
|
const resolvePropertyName = (prop) => prop.includes("-") ? prop : require_names.camelCaseToDash(prop);
|
|
6
6
|
const buildRuntimeSelector = (className, contexts) => {
|
|
@@ -8,7 +8,6 @@ const buildRuntimeSelector = (className, contexts) => {
|
|
|
8
8
|
const pseudoChain = contexts.filter((context) => require_shared.pseudoDependencies.has(context));
|
|
9
9
|
return require_names.applyChildSelectors(pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector, contexts);
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
//#endregion
|
|
13
12
|
exports.buildRuntimeSelector = buildRuntimeSelector;
|
|
14
|
-
exports.resolvePropertyName = resolvePropertyName;
|
|
13
|
+
exports.resolvePropertyName = resolvePropertyName;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { applyChildSelectors, camelCaseToDash } from "../../api/names.mjs";
|
|
2
2
|
import { pseudoDependencies } from "../pseudo/shared.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/prop/css/runtime-only.ts
|
|
5
4
|
const resolvePropertyName = (prop) => prop.includes("-") ? prop : camelCaseToDash(prop);
|
|
6
5
|
const buildRuntimeSelector = (className, contexts) => {
|
|
@@ -8,6 +7,5 @@ const buildRuntimeSelector = (className, contexts) => {
|
|
|
8
7
|
const pseudoChain = contexts.filter((context) => pseudoDependencies.has(context));
|
|
9
8
|
return applyChildSelectors(pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector, contexts);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { buildRuntimeSelector, resolvePropertyName };
|
|
11
|
+
export { buildRuntimeSelector, resolvePropertyName };
|
package/dist/prop/css/server.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_getDtsTemplate = require("./getDtsTemplate.cjs");
|
|
3
4
|
let _webref_css = require("@webref/css");
|
|
4
|
-
|
|
5
5
|
//#region src/prop/css/server.ts
|
|
6
|
-
var server_exports = /* @__PURE__ */
|
|
6
|
+
var server_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
7
7
|
dependencies: () => dependencies,
|
|
8
|
-
name: () =>
|
|
8
|
+
name: () => "css",
|
|
9
9
|
onBoot: () => onBoot,
|
|
10
10
|
onProp: () => onProp
|
|
11
11
|
});
|
|
@@ -13,7 +13,7 @@ const name = "css";
|
|
|
13
13
|
const dependencies = new Set(["css"]);
|
|
14
14
|
const onBoot = async (api) => {
|
|
15
15
|
const [typeObject, typeTemplate] = await require_getDtsTemplate.default();
|
|
16
|
-
api.file.js.dts.replace("body", `$$:FinalProps`, (v) => `${v} &
|
|
16
|
+
api.file.js.dts.replace("body", `$$:FinalProps`, (v) => `${v} & Properties & $$CSSMissingProps`);
|
|
17
17
|
typeTemplate.forEach((entry) => {
|
|
18
18
|
api.file.js.dts.set("body", ...entry);
|
|
19
19
|
});
|
|
@@ -86,15 +86,14 @@ const onProp = async (api, { name, prop, contexts, preferVariables }) => {
|
|
|
86
86
|
api.css.rule(propertyName, value === null ? `var(${api.contextToCSSVariable(name, value, contexts, api.selectorPrefix)})` : value, isImportant ? { important: true } : void 0);
|
|
87
87
|
if (!contexts.length) api.css.write();
|
|
88
88
|
};
|
|
89
|
-
|
|
90
89
|
//#endregion
|
|
91
90
|
exports.dependencies = dependencies;
|
|
92
91
|
exports.name = name;
|
|
93
92
|
exports.onBoot = onBoot;
|
|
94
93
|
exports.onProp = onProp;
|
|
95
|
-
Object.defineProperty(exports,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
94
|
+
Object.defineProperty(exports, "server_exports", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function() {
|
|
97
|
+
return server_exports;
|
|
98
|
+
}
|
|
99
|
+
});
|