@tamagui/web 1.123.17 → 1.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/cjs/Tamagui.cjs +1 -6
  2. package/dist/cjs/Tamagui.js +1 -5
  3. package/dist/cjs/Tamagui.js.map +1 -1
  4. package/dist/cjs/Tamagui.native.js +2 -8
  5. package/dist/cjs/Tamagui.native.js.map +2 -2
  6. package/dist/cjs/createComponent.cjs +9 -13
  7. package/dist/cjs/createComponent.js +10 -8
  8. package/dist/cjs/createComponent.js.map +1 -1
  9. package/dist/cjs/createComponent.native.js +17 -19
  10. package/dist/cjs/createComponent.native.js.map +2 -2
  11. package/dist/cjs/helpers/createShallowSetState.cjs +7 -4
  12. package/dist/cjs/helpers/createShallowSetState.js +12 -6
  13. package/dist/cjs/helpers/createShallowSetState.js.map +1 -1
  14. package/dist/cjs/helpers/createShallowSetState.native.js +10 -4
  15. package/dist/cjs/helpers/createShallowSetState.native.js.map +2 -2
  16. package/dist/cjs/hooks/{shouldDeoptDueToParentScheme.cjs → doesRootSchemeMatchSystem.cjs} +5 -5
  17. package/dist/cjs/hooks/{shouldDeoptDueToParentScheme.js → doesRootSchemeMatchSystem.js} +6 -6
  18. package/dist/cjs/hooks/doesRootSchemeMatchSystem.js.map +6 -0
  19. package/dist/cjs/hooks/doesRootSchemeMatchSystem.native.js +30 -0
  20. package/dist/cjs/hooks/doesRootSchemeMatchSystem.native.js.map +6 -0
  21. package/dist/cjs/hooks/getThemeProxied.cjs +58 -0
  22. package/dist/cjs/hooks/getThemeProxied.js +53 -0
  23. package/dist/cjs/hooks/getThemeProxied.js.map +6 -0
  24. package/dist/cjs/hooks/getThemeProxied.native.js +76 -0
  25. package/dist/cjs/hooks/getThemeProxied.native.js.map +6 -0
  26. package/dist/cjs/hooks/useComponentState.cjs +16 -16
  27. package/dist/cjs/hooks/useComponentState.js +22 -15
  28. package/dist/cjs/hooks/useComponentState.js.map +1 -1
  29. package/dist/cjs/hooks/useComponentState.native.js +15 -15
  30. package/dist/cjs/hooks/useComponentState.native.js.map +2 -2
  31. package/dist/cjs/hooks/useProps.cjs +2 -2
  32. package/dist/cjs/hooks/useProps.js +2 -2
  33. package/dist/cjs/hooks/useProps.js.map +1 -1
  34. package/dist/cjs/hooks/useProps.native.js +2 -2
  35. package/dist/cjs/hooks/useProps.native.js.map +2 -2
  36. package/dist/cjs/hooks/useTheme.cjs +10 -208
  37. package/dist/cjs/hooks/useTheme.js +7 -207
  38. package/dist/cjs/hooks/useTheme.js.map +2 -2
  39. package/dist/cjs/hooks/useTheme.native.js +8 -252
  40. package/dist/cjs/hooks/useTheme.native.js.map +2 -2
  41. package/dist/cjs/hooks/useThemeName.cjs +15 -27
  42. package/dist/cjs/hooks/useThemeName.js +6 -20
  43. package/dist/cjs/hooks/useThemeName.js.map +2 -2
  44. package/dist/cjs/hooks/useThemeName.native.js +16 -22
  45. package/dist/cjs/hooks/useThemeName.native.js.map +2 -2
  46. package/dist/cjs/hooks/useThemeState.cjs +187 -0
  47. package/dist/cjs/hooks/useThemeState.js +159 -0
  48. package/dist/cjs/hooks/useThemeState.js.map +6 -0
  49. package/dist/cjs/hooks/useThemeState.native.js +206 -0
  50. package/dist/cjs/hooks/useThemeState.native.js.map +6 -0
  51. package/dist/cjs/index.cjs +2 -0
  52. package/dist/cjs/index.js +2 -0
  53. package/dist/cjs/index.js.map +1 -1
  54. package/dist/cjs/index.native.js +3 -0
  55. package/dist/cjs/index.native.js.map +1 -1
  56. package/dist/cjs/views/TamaguiProvider.js.map +1 -1
  57. package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
  58. package/dist/cjs/views/Theme.cjs +81 -85
  59. package/dist/cjs/views/Theme.js +44 -51
  60. package/dist/cjs/views/Theme.js.map +2 -2
  61. package/dist/cjs/views/Theme.native.js +58 -58
  62. package/dist/cjs/views/Theme.native.js.map +2 -2
  63. package/dist/cjs/views/ThemeDebug.cjs +21 -43
  64. package/dist/cjs/views/ThemeDebug.js +18 -38
  65. package/dist/cjs/views/ThemeDebug.js.map +2 -2
  66. package/dist/cjs/views/ThemeProvider.cjs +1 -1
  67. package/dist/cjs/views/ThemeProvider.js +1 -1
  68. package/dist/cjs/views/ThemeProvider.js.map +1 -1
  69. package/dist/cjs/views/ThemeProvider.native.js +1 -1
  70. package/dist/cjs/views/ThemeProvider.native.js.map +2 -2
  71. package/dist/esm/Tamagui.js +0 -5
  72. package/dist/esm/Tamagui.js.map +1 -1
  73. package/dist/esm/Tamagui.mjs +0 -5
  74. package/dist/esm/Tamagui.mjs.map +1 -1
  75. package/dist/esm/Tamagui.native.js +1 -8
  76. package/dist/esm/Tamagui.native.js.map +2 -2
  77. package/dist/esm/createComponent.js +9 -8
  78. package/dist/esm/createComponent.js.map +1 -1
  79. package/dist/esm/createComponent.mjs +9 -13
  80. package/dist/esm/createComponent.mjs.map +1 -1
  81. package/dist/esm/createComponent.native.js +16 -19
  82. package/dist/esm/createComponent.native.js.map +2 -2
  83. package/dist/esm/helpers/createShallowSetState.js +13 -7
  84. package/dist/esm/helpers/createShallowSetState.js.map +1 -1
  85. package/dist/esm/helpers/createShallowSetState.mjs +8 -5
  86. package/dist/esm/helpers/createShallowSetState.mjs.map +1 -1
  87. package/dist/esm/helpers/createShallowSetState.native.js +11 -5
  88. package/dist/esm/helpers/createShallowSetState.native.js.map +2 -2
  89. package/dist/esm/hooks/doesRootSchemeMatchSystem.js +7 -0
  90. package/dist/esm/hooks/doesRootSchemeMatchSystem.js.map +6 -0
  91. package/dist/esm/hooks/doesRootSchemeMatchSystem.mjs +5 -0
  92. package/dist/esm/hooks/doesRootSchemeMatchSystem.mjs.map +1 -0
  93. package/dist/esm/hooks/doesRootSchemeMatchSystem.native.js +10 -0
  94. package/dist/esm/hooks/doesRootSchemeMatchSystem.native.js.map +6 -0
  95. package/dist/esm/hooks/getThemeProxied.js +40 -0
  96. package/dist/esm/hooks/getThemeProxied.js.map +6 -0
  97. package/dist/esm/hooks/getThemeProxied.mjs +35 -0
  98. package/dist/esm/hooks/getThemeProxied.mjs.map +1 -0
  99. package/dist/esm/hooks/getThemeProxied.native.js +59 -0
  100. package/dist/esm/hooks/getThemeProxied.native.js.map +6 -0
  101. package/dist/esm/hooks/useComponentState.js +22 -15
  102. package/dist/esm/hooks/useComponentState.js.map +1 -1
  103. package/dist/esm/hooks/useComponentState.mjs +16 -16
  104. package/dist/esm/hooks/useComponentState.mjs.map +1 -1
  105. package/dist/esm/hooks/useComponentState.native.js +15 -15
  106. package/dist/esm/hooks/useComponentState.native.js.map +2 -2
  107. package/dist/esm/hooks/useProps.js +2 -2
  108. package/dist/esm/hooks/useProps.js.map +1 -1
  109. package/dist/esm/hooks/useProps.mjs +2 -2
  110. package/dist/esm/hooks/useProps.mjs.map +1 -1
  111. package/dist/esm/hooks/useProps.native.js +2 -2
  112. package/dist/esm/hooks/useProps.native.js.map +2 -2
  113. package/dist/esm/hooks/useTheme.js +9 -220
  114. package/dist/esm/hooks/useTheme.js.map +2 -2
  115. package/dist/esm/hooks/useTheme.mjs +10 -205
  116. package/dist/esm/hooks/useTheme.mjs.map +1 -1
  117. package/dist/esm/hooks/useTheme.native.js +11 -257
  118. package/dist/esm/hooks/useTheme.native.js.map +2 -2
  119. package/dist/esm/hooks/useThemeName.js +4 -12
  120. package/dist/esm/hooks/useThemeName.js.map +2 -2
  121. package/dist/esm/hooks/useThemeName.mjs +11 -12
  122. package/dist/esm/hooks/useThemeName.mjs.map +1 -1
  123. package/dist/esm/hooks/useThemeName.native.js +15 -14
  124. package/dist/esm/hooks/useThemeName.native.js.map +2 -2
  125. package/dist/esm/hooks/useThemeState.js +151 -0
  126. package/dist/esm/hooks/useThemeState.js.map +6 -0
  127. package/dist/esm/hooks/useThemeState.mjs +159 -0
  128. package/dist/esm/hooks/useThemeState.mjs.map +1 -0
  129. package/dist/esm/hooks/useThemeState.native.js +182 -0
  130. package/dist/esm/hooks/useThemeState.native.js.map +6 -0
  131. package/dist/esm/index.js +2 -0
  132. package/dist/esm/index.js.map +1 -1
  133. package/dist/esm/index.mjs +2 -1
  134. package/dist/esm/index.mjs.map +1 -1
  135. package/dist/esm/index.native.js +2 -0
  136. package/dist/esm/index.native.js.map +2 -2
  137. package/dist/esm/views/TamaguiProvider.js.map +1 -1
  138. package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
  139. package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
  140. package/dist/esm/views/Theme.js +57 -54
  141. package/dist/esm/views/Theme.js.map +2 -2
  142. package/dist/esm/views/Theme.mjs +81 -85
  143. package/dist/esm/views/Theme.mjs.map +1 -1
  144. package/dist/esm/views/Theme.native.js +61 -61
  145. package/dist/esm/views/Theme.native.js.map +2 -2
  146. package/dist/esm/views/ThemeDebug.js +16 -29
  147. package/dist/esm/views/ThemeDebug.js.map +1 -1
  148. package/dist/esm/views/ThemeDebug.mjs +16 -27
  149. package/dist/esm/views/ThemeDebug.mjs.map +1 -1
  150. package/dist/esm/views/ThemeProvider.js +2 -2
  151. package/dist/esm/views/ThemeProvider.js.map +1 -1
  152. package/dist/esm/views/ThemeProvider.mjs +2 -2
  153. package/dist/esm/views/ThemeProvider.mjs.map +1 -1
  154. package/dist/esm/views/ThemeProvider.native.js +2 -2
  155. package/dist/esm/views/ThemeProvider.native.js.map +2 -2
  156. package/package.json +11 -11
  157. package/src/Tamagui.ts +0 -6
  158. package/src/createComponent.tsx +19 -28
  159. package/src/helpers/createShallowSetState.tsx +17 -8
  160. package/src/hooks/doesRootSchemeMatchSystem.native.ts +7 -0
  161. package/src/hooks/doesRootSchemeMatchSystem.ts +4 -0
  162. package/src/hooks/getThemeProxied.ts +165 -0
  163. package/src/hooks/useComponentState.ts +26 -21
  164. package/src/hooks/useProps.tsx +2 -2
  165. package/src/hooks/useTheme.tsx +22 -633
  166. package/src/hooks/useThemeName.tsx +6 -18
  167. package/src/hooks/useThemeState.ts +341 -0
  168. package/src/index.ts +1 -0
  169. package/src/types.tsx +2 -2
  170. package/src/views/TamaguiProvider.tsx +1 -1
  171. package/src/views/Theme.tsx +129 -132
  172. package/src/views/ThemeDebug.native.tsx +2 -2
  173. package/src/views/ThemeDebug.tsx +17 -39
  174. package/src/views/ThemeProvider.tsx +2 -2
  175. package/types/Tamagui.d.ts +0 -2
  176. package/types/Tamagui.d.ts.map +1 -1
  177. package/types/createComponent.d.ts.map +1 -1
  178. package/types/helpers/createShallowSetState.d.ts +1 -1
  179. package/types/helpers/createShallowSetState.d.ts.map +1 -1
  180. package/types/hooks/doesRootSchemeMatchSystem.d.ts +2 -0
  181. package/types/hooks/doesRootSchemeMatchSystem.d.ts.map +1 -0
  182. package/types/hooks/doesRootSchemeMatchSystem.native.d.ts +2 -0
  183. package/types/hooks/doesRootSchemeMatchSystem.native.d.ts.map +1 -0
  184. package/types/hooks/getThemeProxied.d.ts +25 -0
  185. package/types/hooks/getThemeProxied.d.ts.map +1 -0
  186. package/types/hooks/useComponentState.d.ts.map +1 -1
  187. package/types/hooks/useConfiguration.d.ts.map +1 -1
  188. package/types/hooks/useTheme.d.ts +9 -36
  189. package/types/hooks/useTheme.d.ts.map +1 -1
  190. package/types/hooks/useThemeName.d.ts +1 -3
  191. package/types/hooks/useThemeName.d.ts.map +1 -1
  192. package/types/hooks/useThemeState.d.ts +22 -0
  193. package/types/hooks/useThemeState.d.ts.map +1 -0
  194. package/types/index.d.ts +1 -0
  195. package/types/index.d.ts.map +1 -1
  196. package/types/types.d.ts +2 -2
  197. package/types/types.d.ts.map +1 -1
  198. package/types/views/Theme.d.ts +3 -3
  199. package/types/views/Theme.d.ts.map +1 -1
  200. package/types/views/ThemeDebug.d.ts +2 -2
  201. package/types/views/ThemeDebug.d.ts.map +1 -1
  202. package/types/views/ThemeDebug.native.d.ts +2 -2
  203. package/types/views/ThemeDebug.native.d.ts.map +1 -1
  204. package/dist/cjs/helpers/ThemeManager.cjs +0 -202
  205. package/dist/cjs/helpers/ThemeManager.js +0 -183
  206. package/dist/cjs/helpers/ThemeManager.js.map +0 -6
  207. package/dist/cjs/helpers/ThemeManager.native.js +0 -282
  208. package/dist/cjs/helpers/ThemeManager.native.js.map +0 -6
  209. package/dist/cjs/helpers/ThemeManagerContext.cjs +0 -38
  210. package/dist/cjs/helpers/ThemeManagerContext.js +0 -30
  211. package/dist/cjs/helpers/ThemeManagerContext.js.map +0 -6
  212. package/dist/cjs/helpers/ThemeManagerContext.native.js +0 -34
  213. package/dist/cjs/helpers/ThemeManagerContext.native.js.map +0 -6
  214. package/dist/cjs/hooks/shouldDeoptDueToParentScheme.js.map +0 -6
  215. package/dist/cjs/hooks/shouldDeoptDueToParentScheme.native.js +0 -50
  216. package/dist/cjs/hooks/shouldDeoptDueToParentScheme.native.js.map +0 -6
  217. package/dist/esm/helpers/ThemeManager.js +0 -169
  218. package/dist/esm/helpers/ThemeManager.js.map +0 -6
  219. package/dist/esm/helpers/ThemeManager.mjs +0 -177
  220. package/dist/esm/helpers/ThemeManager.mjs.map +0 -1
  221. package/dist/esm/helpers/ThemeManager.native.js +0 -261
  222. package/dist/esm/helpers/ThemeManager.native.js.map +0 -6
  223. package/dist/esm/helpers/ThemeManagerContext.js +0 -6
  224. package/dist/esm/helpers/ThemeManagerContext.js.map +0 -6
  225. package/dist/esm/helpers/ThemeManagerContext.mjs +0 -4
  226. package/dist/esm/helpers/ThemeManagerContext.mjs.map +0 -1
  227. package/dist/esm/helpers/ThemeManagerContext.native.js +0 -6
  228. package/dist/esm/helpers/ThemeManagerContext.native.js.map +0 -6
  229. package/dist/esm/hooks/shouldDeoptDueToParentScheme.js +0 -7
  230. package/dist/esm/hooks/shouldDeoptDueToParentScheme.js.map +0 -6
  231. package/dist/esm/hooks/shouldDeoptDueToParentScheme.mjs +0 -5
  232. package/dist/esm/hooks/shouldDeoptDueToParentScheme.mjs.map +0 -1
  233. package/dist/esm/hooks/shouldDeoptDueToParentScheme.native.js +0 -29
  234. package/dist/esm/hooks/shouldDeoptDueToParentScheme.native.js.map +0 -6
  235. package/src/helpers/ThemeManager.tsx +0 -405
  236. package/src/helpers/ThemeManagerContext.tsx +0 -4
  237. package/src/hooks/shouldDeoptDueToParentScheme.native.tsx +0 -37
  238. package/src/hooks/shouldDeoptDueToParentScheme.tsx +0 -6
  239. package/types/helpers/ThemeManager.d.ts +0 -45
  240. package/types/helpers/ThemeManager.d.ts.map +0 -1
  241. package/types/helpers/ThemeManagerContext.d.ts +0 -4
  242. package/types/helpers/ThemeManagerContext.d.ts.map +0 -1
  243. package/types/hooks/shouldDeoptDueToParentScheme.d.ts +0 -3
  244. package/types/hooks/shouldDeoptDueToParentScheme.d.ts.map +0 -1
  245. package/types/hooks/shouldDeoptDueToParentScheme.native.d.ts +0 -3
  246. package/types/hooks/shouldDeoptDueToParentScheme.native.d.ts.map +0 -1
