@tamagui/web 1.36.5 → 1.37.0

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.
Files changed (146) hide show
  1. package/dist/cjs/constants/accessibilityDirectMap.native.js +3 -0
  2. package/dist/cjs/constants/accessibilityDirectMap.native.js.map +1 -1
  3. package/dist/cjs/createComponent.js +29 -25
  4. package/dist/cjs/createComponent.js.map +1 -1
  5. package/dist/cjs/createTamagui.js +8 -9
  6. package/dist/cjs/createTamagui.js.map +1 -1
  7. package/dist/cjs/helpers/ThemeManager.js +2 -2
  8. package/dist/cjs/helpers/ThemeManager.js.map +1 -1
  9. package/dist/cjs/helpers/createPropMapper.js +7 -6
  10. package/dist/cjs/helpers/createPropMapper.js.map +1 -1
  11. package/dist/cjs/helpers/getSplitStyles.js +169 -223
  12. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  13. package/dist/cjs/helpers/getStylesAtomic.js +1 -1
  14. package/dist/cjs/helpers/getStylesAtomic.js.map +1 -1
  15. package/dist/cjs/helpers/getThemeCSSRules.js +1 -1
  16. package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
  17. package/dist/cjs/helpers/getVariantExtras.js +1 -1
  18. package/dist/cjs/helpers/getVariantExtras.js.map +1 -1
  19. package/dist/cjs/hooks/useMedia.js +3 -2
  20. package/dist/cjs/hooks/useMedia.js.map +1 -1
  21. package/dist/esm/constants/accessibilityDirectMap.native.js +2 -0
  22. package/dist/esm/constants/accessibilityDirectMap.native.js.map +1 -1
  23. package/dist/esm/createComponent.js +29 -25
  24. package/dist/esm/createComponent.js.map +1 -1
  25. package/dist/esm/createTamagui.js +8 -9
  26. package/dist/esm/createTamagui.js.map +1 -1
  27. package/dist/esm/helpers/ThemeManager.js +2 -2
  28. package/dist/esm/helpers/ThemeManager.js.map +1 -1
  29. package/dist/esm/helpers/createPropMapper.js +7 -6
  30. package/dist/esm/helpers/createPropMapper.js.map +1 -1
  31. package/dist/esm/helpers/getSplitStyles.js +169 -224
  32. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  33. package/dist/esm/helpers/getStylesAtomic.js +1 -1
  34. package/dist/esm/helpers/getStylesAtomic.js.map +1 -1
  35. package/dist/esm/helpers/getThemeCSSRules.js +1 -1
  36. package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
  37. package/dist/esm/helpers/getVariantExtras.js +1 -1
  38. package/dist/esm/helpers/getVariantExtras.js.map +1 -1
  39. package/dist/esm/hooks/useMedia.js +3 -2
  40. package/dist/esm/hooks/useMedia.js.map +1 -1
  41. package/package.json +9 -9
  42. package/src/constants/accessibilityDirectMap.native.tsx +3 -0
  43. package/src/createComponent.tsx +36 -25
  44. package/src/createTamagui.ts +16 -9
  45. package/src/helpers/ThemeManager.tsx +2 -2
  46. package/src/helpers/createPropMapper.ts +7 -12
  47. package/src/helpers/getSplitStyles.tsx +248 -272
  48. package/src/helpers/getStylesAtomic.ts +1 -1
  49. package/src/helpers/getThemeCSSRules.ts +4 -1
  50. package/src/helpers/getVariantExtras.tsx +1 -1
  51. package/src/hooks/useMedia.tsx +6 -3
  52. package/src/types.tsx +4 -2
  53. package/types/Tamagui.d.ts.map +1 -0
  54. package/types/config.d.ts.map +1 -0
  55. package/types/constants/accessibilityDirectMap.d.ts.map +1 -0
  56. package/types/constants/accessibilityDirectMap.native.d.ts +1 -0
  57. package/types/constants/accessibilityDirectMap.native.d.ts.map +1 -0
  58. package/types/constants/constants.d.ts.map +1 -0
  59. package/types/constants/isDevTools.d.ts.map +1 -0
  60. package/types/contexts/AnimationDriverContext.d.ts.map +1 -0
  61. package/types/contexts/ButtonNestingContext.d.ts.map +1 -0
  62. package/types/contexts/FontLanguageContext.d.ts.map +1 -0
  63. package/types/contexts/TextAncestorContext.d.ts.map +1 -0
  64. package/types/createComponent.d.ts.map +1 -0
  65. package/types/createFont.d.ts.map +1 -0
  66. package/types/createShorthands.d.ts.map +1 -0
  67. package/types/createTamagui.d.ts.map +1 -0
  68. package/types/createTheme.d.ts.map +1 -0
  69. package/types/createTokens.d.ts.map +1 -0
  70. package/types/createVariable.d.ts.map +1 -0
  71. package/types/createVariables.d.ts.map +1 -0
  72. package/types/helpers/ThemeManager.d.ts.map +1 -0
  73. package/types/helpers/ThemeManagerContext.d.ts.map +1 -0
  74. package/types/helpers/createChainedWeakCache.d.ts.map +1 -0
  75. package/types/helpers/createMediaStyle.d.ts.map +1 -0
  76. package/types/helpers/createPropMapper.d.ts.map +1 -0
  77. package/types/helpers/createProxy.d.ts.map +1 -0
  78. package/types/helpers/createStyledContext.d.ts.map +1 -0
  79. package/types/helpers/defaultOffset.d.ts.map +1 -0
  80. package/types/helpers/expandStyle.d.ts.map +1 -0
  81. package/types/helpers/expandStyles.d.ts.map +1 -0
  82. package/types/helpers/extendStaticConfig.d.ts.map +1 -0
  83. package/types/helpers/getAnimationDriver.d.ts.map +1 -0
  84. package/types/helpers/getExpandedShorthands.d.ts.map +1 -0
  85. package/types/helpers/getFontLanguage.d.ts.map +1 -0
  86. package/types/helpers/getSplitStyles.d.ts +1 -1
  87. package/types/helpers/getSplitStyles.d.ts.map +1 -0
  88. package/types/helpers/getStylesAtomic.d.ts.map +1 -0
  89. package/types/helpers/getStylesAtomic.native.d.ts.map +1 -0
  90. package/types/helpers/getThemeCSSRules.d.ts.map +1 -0
  91. package/types/helpers/getThemeCSSRules.native.d.ts.map +1 -0
  92. package/types/helpers/getVariantExtras.d.ts.map +1 -0
  93. package/types/helpers/insertStyleRule.d.ts.map +1 -0
  94. package/types/helpers/isObj.d.ts.map +1 -0
  95. package/types/helpers/isTamaguiComponent.d.ts.map +1 -0
  96. package/types/helpers/isTamaguiElement.d.ts.map +1 -0
  97. package/types/helpers/matchMedia.d.ts.map +1 -0
  98. package/types/helpers/matchMedia.native.d.ts.map +1 -0
  99. package/types/helpers/mergeProps.d.ts.map +1 -0
  100. package/types/helpers/normalizeColor.d.ts.map +1 -0
  101. package/types/helpers/normalizeShadow.d.ts.map +1 -0
  102. package/types/helpers/normalizeShadow.native.d.ts.map +1 -0
  103. package/types/helpers/normalizeStylePropKeys.d.ts.map +1 -0
  104. package/types/helpers/normalizeStylePropKeys.native.d.ts.map +1 -0
  105. package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
  106. package/types/helpers/objectIdentityKey.d.ts.map +1 -0
  107. package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
  108. package/types/helpers/pseudoDescriptors.d.ts.map +1 -0
  109. package/types/helpers/registerCSSVariable.d.ts.map +1 -0
  110. package/types/helpers/themeable.d.ts.map +1 -0
  111. package/types/helpers/themes.d.ts.map +1 -0
  112. package/types/helpers/timer.d.ts.map +1 -0
  113. package/types/helpers/useShallowSetState.d.ts.map +1 -0
  114. package/types/helpers/withStaticProperties.d.ts.map +1 -0
  115. package/types/hooks/getThemeUnwrapped.d.ts.map +1 -0
  116. package/types/hooks/useAnimationDriver.d.ts.map +1 -0
  117. package/types/hooks/useId.d.ts.map +1 -0
  118. package/types/hooks/useIsTouchDevice.d.ts.map +1 -0
  119. package/types/hooks/useMedia.d.ts.map +1 -0
  120. package/types/hooks/useProps.d.ts.map +1 -0
  121. package/types/hooks/useSafeRef.d.ts.map +1 -0
  122. package/types/hooks/useServerHooks.d.ts.map +1 -0
  123. package/types/hooks/useStyle.d.ts.map +1 -0
  124. package/types/hooks/useTheme.d.ts.map +1 -0
  125. package/types/hooks/useThemeName.d.ts.map +1 -0
  126. package/types/index.d.ts.map +1 -0
  127. package/types/inject-styles.d.ts.map +1 -0
  128. package/types/insertFont.d.ts.map +1 -0
  129. package/types/setupHooks.d.ts.map +1 -0
  130. package/types/setupReactNative.d.ts.map +1 -0
  131. package/types/styled.d.ts.map +1 -0
  132. package/types/types.d.ts +4 -3
  133. package/types/types.d.ts.map +1 -0
  134. package/types/views/AnimationDriverProvider.d.ts.map +1 -0
  135. package/types/views/FontLanguage.d.ts.map +1 -0
  136. package/types/views/FontLanguage.native.d.ts.map +1 -0
  137. package/types/views/FontLanguage.types.d.ts.map +1 -0
  138. package/types/views/Slot.d.ts.map +1 -0
  139. package/types/views/Stack.d.ts.map +1 -0
  140. package/types/views/TamaguiProvider.d.ts.map +1 -0
  141. package/types/views/Text.d.ts.map +1 -0
  142. package/types/views/Theme.d.ts.map +1 -0
  143. package/types/views/ThemeDebug.d.ts.map +1 -0
  144. package/types/views/ThemeDebug.native.d.ts.map +1 -0
  145. package/types/views/ThemeProvider.d.ts.map +1 -0
  146. package/types/views/View.d.ts.map +1 -0
