@tamagui/core 1.0.1-beta.193 → 1.0.1-beta.195

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 (220) hide show
  1. package/dist/cjs/Tamagui.js +4 -2
  2. package/dist/cjs/Tamagui.js.map +2 -2
  3. package/dist/cjs/config.js +1 -2
  4. package/dist/cjs/config.js.map +2 -2
  5. package/dist/cjs/constants/constants.js +13 -8
  6. package/dist/cjs/constants/constants.js.map +2 -2
  7. package/dist/cjs/contexts/TextAncestorContext.js +3 -16
  8. package/dist/cjs/contexts/TextAncestorContext.js.map +3 -3
  9. package/dist/cjs/createComponent.js +204 -294
  10. package/dist/cjs/createComponent.js.map +2 -2
  11. package/dist/cjs/createTamagui.js +15 -16
  12. package/dist/cjs/createTamagui.js.map +3 -3
  13. package/dist/cjs/createVariable.js +1 -2
  14. package/dist/cjs/createVariable.js.map +2 -2
  15. package/dist/cjs/helpers/ThemeManager.js +7 -14
  16. package/dist/cjs/helpers/ThemeManager.js.map +2 -2
  17. package/dist/cjs/helpers/{createShallowUpdate.js → cache.js} +20 -21
  18. package/dist/cjs/helpers/cache.js.map +7 -0
  19. package/dist/cjs/helpers/createMediaStyle.js +14 -8
  20. package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
  21. package/dist/cjs/helpers/extendStaticConfig.js +0 -1
  22. package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
  23. package/dist/cjs/helpers/getSplitStyles.js +212 -93
  24. package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
  25. package/dist/cjs/helpers/getStylesAtomic.js +16 -36
  26. package/dist/cjs/helpers/getStylesAtomic.js.map +3 -3
  27. package/dist/cjs/helpers/insertStyleRule.js +14 -6
  28. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  29. package/dist/cjs/helpers/matchMedia.js.map +2 -2
  30. package/dist/cjs/helpers/mergeTransform.js.map +1 -1
  31. package/dist/cjs/helpers/normalizeValueWithProperty.js +32 -2
  32. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
  33. package/dist/cjs/helpers/useShallowSetState.js.map +2 -2
  34. package/dist/cjs/hooks/getThemeUnwrapped.js +1 -3
  35. package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
  36. package/dist/cjs/hooks/useElementLayout.js +92 -0
  37. package/dist/cjs/hooks/useElementLayout.js.map +7 -0
  38. package/dist/cjs/hooks/useIsTouchDevice.js +2 -10
  39. package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
  40. package/dist/cjs/hooks/useMedia.js +77 -84
  41. package/dist/cjs/hooks/useMedia.js.map +2 -2
  42. package/dist/cjs/hooks/useMedia.test.js +2 -0
  43. package/dist/cjs/{helpers/validate.js.map → hooks/useMedia.test.js.map} +0 -0
  44. package/dist/cjs/hooks/usePressablePressResponder.js +370 -0
  45. package/dist/cjs/hooks/usePressablePressResponder.js.map +7 -0
  46. package/dist/cjs/hooks/useSafeRef.js +13 -15
  47. package/dist/cjs/hooks/useSafeRef.js.map +2 -2
  48. package/dist/cjs/hooks/useTheme.js +3 -4
  49. package/dist/cjs/hooks/useTheme.js.map +2 -2
  50. package/dist/cjs/index.js +1 -17
  51. package/dist/cjs/index.js.map +2 -2
  52. package/dist/cjs/static.js +0 -20
  53. package/dist/cjs/static.js.map +2 -2
  54. package/dist/cjs/styled.js +4 -22
  55. package/dist/cjs/styled.js.map +2 -2
  56. package/dist/cjs/types.js.map +1 -1
  57. package/dist/cjs/{hooks/useIsSSR.js → views/AbsoluteFill.js} +18 -23
  58. package/dist/cjs/views/AbsoluteFill.js.map +7 -0
  59. package/dist/cjs/views/AbsoluteFill.native.js +45 -0
  60. package/dist/cjs/views/AbsoluteFill.native.js.map +7 -0
  61. package/dist/cjs/views/FontLanguage.native.js.map +2 -2
  62. package/dist/cjs/views/Stack.js.map +1 -1
  63. package/dist/cjs/views/TamaguiProvider.js +3 -2
  64. package/dist/cjs/views/TamaguiProvider.js.map +2 -2
  65. package/dist/cjs/views/Text.js.map +1 -1
  66. package/dist/cjs/views/ThemeReset.js +10 -10
  67. package/dist/cjs/views/ThemeReset.js.map +2 -2
  68. package/dist/esm/Tamagui.js +4 -2
  69. package/dist/esm/Tamagui.js.map +2 -2
  70. package/dist/esm/config.js +1 -2
  71. package/dist/esm/config.js.map +2 -2
  72. package/dist/esm/constants/constants.js +11 -7
  73. package/dist/esm/constants/constants.js.map +2 -2
  74. package/dist/esm/contexts/TextAncestorContext.js +2 -13
  75. package/dist/esm/contexts/TextAncestorContext.js.map +2 -2
  76. package/dist/esm/createComponent.js +203 -296
  77. package/dist/esm/createComponent.js.map +2 -2
  78. package/dist/esm/createTamagui.js +15 -16
  79. package/dist/esm/createTamagui.js.map +3 -3
  80. package/dist/esm/createVariable.js +1 -2
  81. package/dist/esm/createVariable.js.map +2 -2
  82. package/dist/esm/helpers/ThemeManager.js +7 -14
  83. package/dist/esm/helpers/ThemeManager.js.map +2 -2
  84. package/dist/esm/helpers/cache.js +18 -0
  85. package/dist/esm/helpers/cache.js.map +7 -0
  86. package/dist/esm/helpers/createMediaStyle.js +14 -8
  87. package/dist/esm/helpers/createMediaStyle.js.map +2 -2
  88. package/dist/esm/helpers/extendStaticConfig.js +0 -1
  89. package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
  90. package/dist/esm/helpers/getSplitStyles.js +221 -94
  91. package/dist/esm/helpers/getSplitStyles.js.map +3 -3
  92. package/dist/esm/helpers/getStylesAtomic.js +13 -26
  93. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  94. package/dist/esm/helpers/insertStyleRule.js +14 -6
  95. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  96. package/dist/esm/helpers/matchMedia.js.map +2 -2
  97. package/dist/esm/helpers/mergeTransform.js.map +1 -1
  98. package/dist/esm/helpers/normalizeValueWithProperty.js +30 -1
  99. package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
  100. package/dist/esm/helpers/useShallowSetState.js.map +2 -2
  101. package/dist/esm/hooks/getThemeUnwrapped.js +1 -3
  102. package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
  103. package/dist/esm/hooks/useElementLayout.js +66 -0
  104. package/dist/esm/hooks/useElementLayout.js.map +7 -0
  105. package/dist/esm/hooks/useIsTouchDevice.js +3 -11
  106. package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
  107. package/dist/esm/hooks/useMedia.js +74 -83
  108. package/dist/esm/hooks/useMedia.js.map +2 -2
  109. package/dist/esm/hooks/useMedia.test.js +1 -0
  110. package/dist/esm/{helpers/validate.js.map → hooks/useMedia.test.js.map} +0 -0
  111. package/dist/esm/hooks/usePressablePressResponder.js +346 -0
  112. package/dist/esm/hooks/usePressablePressResponder.js.map +7 -0
  113. package/dist/esm/hooks/useSafeRef.js +13 -15
  114. package/dist/esm/hooks/useSafeRef.js.map +2 -2
  115. package/dist/esm/hooks/useTheme.js +3 -4
  116. package/dist/esm/hooks/useTheme.js.map +2 -2
  117. package/dist/esm/index.js +1 -14
  118. package/dist/esm/index.js.map +2 -2
  119. package/dist/esm/static.js +0 -14
  120. package/dist/esm/static.js.map +2 -2
  121. package/dist/esm/styled.js +4 -22
  122. package/dist/esm/styled.js.map +2 -2
  123. package/dist/esm/views/AbsoluteFill.js +17 -0
  124. package/dist/esm/views/AbsoluteFill.js.map +7 -0
  125. package/dist/esm/views/AbsoluteFill.native.js +21 -0
  126. package/dist/esm/views/AbsoluteFill.native.js.map +7 -0
  127. package/dist/esm/views/FontLanguage.native.js.map +2 -2
  128. package/dist/esm/views/Stack.js.map +1 -1
  129. package/dist/esm/views/TamaguiProvider.js +5 -4
  130. package/dist/esm/views/TamaguiProvider.js.map +2 -2
  131. package/dist/esm/views/Text.js.map +1 -1
  132. package/dist/esm/views/ThemeReset.js +10 -10
  133. package/dist/esm/views/ThemeReset.js.map +2 -2
  134. package/package.json +14 -14
  135. package/src/Tamagui.ts +7 -3
  136. package/src/config.ts +2 -3
  137. package/src/constants/constants.ts +10 -6
  138. package/src/contexts/TextAncestorContext.tsx +1 -8
  139. package/src/createComponent.tsx +256 -421
  140. package/src/createTamagui.ts +16 -19
  141. package/src/createVariable.ts +1 -3
  142. package/src/helpers/ThemeManager.tsx +7 -15
  143. package/src/helpers/cache.ts +18 -0
  144. package/src/helpers/createMediaStyle.ts +16 -9
  145. package/src/helpers/extendStaticConfig.ts +0 -1
  146. package/src/helpers/getSplitStyles.tsx +257 -151
  147. package/src/helpers/getStylesAtomic.ts +14 -34
  148. package/src/helpers/insertStyleRule.tsx +16 -8
  149. package/src/helpers/matchMedia.ts +1 -0
  150. package/src/helpers/mergeTransform.ts +1 -1
  151. package/src/helpers/normalizeValueWithProperty.ts +30 -0
  152. package/src/helpers/useShallowSetState.tsx +0 -1
  153. package/src/hooks/getThemeUnwrapped.tsx +1 -2
  154. package/src/hooks/useElementLayout.tsx +90 -0
  155. package/src/hooks/useIsTouchDevice.tsx +3 -17
  156. package/src/hooks/useMedia.tsx +80 -87
  157. package/src/hooks/useSafeRef.ts +17 -18
  158. package/src/hooks/useTheme.tsx +4 -4
  159. package/src/index.ts +1 -11
  160. package/src/static.ts +0 -10
  161. package/src/styled.tsx +15 -33
  162. package/src/types.tsx +58 -55
  163. package/src/views/FontLanguage.native.tsx +1 -0
  164. package/src/views/Stack.tsx +1 -1
  165. package/src/views/TamaguiProvider.tsx +5 -5
  166. package/src/views/Text.tsx +1 -1
  167. package/src/views/ThemeReset.tsx +11 -11
  168. package/types/Tamagui.d.ts +6 -4
  169. package/types/constants/constants.d.ts +14 -3
  170. package/types/contexts/TextAncestorContext.d.ts +1 -3
  171. package/types/createComponent.d.ts +0 -15
  172. package/types/helpers/ThemeManager.d.ts +2 -3
  173. package/types/helpers/cache.d.ts +12 -0
  174. package/types/helpers/calc.d.ts +0 -16
  175. package/types/helpers/createMediaStyle.d.ts +1 -1
  176. package/types/helpers/getSplitStyles.d.ts +6 -10
  177. package/types/helpers/getStylesAtomic.d.ts +1 -5
  178. package/types/helpers/insertStyleRule.d.ts +2 -2
  179. package/types/helpers/mergeTransform.d.ts +1 -1
  180. package/types/helpers/normalizeValueWithProperty.d.ts +1 -0
  181. package/types/hooks/useElementLayout.d.ts +27 -0
  182. package/types/hooks/useMedia.d.ts +3 -1
  183. package/types/hooks/useMedia.test.d.ts +1 -0
  184. package/types/hooks/usePressablePressResponder.d.ts +84 -0
  185. package/types/index.d.ts +1 -11
  186. package/types/static.d.ts +0 -1
  187. package/types/types.d.ts +42 -44
  188. package/types/views/AbsoluteFill.d.ts +5 -0
  189. package/types/views/AbsoluteFill.native.d.ts +3 -0
  190. package/types/views/Stack.d.ts +1 -1
  191. package/types/views/Text.d.ts +1 -1
  192. package/dist/cjs/constants/platform.js +0 -74
  193. package/dist/cjs/constants/platform.js.map +0 -7
  194. package/dist/cjs/constants/platform.native.js +0 -62
  195. package/dist/cjs/constants/platform.native.js.map +0 -7
  196. package/dist/cjs/helpers/createShallowUpdate.js.map +0 -7
  197. package/dist/cjs/helpers/validate.js +0 -2
  198. package/dist/cjs/hooks/useDidFinishSSR.js +0 -60
  199. package/dist/cjs/hooks/useDidFinishSSR.js.map +0 -7
  200. package/dist/cjs/hooks/useIsSSR.js.map +0 -7
  201. package/dist/esm/constants/platform.js +0 -39
  202. package/dist/esm/constants/platform.js.map +0 -7
  203. package/dist/esm/constants/platform.native.js +0 -28
  204. package/dist/esm/constants/platform.native.js.map +0 -7
  205. package/dist/esm/helpers/createShallowUpdate.js +0 -20
  206. package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
  207. package/dist/esm/helpers/validate.js +0 -1
  208. package/dist/esm/hooks/useDidFinishSSR.js +0 -35
  209. package/dist/esm/hooks/useDidFinishSSR.js.map +0 -7
  210. package/dist/esm/hooks/useIsSSR.js +0 -22
  211. package/dist/esm/hooks/useIsSSR.js.map +0 -7
  212. package/src/helpers/assignNativePropsToWeb.tsx +0 -178
  213. package/src/helpers/calc.ts +0 -68
  214. package/src/helpers/getFont.tsx +0 -43
  215. package/src/helpers/getStackSize.ts +0 -22
  216. package/src/helpers/startTransition.ts +0 -4
  217. package/src/hooks/useConstant.tsx +0 -19
  218. package/src/hooks/useIsMounted.ts +0 -16
  219. package/src/hooks/usePressable.tsx +0 -9
  220. package/src/hooks/useUnmountEffect.ts +0 -5
