@tamagui/core 1.0.0-beta.187 → 1.0.0-beta.2

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 (273) hide show
  1. package/dist/cjs/Tamagui.js +18 -1
  2. package/dist/cjs/Tamagui.js.map +2 -2
  3. package/dist/cjs/ThemeContext.js +4 -0
  4. package/dist/cjs/ThemeManager.js +30 -14
  5. package/dist/cjs/ThemeManager.js.map +2 -2
  6. package/dist/cjs/conf.js +10 -1
  7. package/dist/cjs/conf.js.map +2 -2
  8. package/dist/cjs/constants/constants.js +6 -0
  9. package/dist/cjs/constants/platform.js +15 -0
  10. package/dist/cjs/constants/platform.js.map +2 -2
  11. package/dist/cjs/constants/rnw.js +4 -0
  12. package/dist/cjs/contexts/ButtonInsideButtonContext.js +4 -0
  13. package/dist/cjs/createComponent.js +156 -130
  14. package/dist/cjs/createComponent.js.map +2 -2
  15. package/dist/cjs/createFont.js +4 -0
  16. package/dist/cjs/createShorthands.js +4 -0
  17. package/dist/cjs/createTamagui.js +56 -27
  18. package/dist/cjs/createTamagui.js.map +2 -2
  19. package/dist/cjs/createTheme.js +4 -0
  20. package/dist/cjs/createTokens.js +7 -6
  21. package/dist/cjs/createTokens.js.map +2 -2
  22. package/dist/cjs/createVariable.js +18 -2
  23. package/dist/cjs/createVariable.js.map +2 -2
  24. package/dist/cjs/defaultComponentState.js +0 -30
  25. package/dist/cjs/defaultComponentState.js.map +3 -3
  26. package/dist/cjs/helpers/RNComponents.js +38 -0
  27. package/dist/cjs/helpers/RNComponents.js.map +7 -0
  28. package/dist/cjs/helpers/addStylesUsingClassname.js +19 -16
  29. package/dist/cjs/helpers/addStylesUsingClassname.js.map +2 -2
  30. package/dist/cjs/helpers/areEqualSets.js +4 -0
  31. package/dist/cjs/helpers/createMediaStyle.js +5 -0
  32. package/dist/cjs/helpers/createPropMapper.js +63 -61
  33. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  34. package/dist/cjs/helpers/createShallowUpdate.js +55 -0
  35. package/dist/cjs/helpers/createShallowUpdate.js.map +7 -0
  36. package/dist/cjs/helpers/createTamaguiProvider.js +5 -5
  37. package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
  38. package/dist/cjs/helpers/extendStaticConfig.js +9 -6
  39. package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
  40. package/dist/cjs/helpers/fixNativeShadow.js +4 -0
  41. package/dist/cjs/helpers/fixNativeShadow.native.js +6 -2
  42. package/dist/cjs/helpers/fixNativeShadow.native.js.map +2 -2
  43. package/dist/cjs/helpers/getExpandedShorthands.js +4 -0
  44. package/dist/cjs/helpers/getSize.js +35 -0
  45. package/dist/cjs/helpers/getSize.js.map +7 -0
  46. package/dist/cjs/helpers/getSplitStyles.js +152 -64
  47. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  48. package/dist/cjs/helpers/getStylesAtomic.js +20 -2
  49. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  50. package/dist/cjs/helpers/getStylesAtomic.native.js +4 -0
  51. package/dist/cjs/helpers/insertStyleRule.js +46 -26
  52. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  53. package/dist/cjs/helpers/isObj.js +4 -0
  54. package/dist/cjs/helpers/isTamaguiElement.js +4 -0
  55. package/dist/cjs/helpers/matchMedia.js +4 -0
  56. package/dist/cjs/helpers/matchMedia.native.js +4 -0
  57. package/dist/cjs/helpers/proxyThemeVariables.js +40 -0
  58. package/dist/cjs/helpers/proxyThemeVariables.js.map +7 -0
  59. package/dist/cjs/helpers/themeable.js +7 -2
  60. package/dist/cjs/helpers/themeable.js.map +2 -2
  61. package/dist/cjs/helpers/validate.js +53 -11
  62. package/dist/cjs/helpers/validate.js.map +2 -2
  63. package/dist/cjs/helpers/withStaticProperties.js +4 -0
  64. package/dist/cjs/helpers/wrapThemeManagerContext.js +4 -0
  65. package/dist/cjs/hooks/useConstant.js +4 -0
  66. package/dist/cjs/hooks/useFeatures.js +101 -12
  67. package/dist/cjs/hooks/useFeatures.js.map +2 -2
  68. package/dist/cjs/hooks/useIsMounted.js +4 -0
  69. package/dist/cjs/hooks/useIsTouchDevice.js +8 -4
  70. package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
  71. package/dist/cjs/hooks/useMedia.js +30 -12
  72. package/dist/cjs/hooks/useMedia.js.map +2 -2
  73. package/dist/cjs/hooks/usePressable.js +4 -0
  74. package/dist/cjs/hooks/useTheme.js +36 -23
  75. package/dist/cjs/hooks/useTheme.js.map +2 -2
  76. package/dist/cjs/hooks/useUnmountEffect.js +4 -0
  77. package/dist/cjs/index.js +15 -0
  78. package/dist/cjs/index.js.map +2 -2
  79. package/dist/cjs/static.js +3 -0
  80. package/dist/cjs/static.js.map +2 -2
  81. package/dist/cjs/styled.js +8 -15
  82. package/dist/cjs/styled.js.map +2 -2
  83. package/dist/cjs/types-rnw.js.map +1 -1
  84. package/dist/cjs/types.js.map +1 -1
  85. package/dist/cjs/views/Stack.js +5 -0
  86. package/dist/cjs/views/Stack.js.map +2 -2
  87. package/dist/cjs/views/Text.js +5 -0
  88. package/dist/cjs/views/Text.js.map +2 -2
  89. package/dist/cjs/views/TextAncestorContext.js +6 -0
  90. package/dist/cjs/views/Theme.js +11 -4
  91. package/dist/cjs/views/Theme.js.map +2 -2
  92. package/dist/cjs/views/ThemeInverse.js +5 -0
  93. package/dist/cjs/views/ThemeProvider.js +6 -1
  94. package/dist/cjs/views/ThemeProvider.js.map +2 -2
  95. package/dist/cjs/views/ThemeReset.js +4 -0
  96. package/dist/esm/Tamagui.js +10 -2
  97. package/dist/esm/Tamagui.js.map +2 -2
  98. package/dist/esm/ThemeManager.js +21 -11
  99. package/dist/esm/ThemeManager.js.map +2 -2
  100. package/dist/esm/conf.js +0 -1
  101. package/dist/esm/conf.js.map +2 -2
  102. package/dist/esm/constants/platform.js +2 -0
  103. package/dist/esm/constants/platform.js.map +2 -2
  104. package/dist/esm/createComponent.js +146 -133
  105. package/dist/esm/createComponent.js.map +2 -2
  106. package/dist/esm/createTamagui.js +53 -28
  107. package/dist/esm/createTamagui.js.map +2 -2
  108. package/dist/esm/createTokens.js +2 -6
  109. package/dist/esm/createTokens.js.map +2 -2
  110. package/dist/esm/createVariable.js +8 -2
  111. package/dist/esm/createVariable.js.map +2 -2
  112. package/dist/esm/defaultComponentState.js +0 -11
  113. package/dist/esm/defaultComponentState.js.map +3 -3
  114. package/dist/esm/helpers/RNComponents.js +12 -0
  115. package/dist/esm/helpers/RNComponents.js.map +7 -0
  116. package/dist/esm/helpers/addStylesUsingClassname.js +16 -18
  117. package/dist/esm/helpers/addStylesUsingClassname.js.map +2 -2
  118. package/dist/esm/helpers/createPropMapper.js +59 -61
  119. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  120. package/dist/esm/helpers/createShallowUpdate.js +19 -0
  121. package/dist/esm/helpers/createShallowUpdate.js.map +7 -0
  122. package/dist/esm/helpers/createTamaguiProvider.js +1 -4
  123. package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
  124. package/dist/esm/helpers/extendStaticConfig.js +9 -6
  125. package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
  126. package/dist/esm/helpers/fixNativeShadow.native.js +2 -2
  127. package/dist/esm/helpers/fixNativeShadow.native.js.map +2 -2
  128. package/dist/esm/helpers/getSize.js +13 -0
  129. package/dist/esm/helpers/getSize.js.map +7 -0
  130. package/dist/esm/helpers/getSplitStyles.js +152 -67
  131. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  132. package/dist/esm/helpers/getStylesAtomic.js +15 -2
  133. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  134. package/dist/esm/helpers/insertStyleRule.js +36 -26
  135. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  136. package/dist/esm/helpers/proxyThemeVariables.js +18 -0
  137. package/dist/esm/helpers/proxyThemeVariables.js.map +7 -0
  138. package/dist/esm/helpers/themeable.js +3 -2
  139. package/dist/esm/helpers/themeable.js.map +2 -2
  140. package/dist/esm/helpers/validate.js +24 -11
  141. package/dist/esm/helpers/validate.js.map +2 -2
  142. package/dist/esm/hooks/useFeatures.js +96 -17
  143. package/dist/esm/hooks/useFeatures.js.map +2 -2
  144. package/dist/esm/hooks/useIsTouchDevice.js +6 -6
  145. package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
  146. package/dist/esm/hooks/useMedia.js +19 -12
  147. package/dist/esm/hooks/useMedia.js.map +2 -2
  148. package/dist/esm/hooks/useTheme.js +28 -23
  149. package/dist/esm/hooks/useTheme.js.map +2 -2
  150. package/dist/esm/index.js +4 -0
  151. package/dist/esm/index.js.map +2 -2
  152. package/dist/esm/static.js +3 -0
  153. package/dist/esm/static.js.map +2 -2
  154. package/dist/esm/styled.js +4 -12
  155. package/dist/esm/styled.js.map +2 -2
  156. package/dist/esm/views/Stack.js +1 -0
  157. package/dist/esm/views/Stack.js.map +2 -2
  158. package/dist/esm/views/Text.js +1 -0
  159. package/dist/esm/views/Text.js.map +2 -2
  160. package/dist/esm/views/Theme.js +7 -4
  161. package/dist/esm/views/Theme.js.map +2 -2
  162. package/dist/esm/views/ThemeProvider.js +2 -1
  163. package/dist/esm/views/ThemeProvider.js.map +2 -2
  164. package/dist/jsx/Tamagui.js +10 -2
  165. package/dist/jsx/ThemeManager.js +21 -11
  166. package/dist/jsx/conf.js +0 -1
  167. package/dist/jsx/constants/platform.js +2 -0
  168. package/dist/jsx/createComponent.js +139 -127
  169. package/dist/jsx/createTamagui.js +53 -28
  170. package/dist/jsx/createTokens.js +2 -6
  171. package/dist/jsx/createVariable.js +8 -2
  172. package/dist/jsx/defaultComponentState.js +0 -11
  173. package/dist/jsx/helpers/RNComponents.js +11 -0
  174. package/dist/jsx/helpers/addStylesUsingClassname.js +16 -18
  175. package/dist/jsx/helpers/createPropMapper.js +59 -61
  176. package/dist/jsx/helpers/createShallowUpdate.js +18 -0
  177. package/dist/jsx/helpers/createTamaguiProvider.js +1 -2
  178. package/dist/jsx/helpers/extendStaticConfig.js +9 -6
  179. package/dist/jsx/helpers/fixNativeShadow.native.js +2 -2
  180. package/dist/jsx/helpers/getSize.js +12 -0
  181. package/dist/jsx/helpers/getSplitStyles.js +152 -67
  182. package/dist/jsx/helpers/getStylesAtomic.js +15 -2
  183. package/dist/jsx/helpers/insertStyleRule.js +36 -26
  184. package/dist/jsx/helpers/proxyThemeVariables.js +17 -0
  185. package/dist/jsx/helpers/themeable.js +3 -3
  186. package/dist/jsx/helpers/validate.js +24 -11
  187. package/dist/jsx/hooks/useFeatures.js +96 -17
  188. package/dist/jsx/hooks/useIsTouchDevice.js +6 -6
  189. package/dist/jsx/hooks/useMedia.js +19 -12
  190. package/dist/jsx/hooks/useTheme.js +28 -23
  191. package/dist/jsx/index.js +4 -0
  192. package/dist/jsx/static.js +3 -0
  193. package/dist/jsx/styled.js +4 -12
  194. package/dist/jsx/views/Stack.js +1 -0
  195. package/dist/jsx/views/Text.js +1 -0
  196. package/dist/jsx/views/Theme.js +7 -4
  197. package/dist/jsx/views/ThemeProvider.js +2 -2
  198. package/package.json +6 -6
  199. package/types/Tamagui.d.ts +18 -1
  200. package/types/Tamagui.d.ts.map +1 -1
  201. package/types/ThemeManager.d.ts +3 -3
  202. package/types/ThemeManager.d.ts.map +1 -1
  203. package/types/conf.d.ts +2 -0
  204. package/types/conf.d.ts.map +1 -1
  205. package/types/constants/platform.d.ts +1 -0
  206. package/types/constants/platform.d.ts.map +1 -1
  207. package/types/createComponent.d.ts +5 -7
  208. package/types/createComponent.d.ts.map +1 -1
  209. package/types/createFont.d.ts +1 -1
  210. package/types/createFont.d.ts.map +1 -1
  211. package/types/createTamagui.d.ts +3 -1
  212. package/types/createTamagui.d.ts.map +1 -1
  213. package/types/createTokens.d.ts +0 -26
  214. package/types/createTokens.d.ts.map +1 -1
  215. package/types/createVariable.d.ts +1 -0
  216. package/types/createVariable.d.ts.map +1 -1
  217. package/types/defaultComponentState.d.ts +0 -12
  218. package/types/defaultComponentState.d.ts.map +1 -1
  219. package/types/helpers/RNComponents.d.ts +2 -0
  220. package/types/helpers/RNComponents.d.ts.map +1 -0
  221. package/types/helpers/addStylesUsingClassname.d.ts.map +1 -1
  222. package/types/helpers/createPropMapper.d.ts +2 -2
  223. package/types/helpers/createPropMapper.d.ts.map +1 -1
  224. package/types/helpers/createShallowUpdate.d.ts +4 -0
  225. package/types/helpers/createShallowUpdate.d.ts.map +1 -0
  226. package/types/helpers/createTamaguiProvider.d.ts +1 -1
  227. package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
  228. package/types/helpers/extendStaticConfig.d.ts +2 -2
  229. package/types/helpers/extendStaticConfig.d.ts.map +1 -1
  230. package/types/helpers/getSize.d.ts +3 -0
  231. package/types/helpers/getSize.d.ts.map +1 -0
  232. package/types/helpers/getSplitStyles.d.ts +15 -18
  233. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  234. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  235. package/types/helpers/insertStyleRule.d.ts +2 -1
  236. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  237. package/types/helpers/proxyThemeVariables.d.ts +2 -0
  238. package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
  239. package/types/helpers/themeable.d.ts +3 -1
  240. package/types/helpers/themeable.d.ts.map +1 -1
  241. package/types/helpers/validate.d.ts.map +1 -1
  242. package/types/hooks/useFeatures.d.ts +7 -5
  243. package/types/hooks/useFeatures.d.ts.map +1 -1
  244. package/types/hooks/useMedia.d.ts +2 -6
  245. package/types/hooks/useMedia.d.ts.map +1 -1
  246. package/types/hooks/useTheme.d.ts +1 -1
  247. package/types/hooks/useTheme.d.ts.map +1 -1
  248. package/types/index.d.ts +2 -0
  249. package/types/index.d.ts.map +1 -1
  250. package/types/static.d.ts +3 -0
  251. package/types/static.d.ts.map +1 -1
  252. package/types/styled.d.ts +13 -8
  253. package/types/styled.d.ts.map +1 -1
  254. package/types/types-rnw.d.ts +0 -5
  255. package/types/types-rnw.d.ts.map +1 -1
  256. package/types/types.d.ts +147 -106
  257. package/types/types.d.ts.map +1 -1
  258. package/types/views/Stack.d.ts +2 -2
  259. package/types/views/Stack.d.ts.map +1 -1
  260. package/types/views/Text.d.ts +2 -2
  261. package/types/views/Text.d.ts.map +1 -1
  262. package/types/views/Theme.d.ts +1 -0
  263. package/types/views/Theme.d.ts.map +1 -1
  264. package/types/views/ThemeProvider.d.ts +1 -0
  265. package/types/views/ThemeProvider.d.ts.map +1 -1
  266. package/LICENSE +0 -21
  267. package/dist/cjs/spacedChildren.js +0 -86
  268. package/dist/cjs/spacedChildren.js.map +0 -7
  269. package/dist/esm/spacedChildren.js +0 -52
  270. package/dist/esm/spacedChildren.js.map +0 -7
  271. package/dist/jsx/spacedChildren.js +0 -44
  272. package/types/spacedChildren.d.ts +0 -9
  273. package/types/spacedChildren.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useTheme.tsx"],