@@ -40,24 +40,24 @@ var import_normalizeValueWithProperty = require("./normalizeValueWithProperty");
40
40
  var import_pseudoDescriptors = require("./pseudoDescriptors");
41
41
  let conf;
42
42
  const PROP_SPLIT = "-";
43
+ let defaultFontVariable = "";
43
44
  const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, languageContext, elementType, debug) => {
44
- var _a, _b, _c;
45
+ var _a, _b, _c, _d, _e, _f, _g;
45
46
  conf = conf || (0, import_config.getConfig)();
46
47
  const { shorthands } = conf;
47
48
  const { variants, propMapper, isReactNative, inlineProps, inlineWhenUnflattened } = staticConfig;
48
49
  const validStyleProps = staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles;
49
50
  const viewProps = {};
50
51
  let pseudos = null;
51
- let psuedosUsed = null;
52
52
  const mediaState = state.mediaState || import_useMedia.mediaState;
53
53
  const usedKeys = {};
54
54
  const propKeys = Object.keys(props);
55
+ const numProps = propKeys.length;
55
56
  let space = props.space;
56
57
  let hasMedia = false;
57
58
  const shouldDoClasses = staticConfig.acceptsClassName && (import_constants.isWeb || IS_STATIC) && !state.noClassNames;
58
59
  let style = {};
59
60
  const flatTransforms = {};
60
- const len = propKeys.length;
61
61
  const rulesToInsert = [];
62
62
  const classNames = {};
63
63
  let className = "";
@@ -75,12 +75,12 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
75
75
  viewProps,
76
76
  languageContext
77
77
  };
