@tamagui/static 2.4.0-1783099846627 → 2.4.0-1783110557100

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.
@@ -891,6 +891,13 @@ function createExtractor({
891
891
  return [];
892
892
  }
893
893
  const styleValue = attemptEvalSafe(value);
894
+ if (name[0] === "$" && (name.startsWith("$theme-") || name.startsWith("$group-")) && styleValue && typeof styleValue === "object" && Object.keys(styleValue).some(k => k[0] === "$")) {
895
+ if (shouldPrintDebug) {
896
+ logger.info(` ! nested media-like key inside ${name}, deopt to runtime`);
897
+ }
898
+ inlined.set(name, true);
899
+ return attr;
900
+ }
894
901
  if (!variants[name] && !isValidStyleKey(name, staticConfig)) {
895
902
  let out = null;
896
903
  propMapper(name, styleValue, propMapperStyleState, false, (key, val) => {
@@ -1673,6 +1680,23 @@ function createExtractor({
1673
1680
  resolveValues: "except-theme"
1674
1681
  })
1675
1682
  }, void 0, void 0, void 0, void 0, false, debugPropValue || shouldPrintDebug);
1683
+ if (extractedMediaLikeProps && platform2 !== "native") {
1684
+ for (const k in extractedMediaLikeProps) {
1685
+ const block = extractedMediaLikeProps[k];
1686
+ if (!block || typeof block !== "object") continue;
1687
+ const blockOut = getSplitStyles(block, staticConfig, defaultTheme, "", componentState, {
1688
+ ...styleProps,
1689
+ noClass: true,
1690
+ fallbackProps: completeProps
1691
+ }, void 0, void 0, void 0, void 0, false, debugPropValue || shouldPrintDebug);
1692
+ if (blockOut) {
1693
+ extractedMediaLikeProps[k] = {
1694
+ ...blockOut.style,
1695
+ ...blockOut.pseudos
1696
+ };
1697
+ }
1698
+ }
1699
+ }
1676
1700
  let outProps = {
1677
1701
  ...(includeProps ? out.viewProps : {}),
1678
1702
  ...out.style,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "2.4.0-1783099846627",
3
+ "version": "2.4.0-1783110557100",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",
@@ -50,19 +50,19 @@
50
50
  "@babel/template": "^7.25.0",
51
51
  "@babel/traverse": "^7.25.4",
52
52
  "@babel/types": "^7.25.4",
53
- "@tamagui/cli-color": "2.4.0-1783099846627",
54
- "@tamagui/config-default": "2.4.0-1783099846627",
55
- "@tamagui/core": "2.4.0-1783099846627",
56
- "@tamagui/fake-react-native": "2.4.0-1783099846627",
57
- "@tamagui/generate-themes": "2.4.0-1783099846627",
58
- "@tamagui/helpers": "2.4.0-1783099846627",
59
- "@tamagui/helpers-node": "2.4.0-1783099846627",
60
- "@tamagui/proxy-worm": "2.4.0-1783099846627",
61
- "@tamagui/react-native-web-internals": "2.4.0-1783099846627",
62
- "@tamagui/react-native-web-lite": "2.4.0-1783099846627",
63
- "@tamagui/shorthands": "2.4.0-1783099846627",
64
- "@tamagui/types": "2.4.0-1783099846627",
65
- "@tamagui/web": "2.4.0-1783099846627",
53
+ "@tamagui/cli-color": "2.4.0-1783110557100",
54
+ "@tamagui/config-default": "2.4.0-1783110557100",
55
+ "@tamagui/core": "2.4.0-1783110557100",
56
+ "@tamagui/fake-react-native": "2.4.0-1783110557100",
57
+ "@tamagui/generate-themes": "2.4.0-1783110557100",
58
+ "@tamagui/helpers": "2.4.0-1783110557100",
59
+ "@tamagui/helpers-node": "2.4.0-1783110557100",
60
+ "@tamagui/proxy-worm": "2.4.0-1783110557100",
61
+ "@tamagui/react-native-web-internals": "2.4.0-1783110557100",
62
+ "@tamagui/react-native-web-lite": "2.4.0-1783110557100",
63
+ "@tamagui/shorthands": "2.4.0-1783110557100",
64
+ "@tamagui/types": "2.4.0-1783110557100",
65
+ "@tamagui/web": "2.4.0-1783110557100",
66
66
  "babel-literal-to-ast": "^2.1.0",
67
67
  "browserslist": "^4.28.1",
68
68
  "check-dependency-version-consistency": "^4.1.0",
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "devDependencies": {
81
81
  "@babel/plugin-syntax-typescript": "^7.25.4",
82
- "@tamagui/build": "2.4.0-1783099846627",
82
+ "@tamagui/build": "2.4.0-1783110557100",
83
83
  "@types/babel__core": "^7.20.5",
84
84
  "@types/find-root": "^1.1.2",
85
85
  "@types/node": "^22.1.0",
@@ -1514,6 +1514,22 @@ export function createExtractor(
1514
1514
  // if value can be evaluated, extract it and filter it out
1515
1515
  const styleValue = attemptEvalSafe(value)
1516
1516
 
1517
+ // media-like blocks with nested $-keys (eg $theme-dark={{ $sm: {…} }})
1518
+ // can't resolve to static CSS in one pass — keep them on the runtime path
1519
+ if (
1520
+ name[0] === '$' &&
1521
+ (name.startsWith('$theme-') || name.startsWith('$group-')) &&
1522
+ styleValue &&
1523
+ typeof styleValue === 'object' &&
1524
+ Object.keys(styleValue).some((k) => k[0] === '$')
1525
+ ) {
1526
+ if (shouldPrintDebug) {
1527
+ logger.info(` ! nested media-like key inside ${name}, deopt to runtime`)
1528
+ }
1529
+ inlined.set(name, true)
1530
+ return attr
1531
+ }
1532
+
1517
1533
  // never flatten if a prop isn't a valid static attribute
1518
1534
  // only post prop-mapping
1519
1535
  if (!variants[name] && !isValidStyleKey(name, staticConfig)) {
@@ -2501,6 +2517,42 @@ export function createExtractor(
2501
2517
  debugPropValue || shouldPrintDebug
2502
2518
  )!
2503
2519
 
2520
+ // resolve tokens inside the plucked blocks: they skipped the main
2521
+ // split, so values like "$color5" would flow raw into the emitted
2522
+ // CSS where browsers reject the declaration. run each block through
2523
+ // its own static split so tokens become var(--x) references.
2524
+ // (native never extracts these — it deopts below — so web only.)
2525
+ if (extractedMediaLikeProps && platform !== 'native') {
2526
+ for (const k in extractedMediaLikeProps) {
2527
+ const block = extractedMediaLikeProps[k]
2528
+ if (!block || typeof block !== 'object') continue
2529
+ const blockOut = getSplitStyles(
2530
+ block,
2531
+ staticConfig,
2532
+ defaultTheme,
2533
+ '',
2534
+ componentState,
2535
+ {
2536
+ ...styleProps,
2537
+ noClass: true,
2538
+ fallbackProps: completeProps,
2539
+ },
2540
+ undefined,
2541
+ undefined,
2542
+ undefined,
2543
+ undefined,
2544
+ false,
2545
+ debugPropValue || shouldPrintDebug
2546
+ )
2547
+ if (blockOut) {
2548
+ extractedMediaLikeProps[k] = {
2549
+ ...blockOut.style,
2550
+ ...blockOut.pseudos,
2551
+ }
2552
+ }
2553
+ }
2554
+ }
2555
+
2504
2556
  let outProps = {
2505
2557
  ...(includeProps ? out.viewProps : {}),
2506
2558
  ...out.style,
@@ -1 +1 @@
1
- {"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,iBAAiB,CAAA;AAEhE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAmBjC,OAAO,KAAK,EAGV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAGf,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAoB,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAc1E,OAAO,EAAE,iBAAiB,EAA6B,MAAM,6BAA6B,CAAA;AAwB1F,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAE1D,KAAK,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAuD9C,wBAAgB,eAAe,CAC7B,EAAE,MAAgB,EAAE,QAAgB,EAAE,GAAE,gBAAsC;;;;;yBAsJnD,cAAc;6BAPhB,cAAc;;mBAwBtB,UAAU,SAAS,mBAAmB;;;;;;;eAKpC,UAAU,SAAS,mBAAmB;;;;;;;EAwiF1D"}
1
+ {"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,iBAAiB,CAAA;AAEhE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAmBjC,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