4
- "sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { ThemeContext } from '../ThemeContext'\nimport { ThemeManager, ThemeManagerContext, emptyManager } from '../ThemeManager'\nimport { ThemeObject } from '../types'\nimport { useConstant } from './useConstant'\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: any,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className, didChangeTheme } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n return useMemo(() => {\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('No theme', { themeName, theme, componentName, className })\n }\n return themes[getConfig().defaultTheme || 'light' || Object.keys(themes)[0]]\n }\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string') {\n if (key[0] === '$') {\n key = key.slice(1)\n }\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (!name || key === '__proto__') {\n return Reflect.get(_, key)\n }\n // TODO make this pattern better\n if (key === GetThemeManager) {\n if (!didChangeTheme) {\n return null\n }\n // TODO\n // console.log('DID CHANGE THEME')\n return themeManager\n }\n if (process.env.NODE_ENV === 'development') {\n if (key === '__state') {\n return state.current\n }\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!themeManager) {\n console.error('No themeManager')\n return\n }\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB accessing theme val', key, { ...state.current })\n }\n }\n if (typeof key === 'string') {\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n const val = themeManager.getValue(key)\n if (val) {\n if (state.current.isRendering) {\n state.current.keys.add(key)\n }\n return val\n }\n if (process.env.NODE_ENV === 'development') {\n console.warn(`No theme value \"${String(key)}\" in ${name}`)\n return null\n }\n }\n return Reflect.get(_, key)\n },\n })\n }, [name, theme, className, didChangeTheme])\n}\n\nconst GetThemeManager = Symbol('GetThemeManager')\n\nexport const getThemeManagerIfChanged = (theme: any) => {\n return theme?.[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: any,\n forceUpdateProp?: any\n) => {\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const { themes } = useContext(ThemeContext)!\n const next = parentManager.getNextTheme({ name, componentName, themes }, props)\n const forceUpdate = forceUpdateProp || useForceUpdate()\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!next) {\n return null\n }\n return new ThemeManager(next.name, next.theme, parentManager)\n })\n\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (next?.name) {\n themeManager.update(next)\n }\n return parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme({ name, componentName, themes }, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n }, [themes, name, componentName, debug, next?.name])\n }\n\n const didChangeTheme = next && parentManager && next.name !== parentManager.fullName\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n didChangeTheme,\n themes,\n themeManager,\n }\n}\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { ThemeContext } from '../ThemeContext'\nimport { ThemeManager, ThemeManagerContext, emptyManager } from '../ThemeManager'\nimport { ThemeObject } from '../types'\nimport { useConstant } from './useConstant'\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: any,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className, didChangeTheme } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n return useMemo(() => {\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('No theme', { themeName, theme, componentName, className })\n }\n return themes[getConfig().defaultTheme || 'light' || Object.keys(themes)[0]]\n }\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string') {\n if (key[0] === '$') {\n key = key.slice(1)\n }\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (!name || key === '__proto__' || typeof key === 'symbol') {\n // TODO make this pattern better\n if (key === GetThemeManager) {\n if (process.env.NODE_ENV === 'development') {\n if (props['debug']) {\n // prettier-ignore\n console.log('did change', { themeName, didChangeTheme, name, componentName }, themeManager?.parentName)\n }\n }\n if (!didChangeTheme) {\n return null\n }\n return themeManager\n }\n return Reflect.get(_, key)\n }\n if (typeof key !== 'string' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n if (process.env.NODE_ENV === 'development') {\n if (key === '__state') {\n return state.current\n }\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!themeManager) {\n console.error('No themeManager')\n return\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n const val = themeManager.getValue(key)\n if (val) {\n if (state.current.isRendering) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB tracking theme key', key)\n }\n }\n }\n return val\n }\n // react native debuger uses toJSON\n if (process.env.NODE_ENV === 'development') {\n console.log(`No theme value \"${String(key)}\" in ${name}`)\n }\n return Reflect.get(_, key)\n },\n })\n }, [name, theme, className, didChangeTheme])\n}\n\nconst GetThemeManager = Symbol('GetThemeManager')\n\nexport const getThemeManagerIfChanged = (theme: any) => {\n return theme?.[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: any,\n forceUpdateProp?: any\n) => {\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const { themes } = useContext(ThemeContext)!\n const next = parentManager.getNextTheme({ name, componentName, themes }, props)\n const forceUpdate = forceUpdateProp || useForceUpdate()\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!next) {\n return null\n }\n return new ThemeManager(next.name, next.theme, parentManager)\n })\n\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (next?.name) {\n themeManager.update(next)\n }\n return parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme({ name, componentName, themes }, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n }, [themes, name, componentName, debug, next?.name])\n }\n\n const didChangeTheme = next && parentManager && next.name !== parentManager.fullName\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n didChangeTheme,\n themes,\n themeManager,\n }\n}\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -8,11 +8,13 @@ import { createTokens } from "./createTokens";
8
8
  export * from "./createVariable";