78
- if (process.env.NODE_ENV === "development" && debug) {
79
- console.groupCollapsed("getSplitStyles (looping backwards)");
78
+ if (process.env.NODE_ENV === "development" && debug && import_constants.isClient) {
79
+ console.groupCollapsed("getSplitStyles (collapsed)");
80
80
  console.log({ props, staticConfig, shouldDoClasses, state, IS_STATIC, propKeys, styleState, theme: { ...theme } });
81
81
  console.groupEnd();
82
82
  }
83
- if (props.className) {
83
+ if (typeof props.className === "string") {
84
84
  for (const cn of props.className.split(" ")) {
85
85
  if (cn[0] === "_") {
86
86
  const [shorthand, mediaOrPseudo] = cn.slice(1).split("-");
@@ -103,46 +103,58 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
103
103
  }
104
104
  }
105
105
  }
106
- function passDownProp(key, val, shouldMergeObject = key in import_pseudoDescriptors.pseudoDescriptors) {
107
- if (shouldMergeObject) {
108
- viewProps[key] || (viewProps[key] = {});
109
- viewProps[key] = {
110
- ...val,
111
- ...viewProps[key]
112
- };
113
- } else {
114
- usedKeys[key] = 1;
115
- viewProps[key] = val;
116
- }
117
- }
118
- const specialProps = [];
119
- function processProp(keyInit, valInit, special = false, fontFamilyOverride = null) {
120
- var _a2, _b2, _c2, _d;
121
- if (keyInit === "className")
122
- return;
106
+ for (let i = 0; i < numProps; i++) {
107
+ let keyInit = propKeys[i];
108
+ let valInit = props[keyInit];
123
109
  if (keyInit in shorthands) {
124
110
  keyInit = shorthands[keyInit];
125
111
  }
126
- if (keyInit === "accessibilityRole") {
127
- usedKeys["role"] = 1;
112
+ if (keyInit === "className")
113
+ continue;
114
+ if (keyInit in usedKeys)
115
+ continue;
116
+ if (keyInit in skipProps)
117
+ continue;
118
+ if (process.env.TAMAGUI_TARGET === "web") {
119
+ if (typeof valInit === "string" && valInit[0] === "_") {
120
+ if (keyInit in validStyleProps || keyInit.includes("-")) {
121
+ if (process.env.NODE_ENV === "development" && debug) {
122
+ console.log(`Adding compiled style ${keyInit}: ${valInit}`);
123
+ }
124
+ if (shouldDoClasses) {
125
+ classNames[keyInit] = valInit;
126
+ delete style[keyInit];
127
+ } else {
128
+ style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit);
129
+ delete className[keyInit];
130
+ }
131
+ continue;
132
+ }
133
+ }
128
134
  }
129
135
  if (process.env.TAMAGUI_TARGET === "native") {
130
136
  if (!import_constants.isAndroid) {
131
137
  if (keyInit === "elevationAndroid")
132
- return;
138
+ continue;
133
139
  }
134
140
  if (keyInit === "userSelect") {
135
141
  keyInit = "selectable";
136
142
  valInit = valInit === "none" ? false : true;
137
- } else if (keyInit.startsWith("aria-") || keyInit === "role") {
143
+ } else if (keyInit === "role") {
144
+ if (valInit === "list") {
145
+ viewProps[keyInit] = valInit;
146
+ } else if (import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit]) {
147
+ viewProps["accessibilityRole"] = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
148
+ }
149
+ continue;
150
+ } else if (keyInit.startsWith("aria-")) {
138
151
  if (import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit]) {
139
152
  const nativeA11yProp = import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit];
140
153
  if (keyInit === "aria-hidden") {
141
154
  viewProps["aria-hidden"] = valInit;
142
155
  }
143
156
  viewProps[nativeA11yProp] = valInit;
144
- usedKeys[keyInit] = 1;
145
- return;
157
+ continue;
146
158
  } else if (import_accessibilityDirectMap.nativeAccessibilityValue[keyInit]) {
147
159
  let field = import_accessibilityDirectMap.nativeAccessibilityValue[keyInit];
148
160
  if (viewProps["accessibilityValue"]) {
@@ -152,7 +164,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
152
164
  [field]: valInit
153
165
  };
154
166
  }
155
- usedKeys[keyInit] = 1;
156
167
  } else if (import_accessibilityDirectMap.nativeAccessibilityState[keyInit]) {
157
168
  let field = import_accessibilityDirectMap.nativeAccessibilityState[keyInit];
158
169
  if (viewProps["accessibilityState"]) {
@@ -162,56 +173,30 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
162
173
  [field]: valInit
163
174
  };
164
175
  }
165
- usedKeys[keyInit] = 1;
166
- } else if (keyInit === "role") {
167
- if (valInit === "list") {
168
- viewProps[keyInit] = valInit;
169
- } else if (import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit]) {
170
- viewProps["accessibilityRole"] = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
171
- }
172
- return;
173
176
  }
174
- return;
177
+ continue;
175
178
  } else if (keyInit.startsWith("data-")) {
176
- return;
179
+ continue;
177
180
  }
