boss-css 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/_virtual/rolldown_runtime.mjs +20 -0
- package/dist/api/browser.cjs +54 -0
- package/dist/api/browser.mjs +48 -0
- package/dist/api/config.cjs +94 -0
- package/dist/api/config.mjs +91 -0
- package/dist/api/css.cjs +304 -0
- package/dist/api/css.mjs +303 -0
- package/dist/api/dictionary.cjs +218 -0
- package/dist/api/dictionary.mjs +215 -0
- package/dist/api/file/dts.cjs +21 -0
- package/dist/api/file/dts.mjs +21 -0
- package/dist/api/file/file.cjs +123 -0
- package/dist/api/file/file.mjs +120 -0
- package/dist/api/file/js.cjs +118 -0
- package/dist/api/file/js.mjs +116 -0
- package/dist/api/names.cjs +52 -0
- package/dist/api/names.mjs +46 -0
- package/dist/api/noopCss.cjs +37 -0
- package/dist/api/noopCss.mjs +36 -0
- package/dist/api/propTree.cjs +54 -0
- package/dist/api/propTree.mjs +48 -0
- package/dist/api/server.cjs +112 -0
- package/dist/api/server.mjs +106 -0
- package/dist/cli/build.cjs +1 -0
- package/dist/cli/build.mjs +3 -0
- package/dist/cli/index.cjs +30 -0
- package/dist/cli/index.mjs +29 -0
- package/dist/cli/tasks/build.cjs +24 -0
- package/dist/cli/tasks/build.mjs +23 -0
- package/dist/cli/tasks/choose.cjs +47 -0
- package/dist/cli/tasks/choose.mjs +46 -0
- package/dist/cli/tasks/compile.cjs +68 -0
- package/dist/cli/tasks/compile.mjs +67 -0
- package/dist/cli/tasks/dev.cjs +51 -0
- package/dist/cli/tasks/dev.mjs +48 -0
- package/dist/cli/tasks/init.cjs +1835 -0
- package/dist/cli/tasks/init.mjs +1831 -0
- package/dist/cli/tasks/watch.cjs +38 -0
- package/dist/cli/tasks/watch.mjs +37 -0
- package/dist/cli/templates/init.cjs +82 -0
- package/dist/cli/templates/init.mjs +78 -0
- package/dist/cli/types.cjs +13 -0
- package/dist/cli/types.mjs +13 -0
- package/dist/cli/utils.cjs +43 -0
- package/dist/cli/utils.mjs +41 -0
- package/dist/compile/classname-strategy.cjs +79 -0
- package/dist/compile/classname-strategy.mjs +77 -0
- package/dist/compile/classname.cjs +366 -0
- package/dist/compile/classname.mjs +360 -0
- package/dist/compile/index.cjs +238 -0
- package/dist/compile/index.mjs +235 -0
- package/dist/compile/jsx.cjs +803 -0
- package/dist/compile/jsx.mjs +800 -0
- package/dist/compile/prepared.cjs +88 -0
- package/dist/compile/prepared.mjs +87 -0
- package/dist/compile/runtime.cjs +33 -0
- package/dist/compile/runtime.mjs +32 -0
- package/dist/compile/transform.cjs +371 -0
- package/dist/compile/transform.mjs +369 -0
- package/dist/cx/index.cjs +93 -0
- package/dist/cx/index.mjs +85 -0
- package/dist/detect-fw/index.cjs +384 -0
- package/dist/detect-fw/index.mjs +379 -0
- package/dist/dev/client.cjs +39 -0
- package/dist/dev/client.mjs +38 -0
- package/dist/dev/plugin/browser.cjs +11 -0
- package/dist/dev/plugin/browser.mjs +9 -0
- package/dist/dev/plugin/server.cjs +86 -0
- package/dist/dev/plugin/server.mjs +78 -0
- package/dist/dev/port.cjs +46 -0
- package/dist/dev/port.mjs +43 -0
- package/dist/dev/runtime.cjs +28 -0
- package/dist/dev/runtime.mjs +29 -0
- package/dist/dev/server.cjs +808 -0
- package/dist/dev/server.mjs +805 -0
- package/dist/dev/shared.cjs +6 -0
- package/dist/dev/shared.mjs +5 -0
- package/dist/eslint-plugin/index.cjs +66 -0
- package/dist/eslint-plugin/index.mjs +66 -0
- package/dist/eslint-plugin/rules/classnames-only.cjs +68 -0
- package/dist/eslint-plugin/rules/classnames-only.mjs +68 -0
- package/dist/eslint-plugin/rules/format-classnames.cjs +137 -0
- package/dist/eslint-plugin/rules/format-classnames.mjs +136 -0
- package/dist/eslint-plugin/rules/no-unknown-classes.cjs +119 -0
- package/dist/eslint-plugin/rules/no-unknown-classes.mjs +119 -0
- package/dist/eslint-plugin/rules/prefer-classnames.cjs +69 -0
- package/dist/eslint-plugin/rules/prefer-classnames.mjs +69 -0
- package/dist/eslint-plugin/rules/prefer-token-values.cjs +197 -0
- package/dist/eslint-plugin/rules/prefer-token-values.mjs +197 -0
- package/dist/eslint-plugin/rules/props-only.cjs +115 -0
- package/dist/eslint-plugin/rules/props-only.mjs +115 -0
- package/dist/eslint-plugin/rules/redundant-cx.cjs +66 -0
- package/dist/eslint-plugin/rules/redundant-cx.mjs +66 -0
- package/dist/eslint-plugin/rules/require-prop-functions.cjs +130 -0
- package/dist/eslint-plugin/rules/require-prop-functions.mjs +130 -0
- package/dist/eslint-plugin/utils/api.cjs +30 -0
- package/dist/eslint-plugin/utils/api.mjs +29 -0
- package/dist/eslint-plugin/utils/ast.cjs +119 -0
- package/dist/eslint-plugin/utils/ast.mjs +112 -0
- package/dist/eslint-plugin/utils/boss-classes.cjs +185 -0
- package/dist/eslint-plugin/utils/boss-classes.mjs +175 -0
- package/dist/eslint-plugin/utils/defaults.cjs +99 -0
- package/dist/eslint-plugin/utils/defaults.mjs +93 -0
- package/dist/eslint-plugin/utils/format.cjs +20 -0
- package/dist/eslint-plugin/utils/format.mjs +19 -0
- package/dist/eslint-plugin/utils/order.cjs +76 -0
- package/dist/eslint-plugin/utils/order.mjs +76 -0
- package/dist/eslint-plugin/utils/property-order.cjs +449 -0
- package/dist/eslint-plugin/utils/property-order.mjs +448 -0
- package/dist/eslint-plugin/utils/static.cjs +36 -0
- package/dist/eslint-plugin/utils/static.mjs +35 -0
- package/dist/fontsource/directory.cjs +39588 -0
- package/dist/fontsource/directory.mjs +39587 -0
- package/dist/fontsource/server.cjs +291 -0
- package/dist/fontsource/server.mjs +282 -0
- package/dist/index.cjs +10 -0
- package/dist/index.mjs +6 -0
- package/dist/log/browser.cjs +28 -0
- package/dist/log/browser.mjs +28 -0
- package/dist/log/server.cjs +32 -0
- package/dist/log/server.mjs +30 -0
- package/dist/merge/index.cjs +590 -0
- package/dist/merge/index.mjs +586 -0
- package/dist/native/browser.cjs +78 -0
- package/dist/native/browser.mjs +77 -0
- package/dist/native/server.cjs +180 -0
- package/dist/native/server.mjs +176 -0
- package/dist/native/styleTypes.cjs +168 -0
- package/dist/native/styleTypes.mjs +164 -0
- package/dist/parser/classname/server.cjs +239 -0
- package/dist/parser/classname/server.mjs +232 -0
- package/dist/parser/jsx/browser.cjs +66 -0
- package/dist/parser/jsx/browser.mjs +63 -0
- package/dist/parser/jsx/extractCode.cjs +99 -0
- package/dist/parser/jsx/extractCode.mjs +98 -0
- package/dist/parser/jsx/extractPrepared.cjs +123 -0
- package/dist/parser/jsx/extractPrepared.mjs +122 -0
- package/dist/parser/jsx/extractProps.cjs +234 -0
- package/dist/parser/jsx/extractProps.mjs +232 -0
- package/dist/parser/jsx/isDOMProp.cjs +17 -0
- package/dist/parser/jsx/isDOMProp.mjs +15 -0
- package/dist/parser/jsx/native.cjs +110 -0
- package/dist/parser/jsx/native.mjs +108 -0
- package/dist/parser/jsx/runtime.cjs +4 -0
- package/dist/parser/jsx/runtime.mjs +3 -0
- package/dist/parser/jsx/server.cjs +278 -0
- package/dist/parser/jsx/server.mjs +268 -0
- package/dist/postcss/index.cjs +16 -0
- package/dist/postcss/index.mjs +16 -0
- package/dist/prop/at/runtime-only.cjs +90 -0
- package/dist/prop/at/runtime-only.mjs +88 -0
- package/dist/prop/at/server.cjs +282 -0
- package/dist/prop/at/server.mjs +268 -0
- package/dist/prop/at/shared.cjs +153 -0
- package/dist/prop/at/shared.mjs +144 -0
- package/dist/prop/bosswind/browser.cjs +18 -0
- package/dist/prop/bosswind/browser.mjs +16 -0
- package/dist/prop/bosswind/runtime-only.cjs +18 -0
- package/dist/prop/bosswind/runtime-only.mjs +16 -0
- package/dist/prop/bosswind/server.cjs +81 -0
- package/dist/prop/bosswind/server.mjs +72 -0
- package/dist/prop/bosswind/shared.cjs +861 -0
- package/dist/prop/bosswind/shared.mjs +855 -0
- package/dist/prop/bosswind/tailwind-theme.cjs +703 -0
- package/dist/prop/bosswind/tailwind-theme.mjs +702 -0
- package/dist/prop/child/runtime-only.cjs +18 -0
- package/dist/prop/child/runtime-only.mjs +15 -0
- package/dist/prop/child/server.cjs +81 -0
- package/dist/prop/child/server.mjs +72 -0
- package/dist/prop/css/getDtsTemplate.cjs +65 -0
- package/dist/prop/css/getDtsTemplate.mjs +63 -0
- package/dist/prop/css/runtime-only.cjs +14 -0
- package/dist/prop/css/runtime-only.mjs +13 -0
- package/dist/prop/css/server.cjs +99 -0
- package/dist/prop/css/server.mjs +90 -0
- package/dist/prop/pseudo/runtime-only.cjs +23 -0
- package/dist/prop/pseudo/runtime-only.mjs +21 -0
- package/dist/prop/pseudo/server.cjs +91 -0
- package/dist/prop/pseudo/server.mjs +82 -0
- package/dist/prop/pseudo/shared.cjs +61 -0
- package/dist/prop/pseudo/shared.mjs +60 -0
- package/dist/reset/server.cjs +34 -0
- package/dist/reset/server.mjs +26 -0
- package/dist/runtime/index.cjs +119 -0
- package/dist/runtime/index.mjs +118 -0
- package/dist/runtime/preact.cjs +4 -0
- package/dist/runtime/preact.mjs +3 -0
- package/dist/runtime/qwik.cjs +21 -0
- package/dist/runtime/qwik.mjs +18 -0
- package/dist/runtime/react.cjs +4 -0
- package/dist/runtime/react.mjs +3 -0
- package/dist/runtime/solid.cjs +15 -0
- package/dist/runtime/solid.mjs +14 -0
- package/dist/runtime/stencil.cjs +25 -0
- package/dist/runtime/stencil.mjs +21 -0
- package/dist/runtime/style.cjs +14 -0
- package/dist/runtime/style.mjs +13 -0
- package/dist/shared/boundaries.cjs +288 -0
- package/dist/shared/boundaries.mjs +285 -0
- package/dist/shared/customCss.cjs +212 -0
- package/dist/shared/customCss.mjs +211 -0
- package/dist/shared/debug.cjs +76 -0
- package/dist/shared/debug.mjs +74 -0
- package/dist/shared/file.cjs +21 -0
- package/dist/shared/file.mjs +19 -0
- package/dist/shared/framework.cjs +10 -0
- package/dist/shared/framework.mjs +9 -0
- package/dist/shared/json.cjs +58 -0
- package/dist/shared/json.mjs +57 -0
- package/dist/shared/types.cjs +11 -0
- package/dist/shared/types.mjs +10 -0
- package/dist/strategy/classic/runtime-only.cjs +190 -0
- package/dist/strategy/classic/runtime-only.mjs +186 -0
- package/dist/strategy/classname-first/runtime-only.cjs +138 -0
- package/dist/strategy/classname-first/runtime-only.mjs +134 -0
- package/dist/strategy/classname-first/server.cjs +139 -0
- package/dist/strategy/classname-first/server.mjs +133 -0
- package/dist/strategy/classname-only/server.cjs +43 -0
- package/dist/strategy/classname-only/server.mjs +35 -0
- package/dist/strategy/inline-first/browser.cjs +61 -0
- package/dist/strategy/inline-first/browser.mjs +58 -0
- package/dist/strategy/inline-first/runtime-only.cjs +159 -0
- package/dist/strategy/inline-first/runtime-only.mjs +155 -0
- package/dist/strategy/inline-first/server.cjs +92 -0
- package/dist/strategy/inline-first/server.mjs +83 -0
- package/dist/strategy/runtime/runtime-only.cjs +24 -0
- package/dist/strategy/runtime/runtime-only.mjs +22 -0
- package/dist/strategy/runtime/server.cjs +72 -0
- package/dist/strategy/runtime/server.mjs +63 -0
- package/dist/strategy/runtime-only/css.cjs +183 -0
- package/dist/strategy/runtime-only/css.mjs +181 -0
- package/dist/tasks/build.cjs +88 -0
- package/dist/tasks/build.mjs +84 -0
- package/dist/tasks/compile.cjs +12 -0
- package/dist/tasks/compile.mjs +12 -0
- package/dist/tasks/postcss.cjs +116 -0
- package/dist/tasks/postcss.mjs +113 -0
- package/dist/tasks/session.cjs +46 -0
- package/dist/tasks/session.mjs +42 -0
- package/dist/tasks/watch.cjs +102 -0
- package/dist/tasks/watch.mjs +99 -0
- package/dist/transform/cache.cjs +24 -0
- package/dist/transform/cache.mjs +21 -0
- package/dist/transform/processFile.cjs +26 -0
- package/dist/transform/processFile.mjs +24 -0
- package/dist/use/token/browser.cjs +65 -0
- package/dist/use/token/browser.mjs +61 -0
- package/dist/use/token/runtime-only.cjs +245 -0
- package/dist/use/token/runtime-only.mjs +239 -0
- package/dist/use/token/server.cjs +325 -0
- package/dist/use/token/server.mjs +313 -0
- package/dist/use/token/vars.cjs +47 -0
- package/dist/use/token/vars.mjs +46 -0
- package/package.json +300 -4
- package/src/api/config.d.ts +1 -0
- package/src/fontsource/types.d.ts +50 -0
- package/src/packages/document-create-element/createElement.browser.js +3 -0
- package/src/packages/document-create-element/createElement.js +7 -0
- package/src/packages/document-create-element/package.json +17 -0
- package/src/packages/is-css-prop/browser.js +13 -0
- package/src/packages/is-css-prop/index.js +13 -0
- package/src/packages/is-css-prop/package-lock.json +52 -0
- package/src/packages/is-css-prop/package.json +17 -0
- package/src/prop/css/csstype.json +4387 -0
- package/src/prop/css/package.json +3 -0
- package/src/reset/reset.css +259 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { dependencies as dependencies$1 } from "../pseudo/server.mjs";
|
|
3
|
+
import { baseAtValues, buildContainerQuery, buildKeyframesRule, buildMediaQuery, defaultBreakpoints, normalizeKeyframeStep, parseContainerContext, parseKeyframesContext, parseRangeKey } from "./shared.mjs";
|
|
4
|
+
import hash from "@emotion/hash";
|
|
5
|
+
|
|
6
|
+
//#region src/prop/at/server.ts
|
|
7
|
+
var server_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
DOWN: () => DOWN,
|
|
9
|
+
UP: () => UP,
|
|
10
|
+
dependencies: () => dependencies,
|
|
11
|
+
name: () => name,
|
|
12
|
+
onBoot: () => onBoot,
|
|
13
|
+
onProp: () => onProp,
|
|
14
|
+
onReady: () => onReady,
|
|
15
|
+
values: () => values
|
|
16
|
+
});
|
|
17
|
+
const UP = "+";
|
|
18
|
+
const DOWN = "-";
|
|
19
|
+
const name = "at";
|
|
20
|
+
const dependencies = new Set([
|
|
21
|
+
"at",
|
|
22
|
+
"container",
|
|
23
|
+
"keyframes"
|
|
24
|
+
]);
|
|
25
|
+
const values = new Map([...baseAtValues]);
|
|
26
|
+
const onBoot = async (api) => {
|
|
27
|
+
const baseBreakpoints = {
|
|
28
|
+
...defaultBreakpoints,
|
|
29
|
+
...api.breakpoints ?? {}
|
|
30
|
+
};
|
|
31
|
+
api.breakpoints = { ...baseBreakpoints };
|
|
32
|
+
const breakpoints = api.breakpoints;
|
|
33
|
+
Object.entries(breakpoints).forEach(([name, [from, to]]) => [
|
|
34
|
+
["", [from, to]],
|
|
35
|
+
[UP, [from, null]],
|
|
36
|
+
[DOWN, [null, to]]
|
|
37
|
+
].forEach(([symbol, fromTo]) => breakpoints[`${name}${symbol}`] = fromTo));
|
|
38
|
+
Object.entries(breakpoints).forEach(([name, [from, to]]) => {
|
|
39
|
+
dependencies.add(name);
|
|
40
|
+
if (from === null) values.set(name, `@media screen and (max-width: ${to}px)`);
|
|
41
|
+
else if (to === null) values.set(name, `@media screen and (min-width: ${from}px)`);
|
|
42
|
+
else values.set(name, `@media screen and (min-width: ${from}px) and (max-width: ${to}px)`);
|
|
43
|
+
});
|
|
44
|
+
Array.from(values.keys()).forEach((name) => dependencies.add(name));
|
|
45
|
+
api.file.js.dts.set("body", `pseudo:AtPropsShorthandsInterfaceStart`, `export interface $$AtPropsShorthands {`);
|
|
46
|
+
for (const name of dependencies) {
|
|
47
|
+
if (name === "container") continue;
|
|
48
|
+
const description = name === "keyframes" ? "@keyframes" : values.get(name) ?? "";
|
|
49
|
+
const prop = {
|
|
50
|
+
property: name,
|
|
51
|
+
aliases: [name],
|
|
52
|
+
description
|
|
53
|
+
};
|
|
54
|
+
api.dictionary.set(name, prop);
|
|
55
|
+
name !== "at" && api.file.js.dts.set("body", `at:${name}:description`, prop.description).set("body", `at:${name}:declaration`, ` "${name}"?: ${name === "keyframes" ? "$$KeyframesProps" : "$$FinalProps"}\n`);
|
|
56
|
+
}
|
|
57
|
+
api.file.js.dts.set("body", `pseudo:AtPropsShorthandsInterfaceEnd`, `}`).set("body", "$$:KeyframesProps", `export type $$KeyframesProps = {
|
|
58
|
+
[key: string]: $$FinalProps
|
|
59
|
+
}`).set("body", "$$:AtNamedProps", `export type $$AtNamedProps = {
|
|
60
|
+
[key in \`container_\${string}\`]?: StandardProperties['container'] | $$FinalProps
|
|
61
|
+
} & {
|
|
62
|
+
[key in \`keyframes_\${string}\`]?: $$KeyframesProps
|
|
63
|
+
}`).set("body", `$$:AtProps`, `export type $$AtProps = {
|
|
64
|
+
at?: {
|
|
65
|
+
[key: string]: $$FinalProps | $$KeyframesProps
|
|
66
|
+
} & { [key: \`keyframes \${string}\`]: $$KeyframesProps } & $$AtPropsShorthands & $$AtNamedProps
|
|
67
|
+
} & $$AtPropsShorthands & $$AtNamedProps`).replace("body", `$$:FinalProps`, (v) => `${v} & $$AtProps`);
|
|
68
|
+
const runtimeConfig = api.runtime;
|
|
69
|
+
if (Boolean(runtimeConfig && (runtimeConfig.only !== void 0 || runtimeConfig.strategy))) {
|
|
70
|
+
api.file.js.importAndConfig({
|
|
71
|
+
name: "onInit",
|
|
72
|
+
from: "boss-css/prop/at/runtime-only"
|
|
73
|
+
}, () => true);
|
|
74
|
+
api.file.js.config({
|
|
75
|
+
from: "boss-css/prop/at/runtime-only",
|
|
76
|
+
config: { breakpoints: baseBreakpoints }
|
|
77
|
+
}, () => true);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const onReady = async (api) => {
|
|
81
|
+
const updateFinalProps = (value) => {
|
|
82
|
+
const content = typeof value === "string" ? value : value?.content;
|
|
83
|
+
if (typeof content !== "string") return value;
|
|
84
|
+
if (!content.includes("StandardProperties")) return content;
|
|
85
|
+
if (content.includes(`Omit<StandardProperties, 'container'>`)) return content;
|
|
86
|
+
return content.replace(" & StandardProperties", () => {
|
|
87
|
+
return ` & Omit<StandardProperties, 'container'> & { container?: StandardProperties['container'] | $$FinalProps }`;
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
api.file.js.dts.replace("body", "$$:FinalProps", updateFinalProps);
|
|
91
|
+
};
|
|
92
|
+
const isContainerContext = (value) => Boolean(parseContainerContext(value));
|
|
93
|
+
const isKeyframesContext = (value) => Boolean(parseKeyframesContext(value));
|
|
94
|
+
const getContainerInfo = (contexts) => {
|
|
95
|
+
for (let i = contexts.length - 1; i >= 0; i -= 1) {
|
|
96
|
+
const info = parseContainerContext(contexts[i]);
|
|
97
|
+
if (info) return info;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
};
|
|
101
|
+
const getContainerInfoWithIndex = (contexts) => {
|
|
102
|
+
for (let i = contexts.length - 1; i >= 0; i -= 1) {
|
|
103
|
+
const info = parseContainerContext(contexts[i]);
|
|
104
|
+
if (info) return {
|
|
105
|
+
...info,
|
|
106
|
+
index: i
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
};
|
|
111
|
+
const resolveMediaQuery = (api, key) => {
|
|
112
|
+
const direct = values.get(key);
|
|
113
|
+
if (direct) return direct;
|
|
114
|
+
const range = parseRangeKey(key, api.breakpoints ?? {}, api.unit ?? "px");
|
|
115
|
+
if (range) return buildMediaQuery(range) ?? key;
|
|
116
|
+
return key;
|
|
117
|
+
};
|
|
118
|
+
const resolveContainerQuery = (api, key, name) => {
|
|
119
|
+
if (key.startsWith("@")) return key;
|
|
120
|
+
const range = parseRangeKey(key, api.breakpoints ?? {}, api.unit ?? "px");
|
|
121
|
+
if (range) return buildContainerQuery(range, name);
|
|
122
|
+
return `${name ? `@container ${name}` : "@container"} ${key}`;
|
|
123
|
+
};
|
|
124
|
+
const resolveAtQuery = (api, contexts, key) => {
|
|
125
|
+
const containerInfo = getContainerInfo(contexts);
|
|
126
|
+
if (containerInfo) return resolveContainerQuery(api, key, containerInfo.name);
|
|
127
|
+
return resolveMediaQuery(api, key);
|
|
128
|
+
};
|
|
129
|
+
const resolveQueryFromContexts = (api, contexts) => {
|
|
130
|
+
const atIndex = contexts.lastIndexOf("at");
|
|
131
|
+
if (atIndex !== -1 && contexts[atIndex + 1]) {
|
|
132
|
+
const containerInfo$1 = parseContainerContext(contexts[atIndex + 1]);
|
|
133
|
+
if (containerInfo$1) {
|
|
134
|
+
const key$1 = contexts[atIndex + 2];
|
|
135
|
+
if (!key$1) return null;
|
|
136
|
+
return resolveContainerQuery(api, key$1, containerInfo$1.name);
|
|
137
|
+
}
|
|
138
|
+
const key = contexts[atIndex + 1];
|
|
139
|
+
return resolveMediaQuery(api, key);
|
|
140
|
+
}
|
|
141
|
+
const containerInfo = getContainerInfoWithIndex(contexts);
|
|
142
|
+
if (containerInfo) {
|
|
143
|
+
const key = contexts[containerInfo.index + 1];
|
|
144
|
+
if (key) return resolveContainerQuery(api, key, containerInfo.name);
|
|
145
|
+
}
|
|
146
|
+
for (let i = contexts.length - 1; i >= 0; i -= 1) {
|
|
147
|
+
const key = contexts[i];
|
|
148
|
+
if (key.startsWith("@")) return key;
|
|
149
|
+
const range = parseRangeKey(key, api.breakpoints ?? {}, api.unit ?? "px");
|
|
150
|
+
if (range) return buildMediaQuery(range) ?? key;
|
|
151
|
+
const direct = values.get(key);
|
|
152
|
+
if (direct) return direct;
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
};
|
|
156
|
+
const buildAutoKeyframesName = (api, contexts) => {
|
|
157
|
+
return `kf-${hash(`${api.selectorPrefix ?? ""}|${contexts.join("|")}`)}`;
|
|
158
|
+
};
|
|
159
|
+
const onProp = async (api, { name, prop, contexts, preferVariables, file }) => {
|
|
160
|
+
const isAt = name === "at";
|
|
161
|
+
const contextName = prop?.named ? `${name} ${prop.named}` : name;
|
|
162
|
+
const handleKeyframes = async (entries, activeContexts) => {
|
|
163
|
+
const keyframesContext = activeContexts.at(-1);
|
|
164
|
+
if (!keyframesContext) return;
|
|
165
|
+
const keyframesInfo = parseKeyframesContext(keyframesContext);
|
|
166
|
+
if (!keyframesInfo) return;
|
|
167
|
+
const keyframesName = keyframesInfo.name ?? buildAutoKeyframesName(api, activeContexts);
|
|
168
|
+
const query = resolveQueryFromContexts(api, activeContexts);
|
|
169
|
+
const frames = /* @__PURE__ */ new Map();
|
|
170
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
171
|
+
for (const [step, stepProp] of Object.entries(entries)) {
|
|
172
|
+
if (!stepProp?.value || typeof stepProp.value !== "object" || Array.isArray(stepProp.value)) continue;
|
|
173
|
+
const normalizedStep = normalizeKeyframeStep(step);
|
|
174
|
+
if (!normalizedStep) continue;
|
|
175
|
+
const stepContexts = [...activeContexts, step];
|
|
176
|
+
const stepEntries = stepProp.value;
|
|
177
|
+
for (const [propName, propValue] of Object.entries(stepEntries)) {
|
|
178
|
+
if (!propValue || typeof propValue !== "object" || Array.isArray(propValue)) continue;
|
|
179
|
+
const resolved = api.dictionary.resolve(propName);
|
|
180
|
+
const descriptor = resolved.descriptor;
|
|
181
|
+
const isCustomProperty = typeof propName === "string" && propName.startsWith("--");
|
|
182
|
+
if (!descriptor?.isCSSProp && !isCustomProperty) continue;
|
|
183
|
+
const propertyName = isCustomProperty ? propName : descriptor?.property ?? api.camelCaseToDash(propName);
|
|
184
|
+
const selectorValue = propValue.selectorValue ?? (preferVariables ? null : propValue.value);
|
|
185
|
+
const classToken = propValue.classToken;
|
|
186
|
+
const resolvedName = resolved?.name ?? propName;
|
|
187
|
+
const className = classToken ? null : api.contextToClassName(resolvedName, selectorValue, stepContexts, true, api.selectorPrefix);
|
|
188
|
+
const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
|
|
189
|
+
const pseudoChain = stepContexts.filter((context) => dependencies$1.has(context));
|
|
190
|
+
const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
|
|
191
|
+
const selector = api.applyChildSelectors(baseWithPseudos, stepContexts);
|
|
192
|
+
selectors.add(selector);
|
|
193
|
+
const value = propValue.value === null ? `var(${api.contextToCSSVariable(resolvedName, null, stepContexts, api.selectorPrefix)})` : String(api.dictionary.toValue(propValue.value, propertyName));
|
|
194
|
+
if (!frames.has(normalizedStep)) frames.set(normalizedStep, /* @__PURE__ */ new Map());
|
|
195
|
+
frames.get(normalizedStep)?.set(propertyName, value);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!frames.size) return;
|
|
199
|
+
api.css.addRule(buildKeyframesRule(keyframesName, frames), query);
|
|
200
|
+
const needsImportant = api.strategy === "inline-first" && preferVariables === true && activeContexts.length > 0;
|
|
201
|
+
for (const selector of selectors) {
|
|
202
|
+
api.css.selector({
|
|
203
|
+
selector,
|
|
204
|
+
query
|
|
205
|
+
});
|
|
206
|
+
api.css.rule("animation-name", keyframesName, needsImportant ? { important: true } : void 0);
|
|
207
|
+
api.css.write();
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const processEntries = async (entries, nextContexts) => {
|
|
211
|
+
for (const [key, styleProp] of Object.entries(entries)) {
|
|
212
|
+
if (!styleProp?.value || typeof styleProp.value !== "object" || Array.isArray(styleProp.value)) continue;
|
|
213
|
+
const styleEntries = styleProp.value;
|
|
214
|
+
if (isContainerContext(key)) {
|
|
215
|
+
nextContexts.push(key);
|
|
216
|
+
await processEntries(styleEntries, nextContexts);
|
|
217
|
+
nextContexts.pop();
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (isKeyframesContext(key)) {
|
|
221
|
+
nextContexts.push(key);
|
|
222
|
+
await handleKeyframes(styleEntries, nextContexts);
|
|
223
|
+
nextContexts.pop();
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
nextContexts.push(key);
|
|
227
|
+
const query = resolveAtQuery(api, nextContexts, key);
|
|
228
|
+
for (const i in styleEntries) {
|
|
229
|
+
const entry = styleEntries[i];
|
|
230
|
+
const classToken = entry?.classToken;
|
|
231
|
+
const resolved = api.dictionary.resolve(i);
|
|
232
|
+
const resolvedName = resolved.descriptor ? resolved.name : i;
|
|
233
|
+
if (resolved.suffix) {
|
|
234
|
+
entry.named = resolved.suffix;
|
|
235
|
+
entry.rawName = resolved.raw;
|
|
236
|
+
}
|
|
237
|
+
const selectorValue = entry?.selectorValue ?? (preferVariables ? null : entry.value);
|
|
238
|
+
const className = classToken ? null : api.contextToClassName(resolvedName, selectorValue, nextContexts, true, api.selectorPrefix);
|
|
239
|
+
const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
|
|
240
|
+
const pseudoChain = nextContexts.filter((context) => dependencies$1.has(context));
|
|
241
|
+
const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
|
|
242
|
+
const selector = api.applyChildSelectors(baseWithPseudos, nextContexts);
|
|
243
|
+
if (query && entry && !entry.query) entry.query = query;
|
|
244
|
+
api.css.selector({
|
|
245
|
+
selector,
|
|
246
|
+
query
|
|
247
|
+
});
|
|
248
|
+
await api.trigger("onProp", {
|
|
249
|
+
name: resolvedName,
|
|
250
|
+
prop: entry,
|
|
251
|
+
contexts: nextContexts,
|
|
252
|
+
preferVariables,
|
|
253
|
+
file
|
|
254
|
+
}, ({ dependencies }) => {
|
|
255
|
+
return !dependencies || dependencies.has(resolvedName);
|
|
256
|
+
});
|
|
257
|
+
if (api.css.current) api.css.write();
|
|
258
|
+
}
|
|
259
|
+
nextContexts.pop();
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
if (isAt) contexts.push(name);
|
|
263
|
+
await processEntries(isAt ? prop.value : { [contextName]: { value: prop.value } }, contexts);
|
|
264
|
+
if (isAt) contexts.pop();
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
export { DOWN, UP, dependencies, name, onBoot, onProp, onReady, server_exports, values };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/prop/at/shared.ts
|
|
3
|
+
const defaultBreakpoints = {
|
|
4
|
+
micro: [null, 375],
|
|
5
|
+
mobile: [376, 639],
|
|
6
|
+
tablet: [640, 1023],
|
|
7
|
+
small: [1024, 1439],
|
|
8
|
+
medium: [1440, 1919],
|
|
9
|
+
large: [1920, null],
|
|
10
|
+
device: [null, 1023]
|
|
11
|
+
};
|
|
12
|
+
const baseAtValues = [
|
|
13
|
+
["dark", "@media screen and (prefers-color-scheme: dark)"],
|
|
14
|
+
["light", "@media screen and (prefers-color-scheme: light)"],
|
|
15
|
+
["hdpi", "@media and screen (min-resolution: 192dpi)"]
|
|
16
|
+
];
|
|
17
|
+
const numberWithUnit = /^(-?\d+(?:\.\d+)?)([a-z%]+)?$/i;
|
|
18
|
+
const parseNumeric = (value, unit) => {
|
|
19
|
+
const match = value.match(numberWithUnit);
|
|
20
|
+
if (!match) return null;
|
|
21
|
+
const [, number, suffix] = match;
|
|
22
|
+
return `${number}${suffix ?? unit}`;
|
|
23
|
+
};
|
|
24
|
+
const parseBreakpoint = (name, bound, breakpoints) => {
|
|
25
|
+
const entry = breakpoints[name];
|
|
26
|
+
if (!entry) return null;
|
|
27
|
+
const value = bound === "min" ? entry[0] : entry[1];
|
|
28
|
+
if (value === null || value === void 0) return null;
|
|
29
|
+
return `${value}px`;
|
|
30
|
+
};
|
|
31
|
+
const parseBound = (value, bound, breakpoints, unit) => {
|
|
32
|
+
return parseBreakpoint(value, bound, breakpoints) ?? parseNumeric(value, unit);
|
|
33
|
+
};
|
|
34
|
+
const parseRangeKey = (key, breakpoints, unit) => {
|
|
35
|
+
if (!key) return null;
|
|
36
|
+
if (key.endsWith("+")) {
|
|
37
|
+
const min = parseBound(key.slice(0, -1), "min", breakpoints, unit);
|
|
38
|
+
return min ? {
|
|
39
|
+
min,
|
|
40
|
+
max: null
|
|
41
|
+
} : null;
|
|
42
|
+
}
|
|
43
|
+
if (key.endsWith("-")) {
|
|
44
|
+
const max = parseBound(key.slice(0, -1), "max", breakpoints, unit);
|
|
45
|
+
return max ? {
|
|
46
|
+
min: null,
|
|
47
|
+
max
|
|
48
|
+
} : null;
|
|
49
|
+
}
|
|
50
|
+
const rangeIndex = key.lastIndexOf("-");
|
|
51
|
+
if (rangeIndex > 0 && rangeIndex < key.length - 1) {
|
|
52
|
+
const min = parseBound(key.slice(0, rangeIndex), "min", breakpoints, unit);
|
|
53
|
+
const max = parseBound(key.slice(rangeIndex + 1), "max", breakpoints, unit);
|
|
54
|
+
if (min || max) return {
|
|
55
|
+
min: min ?? null,
|
|
56
|
+
max: max ?? null
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const entry = breakpoints[key];
|
|
60
|
+
if (entry) {
|
|
61
|
+
const min = entry[0] == null ? null : `${entry[0]}px`;
|
|
62
|
+
const max = entry[1] == null ? null : `${entry[1]}px`;
|
|
63
|
+
if (min || max) return {
|
|
64
|
+
min,
|
|
65
|
+
max
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
};
|
|
70
|
+
const buildMediaQuery = (range) => {
|
|
71
|
+
const parts = [];
|
|
72
|
+
if (range.min) parts.push(`(min-width: ${range.min})`);
|
|
73
|
+
if (range.max) parts.push(`(max-width: ${range.max})`);
|
|
74
|
+
if (!parts.length) return null;
|
|
75
|
+
return `@media screen and ${parts.join(" and ")}`;
|
|
76
|
+
};
|
|
77
|
+
const buildContainerQuery = (range, name) => {
|
|
78
|
+
const parts = [];
|
|
79
|
+
if (range.min) parts.push(`(min-width: ${range.min})`);
|
|
80
|
+
if (range.max) parts.push(`(max-width: ${range.max})`);
|
|
81
|
+
const prefix = name ? `@container ${name}` : "@container";
|
|
82
|
+
if (!parts.length) return prefix;
|
|
83
|
+
return `${prefix} ${parts.join(" and ")}`;
|
|
84
|
+
};
|
|
85
|
+
const parseContainerContext = (context) => {
|
|
86
|
+
if (!context) return null;
|
|
87
|
+
if (context === "container") return { name: null };
|
|
88
|
+
if (context.startsWith("container ")) {
|
|
89
|
+
const name = context.slice(10).trim();
|
|
90
|
+
return name ? { name } : null;
|
|
91
|
+
}
|
|
92
|
+
if (context.startsWith("container_")) {
|
|
93
|
+
const name = context.slice(10).trim();
|
|
94
|
+
return name ? { name } : null;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
const keyframeStepPattern = /^\d+(?:\.\d+)?%$/;
|
|
99
|
+
const normalizeKeyframeStep = (step) => {
|
|
100
|
+
if (!step) return null;
|
|
101
|
+
const trimmed = step.trim().toLowerCase();
|
|
102
|
+
if (trimmed === "from") return "0%";
|
|
103
|
+
if (trimmed === "to") return "100%";
|
|
104
|
+
if (keyframeStepPattern.test(trimmed)) return trimmed;
|
|
105
|
+
return null;
|
|
106
|
+
};
|
|
107
|
+
const sortKeyframeSteps = (steps) => {
|
|
108
|
+
const entries = steps.map((step, index) => {
|
|
109
|
+
return {
|
|
110
|
+
step,
|
|
111
|
+
index,
|
|
112
|
+
order: keyframeStepPattern.test(step) ? Number(step.slice(0, -1)) : null
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
entries.sort((a, b) => {
|
|
116
|
+
if (a.order !== null && b.order !== null) return a.order - b.order;
|
|
117
|
+
if (a.order !== null) return -1;
|
|
118
|
+
if (b.order !== null) return 1;
|
|
119
|
+
return a.index - b.index;
|
|
120
|
+
});
|
|
121
|
+
return entries.map((entry) => entry.step);
|
|
122
|
+
};
|
|
123
|
+
const buildKeyframesRule = (name, frames) => {
|
|
124
|
+
return `@keyframes ${name} { ${sortKeyframeSteps(Array.from(frames.keys())).map((step) => {
|
|
125
|
+
const props = frames.get(step);
|
|
126
|
+
if (!props || props.size === 0) return "";
|
|
127
|
+
return `${step} { ${Array.from(props.entries()).map(([prop, value]) => `${prop}: ${value}`).join("; ")} }`;
|
|
128
|
+
}).filter(Boolean).join(" ")} }`;
|
|
129
|
+
};
|
|
130
|
+
const parseKeyframesContext = (context) => {
|
|
131
|
+
if (!context) return null;
|
|
132
|
+
if (context === "keyframes") return { name: null };
|
|
133
|
+
if (context.startsWith("keyframes ")) {
|
|
134
|
+
const name = context.slice(10).trim();
|
|
135
|
+
return name ? { name } : null;
|
|
136
|
+
}
|
|
137
|
+
if (context.startsWith("keyframes_")) {
|
|
138
|
+
const name = context.slice(10).trim();
|
|
139
|
+
return name ? { name } : null;
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
//#endregion
|
|
145
|
+
exports.baseAtValues = baseAtValues;
|
|
146
|
+
exports.buildContainerQuery = buildContainerQuery;
|
|
147
|
+
exports.buildKeyframesRule = buildKeyframesRule;
|
|
148
|
+
exports.buildMediaQuery = buildMediaQuery;
|
|
149
|
+
exports.defaultBreakpoints = defaultBreakpoints;
|
|
150
|
+
exports.normalizeKeyframeStep = normalizeKeyframeStep;
|
|
151
|
+
exports.parseContainerContext = parseContainerContext;
|
|
152
|
+
exports.parseKeyframesContext = parseKeyframesContext;
|
|
153
|
+
exports.parseRangeKey = parseRangeKey;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
//#region src/prop/at/shared.ts
|
|
2
|
+
const defaultBreakpoints = {
|
|
3
|
+
micro: [null, 375],
|
|
4
|
+
mobile: [376, 639],
|
|
5
|
+
tablet: [640, 1023],
|
|
6
|
+
small: [1024, 1439],
|
|
7
|
+
medium: [1440, 1919],
|
|
8
|
+
large: [1920, null],
|
|
9
|
+
device: [null, 1023]
|
|
10
|
+
};
|
|
11
|
+
const baseAtValues = [
|
|
12
|
+
["dark", "@media screen and (prefers-color-scheme: dark)"],
|
|
13
|
+
["light", "@media screen and (prefers-color-scheme: light)"],
|
|
14
|
+
["hdpi", "@media and screen (min-resolution: 192dpi)"]
|
|
15
|
+
];
|
|
16
|
+
const numberWithUnit = /^(-?\d+(?:\.\d+)?)([a-z%]+)?$/i;
|
|
17
|
+
const parseNumeric = (value, unit) => {
|
|
18
|
+
const match = value.match(numberWithUnit);
|
|
19
|
+
if (!match) return null;
|
|
20
|
+
const [, number, suffix] = match;
|
|
21
|
+
return `${number}${suffix ?? unit}`;
|
|
22
|
+
};
|
|
23
|
+
const parseBreakpoint = (name, bound, breakpoints) => {
|
|
24
|
+
const entry = breakpoints[name];
|
|
25
|
+
if (!entry) return null;
|
|
26
|
+
const value = bound === "min" ? entry[0] : entry[1];
|
|
27
|
+
if (value === null || value === void 0) return null;
|
|
28
|
+
return `${value}px`;
|
|
29
|
+
};
|
|
30
|
+
const parseBound = (value, bound, breakpoints, unit) => {
|
|
31
|
+
return parseBreakpoint(value, bound, breakpoints) ?? parseNumeric(value, unit);
|
|
32
|
+
};
|
|
33
|
+
const parseRangeKey = (key, breakpoints, unit) => {
|
|
34
|
+
if (!key) return null;
|
|
35
|
+
if (key.endsWith("+")) {
|
|
36
|
+
const min = parseBound(key.slice(0, -1), "min", breakpoints, unit);
|
|
37
|
+
return min ? {
|
|
38
|
+
min,
|
|
39
|
+
max: null
|
|
40
|
+
} : null;
|
|
41
|
+
}
|
|
42
|
+
if (key.endsWith("-")) {
|
|
43
|
+
const max = parseBound(key.slice(0, -1), "max", breakpoints, unit);
|
|
44
|
+
return max ? {
|
|
45
|
+
min: null,
|
|
46
|
+
max
|
|
47
|
+
} : null;
|
|
48
|
+
}
|
|
49
|
+
const rangeIndex = key.lastIndexOf("-");
|
|
50
|
+
if (rangeIndex > 0 && rangeIndex < key.length - 1) {
|
|
51
|
+
const min = parseBound(key.slice(0, rangeIndex), "min", breakpoints, unit);
|
|
52
|
+
const max = parseBound(key.slice(rangeIndex + 1), "max", breakpoints, unit);
|
|
53
|
+
if (min || max) return {
|
|
54
|
+
min: min ?? null,
|
|
55
|
+
max: max ?? null
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const entry = breakpoints[key];
|
|
59
|
+
if (entry) {
|
|
60
|
+
const min = entry[0] == null ? null : `${entry[0]}px`;
|
|
61
|
+
const max = entry[1] == null ? null : `${entry[1]}px`;
|
|
62
|
+
if (min || max) return {
|
|
63
|
+
min,
|
|
64
|
+
max
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
const buildMediaQuery = (range) => {
|
|
70
|
+
const parts = [];
|
|
71
|
+
if (range.min) parts.push(`(min-width: ${range.min})`);
|
|
72
|
+
if (range.max) parts.push(`(max-width: ${range.max})`);
|
|
73
|
+
if (!parts.length) return null;
|
|
74
|
+
return `@media screen and ${parts.join(" and ")}`;
|
|
75
|
+
};
|
|
76
|
+
const buildContainerQuery = (range, name) => {
|
|
77
|
+
const parts = [];
|
|
78
|
+
if (range.min) parts.push(`(min-width: ${range.min})`);
|
|
79
|
+
if (range.max) parts.push(`(max-width: ${range.max})`);
|
|
80
|
+
const prefix = name ? `@container ${name}` : "@container";
|
|
81
|
+
if (!parts.length) return prefix;
|
|
82
|
+
return `${prefix} ${parts.join(" and ")}`;
|
|
83
|
+
};
|
|
84
|
+
const parseContainerContext = (context) => {
|
|
85
|
+
if (!context) return null;
|
|
86
|
+
if (context === "container") return { name: null };
|
|
87
|
+
if (context.startsWith("container ")) {
|
|
88
|
+
const name = context.slice(10).trim();
|
|
89
|
+
return name ? { name } : null;
|
|
90
|
+
}
|
|
91
|
+
if (context.startsWith("container_")) {
|
|
92
|
+
const name = context.slice(10).trim();
|
|
93
|
+
return name ? { name } : null;
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
97
|
+
const keyframeStepPattern = /^\d+(?:\.\d+)?%$/;
|
|
98
|
+
const normalizeKeyframeStep = (step) => {
|
|
99
|
+
if (!step) return null;
|
|
100
|
+
const trimmed = step.trim().toLowerCase();
|
|
101
|
+
if (trimmed === "from") return "0%";
|
|
102
|
+
if (trimmed === "to") return "100%";
|
|
103
|
+
if (keyframeStepPattern.test(trimmed)) return trimmed;
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
106
|
+
const sortKeyframeSteps = (steps) => {
|
|
107
|
+
const entries = steps.map((step, index) => {
|
|
108
|
+
return {
|
|
109
|
+
step,
|
|
110
|
+
index,
|
|
111
|
+
order: keyframeStepPattern.test(step) ? Number(step.slice(0, -1)) : null
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
entries.sort((a, b) => {
|
|
115
|
+
if (a.order !== null && b.order !== null) return a.order - b.order;
|
|
116
|
+
if (a.order !== null) return -1;
|
|
117
|
+
if (b.order !== null) return 1;
|
|
118
|
+
return a.index - b.index;
|
|
119
|
+
});
|
|
120
|
+
return entries.map((entry) => entry.step);
|
|
121
|
+
};
|
|
122
|
+
const buildKeyframesRule = (name, frames) => {
|
|
123
|
+
return `@keyframes ${name} { ${sortKeyframeSteps(Array.from(frames.keys())).map((step) => {
|
|
124
|
+
const props = frames.get(step);
|
|
125
|
+
if (!props || props.size === 0) return "";
|
|
126
|
+
return `${step} { ${Array.from(props.entries()).map(([prop, value]) => `${prop}: ${value}`).join("; ")} }`;
|
|
127
|
+
}).filter(Boolean).join(" ")} }`;
|
|
128
|
+
};
|
|
129
|
+
const parseKeyframesContext = (context) => {
|
|
130
|
+
if (!context) return null;
|
|
131
|
+
if (context === "keyframes") return { name: null };
|
|
132
|
+
if (context.startsWith("keyframes ")) {
|
|
133
|
+
const name = context.slice(10).trim();
|
|
134
|
+
return name ? { name } : null;
|
|
135
|
+
}
|
|
136
|
+
if (context.startsWith("keyframes_")) {
|
|
137
|
+
const name = context.slice(10).trim();
|
|
138
|
+
return name ? { name } : null;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
export { baseAtValues, buildContainerQuery, buildKeyframesRule, buildMediaQuery, defaultBreakpoints, normalizeKeyframeStep, parseContainerContext, parseKeyframesContext, parseRangeKey };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_shared = require('./shared.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/prop/bosswind/browser.ts
|
|
4
|
+
const name = "bosswind";
|
|
5
|
+
const onInit = (api) => {
|
|
6
|
+
require_shared.registerBosswindDictionary(api);
|
|
7
|
+
};
|
|
8
|
+
const onBrowserObjectStart = (api, { input }) => {
|
|
9
|
+
if (!input || typeof input !== "object") return;
|
|
10
|
+
const rewritten = require_shared.rewriteBosswindInput(api, input, api.bosswind ?? {});
|
|
11
|
+
Object.keys(input).forEach((key) => delete input[key]);
|
|
12
|
+
Object.assign(input, rewritten);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.name = name;
|
|
17
|
+
exports.onBrowserObjectStart = onBrowserObjectStart;
|
|
18
|
+
exports.onInit = onInit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { registerBosswindDictionary, rewriteBosswindInput } from "./shared.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/prop/bosswind/browser.ts
|
|
4
|
+
const name = "bosswind";
|
|
5
|
+
const onInit = (api) => {
|
|
6
|
+
registerBosswindDictionary(api);
|
|
7
|
+
};
|
|
8
|
+
const onBrowserObjectStart = (api, { input }) => {
|
|
9
|
+
if (!input || typeof input !== "object") return;
|
|
10
|
+
const rewritten = rewriteBosswindInput(api, input, api.bosswind ?? {});
|
|
11
|
+
Object.keys(input).forEach((key) => delete input[key]);
|
|
12
|
+
Object.assign(input, rewritten);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { name, onBrowserObjectStart, onInit };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_shared = require('./shared.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/prop/bosswind/runtime-only.ts
|
|
4
|
+
const name = "bosswind";
|
|
5
|
+
const onInit = (api) => {
|
|
6
|
+
require_shared.registerBosswindDictionary(api);
|
|
7
|
+
};
|
|
8
|
+
const onBrowserObjectStart = (api, { input }) => {
|
|
9
|
+
if (!input || typeof input !== "object") return;
|
|
10
|
+
const rewritten = require_shared.rewriteBosswindInput(api, input, api.bosswind ?? {});
|
|
11
|
+
Object.keys(input).forEach((key) => delete input[key]);
|
|
12
|
+
Object.assign(input, rewritten);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.name = name;
|
|
17
|
+
exports.onBrowserObjectStart = onBrowserObjectStart;
|
|
18
|
+
exports.onInit = onInit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { registerBosswindDictionary, rewriteBosswindInput } from "./shared.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/prop/bosswind/runtime-only.ts
|
|
4
|
+
const name = "bosswind";
|
|
5
|
+
const onInit = (api) => {
|
|
6
|
+
registerBosswindDictionary(api);
|
|
7
|
+
};
|
|
8
|
+
const onBrowserObjectStart = (api, { input }) => {
|
|
9
|
+
if (!input || typeof input !== "object") return;
|
|
10
|
+
const rewritten = rewriteBosswindInput(api, input, api.bosswind ?? {});
|
|
11
|
+
Object.keys(input).forEach((key) => delete input[key]);
|
|
12
|
+
Object.assign(input, rewritten);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { name, onBrowserObjectStart, onInit };
|