boss-css 0.0.13 → 0.0.15
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/LICENSE +21 -0
- package/README.md +146 -1
- package/dist/ai/server.cjs +1 -0
- package/dist/ai/server.mjs +1 -0
- package/dist/ai/skills.cjs +3 -0
- package/dist/ai/skills.mjs +3 -0
- package/dist/cli/tasks/init.cjs +43 -21
- package/dist/cli/tasks/init.mjs +43 -21
- package/dist/cli/templates/init.cjs +5 -5
- package/dist/cli/templates/init.mjs +5 -5
- package/dist/compile/jsx.cjs +4 -2
- package/dist/compile/jsx.mjs +4 -2
- package/dist/devtools-app/index.mjs +320 -0
- package/dist/devtools-app/monaco/vs/_commonjsHelpers-CT9FvmAN.js +1 -0
- package/dist/devtools-app/monaco/vs/abap-D-t0cyap.js +1 -0
- package/dist/devtools-app/monaco/vs/apex-CcIm7xu6.js +1 -0
- package/dist/devtools-app/monaco/vs/assets/css.worker-HnVq6Ewq.js +93 -0
- package/dist/devtools-app/monaco/vs/assets/editor.worker-Be8ye1pW.js +26 -0
- package/dist/devtools-app/monaco/vs/assets/html.worker-B51mlPHg.js +470 -0
- package/dist/devtools-app/monaco/vs/assets/json.worker-DKiEKt88.js +58 -0
- package/dist/devtools-app/monaco/vs/assets/ts.worker-CMbG-7ft.js +67731 -0
- package/dist/devtools-app/monaco/vs/azcli-BA0tQDCg.js +1 -0
- package/dist/devtools-app/monaco/vs/basic-languages/monaco.contribution.js +1 -0
- package/dist/devtools-app/monaco/vs/bat-C397hTD6.js +1 -0
- package/dist/devtools-app/monaco/vs/bicep-DF5aW17k.js +2 -0
- package/dist/devtools-app/monaco/vs/cameligo-plsz8qhj.js +1 -0
- package/dist/devtools-app/monaco/vs/clojure-Y2auQMzK.js +1 -0
- package/dist/devtools-app/monaco/vs/coffee-Bu45yuWE.js +1 -0
- package/dist/devtools-app/monaco/vs/cpp-CkKPQIni.js +1 -0
- package/dist/devtools-app/monaco/vs/csharp-CX28MZyh.js +1 -0
- package/dist/devtools-app/monaco/vs/csp-D8uWnyxW.js +1 -0
- package/dist/devtools-app/monaco/vs/css-CaeNmE3S.js +3 -0
- package/dist/devtools-app/monaco/vs/cssMode-CjiAH6dQ.js +1 -0
- package/dist/devtools-app/monaco/vs/cypher-DVThT8BS.js +1 -0
- package/dist/devtools-app/monaco/vs/dart-CmGfCvrO.js +1 -0
- package/dist/devtools-app/monaco/vs/dockerfile-CZqqYdch.js +1 -0
- package/dist/devtools-app/monaco/vs/ecl-30fUercY.js +1 -0
- package/dist/devtools-app/monaco/vs/editor/editor.main.css +1 -0
- package/dist/devtools-app/monaco/vs/editor/editor.main.js +5 -0
- package/dist/devtools-app/monaco/vs/editor.api-CalNCsUg.js +903 -0
- package/dist/devtools-app/monaco/vs/elixir-xjPaIfzF.js +1 -0
- package/dist/devtools-app/monaco/vs/flow9-DqtmStfK.js +1 -0
- package/dist/devtools-app/monaco/vs/freemarker2-Cz_sV6Md.js +3 -0
- package/dist/devtools-app/monaco/vs/fsharp-BOMdg4U1.js +1 -0
- package/dist/devtools-app/monaco/vs/go-D_hbi-Jt.js +1 -0
- package/dist/devtools-app/monaco/vs/graphql-CKUU4kLG.js +1 -0
- package/dist/devtools-app/monaco/vs/handlebars-OwglfO-1.js +1 -0
- package/dist/devtools-app/monaco/vs/hcl-DTaboeZW.js +1 -0
- package/dist/devtools-app/monaco/vs/html-Pa1xEWsY.js +1 -0
- package/dist/devtools-app/monaco/vs/htmlMode-Bz67EXwp.js +1 -0
- package/dist/devtools-app/monaco/vs/ini-CsNwO04R.js +1 -0
- package/dist/devtools-app/monaco/vs/java-CI4ZMsH9.js +1 -0
- package/dist/devtools-app/monaco/vs/javascript-PczUCGdz.js +1 -0
- package/dist/devtools-app/monaco/vs/jsonMode-DULH5oaX.js +7 -0
- package/dist/devtools-app/monaco/vs/julia-BwzEvaQw.js +1 -0
- package/dist/devtools-app/monaco/vs/kotlin-IUYPiTV8.js +1 -0
- package/dist/devtools-app/monaco/vs/language/css/monaco.contribution.js +1 -0
- package/dist/devtools-app/monaco/vs/language/html/monaco.contribution.js +1 -0
- package/dist/devtools-app/monaco/vs/language/json/monaco.contribution.js +1 -0
- package/dist/devtools-app/monaco/vs/language/typescript/monaco.contribution.js +1 -0
- package/dist/devtools-app/monaco/vs/less-C0eDYdqa.js +2 -0
- package/dist/devtools-app/monaco/vs/lexon-iON-Kj97.js +1 -0
- package/dist/devtools-app/monaco/vs/liquid-DqKjdPGy.js +1 -0
- package/dist/devtools-app/monaco/vs/loader.js +1368 -0
- package/dist/devtools-app/monaco/vs/lspLanguageFeatures-kM9O9rjY.js +4 -0
- package/dist/devtools-app/monaco/vs/lua-DtygF91M.js +1 -0
- package/dist/devtools-app/monaco/vs/m3-CsR4AuFi.js +1 -0
- package/dist/devtools-app/monaco/vs/markdown-C_rD0bIw.js +1 -0
- package/dist/devtools-app/monaco/vs/mdx-DEWtB1K5.js +1 -0
- package/dist/devtools-app/monaco/vs/mips-CiYP61RB.js +1 -0
- package/dist/devtools-app/monaco/vs/monaco.contribution-D2OdxNBt.js +1 -0
- package/dist/devtools-app/monaco/vs/monaco.contribution-DO3azKX8.js +1 -0
- package/dist/devtools-app/monaco/vs/monaco.contribution-EcChJV6a.js +1 -0
- package/dist/devtools-app/monaco/vs/monaco.contribution-qLAYrEOP.js +1 -0
- package/dist/devtools-app/monaco/vs/msdax-C38-sJlp.js +1 -0
- package/dist/devtools-app/monaco/vs/mysql-CdtbpvbG.js +1 -0
- package/dist/devtools-app/monaco/vs/nls.messages-loader.js +1 -0
- package/dist/devtools-app/monaco/vs/nls.messages.cs.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.de.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.es.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.fr.js.js +15 -0
- package/dist/devtools-app/monaco/vs/nls.messages.it.js.js +15 -0
- package/dist/devtools-app/monaco/vs/nls.messages.ja.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.js.js +10 -0
- package/dist/devtools-app/monaco/vs/nls.messages.ko.js.js +25 -0
- package/dist/devtools-app/monaco/vs/nls.messages.pl.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.pt-br.js.js +6 -0
- package/dist/devtools-app/monaco/vs/nls.messages.ru.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.tr.js.js +15 -0
- package/dist/devtools-app/monaco/vs/nls.messages.zh-cn.js.js +17 -0
- package/dist/devtools-app/monaco/vs/nls.messages.zh-tw.js.js +15 -0
- package/dist/devtools-app/monaco/vs/objective-c-CntZFaHX.js +1 -0
- package/dist/devtools-app/monaco/vs/pascal-r6kuqfl_.js +1 -0
- package/dist/devtools-app/monaco/vs/pascaligo-BiXoTmXh.js +1 -0
- package/dist/devtools-app/monaco/vs/perl-DABw_TcH.js +1 -0
- package/dist/devtools-app/monaco/vs/pgsql-me_jFXeX.js +1 -0
- package/dist/devtools-app/monaco/vs/php-D_kh-9LK.js +1 -0
- package/dist/devtools-app/monaco/vs/pla-VfZjczW0.js +1 -0
- package/dist/devtools-app/monaco/vs/postiats-BBSzz8Pk.js +1 -0
- package/dist/devtools-app/monaco/vs/powerquery-Dt-g_2cc.js +1 -0
- package/dist/devtools-app/monaco/vs/powershell-B-7ap1zc.js +1 -0
- package/dist/devtools-app/monaco/vs/protobuf-BmtuEB1A.js +2 -0
- package/dist/devtools-app/monaco/vs/pug-BRpRNeEb.js +1 -0
- package/dist/devtools-app/monaco/vs/python-Cr0UkIbn.js +1 -0
- package/dist/devtools-app/monaco/vs/qsharp-BzsFaUU9.js +1 -0
- package/dist/devtools-app/monaco/vs/r-f8dDdrp4.js +1 -0
- package/dist/devtools-app/monaco/vs/razor-BYAHOTkz.js +1 -0
- package/dist/devtools-app/monaco/vs/redis-fvZQY4PI.js +1 -0
- package/dist/devtools-app/monaco/vs/redshift-45Et0LQi.js +1 -0
- package/dist/devtools-app/monaco/vs/restructuredtext-C7UUFKFD.js +1 -0
- package/dist/devtools-app/monaco/vs/ruby-CZO8zYTz.js +1 -0
- package/dist/devtools-app/monaco/vs/rust-Bfetafyc.js +1 -0
- package/dist/devtools-app/monaco/vs/sb-3GYllVck.js +1 -0
- package/dist/devtools-app/monaco/vs/scala-foMgrKo1.js +1 -0
- package/dist/devtools-app/monaco/vs/scheme-CHdMtr7p.js +1 -0
- package/dist/devtools-app/monaco/vs/scss-C1cmLt9V.js +3 -0
- package/dist/devtools-app/monaco/vs/shell-ClXCKCEW.js +1 -0
- package/dist/devtools-app/monaco/vs/solidity-MZ6ExpPy.js +1 -0
- package/dist/devtools-app/monaco/vs/sophia-DWkuSsPQ.js +1 -0
- package/dist/devtools-app/monaco/vs/sparql-AUGFYSyk.js +1 -0
- package/dist/devtools-app/monaco/vs/sql-32GpJSV2.js +1 -0
- package/dist/devtools-app/monaco/vs/st-CuDFIVZ_.js +1 -0
- package/dist/devtools-app/monaco/vs/swift-n-2HociN.js +3 -0
- package/dist/devtools-app/monaco/vs/systemverilog-Ch4vA8Yt.js +1 -0
- package/dist/devtools-app/monaco/vs/tcl-D74tq1nH.js +1 -0
- package/dist/devtools-app/monaco/vs/tsMode-CZz1Umrk.js +11 -0
- package/dist/devtools-app/monaco/vs/twig-C6taOxMV.js +1 -0
- package/dist/devtools-app/monaco/vs/typescript-DfOrAzoV.js +1 -0
- package/dist/devtools-app/monaco/vs/typespec-D-PIh9Xw.js +1 -0
- package/dist/devtools-app/monaco/vs/vb-Dyb2648j.js +1 -0
- package/dist/devtools-app/monaco/vs/wgsl-BhLXMOR0.js +298 -0
- package/dist/devtools-app/monaco/vs/workers-DcJshg-q.js +1 -0
- package/dist/devtools-app/monaco/vs/xml-CdsdnY8S.js +1 -0
- package/dist/devtools-app/monaco/vs/yaml-DYGvmE88.js +1 -0
- package/dist/eslint-plugin/index.cjs +5 -2
- package/dist/eslint-plugin/index.mjs +5 -2
- package/dist/eslint-plugin/rules/prefer-unitless-values.cjs +217 -0
- package/dist/eslint-plugin/rules/prefer-unitless-values.mjs +217 -0
- package/dist/eslint-plugin/utils/api.cjs +3 -4
- package/dist/eslint-plugin/utils/api.mjs +2 -2
- package/dist/native/browser.cjs +14 -1
- package/dist/native/browser.mjs +14 -1
- package/dist/native/server.cjs +4 -4
- package/dist/native/server.mjs +4 -4
- package/dist/parser/classname/server.cjs +2 -0
- package/dist/parser/classname/server.mjs +2 -0
- package/dist/parser/jsx/server.cjs +13 -7
- package/dist/parser/jsx/server.mjs +13 -7
- package/dist/prop/at/server.cjs +6 -4
- package/dist/prop/at/server.mjs +6 -4
- package/dist/prop/at/shared.cjs +3 -3
- package/dist/prop/at/shared.mjs +3 -3
- package/dist/prop/bosswind/browser.cjs +3 -0
- package/dist/prop/bosswind/browser.mjs +3 -0
- package/dist/prop/bosswind/runtime-only.cjs +3 -0
- package/dist/prop/bosswind/runtime-only.mjs +3 -0
- package/dist/prop/bosswind/selectors.cjs +18 -0
- package/dist/prop/bosswind/selectors.mjs +16 -0
- package/dist/prop/bosswind/shared.cjs +93 -32
- package/dist/prop/bosswind/shared.mjs +94 -32
- package/dist/prop/child/server.cjs +3 -2
- package/dist/prop/child/server.mjs +3 -2
- package/dist/prop/css/server.cjs +2 -1
- package/dist/prop/css/server.mjs +2 -1
- package/dist/prop/pseudo/server.cjs +3 -2
- package/dist/prop/pseudo/server.mjs +3 -2
- package/dist/strategy/classname-first/browser.cjs +7 -1
- package/dist/strategy/classname-first/browser.mjs +7 -1
- package/dist/strategy/classname-first/runtime-only.cjs +15 -4
- package/dist/strategy/classname-first/runtime-only.mjs +15 -4
- package/dist/strategy/classname-first/server.cjs +1 -1
- package/dist/strategy/classname-first/server.mjs +1 -1
- package/dist/transform/cache.cjs +0 -3
- package/dist/transform/cache.mjs +0 -2
- package/dist/use/token/browser.cjs +17 -9
- package/dist/use/token/browser.mjs +18 -10
- package/dist/use/token/normalize.cjs +474 -0
- package/dist/use/token/normalize.mjs +473 -0
- package/dist/use/token/propMap.cjs +34 -5
- package/dist/use/token/propMap.mjs +34 -6
- package/dist/use/token/runtime-only.cjs +36 -47
- package/dist/use/token/runtime-only.mjs +37 -48
- package/dist/use/token/server.cjs +84 -17
- package/dist/use/token/server.mjs +85 -19
- package/dist/use/token/vars.cjs +14 -2
- package/dist/use/token/vars.mjs +15 -2
- package/package.json +13 -7
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { setBosswindSelectorMap } from "./selectors.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/prop/bosswind/shared.ts
|
|
2
4
|
const toDashCase = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3
5
|
const displayKeywords = new Map([
|
|
@@ -579,10 +581,16 @@ const registerBosswindDictionary = (api) => {
|
|
|
579
581
|
api.dictionary.set(entry.name, prop);
|
|
580
582
|
}
|
|
581
583
|
};
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
584
|
+
const selectorValueUnset = Symbol("selectorValueUnset");
|
|
585
|
+
const cloneProp = (prop, value, selectorName, selectorValue = selectorValueUnset) => {
|
|
586
|
+
const next = {
|
|
587
|
+
...prop,
|
|
588
|
+
value
|
|
589
|
+
};
|
|
590
|
+
if (selectorName && selectorName !== prop.selectorName) next.selectorName = selectorName;
|
|
591
|
+
if (selectorValue !== selectorValueUnset) next.selectorValue = selectorValue;
|
|
592
|
+
return next;
|
|
593
|
+
};
|
|
586
594
|
const combineAxisValues = (xValue, yValue, defaults) => {
|
|
587
595
|
if (typeof xValue === "function" || typeof yValue === "function") return () => [resolveTranslateScaleValue(typeof xValue === "function" ? xValue() : xValue, defaults.x), resolveTranslateScaleValue(typeof yValue === "function" ? yValue() : yValue, defaults.y)];
|
|
588
596
|
return [resolveTranslateScaleValue(xValue, defaults.x), resolveTranslateScaleValue(yValue, defaults.y)];
|
|
@@ -605,14 +613,20 @@ const resolveAxisPairs = (entries, node) => {
|
|
|
605
613
|
}
|
|
606
614
|
return results;
|
|
607
615
|
};
|
|
608
|
-
const applyAxisPairsToTree = (entries, node, output, used) => {
|
|
616
|
+
const applyAxisPairsToTree = (entries, node, output, used, getSelectorName) => {
|
|
609
617
|
const pairs = resolveAxisPairs(entries, node);
|
|
610
618
|
if (!pairs.length) return;
|
|
611
619
|
for (const pair of pairs) {
|
|
612
620
|
if (!Number.isFinite(pair.emitIndex)) continue;
|
|
613
621
|
const xValue = node[pair.x]?.value ?? null;
|
|
614
622
|
const yValue = node[pair.y]?.value ?? null;
|
|
615
|
-
|
|
623
|
+
const xIndex = entries.findIndex(([name]) => name === pair.x);
|
|
624
|
+
const yIndex = entries.findIndex(([name]) => name === pair.y);
|
|
625
|
+
const sourceName = xIndex === -1 ? pair.y : yIndex === -1 ? pair.x : xIndex <= yIndex ? pair.x : pair.y;
|
|
626
|
+
const selectorName = getSelectorName ? getSelectorName(sourceName) : void 0;
|
|
627
|
+
const sourceProp = node[sourceName] || node[pair.x] || node[pair.y];
|
|
628
|
+
const selectorValue = sourceProp?.selectorValue !== void 0 ? sourceProp.selectorValue : sourceProp?.value;
|
|
629
|
+
output[pair.prop] = cloneProp(sourceProp, combineAxisValues(xValue, yValue, pair.defaults), selectorName, selectorValue);
|
|
616
630
|
used.set(pair.x, true);
|
|
617
631
|
used.set(pair.y, true);
|
|
618
632
|
used.set(`__emit:${pair.emitIndex}:${pair.prop}`, true);
|
|
@@ -625,22 +639,29 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
625
639
|
const rawEntries = Object.entries(node);
|
|
626
640
|
const entries = [];
|
|
627
641
|
const normalizedNode = {};
|
|
642
|
+
const rawNameByNormalized = /* @__PURE__ */ new Map();
|
|
628
643
|
rawEntries.forEach(([rawName, prop]) => {
|
|
629
644
|
const name = normalizeBosswindName(rawName);
|
|
630
645
|
if (Object.prototype.hasOwnProperty.call(normalizedNode, name)) return;
|
|
631
646
|
normalizedNode[name] = prop;
|
|
647
|
+
rawNameByNormalized.set(name, rawName);
|
|
632
648
|
entries.push([name, prop]);
|
|
633
649
|
});
|
|
650
|
+
const getSelectorName = (name) => rawNameByNormalized.get(name) ?? name;
|
|
634
651
|
const output = {};
|
|
635
652
|
const used = /* @__PURE__ */ new Map();
|
|
636
|
-
applyAxisPairsToTree(entries, normalizedNode, output, used);
|
|
653
|
+
applyAxisPairsToTree(entries, normalizedNode, output, used, getSelectorName);
|
|
637
654
|
const hasSkewX = Object.prototype.hasOwnProperty.call(normalizedNode, "skewX");
|
|
638
655
|
const hasSkewY = Object.prototype.hasOwnProperty.call(normalizedNode, "skewY");
|
|
639
656
|
if (!Object.prototype.hasOwnProperty.call(normalizedNode, "transform") && (hasSkewX || hasSkewY)) {
|
|
640
657
|
const transformValue = resolveSkewTransformValue(hasSkewX ? normalizedNode.skewX?.value ?? null : null, hasSkewY ? normalizedNode.skewY?.value ?? null : null, hasSkewX, hasSkewY);
|
|
641
658
|
if (transformValue) {
|
|
642
|
-
const
|
|
643
|
-
|
|
659
|
+
const sourceName = hasSkewX ? "skewX" : "skewY";
|
|
660
|
+
const sourceProp = normalizedNode[sourceName];
|
|
661
|
+
if (sourceProp) {
|
|
662
|
+
const selectorValue = sourceProp.selectorValue !== void 0 ? sourceProp.selectorValue : sourceProp.value;
|
|
663
|
+
output.transform = cloneProp(sourceProp, transformValue, getSelectorName(sourceName), selectorValue);
|
|
664
|
+
}
|
|
644
665
|
used.set("skewX", true);
|
|
645
666
|
used.set("skewY", true);
|
|
646
667
|
}
|
|
@@ -659,7 +680,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
659
680
|
const value = prop?.value;
|
|
660
681
|
if (name === "flex" || name === "grid") {
|
|
661
682
|
if (value === null || value === true) {
|
|
662
|
-
output.display = cloneProp(prop, name);
|
|
683
|
+
output.display = cloneProp(prop, name, getSelectorName(name), null);
|
|
663
684
|
usedBosswind = true;
|
|
664
685
|
return;
|
|
665
686
|
}
|
|
@@ -669,7 +690,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
669
690
|
if (displayKeywords.has(name)) {
|
|
670
691
|
if (value === null || value === true) {
|
|
671
692
|
const displayValue = displayKeywords.get(name);
|
|
672
|
-
if (displayValue) output.display = cloneProp(prop, displayValue);
|
|
693
|
+
if (displayValue) output.display = cloneProp(prop, displayValue, getSelectorName(name), null);
|
|
673
694
|
}
|
|
674
695
|
usedBosswind = true;
|
|
675
696
|
return;
|
|
@@ -677,7 +698,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
677
698
|
if (positionKeywords.has(name)) {
|
|
678
699
|
if (value === null || value === true) {
|
|
679
700
|
const positionValue = positionKeywords.get(name);
|
|
680
|
-
if (positionValue) output.position = cloneProp(prop, positionValue);
|
|
701
|
+
if (positionValue) output.position = cloneProp(prop, positionValue, getSelectorName(name), null);
|
|
681
702
|
}
|
|
682
703
|
usedBosswind = true;
|
|
683
704
|
return;
|
|
@@ -685,7 +706,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
685
706
|
if (booleanAliases.has(name)) {
|
|
686
707
|
if (value === null || value === true) {
|
|
687
708
|
const entry = booleanAliases.get(name);
|
|
688
|
-
if (entry) output[entry.prop] = cloneProp(prop, entry.value);
|
|
709
|
+
if (entry) output[entry.prop] = cloneProp(prop, entry.value, getSelectorName(name), null);
|
|
689
710
|
}
|
|
690
711
|
usedBosswind = true;
|
|
691
712
|
return;
|
|
@@ -695,13 +716,13 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
695
716
|
usedText = true;
|
|
696
717
|
if (value === null || value === true) return;
|
|
697
718
|
const resolved = resolveTextTarget(api, value, config, tokens);
|
|
698
|
-
output[resolved.prop] = cloneProp(prop, resolved.value);
|
|
719
|
+
output[resolved.prop] = cloneProp(prop, resolved.value, getSelectorName(name));
|
|
699
720
|
return;
|
|
700
721
|
}
|
|
701
722
|
if (name === bgAlias) {
|
|
702
723
|
usedBosswind = true;
|
|
703
724
|
if (value === null || value === true) return;
|
|
704
|
-
output.backgroundColor = cloneProp(prop, typeof value === "string" && tokens?.color ? toTokenPath(value, tokens.color) : value);
|
|
725
|
+
output.backgroundColor = cloneProp(prop, typeof value === "string" && tokens?.color ? toTokenPath(value, tokens.color) : value, getSelectorName(name));
|
|
705
726
|
return;
|
|
706
727
|
}
|
|
707
728
|
if (name === borderAlias) {
|
|
@@ -709,36 +730,39 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
709
730
|
if (parser === "jsx") {
|
|
710
731
|
const resolvedToken = resolveBorderToken(value, tokens);
|
|
711
732
|
if (resolvedToken) {
|
|
712
|
-
output[resolvedToken.prop] = cloneProp(prop, resolvedToken.value);
|
|
733
|
+
output[resolvedToken.prop] = cloneProp(prop, resolvedToken.value, getSelectorName(name));
|
|
713
734
|
return;
|
|
714
735
|
}
|
|
715
|
-
output[name] = prop;
|
|
736
|
+
if (value === null || value === true) output[name] = cloneProp(prop, value, getSelectorName(name), null);
|
|
737
|
+
else output[name] = cloneProp(prop, value, getSelectorName(name));
|
|
716
738
|
return;
|
|
717
739
|
}
|
|
718
740
|
const resolved = resolveBorderTarget(value, config, tokens);
|
|
719
741
|
if (!resolved) {
|
|
720
|
-
output[name] = prop;
|
|
742
|
+
output[name] = cloneProp(prop, value, getSelectorName(name));
|
|
721
743
|
return;
|
|
722
744
|
}
|
|
723
|
-
output[resolved.prop] = cloneProp(prop, resolved.value);
|
|
745
|
+
if (value === null || value === true) output[resolved.prop] = cloneProp(prop, resolved.value, getSelectorName(name), null);
|
|
746
|
+
else output[resolved.prop] = cloneProp(prop, resolved.value, getSelectorName(name));
|
|
724
747
|
return;
|
|
725
748
|
}
|
|
726
749
|
if (name === "shadow") {
|
|
727
750
|
usedBosswind = true;
|
|
728
|
-
if (value === null || value === true) output.boxShadow = cloneProp(prop, resolveShadowValue(value, config));
|
|
729
|
-
else output.boxShadow = prop;
|
|
751
|
+
if (value === null || value === true) output.boxShadow = cloneProp(prop, resolveShadowValue(value, config), getSelectorName(name), null);
|
|
752
|
+
else output.boxShadow = cloneProp(prop, value, getSelectorName(name));
|
|
730
753
|
return;
|
|
731
754
|
}
|
|
732
755
|
if (name === "rounded") {
|
|
733
756
|
usedBosswind = true;
|
|
734
|
-
if (value === null || value === true) output.borderRadius = cloneProp(prop, resolveRoundedValue(value, config));
|
|
735
|
-
else output.borderRadius = prop;
|
|
757
|
+
if (value === null || value === true) output.borderRadius = cloneProp(prop, resolveRoundedValue(value, config), getSelectorName(name), null);
|
|
758
|
+
else output.borderRadius = cloneProp(prop, value, getSelectorName(name));
|
|
736
759
|
return;
|
|
737
760
|
}
|
|
738
761
|
if (name === "grow" || name === "shrink") {
|
|
739
762
|
usedBosswind = true;
|
|
740
763
|
const target = name === "grow" ? "flexGrow" : "flexShrink";
|
|
741
|
-
output[target] = cloneProp(prop, resolveGrowShrinkValue(name, value));
|
|
764
|
+
if (value === null || value === true) output[target] = cloneProp(prop, resolveGrowShrinkValue(name, value), getSelectorName(name), null);
|
|
765
|
+
else output[target] = cloneProp(prop, resolveGrowShrinkValue(name, value), getSelectorName(name));
|
|
742
766
|
return;
|
|
743
767
|
}
|
|
744
768
|
if (aliasMap.has(name)) {
|
|
@@ -747,7 +771,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
747
771
|
const targets = aliasMap.get(name) || [];
|
|
748
772
|
const resolvedValue = name === "shadow" ? resolveShadowValue(value, config) : value;
|
|
749
773
|
targets.forEach((target) => {
|
|
750
|
-
output[target] = cloneProp(prop, resolvedValue);
|
|
774
|
+
output[target] = cloneProp(prop, resolvedValue, getSelectorName(name));
|
|
751
775
|
});
|
|
752
776
|
return;
|
|
753
777
|
}
|
|
@@ -761,7 +785,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
|
|
|
761
785
|
usedText
|
|
762
786
|
};
|
|
763
787
|
};
|
|
764
|
-
const applyAxisPairsToInput = (entries, input, output, used) => {
|
|
788
|
+
const applyAxisPairsToInput = (entries, input, output, used, getSelectorName, setSelector) => {
|
|
765
789
|
const pairs = resolveAxisPairs(entries, input);
|
|
766
790
|
if (!pairs.length) return;
|
|
767
791
|
for (const pair of pairs) {
|
|
@@ -769,6 +793,10 @@ const applyAxisPairsToInput = (entries, input, output, used) => {
|
|
|
769
793
|
const xValue = input[pair.x];
|
|
770
794
|
const yValue = input[pair.y];
|
|
771
795
|
output[pair.prop] = combineAxisValues(xValue, yValue, pair.defaults);
|
|
796
|
+
const xIndex = entries.findIndex(([name]) => name === pair.x);
|
|
797
|
+
const yIndex = entries.findIndex(([name]) => name === pair.y);
|
|
798
|
+
const sourceName = xIndex === -1 ? pair.y : yIndex === -1 ? pair.x : xIndex <= yIndex ? pair.x : pair.y;
|
|
799
|
+
setSelector(pair.prop, getSelectorName(sourceName));
|
|
772
800
|
used.set(pair.x, true);
|
|
773
801
|
used.set(pair.y, true);
|
|
774
802
|
used.set(`__emit:${pair.emitIndex}:${pair.prop}`, true);
|
|
@@ -778,21 +806,31 @@ const rewriteBosswindInput = (api, input, config) => {
|
|
|
778
806
|
const rawEntries = Object.entries(input);
|
|
779
807
|
const entries = [];
|
|
780
808
|
const normalizedInput = {};
|
|
809
|
+
const rawNameByNormalized = /* @__PURE__ */ new Map();
|
|
781
810
|
rawEntries.forEach(([rawName, value]) => {
|
|
782
811
|
const name = normalizeBosswindName(rawName);
|
|
783
812
|
if (Object.prototype.hasOwnProperty.call(normalizedInput, name)) return;
|
|
784
813
|
normalizedInput[name] = value;
|
|
814
|
+
rawNameByNormalized.set(name, rawName);
|
|
785
815
|
entries.push([name, value]);
|
|
786
816
|
});
|
|
817
|
+
const selectorMap = /* @__PURE__ */ new Map();
|
|
818
|
+
const getSelectorName = (name) => rawNameByNormalized.get(name) ?? name;
|
|
819
|
+
const setSelector = (prop, name, valueOverride) => {
|
|
820
|
+
const entry = { name };
|
|
821
|
+
if (valueOverride !== void 0) entry.value = valueOverride;
|
|
822
|
+
selectorMap.set(prop, entry);
|
|
823
|
+
};
|
|
787
824
|
const output = {};
|
|
788
825
|
const used = /* @__PURE__ */ new Map();
|
|
789
|
-
applyAxisPairsToInput(entries, normalizedInput, output, used);
|
|
826
|
+
applyAxisPairsToInput(entries, normalizedInput, output, used, getSelectorName, setSelector);
|
|
790
827
|
const hasSkewX = Object.prototype.hasOwnProperty.call(normalizedInput, "skewX");
|
|
791
828
|
const hasSkewY = Object.prototype.hasOwnProperty.call(normalizedInput, "skewY");
|
|
792
829
|
if (!Object.prototype.hasOwnProperty.call(normalizedInput, "transform") && (hasSkewX || hasSkewY)) {
|
|
793
830
|
const transformValue = resolveSkewTransformValue(hasSkewX ? normalizedInput.skewX : null, hasSkewY ? normalizedInput.skewY : null, hasSkewX, hasSkewY);
|
|
794
831
|
if (transformValue) {
|
|
795
832
|
output.transform = transformValue;
|
|
833
|
+
setSelector("transform", getSelectorName(hasSkewX ? "skewX" : "skewY"));
|
|
796
834
|
used.set("skewX", true);
|
|
797
835
|
used.set("skewY", true);
|
|
798
836
|
}
|
|
@@ -805,28 +843,39 @@ const rewriteBosswindInput = (api, input, config) => {
|
|
|
805
843
|
return;
|
|
806
844
|
}
|
|
807
845
|
if (name === "flex" || name === "grid") {
|
|
808
|
-
if (value === null || value === true)
|
|
809
|
-
|
|
846
|
+
if (value === null || value === true) {
|
|
847
|
+
output.display = name;
|
|
848
|
+
setSelector("display", getSelectorName(name), null);
|
|
849
|
+
} else output[name] = value;
|
|
810
850
|
return;
|
|
811
851
|
}
|
|
812
852
|
if (displayKeywords.has(name)) {
|
|
813
853
|
if (value === null || value === true) {
|
|
814
854
|
const displayValue = displayKeywords.get(name);
|
|
815
|
-
if (displayValue)
|
|
855
|
+
if (displayValue) {
|
|
856
|
+
output.display = displayValue;
|
|
857
|
+
setSelector("display", getSelectorName(name), null);
|
|
858
|
+
}
|
|
816
859
|
}
|
|
817
860
|
return;
|
|
818
861
|
}
|
|
819
862
|
if (positionKeywords.has(name)) {
|
|
820
863
|
if (value === null || value === true) {
|
|
821
864
|
const positionValue = positionKeywords.get(name);
|
|
822
|
-
if (positionValue)
|
|
865
|
+
if (positionValue) {
|
|
866
|
+
output.position = positionValue;
|
|
867
|
+
setSelector("position", getSelectorName(name), null);
|
|
868
|
+
}
|
|
823
869
|
}
|
|
824
870
|
return;
|
|
825
871
|
}
|
|
826
872
|
if (booleanAliases.has(name)) {
|
|
827
873
|
if (value === null || value === true) {
|
|
828
874
|
const entry = booleanAliases.get(name);
|
|
829
|
-
if (entry)
|
|
875
|
+
if (entry) {
|
|
876
|
+
output[entry.prop] = entry.value;
|
|
877
|
+
setSelector(entry.prop, getSelectorName(name), null);
|
|
878
|
+
}
|
|
830
879
|
}
|
|
831
880
|
return;
|
|
832
881
|
}
|
|
@@ -834,43 +883,56 @@ const rewriteBosswindInput = (api, input, config) => {
|
|
|
834
883
|
if (value === null || value === true) return;
|
|
835
884
|
const resolved = resolveTextTarget(api, value, config, void 0);
|
|
836
885
|
output[resolved.prop] = resolved.value;
|
|
886
|
+
setSelector(resolved.prop, getSelectorName(name));
|
|
837
887
|
return;
|
|
838
888
|
}
|
|
839
889
|
if (name === bgAlias) {
|
|
840
890
|
if (value === null || value === true) return;
|
|
841
891
|
output.backgroundColor = value;
|
|
892
|
+
setSelector("backgroundColor", getSelectorName(name));
|
|
842
893
|
return;
|
|
843
894
|
}
|
|
844
895
|
if (name === borderAlias) {
|
|
845
896
|
const resolvedToken = resolveBorderToken(value, api.tokens);
|
|
846
897
|
if (resolvedToken) {
|
|
847
898
|
output[resolvedToken.prop] = resolvedToken.value;
|
|
899
|
+
setSelector(resolvedToken.prop, getSelectorName(name));
|
|
848
900
|
return;
|
|
849
901
|
}
|
|
850
902
|
output[name] = value;
|
|
903
|
+
if (value === null || value === true) setSelector(name, getSelectorName(name), null);
|
|
904
|
+
else setSelector(name, getSelectorName(name));
|
|
851
905
|
return;
|
|
852
906
|
}
|
|
853
907
|
if (name === "shadow") {
|
|
854
908
|
output.boxShadow = resolveShadowValue(value, config);
|
|
909
|
+
if (value === null || value === true) setSelector("boxShadow", getSelectorName(name), null);
|
|
910
|
+
else setSelector("boxShadow", getSelectorName(name));
|
|
855
911
|
return;
|
|
856
912
|
}
|
|
857
913
|
if (name === "rounded") {
|
|
858
914
|
output.borderRadius = resolveRoundedValue(value, config);
|
|
915
|
+
if (value === null || value === true) setSelector("borderRadius", getSelectorName(name), null);
|
|
916
|
+
else setSelector("borderRadius", getSelectorName(name));
|
|
859
917
|
return;
|
|
860
918
|
}
|
|
861
919
|
if (name === "grow" || name === "shrink") {
|
|
862
920
|
output[name === "grow" ? "flexGrow" : "flexShrink"] = resolveGrowShrinkValue(name, value);
|
|
921
|
+
if (value === null || value === true) setSelector(name === "grow" ? "flexGrow" : "flexShrink", getSelectorName(name), null);
|
|
922
|
+
else setSelector(name === "grow" ? "flexGrow" : "flexShrink", getSelectorName(name));
|
|
863
923
|
return;
|
|
864
924
|
}
|
|
865
925
|
if (aliasMap.has(name)) {
|
|
866
926
|
if (value === null || value === true) return;
|
|
867
927
|
(aliasMap.get(name) || []).forEach((target) => {
|
|
868
928
|
output[target] = value;
|
|
929
|
+
setSelector(target, getSelectorName(name));
|
|
869
930
|
});
|
|
870
931
|
return;
|
|
871
932
|
}
|
|
872
933
|
output[name] = value;
|
|
873
934
|
});
|
|
935
|
+
setBosswindSelectorMap(output, selectorMap);
|
|
874
936
|
return output;
|
|
875
937
|
};
|
|
876
938
|
const getBosswindDefaults = (theme) => {
|
|
@@ -43,8 +43,9 @@ const onProp = async (api, { prop, contexts, preferVariables, file }) => {
|
|
|
43
43
|
childProp.rawName = resolved.raw;
|
|
44
44
|
}
|
|
45
45
|
const classToken = childProp.classToken;
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const selectorName = childProp.selectorName ?? resolved.name;
|
|
47
|
+
const selectorValue = preferVariables ? null : childProp.selectorValue !== void 0 ? childProp.selectorValue : childProp.value;
|
|
48
|
+
const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, contexts, true, api.selectorPrefix);
|
|
48
49
|
const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
|
|
49
50
|
const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
|
|
50
51
|
const selector = api.applyChildSelectors(baseWithPseudos, contexts);
|
|
@@ -43,8 +43,9 @@ const onProp = async (api, { prop, contexts, preferVariables, file }) => {
|
|
|
43
43
|
childProp.rawName = resolved.raw;
|
|
44
44
|
}
|
|
45
45
|
const classToken = childProp.classToken;
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const selectorName = childProp.selectorName ?? resolved.name;
|
|
47
|
+
const selectorValue = preferVariables ? null : childProp.selectorValue !== void 0 ? childProp.selectorValue : childProp.value;
|
|
48
|
+
const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, contexts, true, api.selectorPrefix);
|
|
48
49
|
const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
|
|
49
50
|
const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
|
|
50
51
|
const selector = api.applyChildSelectors(baseWithPseudos, contexts);
|
package/dist/prop/css/server.cjs
CHANGED
|
@@ -72,11 +72,12 @@ const onBoot = async (api) => {
|
|
|
72
72
|
const onProp = async (api, { name, prop, contexts, preferVariables }) => {
|
|
73
73
|
const { value, selectorValue = value, classToken, important } = prop;
|
|
74
74
|
const propertyName = api.dictionary.get(name)?.property ?? api.camelCaseToDash(name);
|
|
75
|
+
const selectorName = prop.selectorName ?? name;
|
|
75
76
|
if (name === "container" && value && typeof value === "object" && !Array.isArray(value)) return;
|
|
76
77
|
if (!contexts.length) {
|
|
77
78
|
const selector = classToken ? api.classTokenToSelector(classToken) : null;
|
|
78
79
|
api.css.selector({
|
|
79
|
-
className: selector ? null : api.contextToClassName(
|
|
80
|
+
className: selector ? null : api.contextToClassName(selectorName, selectorValue, contexts, true, api.selectorPrefix),
|
|
80
81
|
selector
|
|
81
82
|
});
|
|
82
83
|
}
|
package/dist/prop/css/server.mjs
CHANGED
|
@@ -72,11 +72,12 @@ const onBoot = async (api) => {
|
|
|
72
72
|
const onProp = async (api, { name, prop, contexts, preferVariables }) => {
|
|
73
73
|
const { value, selectorValue = value, classToken, important } = prop;
|
|
74
74
|
const propertyName = api.dictionary.get(name)?.property ?? api.camelCaseToDash(name);
|
|
75
|
+
const selectorName = prop.selectorName ?? name;
|
|
75
76
|
if (name === "container" && value && typeof value === "object" && !Array.isArray(value)) return;
|
|
76
77
|
if (!contexts.length) {
|
|
77
78
|
const selector = classToken ? api.classTokenToSelector(classToken) : null;
|
|
78
79
|
api.css.selector({
|
|
79
|
-
className: selector ? null : api.contextToClassName(
|
|
80
|
+
className: selector ? null : api.contextToClassName(selectorName, selectorValue, contexts, true, api.selectorPrefix),
|
|
80
81
|
selector
|
|
81
82
|
});
|
|
82
83
|
}
|
|
@@ -60,8 +60,9 @@ const onProp = async (api, { name: _name, prop, contexts, preferVariables, file
|
|
|
60
60
|
prop$1.rawName = resolved.raw;
|
|
61
61
|
}
|
|
62
62
|
const classToken = prop$1.classToken;
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const selectorName = prop$1.selectorName ?? resolved.name;
|
|
64
|
+
const selectorValue = preferVariables ? null : prop$1.selectorValue !== void 0 ? prop$1.selectorValue : prop$1.value;
|
|
65
|
+
const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, contexts, true, api.selectorPrefix);
|
|
65
66
|
const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
|
|
66
67
|
const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
|
|
67
68
|
const selector = api.applyChildSelectors(baseWithPseudos, contexts);
|
|
@@ -60,8 +60,9 @@ const onProp = async (api, { name: _name, prop, contexts, preferVariables, file
|
|
|
60
60
|
prop$1.rawName = resolved.raw;
|
|
61
61
|
}
|
|
62
62
|
const classToken = prop$1.classToken;
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const selectorName = prop$1.selectorName ?? resolved.name;
|
|
64
|
+
const selectorValue = preferVariables ? null : prop$1.selectorValue !== void 0 ? prop$1.selectorValue : prop$1.value;
|
|
65
|
+
const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, contexts, true, api.selectorPrefix);
|
|
65
66
|
const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
|
|
66
67
|
const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
|
|
67
68
|
const selector = api.applyChildSelectors(baseWithPseudos, contexts);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_framework = require('../../shared/framework.cjs');
|
|
3
3
|
const require_cx_index = require('../../cx/index.cjs');
|
|
4
|
+
const require_selectors = require('../../prop/bosswind/selectors.cjs');
|
|
4
5
|
let _boss_css_is_css_prop = require("@boss-css/is-css-prop");
|
|
5
6
|
_boss_css_is_css_prop = require_rolldown_runtime.__toESM(_boss_css_is_css_prop);
|
|
6
7
|
|
|
@@ -21,6 +22,7 @@ const resolveDynamicValue = (value) => {
|
|
|
21
22
|
const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) => {
|
|
22
23
|
const classNameProp = require_framework.getClassNameProp(api.framework);
|
|
23
24
|
const outputRecord = output;
|
|
25
|
+
const selectorMap = require_selectors.getBosswindSelectorMap(input);
|
|
24
26
|
for (const prop in input) {
|
|
25
27
|
const value = input[prop];
|
|
26
28
|
if (prop === "child" && value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -50,7 +52,11 @@ const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) =
|
|
|
50
52
|
const resolvedTokenValue = resolveTokenValue(value);
|
|
51
53
|
const isDynamicFn = typeof resolvedTokenValue === "function";
|
|
52
54
|
const selectorValue = isDynamicFn ? null : resolvedTokenValue;
|
|
53
|
-
const
|
|
55
|
+
const selectorEntry = selectorMap?.get(prop);
|
|
56
|
+
const selectorProp = selectorEntry?.name ?? prop;
|
|
57
|
+
const selectorOverride = selectorEntry && Object.prototype.hasOwnProperty.call(selectorEntry, "value") ? selectorEntry.value : void 0;
|
|
58
|
+
const finalSelectorValue = selectorOverride !== void 0 ? selectorOverride : selectorValue;
|
|
59
|
+
const className = api.contextToClassName(selectorProp, finalSelectorValue, contexts, false, api.selectorPrefix);
|
|
54
60
|
outputRecord[classNameProp] = require_cx_index.cx(outputRecord[classNameProp], className);
|
|
55
61
|
if (!isDynamicFn) continue;
|
|
56
62
|
const cssVarName = api.contextToCSSVariable(prop, null, contexts, api.selectorPrefix);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getClassNameProp } from "../../shared/framework.mjs";
|
|
2
2
|
import { cx } from "../../cx/index.mjs";
|
|
3
|
+
import { getBosswindSelectorMap } from "../../prop/bosswind/selectors.mjs";
|
|
3
4
|
import isCSSProp from "@boss-css/is-css-prop";
|
|
4
5
|
|
|
5
6
|
//#region src/strategy/classname-first/browser.ts
|
|
@@ -19,6 +20,7 @@ const resolveDynamicValue = (value) => {
|
|
|
19
20
|
const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) => {
|
|
20
21
|
const classNameProp = getClassNameProp(api.framework);
|
|
21
22
|
const outputRecord = output;
|
|
23
|
+
const selectorMap = getBosswindSelectorMap(input);
|
|
22
24
|
for (const prop in input) {
|
|
23
25
|
const value = input[prop];
|
|
24
26
|
if (prop === "child" && value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -48,7 +50,11 @@ const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) =
|
|
|
48
50
|
const resolvedTokenValue = resolveTokenValue(value);
|
|
49
51
|
const isDynamicFn = typeof resolvedTokenValue === "function";
|
|
50
52
|
const selectorValue = isDynamicFn ? null : resolvedTokenValue;
|
|
51
|
-
const
|
|
53
|
+
const selectorEntry = selectorMap?.get(prop);
|
|
54
|
+
const selectorProp = selectorEntry?.name ?? prop;
|
|
55
|
+
const selectorOverride = selectorEntry && Object.prototype.hasOwnProperty.call(selectorEntry, "value") ? selectorEntry.value : void 0;
|
|
56
|
+
const finalSelectorValue = selectorOverride !== void 0 ? selectorOverride : selectorValue;
|
|
57
|
+
const className = api.contextToClassName(selectorProp, finalSelectorValue, contexts, false, api.selectorPrefix);
|
|
52
58
|
outputRecord[classNameProp] = cx(outputRecord[classNameProp], className);
|
|
53
59
|
if (!isDynamicFn) continue;
|
|
54
60
|
const cssVarName = api.contextToCSSVariable(prop, null, contexts, api.selectorPrefix);
|
|
@@ -6,6 +6,7 @@ const require_shared = require('../../prop/at/shared.cjs');
|
|
|
6
6
|
const require_prop_at_runtime_only = require('../../prop/at/runtime-only.cjs');
|
|
7
7
|
const require_prop_child_runtime_only = require('../../prop/child/runtime-only.cjs');
|
|
8
8
|
const require_prop_css_runtime_only = require('../../prop/css/runtime-only.cjs');
|
|
9
|
+
const require_selectors = require('../../prop/bosswind/selectors.cjs');
|
|
9
10
|
let _emotion_hash = require("@emotion/hash");
|
|
10
11
|
_emotion_hash = require_rolldown_runtime.__toESM(_emotion_hash);
|
|
11
12
|
let _boss_css_is_css_prop = require("@boss-css/is-css-prop");
|
|
@@ -34,6 +35,7 @@ const handleKeyframes = (api, { output, tag, contexts, prop, value }) => {
|
|
|
34
35
|
const normalizedStep = require_shared.normalizeKeyframeStep(step);
|
|
35
36
|
if (!normalizedStep) continue;
|
|
36
37
|
const stepContexts = [...keyframesContexts, step];
|
|
38
|
+
const selectorMap = require_selectors.getBosswindSelectorMap(stepValue);
|
|
37
39
|
for (const [propName, rawValue] of Object.entries(stepValue)) {
|
|
38
40
|
if (!(0, _boss_css_is_css_prop.default)(tag, propName)) continue;
|
|
39
41
|
let resolved = resolveRuntimeValue(rawValue);
|
|
@@ -43,8 +45,12 @@ const handleKeyframes = (api, { output, tag, contexts, prop, value }) => {
|
|
|
43
45
|
resolved = token.value;
|
|
44
46
|
selectorValue = token.selectorValue;
|
|
45
47
|
}
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
+
const selectorEntry = selectorMap?.get(propName);
|
|
49
|
+
const selectorProp = selectorEntry?.name ?? propName;
|
|
50
|
+
const selectorOverride = selectorEntry && Object.prototype.hasOwnProperty.call(selectorEntry, "value") ? selectorEntry.value : void 0;
|
|
51
|
+
const finalSelectorValue = selectorOverride !== void 0 ? selectorOverride : selectorValue;
|
|
52
|
+
const className = api.contextToClassName(selectorProp, finalSelectorValue, stepContexts, false, api.selectorPrefix);
|
|
53
|
+
const cssClassName = api.contextToClassName(selectorProp, finalSelectorValue, stepContexts, true, api.selectorPrefix);
|
|
48
54
|
output[classNameProp] = require_cx_index.cx(output[classNameProp], className);
|
|
49
55
|
const selector = require_prop_css_runtime_only.buildRuntimeSelector(cssClassName, stepContexts);
|
|
50
56
|
selectors.add(selector);
|
|
@@ -85,6 +91,7 @@ const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) =
|
|
|
85
91
|
const classNameProp = require_framework.getClassNameProp(api.framework);
|
|
86
92
|
const outputRecord = output;
|
|
87
93
|
const inputRecord = input;
|
|
94
|
+
const selectorMap = require_selectors.getBosswindSelectorMap(inputRecord);
|
|
88
95
|
for (const prop in inputRecord) {
|
|
89
96
|
const rawValue = inputRecord[prop];
|
|
90
97
|
if (prop === "child" && rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
|
|
@@ -125,8 +132,12 @@ const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) =
|
|
|
125
132
|
value = token.value;
|
|
126
133
|
selectorValue = token.selectorValue;
|
|
127
134
|
}
|
|
128
|
-
const
|
|
129
|
-
const
|
|
135
|
+
const selectorEntry = selectorMap?.get(prop);
|
|
136
|
+
const selectorProp = selectorEntry?.name ?? prop;
|
|
137
|
+
const selectorOverride = selectorEntry && Object.prototype.hasOwnProperty.call(selectorEntry, "value") ? selectorEntry.value : void 0;
|
|
138
|
+
const finalSelectorValue = selectorOverride !== void 0 ? selectorOverride : selectorValue;
|
|
139
|
+
const className = api.contextToClassName(selectorProp, finalSelectorValue, contexts, false, api.selectorPrefix);
|
|
140
|
+
const cssClassName = api.contextToClassName(selectorProp, finalSelectorValue, contexts, true, api.selectorPrefix);
|
|
130
141
|
outputRecord[classNameProp] = require_cx_index.cx(outputRecord[classNameProp], className);
|
|
131
142
|
insertRuntimeRule(api, cssClassName, contexts, prop, value);
|
|
132
143
|
}
|
|
@@ -5,6 +5,7 @@ import { buildKeyframesRule, normalizeKeyframeStep, parseKeyframesContext } from
|
|
|
5
5
|
import { resolveAtQuery } from "../../prop/at/runtime-only.mjs";
|
|
6
6
|
import { createChildContext } from "../../prop/child/runtime-only.mjs";
|
|
7
7
|
import { buildRuntimeSelector, resolvePropertyName } from "../../prop/css/runtime-only.mjs";
|
|
8
|
+
import { getBosswindSelectorMap } from "../../prop/bosswind/selectors.mjs";
|
|
8
9
|
import hash from "@emotion/hash";
|
|
9
10
|
import isCSSProp from "@boss-css/is-css-prop";
|
|
10
11
|
|
|
@@ -31,6 +32,7 @@ const handleKeyframes = (api, { output, tag, contexts, prop, value }) => {
|
|
|
31
32
|
const normalizedStep = normalizeKeyframeStep(step);
|
|
32
33
|
if (!normalizedStep) continue;
|
|
33
34
|
const stepContexts = [...keyframesContexts, step];
|
|
35
|
+
const selectorMap = getBosswindSelectorMap(stepValue);
|
|
34
36
|
for (const [propName, rawValue] of Object.entries(stepValue)) {
|
|
35
37
|
if (!isCSSProp(tag, propName)) continue;
|
|
36
38
|
let resolved = resolveRuntimeValue(rawValue);
|
|
@@ -40,8 +42,12 @@ const handleKeyframes = (api, { output, tag, contexts, prop, value }) => {
|
|
|
40
42
|
resolved = token.value;
|
|
41
43
|
selectorValue = token.selectorValue;
|
|
42
44
|
}
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
+
const selectorEntry = selectorMap?.get(propName);
|
|
46
|
+
const selectorProp = selectorEntry?.name ?? propName;
|
|
47
|
+
const selectorOverride = selectorEntry && Object.prototype.hasOwnProperty.call(selectorEntry, "value") ? selectorEntry.value : void 0;
|
|
48
|
+
const finalSelectorValue = selectorOverride !== void 0 ? selectorOverride : selectorValue;
|
|
49
|
+
const className = api.contextToClassName(selectorProp, finalSelectorValue, stepContexts, false, api.selectorPrefix);
|
|
50
|
+
const cssClassName = api.contextToClassName(selectorProp, finalSelectorValue, stepContexts, true, api.selectorPrefix);
|
|
45
51
|
output[classNameProp] = cx(output[classNameProp], className);
|
|
46
52
|
const selector = buildRuntimeSelector(cssClassName, stepContexts);
|
|
47
53
|
selectors.add(selector);
|
|
@@ -82,6 +88,7 @@ const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) =
|
|
|
82
88
|
const classNameProp = getClassNameProp(api.framework);
|
|
83
89
|
const outputRecord = output;
|
|
84
90
|
const inputRecord = input;
|
|
91
|
+
const selectorMap = getBosswindSelectorMap(inputRecord);
|
|
85
92
|
for (const prop in inputRecord) {
|
|
86
93
|
const rawValue = inputRecord[prop];
|
|
87
94
|
if (prop === "child" && rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
|
|
@@ -122,8 +129,12 @@ const onBrowserObjectStart = (api, { input, output = {}, tag, contexts = [] }) =
|
|
|
122
129
|
value = token.value;
|
|
123
130
|
selectorValue = token.selectorValue;
|
|
124
131
|
}
|
|
125
|
-
const
|
|
126
|
-
const
|
|
132
|
+
const selectorEntry = selectorMap?.get(prop);
|
|
133
|
+
const selectorProp = selectorEntry?.name ?? prop;
|
|
134
|
+
const selectorOverride = selectorEntry && Object.prototype.hasOwnProperty.call(selectorEntry, "value") ? selectorEntry.value : void 0;
|
|
135
|
+
const finalSelectorValue = selectorOverride !== void 0 ? selectorOverride : selectorValue;
|
|
136
|
+
const className = api.contextToClassName(selectorProp, finalSelectorValue, contexts, false, api.selectorPrefix);
|
|
137
|
+
const cssClassName = api.contextToClassName(selectorProp, finalSelectorValue, contexts, true, api.selectorPrefix);
|
|
127
138
|
outputRecord[classNameProp] = cx(outputRecord[classNameProp], className);
|
|
128
139
|
insertRuntimeRule(api, cssClassName, contexts, prop, value);
|
|
129
140
|
}
|
|
@@ -97,7 +97,7 @@ const onPropTree = async (api, { tree, parser, file, code }) => {
|
|
|
97
97
|
next[name] = {
|
|
98
98
|
...prop,
|
|
99
99
|
value: normalizedValue,
|
|
100
|
-
selectorValue: prop.selectorValue
|
|
100
|
+
selectorValue: prop.selectorValue !== void 0 ? prop.selectorValue : normalizedValue
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
return next;
|
|
@@ -97,7 +97,7 @@ const onPropTree = async (api, { tree, parser, file, code }) => {
|
|
|
97
97
|
next[name] = {
|
|
98
98
|
...prop,
|
|
99
99
|
value: normalizedValue,
|
|
100
|
-
selectorValue: prop.selectorValue
|
|
100
|
+
selectorValue: prop.selectorValue !== void 0 ? prop.selectorValue : normalizedValue
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
return next;
|
package/dist/transform/cache.cjs
CHANGED