@multiplatform.one/config 10.5.2 → 10.6.1

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/design-lint.mjs CHANGED
@@ -61,8 +61,22 @@ const middotJoin = /(^|[^\p{L}\p{N}])·([^\p{L}\p{N}]|$)|\s•\s/u;
61
61
  const focusPaint =
62
62
  /^(?:outline(?:Width|Color|Offset)?|boxShadow|shadow(?:Color|Opacity|Radius|Offset)|elevation)$/;
63
63
  const focusStates = new Set(["focusStyle", "focusVisibleStyle", "focusWithinStyle"]);
64
- const focusClausePaint =
65
- /(?<![\w/-])(?:[@A-Za-z][\w/@-]*:)*focus(?:-visible|-within)?:(?!(?:0(?:px)?|none|transparent)(?:\s+[@A-Za-z][\w/@-]*:|\s*$))\S/;
64
+ const focusClause = /(?<![\w/-])focus(?:-visible|-within)?:(?=\S)/g;
65
+ const inertFocusPayloads = new Set(["0", "0px", "none", "transparent"]);
66
+ const nextFlatClause = /^\s+[@A-Za-z][\w/@-]*:/;
67
+ // A focus clause paints unless its payload is inert and the value ends or a
68
+ // further clause follows it.
69
+ function paintsFocusClause(text) {
70
+ for (const clause of text.matchAll(focusClause)) {
71
+ const rest = text.slice(clause.index + clause[0].length);
72
+ const payload = /^\S*/.exec(rest)[0];
73
+ const after = rest.slice(payload.length);
74
+ const inert =
75
+ inertFocusPayloads.has(payload) && (after.trim() === "" || nextFlatClause.test(after));
76
+ if (!inert) return true;
77
+ }
78
+ return false;
79
+ }
66
80
  // LC-149 FIELD-TRAILING-ACTION: a field's own action (reveal, clear, copy,
67
81
  // eyedropper) is Input.Action inside the field, never an icon button beside it.
68
82
  const fieldTag =
@@ -77,7 +91,6 @@ const copyTag = /^Copy\w*Button$/;
77
91
  // Tamagui 3 replaced `Component.styleable(fn)` with `createStyledHOC(Component,
78
92
  // fn)`, so a wrapped component spells its render function as the second
79
93
  // argument. Both shapes are unwrapped while the tree is half converted.
80
- const styleableWrap = /\.styleable$/;
81
94
  const styledHocWrap = /(?:^|\.)createStyledHOC$/;
82
95
  // LC-176 ICON-BUTTON: an icon-only button paints its recipe's plate. A prop that
83
96
  // paints its own plate, ring or corners around the glyph needs a named plate.
@@ -884,7 +897,7 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
884
897
  }