@@ -1,60 +0,0 @@
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 useDidFinishSSR_exports = {};
20
- __export(useDidFinishSSR_exports, {
21
- useDidFinishSSR: () => useDidFinishSSR,
22
- useSetupHasSSRRendered: () => useSetupHasSSRRendered
23
- });
24
- module.exports = __toCommonJS(useDidFinishSSR_exports);
25
- var import_constants = require("@tamagui/constants");
26
- var import_react = require("react");
27
- let finished = false;
28
- const listeners = /* @__PURE__ */ new Set();
29
- function useSetupHasSSRRendered() {
30
- if (import_constants.isServer || import_constants.isRSC) {
31
- return;
32
- }
33
- (0, import_react.useEffect)(() => {
34
- finished = true;
35
- listeners.forEach((cb) => cb());
36
- listeners.clear();
37
- }, []);
38
- }
39
- function useDidFinishSSR() {
40
- if (import_constants.isServer || import_constants.isRSC) {
41
- return false;
42
- }
43
- const [did, setDid] = (0, import_react.useState)(finished);
44
- if (!finished) {
45
- (0, import_react.useEffect)(() => {
46
- const done = () => setDid(true);
47
- listeners.add(done);
48
- return () => {
49
- listeners.delete(done);
50
- };
51
- }, []);
52
- }
53
- return did;
54
- }
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- useDidFinishSSR,
58
- useSetupHasSSRRendered
59
- });
60
- //# sourceMappingURL=useDidFinishSSR.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useDidFinishSSR.tsx"],
4
- "sourcesContent": ["import { isRSC, isServer } from '@tamagui/constants'\nimport { useEffect, useState } from 'react'\n\nlet finished = false\nconst listeners = new Set<Function>()\n\nexport function useSetupHasSSRRendered() {\n if (isServer || isRSC) {\n return\n }\n\n useEffect(() => {\n finished = true\n listeners.forEach((cb) => cb())\n listeners.clear()\n }, [])\n}\n\nexport function useDidFinishSSR() {\n if (isServer || isRSC) {\n return false\n }\n\n const [did, setDid] = useState(finished)\n\n // conditional hook because it never changes if already true\n if (!finished) {\n useEffect(() => {\n const done = () => setDid(true)\n listeners.add(done)\n return () => {\n listeners.delete(done)\n }\n }, [])\n }\n\n return did\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,mBAAoC;AAEpC,IAAI,WAAW;AACf,MAAM,YAAY,oBAAI,IAAc;AAE7B,SAAS,yBAAyB;AACvC,MAAI,6BAAY,wBAAO;AACrB;AAAA,EACF;AAEA,8BAAU,MAAM;AACd,eAAW;AACX,cAAU,QAAQ,CAAC,OAAO,GAAG,CAAC;AAC9B,cAAU,MAAM;AAAA,EAClB,GAAG,CAAC,CAAC;AACP;AAEO,SAAS,kBAAkB;AAChC,MAAI,6BAAY,wBAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,QAAQ;AAGvC,MAAI,CAAC,UAAU;AACb,gCAAU,MAAM;AACd,YAAM,OAAO,MAAM,OAAO,IAAI;AAC9B,gBAAU,IAAI,IAAI;AAClB,aAAO,MAAM;AACX,kBAAU,OAAO,IAAI;AAAA,MACvB;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useIsSSR.tsx"],
4
- "sourcesContent": ["import { isServer, isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { useState } from 'react'\n\nimport { startTransition } from '../helpers/startTransition'\n\n// because any change before first useEffect causes hydration / mismatch issues\n\nexport const useIsSSR = (props?: { immediate?: boolean }) => {\n const [val, setVal] = useState(true)\n\n if (isWeb && !isServer) {\n useIsomorphicLayoutEffect(() => {\n // could also have a global tamagui `config.immediateSSRTransition`\n if (props?.immediate) {\n setVal(false)\n } else {\n startTransition(() => {\n setVal(false)\n })\n }\n }, [])\n }\n\n return val\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2D;AAC3D,mBAAyB;AAEzB,6BAAgC;AAIzB,MAAM,WAAW,CAAC,UAAoC;AAC3D,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,IAAI;AAEnC,MAAI,0BAAS,CAAC,2BAAU;AACtB,oDAA0B,MAAM;AAE9B,UAAI,+BAAO,WAAW;AACpB,eAAO,KAAK;AAAA,MACd,OAAO;AACL,oDAAgB,MAAM;AACpB,iBAAO,KAAK;AAAA,QACd,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,39 +0,0 @@
1
- var _a, _b;
2
- import { useEffect, useLayoutEffect } from "react";
3
- import { Platform } from "react-native";
4
- const isAndroid = ((_a = Platform) == null ? void 0 : _a.OS) === "android";
5
- const isIOS = ((_b = Platform) == null ? void 0 : _b.OS) === "ios";
6
- const isWeb = process.env.TAMAGUI_TARGET === "web";
7
- const isWindowDefined = typeof window !== "undefined";
8
- const isServer = isWeb && !isWindowDefined;
9
- const isClient = isWeb && isWindowDefined;
10
- const isRSC = process.env.ENABLE_RSC ? import.meta.env ? import.meta.env.SSR : false : false;
11
- const idFn = () => {
12
- };
13
- const useIsomorphicLayoutEffect = isRSC ? idFn : isServer ? useEffect : useLayoutEffect;
14
- const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
15
- const isWebTouchable = isClient && "ontouchstart" in window;
16
- const isTouchable = !isWeb || isWebTouchable;
17
- if (process.env.NODE_ENV === "development") {
18
- if (!process.env.TAMAGUI_TARGET) {
19
- console.warn(`Must set TAMAGUI_TARGET to "web" or "native"`);
20
- } else if (isClient && process.env.TAMAGUI_TARGET !== "web" && process.env.TAMAGUI_IGNORE_TARGET !== "1") {
21
- console.warn(
22
- `Must set TAMAGUI_TARGET to "web" for web apps - if you have window defined outside of the browser, set TAMAGUI_IGNORE_TARGET=1 to hide this`
23
- );
24
- }
25
- }
26
- export {
27
- isAndroid,
28
- isChrome,
29
- isClient,
30
- isIOS,
31
- isRSC,
32
- isServer,
33
- isTouchable,
34
- isWeb,
35
- isWebTouchable,
36
- isWindowDefined,
37
- useIsomorphicLayoutEffect
38
- };
39
- //# sourceMappingURL=platform.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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 isServer = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\n\n// may want to move to VITE_RSC_BUILD\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 : isServer ? 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\nif (process.env.NODE_ENV === 'development') {\n if (!process.env.TAMAGUI_TARGET) {\n // eslint-disable-next-line no-console\n console.warn(`Must set TAMAGUI_TARGET to \"web\" or \"native\"`)\n } else if (\n isClient &&\n process.env.TAMAGUI_TARGET !== 'web' &&\n process.env.TAMAGUI_IGNORE_TARGET !== '1'\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n `Must set TAMAGUI_TARGET to \"web\" for web apps - if you have window defined outside of the browser, set TAMAGUI_IGNORE_TARGET=1 to hide this`\n )\n }\n}\n"],
5
- "mappings": "AAAA;AAAA,SAAS,WAAW,uBAAuB;AAC3C,SAAS,gBAAgB;AAElB,MAAM,cAAY,qCAAU,QAAO;AACnC,MAAM,UAAQ,qCAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,WAAW,SAAS,CAAC;AAC3B,MAAM,WAAW,SAAS;AAG1B,MAAM,QAAQ,QAAQ,IAAI,aAG7B,YAAY,MAEV,YAAY,IAAI,MAChB,QACF;AAEJ,MAAM,OAAO,MAAM;AAAC;AACb,MAAM,4BAA4B,QAAQ,OAAO,WAAW,YAAY;AACxE,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,iBAAiB,YAAY,kBAAkB;AACrD,MAAM,cAAc,CAAC,SAAS;AAErC,IAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,MAAI,CAAC,QAAQ,IAAI,gBAAgB;AAE/B,YAAQ,KAAK,8CAA8C;AAAA,EAC7D,WACE,YACA,QAAQ,IAAI,mBAAmB,SAC/B,QAAQ,IAAI,0BAA0B,KACtC;AAEA,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,28 +0,0 @@
1
- var _a, _b;
2
- import { useLayoutEffect } from "react";
3
- import { Platform } from "react-native";
4
- const isAndroid = ((_a = Platform) == null ? void 0 : _a.OS) === "android";
5
- const isIOS = ((_b = Platform) == null ? void 0 : _b.OS) === "ios";
6
- const isWeb = false;
7
- const isWindowDefined = false;
8
- const isServer = false;
9
- const isClient = false;
10
- const isRSC = false;
11
- const useIsomorphicLayoutEffect = useLayoutEffect;
12
- const isChrome = false;
13
- const isWebTouchable = false;
14
- const isTouchable = true;
15
- export {
16
- isAndroid,
17
- isChrome,
18
- isClient,
19
- isIOS,
20
- isRSC,
21
- isServer,
22
- isTouchable,
23
- isWeb,
24
- isWebTouchable,
25
- isWindowDefined,
26
- useIsomorphicLayoutEffect
27
- };
28
- //# sourceMappingURL=platform.native.js.map
@@ -1,7 +0,0 @@
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 isServer = 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,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AAElB,MAAM,cAAY,qCAAU,QAAO;AACnC,MAAM,UAAQ,qCAAU,QAAO;AAC/B,MAAM,QAAQ;AACd,MAAM,kBAAkB;AACxB,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,4BAA4B;AAClC,MAAM,WAAW;AACjB,MAAM,iBAAiB;AACvB,MAAM,cAAc;",
6
- "names": []
7
- }
@@ -1,20 +0,0 @@
1
- import { useCallback } from "react";
2
- function createShallowUpdate(setter) {
3
- return useCallback(
4
- (next) => {
5
- setter((prev) => {
6
- for (const key in next) {
7
- if (prev[key] !== next[key]) {
8
- return { ...prev, ...next };
9
- }
10
- }
11
- return prev;
12
- });
13
- },
14
- [setter]
15
- );
16
- }
17
- export {
18
- createShallowUpdate
19
- };
20
- //# sourceMappingURL=createShallowUpdate.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/createShallowUpdate.tsx"],
4
- "sourcesContent": ["import React, { useCallback } from 'react'\n\nexport function createShallowUpdate<State extends Object>(\n setter: React.Dispatch<React.SetStateAction<State>>\n) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useCallback(\n (next: Partial<State>) => {\n setter((prev) => {\n for (const key in next) {\n if (prev[key] !== next[key]) {\n return { ...prev, ...next }\n }\n }\n return prev\n })\n },\n [setter]\n )\n}\n"],
5
- "mappings": "AAAA,SAAgB,mBAAmB;AAE5B,SAAS,oBACd,QACA;AAEA,SAAO;AAAA,IACL,CAAC,SAAyB;AACxB,aAAO,CAAC,SAAS;AACf,mBAAW,OAAO,MAAM;AACtB,cAAI,KAAK,SAAS,KAAK,MAAM;AAC3B,mBAAO,EAAE,GAAG,MAAM,GAAG,KAAK;AAAA,UAC5B;AAAA,QACF;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=validate.js.map
@@ -1,35 +0,0 @@
1
- import { isRSC, isServer } from "@tamagui/constants";
2
- import { useEffect, useState } from "react";
3
- let finished = false;
4
- const listeners = /* @__PURE__ */ new Set();
5
- function useSetupHasSSRRendered() {
6
- if (isServer || isRSC) {
7
- return;
8
- }
9
- useEffect(() => {
10
- finished = true;
11
- listeners.forEach((cb) => cb());
12
- listeners.clear();
13
- }, []);
14
- }
15
- function useDidFinishSSR() {
16
- if (isServer || isRSC) {
17
- return false;
18
- }
19
- const [did, setDid] = useState(finished);
20
- if (!finished) {
21
- useEffect(() => {
22
- const done = () => setDid(true);
23
- listeners.add(done);
24
- return () => {
25
- listeners.delete(done);
26
- };
27
- }, []);
28
- }
29
- return did;
30
- }
31
- export {
32
- useDidFinishSSR,
33
- useSetupHasSSRRendered
34
- };
35
- //# sourceMappingURL=useDidFinishSSR.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useDidFinishSSR.tsx"],
4
- "sourcesContent": ["import { isRSC, isServer } from '@tamagui/constants'\nimport { useEffect, useState } from 'react'\n\nlet finished = false\nconst listeners = new Set<Function>()\n\nexport function useSetupHasSSRRendered() {\n if (isServer || isRSC) {\n return\n }\n\n useEffect(() => {\n finished = true\n listeners.forEach((cb) => cb())\n listeners.clear()\n }, [])\n}\n\nexport function useDidFinishSSR() {\n if (isServer || isRSC) {\n return false\n }\n\n const [did, setDid] = useState(finished)\n\n // conditional hook because it never changes if already true\n if (!finished) {\n useEffect(() => {\n const done = () => setDid(true)\n listeners.add(done)\n return () => {\n listeners.delete(done)\n }\n }, [])\n }\n\n return did\n}\n"],
5
- "mappings": "AAAA,SAAS,OAAO,gBAAgB;AAChC,SAAS,WAAW,gBAAgB;AAEpC,IAAI,WAAW;AACf,MAAM,YAAY,oBAAI,IAAc;AAE7B,SAAS,yBAAyB;AACvC,MAAI,YAAY,OAAO;AACrB;AAAA,EACF;AAEA,YAAU,MAAM;AACd,eAAW;AACX,cAAU,QAAQ,CAAC,OAAO,GAAG,CAAC;AAC9B,cAAU,MAAM;AAAA,EAClB,GAAG,CAAC,CAAC;AACP;AAEO,SAAS,kBAAkB;AAChC,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,QAAQ;AAGvC,MAAI,CAAC,UAAU;AACb,cAAU,MAAM;AACd,YAAM,OAAO,MAAM,OAAO,IAAI;AAC9B,gBAAU,IAAI,IAAI;AAClB,aAAO,MAAM;AACX,kBAAU,OAAO,IAAI;AAAA,MACvB;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,22 +0,0 @@
1
- import { isServer, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
2
- import { useState } from "react";
3
- import { startTransition } from "../helpers/startTransition";
4
- const useIsSSR = (props) => {
5
- const [val, setVal] = useState(true);
6
- if (isWeb && !isServer) {
7
- useIsomorphicLayoutEffect(() => {
8
- if (props == null ? void 0 : props.immediate) {
9
- setVal(false);
10
- } else {
11
- startTransition(() => {
12
- setVal(false);
13
- });
14
- }
15
- }, []);
16
- }
17
- return val;
18
- };
19
- export {
20
- useIsSSR
21
- };
22
- //# sourceMappingURL=useIsSSR.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useIsSSR.tsx"],
4
- "sourcesContent": ["import { isServer, isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { useState } from 'react'\n\nimport { startTransition } from '../helpers/startTransition'\n\n// because any change before first useEffect causes hydration / mismatch issues\n\nexport const useIsSSR = (props?: { immediate?: boolean }) => {\n const [val, setVal] = useState(true)\n\n if (isWeb && !isServer) {\n useIsomorphicLayoutEffect(() => {\n // could also have a global tamagui `config.immediateSSRTransition`\n if (props?.immediate) {\n setVal(false)\n } else {\n startTransition(() => {\n setVal(false)\n })\n }\n }, [])\n }\n\n return val\n}\n"],
5
- "mappings": "AAAA,SAAS,UAAU,OAAO,iCAAiC;AAC3D,SAAS,gBAAgB;AAEzB,SAAS,uBAAuB;AAIzB,MAAM,WAAW,CAAC,UAAoC;AAC3D,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,IAAI;AAEnC,MAAI,SAAS,CAAC,UAAU;AACtB,8BAA0B,MAAM;AAE9B,UAAI,+BAAO,WAAW;AACpB,eAAO,KAAK;AAAA,MACd,OAAO;AACL,wBAAgB,MAAM;AACpB,iBAAO,KAAK;AAAA,QACd,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,178 +0,0 @@
1
- import { accessibilityRoleToWebRole, processIDRefList } from '../createComponent'
2
-
3
- // adapted from react-native-web
4
-
5
- export function assignNativePropsToWeb(elementType: string, viewProps: any, nativeProps: any) {
6
- if (!viewProps.role && nativeProps.accessibilityRole) {
7
- if (nativeProps.accessibilityRole === 'none') {
8
- viewProps.role = 'presentation'
9
- } else {
10
- const webRole = accessibilityRoleToWebRole[nativeProps.accessibilityRole]
11
- if (webRole != null) {
12
- viewProps.role = webRole || nativeProps.accessibilityRole
13
- }
14
- }
15
- }
16
-
17
- if (nativeProps.accessibilityActiveDescendant != null) {
18
- viewProps['aria-activedescendant'] = nativeProps.accessibilityActiveDescendant
19
- }
20
- if (nativeProps.accessibilityAtomic != null) {
21
- viewProps['aria-atomic'] = nativeProps.accessibilityAtomic
22
- }
23
- if (nativeProps.accessibilityAutoComplete != null) {
24
- viewProps['aria-autocomplete'] = nativeProps.accessibilityAutoComplete
25
- }
26
- if (nativeProps.accessibilityBusy != null) {
27
- viewProps['aria-busy'] = nativeProps.accessibilityBusy
28
- }
29
- if (nativeProps.accessibilityChecked != null) {
30
- viewProps['aria-checked'] = nativeProps.accessibilityChecked
31
- }
32
- if (nativeProps.accessibilityColumnCount != null) {
33
- viewProps['aria-colcount'] = nativeProps.accessibilityColumnCount
34
- }
35
- if (nativeProps.accessibilityColumnIndex != null) {
36
- viewProps['aria-colindex'] = nativeProps.accessibilityColumnIndex
37
- }
38
- if (nativeProps.accessibilityColumnSpan != null) {
39
- viewProps['aria-colspan'] = nativeProps.accessibilityColumnSpan
40
- }
41
- if (nativeProps.accessibilityControls != null) {
42
- viewProps['aria-controls'] = processIDRefList(nativeProps.accessibilityControls)
43
- }
44
- if (nativeProps.accessibilityCurrent != null) {
45
- viewProps['aria-current'] = nativeProps.accessibilityCurrent
46
- }
47
- if (nativeProps.accessibilityDescribedBy != null) {
48
- viewProps['aria-describedby'] = processIDRefList(nativeProps.accessibilityDescribedBy)
49
- }
50
- if (nativeProps.accessibilityDetails != null) {
51
- viewProps['aria-details'] = nativeProps.accessibilityDetails
52
- }
53
- if (nativeProps.disabled === true) {
54
- viewProps['aria-disabled'] = true
55
- // Enhance with native semantics
56
- if (
57
- elementType === 'button' ||
58
- elementType === 'form' ||
59
- elementType === 'input' ||
60
- elementType === 'select' ||
61
- elementType === 'textarea'
62
- ) {
63
- viewProps.disabled = true
64
- }
65
- }
66
- if (nativeProps.accessibilityErrorMessage != null) {
67
- viewProps['aria-errormessage'] = nativeProps.accessibilityErrorMessage
68
- }
69
- if (nativeProps.accessibilityExpanded != null) {
70
- viewProps['aria-expanded'] = nativeProps.accessibilityExpanded
71
- }
72
- if (nativeProps.accessibilityFlowTo != null) {
73
- viewProps['aria-flowto'] = processIDRefList(nativeProps.accessibilityFlowTo)
74
- }
75
- if (nativeProps.accessibilityHasPopup != null) {
76
- viewProps['aria-haspopup'] = nativeProps.accessibilityHasPopup
77
- }
78
- if (nativeProps.accessibilityHidden === true) {
79
- viewProps['aria-hidden'] = nativeProps.accessibilityHidden
80
- }
81
- if (nativeProps.accessibilityInvalid != null) {
82
- viewProps['aria-invalid'] = nativeProps.accessibilityInvalid
83
- }
84
- if (
85
- nativeProps.accessibilityKeyShortcuts != null &&
86
- Array.isArray(nativeProps.accessibilityKeyShortcuts)
87
- ) {
88
- viewProps['aria-keyshortcuts'] = nativeProps.accessibilityKeyShortcuts.join(' ')
89
- }
90
- if (nativeProps.accessibilityLabel != null) {
91
- viewProps['aria-label'] = nativeProps.accessibilityLabel
92
- }
93
- if (nativeProps.accessibilityLabelledBy != null) {
94
- viewProps['aria-labelledby'] = processIDRefList(nativeProps.accessibilityLabelledBy)
95
- }
96
- if (nativeProps.accessibilityLevel != null) {
97
- viewProps['aria-level'] = nativeProps.accessibilityLevel
98
- }
99
- if (nativeProps.accessibilityLiveRegion != null) {
100
- viewProps['aria-live'] =
101
- nativeProps.accessibilityLiveRegion === 'none' ? 'off' : nativeProps.accessibilityLiveRegion
102
- }
103
- if (nativeProps.accessibilityModal != null) {
104
- viewProps['aria-modal'] = nativeProps.accessibilityModal
105
- }
106
- if (nativeProps.accessibilityMultiline != null) {
107
- viewProps['aria-multiline'] = nativeProps.accessibilityMultiline
108
- }
109
- if (nativeProps.accessibilityMultiSelectable != null) {
110
- viewProps['aria-multiselectable'] = nativeProps.accessibilityMultiSelectable
111
- }
112
- if (nativeProps.accessibilityOrientation != null) {
113
- viewProps['aria-orientation'] = nativeProps.accessibilityOrientation
114
- }
115
- if (nativeProps.accessibilityOwns != null) {
116
- viewProps['aria-owns'] = processIDRefList(nativeProps.accessibilityOwns)
117
- }
118
- if (nativeProps.accessibilityPlaceholder != null) {
119
- viewProps['aria-placeholder'] = nativeProps.accessibilityPlaceholder
120
- }
121
- if (nativeProps.accessibilityPosInSet != null) {
122
- viewProps['aria-posinset'] = nativeProps.accessibilityPosInSet
123
- }
124
- if (nativeProps.accessibilityPressed != null) {
125
- viewProps['aria-pressed'] = nativeProps.accessibilityPressed
126
- }
127
- if (nativeProps.accessibilityReadOnly != null) {
128
- viewProps['aria-readonly'] = nativeProps.accessibilityReadOnly
129
- // Enhance with native semantics
130
- if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
131
- viewProps.readOnly = true
132
- }
133
- }
134
- if (nativeProps.accessibilityRequired != null) {
135
- viewProps['aria-required'] = nativeProps.accessibilityRequired
136
- // Enhance with native semantics
137
- if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
138
- viewProps.required = true
139
- }
140
- }
141
- if (nativeProps.accessibilityRoleDescription != null) {
142
- viewProps['aria-roledescription'] = nativeProps.accessibilityRoleDescription
143
- }
144
- if (nativeProps.accessibilityRowCount != null) {
145
- viewProps['aria-rowcount'] = nativeProps.accessibilityRowCount
146
- }
147
- if (nativeProps.accessibilityRowIndex != null) {
148
- viewProps['aria-rowindex'] = nativeProps.accessibilityRowIndex
149
- }
150
- if (nativeProps.accessibilityRowSpan != null) {
151
- viewProps['aria-rowspan'] = nativeProps.accessibilityRowSpan
152
- }
153
- if (nativeProps.accessibilitySelected != null) {
154
- viewProps['aria-selected'] = nativeProps.accessibilitySelected
155
- }
156
- if (nativeProps.accessibilitySetSize != null) {
157
- viewProps['aria-setsize'] = nativeProps.accessibilitySetSize
158
- }
159
- if (nativeProps.accessibilitySort != null) {
160
- viewProps['aria-sort'] = nativeProps.accessibilitySort
161
- }
162
- if (nativeProps.accessibilityValueMax != null) {
163
- viewProps['aria-valuemax'] = nativeProps.accessibilityValueMax
164
- }
165
- if (nativeProps.accessibilityValueMin != null) {
166
- viewProps['aria-valuemin'] = nativeProps.accessibilityValueMin
167
- }
168
- if (nativeProps.accessibilityValueNow != null) {
169
- viewProps['aria-valuenow'] = nativeProps.accessibilityValueNow
170
- }
171
- if (nativeProps.accessibilityValueText != null) {
172
- viewProps['aria-valuetext'] = nativeProps.accessibilityValueText
173
- }
174
-
175
- if (nativeProps.nativeID) {
176
- viewProps.id = nativeProps.nativeID
177
- }
178
- }
@@ -1,68 +0,0 @@
1
- import { isWeb } from '@tamagui/constants'
2
-
3
- import { getVariableVariable } from '../createVariable'
4
- import { FontLineHeightTokens, FontSizeTokens, SizeTokens, SpaceTokens } from '../types'
5
-
6
- // unused code - not exported
7
-
8
- /**
9
- * Simple calc() that handles native + web
10
- * on web: outputs a calc() string
11
- * on native: outputs a plain number
12
- */
13
-
14
- export type CalcVal =
15
- | string
16
- | number
17
- | SizeTokens
18
- | SpaceTokens
19
- | FontSizeTokens
20
- | FontLineHeightTokens
21
-
22
- const operators = {
23
- '+': (a: number, b: number) => a + b,
24
- '-': (a: number, b: number) => a - b,
25
- '/': (a: number, b: number) => a / b,
26
- '*': (a: number, b: number) => a * b,
27
- }
28
-
29
- type Operator = keyof typeof operators
30
-
31
- export const calc = (...valuesAndOperators: (CalcVal | Operator)[]) => {
32
- if (isWeb) {
33
- let res = 'calc('
34
- for (const cur of valuesAndOperators) {
35
- if (operators[cur as any]) {
36
- // spaces are significant
37
- res += ' ' + cur + ' '
38
- } else {
39
- res += convertToVariableOrNumber(cur)
40
- }
41
- }
42
- return res + ')'
43
- }
44
-
45
- let res = 0
46
- let nextOp: any = null
47
- for (const cur of valuesAndOperators) {
48
- if (operators[cur as any]) {
49
- nextOp = operators[cur as any]
50
- } else {
51
- if (nextOp) {
52
- res = nextOp(res, cur)
53
- nextOp = null
54
- } else {
55
- res = +cur
56
- }
57
- }
58
- }
59
- return res
60
- }
61
-
62
- const convertToVariableOrNumber = (v: any) => {
63
- const varOrVal = getVariableVariable(v)
64
- if (typeof varOrVal === 'number') {
65
- return `${varOrVal}px`
66
- }
67
- return varOrVal
68
- }
@@ -1,43 +0,0 @@
1
- /* eslint-disable no-console */
2
- import { getVariableValue } from '../createVariable'
3
- import { FontSizeTokens, TextProps, VariantSpreadFunction } from '../types'
4
-
5
- export const getFont: VariantSpreadFunction<TextProps, FontSizeTokens> = (
6
- val = '$4',
7
- { fonts, theme, props }
8
- ) => {
9
- const family = getVariableValue(props.fontFamily) || '$body'
10
- const font = fonts[family] || fonts['$body']
11
- if (!font) {
12
- if (process.env.NODE_ENV === 'development') {
13
- console.warn('⚠️ no font found', { family, fontTokens: Object.keys(fonts), val })
14
- }
15
- return {} as any
16
- }
17
- const fontFamily = font.family
18
- const fontSize = props.fontSize || font.size[val]
19
- const lineHeight = props.lineHeight || font.lineHeight[val]
20
- const fontWeight = props.fontWeight || font.weight[val]
21
- const letterSpacing = props.letterSpacing || font.letterSpacing[val]
22
- const fontStyle = props.fontStyle || font.style?.[val]
23
- const textTransform = props.textTransform || font.transform?.[val]
24
- const color = props.color || font.color?.[val] || theme.color
25
- const style = {
26
- color,
27
- fontStyle,
28
- textTransform,
29
- fontFamily,
30
- fontWeight,
31
- letterSpacing,
32
- fontSize,
33
- lineHeight,
34
- }
35
- if (process.env.NODE_ENV === 'development') {
36
- if (props['debug']) {
37
- console.groupCollapsed(' 🔹 getFont', val, props['fontWeight'], props['fow'])
38
- console.log({ style, props, font })
39
- console.groupEnd()
40
- }
41
- }
42
- return style
43
- }
@@ -1,22 +0,0 @@
1
- import { SizeTokens, VariantSpreadExtras } from '../types'
2
- import { getSize, stepTokenUpOrDown } from './getSize'
3
-
4
- export type ScaleVariantExtras = Pick<VariantSpreadExtras<any>, 'tokens' | 'props' | 'fonts'>
5
-
6
- export const getButtonSize = (val: SizeTokens | number, { tokens }: VariantSpreadExtras<any>) => {
7
- if (typeof val === 'number') {
8
- return {
9
- paddingHorizontal: val * 0.25,
10
- height: val,
11
- borderRadius: val * 0.2,
12
- }
13
- }
14
- const ySize = getSize(val, 0)
15
- const xSize = stepTokenUpOrDown(tokens.space, val)
16
- const radiusToken = tokens.radius[val] ?? tokens.radius['$4']
17
- return {
18
- paddingHorizontal: xSize,
19
- height: ySize,
20
- borderRadius: radiusToken,
21
- }
22
- }
@@ -1,4 +0,0 @@
1
- import React from 'react'
2
-
3
- // backwards compat
4
- export const startTransition = React.startTransition || ((cb) => cb())
@@ -1,19 +0,0 @@
1
- import { useMemo, useRef } from 'react'
2
-
3
- type ResultBox<T> = { v: T }
4
-
5
- export function useConstant<T>(fn: () => T): T {
6
- // RSC compat
7
- if (typeof document === 'undefined') {
8
- // eslint-disable-next-line react-hooks/exhaustive-deps
9
- return useMemo(() => fn(), [])
10
- }
11
-
12
- const ref = useRef<ResultBox<T>>()
13
-
14
- if (!ref.current) {
15
- ref.current = { v: fn() }
16
- }
17
-
18
- return ref.current.v
19
- }
@@ -1,16 +0,0 @@
1
- import { useIsomorphicLayoutEffect } from '@tamagui/constants'
2
- import { useRef } from 'react'
3
-
4
- export function useIsMounted() {
5
- const isMounted = useRef(false)
6
-
7
- useIsomorphicLayoutEffect(() => {
8
- isMounted.current = true
9
-
10
- return () => {
11
- isMounted.current = false
12
- }
13
- }, [])
14
-
15
- return isMounted
16
- }
@@ -1,9 +0,0 @@
1
- import { Pressable, PressableProps } from 'react-native'
2
-
3
- const getPressable = Pressable?.['type']?.['render']
4
-
5
- export const usePressable = (props: PressableProps) => {
6
- const out = getPressable(props)
7
- const { children, style, ...pressableProps } = out.props
8
- return [pressableProps, style] as const
9
- }
@@ -1,5 +0,0 @@
1
- import { useEffect } from 'react'
2
-
3
- export function useUnmountEffect(callback: () => void) {
4
- return useEffect(() => () => callback(), [])
5
- }