boss-css 0.0.13 → 0.0.14

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.
@@ -465,7 +465,8 @@ const buildInlineFirstOutput = (tree, tag, state) => {
465
465
  if (!expr) continue;
466
466
  if (shouldInline) styleProps.set(propName, expr);
467
467
  else {
468
- classNames.add(state.api.contextToClassName(propName, null, contexts, false, state.api.selectorPrefix));
468
+ const selectorName = prop.selectorName ?? propName;
469
+ classNames.add(state.api.contextToClassName(selectorName, null, contexts, false, state.api.selectorPrefix));
469
470
  styleProps.set(state.api.contextToCSSVariable(propName, null, contexts, state.api.selectorPrefix), expr);
470
471
  }
471
472
  }
@@ -500,7 +501,8 @@ const buildClassnameFirstOutput = (tree, tag, state) => {
500
501
  const isDynamicFn = prop.dynamic && prop.isFn;
501
502
  const selectorValue = isDynamicFn ? null : resolveSelectorValue(prop);
502
503
  const propName = resolved.name;
503
- classNames.add(state.api.contextToClassName(propName, selectorValue, contexts, false, state.api.selectorPrefix));
504
+ const selectorName = prop.selectorName ?? propName;
505
+ classNames.add(state.api.contextToClassName(selectorName, selectorValue, contexts, false, state.api.selectorPrefix));
504
506
  if (!isDynamicFn) continue;
505
507
  const expr = propToDynamicExpression(prop, propName, state);
506
508
  if (!expr) continue;
@@ -464,7 +464,8 @@ const buildInlineFirstOutput = (tree, tag, state) => {
464
464
  if (!expr) continue;
465
465
  if (shouldInline) styleProps.set(propName, expr);
466
466
  else {
467
- classNames.add(state.api.contextToClassName(propName, null, contexts, false, state.api.selectorPrefix));
467
+ const selectorName = prop.selectorName ?? propName;
468
+ classNames.add(state.api.contextToClassName(selectorName, null, contexts, false, state.api.selectorPrefix));
468
469
  styleProps.set(state.api.contextToCSSVariable(propName, null, contexts, state.api.selectorPrefix), expr);
469
470
  }
470
471
  }
@@ -499,7 +500,8 @@ const buildClassnameFirstOutput = (tree, tag, state) => {
499
500
  const isDynamicFn = prop.dynamic && prop.isFn;
500
501
  const selectorValue = isDynamicFn ? null : resolveSelectorValue(prop);
501
502
  const propName = resolved.name;
502
- classNames.add(state.api.contextToClassName(propName, selectorValue, contexts, false, state.api.selectorPrefix));
503
+ const selectorName = prop.selectorName ?? propName;
504
+ classNames.add(state.api.contextToClassName(selectorName, selectorValue, contexts, false, state.api.selectorPrefix));
503
505
  if (!isDynamicFn) continue;
504
506
  const expr = propToDynamicExpression(prop, propName, state);
505
507
  if (!expr) continue;
@@ -21,6 +21,18 @@ const normalizeValue = (value) => {
21
21
  if (isNumericValue(value)) return typeof value === "string" ? Number(value) : value;
22
22
  return value;
23
23
  };
24
+ const resolveTokenLiteral = (api, tokenPath) => {
25
+ const tokens = typeof api.tokens === "function" ? api.tokens({}) : api.tokens;
26
+ if (!tokens || typeof tokens !== "object") return void 0;
27
+ const [group, ...rest] = tokenPath.split(".");
28
+ let current = tokens[group];
29
+ for (const key of rest) {
30
+ if (!current || typeof current !== "object") return void 0;
31
+ const next = current[key];
32
+ current = next && typeof next === "object" && "value" in next ? next.value : next;
33
+ }
34
+ return current;
35
+ };
24
36
  const getStyleProps = (api) => {
25
37
  if (!api.nativeStyleProps) return /* @__PURE__ */ new Set();
26
38
  api.nativeStylePropSet ??= new Set(api.nativeStyleProps);
@@ -49,7 +61,8 @@ const onBrowserObjectStart = (api, { input, output = {} }) => {
49
61
  let value = input[prop];
50
62
  if (typeof value === "function") value = value();
51
63
  const token = require_use_token_runtime_only.resolveRuntimeToken(api, prop, value);
52
- if (token) value = token.value;
64
+ if (token) if (api.runtime?.only === true && typeof token.value === "string" && token.value.startsWith("var(") && token.tokenPath) value = resolveTokenLiteral(api, token.tokenPath) ?? token.value;
65
+ else value = token.value;
53
66
  bossStyle[prop] = normalizeValue(value);
54
67
  hasBossStyle = true;
55
68
  delete input[prop];
@@ -21,6 +21,18 @@ const normalizeValue = (value) => {
21
21
  if (isNumericValue(value)) return typeof value === "string" ? Number(value) : value;
22
22
  return value;
23
23
  };
24
+ const resolveTokenLiteral = (api, tokenPath) => {
25
+ const tokens = typeof api.tokens === "function" ? api.tokens({}) : api.tokens;
26
+ if (!tokens || typeof tokens !== "object") return void 0;
27
+ const [group, ...rest] = tokenPath.split(".");
28
+ let current = tokens[group];
29
+ for (const key of rest) {
30
+ if (!current || typeof current !== "object") return void 0;
31
+ const next = current[key];
32
+ current = next && typeof next === "object" && "value" in next ? next.value : next;
33
+ }
34
+ return current;
35
+ };
24
36
  const getStyleProps = (api) => {
25
37
  if (!api.nativeStyleProps) return /* @__PURE__ */ new Set();
26
38
  api.nativeStylePropSet ??= new Set(api.nativeStyleProps);
@@ -49,7 +61,8 @@ const onBrowserObjectStart = (api, { input, output = {} }) => {
49
61
  let value = input[prop];
50
62
  if (typeof value === "function") value = value();
51
63
  const token = resolveRuntimeToken(api, prop, value);
52
- if (token) value = token.value;
64
+ if (token) if (api.runtime?.only === true && typeof token.value === "string" && token.value.startsWith("var(") && token.tokenPath) value = resolveTokenLiteral(api, token.tokenPath) ?? token.value;
65
+ else value = token.value;
53
66
  bossStyle[prop] = normalizeValue(value);
54
67
  hasBossStyle = true;
55
68
  delete input[prop];
@@ -103,6 +103,8 @@ const extractPropTree = async (string, api) => {
103
103
  prop.important = true;
104
104
  prop.classToken = selector;
105
105
  }
106
+ if (lastProp) prop.selectorName = lastProp;
107
+ prop.selectorValue = value;
106
108
  createPropPath([...path], prop, tree);
107
109
  selectorTokens.delete(key);
108
110
  }
@@ -103,6 +103,8 @@ const extractPropTree = async (string, api) => {
103
103
  prop.important = true;
104
104
  prop.classToken = selector;
105
105
  }
106
+ if (lastProp) prop.selectorName = lastProp;
107
+ prop.selectorValue = value;
106
108
  createPropPath([...path], prop, tree);
107
109
  selectorTokens.delete(key);
108
110
  }
@@ -204,10 +204,11 @@ const onProp = async (api, { name, prop, contexts, preferVariables, file }) => {
204
204
  const isCustomProperty = typeof propName === "string" && propName.startsWith("--");
205
205
  if (!descriptor?.isCSSProp && !isCustomProperty) continue;
206
206
  const propertyName = isCustomProperty ? propName : descriptor?.property ?? api.camelCaseToDash(propName);
207
- const selectorValue = propValue.selectorValue ?? (preferVariables ? null : propValue.value);
207
+ const selectorValue = preferVariables ? null : propValue.selectorValue !== void 0 ? propValue.selectorValue : propValue.value;
208
208
  const classToken = propValue.classToken;
209
209
  const resolvedName = resolved?.name ?? propName;
210
- const className = classToken ? null : api.contextToClassName(resolvedName, selectorValue, stepContexts, true, api.selectorPrefix);
210
+ const selectorName = propValue.selectorName ?? resolvedName;
211
+ const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, stepContexts, true, api.selectorPrefix);
211
212
  const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
212
213
  const pseudoChain = stepContexts.filter((context) => require_prop_pseudo_server.dependencies.has(context));
213
214
  const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
@@ -253,12 +254,13 @@ const onProp = async (api, { name, prop, contexts, preferVariables, file }) => {
253
254
  const classToken = entry?.classToken;
254
255
  const resolved = api.dictionary.resolve(i);
255
256
  const resolvedName = resolved.descriptor ? resolved.name : i;
257
+ const selectorName = entry?.selectorName ?? resolvedName;
256
258
  if (resolved.suffix) {
257
259
  entry.named = resolved.suffix;
258
260
  entry.rawName = resolved.raw;
259
261
  }
260
- const selectorValue = entry?.selectorValue ?? (preferVariables ? null : entry.value);
261
- const className = classToken ? null : api.contextToClassName(resolvedName, selectorValue, nextContexts, true, api.selectorPrefix);
262
+ const selectorValue = preferVariables ? null : entry?.selectorValue !== void 0 ? entry.selectorValue : entry.value;
263
+ const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, nextContexts, true, api.selectorPrefix);
262
264
  const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
263
265
  const pseudoChain = nextContexts.filter((context) => require_prop_pseudo_server.dependencies.has(context));
264
266
  const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
@@ -203,10 +203,11 @@ const onProp = async (api, { name, prop, contexts, preferVariables, file }) => {
203
203
  const isCustomProperty = typeof propName === "string" && propName.startsWith("--");
204
204
  if (!descriptor?.isCSSProp && !isCustomProperty) continue;
205
205
  const propertyName = isCustomProperty ? propName : descriptor?.property ?? api.camelCaseToDash(propName);
206
- const selectorValue = propValue.selectorValue ?? (preferVariables ? null : propValue.value);
206
+ const selectorValue = preferVariables ? null : propValue.selectorValue !== void 0 ? propValue.selectorValue : propValue.value;
207
207
  const classToken = propValue.classToken;
208
208
  const resolvedName = resolved?.name ?? propName;
209
- const className = classToken ? null : api.contextToClassName(resolvedName, selectorValue, stepContexts, true, api.selectorPrefix);
209
+ const selectorName = propValue.selectorName ?? resolvedName;
210
+ const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, stepContexts, true, api.selectorPrefix);
210
211
  const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
211
212
  const pseudoChain = stepContexts.filter((context) => dependencies$1.has(context));
212
213
  const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
@@ -252,12 +253,13 @@ const onProp = async (api, { name, prop, contexts, preferVariables, file }) => {
252
253
  const classToken = entry?.classToken;
253
254
  const resolved = api.dictionary.resolve(i);
254
255
  const resolvedName = resolved.descriptor ? resolved.name : i;
256
+ const selectorName = entry?.selectorName ?? resolvedName;
255
257
  if (resolved.suffix) {
256
258
  entry.named = resolved.suffix;
257
259
  entry.rawName = resolved.raw;
258
260
  }
259
- const selectorValue = entry?.selectorValue ?? (preferVariables ? null : entry.value);
260
- const className = classToken ? null : api.contextToClassName(resolvedName, selectorValue, nextContexts, true, api.selectorPrefix);
261
+ const selectorValue = preferVariables ? null : entry?.selectorValue !== void 0 ? entry.selectorValue : entry.value;
262
+ const className = classToken ? null : api.contextToClassName(selectorName, selectorValue, nextContexts, true, api.selectorPrefix);
261
263
  const baseSelector = classToken ? api.classTokenToSelector(classToken) : `.${className}`;
262
264
  const pseudoChain = nextContexts.filter((context) => dependencies$1.has(context));
263
265
  const baseWithPseudos = pseudoChain.length ? `${baseSelector}:${pseudoChain.join(":")}` : baseSelector;
@@ -1,3 +1,4 @@
1
+ const require_selectors = require('./selectors.cjs');
1
2
  const require_shared = require('./shared.cjs');
2
3
 
3
4
  //#region src/prop/bosswind/browser.ts
@@ -10,6 +11,8 @@ const onBrowserObjectStart = (api, { input }) => {
10
11
  const rewritten = require_shared.rewriteBosswindInput(api, input, api.bosswind ?? {});
11
12
  Object.keys(input).forEach((key) => delete input[key]);
12
13
  Object.assign(input, rewritten);
14
+ const selectorMap = require_selectors.getBosswindSelectorMap(rewritten);
15
+ if (selectorMap) require_selectors.setBosswindSelectorMap(input, selectorMap);
13
16
  };
14
17
 
15
18
  //#endregion
@@ -1,3 +1,4 @@
1
+ import { getBosswindSelectorMap, setBosswindSelectorMap } from "./selectors.mjs";
1
2
  import { registerBosswindDictionary, rewriteBosswindInput } from "./shared.mjs";
2
3
 
3
4
  //#region src/prop/bosswind/browser.ts
@@ -10,6 +11,8 @@ const onBrowserObjectStart = (api, { input }) => {
10
11
  const rewritten = rewriteBosswindInput(api, input, api.bosswind ?? {});
11
12
  Object.keys(input).forEach((key) => delete input[key]);
12
13
  Object.assign(input, rewritten);
14
+ const selectorMap = getBosswindSelectorMap(rewritten);
15
+ if (selectorMap) setBosswindSelectorMap(input, selectorMap);
13
16
  };
14
17
 
15
18
  //#endregion
@@ -1,3 +1,4 @@
1
+ const require_selectors = require('./selectors.cjs');
1
2
  const require_shared = require('./shared.cjs');
2
3
 
3
4
  //#region src/prop/bosswind/runtime-only.ts
@@ -10,6 +11,8 @@ const onBrowserObjectStart = (api, { input }) => {
10
11
  const rewritten = require_shared.rewriteBosswindInput(api, input, api.bosswind ?? {});
11
12
  Object.keys(input).forEach((key) => delete input[key]);
12
13
  Object.assign(input, rewritten);
14
+ const selectorMap = require_selectors.getBosswindSelectorMap(rewritten);
15
+ if (selectorMap) require_selectors.setBosswindSelectorMap(input, selectorMap);
13
16
  };
14
17
 
15
18
  //#endregion
@@ -1,3 +1,4 @@
1
+ import { getBosswindSelectorMap, setBosswindSelectorMap } from "./selectors.mjs";
1
2
  import { registerBosswindDictionary, rewriteBosswindInput } from "./shared.mjs";
2
3
 
3
4
  //#region src/prop/bosswind/runtime-only.ts
@@ -10,6 +11,8 @@ const onBrowserObjectStart = (api, { input }) => {
10
11
  const rewritten = rewriteBosswindInput(api, input, api.bosswind ?? {});
11
12
  Object.keys(input).forEach((key) => delete input[key]);
12
13
  Object.assign(input, rewritten);
14
+ const selectorMap = getBosswindSelectorMap(rewritten);
15
+ if (selectorMap) setBosswindSelectorMap(input, selectorMap);
13
16
  };
14
17
 
15
18
  //#endregion
@@ -0,0 +1,18 @@
1
+
2
+ //#region src/prop/bosswind/selectors.ts
3
+ const bosswindSelectorKey = Symbol.for("bosswind.selectorMap");
4
+ const getBosswindSelectorMap = (input) => {
5
+ if (!input || typeof input !== "object") return void 0;
6
+ return input[bosswindSelectorKey];
7
+ };
8
+ const setBosswindSelectorMap = (input, selectors) => {
9
+ Object.defineProperty(input, bosswindSelectorKey, {
10
+ value: selectors,
11
+ enumerable: false,
12
+ configurable: true
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.getBosswindSelectorMap = getBosswindSelectorMap;
18
+ exports.setBosswindSelectorMap = setBosswindSelectorMap;
@@ -0,0 +1,16 @@
1
+ //#region src/prop/bosswind/selectors.ts
2
+ const bosswindSelectorKey = Symbol.for("bosswind.selectorMap");
3
+ const getBosswindSelectorMap = (input) => {
4
+ if (!input || typeof input !== "object") return void 0;
5
+ return input[bosswindSelectorKey];
6
+ };
7
+ const setBosswindSelectorMap = (input, selectors) => {
8
+ Object.defineProperty(input, bosswindSelectorKey, {
9
+ value: selectors,
10
+ enumerable: false,
11
+ configurable: true
12
+ });
13
+ };
14
+
15
+ //#endregion
16
+ export { getBosswindSelectorMap, setBosswindSelectorMap };
@@ -1,3 +1,4 @@
1
+ const require_selectors = require('./selectors.cjs');
1
2
 
2
3
  //#region src/prop/bosswind/shared.ts
3
4
  const toDashCase = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
@@ -580,10 +581,16 @@ const registerBosswindDictionary = (api) => {
580
581
  api.dictionary.set(entry.name, prop);
581
582
  }
582
583
  };
583
- const cloneProp = (prop, value) => ({
584
- ...prop,
585
- value
586
- });
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
+ };
587
594
  const combineAxisValues = (xValue, yValue, defaults) => {
588
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)];
589
596
  return [resolveTranslateScaleValue(xValue, defaults.x), resolveTranslateScaleValue(yValue, defaults.y)];
@@ -606,14 +613,20 @@ const resolveAxisPairs = (entries, node) => {
606
613
  }
607
614
  return results;
608
615
  };
609
- const applyAxisPairsToTree = (entries, node, output, used) => {
616
+ const applyAxisPairsToTree = (entries, node, output, used, getSelectorName) => {
610
617
  const pairs = resolveAxisPairs(entries, node);
611
618
  if (!pairs.length) return;
612
619
  for (const pair of pairs) {
613
620
  if (!Number.isFinite(pair.emitIndex)) continue;
614
621
  const xValue = node[pair.x]?.value ?? null;
615
622
  const yValue = node[pair.y]?.value ?? null;
616
- output[pair.prop] = cloneProp(node[pair.x] || node[pair.y], combineAxisValues(xValue, yValue, pair.defaults));
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);
617
630
  used.set(pair.x, true);
618
631
  used.set(pair.y, true);
619
632
  used.set(`__emit:${pair.emitIndex}:${pair.prop}`, true);
@@ -626,22 +639,29 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
626
639
  const rawEntries = Object.entries(node);
627
640
  const entries = [];
628
641
  const normalizedNode = {};
642
+ const rawNameByNormalized = /* @__PURE__ */ new Map();
629
643
  rawEntries.forEach(([rawName, prop]) => {
630
644
  const name = normalizeBosswindName(rawName);
631
645
  if (Object.prototype.hasOwnProperty.call(normalizedNode, name)) return;
632
646
  normalizedNode[name] = prop;
647
+ rawNameByNormalized.set(name, rawName);
633
648
  entries.push([name, prop]);
634
649
  });
650
+ const getSelectorName = (name) => rawNameByNormalized.get(name) ?? name;
635
651
  const output = {};
636
652
  const used = /* @__PURE__ */ new Map();
637
- applyAxisPairsToTree(entries, normalizedNode, output, used);
653
+ applyAxisPairsToTree(entries, normalizedNode, output, used, getSelectorName);
638
654
  const hasSkewX = Object.prototype.hasOwnProperty.call(normalizedNode, "skewX");
639
655
  const hasSkewY = Object.prototype.hasOwnProperty.call(normalizedNode, "skewY");
640
656
  if (!Object.prototype.hasOwnProperty.call(normalizedNode, "transform") && (hasSkewX || hasSkewY)) {
641
657
  const transformValue = resolveSkewTransformValue(hasSkewX ? normalizedNode.skewX?.value ?? null : null, hasSkewY ? normalizedNode.skewY?.value ?? null : null, hasSkewX, hasSkewY);
642
658
  if (transformValue) {
643
- const sourceProp = normalizedNode.skewX || normalizedNode.skewY;
644
- if (sourceProp) output.transform = cloneProp(sourceProp, transformValue);
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
+ }
645
665
  used.set("skewX", true);
646
666
  used.set("skewY", true);
647
667
  }
@@ -660,7 +680,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
660
680
  const value = prop?.value;
661
681
  if (name === "flex" || name === "grid") {
662
682
  if (value === null || value === true) {
663
- output.display = cloneProp(prop, name);
683
+ output.display = cloneProp(prop, name, getSelectorName(name), null);
664
684
  usedBosswind = true;
665
685
  return;
666
686
  }
@@ -670,7 +690,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
670
690
  if (displayKeywords.has(name)) {
671
691
  if (value === null || value === true) {
672
692
  const displayValue = displayKeywords.get(name);
673
- if (displayValue) output.display = cloneProp(prop, displayValue);
693
+ if (displayValue) output.display = cloneProp(prop, displayValue, getSelectorName(name), null);
674
694
  }
675
695
  usedBosswind = true;
676
696
  return;
@@ -678,7 +698,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
678
698
  if (positionKeywords.has(name)) {
679
699
  if (value === null || value === true) {
680
700
  const positionValue = positionKeywords.get(name);
681
- if (positionValue) output.position = cloneProp(prop, positionValue);
701
+ if (positionValue) output.position = cloneProp(prop, positionValue, getSelectorName(name), null);
682
702
  }
683
703
  usedBosswind = true;
684
704
  return;
@@ -686,7 +706,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
686
706
  if (booleanAliases.has(name)) {
687
707
  if (value === null || value === true) {
688
708
  const entry = booleanAliases.get(name);
689
- if (entry) output[entry.prop] = cloneProp(prop, entry.value);
709
+ if (entry) output[entry.prop] = cloneProp(prop, entry.value, getSelectorName(name), null);
690
710
  }
691
711
  usedBosswind = true;
692
712
  return;
@@ -696,13 +716,13 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
696
716
  usedText = true;
697
717
  if (value === null || value === true) return;
698
718
  const resolved = resolveTextTarget(api, value, config, tokens);
699
- output[resolved.prop] = cloneProp(prop, resolved.value);
719
+ output[resolved.prop] = cloneProp(prop, resolved.value, getSelectorName(name));
700
720
  return;
701
721
  }
702
722
  if (name === bgAlias) {
703
723
  usedBosswind = true;
704
724
  if (value === null || value === true) return;
705
- 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));
706
726
  return;
707
727
  }
708
728
  if (name === borderAlias) {
@@ -710,36 +730,39 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
710
730
  if (parser === "jsx") {
711
731
  const resolvedToken = resolveBorderToken(value, tokens);
712
732
  if (resolvedToken) {
713
- output[resolvedToken.prop] = cloneProp(prop, resolvedToken.value);
733
+ output[resolvedToken.prop] = cloneProp(prop, resolvedToken.value, getSelectorName(name));
714
734
  return;
715
735
  }
716
- 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));
717
738
  return;
718
739
  }
719
740
  const resolved = resolveBorderTarget(value, config, tokens);
720
741
  if (!resolved) {
721
- output[name] = prop;
742
+ output[name] = cloneProp(prop, value, getSelectorName(name));
722
743
  return;
723
744
  }
724
- 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));
725
747
  return;
726
748
  }
727
749
  if (name === "shadow") {
728
750
  usedBosswind = true;
729
- if (value === null || value === true) output.boxShadow = cloneProp(prop, resolveShadowValue(value, config));
730
- 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));
731
753
  return;
732
754
  }
733
755
  if (name === "rounded") {
734
756
  usedBosswind = true;
735
- if (value === null || value === true) output.borderRadius = cloneProp(prop, resolveRoundedValue(value, config));
736
- 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));
737
759
  return;