885
898
  function checkFocus(key, value, node) {
886
899
  const flat = resolve(value);
887
- if (focusPaint.test(key) && ts.isStringLiteralLike(flat) && focusClausePaint.test(flat.text)) {
900
+ if (focusPaint.test(key) && ts.isStringLiteralLike(flat) && paintsFocusClause(flat.text)) {
888
901
  report(
889
902
  node,
890
903
  "field-focus",
@@ -1944,7 +1957,7 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
1944
1957
  const callee = current.expression.getText(file);
1945
1958
  if (/^(?:(?:React\.)?(?:memo|forwardRef)|observer|withStaticProperties)$/.test(callee))
1946
1959
  current = current.arguments[0];
1947
- else if (styleableWrap.test(callee)) current = current.arguments[0];
1960
+ else if (callee.endsWith(".styleable")) current = current.arguments[0];
1948
1961
  else if (styledHocWrap.test(callee) && current.arguments[1]) current = current.arguments[1];
1949
1962
  else return current;
1950
1963
  }
@@ -1957,7 +1970,7 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
1957
1970
  if (styledPrimitive(value)?.paints) return true;
1958
1971
  if (ts.isCallExpression(value)) {
1959
1972
  const callee = value.expression.getText(file);
1960
- if (styleableWrap.test(callee) || styledHocWrap.test(callee)) return false;
1973
+ if (callee.endsWith(".styleable") || styledHocWrap.test(callee)) return false;
1961
1974
  }
1962
1975
  return false;
1963
1976
  }
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as phosphorTokenColorPlugin, n as tamaguiWorkspacePathsFile, t as ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths-7eT9XxzE.js";
2
2
  import { t as createStorybookViteConfig } from "./storybook-CBMUIh2Y.js";
3
- import { t as createViteConfig } from "./vite-CuPNWr9Z.js";
3
+ import { t as createViteConfig } from "./vite-5p2IIWBo.js";
4
4
  import { t as createVitestConfig } from "./vitest-B8Z8ZZQR.js";
5
5
 
6
6
  export { createStorybookViteConfig, createViteConfig, createVitestConfig, ensureTamaguiWorkspacePaths, phosphorTokenColorPlugin, tamaguiWorkspacePathsFile };
@@ -225,9 +225,7 @@ function createViteConfig(options = {}) {
225
225
  dotenv.config({ path: path.resolve(projectRoot, ".env") });
226
226
  if (publicConfigKeys.length > 0) bakePublicConfig(publicConfigKeys);
227
227
  const vitePlugins = [];
228
- vitePlugins.push(singletonResolvePlugin(projectRoot));
229
- vitePlugins.push(preferBuiltWorkspaceEntryPlugin());
230
- vitePlugins.push(phosphorTokenColorPlugin());
228
+ vitePlugins.push(singletonResolvePlugin(projectRoot), preferBuiltWorkspaceEntryPlugin(), phosphorTokenColorPlugin());
231
229
  if (publicConfigFile) vitePlugins.push(publicConfigPlugin({
232
230
  file: publicConfigFile,
233
231
  projectRoot,
package/lib/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as staleNativeDistSource, i as resolveWorkspaceNativeEntry, n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-51EOX3PW.js";
2
2
  import { i as phosphorTokenColorPlugin } from "./tamaguiWorkspacePaths-7eT9XxzE.js";
3
- import { a as phosphorNativeIconLibId, i as phosphorNativeIconBaseId, n as nativeOnlyPlugin, o as publicConfigPlugin, r as phosphorNativeIconBase, s as readPublicConfigKeys, t as createViteConfig } from "./vite-CuPNWr9Z.js";
3
+ import { a as phosphorNativeIconLibId, i as phosphorNativeIconBaseId, n as nativeOnlyPlugin, o as publicConfigPlugin, r as phosphorNativeIconBase, s as readPublicConfigKeys, t as createViteConfig } from "./vite-5p2IIWBo.js";
4
4
 
5
5
  export { createViteConfig, discoverPublicPackageRoots, nativeOnlyPlugin, phosphorNativeIconBase, phosphorNativeIconBaseId, phosphorNativeIconLibId, phosphorTokenColorPlugin, publicConfigPlugin, publicPackageViteSourceAliases, readPublicConfigKeys, resolveWorkspaceNativeEntry, staleNativeDistSource };
package/lint.mjs CHANGED
@@ -497,7 +497,7 @@ export function readThemeKeys() {
497
497
  }
498
498
  for (const k of keysOfBlock(sliceBlock(templatesSrc, "const base = {", "\n };"), 4)) {
499
499
  keys.add(k);
500
- const step = k.match(/^color-([1-9]\d*)$/)?.[1];
500
+ const step = /^color-([1-9]\d*)$/.exec(k)?.[1];
501
501
  if (step) keys.add(`accent-${step}`);
502
502
  }
503
503
  const rampHues = rampsSrc.match(/export const themeRampHues = \[([^\]]+)\]/)?.[1] ?? "";
@@ -605,7 +605,10 @@ function checkStyleTokens() {
605
605
  if (colorProps.has(long)) colorProps.add(short);
606
606
  }
607
607
  const props = [...byProp.keys()].sort((a, b) => b.length - a.length).join("|");
608
- const re = new RegExp(`(?<![\\w-])(${props})=(?:"([^"\\n]*)"|\\{\\s*"([^"\\n]*)"\\s*\\})`, "g");
608
+ const re = new RegExp(
609
+ String.raw`(?<![\w-])(${props})=(?:"([^"\n]*)"|\{\s*"([^"\n]*)"\s*\})`,
610
+ "g",
611
+ );
609
612
  const violations = scanLiterals(re, (m) => {
610
613
  const value = m[2] ?? m[3];
611
614
  const resolvable = byProp.get(m[1]) ?? new Set();
@@ -617,7 +620,11 @@ function checkStyleTokens() {
617
620
  }
618
621
 
619
622
  const flatModifierChain = /^(?:[@A-Za-z][\w/@-]*:)+/;
620
- const themeKeyShape = /^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)+|[a-z]+\d+|[a-z]+[A-Z][A-Za-z0-9]*)$/;
623
+ const themeKeyShapes = [
624
+ /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/,
625
+ /^[a-z]+\d+$/,
626
+ /^[a-z]+[A-Z][A-Za-z0-9]*$/,
627
+ ];
621
628
 
622
629
  /**
623
630
  * The words of a style value that name a token or theme key nothing defines.
@@ -642,7 +649,7 @@ function unresolvedStyleWords(value, resolvable, isColor) {
642
649
  if (word.startsWith("$")) return /^\$[A-Za-z0-9.-]+$/.test(word) && !known(word.slice(1));
643
650
  if (!isColor || word === "currentColor") return false;
644
651
  const name = word.replace(/^[a-z]+\./, "");
645
- return themeKeyShape.test(name) && !known(word);
652
+ return themeKeyShapes.some((shape) => shape.test(name)) && !known(word);
646
653
  });
647
654
  }
648
655
 
@@ -650,7 +657,7 @@ function unresolvedStyleWords(value, resolvable, isColor) {
650
657
  function checkThemeNames() {
651
658
  const valid = readThemeNames();
652
659
  if (!valid.size) return { violations: [], ok: false };
653
- const re = /\btheme=(?:"([A-Za-z][A-Za-z0-9_]*)"|\{\s*"([A-Za-z][A-Za-z0-9_]*)"\s*\})/g;
660
+ const re = /\btheme=(?:"([A-Za-z]\w*)"|\{\s*"([A-Za-z]\w*)"\s*\})/g;
654
661
  const violations = scanLiterals(re, (m) => {
655
662
  const name = m[1] ?? m[2];
656
663
  return valid.has(name) ? undefined : `theme="${name}"`;
@@ -718,6 +725,41 @@ function checkIntentTokens() {
718
725
  return { violations, valid: [...valid].sort(), ok: true };
719
726
  }
720
727
 
728
+ const quotedRun = /["'][^"'\n]*/g;
729
+ const enterExitClause = /(?<![\w/-])(?:enter|exit):(?![\s"'])/;
730
+
731
+ /**
732
+ * Whether the quote at `at` opens an attribute value: `=`, then space, an
733
+ * optional `{` and more space before it.
734
+ * @param {string} tag
735
+ * @param {number} at
736
+ */
737
+ function opensAttrValue(tag, at) {
738
+ let i = at - 1;
739
+ while (i >= 0 && /\s/.test(tag[i])) i--;
740
+ if (tag[i] === "{") {
741
+ i--;
742
+ while (i >= 0 && /\s/.test(tag[i])) i--;
743
+ }
744
+ return tag[i] === "=";
745
+ }
746
+
747
+ /**
748
+ * Whether a tag's text carries an `enter:` or `exit:` flat clause inside a
749
+ * quoted attribute value. Each value is read with the opening quote and the
750
+ * character that closes it, so the clause sees the same neighbours it has in
751
+ * the tag.
752
+ * @param {string} tag
753
+ */
754
+ function hasEnterExitClause(tag) {
755
+ for (const value of tag.matchAll(quotedRun)) {
756
+ if (!opensAttrValue(tag, value.index)) continue;
757
+ const end = value.index + value[0].length + 1;
758
+ if (enterExitClause.test(tag.slice(value.index, end))) return true;
759
+ }
760
+ return false;
761
+ }
762
+
721
763
  /**
722
764
  * Two more silent-animation-death shapes, both found dead in the live sweep
723
765
  * (`p-results/fix-animation-sweep.md`) and neither catchable by the token
@@ -758,11 +800,7 @@ function checkAnimationProps() {
758
800
  // truncates the tag and hides everything after it from this check.
759
801
  for (const tag of src.matchAll(/<[A-Z][\w.]*(?:\s(?:=>|[^>])*)?>/gs)) {
760
802
  const t = tag[0];
761
- if (
762
- !/\b(enterStyle|exitStyle)=/.test(t) &&
763
- !/=\s*\{?\s*["'][^"'\n]*?(?<![\w/-])(?:enter|exit):(?![\s"'])/.test(t)
764
- )
765
- continue;
803
+ if (!/\b(enterStyle|exitStyle)=/.test(t) && !hasEnterExitClause(t)) continue;
766
804
  if (/\btransition(?:[=:]|Props\()/.test(t)) continue;
767
805
  const line = src.slice(0, tag.index).split("\n").length;
768
806
  driverless.push(`${rel}:${line} — enter/exitStyle with no \`transition\` driver (LC-24)`);
@@ -2672,25 +2710,29 @@ function styledVariantAttrSites(ts, src, filePath) {
2672
2710
  };
2673
2711
  collect(sf);
2674
2712
 
2713
+ const readSpread = (prop, where, seen) => {
2714
+ const spread = unwrap(prop.expression);
2715
+ if (!spread) return;
2716
+ const branches = ts.isConditionalExpression(spread)
2717
+ ? [unwrap(spread.whenTrue), unwrap(spread.whenFalse)]
2718
+ : [spread];
2719
+ for (const branch of branches) {
2720
+ if (!branch) continue;
2721
+ if (ts.isObjectLiteralExpression(branch)) readValue(branch, where, seen);
2722
+ else if (ts.isIdentifier(branch) && locals.has(branch.text) && !seen.has(branch.text)) {
2723
+ readValue(
2724
+ locals.get(branch.text),
2725
+ `${where} via ...${branch.text}`,
2726
+ new Set([...seen, branch.text]),
2727
+ );
2728
+ }
2729
+ }
2730
+ };
2731
+
2675
2732
  const readValue = (obj, where, seen) => {
2676
2733
  for (const prop of obj.properties) {
2677
2734
  if (ts.isSpreadAssignment(prop)) {
2678
- const spread = unwrap(prop.expression);
2679
- if (!spread) continue;
2680
- const branches = ts.isConditionalExpression(spread)
2681
- ? [unwrap(spread.whenTrue), unwrap(spread.whenFalse)]
2682
- : [spread];
2683
- for (const branch of branches) {
2684
- if (!branch) continue;
2685
- if (ts.isObjectLiteralExpression(branch)) readValue(branch, where, seen);
2686
- else if (ts.isIdentifier(branch) && locals.has(branch.text) && !seen.has(branch.text)) {
2687
- readValue(
2688
- locals.get(branch.text),
2689
- `${where} via ...${branch.text}`,
2690
- new Set([...seen, branch.text]),
2691
- );
2692
- }
2693
- }
2735
+ readSpread(prop, where, seen);
2694
2736
  continue;
2695
2737
  }
2696
2738
  const key = keyOf(prop);
@@ -2699,57 +2741,60 @@ function styledVariantAttrSites(ts, src, filePath) {
2699
2741
  }
2700
2742
  };
2701
2743
 
2744
+ const isStyledCallee = (callee) =>
2745
+ (ts.isIdentifier(callee) && callee.text === "styled") ||
2746
+ (ts.isPropertyAccessExpression(callee) &&
2747
+ ts.isIdentifier(callee.expression) &&
2748
+ callee.expression.text === "styled" &&
2749
+ callee.name.text !== "dynamic");
2750
+
2751
+ const isContextProp = (prop) => ts.isPropertyAssignment(prop) && keyOf(prop) === "context";
2752
+
2753
+ const readBagHazards = (options) => {
2754
+ if (options.properties.some(isContextProp)) return;
2755
+ for (const prop of options.properties) {
2756
+ if (!ts.isPropertyAssignment(prop) && !ts.isShorthandPropertyAssignment(prop)) continue;
2757
+ const key = keyOf(prop);
2758
+ if (key && BAG_HAZARD_ATTRS.has(key))
2759
+ sites.push({ line: lineOf(prop.getStart(sf)), key, where: "the options object" });
2760
+ }
2761
+ };
2762
+
2763
+ const readVariantCase = (variantName, one) => {
2764
+ if (!ts.isPropertyAssignment(one)) return;
2765
+ const caseName = keyOf(one) ?? "?";
2766
+ const value = unwrap(one.initializer);
2767
+ const where = `variants.${variantName}.${caseName}`;
2768
+ if (!value) return;
2769
+ if (ts.isObjectLiteralExpression(value)) readValue(value, where, new Set());
2770
+ else if (ts.isIdentifier(value) && locals.has(value.text)) {
2771
+ readValue(locals.get(value.text), `${where} = ${value.text}`, new Set([value.text]));
2772
+ }
2773
+ };
2774
+
2775
+ const readVariant = (variant) => {
2776
+ if (!ts.isPropertyAssignment(variant)) return;
2777
+ const variantName = keyOf(variant) ?? "?";
2778
+ const cases = unwrap(variant.initializer);
2779
+ if (!cases || !ts.isObjectLiteralExpression(cases)) return;
2780
+ for (const one of cases.properties) readVariantCase(variantName, one);
2781
+ };
2782
+
2783
+ const readVariants = (options) => {
2784
+ for (const prop of options.properties) {
2785
+ if (!ts.isPropertyAssignment(prop) || keyOf(prop) !== "variants") continue;
2786
+ const variants = unwrap(prop.initializer);
2787
+ if (!variants || !ts.isObjectLiteralExpression(variants)) continue;
2788
+ for (const variant of variants.properties) readVariant(variant);
2789
+ }
2790
+ };
2791
+
2702
2792
  const visit = (node) => {
2703
- if (ts.isCallExpression(node)) {
2704
- const callee = node.expression;
2705
- const isStyled =
2706
- (ts.isIdentifier(callee) && callee.text === "styled") ||
2707
- (ts.isPropertyAccessExpression(callee) &&
2708
- ts.isIdentifier(callee.expression) &&
2709
- callee.expression.text === "styled" &&
2710
- callee.name.text !== "dynamic");
2711
- if (isStyled) {
2712
- const options = unwrap(node.arguments[1]);
2713
- if (options && ts.isObjectLiteralExpression(options)) {
2714
- const guarded = options.properties.some(
2715
- (prop) => ts.isPropertyAssignment(prop) && keyOf(prop) === "context",
2716
- );
2717
- if (!guarded) {
2718
- for (const prop of options.properties) {
2719
- if (!ts.isPropertyAssignment(prop) && !ts.isShorthandPropertyAssignment(prop))
2720
- continue;
2721
- const key = keyOf(prop);
2722
- if (key && BAG_HAZARD_ATTRS.has(key))
2723
- sites.push({ line: lineOf(prop.getStart(sf)), key, where: "the options object" });
2724
- }
2725
- }
2726
- for (const prop of options.properties) {
2727
- if (!ts.isPropertyAssignment(prop) || keyOf(prop) !== "variants") continue;
2728
- const variants = unwrap(prop.initializer);
2729
- if (!variants || !ts.isObjectLiteralExpression(variants)) continue;
2730
- for (const variant of variants.properties) {
2731
- if (!ts.isPropertyAssignment(variant)) continue;
2732
- const variantName = keyOf(variant) ?? "?";
2733
- const cases = unwrap(variant.initializer);
2734
- if (!cases || !ts.isObjectLiteralExpression(cases)) continue;
2735
- for (const one of cases.properties) {
2736
- if (!ts.isPropertyAssignment(one)) continue;
2737
- const caseName = keyOf(one) ?? "?";
2738
- const value = unwrap(one.initializer);
2739
- const where = `variants.${variantName}.${caseName}`;
2740
- if (!value) continue;
2741
- if (ts.isObjectLiteralExpression(value)) readValue(value, where, new Set());
2742
- else if (ts.isIdentifier(value) && locals.has(value.text)) {
2743
- readValue(
2744
- locals.get(value.text),
2745
- `${where} = ${value.text}`,
2746
- new Set([value.text]),
2747
- );
2748
- }
2749
- }
2750
- }
2751
- }
2752
- }
2793
+ if (ts.isCallExpression(node) && isStyledCallee(node.expression)) {
2794
+ const options = unwrap(node.arguments[1]);
2795
+ if (options && ts.isObjectLiteralExpression(options)) {
2796
+ readBagHazards(options);
2797
+ readVariants(options);
2753
2798
  }
2754
2799
  }
2755
2800
  ts.forEachChild(node, visit);
@@ -2784,35 +2829,21 @@ function styledVariantAttrSites(ts, src, filePath) {
2784
2829
  function checkStyledVariantAttrs() {
2785
2830
  /** @type {string[]} */
2786
2831
  const violations = [];
2787
- const baselinePath = join(ROOT, VARIANT_ATTR_BASELINES);
2788
2832
  /** @type {Record<string, number>} */
2789
- let baseline = {};
2790
- if (existsSync(baselinePath)) {
2791
- const raw = JSON.parse(readFileSync(baselinePath, "utf8"));
2792
- if (raw && typeof raw.sites === "object") baseline = raw.sites;
2793
- }
2833
+ const baseline = readSiteBaseline(join(ROOT, VARIANT_ATTR_BASELINES));
2794
2834
  /** @type {Record<string, number>} */
2795
2835
  const counted = {};
2796
2836
  /** @type {string[]} */
2797
2837
  const candidates = [];
2798
2838
 
2799
2839
  const collect = (filePath) => {
2800
- if (!RETIRED_SCANNED_RE.test(filePath) || filePath.endsWith(".d.ts")) return;
2801
- if (VARIANT_ATTR_EXEMPT_RE.test(filePath)) return;
2802
- if (VARIANT_ATTR_GNOME_RE.test(relative(ROOT, filePath).replaceAll("\\", "/"))) return;
2803
- const src = readFileSync(filePath, "utf8");
2804
- if (!VARIANT_ATTR_CANDIDATE_RE.test(src)) return;
2805
- candidates.push(filePath);
2840
+ if (isVariantAttrCandidate(filePath)) candidates.push(filePath);
2806
2841
  };
2807
2842
  for (const dir of [PUBLIC_DIR, PACKAGES_DIR, APPS_DIR, FEATURES_DIR]) walkFiles(dir, collect);
2808
2843
  if (!candidates.length) return violations;
2809
2844
 
2810
- let ts;
2811
- try {
2812
- // The parser is this package's own dependency, not the consumer tree's
2813
- // content, so it resolves from here and not from the scanned root.
2814
- ts = createRequire(import.meta.url)("typescript");
2815
- } catch {
2845
+ const ts = loadConfigTypescript();
2846
+ if (!ts) {
2816
2847
  return [
2817
2848
  `typescript could not be resolved from @multiplatform.one/config, so ${candidates.length} styled() file(s) went unparsed — install it rather than let this check go quiet`,
2818
2849
  ];
@@ -2820,27 +2851,63 @@ function checkStyledVariantAttrs() {
2820
2851
 
2821
2852
  for (const filePath of candidates) {
2822
2853
  const rel = relative(ROOT, filePath).replaceAll("\\", "/");
2823
- const src = readFileSync(filePath, "utf8");
2824
- const lines = src.split("\n");
2825
- let open = 0;
2826
- for (const site of styledVariantAttrSites(ts, src, filePath)) {
2827
- open += 1;
2828
- if (open > (baseline[rel] ?? 0)) {
2829
- violations.push(
2830
- site.where === "the options object"
2831
- ? `${rel}:${site.line} — \`${site.key}\` in a styled() options object with no \`context\` is dropped from every usage the compiler can flatten; write it at the call site (LC-303)\n ${(lines[site.line - 1] ?? "").trim()}`
2832
- : `${rel}:${site.line} — \`${site.key}\` in ${site.where} reaches no element on ${VARIANT_DROPPED_ATTRS.get(site.key)}; write it at the call site (LC-303)\n ${(lines[site.line - 1] ?? "").trim()}`,
2833
- );
2834
- }
2835
- }
2854
+ const open = pushVariantAttrViolations(ts, filePath, rel, baseline, violations);
2836
2855
  if (open > 0) counted[rel] = open;
2837
2856
  }
2838
2857
 
2858
+ violations.push(...ratchetDownViolations(VARIANT_ATTR_BASELINES, baseline, counted));
2859
+ return violations;
2860
+ }
2861
+
2862
+ function isVariantAttrCandidate(filePath) {
2863
+ if (!RETIRED_SCANNED_RE.test(filePath) || filePath.endsWith(".d.ts")) return false;
2864
+ if (VARIANT_ATTR_EXEMPT_RE.test(filePath)) return false;
2865
+ if (VARIANT_ATTR_GNOME_RE.test(relative(ROOT, filePath).replaceAll("\\", "/"))) return false;
2866
+ const src = readFileSync(filePath, "utf8");
2867
+ return VARIANT_ATTR_CANDIDATE_RE.test(src);
2868
+ }
2869
+
2870
+ function loadConfigTypescript() {
2871
+ try {
2872
+ // The parser is this package's own dependency, not the consumer tree's
2873
+ // content, so it resolves from here and not from the scanned root.
2874
+ return createRequire(import.meta.url)("typescript");
2875
+ } catch {
2876
+ return undefined;
2877
+ }
2878
+ }
2879
+
2880
+ function pushVariantAttrViolations(ts, filePath, rel, baseline, violations) {
2881
+ const src = readFileSync(filePath, "utf8");
2882
+ const lines = src.split("\n");
2883
+ let open = 0;
2884
+ for (const site of styledVariantAttrSites(ts, src, filePath)) {
2885
+ open += 1;
2886
+ if (open > (baseline[rel] ?? 0)) violations.push(variantAttrViolation(rel, site, lines));
2887
+ }
2888
+ return open;
2889
+ }
2890
+
2891
+ function variantAttrViolation(rel, site, lines) {
2892
+ const text = (lines[site.line - 1] ?? "").trim();
2893
+ return site.where === "the options object"
2894
+ ? `${rel}:${site.line} — \`${site.key}\` in a styled() options object with no \`context\` is dropped from every usage the compiler can flatten; write it at the call site (LC-303)\n ${text}`
2895
+ : `${rel}:${site.line} — \`${site.key}\` in ${site.where} reaches no element on ${VARIANT_DROPPED_ATTRS.get(site.key)}; write it at the call site (LC-303)\n ${text}`;
2896
+ }
2897
+
2898
+ function readSiteBaseline(baselinePath) {
2899
+ if (!existsSync(baselinePath)) return {};
2900
+ const raw = JSON.parse(readFileSync(baselinePath, "utf8"));
2901
+ return raw && typeof raw.sites === "object" ? raw.sites : {};
2902
+ }
2903
+
2904
+ function ratchetDownViolations(baselineFile, baseline, counted) {
2905
+ const violations = [];
2839
2906
  for (const [rel, allowed] of Object.entries(baseline)) {
2840
2907
  const now = counted[rel] ?? 0;
2841
2908
  if (now < allowed) {
2842
2909
  violations.push(
2843
- `${VARIANT_ATTR_BASELINES}: ${rel} is down to ${now} from ${allowed} — lower the ratchet`,
2910
+ `${baselineFile}: ${rel} is down to ${now} from ${allowed} — lower the ratchet`,
2844
2911
  );
2845
2912
  }
2846
2913
  }
@@ -2924,8 +2991,48 @@ function checkOneSidebar() {
2924
2991
  return violations;
2925
2992
  }
2926
2993
 
2927
- const SPREAD_JUSTIFY_RE =
2928
- /justifyContent(?:\s*=\s*\{?\s*|\s*:\s*)["'](?:[^"'\n]*?[\s:])?(space-between|space-around|space-evenly)(?=["'\s])/g;
2994
+ const justifyValueStart = /justifyContent\s*(?:=\s*(?:\{\s*)?|:\s*)["']/g;
2995
+ const spreadAfterBreak = /[\s:](space-between|space-around|space-evenly)(?=["'\s])/;
2996
+ const spreadAtStart = /^(space-between|space-around|space-evenly)(?=["'\s])/;
2997
+ const longestSpread = "space-between".length;
2998
+
2999
+ /**
3000
+ * Every spread `justifyContent` value in a source file, as `{ index, value }`
3001
+ * with the index of its `justifyContent`. A value names the first spread word
3002
+ * that follows a space or colon inside the quotes, else a spread word that
3003
+ * opens them. A newline closes the quotes but may itself be that space.
3004
+ * @param {string} src
3005
+ * @returns {{ index: number, value: string }[]}
3006
+ */
3007
+ function spreadJustifyHits(src) {
3008
+ const hits = [];
3009
+ justifyValueStart.lastIndex = 0;
3010
+ let start;
3011
+ while ((start = justifyValueStart.exec(src))) {
3012
+ const open = start.index + start[0].length;
3013
+ let close = open;
3014
+ while (close < src.length && !"\"'\n".includes(src[close])) close++;
3015
+ const window = src.slice(open, close + longestSpread + 2);
3016
+ const after = spreadAfterBreak.exec(window);
3017
+ let value;
3018
+ let end;
3019
+ if (after && after.index <= close - open) {
3020
+ value = after[1];
3021
+ end = open + after.index + after[0].length;
3022
+ } else {
3023
+ const first = spreadAtStart.exec(window);
3024
+ if (first) {
3025
+ value = first[1];
3026
+ end = open + first[0].length;
3027
+ }
3028
+ }
3029
+ if (value) {
3030
+ hits.push({ index: start.index, value });
3031
+ justifyValueStart.lastIndex = end;
3032
+ } else justifyValueStart.lastIndex = start.index + 1;
3033
+ }
3034
+ return hits;
3035
+ }
2929
3036
 
2930
3037
  /**
2931
3038
  * LC-102 HUG-CONTENT: rows and columns hug their content; a spread
@@ -2949,13 +3056,13 @@ function checkHugContent() {
2949
3056
  )
2950
3057
  continue;
2951
3058
  const live = nonCommentOffsets(src);
2952
- const hits = [...src.matchAll(SPREAD_JUSTIFY_RE)].filter((m) => live[m.index ?? 0] === 1);
3059
+ const hits = spreadJustifyHits(src).filter((m) => live[m.index] === 1);
2953
3060
  const allowed = baselines.hugContent[path] ?? 0;
2954
3061
  if (allowed > 0) seen.add(path);
2955
3062
  if (hits.length > allowed) {
2956
3063
  const first = hits[allowed] ?? hits[0];
2957
3064
  violations.push(
2958
- `${path}:${lineAt(src, first.index ?? 0)} — justifyContent="${first[1]}" (${hits.length} in file, baseline ${allowed}); hug the content with a gap instead`,
3065
+ `${path}:${lineAt(src, first.index)} — justifyContent="${first.value}" (${hits.length} in file, baseline ${allowed}); hug the content with a gap instead`,
2959
3066
  );
2960
3067
  } else if (hits.length < allowed) {
2961
3068
  violations.push(
@@ -3226,7 +3333,7 @@ const PSEUDO_PROP_TOOLING_RE = /(?:^|\/)public\/config\//;
3226
3333
  * `styled(` to its matching paren and reports only keys at brace depth 1,
3227
3334
  * which is the options object itself.
3228
3335
  */
3229
- const DOTTED_TOKEN_RE = /(?:^|[\s{,(])([a-zA-Z][\w]*)\s*[:=]\s*\{?\s*["']\$(\d+\.\d+)["']/g;
3336
+ const DOTTED_TOKEN_RE = /(?:^|[\s{,(])([a-zA-Z]\w*)\s*[:=]\s*(?:\{\s*)?["']\$(\d+\.\d+)["']/g;
3230
3337
 
3231
3338
  /**
3232
3339
  * Props a size or space token is meaningful on, so a `price: "$2.50"` in a
@@ -3298,46 +3405,86 @@ function findStyledNameOptions(src) {
3298
3405
  const sites = [];
3299
3406
  let control = 0;
3300
3407
  for (const call of src.matchAll(/\bstyled\(/g)) {
3301
- let depth = 0;
3302
- let quote = null;
3303
- let i = call.index + call[0].length - 1;
3304
- let end = -1;
3305
- while (i < src.length) {
3306
- const ch = src[i];
3307
- if (quote) {
3308
- if (ch === "\\") {
3309
- i += 2;
3310
- continue;
3311
- }
3312
- if (ch === quote) quote = null;
3313
- } else if (ch === '"' || ch === "'" || ch === "`") quote = ch;
3314
- else if (ch === "(") depth += 1;
3315
- else if (ch === ")") {
3316
- depth -= 1;
3317
- if (depth === 0) {
3318
- end = i;
3319
- break;
3320
- }
3321
- }
3322
- i += 1;
3323
- }
3408
+ const end = closingParenIndex(src, call.index + call[0].length - 1);
3324
3409
  if (end < 0) continue;
3325
3410
  const start = call.index + call[0].length;
3326
3411
  const body = src.slice(start, end);
3327
- let braces = 0;
3328
- for (const token of body.matchAll(/[{}]|\bname\s*:|\bdisplayName\s*:/g)) {
3329
- const text = token[0];
3330
- if (text === "{") braces += 1;
3331
- else if (text === "}") braces -= 1;
3332
- else if (braces === 1) {
3333
- if (text.startsWith("displayName")) control += 1;
3334
- else sites.push(start + token.index);
3335
- }
3336
- }
3412
+ control += collectStyledNameTokens(body, start, sites);
3337
3413
  }
3338
3414
  return { sites: [...new Set(sites)], control };
3339
3415
  }
3340
3416
 
3417
+ function closingParenIndex(src, from) {
3418
+ let depth = 0;
3419
+ let i = from;
3420
+ while (i < src.length) {
3421
+ const ch = src[i];
3422
+ if (ch === '"' || ch === "'" || ch === "`") i = closingQuoteIndex(src, i);
3423
+ else if (ch === "(") depth += 1;
3424
+ else if (ch === ")") {
3425
+ depth -= 1;
3426
+ if (depth === 0) return i;
3427
+ }
3428
+ i += 1;
3429
+ }
3430
+ return -1;
3431
+ }
3432
+
3433
+ function closingQuoteIndex(src, from) {
3434
+ const quote = src[from];
3435
+ let i = from + 1;
3436
+ while (i < src.length) {
3437
+ if (src[i] === "\\") {
3438
+ i += 2;
3439
+ continue;
3440
+ }
3441
+ if (src[i] === quote) return i;
3442
+ i += 1;
3443
+ }
3444
+ return i;
3445
+ }
3446
+
3447
+ function collectStyledNameTokens(body, start, sites) {
3448
+ let braces = 0;
3449
+ let control = 0;
3450
+ for (const token of body.matchAll(/[{}]|\bname\s*:|\bdisplayName\s*:/g)) {
3451
+ const text = token[0];
3452
+ if (text === "{") braces += 1;
3453
+ else if (text === "}") braces -= 1;
3454
+ else if (braces === 1) {
3455
+ if (text.startsWith("displayName")) control += 1;
3456
+ else sites.push(start + token.index);
3457
+ }
3458
+ }
3459
+ return control;
3460
+ }
3461
+
3462
+ // ── FZ-12014 CLAUSE-BASE: a clause-only opacity string has no rest value ──
3463
+
3464
+ /**
3465
+ * `opacity="enter:0 exit:0"` says when the element is transparent and never
3466
+ * what it is the rest of the time. Tamagui resolves the missing base itself,
3467
+ * and under a sheet's AnimatePresence it resolved to 0.45, so every sheet
3468
+ * scrim composited at 0.45 of its configured alpha: the 222 the Tier 2 shots
3469
+ * caught against a baseline of 192, in both schemes. Measured on
3470
+ * components-sheetframe--default and components-sheetmodal--over-page.
3471
+ *
3472
+ * The object form (`opacity={{ enter: 0, exit: 0 }}`) resolves its base to 1
3473
+ * and is NOT the defect, measured on components-dialogcontent--default, so
3474
+ * this reads string literals only and leaves `overlayEnterExit` alone.
3475
+ */
3476
+ const CLAUSE_ONLY_OPACITY_RE = /\bopacity\s*[:=]\s*\{?\s*"([^"]*)"\s*\}?/g;
3477
+
3478
+ function checkClauseBaseOpacity() {
3479
+ return scanLiterals(CLAUSE_ONLY_OPACITY_RE, (match) => {
3480
+ const value = match[1].trim();
3481
+ if (!value || !value.includes(":")) return undefined;
3482
+ const words = value.split(/\s+/);
3483
+ if (words.some((word) => !flatModifierChain.test(word))) return undefined;
3484
+ return `opacity="${value}" states no base, so Tamagui picks the rest value; write the base first, as opacity="1 ${value}"`;
3485
+ });
3486
+ }
3487
+
3341
3488
  /**
3342
3489
  * FZ-10849 V3-CLAUSE: Tamagui 3 removed every v2 pseudo-style prop and every
3343
3490
  * `$`-prefixed style prop. They are not errors. They typecheck, they render,
@@ -3367,13 +3514,8 @@ function findStyledNameOptions(src) {
3367
3514
  function checkV2PseudoProps() {
3368
3515
  /** @type {string[]} */
3369
3516
  const violations = [];
3370
- const baselinePath = join(ROOT, PSEUDO_PROP_BASELINES);
3371
3517
  /** @type {Record<string, number>} */
3372
- let baseline = {};
3373
- if (existsSync(baselinePath)) {
3374
- const raw = JSON.parse(readFileSync(baselinePath, "utf8"));
3375
- if (raw && typeof raw.sites === "object") baseline = raw.sites;
3376
- }
3518
+ const baseline = readSiteBaseline(join(ROOT, PSEUDO_PROP_BASELINES));
3377
3519
  let registry;
3378
3520
  try {
3379
3521
  registry = readPseudoPropEscapeRegistry(join(ROOT, "docs/theme-propagation-spec.md"));
@@ -3389,98 +3531,19 @@ function checkV2PseudoProps() {
3389
3531
  const counted = {};
3390
3532
 
3391
3533
  const scan = (filePath) => {
3392
- if (!RETIRED_SCANNED_RE.test(filePath) || filePath.endsWith(".d.ts")) return;
3393
- const rel = relative(ROOT, filePath).replaceAll("\\", "/");
3394
- if (PSEUDO_PROP_TOOLING_RE.test(`/${rel}`)) return;
3395
- const src = readFileSync(filePath, "utf8");
3396
- if (!/Style\s*[:=]|\$[a-z]|\$\d+\.\d|\bstyled\(|(?:^|\s)tag=/m.test(src)) return;
3397
- const code = codeOffsets(src);
3534
+ const source = pseudoPropSource(filePath);
3535
+ if (!source) return;
3536
+ const { rel, src } = source;
3398
3537
  const lines = src.split("\n");
3399
- const escapedLines = new Set();
3400
- /** @type {Map<number, string>} */
3401
- const reasonAt = new Map();
3402
- for (const { line, reason } of findPseudoPropEscapes(src)) {
3403
- for (const at of [line, line + 1]) {
3404
- escapedLines.add(at);
3405
- if (!reasonAt.has(at)) reasonAt.set(at, reason);
3406
- }
3407
- }
3408
-
3409
- /** @type {Map<number, string>} */
3410
- const hits = new Map();
3411
- for (const match of src.matchAll(V2_PSEUDO_KEY_RE)) {
3412
- const index = (match.index ?? 0) + match[0].indexOf(match[2]);
3413
- if (code[index] !== 1) continue;
3414
- hits.set(
3415
- index,
3416
- `\`${match[2]}\` emits nothing; write the \`${V2_PSEUDO_PROPS.get(
3417
- match[2],
3418
- )}\` clause on the style's own property`,
3419
- );
3420
- }
3421
- if (STYLES_FROM_TAMAGUI_RE.test(src)) {
3422
- for (const match of src.matchAll(DOLLAR_PROP_RE)) {
3423
- const index = (match.index ?? 0) + match[0].indexOf("$");
3424
- // A quoted key — `{ "$max-sm": {…} }` — is just as inert and is how two
3425
- // live sites hid from the first draft of this check. The `$` then sits
3426
- // inside a string, so the code test reads the character before the
3427
- // opening quote, which is the one in code.
3428
- if (code[match[1] ? index - 2 : index] !== 1) continue;
3429
- if (src[index - 1] === "$" || src[index - 1] === ".") continue;
3430
- const clause = match[2].replace(/^gt([A-Z])/, (_, c) => `gt${c}`);
3431
- hits.set(
3432
- index,
3433
- `\`$${match[2]}\` emits nothing; write the \`${clause}:\` clause on the style's own property`,
3434
- );
3435
- }
3436
- }
3437
-
3438
- for (const match of src.matchAll(DOTTED_TOKEN_RE)) {
3439
- const index = (match.index ?? 0) + match[0].indexOf("$");
3440
- // The `$` is inside the quoted value, so the code test reads the prop
3441
- // name, which is the part in code.
3442
- if (code[(match.index ?? 0) + match[0].indexOf(match[1])] !== 1) continue;
3443
- if (!TOKEN_GEOMETRY_PROPS.has(match[1])) continue;
3444
- hits.set(
3445
- index,
3446
- `\`${match[1]}="$${match[2]}"\` emits nothing; a dotted token reaches the DOM verbatim, so the property is dropped — the v3 scale key is kebab and bare: \`${match[1]}="${match[2].replace(".", "-")}"\``,
3447
- );
3448
- }
3449
- if (STYLES_FROM_TAMAGUI_RE.test(src)) {
3450
- for (const match of src.matchAll(TAG_PROP_RE)) {
3451
- const index = (match.index ?? 0) + match[0].indexOf("tag");
3452
- if (code[index] !== 1) continue;
3453
- hits.set(
3454
- index,
3455
- '`tag` is gone in v3 and renders the base element instead; write `render` — `render="button"`, or `render={<a href={link} />}` when the element carries attributes',
3456
- );
3457
- }
3458
- }
3459
- const styledNames = findStyledNameOptions(src);
3460
- for (const index of styledNames.sites) {
3461
- if (code[index] !== 1) continue;
3462
- hits.set(
3463
- index,
3464
- "`name` is not a `styled()` option in v3; it falls into `...defaultProps`, so it emits no class and, on an input-like base, reaches the DOM as the form field's `name` — rename it to `displayName`, and write `className` by hand where a selector needs the class",
3465
- );
3466
- }
3538
+ const { escapedLines, reasonAt } = pseudoPropEscapeLines(src);
3539
+ const hits = collectPseudoPropHits(src, codeOffsets(src));
3467
3540
 
3468
3541
  let open = 0;
3469
3542
  for (const [index, what] of [...hits].sort((a, b) => a[0] - b[0])) {
3470
3543
  const line = lineAt(src, index);
3471
3544
  if (escapedLines.has(line)) {
3472
- const reason = reasonAt.get(line) ?? "";
3473
- if (!reason) {
3474
- violations.push(`${rel}:${line} — pseudo-prop-escape with no written reason`);
3475
- continue;
3476
- }
3477
- const key = `${rel}\n${reason}`;
3478
- if (!registry.present) continue;
3479
- if (declared.has(key)) {
3480
- declared.set(key, true);
3481
- continue;
3482
- }
3483
- violations.push(`${rel}:${line} — undeclared escape "${reason}"`);
3545
+ const violation = escapedHitViolation(rel, line, reasonAt, registry, declared);
3546
+ if (violation) violations.push(violation);
3484
3547
  continue;
3485
3548
  }
3486
3549
  open += 1;
@@ -3493,14 +3556,7 @@ function checkV2PseudoProps() {
3493
3556
 
3494
3557
  for (const dir of [PUBLIC_DIR, PACKAGES_DIR, APPS_DIR, FEATURES_DIR]) walkFiles(dir, scan);
3495
3558
 
3496
- for (const [rel, allowed] of Object.entries(baseline)) {
3497
- const now = counted[rel] ?? 0;
3498
- if (now < allowed) {
3499
- violations.push(
3500
- `${PSEUDO_PROP_BASELINES}: ${rel} is down to ${now} from ${allowed} — lower the ratchet`,
3501
- );
3502
- }
3503
- }
3559
+ violations.push(...ratchetDownViolations(PSEUDO_PROP_BASELINES, baseline, counted));
3504
3560
  for (const [key, seen] of declared) {
3505
3561
  if (seen) continue;
3506
3562
  const [file, reason] = key.split("\n");
@@ -3509,6 +3565,117 @@ function checkV2PseudoProps() {
3509
3565
  return violations;
3510
3566
  }
3511
3567
 
3568
+ function pseudoPropSource(filePath) {
3569
+ if (!RETIRED_SCANNED_RE.test(filePath) || filePath.endsWith(".d.ts")) return undefined;
3570
+ const rel = relative(ROOT, filePath).replaceAll("\\", "/");
3571
+ if (PSEUDO_PROP_TOOLING_RE.test(`/${rel}`)) return undefined;
3572
+ const src = readFileSync(filePath, "utf8");
3573
+ if (!/Style\s*[:=]|\$[a-z]|\$\d+\.\d|\bstyled\(|(?:^|\s)tag=/m.test(src)) return undefined;
3574
+ return { rel, src };
3575
+ }
3576
+
3577
+ function pseudoPropEscapeLines(src) {
3578
+ const escapedLines = new Set();
3579
+ /** @type {Map<number, string>} */
3580
+ const reasonAt = new Map();
3581
+ for (const { line, reason } of findPseudoPropEscapes(src)) {
3582
+ for (const at of [line, line + 1]) {
3583
+ escapedLines.add(at);
3584
+ if (!reasonAt.has(at)) reasonAt.set(at, reason);
3585
+ }
3586
+ }
3587
+ return { escapedLines, reasonAt };
3588
+ }
3589
+
3590
+ function escapedHitViolation(rel, line, reasonAt, registry, declared) {
3591
+ const reason = reasonAt.get(line) ?? "";
3592
+ if (!reason) return `${rel}:${line} — pseudo-prop-escape with no written reason`;
3593
+ const key = `${rel}\n${reason}`;
3594
+ if (!registry.present) return undefined;
3595
+ if (declared.has(key)) {
3596
+ declared.set(key, true);
3597
+ return undefined;
3598
+ }
3599
+ return `${rel}:${line} — undeclared escape "${reason}"`;
3600
+ }
3601
+
3602
+ function collectPseudoPropHits(src, code) {
3603
+ /** @type {Map<number, string>} */
3604
+ const hits = new Map();
3605
+ addV2PseudoKeyHits(src, code, hits);
3606
+ if (STYLES_FROM_TAMAGUI_RE.test(src)) addDollarPropHits(src, code, hits);
3607
+ addDottedTokenHits(src, code, hits);
3608
+ if (STYLES_FROM_TAMAGUI_RE.test(src)) addTagPropHits(src, code, hits);
3609
+ addStyledNameHits(src, code, hits);
3610
+ return hits;
3611
+ }
3612
+
3613
+ function addV2PseudoKeyHits(src, code, hits) {
3614
+ for (const match of src.matchAll(V2_PSEUDO_KEY_RE)) {
3615
+ const index = (match.index ?? 0) + match[0].indexOf(match[2]);
3616
+ if (code[index] !== 1) continue;
3617
+ hits.set(
3618
+ index,
3619
+ `\`${match[2]}\` emits nothing; write the \`${V2_PSEUDO_PROPS.get(
3620
+ match[2],
3621
+ )}\` clause on the style's own property`,
3622
+ );
3623
+ }
3624
+ }
3625
+
3626
+ function addDollarPropHits(src, code, hits) {
3627
+ for (const match of src.matchAll(DOLLAR_PROP_RE)) {
3628
+ const index = (match.index ?? 0) + match[0].indexOf("$");
3629
+ // A quoted key — `{ "$max-sm": {…} }` — is just as inert and is how two
3630
+ // live sites hid from the first draft of this check. The `$` then sits
3631
+ // inside a string, so the code test reads the character before the
3632
+ // opening quote, which is the one in code.
3633
+ if (code[match[1] ? index - 2 : index] !== 1) continue;
3634
+ if (src[index - 1] === "$" || src[index - 1] === ".") continue;
3635
+ const clause = match[2].replace(/^gt([A-Z])/, (_, c) => `gt${c}`);
3636
+ hits.set(
3637
+ index,
3638
+ `\`$${match[2]}\` emits nothing; write the \`${clause}:\` clause on the style's own property`,
3639
+ );
3640
+ }
3641
+ }
3642
+
3643
+ function addDottedTokenHits(src, code, hits) {
3644
+ for (const match of src.matchAll(DOTTED_TOKEN_RE)) {
3645
+ const index = (match.index ?? 0) + match[0].indexOf("$");
3646
+ // The `$` is inside the quoted value, so the code test reads the prop
3647
+ // name, which is the part in code.
3648
+ if (code[(match.index ?? 0) + match[0].indexOf(match[1])] !== 1) continue;
3649
+ if (!TOKEN_GEOMETRY_PROPS.has(match[1])) continue;
3650
+ hits.set(
3651
+ index,
3652
+ `\`${match[1]}="$${match[2]}"\` emits nothing; a dotted token reaches the DOM verbatim, so the property is dropped — the v3 scale key is kebab and bare: \`${match[1]}="${match[2].replace(".", "-")}"\``,
3653
+ );
3654
+ }
3655
+ }
3656
+
3657
+ function addTagPropHits(src, code, hits) {
3658
+ for (const match of src.matchAll(TAG_PROP_RE)) {
3659
+ const index = (match.index ?? 0) + match[0].indexOf("tag");
3660
+ if (code[index] !== 1) continue;
3661
+ hits.set(
3662
+ index,
3663
+ '`tag` is gone in v3 and renders the base element instead; write `render` — `render="button"`, or `render={<a href={link} />}` when the element carries attributes',
3664
+ );
3665
+ }
3666
+ }
3667
+
3668
+ function addStyledNameHits(src, code, hits) {
3669
+ const styledNames = findStyledNameOptions(src);
3670
+ for (const index of styledNames.sites) {
3671
+ if (code[index] !== 1) continue;
3672
+ hits.set(
3673
+ index,
3674
+ "`name` is not a `styled()` option in v3; it falls into `...defaultProps`, so it emits no class and, on an input-like base, reaches the DOM as the form field's `name` — rename it to `displayName`, and write `className` by hand where a selector needs the class",
3675
+ );
3676
+ }
3677
+ }
3678
+
3512
3679
  /**
3513
3680
  * Run structural convention checks over a consumer tree.
3514
3681
  *
@@ -3549,6 +3716,7 @@ export function runConventionChecks(options = {}) {
3549
3716
  const nativeFocusWithin = checkNativeFocusWithin();
3550
3717
  const oneTabBar = checkOneTabBar();
3551
3718
  const v2PseudoProps = checkV2PseudoProps();
3719
+ const clauseBaseOpacity = checkClauseBaseOpacity();
3552
3720
  let failed = false;
3553
3721
 
3554
3722
  for (const [rule, list] of /** @type {const} */ ([
@@ -3576,6 +3744,10 @@ export function runConventionChecks(options = {}) {
3576
3744
  "Convention (LC-150 TAB-BAR-ANATOMY): one bottom tab bar for every MPO app. A phone app renders TabBar from @multiplatform.one/components with items (an icon component and a label) and nothing else; the bar owns its metrics and the theme its colours. An app-local tab bar, a navigator's own tab bar, or tabBar* styling options fork the look.",
3577
3745
  oneTabBar,
3578
3746
  ],
3747
+ [
3748
+ 'Convention (FZ-12014 CLAUSE-BASE): a clause-only `opacity` string states no rest value. Tamagui resolves the missing base itself — under a sheet\'s AnimatePresence it resolved to 0.45, compositing every sheet scrim at 0.45 of its configured alpha. Write the base first: `opacity="1 enter:0 exit:0"`. The object form resolves its base to 1 and is not affected.',
3749
+ clauseBaseOpacity,
3750
+ ],
3579
3751
  [
3580
3752
  'Convention (FZ-10849 V3-CLAUSE): Tamagui 3 removed the v2 pseudo-style props and every `$`-prefixed style prop. They still typecheck and still render, and they emit NOTHING, so neither tsc nor a passing spec catches one. Write one flat clause per style property instead: `<View bg="background hover:background-hover" p="4 sm:6" />`. Clause names are kebab — `focus-visible:`, never `focusVisible:`, which is inert too. A transform offset carries its unit (`y="0px enter:-25px"`); a bare number resolves as a space token and emits unitless, which drops the transform. A value no clause can express keeps the prop with a `pseudo-prop-escape: <reason>` comment plus a row in docs/theme-propagation-spec.md `## Pseudo-prop escapes`; sites awaiting conversion are counted in docs/pseudo-prop-baselines.json, which only shrinks.',
3581
3753
  v2PseudoProps,
package/oxlint.mjs CHANGED
@@ -74,7 +74,7 @@ export function findHexEscapes(src) {
74
74
  const sites = [];
75
75
  src.split("\n").forEach((text, index) => {
76
76
  if (text.trim().startsWith("*")) return;
77
- const match = text.match(HEX_ESCAPE_COMMENT);
77
+ const match = HEX_ESCAPE_COMMENT.exec(text);
78
78
  if (match) sites.push({ line: index + 1, reason: match[1].trim() });
79
79
  });
80
80
  return sites;
@@ -84,8 +84,29 @@ export function findHexEscapes(src) {
84
84
  * A `pseudo-prop-escape: <reason>` line or block comment (FZ-10849). A JSDoc
85
85
  * `*` line or a backticked mention is prose about the marker, not the marker.
86
86
  */
87
- const PSEUDO_PROP_ESCAPE_COMMENT =
88
- /(?<!`)(?:\/\/|\/\*)\s*pseudo-prop-escape:\s*(.*?)\s*(?:\*\/.*)?$/;
87
+ const PSEUDO_PROP_ESCAPE_HEAD = /(?<!`)(?:\/\/|\/\*)\s*pseudo-prop-escape:/g;
88
+
89
+ /**
90
+ * The reason a `pseudo-prop-escape:` comment on one line writes: the text
91
+ * after the marker up to a closing `*\/`, trimmed. A line break other than
92
+ * `\n` may sit only in the space before or after the reason.
93
+ * @param {string} text
94
+ * @returns {string | undefined}
95
+ */
96
+ function pseudoPropEscapeReason(text) {
97
+ for (const head of text.matchAll(PSEUDO_PROP_ESCAPE_HEAD)) {
98
+ const body = text.slice(head.index + head[0].length).trimStart();
99
+ const lastBreak = Math.max(
100
+ body.lastIndexOf("\r"),
101
+ body.lastIndexOf("\u2028"),
102
+ body.lastIndexOf("\u2029"),
103
+ );
104
+ const close = body.indexOf("*/", lastBreak + 1);
105
+ const reason = (close < 0 ? body : body.slice(0, close)).trimEnd();
106
+ if (!/[\r\u2028\u2029]/.test(reason)) return reason;
107
+ }
108
+ return undefined;
109
+ }
89
110
 
90
111
  /**
91
112
  * Every `pseudo-prop-escape:` comment in a source file, with the reason it
@@ -99,8 +120,8 @@ export function findPseudoPropEscapes(src) {
99
120
  const sites = [];
100
121
  src.split("\n").forEach((text, index) => {
101
122
  if (text.trim().startsWith("*")) return;
102
- const match = text.match(PSEUDO_PROP_ESCAPE_COMMENT);
103
- if (match) sites.push({ line: index + 1, reason: match[1].trim() });
123
+ const reason = pseudoPropEscapeReason(text);
124
+ if (reason !== undefined) sites.push({ line: index + 1, reason });
104
125
  });
105
126
  return sites;
106
127
  }
@@ -481,7 +502,7 @@ export function isPaletteModule(filename) {
481
502
  */
482
503
  export function matchColorLiteral(value) {
483
504
  if (typeof value !== "string") return undefined;
484
- const match = value.match(COLOR_LITERAL);
505
+ const match = COLOR_LITERAL.exec(value);
485
506
  return match?.[0];
486
507
  }
487
508
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/config",
3
- "version": "10.5.2",
3
+ "version": "10.6.1",
4
4
  "description": "Shared build and test configuration presets for multiplatform.one",
5
5
  "keywords": [
6
6
  "config",
@@ -122,7 +122,7 @@
122
122
  "@babel/parser": "^7.29.9",
123
123
  "@babel/plugin-transform-block-scoping": "^7.29.7",
124
124
  "@babel/traverse": "^7.29.10",
125
- "@multiplatform.one/utils": "^10.5.2",
125
+ "@multiplatform.one/utils": "^10.6.1",
126
126
  "@tamagui/vite-plugin": "3.2.3",
127
127
  "@vitejs/plugin-react": "^6.1.2",
128
128
  "dotenv": "^17.4.2",
package/press-lint.mjs CHANGED
@@ -47,7 +47,7 @@ function clauseChains(value) {
47
47
  /** @type {string[][]} */
48
48
  const chains = [];
49
49
  for (const word of value.split(/\s+/)) {
50
- const chain = word.match(/^((?:[@A-Za-z][\w/@-]*:)+)\S/)?.[1];
50
+ const chain = /^((?:[@A-Za-z][\w/@-]*:)+)\S/.exec(word)?.[1];
51
51
  if (chain) chains.push(chain.slice(0, -1).split(":"));
52
52
  }
53
53
  return chains;
package/src/lint.spec.ts CHANGED
@@ -1346,7 +1346,7 @@ describe("LC-24 enter/exit driver (MPO-327)", () => {
1346
1346
  const root = makeTree();
1347
1347
  writeFileSync(
1348
1348
  join(root, "apps", "demo", "App.tsx"),
1349
- 'export const App = () => <View opacity="enter:0" {...transitionProps(knobProps.motion.overlay)} />;\n',
1349
+ 'export const App = () => <View opacity="1 enter:0" {...transitionProps(knobProps.motion.overlay)} />;\n',
1350
1350
  );
1351
1351
  const { code, errors } = run(root);
1352
1352
  expect(errors).not.toMatch(/LC-24/);
@@ -1388,6 +1388,44 @@ describe("LC-24 enter/exit driver (MPO-327)", () => {
1388
1388
  });
1389
1389
  });
1390
1390
 
1391
+ describe("clause-base opacity (FZ-12014 CLAUSE-BASE)", () => {
1392
+ function run(root: string) {
1393
+ const error = vi.spyOn(console, "error").mockImplementation(() => {});
1394
+ const log = vi.spyOn(console, "log").mockImplementation(() => {});
1395
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
1396
+ const code = runConventionChecks({ roots: { root } });
1397
+ const errors = error.mock.calls.map((c) => String(c[0])).join("\n");
1398
+ error.mockRestore();
1399
+ log.mockRestore();
1400
+ warn.mockRestore();
1401
+ return { code, errors };
1402
+ }
1403
+
1404
+ it.each([
1405
+ '<View opacity="enter:0 exit:0" transition="quick" />',
1406
+ '<View opacity="press:0.95" />',
1407
+ '<View opacity="hover:0.85 press:0.7" />',
1408
+ ])("fails an opacity clause string that states no base: %s", (tag) => {
1409
+ const root = makeTree();
1410
+ writeFileSync(join(root, "apps", "demo", "App.tsx"), `export const App = () => ${tag};\n`);
1411
+ const { code, errors } = run(root);
1412
+ expect(code).toBe(1);
1413
+ expect(errors).toMatch(/CLAUSE-BASE/);
1414
+ expect(errors).toMatch(/apps\/demo\/App\.tsx:1 — opacity=/);
1415
+ });
1416
+
1417
+ it.each([
1418
+ '<View opacity="1 enter:0 exit:0" transition="quick" />',
1419
+ '<View opacity="0 hover:1" />',
1420
+ '<View opacity={{ enter: 0, exit: 0 }} transition="quick" />',
1421
+ "<View opacity={dim ? 0.5 : 1} />",
1422
+ ])("passes a stated base, and leaves the object form alone: %s", (tag) => {
1423
+ const root = makeTree();
1424
+ writeFileSync(join(root, "apps", "demo", "App.tsx"), `export const App = () => ${tag};\n`);
1425
+ expect(run(root).errors).not.toMatch(/CLAUSE-BASE/);
1426
+ });
1427
+ });
1428
+
1391
1429
  describe("v2 pseudo style props (FZ-10849 V3-CLAUSE)", () => {
1392
1430
  const spec = "docs/theme-propagation-spec.md";
1393
1431
 
package/src/vite.ts CHANGED
@@ -239,9 +239,11 @@ export function createViteConfig(options: CreateViteConfigOptions = {}): UserCon
239
239
  }
240
240
 
241
241
  const vitePlugins: UserConfig["plugins"] = [];
242
- vitePlugins.push(singletonResolvePlugin(projectRoot) as Plugin);
243
- vitePlugins.push(preferBuiltWorkspaceEntryPlugin());
244
- vitePlugins.push(phosphorTokenColorPlugin());
242
+ vitePlugins.push(
243
+ singletonResolvePlugin(projectRoot) as Plugin,
244
+ preferBuiltWorkspaceEntryPlugin(),
245
+ phosphorTokenColorPlugin(),
246
+ );
245
247
  if (publicConfigFile) {
246
248
  vitePlugins.push(
247
249
  publicConfigPlugin({ file: publicConfigFile, projectRoot, keys: inlinePublicConfigKeys }),
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAI/C,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EACJ,OAAO,GACP;QACE;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAEtB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEN;;OAEG;IACH,IAAI,CAAC,EACD,OAAO,GACP;QACE;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAEjB;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IAEN;;;OAGG;IACH,GAAG,CAAC,EACA,OAAO,GACP;QACE,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3B,GAAG,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACtD,KAAK,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;QAC/B,MAAM,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAA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