@tamagui/web 1.22.6 → 1.22.8

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 (299) hide show
  1. package/dist/cjs/Tamagui.js +3 -3
  2. package/dist/cjs/createComponent.js +35 -60
  3. package/dist/cjs/createComponent.js.map +1 -1
  4. package/dist/cjs/createTamagui.js +9 -9
  5. package/dist/cjs/createTokens.js +1 -1
  6. package/dist/cjs/createVariable.js +1 -1
  7. package/dist/cjs/createVariables.js +1 -1
  8. package/dist/cjs/helpers/ThemeManager.js +3 -3
  9. package/dist/cjs/helpers/createMediaStyle.js +1 -1
  10. package/dist/cjs/helpers/createPropMapper.js +18 -12
  11. package/dist/cjs/helpers/createPropMapper.js.map +1 -1
  12. package/dist/cjs/helpers/expandStyles.js +4 -4
  13. package/dist/cjs/helpers/extendStaticConfig.js +2 -2
  14. package/dist/cjs/helpers/getAnimationDriver.js +1 -1
  15. package/dist/cjs/helpers/getExpandedShorthands.js +1 -1
  16. package/dist/cjs/helpers/getSplitStyles.js +11 -10
  17. package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
  18. package/dist/cjs/helpers/getStylesAtomic.js +4 -4
  19. package/dist/cjs/helpers/getThemeCSSRules.js +3 -3
  20. package/dist/cjs/helpers/getVariantExtras.js +2 -2
  21. package/dist/cjs/helpers/isTamaguiElement.js +1 -1
  22. package/dist/cjs/helpers/memoizeFunctionByArgumentsReference.js +31 -0
  23. package/dist/cjs/helpers/memoizeFunctionByArgumentsReference.js.map +6 -0
  24. package/dist/cjs/helpers/normalizeShadow.js +2 -2
  25. package/dist/cjs/helpers/normalizeShadow.native.js +3 -3
  26. package/dist/cjs/helpers/normalizeValueWithProperty.js +2 -2
  27. package/dist/cjs/helpers/proxyThemeVariables.js +1 -1
  28. package/dist/cjs/helpers/registerCSSVariable.js +1 -1
  29. package/dist/cjs/helpers/themeable.js +2 -2
  30. package/dist/cjs/helpers/themeable.js.map +1 -1
  31. package/dist/cjs/helpers/themes.js +2 -2
  32. package/dist/cjs/hooks/useAnimationDriver.js +2 -2
  33. package/dist/cjs/hooks/useMedia.js +3 -3
  34. package/dist/cjs/hooks/useProps.js +1 -1
  35. package/dist/cjs/hooks/useStyle.js +5 -5
  36. package/dist/cjs/hooks/useTheme.js +7 -7
  37. package/dist/cjs/hooks/useThemeName.js +2 -2
  38. package/dist/cjs/index.js +96 -96
  39. package/dist/cjs/index.js.map +1 -1
  40. package/dist/cjs/insertFont.js +4 -4
  41. package/dist/cjs/styled.js +12 -5
  42. package/dist/cjs/styled.js.map +1 -1
  43. package/dist/cjs/views/FontLanguage.native.js +1 -1
  44. package/dist/cjs/views/Stack.js +2 -2
  45. package/dist/cjs/views/TamaguiProvider.js +5 -5
  46. package/dist/cjs/views/Text.js +1 -1
  47. package/dist/cjs/views/Theme.js +4 -4
  48. package/dist/cjs/views/ThemeDebug.js +1 -1
  49. package/dist/cjs/views/ThemeDebug.js.map +1 -1
  50. package/dist/cjs/views/ThemeProvider.js +2 -2
  51. package/dist/esm/Tamagui.js +3 -3
  52. package/dist/esm/Tamagui.mjs +3 -3
  53. package/dist/esm/createComponent.js +36 -61
  54. package/dist/esm/createComponent.js.map +1 -1
  55. package/dist/esm/createComponent.mjs +36 -61
  56. package/dist/esm/createComponent.mjs.map +1 -1
  57. package/dist/esm/createTamagui.js +9 -9
  58. package/dist/esm/createTamagui.mjs +9 -9
  59. package/dist/esm/createTokens.js +1 -1
  60. package/dist/esm/createTokens.mjs +1 -1
  61. package/dist/esm/createVariable.js +1 -1
  62. package/dist/esm/createVariable.mjs +1 -1
  63. package/dist/esm/createVariables.js +1 -1
  64. package/dist/esm/createVariables.mjs +1 -1
  65. package/dist/esm/helpers/ThemeManager.js +3 -3
  66. package/dist/esm/helpers/ThemeManager.mjs +3 -3
  67. package/dist/esm/helpers/createMediaStyle.js +1 -1
  68. package/dist/esm/helpers/createMediaStyle.mjs +1 -1
  69. package/dist/esm/helpers/createPropMapper.js +18 -12
  70. package/dist/esm/helpers/createPropMapper.js.map +1 -1
  71. package/dist/esm/helpers/createPropMapper.mjs +18 -12
  72. package/dist/esm/helpers/createPropMapper.mjs.map +1 -1
  73. package/dist/esm/helpers/expandStyles.js +4 -4
  74. package/dist/esm/helpers/expandStyles.mjs +4 -4
  75. package/dist/esm/helpers/extendStaticConfig.js +2 -2
  76. package/dist/esm/helpers/extendStaticConfig.mjs +2 -2
  77. package/dist/esm/helpers/getAnimationDriver.js +1 -1
  78. package/dist/esm/helpers/getAnimationDriver.mjs +1 -1
  79. package/dist/esm/helpers/getExpandedShorthands.js +1 -1
  80. package/dist/esm/helpers/getExpandedShorthands.mjs +1 -1
  81. package/dist/esm/helpers/getSplitStyles.js +11 -10
  82. package/dist/esm/helpers/getSplitStyles.js.map +1 -1
  83. package/dist/esm/helpers/getSplitStyles.mjs +11 -10
  84. package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
  85. package/dist/esm/helpers/getStylesAtomic.js +4 -4
  86. package/dist/esm/helpers/getStylesAtomic.mjs +4 -4
  87. package/dist/esm/helpers/getThemeCSSRules.js +3 -3
  88. package/dist/esm/helpers/getThemeCSSRules.mjs +3 -3
  89. package/dist/esm/helpers/getVariantExtras.js +2 -2
  90. package/dist/esm/helpers/getVariantExtras.mjs +2 -2
  91. package/dist/esm/helpers/isTamaguiElement.js +1 -1
  92. package/dist/esm/helpers/isTamaguiElement.mjs +1 -1
  93. package/dist/esm/helpers/memoizeFunctionByArgumentsReference.js +30 -0
  94. package/dist/esm/helpers/memoizeFunctionByArgumentsReference.js.map +6 -0
  95. package/dist/esm/helpers/memoizeFunctionByArgumentsReference.mjs +30 -0
  96. package/dist/esm/helpers/memoizeFunctionByArgumentsReference.mjs.map +6 -0
  97. package/dist/esm/helpers/normalizeShadow.js +2 -2
  98. package/dist/esm/helpers/normalizeShadow.mjs +2 -2
  99. package/dist/esm/helpers/normalizeShadow.native.js +3 -3
  100. package/dist/esm/helpers/normalizeShadow.native.mjs +3 -3
  101. package/dist/esm/helpers/normalizeValueWithProperty.js +2 -2
  102. package/dist/esm/helpers/normalizeValueWithProperty.mjs +2 -2
  103. package/dist/esm/helpers/proxyThemeVariables.js +1 -1
  104. package/dist/esm/helpers/proxyThemeVariables.mjs +1 -1
  105. package/dist/esm/helpers/registerCSSVariable.js +1 -1
  106. package/dist/esm/helpers/registerCSSVariable.mjs +1 -1
  107. package/dist/esm/helpers/themeable.js +2 -2
  108. package/dist/esm/helpers/themeable.js.map +1 -1
  109. package/dist/esm/helpers/themeable.mjs +2 -2
  110. package/dist/esm/helpers/themeable.mjs.map +1 -1
  111. package/dist/esm/helpers/themes.js +2 -2
  112. package/dist/esm/helpers/themes.mjs +2 -2
  113. package/dist/esm/hooks/useAnimationDriver.js +2 -2
  114. package/dist/esm/hooks/useAnimationDriver.mjs +2 -2
  115. package/dist/esm/hooks/useMedia.js +3 -3
  116. package/dist/esm/hooks/useMedia.mjs +3 -3
  117. package/dist/esm/hooks/useProps.js +1 -1
  118. package/dist/esm/hooks/useProps.mjs +1 -1
  119. package/dist/esm/hooks/useStyle.js +5 -5
  120. package/dist/esm/hooks/useStyle.mjs +5 -5
  121. package/dist/esm/hooks/useTheme.js +7 -7
  122. package/dist/esm/hooks/useTheme.mjs +7 -7
  123. package/dist/esm/hooks/useThemeName.js +2 -2
  124. package/dist/esm/hooks/useThemeName.mjs +2 -2
  125. package/dist/esm/index.js +49 -49
  126. package/dist/esm/index.mjs +49 -49
  127. package/dist/esm/insertFont.js +4 -4
  128. package/dist/esm/insertFont.mjs +4 -4
  129. package/dist/esm/styled.js +12 -5
  130. package/dist/esm/styled.js.map +1 -1
  131. package/dist/esm/styled.mjs +12 -5
  132. package/dist/esm/styled.mjs.map +1 -1
  133. package/dist/esm/views/FontLanguage.native.js +1 -1
  134. package/dist/esm/views/FontLanguage.native.mjs +1 -1
  135. package/dist/esm/views/Stack.js +2 -2
  136. package/dist/esm/views/Stack.mjs +2 -2
  137. package/dist/esm/views/TamaguiProvider.js +5 -5
  138. package/dist/esm/views/TamaguiProvider.mjs +5 -5
  139. package/dist/esm/views/Text.js +1 -1
  140. package/dist/esm/views/Text.mjs +1 -1
  141. package/dist/esm/views/Theme.js +4 -4
  142. package/dist/esm/views/Theme.mjs +4 -4
  143. package/dist/esm/views/ThemeDebug.js +1 -1
  144. package/dist/esm/views/ThemeDebug.js.map +1 -1
  145. package/dist/esm/views/ThemeDebug.mjs +1 -1
  146. package/dist/esm/views/ThemeDebug.mjs.map +1 -1
  147. package/dist/esm/views/ThemeProvider.js +2 -2
  148. package/dist/esm/views/ThemeProvider.mjs +2 -2
  149. package/package.json +9 -9
  150. package/src/Tamagui.ts +3 -3
  151. package/src/config.ts +1 -1
  152. package/src/contexts/FontLanguageContext.tsx +1 -1
  153. package/src/createComponent.tsx +36 -69
  154. package/src/createFont.ts +1 -1
  155. package/src/createShorthands.ts +1 -1
  156. package/src/createTamagui.ts +10 -10
  157. package/src/createTheme.ts +1 -1
  158. package/src/createTokens.ts +3 -3
  159. package/src/createVariable.ts +1 -1
  160. package/src/createVariables.ts +1 -1
  161. package/src/helpers/ThemeManager.tsx +4 -4
  162. package/src/helpers/ThemeManagerContext.tsx +1 -1
  163. package/src/helpers/createMediaStyle.ts +2 -2
  164. package/src/helpers/createPropMapper.ts +25 -16
  165. package/src/helpers/expandStyles.ts +4 -4
  166. package/src/helpers/extendStaticConfig.ts +3 -3
  167. package/src/helpers/getAnimationDriver.tsx +1 -1
  168. package/src/helpers/getExpandedShorthands.ts +2 -2
  169. package/src/helpers/getSplitStyles.tsx +12 -11
  170. package/src/helpers/getStylesAtomic.ts +5 -5
  171. package/src/helpers/getThemeCSSRules.ts +4 -4
  172. package/src/helpers/getVariantExtras.tsx +4 -4
  173. package/src/helpers/insertStyleRule.tsx +1 -1
  174. package/src/helpers/isTamaguiComponent.tsx +1 -1
  175. package/src/helpers/isTamaguiElement.tsx +2 -2
  176. package/src/helpers/matchMedia.native.ts +1 -1
  177. package/src/helpers/matchMedia.ts +1 -1
  178. package/src/helpers/memoizeFunctionByArgumentsReference.ts +38 -0
  179. package/src/helpers/normalizeShadow.native.ts +3 -3
  180. package/src/helpers/normalizeShadow.ts +2 -2
  181. package/src/helpers/normalizeValueWithProperty.ts +2 -2
  182. package/src/helpers/proxyThemeVariables.tsx +1 -1
  183. package/src/helpers/registerCSSVariable.ts +1 -1
  184. package/src/helpers/themeable.tsx +4 -3
  185. package/src/helpers/themes.ts +3 -3
  186. package/src/helpers/useShallowSetState.tsx +1 -1
  187. package/src/hooks/useAnimationDriver.tsx +2 -2
  188. package/src/hooks/useMedia.tsx +4 -4
  189. package/src/hooks/useProps.tsx +1 -1
  190. package/src/hooks/useStyle.tsx +5 -5
  191. package/src/hooks/useTheme.tsx +8 -8
  192. package/src/hooks/useThemeName.tsx +3 -3
  193. package/src/index.ts +49 -49
  194. package/src/insertFont.ts +6 -6
  195. package/src/setupReactNative.ts +1 -1
  196. package/src/styled.tsx +13 -16
  197. package/src/types.tsx +5 -5
  198. package/src/views/FontLanguage.native.tsx +2 -2
  199. package/src/views/FontLanguage.tsx +1 -1
  200. package/src/views/Stack.tsx +3 -3
  201. package/src/views/TamaguiProvider.tsx +6 -6
  202. package/src/views/Text.tsx +2 -2
  203. package/src/views/Theme.tsx +5 -5
  204. package/src/views/ThemeDebug.tsx +3 -3
  205. package/src/views/ThemeProvider.tsx +2 -2
  206. package/types/Tamagui.d.ts +1 -1
  207. package/types/Tamagui.d.ts.map +1 -1
  208. package/types/config.d.ts +19 -19
  209. package/types/config.d.ts.map +1 -1
  210. package/types/contexts/FontLanguageContext.d.ts +1 -1
  211. package/types/createComponent.d.ts.map +1 -1
  212. package/types/createFont.d.ts +1 -1
  213. package/types/createFont.d.ts.map +1 -1
  214. package/types/createShorthands.d.ts +1 -1
  215. package/types/createShorthands.d.ts.map +1 -1
  216. package/types/createTamagui.d.ts +1 -1
  217. package/types/createTamagui.d.ts.map +1 -1
  218. package/types/createTheme.d.ts +1 -1
  219. package/types/createTheme.d.ts.map +1 -1
  220. package/types/createTokens.d.ts +2 -2
  221. package/types/createTokens.d.ts.map +1 -1
  222. package/types/createVariables.d.ts +1 -1
  223. package/types/createVariables.d.ts.map +1 -1
  224. package/types/helpers/ThemeManager.d.ts +2 -2
  225. package/types/helpers/ThemeManager.d.ts.map +1 -1
  226. package/types/helpers/ThemeManagerContext.d.ts +1 -1
  227. package/types/helpers/ThemeManagerContext.d.ts.map +1 -1
  228. package/types/helpers/createMediaStyle.d.ts +1 -1
  229. package/types/helpers/createMediaStyle.d.ts.map +1 -1
  230. package/types/helpers/createPropMapper.d.ts +1 -1
  231. package/types/helpers/createPropMapper.d.ts.map +1 -1
  232. package/types/helpers/expandStyles.d.ts +1 -1
  233. package/types/helpers/expandStyles.d.ts.map +1 -1
  234. package/types/helpers/extendStaticConfig.d.ts +1 -1
  235. package/types/helpers/extendStaticConfig.d.ts.map +1 -1
  236. package/types/helpers/getAnimationDriver.d.ts +1 -1
  237. package/types/helpers/getExpandedShorthands.d.ts +1 -1
  238. package/types/helpers/getExpandedShorthands.d.ts.map +1 -1
  239. package/types/helpers/getSplitStyles.d.ts +2 -2
  240. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  241. package/types/helpers/getStylesAtomic.d.ts +2 -2
  242. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  243. package/types/helpers/getThemeCSSRules.d.ts +1 -1
  244. package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
  245. package/types/helpers/getVariantExtras.d.ts +2 -2
  246. package/types/helpers/getVariantExtras.d.ts.map +1 -1
  247. package/types/helpers/insertStyleRule.d.ts +1 -1
  248. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  249. package/types/helpers/isTamaguiComponent.d.ts +1 -1
  250. package/types/helpers/isTamaguiComponent.d.ts.map +1 -1
  251. package/types/helpers/isTamaguiElement.d.ts +1 -1
  252. package/types/helpers/isTamaguiElement.d.ts.map +1 -1
  253. package/types/helpers/matchMedia.d.ts +1 -1
  254. package/types/helpers/matchMedia.d.ts.map +1 -1
  255. package/types/helpers/matchMedia.native.d.ts +1 -1
  256. package/types/helpers/matchMedia.native.d.ts.map +1 -1
  257. package/types/helpers/memoizeFunctionByArgumentsReference.d.ts +11 -0
  258. package/types/helpers/memoizeFunctionByArgumentsReference.d.ts.map +1 -0
  259. package/types/helpers/registerCSSVariable.d.ts +1 -1
  260. package/types/helpers/registerCSSVariable.d.ts.map +1 -1
  261. package/types/helpers/themeable.d.ts +1 -1
  262. package/types/helpers/themeable.d.ts.map +1 -1
  263. package/types/helpers/themes.d.ts +1 -1
  264. package/types/helpers/themes.d.ts.map +1 -1
  265. package/types/helpers/useShallowSetState.d.ts +1 -1
  266. package/types/helpers/useShallowSetState.d.ts.map +1 -1
  267. package/types/hooks/useAnimationDriver.d.ts +1 -1
  268. package/types/hooks/useAnimationDriver.d.ts.map +1 -1
  269. package/types/hooks/useMedia.d.ts +1 -1
  270. package/types/hooks/useMedia.d.ts.map +1 -1
  271. package/types/hooks/useStyle.d.ts +1 -1
  272. package/types/hooks/useTheme.d.ts +2 -2
  273. package/types/hooks/useTheme.d.ts.map +1 -1
  274. package/types/hooks/useThemeName.d.ts +1 -1
  275. package/types/hooks/useThemeName.d.ts.map +1 -1
  276. package/types/index.d.ts +49 -49
  277. package/types/index.d.ts.map +1 -1
  278. package/types/insertFont.d.ts +2 -2
  279. package/types/insertFont.d.ts.map +1 -1
  280. package/types/setupReactNative.d.ts +1 -1
  281. package/types/setupReactNative.d.ts.map +1 -1
  282. package/types/styled.d.ts +1 -1
  283. package/types/styled.d.ts.map +1 -1
  284. package/types/types.d.ts +4 -4
  285. package/types/types.d.ts.map +1 -1
  286. package/types/views/FontLanguage.d.ts +1 -1
  287. package/types/views/FontLanguage.d.ts.map +1 -1
  288. package/types/views/FontLanguage.native.d.ts +1 -1
  289. package/types/views/FontLanguage.native.d.ts.map +1 -1
  290. package/types/views/Stack.d.ts +2 -2
  291. package/types/views/Stack.d.ts.map +1 -1
  292. package/types/views/TamaguiProvider.d.ts +1 -1
  293. package/types/views/TamaguiProvider.d.ts.map +1 -1
  294. package/types/views/Text.d.ts +2 -2
  295. package/types/views/Text.d.ts.map +1 -1
  296. package/types/views/Theme.d.ts +2 -2
  297. package/types/views/Theme.d.ts.map +1 -1
  298. package/types/views/ThemeDebug.d.ts +2 -2
  299. package/types/views/ThemeDebug.d.ts.map +1 -1
