@tamagui/core 1.0.1-beta.141 → 1.0.1-beta.142

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 (200) hide show
  1. package/dist/cjs/Tamagui.js +2 -2
  2. package/dist/cjs/Tamagui.js.map +2 -2
  3. package/dist/cjs/addTheme.js +28 -22
  4. package/dist/cjs/addTheme.js.map +2 -2
  5. package/dist/cjs/config.js +75 -0
  6. package/dist/cjs/config.js.map +7 -0
  7. package/dist/cjs/constants/platform.js +7 -1
  8. package/dist/cjs/constants/platform.js.map +2 -2
  9. package/dist/cjs/constants/platform.native.js +62 -0
  10. package/dist/cjs/constants/platform.native.js.map +7 -0
  11. package/dist/cjs/createComponent.js +71 -58
  12. package/dist/cjs/createComponent.js.map +2 -2
  13. package/dist/cjs/createComponent.server.js +431 -0
  14. package/dist/cjs/createComponent.server.js.map +7 -0
  15. package/dist/cjs/createTamagui.js +10 -8
  16. package/dist/cjs/createTamagui.js.map +2 -2
  17. package/dist/cjs/createVariable.js +6 -12
  18. package/dist/cjs/createVariable.js.map +2 -2
  19. package/dist/cjs/createVariables.js +5 -2
  20. package/dist/cjs/createVariables.js.map +2 -2
  21. package/dist/cjs/helpers/RNComponents.js +11 -11
  22. package/dist/cjs/helpers/RNComponents.js.map +2 -2
  23. package/dist/cjs/helpers/ThemeManager.js +7 -9
  24. package/dist/cjs/helpers/ThemeManager.js.map +2 -2
  25. package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -1
  26. package/dist/cjs/helpers/assignNativePropsToWeb.js.map +2 -2
  27. package/dist/cjs/helpers/createPropMapper.js +3 -3
  28. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  29. package/dist/cjs/helpers/expandStyles.js +4 -4
  30. package/dist/cjs/helpers/expandStyles.js.map +2 -2
  31. package/dist/cjs/helpers/getAnimationDriver.js +32 -0
  32. package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
  33. package/dist/cjs/helpers/getExpandedShorthands.js +3 -3
  34. package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
  35. package/dist/cjs/helpers/getFont.js +1 -1
  36. package/dist/cjs/helpers/getFont.js.map +2 -2
  37. package/dist/cjs/helpers/getSize.js +2 -2
  38. package/dist/cjs/helpers/getSize.js.map +2 -2
  39. package/dist/cjs/helpers/getSplitStyles.js +12 -13
  40. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  41. package/dist/cjs/helpers/getStylesAtomic.js +6 -4
  42. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  43. package/dist/cjs/helpers/getVariantExtras.js +2 -2
  44. package/dist/cjs/helpers/getVariantExtras.js.map +2 -2
  45. package/dist/cjs/helpers/normalizeColor.js +2 -2
  46. package/dist/cjs/helpers/normalizeColor.js.map +2 -2
  47. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
  48. package/dist/cjs/helpers/useAnimationDriver.js +2 -0
  49. package/dist/cjs/helpers/useAnimationDriver.js.map +7 -0
  50. package/dist/cjs/hooks/getThemeUnwrapped.js +2 -0
  51. package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
  52. package/dist/cjs/hooks/useAnimationDriver.js +2 -0
  53. package/dist/cjs/hooks/useAnimationDriver.js.map +7 -0
  54. package/dist/cjs/hooks/useFeatures.js +2 -2
  55. package/dist/cjs/hooks/useFeatures.js.map +2 -2
  56. package/dist/cjs/hooks/useServerContext.js +21 -0
  57. package/dist/cjs/hooks/useServerContext.js.map +7 -0
  58. package/dist/cjs/hooks/useServerHooks.js +36 -0
  59. package/dist/cjs/hooks/useServerHooks.js.map +7 -0
  60. package/dist/cjs/hooks/useTheme.js +71 -41
  61. package/dist/cjs/hooks/useTheme.js.map +2 -2
  62. package/dist/cjs/index.js +7 -6
  63. package/dist/cjs/index.js.map +2 -2
  64. package/dist/cjs/injectStyles.js +40 -0
  65. package/dist/cjs/injectStyles.js.map +7 -0
  66. package/dist/cjs/insertFont.js +2 -2
  67. package/dist/cjs/insertFont.js.map +2 -2
  68. package/dist/cjs/styled.js +11 -1
  69. package/dist/cjs/styled.js.map +2 -2
  70. package/dist/cjs/types.js.map +1 -1
  71. package/dist/cjs/views/TamaguiProvider.js +6 -1
  72. package/dist/cjs/views/TamaguiProvider.js.map +2 -2
  73. package/dist/cjs/views/ThemeProvider.js +9 -5
  74. package/dist/cjs/views/ThemeProvider.js.map +2 -2
  75. package/dist/esm/Tamagui.js +1 -1
  76. package/dist/esm/Tamagui.js.map +1 -1
  77. package/dist/esm/addTheme.js +27 -21
  78. package/dist/esm/addTheme.js.map +2 -2
  79. package/dist/esm/config.js +43 -0
  80. package/dist/esm/config.js.map +7 -0
  81. package/dist/esm/constants/platform.js +5 -1
  82. package/dist/esm/constants/platform.js.map +2 -2
  83. package/dist/esm/constants/platform.native.js +28 -0
  84. package/dist/esm/constants/platform.native.js.map +7 -0
  85. package/dist/esm/createComponent.js +71 -60
  86. package/dist/esm/createComponent.js.map +2 -2
  87. package/dist/esm/createComponent.server.js +408 -0
  88. package/dist/esm/createComponent.server.js.map +7 -0
  89. package/dist/esm/createTamagui.js +7 -5
  90. package/dist/esm/createTamagui.js.map +2 -2
  91. package/dist/esm/createVariable.js +6 -12
  92. package/dist/esm/createVariable.js.map +2 -2
  93. package/dist/esm/createVariables.js +5 -2
  94. package/dist/esm/createVariables.js.map +2 -2
  95. package/dist/esm/helpers/RNComponents.js +11 -8
  96. package/dist/esm/helpers/RNComponents.js.map +2 -2
  97. package/dist/esm/helpers/ThemeManager.js +6 -8
  98. package/dist/esm/helpers/ThemeManager.js.map +2 -2
  99. package/dist/esm/helpers/assignNativePropsToWeb.js +0 -1
  100. package/dist/esm/helpers/assignNativePropsToWeb.js.map +2 -2
  101. package/dist/esm/helpers/createPropMapper.js +2 -2
  102. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  103. package/dist/esm/helpers/expandStyles.js +3 -3
  104. package/dist/esm/helpers/expandStyles.js.map +2 -2
  105. package/dist/esm/helpers/getAnimationDriver.js +8 -0
  106. package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
  107. package/dist/esm/helpers/getExpandedShorthands.js +2 -2
  108. package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
  109. package/dist/esm/helpers/getFont.js +1 -1
  110. package/dist/esm/helpers/getFont.js.map +2 -2
  111. package/dist/esm/helpers/getSize.js +1 -1
  112. package/dist/esm/helpers/getSize.js.map +1 -1
  113. package/dist/esm/helpers/getSplitStyles.js +12 -13
  114. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  115. package/dist/esm/helpers/getStylesAtomic.js +5 -3
  116. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  117. package/dist/esm/helpers/getVariantExtras.js +1 -1
  118. package/dist/esm/helpers/getVariantExtras.js.map +1 -1
  119. package/dist/esm/helpers/normalizeColor.js +1 -1
  120. package/dist/esm/helpers/normalizeColor.js.map +1 -1
  121. package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
  122. package/dist/esm/helpers/useAnimationDriver.js +1 -0
  123. package/dist/esm/helpers/useAnimationDriver.js.map +7 -0
  124. package/dist/esm/hooks/getThemeUnwrapped.js +2 -0
  125. package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
  126. package/dist/esm/hooks/useAnimationDriver.js +1 -0
  127. package/dist/esm/hooks/useAnimationDriver.js.map +7 -0
  128. package/dist/esm/hooks/useFeatures.js +1 -1
  129. package/dist/esm/hooks/useFeatures.js.map +2 -2
  130. package/dist/esm/hooks/useServerContext.js +4 -0
  131. package/dist/esm/hooks/useServerContext.js.map +7 -0
  132. package/dist/esm/hooks/useServerHooks.js +11 -0
  133. package/dist/esm/hooks/useServerHooks.js.map +7 -0
  134. package/dist/esm/hooks/useTheme.js +72 -42
  135. package/dist/esm/hooks/useTheme.js.map +2 -2
  136. package/dist/esm/index.js +2 -1
  137. package/dist/esm/index.js.map +2 -2
  138. package/dist/esm/injectStyles.js +16 -0
  139. package/dist/esm/injectStyles.js.map +7 -0
  140. package/dist/esm/insertFont.js +1 -1
  141. package/dist/esm/insertFont.js.map +1 -1
  142. package/dist/esm/styled.js +11 -1
  143. package/dist/esm/styled.js.map +2 -2
  144. package/dist/esm/views/TamaguiProvider.js +7 -2
  145. package/dist/esm/views/TamaguiProvider.js.map +2 -2
  146. package/dist/esm/views/ThemeProvider.js +9 -5
  147. package/dist/esm/views/ThemeProvider.js.map +2 -2
  148. package/package.json +35 -14
  149. package/src/Tamagui.ts +1 -1
  150. package/src/addTheme.ts +33 -21
  151. package/src/{conf.ts → config.ts} +4 -0
  152. package/src/constants/platform.native.ts +14 -0
  153. package/src/constants/platform.ts +12 -1
  154. package/src/createComponent.tsx +164 -148
  155. package/src/createTamagui.ts +11 -5
  156. package/src/createVariable.ts +8 -25
  157. package/src/createVariables.ts +5 -2
  158. package/src/helpers/RNComponents.tsx +13 -13
  159. package/src/helpers/ThemeManager.tsx +15 -12
  160. package/src/helpers/assignNativePropsToWeb.tsx +0 -1
  161. package/src/helpers/createPropMapper.ts +2 -2
  162. package/src/helpers/expandStyles.ts +4 -3
  163. package/src/helpers/getAnimationDriver.tsx +5 -0
  164. package/src/helpers/getExpandedShorthands.ts +2 -2
  165. package/src/helpers/getFont.tsx +1 -1
  166. package/src/helpers/getSize.ts +1 -1
  167. package/src/helpers/getSplitStyles.tsx +12 -13
  168. package/src/helpers/getStylesAtomic.ts +6 -3
  169. package/src/helpers/getVariantExtras.tsx +2 -2
  170. package/src/helpers/normalizeColor.ts +1 -1
  171. package/src/helpers/normalizeValueWithProperty.ts +2 -0
  172. package/src/hooks/getThemeUnwrapped.tsx +1 -0
  173. package/src/hooks/useFeatures.tsx +2 -1
  174. package/src/hooks/useServerHooks.tsx +13 -0
  175. package/src/hooks/useTheme.tsx +94 -48
  176. package/src/index.ts +2 -1
  177. package/src/injectStyles.ts +20 -0
  178. package/src/insertFont.ts +1 -1
  179. package/src/styled.tsx +15 -1
  180. package/src/types.tsx +33 -0
  181. package/src/views/TamaguiProvider.tsx +11 -4
  182. package/src/views/ThemeProvider.tsx +9 -6
  183. package/types/config.d.ts +27 -0
  184. package/types/constants/platform.d.ts +1 -0
  185. package/types/constants/platform.native.d.ts +13 -0
  186. package/types/createComponent.server.d.ts +36 -0
  187. package/types/createVariable.d.ts +1 -2
  188. package/types/helpers/RNComponents.d.ts +1 -1
  189. package/types/helpers/ThemeManager.d.ts +2 -8
  190. package/types/helpers/getAnimationDriver.d.ts +6 -0
  191. package/types/helpers/useAnimationDriver.d.ts +1 -0
  192. package/types/hooks/useAnimationDriver.d.ts +1 -0
  193. package/types/hooks/useServerContext.d.ts +2 -0
  194. package/types/hooks/useServerHooks.d.ts +4 -0
  195. package/types/hooks/useTheme.d.ts +5 -21
  196. package/types/index.d.ts +2 -1
  197. package/types/injectStyles.d.ts +7 -0
  198. package/types/types.d.ts +23 -0
  199. package/types/views/TamaguiProvider.d.ts +1 -1
  200. package/types/views/ThemeProvider.d.ts +0 -1