@@ -26,21 +26,20 @@ __export(Theme_exports, {
26
26
  getThemedChildren: () => getThemedChildren
27
27
  });
28
28
  module.exports = __toCommonJS(Theme_exports);
29
- var import_constants = require("@tamagui/constants"), import_react = __toESM(require("react")), import_createVariable = require("../createVariable"), import_log = require("../helpers/log"), import_ThemeManagerContext = require("../helpers/ThemeManagerContext"), import_useTheme = require("../hooks/useTheme"), import_ThemeDebug = require("./ThemeDebug"), import_jsx_runtime = require("react/jsx-runtime");
30
- const Theme = (0, import_react.forwardRef)(function({ children, ...props }, ref) {
29
+ var import_constants = require("@tamagui/constants"), import_react = __toESM(require("react")), import_config = require("../config"), import_createVariable = require("../createVariable"), import_useTheme = require("../hooks/useTheme"), import_useThemeState = require("../hooks/useThemeState"), import_ThemeDebug = require("./ThemeDebug"), import_jsx_runtime = require("react/jsx-runtime");
30
+ const empty = { className: "", style: {} }, Theme = (0, import_react.forwardRef)(function(props, ref) {
31
31
  if (props.disable)
32
- return children;
33
- const isRoot = !!props._isRoot, themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot);
32
+ return props.children;
33
+ const isRoot = !!props._isRoot, [_, themeState] = (0, import_useTheme.useThemeWithState)(props, isRoot);
34
34
  let finalChildren = props["disable-child-theme"] ? import_react.Children.map(
35
- children,
35
+ props.children,
36
36
  (child) => (0, import_react.cloneElement)(child, { "data-disable-theme": !0 })
37
- ) : children;
37
+ ) : props.children;
38
38
  if (ref)
39
39
  try {
40
40
  import_react.default.Children.only(finalChildren), finalChildren = (0, import_react.cloneElement)(finalChildren, { ref });
41
41
  } catch {
42
42
  }
43
- process.env.NODE_ENV === "development" && props.debug === "visualize" && (finalChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: finalChildren }));
44
43
  const stateRef = (0, import_react.useRef)({
45
44
  hasEverThemed: !1
46
45
  });