178
181
  }
179
- if (process.env.TAMAGUI_TARGET === "web") {
180
- if (keyInit === "elevationAndroid")
181
- return;
182
- }
183
182
  if (!staticConfig.isHOC) {
184
183
  if (keyInit in skipProps) {
185
184
  if (process.env.NODE_ENV === "development" && debug && keyInit === "debug") {
186
185
  } else {
187
- return;
188
- }
189
- }
190
- }
191
- if (keyInit in usedKeys) {
192
- return;
193
- }
194
- if (typeof valInit === "string" && valInit[0] === "_") {
195
- if (keyInit in validStyleProps || keyInit.includes("-")) {
196
- if (shouldDoClasses) {
197
- classNames[keyInit] = valInit;
198
- } else {
199
- style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit);
186
+ continue;
200
187
  }
201
- usedKeys[keyInit] = 1;
202
- return;
203
188
  }
204
189
  }
205
190
  if (keyInit === "dataSet") {
206
- for (const key in valInit) {
207
- viewProps[`data-${hyphenate(key)}`] = valInit[key];
191
+ for (const keyInit2 in valInit) {
192
+ viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
208
193
  }
209
- return;
194
+ continue;
210
195
  }
211
196
  const isMainStyle = keyInit === "style";
212
197
  if (isMainStyle || keyInit.startsWith("_style")) {
213
198
  if (!valInit)
214
- return;
199
+ continue;
215
200
  const styles = [].concat(valInit).flat();
216
201
  const styleLen = styles.length;
217
202
  for (let j = styleLen; j >= 0; j--) {
@@ -226,44 +211,41 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
226
211
  style[key] = cur[key];
227
212
  }
228
213
  }
229
- return;
214
+ continue;
230
215
  }
231
216
  if (process.env.TAMAGUI_TARGET === "web") {
232
217
  if (keyInit === "disabled" && valInit === true) {
233
- usedKeys[keyInit] = 1;
234
218
  viewProps["aria-disabled"] = true;
235
219
  if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
236
220
  viewProps.disabled = true;
237
221
  }
238
222
  if (!(variants == null ? void 0 : variants.disabled)) {
239
- return;
223
+ continue;
240
224
  }
241
225
  }
242
226
  if (keyInit === "testID") {
243
- usedKeys[keyInit] = 1;
244
227
  viewProps[isReactNative ? "testId" : "data-testid"] = valInit;
245
- return;
228
+ continue;
246
229
  }
247
230
  if (keyInit === "id" || keyInit === "nativeID") {
248
- usedKeys[keyInit] = 1;
249
231
  if (isReactNative) {
250
232
  viewProps.nativeID = valInit;
251
233
  } else {
252
234
  viewProps.id = valInit;
253
235
  }
254
- return;
236
+ continue;
255
237
  }
256
238
  let didUseKeyInit = false;
257
239
  if (isReactNative) {
258
- if (import_accessibilityDirectMap.accessibilityDirectMap[keyInit] || keyInit.startsWith("accessibility")) {
240
+ if (keyInit in import_accessibilityDirectMap.accessibilityDirectMap || keyInit.startsWith("accessibility")) {
259
241
  viewProps[keyInit] = valInit;
260
- usedKeys[keyInit] = 1;
261
- return;
242
+ continue;
262
243
  }
263
244
  } else {
264
245
  didUseKeyInit = true;
265
246
  if (keyInit in import_accessibilityDirectMap.accessibilityDirectMap) {
266
247
  viewProps[import_accessibilityDirectMap.accessibilityDirectMap[keyInit]] = valInit;
248
+ continue;
267
249
  } else {
268
250
  switch (keyInit) {
269
251
  case "accessibilityRole": {
@@ -272,38 +254,38 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
272
254
  } else {
273
255
  viewProps.role = accessibilityRoleToWebRole[valInit] || valInit;
274
256
  }
275
- return;
257
+ continue;
276
258
  }
277
259
  case "accessibilityLabelledBy":
278
260
  case "accessibilityFlowTo":
279
261
  case "accessibilityControls":
280
262
  case "accessibilityDescribedBy": {
281
263
  viewProps[`aria-${keyInit.replace("accessibility", "").toLowerCase()}`] = processIDRefList(valInit);
282
- return;
264
+ continue;
283
265
  }
284
266
  case "accessibilityKeyShortcuts": {
285
267
  if (Array.isArray(valInit)) {
286
268
  viewProps["aria-keyshortcuts"] = valInit.join(" ");
287
269
  }
288
- return;
270
+ continue;
289
271
  }
290
272
  case "accessibilityLiveRegion": {
291
273
  viewProps["aria-live"] = valInit === "none" ? "off" : valInit;
292
- return;
274
+ continue;
293
275
  }
294
276
  case "accessibilityReadOnly": {
295
277
  viewProps["aria-readonly"] = valInit;
296
278
  if (elementType === "input" || elementType === "select" || elementType === "textarea") {
297
279
  viewProps.readOnly = true;
298
280
  }
299
- return;
281
+ continue;
300
282
  }
301
283
  case "accessibilityRequired": {
302
284
  viewProps["aria-required"] = valInit;
303
285
  if (elementType === "input" || elementType === "select" || elementType === "textarea") {
304
286
  viewProps.required = valInit;
305
287
  }
306
- return;
288
+ continue;
307
289
  }
308
290
  default: {
309
291
  didUseKeyInit = false;
@@ -312,71 +294,53 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
312
294
  }
313
295
  }
314
296
  if (didUseKeyInit) {
315
- usedKeys[keyInit] = 1;
316
- return;
297
+ continue;
317
298
  }
318
299
  if (valInit && valInit[0] === "_") {
319
300
  const isValidClassName = keyInit in import_helpers.validStyles;
320
301
  const isMediaOrPseudo2 = !isValidClassName && keyInit.includes(PROP_SPLIT) && import_helpers.validStyles[keyInit.split(PROP_SPLIT)[0]];
321
302
  if (isValidClassName || isMediaOrPseudo2) {
322
- usedKeys[keyInit] = 1;
323
303
  if (process.env.NODE_ENV === "development" && debug) {
324
304
  console.log("tamagui classname props", keyInit, valInit);
325
305
  }
326
306
  mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo2);
327
- return;
307
+ continue;
328
308
  }
329
309
  }
330
310
  }
