@tamagui/static 2.4.6 → 2.5.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.
@@ -1266,9 +1266,11 @@ function createExtractor({
1266
1266
  const inlineProps = /* @__PURE__ */new Set([
1267
1267
  // adding some always inline props
1268
1268
  ...(restProps.inlineProps || []), ...(staticConfig.inlineProps || [])]);
1269
+ const canFlattenTransition = isTargetingHTML && tamaguiConfig?.animations.outputStyle === "css" && !tamaguiConfig.animationDrivers;
1269
1270
  const deoptProps = /* @__PURE__ */new Set([
1270
- // always de-opt animation these
1271
- "animation", "animateOnly", "animatePresence", "disableOptimization", ...(!isTargetingHTML ? [
1271
+ // css-only transitions lower to ordinary css; every runtime driver
1272
+ // needs the component preserved so it can respond to prop changes.
1273
+ "animation", ...(canFlattenTransition ? [] : ["transition"]), "animateOnly", "animatePresence", "disableOptimization", ...(!isTargetingHTML ? [
1272
1274
  // native has no css pseudo selectors; these are runtime-only on
1273
1275
  // rn (event listeners + style merge in createComponent), and if
1274
1276
  // we let them flatten into the stylesheet they get written
@@ -160,11 +160,13 @@ async function extractToClassNames({
160
160
  cssMap.get(containerSelector).commentTexts.push(comment);
161
161
  }
162
162
  }
163
+ const hasCSSOnlyAnimationDriver = tamaguiConfig.animations.outputStyle === "css" && !tamaguiConfig.animationDrivers;
163
164
  let elementIsAnimated = false;
164
165
  for (const attr of jsxPath.node.openingElement.attributes) {
165
166
  if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name)) continue;
166
167
  const n = attr.name.name;
167
- if (n === "animation" || n === "animateOnly" || n === "animatePresence" || n === "animatedBy" || n === "enterStyle" || n === "exitStyle") {
168
+ if (n === "transition" && hasCSSOnlyAnimationDriver) continue;
169
+ if (n === "animation" || n === "transition" || n === "animateOnly" || n === "animatePresence" || n === "animatedBy" || n === "enterStyle" || n === "exitStyle") {
168
170
  elementIsAnimated = true;
169
171
  break;
170
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "2.4.6",
3
+ "version": "2.5.1",
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.6",
54
- "@tamagui/config-default": "2.4.6",
55
- "@tamagui/core": "2.4.6",
56
- "@tamagui/fake-react-native": "2.4.6",
57
- "@tamagui/generate-themes": "2.4.6",
58
- "@tamagui/helpers": "2.4.6",
59
- "@tamagui/helpers-node": "2.4.6",
60
- "@tamagui/proxy-worm": "2.4.6",
61
- "@tamagui/react-native-web-internals": "2.4.6",
62
- "@tamagui/react-native-web-lite": "2.4.6",
63
- "@tamagui/shorthands": "2.4.6",
64
- "@tamagui/types": "2.4.6",
65
- "@tamagui/web": "2.4.6",
53
+ "@tamagui/cli-color": "2.5.1",
54
+ "@tamagui/config-default": "2.5.1",
55
+ "@tamagui/core": "2.5.1",
56
+ "@tamagui/fake-react-native": "2.5.1",
57
+ "@tamagui/generate-themes": "2.5.1",
58
+ "@tamagui/helpers": "2.5.1",
59
+ "@tamagui/helpers-node": "2.5.1",
60
+ "@tamagui/proxy-worm": "2.5.1",
61
+ "@tamagui/react-native-web-internals": "2.5.1",
62
+ "@tamagui/react-native-web-lite": "2.5.1",
63
+ "@tamagui/shorthands": "2.5.1",
64
+ "@tamagui/types": "2.5.1",
65
+ "@tamagui/web": "2.5.1",
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.6",
82
+ "@tamagui/build": "2.5.1",
83
83
  "@types/babel__core": "^7.20.5",
84
84
  "@types/find-root": "^1.1.2",
85
85
  "@types/node": "^22.1.0",
@@ -96,5 +96,10 @@
96
96
  },
97
97
  "tests": {
98
98
  "parallel": true
99
+ },
100
+ "repository": {
101
+ "type": "git",
102
+ "url": "https://github.com/tamagui/tamagui.git",
103
+ "directory": "code/compiler/static"
99
104
  }
100
105
  }
@@ -1149,9 +1149,16 @@ export function createExtractor(
1149
1149
  ...(staticConfig.inlineProps || []),
1150
1150
  ])
1151
1151
 
1152
+ const canFlattenTransition =
1153
+ isTargetingHTML &&
1154
+ tamaguiConfig?.animations.outputStyle === 'css' &&
1155
+ !tamaguiConfig.animationDrivers
1156
+
1152
1157
  const deoptProps = new Set([
1153
- // always de-opt animation these
1158
+ // css-only transitions lower to ordinary css; every runtime driver
1159
+ // needs the component preserved so it can respond to prop changes.
1154
1160
  'animation',
1161
+ ...(canFlattenTransition ? [] : ['transition']),
1155
1162
  'animateOnly',
1156
1163
  'animatePresence',
1157
1164
  'disableOptimization',
@@ -214,17 +214,20 @@ export async function extractToClassNames({
214
214
  // is isReactNative:false yet still needs JS.
215
215
  //
216
216
  // in practice createExtractor's deoptProps already de-opts every animated
217
- // element upstream (`animation`/`animateOnly`/`animatePresence` always;
218
- // enterStyle/exitStyle on RN drivers), so a flattened element reaching here
219
- // is normally non-animated and this never fires. it keeps the invariant
220
- // local and correct regardless of future deoptProps changes — it only ever
221
- // bails the animated case to runtime, never widens what extracts.
217
+ // element upstream except CSS-only transitions, which lower to ordinary
218
+ // CSS. it keeps the invariant local and correct regardless of future
219
+ // deoptProps changes it only ever bails the animated case to runtime,
220
+ // never widens what extracts.
221
+ const hasCSSOnlyAnimationDriver =
222
+ tamaguiConfig.animations.outputStyle === 'css' && !tamaguiConfig.animationDrivers
222
223
  let elementIsAnimated = false
223
224
  for (const attr of jsxPath.node.openingElement.attributes) {
224
225
  if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name)) continue
225
226
  const n = attr.name.name
227
+ if (n === 'transition' && hasCSSOnlyAnimationDriver) continue
226
228
  if (
227
229
  n === 'animation' ||
230
+ n === 'transition' ||
228
231
  n === 'animateOnly' ||
229
232
  n === 'animatePresence' ||
230
233
  n === 'animatedBy' ||
@@ -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;;;;;;;EA4lF1D"}
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;A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GAAG,SAAS,CAAA;CACtC,CAAA;AAQD,wBAAsB,mBAAmB,CAAC,EACxC,SAAS,EACT,MAAM,EACN,UAAe,EACf,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CA8mB9D"}
1
+ {"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAKjC,OAAO,KAAK,EAAe,cAAc,EAAW,MAAM,UAAU,CAAA;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAYlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAA;IACX,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAA;QACd,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,CAAA;AAQD,wBAAsB,mBAAmB,CAAC,EACxC,SAAS,EACT,MAAM,EACN,UAAe,EACf,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAinB9D"}