@@ -28,7 +28,7 @@ __export(Tamagui_exports, {
28
28
  module.exports = __toCommonJS(Tamagui_exports);
29
29
  var Helpers = __toESM(require("@tamagui/helpers"));
30
30
  var rnw = __toESM(require("@tamagui/rnw"));
31
- var import_conf = require("./conf");
31
+ var import_config = require("./config");
32
32
  var import_insertStyleRule = require("./helpers/insertStyleRule");
33
33
  class TamaguiManager {
34
34
  constructor() {
@@ -36,7 +36,7 @@ class TamaguiManager {
36
36
  this.Helpers = Helpers;
37
37
  }
38
38
  get config() {
39
- return (0, import_conf.getConfig)();
39
+ return (0, import_config.getConfig)();
40
40
  }
41
41
  get insertedRules() {
42
42
  return (0, import_insertStyleRule.getAllRules)();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Tamagui.ts"],
4
- "sourcesContent": ["import * as Helpers from '@tamagui/helpers'\nimport * as rnw from '@tamagui/rnw'\n\nimport { getConfig } from './conf'\nimport { getAllRules, getAllSelectors, getAllTransforms } from './helpers/insertStyleRule'\n\n// serves a central store for state\n\nclass TamaguiManager {\n rnw = rnw\n Helpers = Helpers\n\n get config() {\n return getConfig()\n }\n\n get insertedRules() {\n return getAllRules()\n }\n\n get allSelectors() {\n return getAllSelectors()\n }\n\n get allTransforms() {\n return getAllTransforms()\n }\n\n get identifierToValue() {\n return identifierToValue\n }\n}\n\nexport const Tamagui = new TamaguiManager()\n\nconst identifierToValue = new Map<string, any>()\n\nexport const getValueFromIdentifier = (identifier: string) => {\n return identifierToValue.get(identifier)\n}\n\nexport const setIdentifierValue = (identifier: string, value: any) => {\n identifierToValue.set(identifier, value)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAyB;AACzB,UAAqB;AAErB,kBAA0B;AAC1B,6BAA+D;AAI/D,MAAM,eAAe;AAAA,EAArB;AACE,eAAM;AACN,mBAAU;AAAA;AAAA,EAEV,IAAI,SAAS;AACX,WAAO,2BAAU;AAAA,EACnB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,wCAAY;AAAA,EACrB;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,4CAAgB;AAAA,EACzB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,6CAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,oBAAoB;AACtB,WAAO;AAAA,EACT;AACF;AAEO,MAAM,UAAU,IAAI,eAAe;AAE1C,MAAM,oBAAoB,oBAAI,IAAiB;AAExC,MAAM,yBAAyB,CAAC,eAAuB;AAC5D,SAAO,kBAAkB,IAAI,UAAU;AACzC;AAEO,MAAM,qBAAqB,CAAC,YAAoB,UAAe;AACpE,oBAAkB,IAAI,YAAY,KAAK;AACzC;",
4
+ "sourcesContent": ["import * as Helpers from '@tamagui/helpers'\nimport * as rnw from '@tamagui/rnw'\n\nimport { getConfig } from './config'\nimport { getAllRules, getAllSelectors, getAllTransforms } from './helpers/insertStyleRule'\n\n// serves a central store for state\n\nclass TamaguiManager {\n rnw = rnw\n Helpers = Helpers\n\n get config() {\n return getConfig()\n }\n\n get insertedRules() {\n return getAllRules()\n }\n\n get allSelectors() {\n return getAllSelectors()\n }\n\n get allTransforms() {\n return getAllTransforms()\n }\n\n get identifierToValue() {\n return identifierToValue\n }\n}\n\nexport const Tamagui = new TamaguiManager()\n\nconst identifierToValue = new Map<string, any>()\n\nexport const getValueFromIdentifier = (identifier: string) => {\n return identifierToValue.get(identifier)\n}\n\nexport const setIdentifierValue = (identifier: string, value: any) => {\n identifierToValue.set(identifier, value)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAyB;AACzB,UAAqB;AAErB,oBAA0B;AAC1B,6BAA+D;AAI/D,MAAM,eAAe;AAAA,EAArB;AACE,eAAM;AACN,mBAAU;AAAA;AAAA,EAEV,IAAI,SAAS;AACX,WAAO,6BAAU;AAAA,EACnB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,wCAAY;AAAA,EACrB;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,4CAAgB;AAAA,EACzB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,6CAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,oBAAoB;AACtB,WAAO;AAAA,EACT;AACF;AAEO,MAAM,UAAU,IAAI,eAAe;AAE1C,MAAM,oBAAoB,oBAAI,IAAiB;AAExC,MAAM,yBAAyB,CAAC,eAAuB;AAC5D,SAAO,kBAAkB,IAAI,UAAU;AACzC;AAEO,MAAM,qBAAqB,CAAC,YAAoB,UAAe;AACpE,oBAAkB,IAAI,YAAY,KAAK;AACzC;",
6
6
  "names": []
7
7
  }
@@ -21,7 +21,7 @@ __export(addTheme_exports, {
21
21
  addTheme: () => addTheme
22
22
  });
23
23
  module.exports = __toCommonJS(addTheme_exports);
24
- var import_conf = require("./conf");
24
+ var import_config = require("./config");
25
25
  var import_platform = require("./constants/platform");
26
26
  var import_getThemeCSSRules = require("./helpers/getThemeCSSRules");
27
27
  var import_themes = require("./helpers/themes");
@@ -32,36 +32,42 @@ function addTheme({
32
32
  update
33
33
  }) {
34
34
  var _a;
35
- const config = (0, import_conf.getConfig)();
36
- if (!config) {
37
- throw new Error(`Must run createTamagui once before loading theme`);
38
- }
39
- if (!update && config.themes[themeName]) {
40
- throw new Error(`Already defined theme "${themeName}", use updateTheme to change values`);
35
+ const config = (0, import_config.getConfig)();
36
+ if (process.env.NODE_ENV === "development") {
37
+ if (!config) {
38
+ throw new Error(`Must run createTamagui once before loading theme`);
39
+ }
40
+ if (!update && config.themes[themeName]) {
41
+ throw new Error(`Already defined theme "${themeName}", use updateTheme to change values`);
42
+ }
41
43
  }
42
44
  const theme = { ...themeIn };
43
45
  for (const key in theme) {
44
46
  (0, import_themes.ensureThemeVariable)(theme, key);
45
47
  }
46
- const cssRules = (0, import_getThemeCSSRules.getThemeCSSRules)({
47
- config,
48
- themeName,
49
- names: [themeName],
50
- theme
51
- });
52
48
  const themeProxied = (0, import_themes.proxyThemeToParents)(themeName, theme, config.themes);
53
49
  config.themes[themeName] = themeProxied;
54
- if (insertCSS && import_platform.isWeb) {
55
- const id = `tamagui_theme_style_${themeName}`;
56
- const existing = document.querySelector(`#${id}`);
57
- const style = document.createElement("style");
58
- style.id = id;
59
- style.appendChild(document.createTextNode(cssRules.join("\n")));
60
- document.head.appendChild(style);
61
- if (existing) {
62
- (_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
50
+ let cssRules = [];
51
+ if (import_platform.isWeb) {
52
+ if (insertCSS) {
53
+ cssRules = (0, import_getThemeCSSRules.getThemeCSSRules)({
54
+ config,
55
+ themeName,
56
+ names: [themeName],
57
+ theme
58
+ });
59
+ const id = `tamagui_theme_style_${themeName}`;
60
+ const existing = document.querySelector(`#${id}`);
61
+ const style = document.createElement("style");
62
+ style.id = id;
63
+ style.appendChild(document.createTextNode(cssRules.join("\n")));
64
+ document.head.appendChild(style);
65
+ if (existing) {
66
+ (_a = existing.parentElement) == null ? void 0 : _a.removeChild(existing);
67
+ }
63
68
  }
64
69
  }
70
+ (0, import_config.updateConfig)("themes", { ...config.themes, [themeName]: themeProxied });
65
71
  return {
66
72
  theme: themeProxied,
67
73
  cssRules
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "sourcesContent": ["import { getConfig } from './conf'\nimport { isWeb } from './constants/platform'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeObject } from './types'\n\nexport function addTheme({\n name: themeName,\n theme: themeIn,\n insertCSS,\n update,\n}: {\n name: string\n theme: ThemeObject\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n if (!config) {\n throw new Error(`Must run createTamagui once before loading theme`)\n }\n if (!update && config.themes[themeName]) {\n throw new Error(`Already defined theme \"${themeName}\", use updateTheme to change values`)\n }\n const theme = { ...themeIn }\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n const cssRules = getThemeCSSRules({\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n if (insertCSS && isWeb) {\n const id = `tamagui_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAC1B,sBAAsB;AACtB,8BAAiC;AACjC,oBAAyD;AAGlD,kBAAkB;AAAA,EACvB,MAAM;AAAA,EACN,OAAO;AAAA,EACP;AAAA,EACA;AAAA,GAMC;AAhBH;AAiBE,QAAM,SAAS,2BAAU;AACzB,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,MAAI,CAAC,UAAU,OAAO,OAAO,YAAY;AACvC,UAAM,IAAI,MAAM,0BAA0B,8CAA8C;AAAA,EAC1F;AACA,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,2CAAoB,OAAO,GAAG;AAAA,EAChC;AACA,QAAM,WAAW,8CAAiB;AAAA,IAChC;AAAA,IACA;AAAA,IACA,OAAO,CAAC,SAAS;AAAA,IACjB;AAAA,EACF,CAAC;AACD,QAAM,eAAe,uCAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,aAAa;AAE3B,MAAI,aAAa,uBAAO;AACtB,UAAM,KAAK,uBAAuB;AAClC,UAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,KAAK;AACX,UAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,aAAS,KAAK,YAAY,KAAK;AAC/B,QAAI,UAAU;AACZ,qBAAS,kBAAT,mBAAwB,YAAY;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { getConfig, updateConfig } from './config'\nimport { isWeb } from './constants/platform'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeObject } from './types'\n\nexport function addTheme({\n name: themeName,\n theme: themeIn,\n insertCSS,\n update,\n}: {\n name: string\n theme: ThemeObject\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error(`Must run createTamagui once before loading theme`)\n }\n if (!update && config.themes[themeName]) {\n throw new Error(`Already defined theme \"${themeName}\", use updateTheme to change values`)\n }\n }\n\n const theme = { ...themeIn }\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `tamagui_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAwC;AACxC,sBAAsB;AACtB,8BAAiC;AACjC,oBAAyD;AAGlD,kBAAkB;AAAA,EACvB,MAAM;AAAA,EACN,OAAO;AAAA,EACP;AAAA,EACA;AAAA,GAMC;AAhBH;AAiBE,QAAM,SAAS,6BAAU;AACzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AACA,QAAI,CAAC,UAAU,OAAO,OAAO,YAAY;AACvC,YAAM,IAAI,MAAM,0BAA0B,8CAA8C;AAAA,IAC1F;AAAA,EACF;AAEA,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,2CAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,uCAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,aAAa;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,uBAAO;AACT,QAAI,WAAW;AACb,iBAAW,8CAAiB;AAAA,QAC1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,uBAAuB;AAClC,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,kCAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,YAAY,aAAa,CAAC;AAItE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var config_exports = {};
20
+ __export(config_exports, {
21
+ configListeners: () => configListeners,
22
+ getConfig: () => getConfig,
23
+ getHasConfigured: () => getHasConfigured,
24
+ getThemes: () => getThemes,
25
+ getTokens: () => getTokens,
26
+ onConfiguredOnce: () => onConfiguredOnce,
27
+ setConfig: () => setConfig,
28
+ setConfigFont: () => setConfigFont,
29
+ updateConfig: () => updateConfig
30
+ });
31
+ module.exports = __toCommonJS(config_exports);
32
+ let conf;
33
+ const setConfig = (next) => {
34
+ conf = next;
35
+ if (configListeners.size) {
36
+ configListeners.forEach((cb) => cb(conf));
37
+ configListeners.clear();
38
+ }
39
+ };
40
+ const setConfigFont = (name, font, fontParsed) => {
41
+ if (process.env.NODE_ENV === "development") {
42
+ if (!conf)
43
+ throw new Error(`Haven't called createTamagui yet`);
44
+ }
45
+ Object.assign(conf.fonts, { [name]: font });
46
+ Object.assign(conf.fontsParsed, { [`$${name}`]: fontParsed });
47
+ };
48
+ const getHasConfigured = () => !!conf;
49
+ const getConfig = () => conf;
50
+ const getTokens = () => conf.tokensParsed;
51
+ const getThemes = () => conf.themes;
52
+ const configListeners = /* @__PURE__ */ new Set();
53
+ const onConfiguredOnce = (cb) => {
54
+ if (conf) {
55
+ cb(conf);
56
+ } else {
57
+ configListeners.add(cb);
58
+ }
59
+ };
60
+ const updateConfig = (key, value) => {
61
+ Object.assign(key, value);
62
+ };
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ configListeners,
66
+ getConfig,
67
+ getHasConfigured,
68
+ getThemes,
69
+ getTokens,
70
+ onConfiguredOnce,
71
+ setConfig,
72
+ setConfigFont,
73
+ updateConfig
74
+ });
75
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/config.ts"],
4
+ "sourcesContent": ["import { ConfigListener, TamaguiInternalConfig } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(conf!))\n configListeners.clear()\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const getHasConfigured = () => !!conf\nexport const getConfig = () => conf!\nexport const getTokens = () => conf!.tokensParsed\nexport const getThemes = () => conf!.themes\n\nexport const configListeners = new Set<ConfigListener>()\n\nexport const onConfiguredOnce = (cb: ConfigListener) => {\n if (conf) {\n cb(conf!)\n } else {\n configListeners.add(cb)\n }\n}\n\nexport const updateConfig = (key: string, value: any) => {\n Object.assign(key, value)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAI;AAEG,MAAM,YAAY,CAAC,SAAgC;AACxD,SAAO;AACP,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAK,CAAC;AACzC,oBAAgB,MAAM;AAAA,EACxB;AACF;AAEO,MAAM,gBAAgB,CAAC,MAAc,MAAW,eAAoB;AACzE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC;AAAM,YAAM,IAAI,MAAM,kCAAkC;AAAA,EAC/D;AACA,SAAO,OAAO,KAAM,OAAO,EAAE,CAAC,OAAO,KAAK,CAAC;AAC3C,SAAO,OAAO,KAAM,aAAa,EAAE,CAAC,IAAI,SAAS,WAAW,CAAC;AAC/D;AAEO,MAAM,mBAAmB,MAAM,CAAC,CAAC;AACjC,MAAM,YAAY,MAAM;AACxB,MAAM,YAAY,MAAM,KAAM;AAC9B,MAAM,YAAY,MAAM,KAAM;AAE9B,MAAM,kBAAkB,oBAAI,IAAoB;AAEhD,MAAM,mBAAmB,CAAC,OAAuB;AACtD,MAAI,MAAM;AACR,OAAG,IAAK;AAAA,EACV,OAAO;AACL,oBAAgB,IAAI,EAAE;AAAA,EACxB;AACF;AAEO,MAAM,eAAe,CAAC,KAAa,UAAe;AACvD,SAAO,OAAO,KAAK,KAAK;AAC1B;",
6
+ "names": []
7
+ }
@@ -22,6 +22,7 @@ __export(platform_exports, {
22
22
  isChrome: () => isChrome,
23
23
  isClient: () => isClient,
24
24
  isIOS: () => isIOS,
25
+ isRSC: () => isRSC,
25
26
  isSSR: () => isSSR,
26
27
  isTouchable: () => isTouchable,
27
28
  isWeb: () => isWeb,
@@ -32,6 +33,7 @@ __export(platform_exports, {
32
33
  module.exports = __toCommonJS(platform_exports);
33
34
  var import_react = require("react");
34
35
  var import_react_native = require("react-native");
36
+ const import_meta = {};
35
37
  var _a, _b;
36
38
  const isAndroid = ((_a = import_react_native.Platform) == null ? void 0 : _a.OS) === "android";
37
39
  const isIOS = ((_b = import_react_native.Platform) == null ? void 0 : _b.OS) === "ios";
@@ -39,7 +41,10 @@ const isWeb = process.env.TAMAGUI_TARGET === "web";
39
41
  const isWindowDefined = typeof window !== "undefined";
40
42
  const isSSR = isWeb && !isWindowDefined;
41
43
  const isClient = isWeb && isWindowDefined;
42
- const useIsomorphicLayoutEffect = isSSR ? import_react.useEffect : import_react.useLayoutEffect;
44
+ const isRSC = process.env.ENABLE_RSC ? import_meta.env ? import_meta.env.SSR : false : false;
45
+ const idFn = () => {
46
+ };
47
+ const useIsomorphicLayoutEffect = isRSC ? idFn : isSSR ? import_react.useEffect : import_react.useLayoutEffect;
43
48
  const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
44
49
  const isWebTouchable = isClient && "ontouchstart" in window;
45
50
  const isTouchable = !isWeb || isWebTouchable;
@@ -49,6 +54,7 @@ const isTouchable = !isWeb || isWebTouchable;
49
54
  isChrome,
50
55
  isClient,
51
56
  isIOS,
57
+ isRSC,
52
58
  isSSR,
53
59
  isTouchable,
54
60
  isWeb,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/constants/platform.ts"],
4
- "sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const isSSR = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\nexport const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const isWebTouchable = isClient && 'ontouchstart' in window\nexport const isTouchable = !isWeb || isWebTouchable\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,0BAAyB;AADzB;AAGO,MAAM,YAAY,2DAAU,QAAO;AACnC,MAAM,QAAQ,2DAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,QAAQ,SAAS,CAAC;AACxB,MAAM,WAAW,SAAS;AAC1B,MAAM,4BAA4B,QAAQ,yBAAY;AACtD,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,iBAAiB,YAAY,kBAAkB;AACrD,MAAM,cAAc,CAAC,SAAS;",
4
+ "sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const isSSR = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\n\nexport const isRSC = process.env.ENABLE_RSC\n ? // note this is statically analyzed so no funny business, just access it without optional chaining\n // @ts-ignore\n import.meta.env\n ? // @ts-ignore\n import.meta.env.SSR\n : false\n : false\n\nconst idFn = () => {}\nexport const useIsomorphicLayoutEffect = isRSC ? idFn : isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const isWebTouchable = isClient && 'ontouchstart' in window\nexport const isTouchable = !isWeb || isWebTouchable\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,0BAAyB;AADzB;AAAA;AAGO,MAAM,YAAY,2DAAU,QAAO;AACnC,MAAM,QAAQ,2DAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,QAAQ,SAAS,CAAC;AACxB,MAAM,WAAW,SAAS;AAE1B,MAAM,QAAQ,QAAQ,IAAI,aAG7B,YAAY,MAEV,YAAY,IAAI,MAChB,QACF;AAEJ,MAAM,OAAO,MAAM;AAAC;AACb,MAAM,4BAA4B,QAAQ,OAAO,QAAQ,yBAAY;AACrE,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,iBAAiB,YAAY,kBAAkB;AACrD,MAAM,cAAc,CAAC,SAAS;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var platform_native_exports = {};
20
+ __export(platform_native_exports, {
21
+ isAndroid: () => isAndroid,
22
+ isChrome: () => isChrome,
23
+ isClient: () => isClient,
24
+ isIOS: () => isIOS,
25
+ isRSC: () => isRSC,
26
+ isSSR: () => isSSR,
27
+ isTouchable: () => isTouchable,
28
+ isWeb: () => isWeb,
29
+ isWebTouchable: () => isWebTouchable,
30
+ isWindowDefined: () => isWindowDefined,
31
+ useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect
32
+ });
33
+ module.exports = __toCommonJS(platform_native_exports);
34
+ var import_react = require("react");
35
+ var import_react_native = require("react-native");
36
+ var _a, _b;
37
+ const isAndroid = ((_a = import_react_native.Platform) == null ? void 0 : _a.OS) === "android";
38
+ const isIOS = ((_b = import_react_native.Platform) == null ? void 0 : _b.OS) === "ios";
39
+ const isWeb = false;
40
+ const isWindowDefined = false;
41
+ const isSSR = false;
42
+ const isClient = false;
43
+ const isRSC = false;
44
+ const useIsomorphicLayoutEffect = import_react.useLayoutEffect;
45
+ const isChrome = false;
46
+ const isWebTouchable = false;
47
+ const isTouchable = true;
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ isAndroid,
51
+ isChrome,
52
+ isClient,
53
+ isIOS,
54
+ isRSC,
55
+ isSSR,
56
+ isTouchable,
57
+ isWeb,
58
+ isWebTouchable,
59
+ isWindowDefined,
60
+ useIsomorphicLayoutEffect
61
+ });
62
+ //# sourceMappingURL=platform.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/platform.native.ts"],
4
+ "sourcesContent": ["import { useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = false\nexport const isWindowDefined = false\nexport const isSSR = false\nexport const isClient = false\nexport const isRSC = false\nexport const useIsomorphicLayoutEffect = useLayoutEffect\nexport const isChrome = false\nexport const isWebTouchable = false\nexport const isTouchable = true\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAChC,0BAAyB;AADzB;AAGO,MAAM,YAAY,2DAAU,QAAO;AACnC,MAAM,QAAQ,2DAAU,QAAO;AAC/B,MAAM,QAAQ;AACd,MAAM,kBAAkB;AACxB,MAAM,QAAQ;AACd,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,4BAA4B;AAClC,MAAM,WAAW;AACjB,MAAM,iBAAiB;AACvB,MAAM,cAAc;",
6
+ "names": []
7
+ }
@@ -35,7 +35,7 @@ var import_rnw = require("@tamagui/rnw");
35
35
  var import_use_force_update = require("@tamagui/use-force-update");
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_react_native = require("react-native");
38
- var import_conf = require("./conf");
38
+ var import_config = require("./config");
39
39
  var import_constants = require("./constants/constants");
40
40
  var import_platform = require("./constants/platform");
41
41
  var import_FontLanguageContext = require("./contexts/FontLanguageContext");
@@ -51,6 +51,7 @@ var import_proxyThemeVariables = require("./helpers/proxyThemeVariables");
51
51
  var import_useFeatures = require("./hooks/useFeatures");
52
52
  var import_useMedia = require("./hooks/useMedia");
53
53
  var import_usePressable = require("./hooks/usePressable");
54
+ var import_useServerHooks = require("./hooks/useServerHooks");
54
55
  var import_useTheme = require("./hooks/useTheme");
55
56
  var import_Pressability = require("./vendor/Pressability");
56
57
  var import_Slot = require("./views/Slot");
@@ -75,7 +76,7 @@ if (typeof document !== "undefined") {
75
76
  document.addEventListener("touchcancel", cancelTouches);
76
77
  }
77
78
  function mergeShorthands({ defaultProps }, { shorthands }) {
78
- for (const key in defaultProps) {
79
+ for (const key of Object.keys(defaultProps)) {
79
80
  defaultProps[shorthands[key] || key] = defaultProps[key];
80
81
  }
81
82
  }
@@ -107,29 +108,14 @@ function createComponent(configIn, ParentComponent) {
107
108
  } else {
108
109
  props = propsIn;
109
110
  }
110
- const hostRef = (0, import_react.useRef)(null);
111
111
  const { Component, isText, isZStack } = staticConfig;
112
112
  const componentName = props.componentName || staticConfig.componentName;
113
113
  const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
114
- if (process.env.NODE_ENV === "development") {
115
- if (props["debug"]) {
116
- const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
117
- const banner = `${name} ${propsIn["data-is"] || ""}`;
118
- console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
119
- console.log("props", propsIn);
120
- console.log("ref", hostRef, "(click to view)");
121
- if (props["debug"] === "break") {
122
- debugger;
123
- }
124
- }
125
- }
126
114
  const forceUpdate = (0, import_use_force_update.useForceUpdate)();
115
+ config = config || (0, import_config.getConfig)();
127
116
  const theme = (0, import_useTheme.useTheme)(props.theme, componentName, props, forceUpdate);
128
- const states = (0, import_react.useState)(defaultComponentState);
117
+ const states = (0, import_useServerHooks.useServerState)(defaultComponentState);
129
118
  const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
130
- const setState = states[1];
131
- const setStateShallow = (0, import_createShallowUpdate.createShallowUpdate)(setState);
132
- const languageContext = (0, import_react.useContext)(import_FontLanguageContext.FontLanguageContext);
133
119
  const shouldAvoidClasses = !!(props.animation && avoidClasses);
134
120
  const shouldForcePseudo = !!propsIn.forceStyle;
135
121
  const hasTextAncestor = !!(import_platform.isWeb && isText ? (0, import_react.useContext)(import_TextAncestorContext.TextAncestorContext) : false);
@@ -144,9 +130,28 @@ function createComponent(configIn, ParentComponent) {
144
130
  hasTextAncestor,
145
131
  resolveVariablesAs: "value"
146
132
  };
147
- const splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, splitStyleState, props.asChild ? null : initialSplitStyles.classNames, languageContext || void 0, props["debug"]);
133
+ const languageContext = import_platform.isRSC ? null : (0, import_react.useContext)(import_FontLanguageContext.FontLanguageContext);
134
+ const splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, splitStyleState, props.asChild ? null : initialSplitStyles == null ? void 0 : initialSplitStyles.classNames, languageContext || void 0, props["debug"]);
135
+ const hostRef = (0, import_useServerHooks.useServerRef)(null);
136
+ const setState = states[1];
137
+ const setStateShallow = (0, import_createShallowUpdate.createShallowUpdate)(setState);
138
+ if (process.env.NODE_ENV === "development") {
139
+ if (props["debug"]) {
140
+ const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
141
+ const type = staticConfig.isReactNativeWeb ? "rnw" : "tamagui";
142
+ const banner = `${name} ${propsIn["data-is"] || ""} ${type}`;
143
+ console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
144
+ console.log("props in", propsIn);
145
+ if (typeof window !== "undefined") {
146
+ console.log("ref", hostRef, "(click to view)");
147
+ }
148
+ if (props["debug"] === "break") {
149
+ debugger;
150
+ }
151
+ }
152
+ }
148
153
  const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
149
- const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
154
+ const useAnimations = (_a = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
150
155
  const isAnimated = !!(useAnimations && props.animation);
151
156
  const hasEnterStyle = !!props.enterStyle;
152
157
  const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...style } : null;
@@ -272,28 +277,30 @@ function createComponent(configIn, ParentComponent) {
272
277
  } = nonTamaguiProps;
273
278
  viewProps = webProps;
274
279
  (0, import_assignNativePropsToWeb.assignNativePropsToWeb)(elementType, viewProps, nonTamaguiProps);
275
- (0, import_rnw.useElementLayout)(hostRef, onLayout);
276
- (0, import_rnw.useResponderEvents)(hostRef, {
277
- onMoveShouldSetResponder,
278
- onMoveShouldSetResponderCapture,
279
- onResponderEnd,
280
- onResponderGrant,
281
- onResponderMove,
282
- onResponderReject,
283
- onResponderRelease,
284
- onResponderStart,
285
- onResponderTerminate,
286
- onResponderTerminationRequest,
287
- onScrollShouldSetResponder,
288
- onScrollShouldSetResponderCapture,
289
- onSelectionChangeShouldSetResponder,
290
- onSelectionChangeShouldSetResponderCapture,
291
- onStartShouldSetResponder,
292
- onStartShouldSetResponderCapture
293
- });
294
- const platformMethodsRef = (0, import_rnw.usePlatformMethods)(viewProps);
295
- const setRef = (0, import_rnw.useMergeRefs)(hostRef, platformMethodsRef, forwardedRef);
296
- viewProps.ref = setRef;
280
+ if (!import_platform.isRSC) {
281
+ (0, import_rnw.useElementLayout)(hostRef, onLayout);
282
+ (0, import_rnw.useResponderEvents)(hostRef, {
283
+ onMoveShouldSetResponder,
284
+ onMoveShouldSetResponderCapture,
285
+ onResponderEnd,
286
+ onResponderGrant,
287
+ onResponderMove,
288
+ onResponderReject,
289
+ onResponderRelease,
290
+ onResponderStart,
291
+ onResponderTerminate,
292
+ onResponderTerminationRequest,
293
+ onScrollShouldSetResponder,
294
+ onScrollShouldSetResponderCapture,
295
+ onSelectionChangeShouldSetResponder,
296
+ onSelectionChangeShouldSetResponderCapture,
297
+ onStartShouldSetResponder,
298
+ onStartShouldSetResponderCapture
299
+ });
300
+ const platformMethodsRef = (0, import_rnw.usePlatformMethods)(viewProps);
301
+ const setRef = (0, import_rnw.useMergeRefs)(hostRef, platformMethodsRef, forwardedRef);
302
+ viewProps.ref = setRef;
303
+ }
297
304
  if (props.href != void 0 && hrefAttrs != void 0) {
298
305
  const { download, rel, target } = hrefAttrs;
299
306
  if (download != null) {
@@ -336,7 +343,7 @@ function createComponent(configIn, ParentComponent) {
336
343
  }
337
344
  });
338
345
  }
339
- const internal = (0, import_react.useRef)();
346
+ const internal = (0, import_useServerHooks.useServerRef)();
340
347
  if (!internal.current) {
341
348
  internal.current = {
342
349
  isMounted: true
@@ -370,7 +377,7 @@ function createComponent(configIn, ParentComponent) {
370
377
  animationStyles ?? style,
371
378
  medias
372
379
  ];
373
- if (!animationStyles) {
380
+ if (!animationStyles && initialSplitStyles) {
374
381
  const initPseudos = initialSplitStyles.pseudos;
375
382
  const force = shouldForcePseudo;
376
383
  !state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
@@ -408,8 +415,13 @@ function createComponent(configIn, ParentComponent) {
408
415
  className,
409
416
  id: props.id
410
417
  };
411
- if (props["data-is"]) {
412
- viewProps.dataSet.is = props["data-is"];
418
+ if (process.env.NODE_ENV === "development") {
419
+ Object.keys(viewProps).forEach((key) => {
420
+ if (key.startsWith("data-")) {
421
+ viewProps.dataSet[key.replace("data-", "")] = viewProps[key];
422
+ delete viewProps[key];
423
+ }
424
+ });
413
425
  }
414
426
  } else {
415
427
  viewProps.className = className;
@@ -418,7 +430,7 @@ function createComponent(configIn, ParentComponent) {
418
430
  } else {
419
431
  viewProps.style = styles;
420
432
  }
421
- const initialPseudos = initialSplitStyles.pseudos;
433
+ const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
422
434
  const attachPress = !!((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle) || onPress || onPressOut || onPressIn || onClick);
423
435
  const isHoverable = import_platform.isWeb;
424
436
  const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
@@ -435,7 +447,7 @@ function createComponent(configIn, ParentComponent) {
435
447
  pressIn: false
436
448
  });
437
449
  }, []);
438
- const events = shouldAttach ? {
450
+ const events = shouldAttach && !import_platform.isRSC ? {
439
451
  [pressOutKey]: attachPress ? (e) => {
440
452
  unPress();
441
453
  onPressOut == null ? void 0 : onPressOut(e);
@@ -531,7 +543,7 @@ function createComponent(configIn, ParentComponent) {
531
543
  onPressOut
532
544
  };
533
545
  }
534
- if (import_platform.isWeb) {
546
+ if (!import_platform.isRSC && import_platform.isWeb) {
535
547
  const [pressableProps] = (0, import_usePressable.usePressable)(events ? {
536
548
  disabled,
537
549
  ...hitSlop && {
@@ -580,7 +592,7 @@ function createComponent(configIn, ParentComponent) {
580
592
  if (process.env.TAMAGUI_TARGET === "web") {
581
593
  const isAnimatedRNWView = isAnimated && typeof elementType !== "string";
582
594
  const shouldWrapWithComponentTheme = isAnimatedRNWView && (0, import_createPropMapper.getReturnVariablesAs)(props, splitStyleState) === "non-color-value";
583
- const shouldWrapWithHover = events && attachHover;
595
+ const shouldWrapWithHover = Boolean(events || import_platform.isRSC) && attachHover;
584
596
  if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
585
597
  const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
586
598
  const hoverClassName = shouldWrapWithHover ? "t_Hoverable" : "";
@@ -589,7 +601,7 @@ function createComponent(configIn, ParentComponent) {
589
601
  style: {
590
602
  display: "contents"
591
603
  },
592
- ...shouldWrapWithHover && {
604
+ ...events && shouldWrapWithHover && {
593
605
  onMouseEnter: events.onMouseEnter,
594
606
  onMouseLeave: events.onMouseLeave
595
607
  }
@@ -598,7 +610,8 @@ function createComponent(configIn, ParentComponent) {
598
610
  }
599
611
  if (process.env.NODE_ENV === "development") {
600
612
  if (props["debug"]) {
601
- console.groupCollapsed("props out", viewProps, typeof elementType === "string" ? elementType : "Component");
613
+ const element2 = typeof elementType === "string" ? elementType : "Component";
614
+ console.groupCollapsed(`render <${element2} /> with props`, viewProps);
602
615
  for (const key in viewProps) {
603
616
  console.log(key, viewProps[key]);
604
617
  }
@@ -610,15 +623,14 @@ function createComponent(configIn, ParentComponent) {
610
623
  console.groupEnd();
611
624
  }
612
625
  }
613
- return features.elements.length ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, features.elements, content) : content;
626
+ return !import_platform.isRSC && features.elements.length ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, features.elements, content) : content;
614
627
  });
615
628
  if (staticConfig.componentName) {
616
629
  component.displayName = staticConfig.componentName;
617
630
  }
618
- (0, import_conf.onConfiguredOnce)((conf) => {
619
- if (process.env.IS_STATIC === "is_static") {
631
+ (0, import_config.onConfiguredOnce)((conf) => {
632
+ if (process.env.IS_STATIC === "is_static")
620
633
  return;
621
- }
622
634
  tamaguiConfig = conf;
623
635
  mergeShorthands(staticConfig, tamaguiConfig);
624
636
  if (tamaguiConfig.animations) {
@@ -627,7 +639,7 @@ function createComponent(configIn, ParentComponent) {
627
639
  AnimatedView = tamaguiConfig.animations.View;
628
640
  }
629
641
  initialTheme = initialTheme || (0, import_proxyThemeVariables.proxyThemeVariables)(conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]);
630
- config = (0, import_conf.getConfig)();
642
+ config = (0, import_config.getConfig)();
631
643
  let defaultPropsIn = staticConfig.defaultProps || {};
632
644
  const parentNames = [...staticConfig.parentNames || [], staticConfig.componentName];
633
645
  if (config.defaultProps && parentNames && staticConfig.componentName) {
@@ -719,6 +731,7 @@ const Spacer = createComponent({
719
731
  validStyles: import_helpers.validStyles,
720
732
  defaultProps: {
721
733
  ...import_constants.stackDefaultStyles,
734
+ tag: "span",
722
735
  size: true
723
736
  },
724
737
  variants: {