9
9
  export * from "./styled";
10
10
  export * from "./types";
11
+ import { RNWTextProps, RNWViewProps } from "./types-rnw";
11
12
  import { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from "./conf";
12
13
  export * from "./constants/constants";
13
14
  export * from "./constants/platform";
14
15
  export * from "./constants/rnw";
15
16
  export * from "./helpers/getExpandedShorthands";
17
+ export * from "./helpers/getSize";
16
18
  export * from "./helpers/getSplitStyles";
17
19
  export * from "./helpers/getStylesAtomic";
18
20
  export * from "./helpers/isObj";
@@ -38,6 +40,8 @@ export * from "./views/ThemeProvider";
38
40
  export * from "./views/TextAncestorContext";
39
41
  export * from "@tamagui/helpers";
40
42
  export {
43
+ RNWTextProps,
44
+ RNWViewProps,
41
45
  createTokens,
42
46
  getConfig,
43
47
  getHasConfigured,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport { createTokens } from './createTokens'\nexport * from './createVariable'\nexport * from './styled'\nexport * from './types'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useIsTouchDevice'\nexport * from './hooks/useConstant'\nexport * from './hooks/usePressable'\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useUnmountEffect'\nexport * from '@tamagui/use-force-update'\n\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/Theme'\nexport * from './views/ThemeReset'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/TextAncestorContext'\n\nexport * from '@tamagui/helpers'\n"],
5
- "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;",
4
+ "sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport { createTokens } from './createTokens'\nexport * from './createVariable'\nexport * from './styled'\nexport * from './types'\n// for type portability\nexport { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useIsTouchDevice'\nexport * from './hooks/useConstant'\nexport * from './hooks/usePressable'\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useUnmountEffect'\nexport * from '@tamagui/use-force-update'\n\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/Theme'\nexport * from './views/ThemeReset'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/TextAncestorContext'\n\nexport * from '@tamagui/helpers'\n"],
5
+ "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;",
6
6
  "names": []
7
7
  }