331
311
  let isMedia = (0, import_useMedia.isMediaKey)(keyInit);
332
312
  let isPseudo = keyInit in import_helpers.validPseudoKeys;
333
313
  let isMediaOrPseudo = isMedia || isPseudo;
334
- const isVariant = variants && keyInit in variants;
314
+ let isVariant = variants && keyInit in variants;
335
315
  const isStyleProp = isMediaOrPseudo || isVariant || keyInit in validStyleProps || keyInit in shorthands;
336
316
  if (isStyleProp && props.asChild === "except-style") {
337
- return;
317
+ continue;
338
318
  }
339
- const shouldPassProp = !isStyleProp;
340
- const isHOCShouldPassThrough = staticConfig.isHOC && (isMediaOrPseudo || ((_b2 = (_a2 = staticConfig.parentStaticConfig) == null ? void 0 : _a2.variants) == null ? void 0 : _b2[keyInit]));
319
+ const shouldPassProp = !isStyleProp && !(keyInit in handledProps);
320
+ const isHOCShouldPassThrough = Boolean(
321
+ staticConfig.isHOC && (isMediaOrPseudo || ((_b = (_a = staticConfig.parentStaticConfig) == null ? void 0 : _a.variants) == null ? void 0 : _b[keyInit]))
322
+ );
341
323
  const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
342
324
  if (shouldPassThrough) {
343
325
  if (process.env.NODE_ENV === "development" && debug === "verbose") {
344
326
  console.groupCollapsed(` \u{1F539} pass through ${keyInit}`);
345
- console.log({
346
- valInit,
347
- variants,
348
- variant: variants == null ? void 0 : variants[keyInit],
349
- isVariant,
350
- shouldPassProp,
351
- isHOCShouldPassThrough
352
- });
327
+ console.log({ valInit, variants, variant: variants == null ? void 0 : variants[keyInit], isVariant, shouldPassProp, isHOCShouldPassThrough });
353
328
  console.groupEnd();
354
329
  }
355
- if (isPseudo) {
356
- const pseudoStyleObject = getSubStyle(
357
- styleState,
358
- keyInit,
359
- valInit,
360
- true,
361
- state.noClassNames
362
- );
363
- const descriptor = import_pseudoDescriptors.pseudoDescriptors[keyInit];
364
- for (const key in pseudoStyleObject) {
365
- const fullKey = `${key}${PROP_SPLIT}${descriptor.name}`;
366
- usedKeys[fullKey] = 1;
367
- }
368
- }
369
- passDownProp(keyInit, valInit, isMediaOrPseudo);
330
+ passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo);
370
331
  if (!isVariant) {
371
- return;
332
+ continue;
372
333
  }
373
334
  }