@@ -1,8 +1,8 @@
1
1
  import { isAndroid, isWeb } from '@tamagui/constants'
2
2
 
3
- import { getConfig } from '../config.js'
4
- import { isDevTools } from '../constants/isDevTools.js'
5
- import { Variable, getVariableValue, isVariable } from '../createVariable.js'
3
+ import { getConfig } from '../config'
4
+ import { isDevTools } from '../constants/isDevTools'
5
+ import { Variable, getVariableValue, isVariable } from '../createVariable'
6
6
  import type {
7
7
  DebugProp,
8
8
  GenericVariantDefinitions,
@@ -11,13 +11,13 @@ import type {
11
11
  StaticConfigParsed,
12
12
  TamaguiInternalConfig,
13
13
  VariantSpreadFunction,
14
- } from '../types.js'
15
- import type { LanguageContextType } from '../views/FontLanguage.types.js'
16
- import { expandStyle } from './expandStyle.js'
17
- import { expandStyles } from './expandStyles.js'
18
- import { getFontsForLanguage, getVariantExtras } from './getVariantExtras.js'
19
- import { isObj } from './isObj.js'
20
- import { mergeProps } from './mergeProps.js'
14
+ } from '../types'
15
+ import type { LanguageContextType } from '../views/FontLanguage.types'
16
+ import { expandStyle } from './expandStyle'
17
+ import { expandStyles } from './expandStyles'
18
+ import { getFontsForLanguage, getVariantExtras } from './getVariantExtras'
19
+ import { isObj } from './isObj'
20
+ import { mergeProps } from './mergeProps'
21
21
 