738
760
  }
739
761
  if (name === "grow" || name === "shrink") {
740
762
  usedBosswind = true;
741
763
  const target = name === "grow" ? "flexGrow" : "flexShrink";
742
- 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));
743
766
  return;
744
767
  }
745
768
  if (aliasMap.has(name)) {
@@ -748,7 +771,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
748
771
  const targets = aliasMap.get(name) || [];
749
772
  const resolvedValue = name === "shadow" ? resolveShadowValue(value, config) : value;
750
773
  targets.forEach((target) => {
751
- output[target] = cloneProp(prop, resolvedValue);
774
+ output[target] = cloneProp(prop, resolvedValue, getSelectorName(name));
752
775
  });
753
776
  return;
754
777
  }
@@ -762,7 +785,7 @@ const rewriteBosswindTree = (api, tree, config, tokens, parser) => {
762
785
  usedText
763
786
  };
764
787
  };
765
- const applyAxisPairsToInput = (entries, input, output, used) => {
788
+ const applyAxisPairsToInput = (entries, input, output, used, getSelectorName, setSelector) => {
766
789
  const pairs = resolveAxisPairs(entries, input);
767
790
  if (!pairs.length) return;
768
791
  for (const pair of pairs) {
@@ -770,6 +793,10 @@ const applyAxisPairsToInput = (entries, input, output, used) => {
770
793
  const xValue = input[pair.x];
771
794
  const yValue = input[pair.y];
772
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));
773
800
  used.set(pair.x, true);
774
801
  used.set(pair.y, true);
775
802
  used.set(`__emit:${pair.emitIndex}:${pair.prop}`, true);
@@ -779,21 +806,31 @@ const rewriteBosswindInput = (api, input, config) => {
779
806
  const rawEntries = Object.entries(input);
780
807
  const entries = [];
781
808
  const normalizedInput = {};
809
+ const rawNameByNormalized = /* @__PURE__ */ new Map();
782
810
  rawEntries.forEach(([rawName, value]) => {
783
811
  const name = normalizeBosswindName(rawName);
784
812
  if (Object.prototype.hasOwnProperty.call(normalizedInput, name)) return;
785
813
  normalizedInput[name] = value;
814
+ rawNameByNormalized.set(name, rawName);
786
815
  entries.push([name, value]);
787
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
+ };
788
824
  const output = {};
789
825
  const used = /* @__PURE__ */ new Map();
790
- applyAxisPairsToInput(entries, normalizedInput, output, used);
826
+ applyAxisPairsToInput(entries, normalizedInput, output, used, getSelectorName, setSelector);
791
827
  const hasSkewX = Object.prototype.hasOwnProperty.call(normalizedInput, "skewX");
792
828
  const hasSkewY = Object.prototype.hasOwnProperty.call(normalizedInput, "skewY");
793
829
  if (!Object.prototype.hasOwnProperty.call(normalizedInput, "transform") && (hasSkewX || hasSkewY)) {
794
830
  const transformValue = resolveSkewTransformValue(hasSkewX ? normalizedInput.skewX : null, hasSkewY ? normalizedInput.skewY : null, hasSkewX, hasSkewY);
795
831
  if (transformValue) {
796
832
  output.transform = transformValue;
833
+ setSelector("transform", getSelectorName(hasSkewX ? "skewX" : "skewY"));
797
834
  used.set("skewX", true);
798
835
  used.set("skewY", true);
799
836
  }
@@ -806,28 +843,39 @@ const rewriteBosswindInput = (api, input, config) => {
806
843
  return;
807
844
  }
808
845
  if (name === "flex" || name === "grid") {
809
- if (value === null || value === true) output.display = name;
810
- else output[name] = value;
846
+ if (value === null || value === true) {
847
+ output.display = name;
848
+ setSelector("display", getSelectorName(name), null);
849
+ } else output[name] = value;
811
850
  return;
812
851
  }
813
852
  if (displayKeywords.has(name)) {
814
853
  if (value === null || value === true) {
815
854
  const displayValue = displayKeywords.get(name);
816
- if (displayValue) output.display = displayValue;
855
+ if (displayValue) {
856
+ output.display = displayValue;
857
+ setSelector("display", getSelectorName(name), null);
858
+ }
817
859
  }
818
860
  return;
819
861
  }
820
862
  if (positionKeywords.has(name)) {
821
863
  if (value === null || value === true) {
822
864
  const positionValue = positionKeywords.get(name);
823
- if (positionValue) output.position = positionValue;
865
+ if (positionValue) {
866
+ output.position = positionValue;
867
+ setSelector("position", getSelectorName(name), null);
868
+ }
824
869
  }
825
870
  return;
826
871
  }
827
872
  if (booleanAliases.has(name)) {
828
873
  if (value === null || value === true) {
829
874
  const entry = booleanAliases.get(name);
830
- if (entry) output[entry.prop] = entry.value;
875
+ if (entry) {
876
+ output[entry.prop] = entry.value;
877
+ setSelector(entry.prop, getSelectorName(name), null);
878
+ }
831
879
  }
832
880
  return;
833
881
  }
@@ -835,43 +883,56 @@ const rewriteBosswindInput = (api, input, config) => {
835
883
  if (value === null || value === true) return;
836
884
  const resolved = resolveTextTarget(api, value, config, void 0);
837
885
  output[resolved.prop] = resolved.value;
886
+ setSelector(resolved.prop, getSelectorName(name));
838
887
  return;
839
888
  }
840
889
  if (name === bgAlias) {
841
890
  if (value === null || value === true) return;
842
891
  output.backgroundColor = value;
892
+ setSelector("backgroundColor", getSelectorName(name));
843
893
  return;
844
894
  }
845
895
  if (name === borderAlias) {
846
896
  const resolvedToken = resolveBorderToken(value, api.tokens);
847
897
  if (resolvedToken) {
848
898
  output[resolvedToken.prop] = resolvedToken.value;
899
+ setSelector(resolvedToken.prop, getSelectorName(name));
849
900
  return;
850
901
  }
851
902
  output[name] = value;
903
+ if (value === null || value === true) setSelector(name, getSelectorName(name), null);
904
+ else setSelector(name, getSelectorName(name));
852
905
  return;
853
906
  }
854
907
  if (name === "shadow") {
855
908
  output.boxShadow = resolveShadowValue(value, config);
909
+ if (value === null || value === true) setSelector("boxShadow", getSelectorName(name), null);
910
+ else setSelector("boxShadow", getSelectorName(name));
856
911
  return;
857
912
  }
858
913
  if (name === "rounded") {
859
914
  output.borderRadius = resolveRoundedValue(value, config);
915
+ if (value === null || value === true) setSelector("borderRadius", getSelectorName(name), null);
916
+ else setSelector("borderRadius", getSelectorName(name));
860
917
  return;
861
918
  }
862
919
  if (name === "grow" || name === "shrink") {
863
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));
864
923
  return;
865
924
  }
866
925
  if (aliasMap.has(name)) {
867
926
  if (value === null || value === true) return;
868
927
  (aliasMap.get(name) || []).forEach((target) => {
869
928
  output[target] = value;
929
+ setSelector(target, getSelectorName(name));
870
930
  });
871
931
  return;
872
932
  }
873
933
  output[name] = value;
874
934
  });
935
+ require_selectors.setBosswindSelectorMap(output, selectorMap);
875
936
  return output;
876
937
  };
877
938
  const getBosswindDefaults = (theme) => {