335
+ defaultFontVariable || (defaultFontVariable = `$${conf.defaultFont}`);
336
+ fontFamily || (fontFamily = props[conf.inverseShorthands.fontFamily] || props.fontFamily || defaultFontVariable);
374
337
  const expanded = isMediaOrPseudo ? [[keyInit, valInit]] : propMapper(
375
338
  keyInit,
376
339
  valInit,
377
340
  theme,
378
- special ? { ...props, fontFamily: fontFamilyOverride } : props,
341
+ props,
379
342
  state,
343
+ fontFamily,
380
344
  languageContext,
381
345
  void 0,
382
346
  debug
@@ -384,17 +348,9 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
384
348
  if (!fontFamily) {
385
349
  fontFamily = (0, import_createPropMapper.getPropMappedFontFamily)(expanded);
386
350
  }
387
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
351
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && import_constants.isClient) {
388
352
  console.groupCollapsed(" \u{1F539} styles", keyInit, valInit);
389
- console.log({
390
- expanded,
391
- state,
392
- isVariant,
393
- variant: variants == null ? void 0 : variants[keyInit],
394
- shouldPassProp,
395
- isHOCShouldPassThrough,
396
- theme
397
- });
353
+ console.log({ expanded, state: { ...state }, isVariant, variant: variants == null ? void 0 : variants[keyInit], shouldPassProp, isHOCShouldPassThrough, theme, usedKeys: { ...usedKeys } });
398
354
  if (!import_constants.isServer && import_isDevTools.isDevTools) {
399
355
  console.log("expanded", expanded, "\nusedKeys", { ...usedKeys }, "\ncurrent", {
400
356
  ...style
@@ -403,30 +359,27 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
403
359
  console.groupEnd();
404
360
  }
405
361
  if (!expanded)
406
- return;
362
+ continue;
407
363
  for (const [key, val] of expanded) {
408
- if (val === void 0)
364
+ if (val == null)
409
365
  continue;
410
- if (key in import_helpers.stylePropsFont && !special && key !== "fontFamily") {
411
- specialProps.push([key, val]);
366
+ if (key in usedKeys)
412
367
  continue;
413
- }
414
368
  isMedia = (0, import_useMedia.isMediaKey)(key);
415
369
  isPseudo = key in import_helpers.validPseudoKeys;
416
370
  isMediaOrPseudo = isMedia || isPseudo;
417
- if (!isMediaOrPseudo && key in usedKeys) {
418
- if (process.env.NODE_ENV === "developmnet" && debug === "verbose") {
419
- console.log(`Used media/pseudo ${key}`);
420
- }
421
- continue;
422
- }
423
371
  if ((inlineProps == null ? void 0 : inlineProps.has(key)) || (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key))) {
424
- usedKeys[key] = 1;
425
372
  viewProps[key] = props[key] ?? val;
426
373
  }
427
- const isHOCShouldPassThrough2 = staticConfig.isHOC && (isMediaOrPseudo || ((_d = (_c2 = staticConfig.parentStaticConfig) == null ? void 0 : _c2.variants) == null ? void 0 : _d[keyInit]));
374
+ const isHOCShouldPassThrough2 = staticConfig.isHOC && (isMediaOrPseudo || ((_d = (_c = staticConfig.parentStaticConfig) == null ? void 0 : _c.variants) == null ? void 0 : _d[keyInit]));
428
375
  if (isHOCShouldPassThrough2) {
429
- passDownProp(key, val);
376
+ isVariant = variants && key in variants;
377
+ passDownProp(viewProps, key, val, isMediaOrPseudo);
378
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
379
+ console.groupCollapsed(` - passing down prop ${key}`);
380
+ console.log({ val, after: { ...viewProps[key] } });
381
+ console.groupEnd();
382
+ }
430
383
  if (!isVariant) {
431
384
  continue;
432
385
  }
@@ -438,6 +391,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
438
391
  styleState,
439
392
  key,
440
393
  val,
394
+ fontFamily,
441
395
  true,
442
396
  state.noClassNames
443
397
  );
@@ -445,68 +399,67 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
445
399
  const isEnter = descriptor.name === "enter";
446
400
  const isExit = descriptor.name === "exit";
447
401
  if (!descriptor || isExit && !state.isExiting) {
402
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
403
+ console.log("skip exit");
404
+ }
448
405
  continue;
449
406
  }
450
407
  if (!shouldDoClasses || IS_STATIC) {
451
408
  pseudos || (pseudos = {});
452
409
  pseudos[key] || (pseudos[key] = {});
453
- Object.assign(pseudos[key], pseudoStyleObject);
454
410
  }
455
411
  if (shouldDoClasses && !isEnter && !isExit) {
456
412
  const pseudoStyles = (0, import_getStylesAtomic.generateAtomicStyles)(pseudoStyleObject, descriptor);
457
413
  for (const psuedoStyle of pseudoStyles) {
458
414
  const fullKey = `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}`;
459
- if (!(fullKey in usedKeys)) {
460
- usedKeys[fullKey] = 1;
461
- addStyleToInsertRules(rulesToInsert, psuedoStyle);
462
- mergeClassName(
463
- transforms,
464
- classNames,
465
- fullKey,
466
- psuedoStyle.identifier,
467
- isMediaOrPseudo
468
- );
469
- }
415
+ addStyleToInsertRules(rulesToInsert, psuedoStyle);
416
+ mergeClassName(
417
+ transforms,
418
+ classNames,
419
+ fullKey,
420
+ psuedoStyle.identifier,
421
+ isMediaOrPseudo
422
+ );
470
423
  }
471
424
  } else {
472
- if (key in usedKeys) {
473
- continue;
474
- }
475
- let isDisabled = !state[descriptor.stateKey || descriptor.name];
425
+ const descriptorKey = descriptor.stateKey || descriptor.name;
426
+ const pseudoState = state[descriptorKey];
427
+ let isDisabled = !pseudoState;
476
428
  if (import_constants.isWeb && !import_constants.isClient && isEnter) {
477
429
  isDisabled = false;
478
430
  }
431
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
432
+ console.groupCollapsed("pseudo", keyInit, !isDisabled);
433
+ console.log(pseudoStyleObject, { isDisabled, descriptorKey, descriptor, pseudoState, state: { ...state } });
434
+ console.groupEnd();
435
+ }
436
+ const importance = descriptor.priority;
479
437
  if (!isDisabled) {
480
- if (valInit === staticConfig.defaultProps[keyInit]) {
481
- } else {
482
- usedKeys[key] || (usedKeys[key] = 1);
483
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
484
- console.log(`Setting used ${key}`);
485
- }
438
+ for (const key2 in val) {
439
+ const k = shorthands[key2] || key2;
440
+ usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
486
441
  }
487
442
  }
488
- psuedosUsed || (psuedosUsed = {});
489
- const importance = descriptor.priority;
490
443
  for (const pkey in pseudoStyleObject) {
491
444
  const val2 = pseudoStyleObject[pkey];
492
445
  if (isDisabled) {
493
- if (!(pkey in usedKeys) && pkey in animatableDefaults) {
446
+ if (pkey in animatableDefaults && !(pkey in usedKeys)) {
494
447
  const defaultVal = animatableDefaults[pkey];
495
- mergeStyle(styleState, flatTransforms, pkey, defaultVal, true);
448
+ mergeStyle(styleState, flatTransforms, pkey, defaultVal);
449
+ }
450
+ } else {
451
+ const curImportance = usedKeys[importance] || 0;
452
+ const shouldMerge = importance >= curImportance;
453
+ if (shouldMerge) {
454
+ pseudos || (pseudos = {});
455
+ pseudos[key] || (pseudos[key] = {});
456
+ pseudos[key][pkey] = val2;
457
+ mergeStyle(styleState, flatTransforms, pkey, val2);
458
+ usedKeys[pkey] || (usedKeys[pkey] = 1);
459
+ }
460
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
461
+ console.log(" subKey", pkey, shouldMerge, { importance, curImportance, pkey, val: val2 });
496
462
  }
497
- continue;
498
- }
499
- const curImportance = psuedosUsed[importance] || 0;
500
- const shouldMerge = importance >= curImportance;
501
- if (shouldMerge) {
502
- psuedosUsed[pkey] = importance;
503
- pseudos || (pseudos = {});
504
- pseudos[key] || (pseudos[key] = {});
505
- pseudos[key][pkey] = val2;
506
- mergeStyle(styleState, flatTransforms, pkey, val2);
507
- }
508
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
509
- console.log(" merge pseudo?", keyInit, shouldMerge, { importance, curImportance, pkey, val: val2 });
510
463
  }
511
464
  }