22
22
  export type ResolveVariableTypes =
23
23
  | 'auto'
@@ -444,27 +444,36 @@ const getToken = (
444
444
  debug?: DebugProp
445
445
  ) => {
446
446
  const tokensParsed = conf.tokensParsed
447
- const fontsParsed = languageContext
448
- ? getFontsForLanguage(conf.fontsParsed, languageContext)
449
- : conf.fontsParsed
450
447
  let valOrVar: any
451
448
  let hasSet = false
452
449
  if (value in theme) {
450
+ if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
451
+ // rome-ignore lint/nursery/noConsoleLog: <explanation>
452
+ console.log(`Getting theme value for ${key} from ${value} = ${theme[value].val}`)
453
+ }
453
454
  valOrVar = theme[value]
454
455
  hasSet = true
455
456
  } else {
456
457
  switch (key) {
457
- case 'fontFamily':
458
+ case 'fontFamily': {
459
+ const fontsParsed = languageContext
460
+ ? getFontsForLanguage(conf.fontsParsed, languageContext)
461
+ : conf.fontsParsed
458
462
  valOrVar = fontsParsed[value]?.family || value
459
463
  hasSet = true
460
464
  break
465
+ }
461
466
  case 'fontSize':
462
467
  case 'lineHeight':
463
468
  case 'letterSpacing':
464
- case 'fontWeight':
469
+ case 'fontWeight': {
470
+ const fontsParsed = languageContext
471
+ ? getFontsForLanguage(conf.fontsParsed, languageContext)
472
+ : conf.fontsParsed
465
473
  valOrVar = fontsParsed[fontFamily]?.[fontShorthand[key] || key]?.[value] || value
466
474
  hasSet = true
467
475
  break
476
+ }
468
477
  }
469
478
  for (const cat in tokenCategories) {
470
479
  if (key in tokenCategories[cat]) {
@@ -507,7 +516,7 @@ Set the debug prop to true to see more detailed debug information.`
507
516
  if (debug) {
508
517
  if (isDevTools) {
509
518
  // rome-ignore lint/nursery/noConsoleLog: ok
510
- console.log('Looked in:', { theme, tokensParsed, fontsParsed })
519
+ console.log('Looked in:', { theme, tokensParsed })
511
520
  }
512
521
  }
513
522
  return null
@@ -1,10 +1,10 @@
1
1
  import { isWeb } from '@tamagui/constants'
2
2
 
3
- import { getConfig } from '../config.js'
4
- import { expandStyle } from './expandStyle.js'
3
+ import { getConfig } from '../config'
4
+ import { expandStyle } from './expandStyle'
5
5
  import { normalizeShadow } from './normalizeShadow'
6
- import { normalizeValueWithProperty } from './normalizeValueWithProperty.js'
7
- import { pseudoDescriptors } from './pseudoDescriptors.js'
6
+ import { normalizeValueWithProperty } from './normalizeValueWithProperty'
7
+ import { pseudoDescriptors } from './pseudoDescriptors'
8
8
 
9
9
  let shorthands: Record<string, string> | null = null
10
10
 
@@ -5,9 +5,9 @@ import type {
5
5
  StaticConfig,
6
6
  StaticConfigParsed,
7
7
  StylableComponent,
8
- } from '../types.js'
9
- import { createPropMapper } from './createPropMapper.js'
10
- import { mergeProps } from './mergeProps.js'
8
+ } from '../types'
9
+ import { createPropMapper } from './createPropMapper'
10
+ import { mergeProps } from './mergeProps'
11
11
 
12
12
  export function extendStaticConfig(
13
13
  config: Partial<StaticConfig>,
@@ -1,4 +1,4 @@
1
- import { getConfig } from '../config.js'
1
+ import { getConfig } from '../config'
2
2
 
3
3
  /**
4
4
  * @deprecated use the `useAnimationDriver` hook instead
@@ -1,5 +1,5 @@
1
- import { getConfig } from '../config.js'
2
- import { Shorthands } from '../types.js'
1
+ import { getConfig } from '../config'
2
+ import { Shorthands } from '../types'
3
3
 
4
4
  export function getExpandedShorthands<A extends Object>(
5
5
  props: A
@@ -16,15 +16,15 @@ import {
16
16
  } from '@tamagui/helpers'
17
17
  import { useInsertionEffect } from 'react'
18
18
 
19
- import { getConfig, getFont } from '../config.js'
20
- import { isDevTools } from '../constants/isDevTools.js'
19
+ import { getConfig, getFont } from '../config'
20
+ import { isDevTools } from '../constants/isDevTools'
21
21
  import {
22
22
  getMediaImportanceIfMoreImportant,
23
23
  mediaState as globalMediaState,
24
24
  mediaKeysWithAndWithout$,
25
25
  mediaQueryConfig,
26
26
  mergeMediaByImportance,
27
- } from '../hooks/useMedia.js'
27
+ } from '../hooks/useMedia'
28
28
  import type {
29
29
  ClassNamesObject,
30
30
  DebugProp,
@@ -41,14 +41,14 @@ import type {
41
41
  TextStyleProps,
42
42
  ThemeParsed,
43
43
  ViewStyleWithPseudos,
44
- } from '../types.js'
44
+ } from '../types'
45
45
  import type {
46
46
  FontLanguageProps,
47
47
  LanguageContextType,
48
- } from '../views/FontLanguage.types.js'
49
- import { createMediaStyle } from './createMediaStyle.js'
50
- import { getPropMappedFontFamily } from './createPropMapper.js'
51
- import { fixStyles } from './expandStyles.js'
48
+ } from '../views/FontLanguage.types'
49
+ import { createMediaStyle } from './createMediaStyle'
50
+ import { getPropMappedFontFamily } from './createPropMapper'
51
+ import { fixStyles } from './expandStyles'
52
52
  import { generateAtomicStyles, getStylesAtomic, styleToCSS } from './getStylesAtomic'
53
53
  import {
54
54
  insertStyleRules,
@@ -56,12 +56,12 @@ import {
56
56
  scanAllSheets,
57
57
  shouldInsertStyleRules,
58
58
  updateRules,
59
- } from './insertStyleRule.js'
59
+ } from './insertStyleRule'
60
60
  import {
61
61
  normalizeValueWithProperty,
62
62
  reverseMapClassNameToValue,
63
- } from './normalizeValueWithProperty.js'
64
- import { pseudoDescriptors } from './pseudoDescriptors.js'
63
+ } from './normalizeValueWithProperty'
64
+ import { pseudoDescriptors } from './pseudoDescriptors'
65
65
 
66
66
  type GetStyleState = {
67
67
  style: TextStyleProps
@@ -633,6 +633,7 @@ export const getSplitStyles: StyleSplitter = (
633
633
  isVariant,
634
634
  shouldPassProp,
635
635
  isHOCShouldPassThrough,
636
+ theme,
636
637
  })
637
638
  if (!isServer && isDevTools) {
638
639
  // rome-ignore lint/nursery/noConsoleLog: ok
@@ -5,11 +5,11 @@
5
5
 
6
6
  import { StyleObject, simpleHash } from '@tamagui/helpers'
7
7
 
8
- import { getConfig } from '../config.js'
9
- import type { TamaguiInternalConfig, ViewStyleWithPseudos } from '../types.js'
10
- import { defaultOffset } from './defaultOffset.js'
11
- import { normalizeValueWithProperty } from './normalizeValueWithProperty.js'
12
- import { PseudoDescriptor, pseudoDescriptors } from './pseudoDescriptors.js'
8
+ import { getConfig } from '../config'
9
+ import type { TamaguiInternalConfig, ViewStyleWithPseudos } from '../types'
10
+ import { defaultOffset } from './defaultOffset'
11
+ import { normalizeValueWithProperty } from './normalizeValueWithProperty'
12
+ import { PseudoDescriptor, pseudoDescriptors } from './pseudoDescriptors'
13
13
 
14
14
  // refactor this file away next...
15
15
 
@@ -1,9 +1,9 @@
1
1
  import { simpleHash } from '@tamagui/helpers'
2
2
 
3
- import { THEME_CLASSNAME_PREFIX } from '../constants/constants.js'
4
- import { Variable, variableToString } from '../createVariable.js'
5
- import type { CreateTamaguiProps, ThemeParsed } from '../types.js'
6
- import { tokensValueToVariable } from './registerCSSVariable.js'
3
+ import { THEME_CLASSNAME_PREFIX } from '../constants/constants'
4
+ import { Variable, variableToString } from '../createVariable'
5
+ import type { CreateTamaguiProps, ThemeParsed } from '../types'
6
+ import { tokensValueToVariable } from './registerCSSVariable'
7
7
 
8
8
  export function getThemeCSSRules({
9
9
  config,
@@ -1,7 +1,7 @@
1
- import { getConfig } from '../config.js'
2
- import { GenericFonts } from '../types.js'
3
- import { LanguageContextType } from '../views/FontLanguage.types.js'
4
- import { createProxy } from './createProxy.js'
1
+ import { getConfig } from '../config'
2
+ import { GenericFonts } from '../types'
3
+ import { LanguageContextType } from '../views/FontLanguage.types'
4
+ import { createProxy } from './createProxy'
5
5
 
6
6
  const extrasCache = new WeakMap()
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { isClient } from '@tamagui/constants'
2
2
 
3
- import type { RulesToInsert, StyleObject } from '../types.js'
3
+ import type { RulesToInsert, StyleObject } from '../types'
4
4
 
5
5
  const allSelectors: Record<string, string> = {}
6
6
  const allRules: Record<string, string> = {}
@@ -1,4 +1,4 @@
1
- import { StaticConfig, StaticConfigParsed } from '../types.js'
1
+ import { StaticConfig, StaticConfigParsed } from '../types'
2
2
 
3
3
  export function isTamaguiComponent<A>(
4
4
  comp: A,
@@ -1,7 +1,7 @@
1
1
  import { isValidElement } from 'react'
2
2
 
3
- import { TamaguiReactElement } from '../types.js'
4
- import { isTamaguiComponent } from './isTamaguiComponent.js'
3
+ import { TamaguiReactElement } from '../types'
4
+ import { isTamaguiComponent } from './isTamaguiComponent'
5
5
 
6
6
  export const isTamaguiElement = (
7
7
  child: any,
@@ -1,4 +1,4 @@
1
- import { MatchMedia, MediaQueryList } from '../types.js'
1
+ import { MatchMedia, MediaQueryList } from '../types'
2
2
 
3
3
  let matchMediaImpl: MatchMedia = matchMediaFallback
4
4
 
@@ -1,4 +1,4 @@
1
- import { MatchMedia, MediaQueryList } from '../types.js'
1
+ import { MatchMedia, MediaQueryList } from '../types'
2
2
 
3
3
  export const matchMedia =
4
4
  (typeof window !== 'undefined' && window.matchMedia) || matchMediaFallback
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Unused for now but useful function and could replace various caches we use with some testing
3
+ */
4
+
5
+ function isObject(arg) {
6
+ const t = typeof arg
7
+ return (t === 'object' || t === 'function') && arg !== null
8
+ }
9
+
10
+ class FunctionArgumentCache {
11
+ map = new Map()
12
+ weakmap = new WeakMap()
13
+
14
+ get(args: any[]): any {
15
+ let cache = this
16
+ for (let value of args) {
17
+ const map = cache[isObject(value) ? 'weakmap' : 'map']
18
+ cache = map.get(value) || map.set(value, new FunctionArgumentCache()).get(value)
19
+ }
20
+ return cache
21
+ }
22
+ }
23
+
24
+ function memoize<Fn extends Function>(fn: Fn): Fn {
25
+ const cache = new FunctionArgumentCache()
26
+
27
+ return function (this: any, ...args: any[]) {
28
+ // get (or create) a cache item
29
+ const item = cache.get(args)
30
+
31
+ if (item.hasOwnProperty('value')) {
32
+ console.warn('cached')
33
+ return item.value
34
+ }
35
+
36
+ return (item.value = fn.apply(this, args))
37
+ } as any as Fn
38
+ }
@@ -1,8 +1,8 @@
1
1
  import { normalizeCSSColor } from '@tamagui/normalize-css-color'
2
2
 
3
- import { defaultOffset } from './defaultOffset.js'
4
- import { rgba } from './normalizeColor.js'
5
- import { normalizeValueWithProperty } from './normalizeValueWithProperty.js'
3
+ import { defaultOffset } from './defaultOffset'
4
+ import { rgba } from './normalizeColor'
5
+ import { normalizeValueWithProperty } from './normalizeValueWithProperty'
6
6
 
7
7
  export function normalizeShadow({
8
8
  shadowColor,
@@ -1,5 +1,5 @@
1
- import { defaultOffset } from './defaultOffset.js'
2
- import { normalizeValueWithProperty } from './normalizeValueWithProperty.js'
1
+ import { defaultOffset } from './defaultOffset'
2
+ import { normalizeValueWithProperty } from './normalizeValueWithProperty'
3
3
 
4
4
  export function normalizeShadow({
5
5
  shadowColor,
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { isWeb } from '@tamagui/constants'
7
7
 
8
- import { getAllSelectors } from './insertStyleRule.js'
9
- import { names, normalizeColor } from './normalizeColor.js'
8
+ import { getAllSelectors } from './insertStyleRule'
9
+ import { names, normalizeColor } from './normalizeColor'
10
10
  import { normalizeStylePropKeys } from './normalizeStylePropKeys'
11
11
 
12
12
  const colorCache = new Map()
@@ -1,4 +1,4 @@
1
- import { createProxy } from './createProxy.js'
1
+ import { createProxy } from './createProxy'
2
2
 
3
3
  export function proxyThemeVariables<A extends Object>(obj: A): A {
4
4
  return createProxy<A>(obj || {}, {
@@ -1,4 +1,4 @@
1
- import { Variable, createCSSVariable } from '../createVariable.js'
1
+ import { Variable, createCSSVariable } from '../createVariable'
2
2
 
3
3
  export const registerCSSVariable = (v: Variable) => {
4
4
  tokensValueToVariable.set(v.val, v)
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef } from 'react'
2
2
 
3
- import { DebugProp, StaticConfig, ThemeName } from '../types.js'
4
- import { Theme } from '../views/Theme.js'
3
+ import { DebugProp, StaticConfig, ThemeName } from '../types'
4
+ import { Theme } from '../views/Theme'
5
5
 
6
6
  export interface ThemeableProps {
7
7
  theme?: ThemeName | null
@@ -17,6 +17,7 @@ export function themeable<Component extends (props: any) => any>(
17
17
  ) {
18
18
  const withThemeComponent = forwardRef(function WithTheme(props: ThemeableProps, ref) {
19
19
  const { themeInverse, theme, componentName, themeReset, ...rest } = props
20
+
20
21
  const element = React.createElement(component, { ...rest, ref } as any)
21
22
 
22
23
  return (
@@ -26,7 +27,7 @@ export function themeable<Component extends (props: any) => any>(
26
27
  name={(theme as any) || null}
27
28
  disable-child-theme
28
29
  debug={props.debug}
29
- reset={props.themeReset}
30
+ reset={themeReset}
30
31
  >
31
32
  {element}
32
33
  </Theme>
@@ -1,6 +1,6 @@
1
- import { createVariable, isVariable } from '../createVariable.js'
2
- import { GetThemeUnwrapped } from '../hooks/getThemeUnwrapped.js'
3
- import { CreateTamaguiProps } from '../types.js'
1
+ import { createVariable, isVariable } from '../createVariable'
2
+ import { GetThemeUnwrapped } from '../hooks/getThemeUnwrapped'
3
+ import { CreateTamaguiProps } from '../types'
4
4
 
5
5
  // mutates, freeze after
6
6
  // shared by createTamagui so extracted here
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from 'react'
2
2
 
3
- import { DebugProp, TamaguiComponentState } from '../types.js'
3
+ import { DebugProp, TamaguiComponentState } from '../types'
4
4
 
5
5
  export function useShallowSetState<State extends TamaguiComponentState>(
6
6
  setter: React.Dispatch<React.SetStateAction<State>>,
@@ -1,7 +1,7 @@
1
1
  import { useContext } from 'react'
2
2
 
3
- import { AnimationDriverContext } from '../contexts/AnimationDriverContext.js'
4
- import { getAnimationDriver } from '../helpers/getAnimationDriver.js'
3
+ import { AnimationDriverContext } from '../contexts/AnimationDriverContext'
4
+ import { getAnimationDriver } from '../helpers/getAnimationDriver'
5
5
  import { isRSC } from '@tamagui/constants'
6
6
 
7
7
  export const useAnimationDriver = () => {
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useMemo, useSyncExternalStore } from 'react'
2
2
 
3
- import { getConfig } from '../config.js'
4
- import { createProxy } from '../helpers/createProxy.js'
3
+ import { getConfig } from '../config'
4
+ import { createProxy } from '../helpers/createProxy'
5
5
  import { matchMedia } from '../helpers/matchMedia'
6
6
  import type {
7
7
  MediaQueries,
@@ -9,8 +9,8 @@ import type {
9
9
  MediaQueryObject,
10
10
  MediaQueryState,
11
11
  TamaguiInternalConfig,
12
- } from '../types.js'
13
- import { useSafeRef } from './useSafeRef.js'
12
+ } from '../types'
13
+ import { useSafeRef } from './useSafeRef'
14
14
 
15
15
  export let mediaState: MediaQueryState =
16
16
  // development only safeguard
@@ -1,4 +1,4 @@
1
- import { useMediaPropsActive } from './useMedia.js'
1
+ import { useMediaPropsActive } from './useMedia'
2
2
 
3
3
  /**
4
4
  * Will flatten any media styles down + expand all shorthands.
@@ -1,9 +1,9 @@
1
1
  import { isRSC, isWeb } from '@tamagui/constants'
2
2
  import { useContext } from 'react'
3
3
 
4
- import { FontLanguageContext } from '../contexts/FontLanguageContext.js'
5
- import { TextAncestorContext } from '../contexts/TextAncestorContext.js'
6
- import { useSplitStyles } from '../helpers/getSplitStyles.js'
4
+ import { FontLanguageContext } from '../contexts/FontLanguageContext'
5
+ import { TextAncestorContext } from '../contexts/TextAncestorContext'
6
+ import { useSplitStyles } from '../helpers/getSplitStyles'
7
7
  import {
8
8
  DebugProp,
9
9
  GetProps,
@@ -11,8 +11,8 @@ import {
11
11
  TamaguiComponent,
12
12
  TextNonStyleProps,
13
13
  } from '../types'
14
- import { useMedia } from './useMedia.js'
15
- import { useTheme } from './useTheme.js'
14
+ import { useMedia } from './useMedia'
15
+ import { useTheme } from './useTheme'
16
16
 
17
17
  export function useStyle<
18
18
  Component extends TamaguiComponent,
@@ -2,18 +2,18 @@
2
2
  import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'
3
3
  import { useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react'
4
4
 
5
- import { getConfig } from '../config.js'
6
- import { isDevTools } from '../constants/isDevTools.js'
7
- import { createProxy } from '../helpers/createProxy.js'
5
+ import { getConfig } from '../config'
6
+ import { isDevTools } from '../constants/isDevTools'
7
+ import { createProxy } from '../helpers/createProxy'
8
8
  import {
9
9
  ThemeManager,
10
10
  ThemeManagerState,
11
11
  getNonComponentParentManager,
12
- } from '../helpers/ThemeManager.js'
13
- import { ThemeManagerContext } from '../helpers/ThemeManagerContext.js'
14
- import type { ThemeParsed, ThemeProps } from '../types.js'
15
- import { GetThemeUnwrapped } from './getThemeUnwrapped.js'
16
- import { useServerRef } from './useServerHooks.js'
12
+ } from '../helpers/ThemeManager'
13
+ import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
14
+ import type { ThemeParsed, ThemeProps } from '../types'
15
+ import { GetThemeUnwrapped } from './getThemeUnwrapped'
16
+ import { useServerRef } from './useServerHooks'
17
17
 
18
18
  export type ChangedThemeResponse = {
19
19
  isNewTheme: boolean
@@ -1,9 +1,9 @@
1
1
  import { isRSC, useIsomorphicLayoutEffect } from '@tamagui/constants'
2
2
  import { useContext, useState } from 'react'
3
3
 
4
- import { getConfig } from '../config.js'
5
- import { ThemeManagerContext } from '../helpers/ThemeManagerContext.js'
6
- import { ThemeName } from '../types.js'
4
+ import { getConfig } from '../config'
5
+ import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
6
+ import { ThemeName } from '../types'
7
7
 
8
8
  export function useThemeName(opts?: { parent?: true }): ThemeName {
9
9
  if (isRSC) {