@@ -3,12 +3,15 @@ export * from "./createComponent";
3
3
  export * from "./createFont";
4
4
  export * from "./createTokens";
5
5
  export * from "./createTamagui";
6
+ export * from "./createVariable";
6
7
  export * from "./constants/constants";
7
8
  export * from "./hooks/useMedia";
8
9
  export * from "./hooks/useTheme";
9
10
  export * from "./helpers/isObj";
10
11
  export * from "./helpers/getStylesAtomic";
12
+ export * from "./helpers/proxyThemeVariables";
11
13
  export * from "./helpers/getSplitStyles";
12
14
  export * from "@tamagui/helpers";
13
15
  export * from "./constants/rnw";
16
+ export * from "./types";
14
17
  //# sourceMappingURL=static.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/static.ts"],
4
- "sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createTamagui'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/rnw'\n"],
5
- "mappings": "AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;",
4
+ "sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createTamagui'\nexport * from './createVariable'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/proxyThemeVariables'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/rnw'\n\nexport * from './types'\n"],
5
+ "mappings": "AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import * as ReactNative from "react-native";
4
3
  import { Image, Text, TextInput } from "react-native";
5
4
  import { createComponent } from "./createComponent";
6
- import { extendStaticConfig } from "./helpers/extendStaticConfig";
7
- const RNComponents = /* @__PURE__ */ new WeakMap();
8
- for (const key of ["Image", "TextInput", "Text", "View"]) {
9
- const val = ReactNative[key];
10
- if (val && typeof val === "object") {
11
- RNComponents.set(val, true);
12
- }
13
- }
5
+ import { RNComponents } from "./helpers/RNComponents";
14
6
  function styled(Component, options, staticExtractionOptions) {
15
7
  const staticConfigProps = (() => {
16
8
  if (options) {
@@ -18,7 +10,7 @@ function styled(Component, options, staticExtractionOptions) {
18
10
  if (defaultVariants) {
19
11
  Object.assign(defaultProps, defaultVariants);
20
12
  }
21
- const isReactNativeWeb = RNComponents.has(Component);
13
+ const isReactNativeWeb = "staticConfig" in Component ? Component.staticConfig.isReactNativeWeb : RNComponents.has(Component);
22
14
  const isTamagui = !isReactNativeWeb && "staticConfig" in Component;
23
15
  const Comp = Component;
24
16
  const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false));
@@ -32,6 +24,7 @@ function styled(Component, options, staticExtractionOptions) {
32
24
  isTamagui,
33
25
  variants,
34
26
  defaultProps,
27
+ defaultVariants,
35
28
  componentName: name,
36
29
  isReactNativeWeb,
37
30
  isInput,
@@ -42,8 +35,7 @@ function styled(Component, options, staticExtractionOptions) {
42
35
  }
43
36
  return {};
44
37
  })();
45
- const config = extendStaticConfig(Component, staticConfigProps);
46
- const component = createComponent(config);
38
+ const component = createComponent(staticConfigProps, Component);
47
39
  return component;
48
40
  }
49
41
  __name(styled, "styled");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/styled.tsx"],
4
- "sourcesContent": ["import * as ReactNative from 'react-native'\nimport { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport {\n GetProps,\n GetVariantProps,\n MediaPropKeys,\n MediaProps,\n PseudoProps,\n PsuedoPropKeys,\n StaticComponent,\n StaticConfig,\n StylableComponent,\n VariantDefinitions,\n} from './types'\n\n// bye bye tree shaking... but only way to properly detect react-native components...\n// also neither rnw nor react support tree shaking atm\nconst RNComponents = new WeakMap()\n// I was looping over all of them, but casuses deprecation warnings and there's only a few\n// we realistically support - lets whitelist rather than blacklist\nfor (const key of ['Image', 'TextInput', 'Text', 'View']) {\n const val = ReactNative[key]\n if (val && typeof val === 'object') {\n RNComponents.set(val, true)\n }\n}\n\nexport function styled<\n ParentComponent extends StylableComponent,\n // = VariantDefinitions<GetProps<ParentComponent>> gives type inference to variants: { true: { ... } }\n // but causes \"Type instantiation is excessively deep and possibly infinite.\"...\n Variants extends VariantDefinitions<any> | symbol =\n | VariantDefinitions<GetProps<ParentComponent>>\n | symbol\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n defaultVariants?: Variants extends Object ? GetVariantProps<Variants> : never\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps = (() => {\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n const isReactNativeWeb = RNComponents.has(Component)\n const isTamagui = !isReactNativeWeb && 'staticConfig' in Component\n const Comp = Component as any\n const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false))\n const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false))\n const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false))\n const conf: StaticConfig = {\n ...staticExtractionOptions,\n ...(!isTamagui && {\n Component: Comp,\n }),\n isTamagui,\n // this type gets messed up by options?: Partial<GetProps<ParentComponent>> above\n // take away the Partial<> and it's fine\n variants,\n defaultProps,\n componentName: name,\n isReactNativeWeb,\n isInput,\n isText,\n isImage,\n }\n return conf\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n\n type ParentProps = GetProps<ParentComponent>\n type VariantProps = Variants extends symbol ? {} : Expand<GetVariantProps<Variants>>\n type VariantKeys = Variants extends symbol ? never : keyof Variants[keyof Variants]\n type ParentPropsWithoutOurVariants = VariantKeys extends never\n ? ParentProps\n : Omit<ParentProps, VariantKeys>\n type StyleProps = VariantProps & ParentPropsWithoutOurVariants\n type Props = Variants extends undefined | symbol\n ? ParentProps\n : Omit<\n ParentProps extends Object ? ParentProps : {},\n (VariantKeys extends never ? ImpossibleKey : VariantKeys) | MediaPropKeys | PsuedoPropKeys\n > &\n VariantProps &\n MediaProps<StyleProps> &\n PseudoProps<StyleProps>\n\n return component as StaticComponent<Props, VariantProps>\n}\n\ntype ImpossibleKey = 1234556123312321\ntype Expand<T> = T extends infer O ? { [K in keyof O]?: O[K] } : never\n"],
5
- "mappings": ";;AAAA;AACA;AAEA;AACA;AAgBA,MAAM,eAAe,oBAAI,QAAQ;AAGjC,WAAW,OAAO,CAAC,SAAS,aAAa,QAAQ,MAAM,GAAG;AACxD,QAAM,MAAM,YAAY;AACxB,MAAI,OAAO,OAAO,QAAQ,UAAU;AAClC,iBAAa,IAAI,KAAK,IAAI;AAAA,EAC5B;AACF;AAEO,gBAQL,WAEA,SAKA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAC/B,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,YAAM,mBAAmB,aAAa,IAAI,SAAS;AACnD,YAAM,YAAY,CAAC,oBAAoB,kBAAkB;AACzD,YAAM,OAAO;AACb,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,QAAQ;AAC1E,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,YAAY;AAC9E,YAAM,SAAS,CAAC,CAAE,cAAa,UAAW,EAAC,YAAY,WAAW,SAAS,OAAO;AAClF,YAAM,OAAqB;AAAA,WACtB;AAAA,WACC,CAAC,aAAa;AAAA,UAChB,WAAW;AAAA,QACb;AAAA,QACA;AAAA,QAGA;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,aAAO;AAAA,IACT;AACA,WAAO,CAAC;AAAA,EACV,GAAG;AACH,QAAM,SAAS,mBAAmB,WAAW,iBAAiB;AAC9D,QAAM,YAAY,gBAAgB,MAAO;AAmBzC,SAAO;AACT;AAtEgB;",
4
+ "sourcesContent": ["import { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { RNComponents } from './helpers/RNComponents'\nimport {\n GetProps,\n GetVariantValues,\n MediaProps,\n PseudoProps,\n StaticConfig,\n StylableComponent,\n TamaguiComponent,\n VariantDefinitions,\n VariantSpreadFunction,\n} from './types'\n\n// TODO may be able to use this in the options?: arg below directly\nexport type StyledOptions<ParentComponent extends StylableComponent> = GetProps<ParentComponent> & {\n name?: string\n variants?: VariantDefinitions<ParentComponent> | undefined\n defaultVariants?: { [key: string]: any }\n}\n\nexport function styled<\n ParentComponent extends StylableComponent,\n Variants extends VariantDefinitions<ParentComponent> | symbol =\n | VariantDefinitions<ParentComponent>\n | symbol\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n // thought i had this typed, but can't get it linked\n defaultVariants?: { [key: string]: any }\n },\n staticExtractionOptions?: Partial<StaticConfig>\n) {\n const staticConfigProps = (() => {\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n const isReactNativeWeb =\n 'staticConfig' in Component\n ? Component.staticConfig.isReactNativeWeb\n : RNComponents.has(Component)\n const isTamagui = !isReactNativeWeb && 'staticConfig' in Component\n const Comp = Component as any\n const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false))\n const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false))\n const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false))\n const conf: Partial<StaticConfig> = {\n ...staticExtractionOptions,\n ...(!isTamagui && {\n Component: Comp,\n }),\n isTamagui,\n // this type gets messed up by options?: Partial<GetProps<ParentComponent>> above\n // take away the Partial<> and it's fine\n variants,\n defaultProps,\n defaultVariants,\n componentName: name,\n isReactNativeWeb,\n isInput,\n isText,\n isImage,\n }\n return conf\n }\n return {}\n })()\n\n const component = createComponent(staticConfigProps, Component)\n\n // get parent props without pseudos and medias so we can rebuild both with new variants\n type ParentPropsBase = ParentComponent extends TamaguiComponent<any, any, infer P>\n ? P\n : GetProps<ParentComponent>\n type ParentVariants = ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}\n\n type OurVariants = Variants extends symbol\n ? {}\n : {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n }\n\n type VariantProps = Omit<ParentVariants, keyof OurVariants> & OurVariants\n type OurPropsBase = ParentPropsBase & VariantProps\n\n type Props = Variants extends void | symbol\n ? GetProps<ParentComponent>\n : // start with base props\n OurPropsBase &\n // add in media (+ pseudos nested)\n MediaProps<Partial<OurPropsBase>> &\n // add in pseudos\n PseudoProps<Partial<OurPropsBase>>\n\n return component as TamaguiComponent<\n Props,\n // TODO infer ref\n any,\n ParentPropsBase,\n ParentVariants & OurVariants\n >\n}\n\n// test types:\n// // variants\n// export const XStack = styled(Stack, {\n// flexDirection: 'row',\n// name: 'XStack',\n// variants: {\n// fullscreen: {\n// true: {},\n// },\n// elevation: {\n// '...size': (val) => ({}),\n// },\n// },\n// })\n// const InBetween = styled(XStack, {})\n// type INBVariants = typeof InBetween extends TamaguiComponent<any, any, any, infer Variants> ? Variants: never\n// const SwitchFrame = styled(InBetween, {\n// name: 'Switch',\n// tag: 'button',\n// borderRadius: 100,\n// borderWidth: 0,\n// variants: {\n// name: {\n// true: {\n// backgroundColor: 'aliceblue'\n// },\n// // 1: {\n\n// // },\n// // ':number': (val) => {\n// // return {}\n// // },\n// // \"...fontSize\": (val) => {\n// // return {}\n// // },\n// // \"...color\": (val) => {\n// // return {}\n// // }\n// }\n// },\n// defaultVariants: {\n// size: '$4',\n// },\n// })\n// const x = <XStack fullscreen />\n// const y = <XStack fullscreen />\n// const z = <SwitchFrame fullscreen name />\n\n// depth:\n// export const SizableText = styled(Stack, {\n// name: 'SizableText',\n// backgroundColor: 'red',\n// variants: {\n// size: {\n// '...fontSize': (val, { props }) => {\n// return {\n// backgroundColor: '',\n// }\n// },\n// },\n// },\n// })\n// export const Heading = styled(SizableText, {\n// tag: 'span',\n// name: 'Heading',\n// accessibilityRole: 'header',\n// size: '$8',\n// margin: 0,\n// })\n// export const Paragraph = styled(SizableText, {\n// tag: 'p',\n// margin: 10,\n// variants: {\n// another: {\n// true: {},\n// },\n// },\n// })\n// export const Paragraph2 = styled(Paragraph, {\n// tag: 'p',\n// variants: {\n// another: {\n// '...color': (val) => ({\n// backgroundColor: 'red',\n// }),\n// },\n// },\n// })\n// const a = <SizableText size=\"$10\" />\n// const b = <Paragraph size=\"$10\" another />\n// const c = <Paragraph2 size=\"$10\" another=\"aliceblue\" />\n// export const SizableText2 = styled(SizableText, {\n// })\n// const xx = <SizableText2 abc />\n// export const Paragraph = styled(SizableText, {\n// name: 'Paragraph',\n// })\n// export const Heading = styled(Paragraph, {\n// tag: 'span',\n// margin: 0,\n// })\n// export const H2 = styled(Heading, {\n// name: 'H2',\n// })\n// const x = <H2 color=\"red\" />\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AAoBO,gBAML,WAEA,SAMA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAC/B,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,YAAM,mBACJ,kBAAkB,YACd,UAAU,aAAa,mBACvB,aAAa,IAAI,SAAS;AAChC,YAAM,YAAY,CAAC,oBAAoB,kBAAkB;AACzD,YAAM,OAAO;AACb,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,QAAQ;AAC1E,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,YAAY;AAC9E,YAAM,SAAS,CAAC,CAAE,cAAa,UAAW,EAAC,YAAY,WAAW,SAAS,OAAO;AAClF,YAAM,OAA8B;AAAA,WAC/B;AAAA,WACC,CAAC,aAAa;AAAA,UAChB,WAAW;AAAA,QACb;AAAA,QACA;AAAA,QAGA;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,aAAO;AAAA,IACT;AACA,WAAO,CAAC;AAAA,EACV,GAAG;AAEH,QAAM,YAAY,gBAAgB,mBAAmB,SAAS;AA4B9D,SAAO;AAOT;AAxFgB;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
1
  import { stackDefaultStyles } from "../constants/constants";
2
2
  import { createComponent } from "../createComponent";
3
3
  const Stack = createComponent({
4
+ componentName: "Stack",
4
5
  defaultProps: {
5
6
  ...stackDefaultStyles,
6
7
  flexDirection: "column"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Stack.tsx"],
4
- "sourcesContent": ["import { View } from 'react-native'\n\nimport { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps } from '../types'\n\nexport const Stack = createComponent<StackProps, View>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
5
- "mappings": "AAEA;AACA;AAGO,MAAM,QAAQ,gBAAkC;AAAA,EACrD,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA,EACjB;AACF,CAAC;",
4
+ "sourcesContent": ["import { View } from 'react-native'\n\nimport { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps, StackPropsBase } from '../types'\n\nexport const Stack = createComponent<StackProps, View, StackPropsBase>({\n componentName: 'Stack',\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
5
+ "mappings": "AAEA;AACA;AAGO,MAAM,QAAQ,gBAAkD;AAAA,EACrE,eAAe;AAAA,EACf,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA,EACjB;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -8,6 +8,7 @@ const ellipseStyle = {
8
8
  whiteSpace: "nowrap"
9
9
  };
10
10
  const Text = createComponent({
11
+ componentName: "Text",
11
12
  isText: true,
12
13
  defaultProps: {
13
14
  display: isWeb ? "inline" : "flex",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Text.tsx"],
4
- "sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n ':number': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
5
- "mappings": "AAAA;AAGA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAqC;AAAA,EACvD,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,WAAW,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,EAAE,IAAI;AAAA,IAC9D;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EACA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAC5C,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;",
4
+ "sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n ':number': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
5
+ "mappings": "AAAA;AAGA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,WAAW,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,EAAE,IAAI;AAAA,IAC9D;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EACA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAC5C,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -3,11 +3,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
  import React, { memo, useMemo } from "react";
4
4
  import { isWeb } from "../constants/platform";
5
5
  import { wrapThemeManagerContext } from "../helpers/wrapThemeManagerContext";
6
- import { useChangeThemeEffect } from "../static";
6
+ import { useChangeThemeEffect } from "../hooks/useTheme";
7
7
  React["createElement"];
8
8
  const Theme = memo(/* @__PURE__ */ __name(function Theme2(props) {
9
9
  var _a, _b;
10
- const { name, theme, themeManager, themes, className } = useChangeThemeEffect(props.name, void 0, props);
10
+ const { name, theme, themeManager, themes, className } = useChangeThemeEffect(props.name, props.componentName, props);
11
11
  if (!themes || !name || !theme) {
12
12
  if (name && !theme && process.env.NODE_ENV === "development") {
13
13
  console.warn(`No theme found by name ${name}`);
@@ -16,8 +16,11 @@ const Theme = memo(/* @__PURE__ */ __name(function Theme2(props) {
16
16
  }
17
17
  const contents = useMemo(() => wrapThemeManagerContext(props.children, themeManager), [props.children, themeManager]);
18
18
  if (isWeb) {
19
- return /* @__PURE__ */ React.createElement("div", {
20
- className: props.disableThemeClass ? "" : props.className ? `${className || ""} ${props.className || ""}` : className || "",
19
+ return /* @__PURE__ */ React.createElement("span", {
20
+ className: [
21
+ `tui_Theme`,
22
+ ...!props.disableThemeClass ? [props.className, className].filter(Boolean) : []
23
+ ].join(" "),
21
24
  style: {
22
25
  display: "contents",
23
26
  color: (_b = (_a = themes[name]) == null ? void 0 : _a.color) == null ? void 0 : _b.toString()
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../static'\nimport { ThemeName } from '../types'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n children?: any\n debug?: boolean\n}\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n undefined,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <div\n className={\n props.disableThemeClass\n ? ''\n : props.className\n ? `${className || ''} ${props.className || ''}`\n : className || ''\n }\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </div>\n )\n }\n\n return contents\n})\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAUC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAlB5D;AAmBE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,QACA,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,QACf,MAAM,wBAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WACE,MAAM,oBACF,KACA,MAAM,YACN,GAAG,aAAa,MAAM,MAAM,aAAa,OACzC,aAAa;AAAA,MAEnB,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GA3C0B,QA2CzB;",
4
+ "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeName } from '../types'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n debug?: boolean\n}\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <span\n className={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\n ].join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAWC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAnB5D;AAoBE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,QACf,MAAM,wBAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GAxC0B,QAwCzB;",
6
6
  "names": []
7
7
  }
@@ -20,7 +20,7 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
20
20
  return () => {
21
21
  document.body.classList.remove(cn);
22
22
  };
23
- }, []);
23
+ }, [props.disableRootThemeClass]);
24
24
  }
25
25
  const themeContext = useMemo(() => {
26
26
  return {
@@ -31,6 +31,7 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
31
31
  return /* @__PURE__ */ React.createElement(ThemeContext.Provider, {
32
32
  value: themeContext
33
33
  }, /* @__PURE__ */ React.createElement(Theme, {
34
+ className: props.className,
34
35
  name: props.defaultTheme,
35
36
  disableThemeClass: props.disableRootThemeClass
36
37
  }, props.children));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeProvider.tsx"],
4
- "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n document.body.classList.add(cn)\n return () => {\n document.body.classList.remove(cn)\n }\n }, [])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AAGA,MAAM;AASC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,iBAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,eAAS,KAAK,UAAU,IAAI,EAAE;AAC9B,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,EAAE;AAAA,MACnC;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,oCAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,oCAAC;AAAA,IAAM,MAAM,MAAM;AAAA,IAAc,mBAAmB,MAAM;AAAA,KACvD,MAAM,QACT,CACF;AAEJ,GAjC6B;",
4
+ "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n document.body.classList.add(cn)\n return () => {\n document.body.classList.remove(cn)\n }\n }, [props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AAGA,MAAM;AAUC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,iBAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,eAAS,KAAK,UAAU,IAAI,EAAE;AAC9B,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,EAAE;AAAA,MACnC;AAAA,IACF,GAAG,CAAC,MAAM,qBAAqB,CAAC;AAAA,EAClC;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,oCAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,oCAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ,GArC6B;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,19 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import * as Helpers from "@tamagui/helpers";
4
+ import { getConfig } from "./conf";
3
5
  import { rnw } from "./constants/rnw";
4
- import { getAllSelectors, getAllTransforms } from "./helpers/insertStyleRule";
6
+ import { getAllSelectors, getAllTransforms, getInsertedRules } from "./helpers/insertStyleRule";
5
7
  class TamaguiManager {
6
8
  constructor() {
7
- this.config = null;
8
9
  this.rnw = rnw;
10
+ this.Helpers = Helpers;
11
+ }
12
+ get config() {
13
+ return getConfig();
14
+ }
15
+ get insertedRules() {
16
+ return getInsertedRules();
9
17
  }
10
18
  get allSelectors() {
11
19
  return getAllSelectors();
@@ -16,9 +16,9 @@ var __privateMethod = (obj, member, method) => {
16
16
  var _getClassName, getClassName_fn;
17
17
  import { createContext } from "react";
18
18
  import { getThemes } from "./conf";
19
- import { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from "./static";
19
+ import { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from "./constants/constants";
20
20
  class ThemeManager {
21
- constructor(name = null, theme = null, parentManager = null) {
21
+ constructor(name = "", theme = null, parentManager = null) {
22
22
  this.name = name;
23
23
  this.theme = theme;
24
24
  this.parentManager = parentManager;
@@ -76,7 +76,7 @@ class ThemeManager {
76
76
  return false;
77
77
  }
78
78
  this.className = className || null;
79
- this.name = name || null;
79
+ this.name = name || "";
80
80
  this.theme = theme;
81
81
  this.notifyListeners();
82
82
  return true;
@@ -85,10 +85,14 @@ class ThemeManager {
85
85
  const { themes = getThemes(), name, componentName } = opts;
86
86
  if (!name) {
87
87
  if (componentName) {
88
- const name2 = `${this.name}_${componentName}`;
89
- const theme2 = themes[name2];
90
- if (theme2) {
91
- return { name: name2, theme: theme2, className: __privateMethod(this, _getClassName, getClassName_fn).call(this, name2) };
88
+ const names = [
89
+ `${this.name}_${componentName}`,
90
+ `${withoutComponentName(this.name)}_${componentName}`
91
+ ];
92
+ for (const name2 of names) {
93
+ if (name2 in themes) {
94
+ return { name: name2, theme: themes[name2], className: __privateMethod(this, _getClassName, getClassName_fn).call(this, name2) };
95
+ }
92
96
  }
93
97
  }
94
98
  return {
@@ -113,9 +117,14 @@ class ThemeManager {
113
117
  parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR));
114
118
  }
115
119
  if (componentName) {
116
- const componentThemeName = `${nextName}_${componentName}`;
117
- if (componentThemeName in themes) {
118
- nextName = componentThemeName;
120
+ const names = [
121
+ `${nextName}_${componentName}`,
122
+ `${withoutComponentName(nextName)}_${componentName}`
123
+ ];
124
+ for (const name2 of names) {
125
+ if (name2 in themes) {
126
+ nextName = name2;
127
+ }
119
128
  }
120
129
  }
121
130
  let theme = themes[nextName];
@@ -123,7 +132,7 @@ class ThemeManager {
123
132
  theme = themes[`light_${nextName}`];
124
133
  }
125
134
  if (process.env.NODE_ENV === "development" && props && props["debug"]) {
126
- console.log("getNextTheme", { opts, nextName, parentName }, this);
135
+ console.log("getNextTheme", { name: opts.name, nextName, parentName });
127
136
  }
128
137
  return {
129
138
  name: nextName,
@@ -169,6 +178,7 @@ getClassName_fn = /* @__PURE__ */ __name(function(name) {
169
178
  }, "#getClassName");
170
179
  const ThemeManagerContext = createContext(null);
171
180
  const emptyManager = new ThemeManager();
181
+ const withoutComponentName = /* @__PURE__ */ __name((name) => name.replace(/\_[A-Z][a-z]+$/, ""), "withoutComponentName");
172
182
  export {
173
183
  ThemeManager,
174
184
  ThemeManagerContext,
package/dist/jsx/conf.js CHANGED
@@ -21,7 +21,6 @@ const onConfiguredOnce = /* @__PURE__ */ __name((cb) => {
21
21
  configListeners.add(cb);
22
22
  }
23
23
  if (!globalThis["Tamagui"]) {
24
- Tamagui.config = conf;
25
24
  globalThis["Tamagui"] = Tamagui;
26
25
  }
27
26
  }, "onConfiguredOnce");
@@ -5,6 +5,7 @@ const isAndroid = ((_a = Platform) == null ? void 0 : _a.OS) === "android";
5
5
  const isIOS = ((_b = Platform) == null ? void 0 : _b.OS) === "ios";
6
6
  const isWeb = process.env.TAMAGUI_TARGET !== "native" && (process.env.TAMAGUI_TARGET === "web" || ((_c = Platform) == null ? void 0 : _c.OS) === "web");
7
7
  const isSSR = isWeb && typeof window === "undefined";
8
+ const isClient = isWeb && typeof window !== "undefined";
8
9
  const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
9
10
  const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
10
11
  const supportsTouchWeb = typeof window !== "undefined" && "ontouchstart" in window;
@@ -13,6 +14,7 @@ const isWebIOS = isWeb && typeof navigator !== "undefined" && (/iPad|iPhone|iPod
13
14
  export {
14
15
  isAndroid,
15
16
  isChrome,
17
+ isClient,
16
18
  isIOS,
17
19
  isSSR,
18
20
  isTouchDevice,