512
465
  }
@@ -520,6 +473,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
520
473
  styleState,
521
474
  key,
522
475
  val,
476
+ fontFamily,
523
477
  // TODO try true like pseudo
524
478
  false
525
479
  );
@@ -558,11 +512,8 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
558
512
  for (const style2 of mediaStyles) {
559
513
  const out = (0, import_createMediaStyle.createMediaStyle)(style2, mediaKeyShort, import_useMedia.mediaQueryConfig);
560
514
  const fullKey = `${style2.property}${PROP_SPLIT}${mediaKeyShort}`;
561
- if (!usedKeys[fullKey]) {
562
- usedKeys[fullKey] = 1;
563
- addStyleToInsertRules(rulesToInsert, out);
564
- mergeClassName(transforms, classNames, fullKey, out.identifier, true);
565
- }
515
+ addStyleToInsertRules(rulesToInsert, out);
516
+ mergeClassName(transforms, classNames, fullKey, out.identifier, true);
566
517
  }
567
518
  } else if (mediaState[mediaKeyShort]) {
568
519
  for (const subKey in mediaStyle) {
@@ -593,7 +544,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
593
544
  }
594
545
  if (process.env.TAMAGUI_TARGET === "native") {
595
546
  if (key === "pointerEvents") {
596
- usedKeys[key] = 1;
597
547
  viewProps[key] = val;
598
548
  continue;
599
549
  }
@@ -604,38 +554,25 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
604
554
  fontFamily = fam;
605
555
  }
606
556
  }
607
- if (key in validStyleProps) {
608
- mergeStyle(styleState, flatTransforms, key, val);
609
- continue;
610
- } else if (process.env.TAMAGUI_TARGET === "native" && import_constants.isAndroid && key === "elevation") {
557
+ if (key in validStyleProps || process.env.TAMAGUI_TARGET === "native" && import_constants.isAndroid && key === "elevation") {
611
558
  mergeStyle(styleState, flatTransforms, key, val);
612
559
  continue;
613
560
  }
614
561
  if (!isVariant && !(key in skipProps)) {
615
562
  viewProps[key] = val;
616
- usedKeys[key] = 1;
617
563
  }
618
564
  }
619
565
  }
620
- for (let i = len - 1; i >= 0; i--) {
621
- const keyInit = propKeys[i];
622
- const valInit = props[keyInit];
623
- processProp(keyInit, valInit);
624
- }
625
566
  fontFamily || (fontFamily = conf.defaultFont);
626
- for (let i = 0; i < specialProps.length; i++) {
627
- const [key, value] = specialProps[i];
628
- processProp(key, value, true, fontFamily);
629
- }
630
567
  (0, import_expandStyles.fixStyles)(style);
631
568
  if (import_constants.isWeb) {
632
569
  (0, import_getStylesAtomic.styleToCSS)(style);
633
570
  }