@@ -48,55 +47,49 @@ const Theme = (0, import_react.forwardRef)(function({ children, ...props }, ref)
48
47
  });
49
48
  Theme.avoidForwardRef = !0;
50
49
  function getThemedChildren(themeState, children, props, isRoot = !1, stateRef) {
51
- const { themeManager, isNewTheme } = themeState;
52
- if (!themeManager)
53
- return children;
54
- const { shallow, forceClassName } = props;
55
- let shouldRenderChildrenWithTheme = isNewTheme || isRoot || "inverse" in props || "name" in props || "reset" in props || "forceClassName" in props || stateRef.current.hasEverThemed;
56
- if (shouldRenderChildrenWithTheme && (stateRef.current.hasEverThemed = !0), !shouldRenderChildrenWithTheme)
50
+ const { shallow, forceClassName } = props, state = stateRef.current;
51
+ if (!(state.hasEverThemed || themeState.isNew || isRoot || (0, import_useThemeState.hasThemeUpdatingProps)(props)))
57
52
  return children;
58
- process.env.NODE_ENV === "development" && shouldRenderChildrenWithTheme && props.debug === "verbose" && (0, import_log.log)(
59
- `adding theme: isRoot ${isRoot}, inverse ${"inverse" in props}, isNewTheme ${isNewTheme}, hasEver ${stateRef.current.hasEverThemed}`,
60
- props
61
- );
62
- let next = children;
63
- shallow && (next = import_react.Children.toArray(children).map((child) => (0, import_react.isValidElement)(child) ? (0, import_react.cloneElement)(
64
- child,
65
- void 0,
66
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children })
67
- ) : child));
68
- const elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, { value: themeManager, children: next });
69
- return forceClassName === !1 ? elementsWithContext : import_constants.isWeb ? wrapThemeElements({
70
- children: elementsWithContext,
71
- themeState,
53
+ children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useThemeState.ThemeStateContext.Provider, { value: themeState.id, children });
54
+ const { isInverse, name } = themeState, requiresExtraWrapper = isInverse || forceClassName;
55
+ if (state.hasEverThemed || (state.hasEverThemed = !0), (requiresExtraWrapper || // if the theme is exactly dark or light, its likely to change between dark/light
56
+ // and that would require wrapping which would re-parent, so to avoid re-parenting do this
57
+ themeState.name === "dark" || themeState.name === "light") && (state.hasEverThemed = "wrapped"), shallow && themeState.parentId) {
58
+ const parentState = (0, import_useThemeState.getThemeState)(
59
+ themeState.isNew ? themeState.id : themeState.parentId
60
+ );
61
+ if (!parentState) throw new Error("\u203C\uFE0F010");
62
+ children = import_react.Children.toArray(children).map((child) => (0, import_react.isValidElement)(child) ? (0, import_react.cloneElement)(
63
+ child,
64
+ void 0,
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: parentState.name, children: child.props.children })
66
+ ) : child);
67
+ }
68
+ if (process.env.NODE_ENV === "development" && props.debug && (console.warn(" getThemedChildren", {
69
+ requiresExtraWrapper,
72
70
  forceClassName,
73
- isRoot
74
- }) : elementsWithContext;
75
- }
76
- function wrapThemeElements({
77
- children,
78
- themeState,
79
- forceClassName,
80
- isRoot
81
- }) {
82
- if (isRoot && forceClassName === !1)
71
+ themeState,
72
+ state,
73
+ ...getThemeClassNameAndStyle(themeState, props, isRoot)
74
+ }), children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children })), forceClassName === !1)
75
+ return children;
76
+ if (import_constants.isWeb) {
77
+ const { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot);
78
+ if (children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children }), state.hasEverThemed === "wrapped") {
79
+ const className2 = requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} _dsp_contents` : "_dsp_contents";
80
+ children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: className2, children });
81
+ }
83
82
  return children;
84
- const inverse = themeState.inversed, requiresExtraWrapper = typeof inverse == "boolean" || forceClassName, { className, style } = getThemeClassNameAndStyle(themeState, isRoot);
85
- let themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
86
- if (requiresExtraWrapper) {
87
- const name = themeState.state?.name || "", inverseClassName = name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "";
88
- themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${inverse ? inverseClassName : ""} _dsp_contents`, children: themedChildren });
89
83
  }