634
571
  if (process.env.TAMAGUI_TARGET === "native") {
635
572
  if ("fontFamily" in style && style.fontFamily) {
636
- const faceInfo = (_a = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _a.face;
573
+ const faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
637
574
  if (faceInfo) {
638
- const overrideFace = (_c = (_b = faceInfo[style.fontWeight]) == null ? void 0 : _b[style.fontStyle || "normal"]) == null ? void 0 : _c.val;
575
+ const overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
639
576
  if (overrideFace) {
640
577
  style.fontFamily = overrideFace;
641
578
  fontFamily = overrideFace;
@@ -655,7 +592,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
655
592
  }
656
593
  }
657
594
  if (flatTransforms) {
658
- mergeTransforms(style, flatTransforms, true);
595
+ mergeFlatTransforms(style, flatTransforms, true);
659
596
  }
660
597
  if (parentSplitStyles) {
661
598
  if (process.env.TAMAGUI_TARGET === "web") {
@@ -684,7 +621,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
684
621
  const atomic = (0, import_getStylesAtomic.getStylesAtomic)(style);
685
622
  for (const atomicStyle of atomic) {
686
623
  const key = atomicStyle.property;
687
- if (props.animateOnly && props.animateOnly.includes(key)) {
624
+ if (state.isAnimated && props.animateOnly && props.animateOnly.includes(key)) {
688
625
  retainedStyles[key] = style[key];
689
626
  } else {
690
627
  addStyleToInsertRules(rulesToInsert, atomicStyle);
@@ -748,18 +685,11 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
748
685
  }
749
686
  }
750
687
  }
751
- const nextViewProps = {};
752
- const ks = Object.keys(viewProps);
753
- const l = ks.length;
754
- for (let i = l - 1; i >= 0; i--) {
755
- const key = ks[i];
756
- nextViewProps[key] = viewProps[key];
757
- }
758
688
  const result = {
759
689
  space,
760
690
  hasMedia,
761
691
  fontFamily,
762
- viewProps: nextViewProps,
692
+ viewProps,
763
693
  // @ts-expect-error
764
694
  style,
765
695
  pseudos,
@@ -771,8 +701,8 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
771
701
  }
772
702
  if (process.env.NODE_ENV === "development" && debug === "verbose") {
773
703
  if (import_isDevTools.isDevTools) {
774
- console.groupCollapsed(" \u{1F539} =>");
775
- const logs = { ...result, state, etc: { transforms, viewProps, rulesToInsert, parentSplitStyles, flatTransforms } };
704
+ console.groupCollapsed(" \u{1F539} ===>");
705
+ const logs = { ...result, state, transforms, viewProps, viewPropsOrder: Object.keys(viewProps), rulesToInsert, parentSplitStyles, flatTransforms };
776
706
  for (const key in logs) {
777
707
  console.log(key, logs[key]);
778
708
  }
@@ -812,12 +742,10 @@ function getSubStyleProps(defaultProps, baseProps, specificProps) {
812
742
  ...specificProps
813
743
  };
814
744
  }
815
- function mergeStyle({ usedKeys, classNames, viewProps, style }, flatTransforms, key, val, dontSetUsed = false) {
816
- if (!dontSetUsed) {
817
- usedKeys[key] || (usedKeys[key] = 1);
818
- }
745
+ function mergeStyle({ classNames, viewProps, style, usedKeys }, flatTransforms, key, val) {
819
746
  if (val && val[0] === "_") {
820
747
  classNames[key] = val;
748
+ usedKeys[key] || (usedKeys[key] = 1);
821
749
  } else if (key in import_helpers.stylePropsTransform) {
822
750
  flatTransforms || (flatTransforms = {});
823
751
  flatTransforms[key] = val;
@@ -830,7 +758,7 @@ function mergeStyle({ usedKeys, classNames, viewProps, style }, flatTransforms,
830
758
  }
831
759
  }
832
760
  }
833
- const getSubStyle = (styleState, subKey, styleIn, avoidDefaultProps, avoidMergeTransform) => {
761
+ const getSubStyle = (styleState, subKey, styleIn, fontFamily, avoidDefaultProps, avoidMergeTransform) => {
834
762
  const { staticConfig, theme, props, state, conf: conf2, languageContext } = styleState;
835
763
  const styleOut = {};
836
764
  for (let key in styleIn) {
@@ -842,16 +770,13 @@ const getSubStyle = (styleState, subKey, styleIn, avoidDefaultProps, avoidMergeT
842
770
  theme,
843
771
  getSubStyleProps(staticConfig.defaultProps, props, props[subKey]),
844
772
  state,
773
+ fontFamily,
845
774
  languageContext,
846
775
  avoidDefaultProps
847
776
  );
848
- if (!staticConfig.isHOC) {
849
- if (key in skipProps) {
850
- continue;
851
- }
852
- }
853
- if (!expanded)
777
+ if (!expanded || !staticConfig.isHOC && key in skipProps) {
854
778
  continue;
779
+ }
855
780
  for (const [skey, sval] of expanded) {
856
781
  if (!avoidMergeTransform && skey in import_helpers.stylePropsTransform) {
857
782
  mergeTransform(styleOut, skey, sval);
@@ -891,7 +816,9 @@ const animatableDefaults = {
891
816
  scale: 1,
892
817
  rotate: "0deg",
893
818
  rotateY: "0deg",
894
- rotateX: "0deg"
819
+ rotateX: "0deg",
820
+ x: 0,
821
+ y: 0
895
822
  };
896
823
  const lowercaseHyphenate = (match) => `-${match.toLowerCase()}`;
897
824
  const hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate);
@@ -901,8 +828,8 @@ const mergeTransform = (obj, key, val, backwards = false) => {
901
828
  [mapTransformKeys[key] || key]: val
902
829
  });
903
830
  };
904
- const mergeTransforms = (obj, flatTransforms, backwards = false) => {
905
- Object.entries(flatTransforms).forEach(([key, val]) => {
831
+ const mergeFlatTransforms = (obj, flatTransforms, backwards = false) => {
832
+ Object.entries(flatTransforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
906
833
  mergeTransform(obj, key, val, backwards);
907
834
  });
908
835
  };
@@ -918,6 +845,9 @@ const skipProps = {
918
845
  componentName: true,
919
846
  tag: true
920
847
  };
848
+ const handledProps = {
849
+ role: true
850
+ };
921
851
  if (process.env.NODE_ENV === "test") {
922
852
  skipProps["data-test-renders"] = true;
923
853
  }
@@ -937,6 +867,10 @@ if (process.env.TAMAGUI_TARGET === "native") {
937
867
  outlineWidth: true,
938
868
  outlineColor: true
939
869
  });
870
+ } else {
871
+ Object.assign(skipProps, {
872
+ elevationAndroid: true
873
+ });
940
874
  }
941
875
  const accessibilityRoleToWebRole = {
942
876
  adjustable: "slider",
@@ -946,6 +880,18 @@ const accessibilityRoleToWebRole = {
946
880
  none: "presentation",
947
881
  summary: "region"
948
882
  };
883
+ function passDownProp(viewProps, key, val, shouldMergeObject = false) {
884
+ if (shouldMergeObject) {
885
+ const next = {
886
+ ...viewProps[key],
887
+ ...val
888
+ };
889
+ delete viewProps[key];
890
+ viewProps[key] = next;
891
+ } else {
892
+ viewProps[key] = val;
893
+ }
894
+ }
949
895
  // Annotate the CommonJS export names for ESM import in node:
950
896
  0 && (module.exports = {
951
897
  PROP_SPLIT,