90
- return themedChildren;
84
+ return children;
91
85
  }
92
- const emptyObj = {};
93
- function getThemeClassNameAndStyle(themeState, isRoot = !1) {
94
- if (!themeState.isNewTheme)
95
- return { className: "", style: emptyObj };
96
- const themeColor = themeState.state?.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
86
+ function getThemeClassNameAndStyle(themeState, props, isRoot = !1) {
87
+ if (!themeState.isNew && !props.forceClassName)
88
+ return empty;
89
+ const themeColor = themeState?.theme && themeState.isNew ? (0, import_createVariable.variableToString)(themeState.theme.color) : "", style = themeColor ? {
97
90
  color: themeColor
98
- } : void 0;
99
- let className = themeState.state?.className || "";
100
- return isRoot && (className = className.replace("t_sub_theme", "")), { style, className };
91
+ } : void 0, maxInverses = (0, import_config.getSetting)("maxDarkLightNesting") || 3, themeClassName = themeState.inverses >= maxInverses ? themeState.name : themeState.name.replace(schemePrefix, ""), className = `${isRoot ? "" : "t_sub_theme"} t_${themeClassName}`;
92
+ return { style, className };
101
93
  }
94
+ const schemePrefix = /^(dark|light)_/;
102
95
  //# sourceMappingURL=Theme.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB,+BAEtB,eAAkF,2BAClF,wBAAiC,8BACjC,aAAoB,2BACpB,6BAAoC,2CAEpC,kBAAqC,8BAErC,oBAA2B,yBA8BnB;AA5BD,MAAM,YAAQ,yBAAW,SAAe,EAAE,UAAU,GAAG,MAAM,GAAe,KAAK;AAEtF,MAAI,MAAM;AACR,WAAO;AAGT,QAAM,SAAS,CAAC,CAAC,MAAM,SACjB,iBAAa,sCAAqB,OAAO,MAAM;AAGrD,MAAI,gBAF4B,MAAM,qBAAqB,IAGvD,sBAAS;AAAA,IAAI;AAAA,IAAU,CAAC,cACtB,2BAAa,OAAO,EAAG,sBAAuB,GAAK,CAAC;AAAA,EACtD,IACA;AAEJ,MAAI;AACF,QAAI;AACF,mBAAAA,QAAM,SAAS,KAAK,aAAa,GACjC,oBAAgB,2BAAa,eAAe,EAAE,IAAI,CAAC;AAAA,IACrD,QAAQ;AAAA,IAER;AAGF,EAAI,QAAQ,IAAI,aAAa,iBACvB,MAAM,UAAU,gBAClB,gBACE,4CAAC,gCAAW,YAAwB,YAAY,OAC7C,yBACH;AAKN,QAAM,eAAW,qBAAO;AAAA,IACtB,eAAe;AAAA,EACjB,CAAC;AAED,SAAO,kBAAkB,YAAY,eAAe,OAAO,QAAQ,QAAQ;AAC7E,CAAC;AAED,MAAM,kBAAqB;AAEpB,SAAS,kBACd,YACA,UACA,OACA,SAAS,IACT,UACA;AACA,QAAM,EAAE,cAAc,WAAW,IAAI;AAGrC,MAAI,CAAC;AACH,WAAO;A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,2BAA2B,OACrD,UACH,GAIE,MAAM,kBAAkB,WAAW;AAErC,YAAMC,aAAY,uBACd,GACE,YACI,KAAK,WAAW,OAAO,IACrB,wBACA,KAAK,WAAW,MAAM,IACpB,uBACA,KACJ,EACN,mBACA;AACJ,iBAAW,4CAAC,UAAK,WAAWA,YAAY,UAAS;AAAA,IACnD;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,SAAS,0BACP,YACA,OACA,SAAS,IACT;AACA,MAAI,CAAC,WAAW,SAAS,CAAC,MAAM;AAC9B,WAAO;AAIT,QAAM,aACJ,YAAY,SAAS,WAAW,YAAQ,wCAAiB,WAAW,MAAM,KAAK,IAAI,IAE/E,QAAQ,aACV;AAAA,IACE,OAAO;AAAA,EACT,IACA,QAEE,kBAAc,0BAAW,qBAAqB,KAAK,GACnD,iBACJ,WAAW,YAAY,cACnB,WAAW,OACX,WAAW,KAAK,QAAQ,cAAc,EAAE,GAExC,YAAY,GAAG,SAAS,KAAK,aAAa,MAAM,cAAc;AAEpE,SAAO,EAAE,OAAO,UAAU;AAC5B;AAEA,MAAM,eAAe;",
5
+ "names": ["React", "className"]
6
6
  }
@@ -27,15 +27,17 @@ __export(Theme_exports, {
27
27
  getThemedChildren: () => getThemedChildren
28
28
  });
29
29
  module.exports = __toCommonJS(Theme_exports);
30
- var import_jsx_runtime = require("react/jsx-runtime"), import_constants = require("@tamagui/constants"), import_react = __toESM(require("react")), import_createVariable = require("../createVariable"), import_log = require("../helpers/log"), import_ThemeManagerContext = require("../helpers/ThemeManagerContext"), import_useTheme = require("../hooks/useTheme"), import_ThemeDebug = require("./ThemeDebug"), Theme = /* @__PURE__ */ (0, import_react.forwardRef)(function(param, ref) {
31
- var { children, ...props } = param;
30
+ var import_jsx_runtime = require("react/jsx-runtime"), import_constants = require("@tamagui/constants"), import_react = __toESM(require("react")), import_config = require("../config"), import_createVariable = require("../createVariable"), import_useTheme = require("../hooks/useTheme"), import_useThemeState = require("../hooks/useThemeState"), import_ThemeDebug = require("./ThemeDebug"), empty = {
31
+ className: "",
32
+ style: {}
33
+ }, Theme = /* @__PURE__ */ (0, import_react.forwardRef)(function(props, ref) {
32
34
  if (props.disable)
33
- return children;
34
- var isRoot = !!props._isRoot, themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), disableDirectChildTheme = props["disable-child-theme"], finalChildren = disableDirectChildTheme ? import_react.Children.map(children, function(child) {
35
+ return props.children;
36
+ var isRoot = !!props._isRoot, [_, themeState] = (0, import_useTheme.useThemeWithState)(props, isRoot), disableDirectChildTheme = props["disable-child-theme"], finalChildren = disableDirectChildTheme ? import_react.Children.map(props.children, function(child) {
35
37
  return /* @__PURE__ */ (0, import_react.cloneElement)(child, {
36
38
  "data-disable-theme": !0
37
39
  });
38
- }) : children;
40
+ }) : props.children;
39
41
  if (ref)
40
42
  try {
41
43
  import_react.default.Children.only(finalChildren), finalChildren = /* @__PURE__ */ (0, import_react.cloneElement)(finalChildren, {
@@ -43,11 +45,6 @@ var import_jsx_runtime = require("react/jsx-runtime"), import_constants = requir
43
45
  });
44
46
  } catch {
45
47
  }
46
- process.env.NODE_ENV === "development" && props.debug === "visualize" && (finalChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, {
47
- themeState,
48
- themeProps: props,
49
- children: finalChildren
50
- }));
51
48
  var stateRef = (0, import_react.useRef)({
52
49
  hasEverThemed: !1
53
50
  });
@@ -55,65 +52,68 @@ var import_jsx_runtime = require("react/jsx-runtime"), import_constants = requir
55
52
  });
56
53
  Theme.avoidForwardRef = !0;
57
54
  function getThemedChildren(themeState, children, props) {
58
- var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, stateRef = arguments.length > 4 ? arguments[4] : void 0, { themeManager, isNewTheme } = themeState;
59
- if (!themeManager)
60
- return children;
61
- var { shallow, forceClassName } = props, shouldRenderChildrenWithTheme = isNewTheme || isRoot || "inverse" in props || "name" in props || "reset" in props || "forceClassName" in props || stateRef.current.hasEverThemed;
62
- if (shouldRenderChildrenWithTheme && (stateRef.current.hasEverThemed = !0), !shouldRenderChildrenWithTheme)
63
- return children;
64
- process.env.NODE_ENV === "development" && shouldRenderChildrenWithTheme && props.debug === "verbose" && (0, import_log.log)(`adding theme: isRoot ${isRoot}, inverse ${"inverse" in props}, isNewTheme ${isNewTheme}, hasEver ${stateRef.current.hasEverThemed}`, props);
65
- var next = children;
66
- shallow && (next = import_react.Children.toArray(children).map(function(child) {
67
- return /* @__PURE__ */ (0, import_react.isValidElement)(child) ? /* @__PURE__ */ (0, import_react.cloneElement)(child, void 0, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, {
68
- name: themeManager.state.parentName,
69
- children: child.props.children
70
- })) : child;
71
- }));
72
- var elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, {
73
- value: themeManager,
74
- children: next
75
- });
76
- return forceClassName === !1 ? elementsWithContext : import_constants.isWeb ? wrapThemeElements({
77
- children: elementsWithContext,
78
- themeState,
79
- forceClassName,
80
- isRoot
81
- }) : elementsWithContext;
82
- }
83
- function wrapThemeElements(param) {
84
- var { children, themeState, forceClassName, isRoot } = param;
85
- if (isRoot && forceClassName === !1)
55
+ var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, stateRef = arguments.length > 4 ? arguments[4] : void 0, { shallow, forceClassName } = props, state = stateRef.current, hasEverThemed = state.hasEverThemed, shouldRenderChildrenWithTheme = hasEverThemed || themeState.isNew || isRoot || (0, import_useThemeState.hasThemeUpdatingProps)(props);
56
+ if (!shouldRenderChildrenWithTheme)
86
57
  return children;
87
- var inverse = themeState.inversed, requiresExtraWrapper = typeof inverse == "boolean" || forceClassName, { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
88
- className: `${className} _dsp_contents is_Theme`,
89
- style,
58
+ children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useThemeState.ThemeStateContext.Provider, {
59
+ value: themeState.id,
90
60
  children
91
61
  });
92
- if (requiresExtraWrapper) {
93
- var _themeState_state, name = ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", inverseClassName = name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "";
94
- themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
95
- className: `${inverse ? inverseClassName : ""} _dsp_contents`,
96
- children: themedChildren
62
+ var { isInverse, name } = themeState, requiresExtraWrapper = isInverse || forceClassName;
63
+ if (state.hasEverThemed || (state.hasEverThemed = !0), (requiresExtraWrapper || // if the theme is exactly dark or light, its likely to change between dark/light
64
+ // and that would require wrapping which would re-parent, so to avoid re-parenting do this
65
+ themeState.name === "dark" || themeState.name === "light") && (state.hasEverThemed = "wrapped"), shallow && themeState.parentId) {
66
+ var parentState = (0, import_useThemeState.getThemeState)(themeState.isNew ? themeState.id : themeState.parentId);
67
+ if (!parentState) throw new Error("\u203C\uFE0F010");
68
+ children = import_react.Children.toArray(children).map(function(child) {
69
+ return /* @__PURE__ */ (0, import_react.isValidElement)(child) ? /* @__PURE__ */ (0, import_react.cloneElement)(child, void 0, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, {
70
+ name: parentState.name,
71
+ children: child.props.children
72
+ })) : child;
97
73
  });
98
74
  }
99
- return themedChildren;
75
+ if (process.env.NODE_ENV === "development" && props.debug && (console.warn(" getThemedChildren", {
76
+ requiresExtraWrapper,
77
+ forceClassName,
78
+ themeState,
79
+ state,
80
+ ...getThemeClassNameAndStyle(themeState, props, isRoot)
81
+ }), children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, {
82
+ themeState,
83
+ themeProps: props,
84
+ children
85
+ })), forceClassName === !1)
86
+ return children;
87
+ if (import_constants.isWeb) {
88
+ var { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot);
89
+ if (children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
90
+ className: `${className} _dsp_contents is_Theme`,
91
+ style,
92
+ children
93
+ }), state.hasEverThemed === "wrapped") {
94
+ var className1 = requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} _dsp_contents` : "_dsp_contents";
95
+ children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
96
+ className: className1,
97
+ children
98
+ });
99
+ }
100
+ return children;
101
+ }
102
+ return children;
100
103
  }
101
- var emptyObj = {};
102
- function getThemeClassNameAndStyle(themeState) {
103
- var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, _themeState_state, _themeState_state1;
104
- if (!themeState.isNewTheme)
105
- return {
106
- className: "",
107
- style: emptyObj
108
- };
109
- var themeColor = !((_themeState_state = themeState.state) === null || _themeState_state === void 0) && _themeState_state.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
104
+ function getThemeClassNameAndStyle(themeState, props) {
105
+ var isRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
106
+ if (!themeState.isNew && !props.forceClassName)
107
+ return empty;
108
+ var themeColor = themeState != null && themeState.theme && themeState.isNew ? (0, import_createVariable.variableToString)(themeState.theme.color) : "", style = themeColor ? {
110
109
  color: themeColor
111
- } : void 0, className = ((_themeState_state1 = themeState.state) === null || _themeState_state1 === void 0 ? void 0 : _themeState_state1.className) || "";
112
- return isRoot && (className = className.replace("t_sub_theme", "")), {
110
+ } : void 0, maxInverses = (0, import_config.getSetting)("maxDarkLightNesting") || 3, themeClassName = themeState.inverses >= maxInverses ? themeState.name : themeState.name.replace(schemePrefix, ""), className = `${isRoot ? "" : "t_sub_theme"} t_${themeClassName}`;
111
+ return {
113
112
  style,
114
113
  className
115
114
  };
116
115
  }
116
+ var schemePrefix = /^(dark|light)_/;
117
117
  // Annotate the CommonJS export names for ESM import in node:
118
118
  0 && (module.exports = {
119
119
  Theme,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Users/n8/tamagui/code/core/web/src/views/Theme.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,mBAAsB,+BAEtB,eAAkF,2BAClF,wBAAiC,8BACjC,aAAoB,2BACpB,6BAAoC,2CAEpC,kBAAqC,8BAErC,oBAA2B,yBAEdA,QAAQC,6CAAW,SAAe,OAAoCC,KAAG;MAAvC,EAAEC,UAAU,GAAGC,MAAAA,IAAf;AAE7C,MAAIA,MAAMC;AACR,WAAOF;AAGT,MAAMG,SAAS,CAAC,CAACF,MAAM,SACjBG,iBAAaC,sCAAqBJ,OAAOE,MAAAA,GACzCG,0BAA0BL,MAAM,qBAAA,GAElCM,gBAAgBD,0BAChBE,sBAASC,IAAIT,UAAU,SAACU,OAAAA;WACtBC,+CAAaD,OAAO;MAAG,sBAAuB;IAAK,CAAA;OAErDV;AAEJ,MAAID;AACF,QAAI;AACFa,mBAAAA,QAAMJ,SAASK,KAAKN,aAAAA,GACpBA,gBAAgBI,+CAAaJ,eAAe;QAAER;MAAI,CAAA;IACpD,QAAQ;IAER;AAGF,EAAIe,QAAQC,IAAIC,aAAa,iBACvBf,MAAMgB,UAAU,gBAClBV,gBACE,uCAAAW,KAACC,8BAAAA;IAAWf;IAAwBgB,YAAYnB;cAC7CM;;AAMT,MAAMc,eAAWC,qBAAO;IACtBC,eAAe;EACjB,CAAA;AAEA,SAAOC,kBAAkBpB,YAAYG,eAAeN,OAAOE,QAAQkB,QAAAA;AACrE,CAAA;AAEAxB,MAAM,kBAAqB;AAEpB,SAAS2B,kBACdpB,YACAJ,UACAC,OAAiB;MACjBE,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IACTkB,WAAAA,UAAAA,SAAAA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AKJ,WAAW,GAAGA,SAAAA;IAAoCC;;;AAM1D,MAAIF,sBAAsB;QACX3C,mBAAPgC,SAAOhC,oBAAAA,WAAWiC,WAAK,QAAhBjC,sBAAAA,SAAAA,SAAAA,kBAAkBgC,SAAQ,IACjCiB,mBAAmBjB,KAAKkB,WAAW,OAAA,IACrC,wBACAlB,KAAKkB,WAAW,MAAA,IACd,uBACA;AAENH,qBACE,uCAAAjC,KAACkC,QAAAA;MAAKJ,WAAW,GAAGH,UAAUQ,mBAAmB,EAAA;gBAC9CF;;EAGP;AAEA,SAAOA;AACT;AAEA,IAAMI,WAAW,CAAC;AAElB,SAASL,0BAA0B9C,YAAgC;MAAED,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IAO1EC,mBAUcA;AAhBhB,MAAI,CAACA,WAAWsB;AACd,WAAO;MAAEsB,WAAW;MAAIC,OAAOM;IAAS;AAI1C,MAAMC,aACJpD,uBAAAA,WAAWiC,WAAK,QAAhBjC,sBAAAA,WAAAA,kBAAkBqD,SAASrD,WAAWsB,iBAClCgC,wCAAiBtD,WAAWiC,MAAMoB,MAAME,KAAK,IAC7C,IAEAV,QAAQO,aACV;IACEG,OAAOH;EACT,IACArB,QAEAa,cAAY5C,qBAAAA,WAAWiC,WAAK,QAAhBjC,uBAAAA,SAAAA,SAAAA,mBAAkB4C,cAAa;AAC/C,SAAI7C,WACF6C,YAAYA,UAAUY,QAAQ,eAAe,EAAA,IAExC;IAAEX;IAAOD;EAAU;AAC5B;",
5
- "names": ["Theme", "forwardRef", "ref", "children", "props", "disable", "isRoot", "themeState", "useChangeThemeEffect", "disableDirectChildTheme", "finalChildren", "Children", "map", "child", "cloneElement", "React", "only", "process", "env", "NODE_ENV", "debug", "_jsx", "ThemeDebug", "themeProps", "stateRef", "useRef", "hasEverThemed", "getThemedChildren", "themeManager", "isNewTheme", "shallow", "forceClassName", "shouldRenderChildrenWithTheme", "current", "log", "next", "toArray", "isValidElement", "undefined", "name", "state", "parentName", "elementsWithContext", "ThemeManagerContext", "Provider", "value", "isWeb", "wrapThemeElements", "inverse", "inversed", "requiresExtraWrapper", "className", "style", "getThemeClassNameAndStyle", "themedChildren", "span", "inverseClassName", "startsWith", "emptyObj", "themeColor", "theme", "variableToString", "color", "replace"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,mBAAsB,+BAEtB,eAOO,2BACP,gBAA2B,sBAC3B,wBAAiC,8BACjC,kBAAkC,8BAClC,uBAKO,mCAEP,oBAA2B,yBAErBA,QAAQ;EAAEC,WAAW;EAAIC,OAAO,CAAC;AAAE,GAE5BC,QAAQC,6CAAW,SAAeC,OAAmBC,KAAG;AAEnE,MAAID,MAAME;AACR,WAAOF,MAAMG;AAGf,MAAMC,SAAS,CAAC,CAACJ,MAAM,SACjB,CAACK,GAAGC,UAAAA,QAAcC,mCAAkBP,OAAOI,MAAAA,GAE3CI,0BAA0BR,MAAM,qBAAA,GAElCS,gBAAgBD,0BAChBE,sBAASC,IAAIX,MAAMG,UAAU,SAACS,OAAAA;WAC5BC,+CAAaD,OAAO;MAAG,sBAAuB;IAAK,CAAA;OAErDZ,MAAMG;AAEV,MAAIF;AACF,QAAI;AACFa,mBAAAA,QAAMJ,SAASK,KAAKN,aAAAA,GACpBA,gBAAgBI,+CAAaJ,eAAe;QAAER;MAAI,CAAA;IACpD,QAAQ;IAER;AAGF,MAAMe,eAAWC,qBAAO;IACtBC,eAAe;EACjB,CAAA;AAEA,SAAOC,kBAAkBb,YAAYG,eAAeT,OAAOI,QAAQY,QAAAA;AACrE,CAAA;AAEAlB,MAAM,kBAAqB;AAEpB,SAASqB,kBACdb,YACAH,UACAH,OAAiB;MACjBI,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IACTY,WAAAA,UAAAA,SAAAA,IAAAA,UAAAA,CAAAA,IAAAA,QAEM,EAAEI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W,GAAGA,SAAAA;MAAoCC;;QAMtDyB,MAAMJ,kBAAkB,WAAW;AAErC,UAAMtB,aAAYsC,uBACd,GACEF,YACIC,KAAKoB,WAAW,OAAA,IACd,wBACApB,KAAKoB,WAAW,MAAA,IACd,uBACA,KACJ,EAAA,mBAEN;AACJlD,iBAAW,uCAAAwB,KAACyB,QAAAA;QAAKxD,WAAWA;;;IAC9B;AAEA,WAAOO;EACT;AAEA,SAAOA;AACT;AAEA,SAAS6C,0BACP1C,YACAN,OAAiB;MACjBI,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS;AAET,MAAI,CAACE,WAAWmB,SAAS,CAACzB,MAAMqB;AAC9B,WAAO1B;AAIT,MAAM2D,aACJhD,cAAAA,QAAAA,WAAYiD,SAASjD,WAAWmB,YAAQ+B,wCAAiBlD,WAAWiD,MAAME,KAAK,IAAI,IAE/E5D,QAAQyD,aACV;IACEG,OAAOH;EACT,IACAb,QAEEiB,kBAAcC,0BAAW,qBAAA,KAA0B,GACnDC,iBACJtD,WAAWuD,YAAYH,cACnBpD,WAAW2B,OACX3B,WAAW2B,KAAK6B,QAAQC,cAAc,EAAA,GAEtCnE,YAAY,GAAGQ,SAAS,KAAK,aAAA,MAAmBwD,cAAAA;AAEtD,SAAO;IAAE/D;IAAOD;EAAU;AAC5B;AAEA,IAAMmE,eAAe;",
5
+ "names": ["empty", "className", "style", "Theme", "forwardRef", "props", "ref", "disable", "children", "isRoot", "_", "themeState", "useThemeWithState", "disableDirectChildTheme", "finalChildren", "Children", "map", "child", "cloneElement", "React", "only", "stateRef", "useRef", "hasEverThemed", "getThemedChildren", "shallow", "forceClassName", "state", "current", "shouldRenderChildrenWithTheme", "isNew", "hasThemeUpdatingProps", "_jsx", "ThemeStateContext", "Provider", "value", "id", "isInverse", "name", "requiresExtraWrapper", "parentId", "parentState", "getThemeState", "Error", "toArray", "isValidElement", "undefined", "process", "env", "NODE_ENV", "debug", "console", "warn", "getThemeClassNameAndStyle", "ThemeDebug", "themeProps", "isWeb", "span", "startsWith", "themeColor", "theme", "variableToString", "color", "maxInverses", "getSetting", "themeClassName", "inverses", "replace", "schemePrefix"]
6
6
  }
@@ -1,9 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all) __defProp(target, name, {
9
7
  get: all[name],
@@ -17,26 +15,16 @@ var __export = (target, all) => {
17
15
  });
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
32
21
  var ThemeDebug_exports = {};
33
22
  __export(ThemeDebug_exports, {
34
23
  ThemeDebug: () => ThemeDebug
35
24
  });
36
25
  module.exports = __toCommonJS(ThemeDebug_exports);
37
- var import_react = __toESM(require("react")),
38
- import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr"),
39
- import_use_force_update = require("@tamagui/use-force-update"),
26
+ var import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr"),
27
+ import_react = require("react"),
40
28
  import_react_dom = require("react-dom"),
41
29
  import_jsx_runtime = require("react/jsx-runtime");
42
30
  let node;
@@ -46,17 +34,9 @@ function ThemeDebug({
46
34
  children
47
35
  }) {
48
36
  if (process.env.NODE_ENV === "development") {
49
- const isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(),
50
- [onChangeCount, setOnChangeCount] = import_react.default.useState(0),
51
- rerender = (0, import_use_force_update.useForceUpdate)(),
52
- id = import_react.default.useId();
53
- return process.env.NODE_ENV === "development" && typeof document < "u" && (node || (node = document.createElement("div"), node.style.height = "200px", node.style.overflowY = "scroll", node.style.position = "fixed", node.style.zIndex = 1e7, node.style.bottom = "30px", node.style.left = "30px", node.style.right = "30px", node.style.display = "flex", node.style.border = "1px solid #888", node.style.flexDirection = "row", node.style.background = "var(--background)", document.body.appendChild(node))), import_react.default.useEffect(() => {
54
- themeState.themeManager?.parentManager?.onChangeTheme((name, manager) => {
55
- setOnChangeCount(p => ++p), console.warn(`theme changed for ${themeState.themeManager?.id} from parent ${themeState.themeManager?.parentManager?.id} to new name`, name);
56
- });
57
- }, [themeState.themeManager]), import_react.default.useEffect(() => {
58
- const tm = setInterval(rerender, 1e3);
59
- return () => clearTimeout(tm);
37
+ const isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();
38
+ return process.env.NODE_ENV === "development" && typeof document < "u" && (node || (node = document.createElement("div"), node.style.height = "200px", node.style.overflowY = "scroll", node.style.position = "fixed", node.style.zIndex = 1e7, node.style.bottom = "30px", node.style.left = "30px", node.style.right = "30px", node.style.display = "flex", node.style.border = "1px solid #888", node.style.flexDirection = "row", node.style.background = "var(--background)")), (0, import_react.useEffect)(() => {
39
+ document.body.appendChild(node);
60
40
  }, []), themeProps["disable-child-theme"] || !isHydrated ? children : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
61
41
  children: [(0, import_react_dom.createPortal)(/* @__PURE__ */(0, import_jsx_runtime.jsxs)("code", {
62
42
  style: {
@@ -65,25 +45,23 @@ function ThemeDebug({
65
45
  overflow: "auto",
66
46
  padding: 5
67
47
  },
68
- children: ["<Theme ", id, " />\xA0", JSON.stringify({
69
- propsName: themeProps.name,
70
- name: themeState?.state?.name,
71
- className: themeState?.state?.className,
72
- inverse: themeProps.inverse,
73
- forceClassName: themeProps.forceClassName,
74
- parent: themeState.themeManager?.state.parentName,
75
- id: themeState.themeManager?.id,
76
- parentId: themeState.themeManager?.parentManager?.id,
77
- isNew: themeState.isNewTheme,
78
- onChangeCount,
79
- listening: [...(themeState.themeManager?._listeningIds || [])].join(","),
80
- _numChangeEventsSent: themeState.themeManager?._numChangeEventsSent
48
+ children: ["<Theme ", themeState.id, " />\xA0", JSON.stringify({
49
+ name: themeState.name,
50
+ parentId: themeState.parentId,
51
+ inverses: themeState.inverses,
52
+ isNew: themeState.isNew,
53
+ themeProps: {
54
+ name: themeProps.name,
55
+ componentName: themeProps.componentName,
56
+ reset: themeProps.reset,
57
+ inverse: themeProps.inverse
58
+ }
81
59
  }, null, 2)]
82
60
  }), node), /* @__PURE__ */(0, import_jsx_runtime.jsx)("div", {
83
61
  style: {
84
62
  color: "red"
85
63
  },
86
- children: id
64
+ children: themeState.id
87
65
  }), children]
88
66
  });
89
67
  }
@@ -1,8 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
7
  __defProp(target, name, { get: all[name], enumerable: !0 });
@@ -12,20 +11,13 @@ var __export = (target, all) => {
12
11
  !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
12
  return to;
14
13
  };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
15
  var ThemeDebug_exports = {};
24
16
  __export(ThemeDebug_exports, {
25
17
  ThemeDebug: () => ThemeDebug
26
18
  });
27
19
  module.exports = __toCommonJS(ThemeDebug_exports);
28
- var import_react = __toESM(require("react")), import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr"), import_use_force_update = require("@tamagui/use-force-update"), import_react_dom = require("react-dom"), import_jsx_runtime = require("react/jsx-runtime");
20
+ var import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr"), import_react = require("react"), import_react_dom = require("react-dom"), import_jsx_runtime = require("react/jsx-runtime");
29
21
  let node;
30
22
  function ThemeDebug({
31
23
  themeState,
@@ -33,17 +25,9 @@ function ThemeDebug({
33
25
  children
34
26
  }) {
35
27
  if (process.env.NODE_ENV === "development") {
36
- const isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), [onChangeCount, setOnChangeCount] = import_react.default.useState(0), rerender = (0, import_use_force_update.useForceUpdate)(), id = import_react.default.useId();
37
- return process.env.NODE_ENV === "development" && typeof document < "u" && (node || (node = document.createElement("div"), node.style.height = "200px", node.style.overflowY = "scroll", node.style.position = "fixed", node.style.zIndex = 1e7, node.style.bottom = "30px", node.style.left = "30px", node.style.right = "30px", node.style.display = "flex", node.style.border = "1px solid #888", node.style.flexDirection = "row", node.style.background = "var(--background)", document.body.appendChild(node))), import_react.default.useEffect(() => {
38
- themeState.themeManager?.parentManager?.onChangeTheme((name, manager) => {
39
- setOnChangeCount((p) => ++p), console.warn(
40
- `theme changed for ${themeState.themeManager?.id} from parent ${themeState.themeManager?.parentManager?.id} to new name`,
41
- name
42
- );
43
- });
44
- }, [themeState.themeManager]), import_react.default.useEffect(() => {
45
- const tm = setInterval(rerender, 1e3);
46
- return () => clearTimeout(tm);
28
+ const isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();
29
+ return process.env.NODE_ENV === "development" && typeof document < "u" && (node || (node = document.createElement("div"), node.style.height = "200px", node.style.overflowY = "scroll", node.style.position = "fixed", node.style.zIndex = 1e7, node.style.bottom = "30px", node.style.left = "30px", node.style.right = "30px", node.style.display = "flex", node.style.border = "1px solid #888", node.style.flexDirection = "row", node.style.background = "var(--background)")), (0, import_react.useEffect)(() => {
30
+ document.body.appendChild(node);
47
31
  }, []), themeProps["disable-child-theme"] || !isHydrated ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
48
32
  (0, import_react_dom.createPortal)(
49
33
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -57,24 +41,20 @@ function ThemeDebug({
57
41
  },
58
42
  children: [
59
43
  "<Theme ",
60
- id,
44
+ themeState.id,
61
45
  " />\xA0",
62
46
  JSON.stringify(
63
47
  {
64
- propsName: themeProps.name,
65
- name: themeState?.state?.name,
66
- className: themeState?.state?.className,
67
- inverse: themeProps.inverse,
68
- forceClassName: themeProps.forceClassName,
69
- parent: themeState.themeManager?.state.parentName,
70
- id: themeState.themeManager?.id,
71
- parentId: themeState.themeManager?.parentManager?.id,
72
- isNew: themeState.isNewTheme,
73
- onChangeCount,
74
- listening: [...themeState.themeManager?._listeningIds || []].join(
75
- ","
76
- ),
77
- _numChangeEventsSent: themeState.themeManager?._numChangeEventsSent
48
+ name: themeState.name,
49
+ parentId: themeState.parentId,
50
+ inverses: themeState.inverses,
51
+ isNew: themeState.isNew,
52
+ themeProps: {
53
+ name: themeProps.name,
54
+ componentName: themeProps.componentName,
55
+ reset: themeProps.reset,
56
+ inverse: themeProps.inverse
57
+ }
78
58
  },
79
59
  null,
80
60
  2
@@ -84,7 +64,7 @@ function ThemeDebug({
84
64
  ),
85
65
  node
86
66
  ),
87
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: "red" }, children: id }),
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: "red" }, children: themeState.id }),
88
68
  children
89
69
  ] });
90
70
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeDebug.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,4BAAgC,wCAChC,0BAA+B,sCAC/B,mBAA6B,sBAyDvB;AApDN,IAAI;AAEG,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AACF,GAAgF;AAC9E,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,UAAM,iBAAa,2CAAgB,GAC7B,CAAC,eAAe,gBAAgB,IAAI,aAAAA,QAAM,SAAS,CAAC,GACpD,eAAW,wCAAe,GAC1B,KAAK,aAAAA,QAAM,MAAM;AAoCvB,WAlCI,QAAQ,IAAI,aAAa,iBAAiB,OAAO,WAAa,QAC3D,SACH,OAAO,SAAS,cAAc,KAAK,GACnC,KAAK,MAAM,SAAS,SACpB,KAAK,MAAM,YAAY,UACvB,KAAK,MAAM,WAAW,SACtB,KAAK,MAAM,SAAS,KACpB,KAAK,MAAM,SAAS,QACpB,KAAK,MAAM,OAAO,QAClB,KAAK,MAAM,QAAQ,QACnB,KAAK,MAAM,UAAU,QACrB,KAAK,MAAM,SAAS,kBACpB,KAAK,MAAM,gBAAgB,OAC3B,KAAK,MAAM,aAAa,qBACxB,SAAS,KAAK,YAAY,IAAI,KAIlC,aAAAA,QAAM,UAAU,MAAM;AACpB,iBAAW,cAAc,eAAe,c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F;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA;AAAA;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA,MAEA,4CAAC,SAAI,OAAO,EAAE,OAAO,MAAM,GAAI,qBAAW,IAAG;AAAA,MAE5C;AAAA,OACH;AAAA,EAEJ;AACA,SAAO;AACT;AAEA,WAAW,cAAiB;",
5
+ "names": []
6
6
  }
@@ -54,7 +54,7 @@ const ThemeProvider = props => {
54
54
  className: props.className,
55
55
  name: props.defaultTheme,
56
56
  forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
57
- _isRoot: !0,
57
+ _isRoot: import_react.useId,
58
58
  children: props.children
59
59
  });
60
60
  };
@@ -40,7 +40,7 @@ const ThemeProvider = (props) => {
40
40
  className: props.className,
41
41
  name: props.defaultTheme,
42
42
  forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
43
- _isRoot: !0,
43
+ _isRoot: import_react.useId,
44
44
  children: props.children
45
45
  }
46
46
  );
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeProvider.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,mBAAyB,+BAEzBA,oBAAuC,mCACvC,eAAsB,oBACtB,gBAA2B,sBAiCvB;AApBG,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,wBACJ,MAAM,6BAAyB,0BAAW,uBAAuB,GAC7D,uBACJ,MAAM,4BAAwB,0BAAW,sBAAsB;AAGjE,SAAI,6BACF,aAAAC,QAAM,gBAAgB,MAAM;AAC1B,QAAI,sBAAuB;AAC3B,UAAM,KAAK,GAAG,wCAAsB,GAAG,MAAM,YAAY,IACnD,SAAS,uBAAuB,SAAS,kBAAkB,SAAS;AAC1E,kBAAO,UAAU,IAAI,EAAE,GAChB,MAAM;AACX,aAAO,UAAU,OAAO,EAAE;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,MAAM,cAAc,uBAAuB,oBAAoB,CAAC,GAIpE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MAEZ,gBAAgB,CAAC,yBAAyB,CAAC;AAAA,MAE3C,SAAO;AAAA,MAEN,gBAAM;AAAA;AAAA,EACT;AAEJ;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B,2BAC7B,mBAAyB,+BAEzBA,oBAAuC,mCACvC,eAAsB,oBACtB,gBAA2B,sBAiCvB;AApBG,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,wBACJ,MAAM,6BAAyB,0BAAW,uBAAuB,GAC7D,uBACJ,MAAM,4BAAwB,0BAAW,sBAAsB;AAGjE,SAAI,6BACF,aAAAC,QAAM,gBAAgB,MAAM;AAC1B,QAAI,sBAAuB;AAC3B,UAAM,KAAK,GAAG,wCAAsB,GAAG,MAAM,YAAY,IACnD,SAAS,uBAAuB,SAAS,kBAAkB,SAAS;AAC1E,kBAAO,UAAU,IAAI,EAAE,GAChB,MAAM;AACX,aAAO,UAAU,OAAO,EAAE;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,MAAM,cAAc,uBAAuB,oBAAoB,CAAC,GAIpE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MAEZ,gBAAgB,CAAC,yBAAyB,CAAC;AAAA,MAE3C,SAAS;AAAA,MAER,gBAAM;AAAA;AAAA,EACT;AAEJ;",
5
5
  "names": ["import_constants", "React"]
6
6
  }
@@ -45,7 +45,7 @@ var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(re
45
45
  // if root class disabled, force class here
46
46
  forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
47
47
  // @ts-expect-error
48
- _isRoot: !0,
48
+ _isRoot: import_react.useId,
49
49
  children: props.children
50
50
  });
51
51
  };