@tamagui/core 1.0.1-rc.8 → 1.0.1-rc.9

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 (151) hide show
  1. package/dist/cjs/Pressability.js +32 -0
  2. package/dist/cjs/Pressability.js.map +7 -0
  3. package/dist/cjs/Pressability.native.js +32 -0
  4. package/dist/cjs/Pressability.native.js.map +7 -0
  5. package/dist/cjs/ThemeContext.js +30 -0
  6. package/dist/cjs/ThemeContext.js.map +7 -0
  7. package/dist/cjs/ThemeManager.js +211 -0
  8. package/dist/cjs/ThemeManager.js.map +7 -0
  9. package/dist/cjs/conf.js +70 -0
  10. package/dist/cjs/conf.js.map +7 -0
  11. package/dist/cjs/constants/platform.js +4 -10
  12. package/dist/cjs/constants/platform.js.map +2 -2
  13. package/dist/cjs/constants/rnw.native.js +28 -0
  14. package/dist/cjs/constants/rnw.native.js.map +7 -0
  15. package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +1 -1
  16. package/dist/cjs/createTamagui.js +2 -0
  17. package/dist/cjs/createTamagui.js.map +2 -2
  18. package/dist/cjs/defaultComponentState.js +2 -0
  19. package/dist/cjs/defaultComponentState.js.map +7 -0
  20. package/dist/cjs/helpers/assignNativePropsToWeb.js.map +1 -1
  21. package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +1 -1
  22. package/dist/cjs/helpers/calc.js.map +2 -2
  23. package/dist/cjs/helpers/createShallowUpdate.js +9 -12
  24. package/dist/cjs/helpers/createShallowUpdate.js.map +1 -1
  25. package/dist/cjs/helpers/createTamaguiProvider.js +65 -0
  26. package/dist/cjs/helpers/createTamaguiProvider.js.map +7 -0
  27. package/dist/cjs/helpers/cssHash.js +51 -0
  28. package/dist/cjs/helpers/cssHash.js.map +7 -0
  29. package/dist/cjs/helpers/expandStyle.test.js +10 -0
  30. package/dist/cjs/helpers/expandStyle.test.js.map +7 -0
  31. package/dist/cjs/helpers/getFont.js +2 -6
  32. package/dist/cjs/helpers/getFont.js.map +2 -2
  33. package/dist/cjs/helpers/getSplitStyles.js +14 -9
  34. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  35. package/dist/cjs/helpers/getStackSize.js.map +1 -1
  36. package/dist/cjs/helpers/insertStyleRule.js +60 -27
  37. package/dist/cjs/helpers/insertStyleRule.js.map +3 -3
  38. package/dist/cjs/helpers/nativeGestureHandler.native.js +19 -0
  39. package/dist/cjs/helpers/nativeGestureHandler.native.js.map +7 -0
  40. package/dist/cjs/helpers/normalizeValueWithProperty.js +3 -3
  41. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
  42. package/dist/cjs/helpers/startTransition.js +1 -4
  43. package/dist/cjs/helpers/startTransition.js.map +2 -2
  44. package/dist/cjs/helpers/themeable.js +2 -2
  45. package/dist/cjs/helpers/themeable.js.map +2 -2
  46. package/dist/cjs/helpers/wrapThemeManagerContext.js +37 -0
  47. package/dist/cjs/helpers/wrapThemeManagerContext.js.map +7 -0
  48. package/dist/cjs/hooks/useConstant.js +0 -3
  49. package/dist/cjs/hooks/useConstant.js.map +2 -2
  50. package/dist/cjs/hooks/useElementLayout.js +1 -1
  51. package/dist/cjs/hooks/useElementLayout.js.map +2 -2
  52. package/dist/cjs/hooks/useFeatures.js +201 -0
  53. package/dist/cjs/hooks/useFeatures.js.map +7 -0
  54. package/dist/cjs/hooks/useIsMounted.js.map +1 -1
  55. package/dist/cjs/hooks/useIsSSR.js +6 -10
  56. package/dist/cjs/hooks/useIsSSR.js.map +2 -2
  57. package/dist/cjs/hooks/useMedia.js +5 -0
  58. package/dist/cjs/hooks/useMedia.js.map +2 -2
  59. package/dist/cjs/hooks/usePressable.js.map +1 -1
  60. package/dist/cjs/hooks/usePrevious.js +1 -0
  61. package/dist/cjs/hooks/usePrevious.js.map +7 -0
  62. package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
  63. package/dist/cjs/styled.js +12 -0
  64. package/dist/cjs/styled.js.map +2 -2
  65. package/dist/cjs/views/TextAncestorContext.js +44 -0
  66. package/dist/cjs/views/TextAncestorContext.js.map +7 -0
  67. package/dist/cjs/views/ThemeInverse.js +20 -21
  68. package/dist/cjs/views/ThemeInverse.js.map +2 -2
  69. package/dist/cjs/views/ThemeReset.js +5 -10
  70. package/dist/cjs/views/ThemeReset.js.map +3 -3
  71. package/dist/esm/Pressability.js +7 -0
  72. package/dist/esm/Pressability.js.map +7 -0
  73. package/dist/esm/Pressability.native.js +7 -0
  74. package/dist/esm/Pressability.native.js.map +7 -0
  75. package/dist/esm/ThemeContext.js +6 -0
  76. package/dist/esm/ThemeContext.js.map +7 -0
  77. package/dist/esm/ThemeManager.js +185 -0
  78. package/dist/esm/ThemeManager.js.map +7 -0
  79. package/dist/esm/conf.js +39 -0
  80. package/dist/esm/conf.js.map +7 -0
  81. package/dist/esm/constants/platform.js +3 -7
  82. package/dist/esm/constants/platform.js.map +2 -2
  83. package/dist/esm/constants/rnw.native.js +5 -0
  84. package/dist/esm/constants/rnw.native.js.map +7 -0
  85. package/dist/esm/contexts/ButtonInsideButtonContext.js.map +1 -1
  86. package/dist/esm/createTamagui.js +7 -1
  87. package/dist/esm/createTamagui.js.map +2 -2
  88. package/dist/esm/defaultComponentState.js +1 -0
  89. package/dist/esm/defaultComponentState.js.map +7 -0
  90. package/dist/esm/helpers/assignNativePropsToWeb.js.map +1 -1
  91. package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +1 -1
  92. package/dist/esm/helpers/calc.js.map +2 -2
  93. package/dist/esm/helpers/createShallowUpdate.js +9 -12
  94. package/dist/esm/helpers/createShallowUpdate.js.map +1 -1
  95. package/dist/esm/helpers/createTamaguiProvider.js +38 -0
  96. package/dist/esm/helpers/createTamaguiProvider.js.map +7 -0
  97. package/dist/esm/helpers/cssHash.js +27 -0
  98. package/dist/esm/helpers/cssHash.js.map +7 -0
  99. package/dist/esm/helpers/expandStyle.test.js +9 -0
  100. package/dist/esm/helpers/expandStyle.test.js.map +7 -0
  101. package/dist/esm/helpers/getFont.js +2 -6
  102. package/dist/esm/helpers/getFont.js.map +2 -2
  103. package/dist/esm/helpers/getSplitStyles.js +16 -10
  104. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  105. package/dist/esm/helpers/getStackSize.js.map +1 -1
  106. package/dist/esm/helpers/insertStyleRule.js +58 -26
  107. package/dist/esm/helpers/insertStyleRule.js.map +3 -3
  108. package/dist/esm/helpers/nativeGestureHandler.native.js +2 -0
  109. package/dist/esm/helpers/nativeGestureHandler.native.js.map +7 -0
  110. package/dist/esm/helpers/normalizeValueWithProperty.js +3 -3
  111. package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
  112. package/dist/esm/helpers/startTransition.js.map +1 -1
  113. package/dist/esm/helpers/themeable.js +2 -2
  114. package/dist/esm/helpers/themeable.js.map +2 -2
  115. package/dist/esm/helpers/wrapThemeManagerContext.js +11 -0
  116. package/dist/esm/helpers/wrapThemeManagerContext.js.map +7 -0
  117. package/dist/esm/hooks/useConstant.js +1 -4
  118. package/dist/esm/hooks/useConstant.js.map +2 -2
  119. package/dist/esm/hooks/useElementLayout.js +1 -1
  120. package/dist/esm/hooks/useElementLayout.js.map +2 -2
  121. package/dist/esm/hooks/useFeatures.js +174 -0
  122. package/dist/esm/hooks/useFeatures.js.map +7 -0
  123. package/dist/esm/hooks/useIsMounted.js.map +1 -1
  124. package/dist/esm/hooks/useIsSSR.js +8 -12
  125. package/dist/esm/hooks/useIsSSR.js.map +2 -2
  126. package/dist/esm/hooks/useMedia.js +4 -0
  127. package/dist/esm/hooks/useMedia.js.map +2 -2
  128. package/dist/esm/hooks/usePressable.js.map +1 -1
  129. package/dist/esm/hooks/usePrevious.js +1 -0
  130. package/dist/esm/hooks/usePrevious.js.map +7 -0
  131. package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
  132. package/dist/esm/styled.js +12 -0
  133. package/dist/esm/styled.js.map +2 -2
  134. package/dist/esm/views/TextAncestorContext.js +15 -0
  135. package/dist/esm/views/TextAncestorContext.js.map +7 -0
  136. package/dist/esm/views/ThemeInverse.js +15 -20
  137. package/dist/esm/views/ThemeInverse.js.map +2 -2
  138. package/dist/esm/views/ThemeReset.js +4 -6
  139. package/dist/esm/views/ThemeReset.js.map +2 -2
  140. package/package.json +10 -11
  141. package/src/createTamagui.ts +8 -1
  142. package/src/helpers/getSplitStyles.tsx +17 -9
  143. package/src/helpers/insertStyleRule.tsx +70 -38
  144. package/src/helpers/normalizeValueWithProperty.ts +3 -3
  145. package/src/helpers/themeable.tsx +3 -3
  146. package/src/hooks/useElementLayout.tsx +1 -1
  147. package/src/hooks/useMedia.tsx +3 -0
  148. package/src/styled.tsx +15 -0
  149. package/types/helpers/insertStyleRule.d.ts +2 -1
  150. package/types/helpers/themeable.d.ts +1 -1
  151. package/types/hooks/useMedia.d.ts +1 -0
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var TextAncestorContext_exports = {};
23
+ __export(TextAncestorContext_exports, {
24
+ FallbackNativeContext: () => FallbackNativeContext,
25
+ TextAncestorContext: () => TextAncestorContext,
26
+ TextAncestorProvider: () => TextAncestorProvider
27
+ });
28
+ module.exports = __toCommonJS(TextAncestorContext_exports);
29
+ var import_rnw = require("@tamagui/rnw");
30
+ var import_react = __toESM(require("react"));
31
+ const FallbackNativeContext = (0, import_react.createContext)(false);
32
+ const TextAncestorContext = import_rnw.TextAncestorContext ?? FallbackNativeContext;
33
+ const TextAncestorProvider = (props) => {
34
+ return /* @__PURE__ */ import_react.default.createElement(TextAncestorContext.Provider, {
35
+ value: false
36
+ }, props.children);
37
+ };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ FallbackNativeContext,
41
+ TextAncestorContext,
42
+ TextAncestorProvider
43
+ });
44
+ //# sourceMappingURL=TextAncestorContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/views/TextAncestorContext.tsx"],
4
+ "sourcesContent": ["import { TextAncestorContext as RNWTextAncestorContext } from '@tamagui/rnw'\nimport React, { createContext } from 'react'\n\nexport const FallbackNativeContext = createContext(false)\n\nexport const TextAncestorContext = RNWTextAncestorContext ?? FallbackNativeContext\n\nexport const TextAncestorProvider = (props) => {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA8D;AAC9D,mBAAqC;AAE9B,MAAM,wBAAwB,gCAAc,KAAK;AAEjD,MAAM,sBAAsB,kCAA0B;AAEtD,MAAM,uBAAuB,CAAC,UAAU;AAC7C,SAAO,mDAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAAQ,MAAM,QAAS;AACrE;",
6
+ "names": []
7
+ }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,42 +17,39 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
18
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
22
  var ThemeInverse_exports = {};
20
23
  __export(ThemeInverse_exports, {
21
- ThemeInverse: () => ThemeInverse
24
+ ThemeInverse: () => ThemeInverse,
25
+ setThemeInversions: () => setThemeInversions
22
26
  });
23
27
  module.exports = __toCommonJS(ThemeInverse_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_react = require("react");
28
+ var import_react = __toESM(require("react"));
26
29
  var import_platform = require("../constants/platform");
27
30
  var import_useTheme = require("../hooks/useTheme");
28
31
  var import_Theme = require("./Theme");
29
- const ThemeInverse = ({
30
- children,
31
- disable
32
- }) => {
32
+ let inversions = {
33
+ light: "dark",
34
+ dark: "light"
35
+ };
36
+ function setThemeInversions(next) {
37
+ inversions = next;
38
+ }
39
+ const ThemeInverse = (props) => {
33
40
  const themeName = (0, import_useTheme.useThemeName)();
34
41
  const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
35
42
  const [name, setName] = (0, import_react.useState)(null);
36
43
  (0, import_platform.useIsomorphicLayoutEffect)(() => {
37
- if (themeName.startsWith("dark")) {
38
- setName("light");
39
- }
40
- if (themeName.startsWith("light")) {
41
- setName("dark");
42
- }
44
+ setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
43
45
  }, [defaultTheme, themeName]);
44
- if (disable) {
45
- return children;
46
- }
47
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
48
- name,
49
- children
50
- });
46
+ return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
47
+ name
48
+ }, props.children);
51
49
  };
52
50
  // Annotate the CommonJS export names for ESM import in node:
53
51
  0 && (module.exports = {
54
- ThemeInverse
52
+ ThemeInverse,
53
+ setThemeInversions
55
54
  });
56
55
  //# sourceMappingURL=ThemeInverse.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeInverse.tsx"],
4
- "sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\nexport const ThemeInverse = ({\n children,\n disable,\n}: {\n children: React.ReactNode\n disable?: boolean\n}) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n if (themeName.startsWith('dark')) {\n setName('light')\n }\n if (themeName.startsWith('light')) {\n setName('dark')\n }\n }, [defaultTheme, themeName])\n\n if (disable) {\n return children as JSX.Element\n }\n\n return <Theme name={name}>{children}</Theme>\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BS;AA/BT,mBAAgC;AAEhC,sBAA0C;AAC1C,sBAAkD;AAClD,mBAAsB;AAEf,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,gBAAY,8BAAa;AAC/B,QAAM,mBAAe,qCAAoB;AACzC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AAGpD,iDAA0B,MAAM;AAC9B,QAAI,UAAU,WAAW,MAAM,GAAG;AAChC,cAAQ,OAAO;AAAA,IACjB;AACA,QAAI,UAAU,WAAW,OAAO,GAAG;AACjC,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,SAAO,4CAAC;AAAA,IAAM;AAAA,IAAa;AAAA,GAAS;AACtC;",
4
+ "sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n setName(inversions[themeName] || inversions[defaultTheme || ''] || null)\n }, [defaultTheme, themeName])\n\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAEhC,sBAA0C;AAC1C,sBAAkD;AAClD,mBAAsB;AAItB,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAEO,MAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,YAAY,kCAAa;AAC/B,QAAM,eAAe,yCAAoB;AACzC,QAAM,CAAC,MAAM,WAAW,2BAAwB,IAAI;AAGpD,iDAA0B,MAAM;AAC9B,YAAQ,WAAW,cAAc,WAAW,gBAAgB,OAAO,IAAI;AAAA,EACzE,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,SAAO,mDAAC;AAAA,IAAM;AAAA,KAAa,MAAM,QAAS;AAC5C;",
6
6
  "names": []
7
7
  }
@@ -17,20 +17,16 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
24
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
22
  var ThemeReset_exports = {};
26
23
  __export(ThemeReset_exports, {
27
24
  ThemeReset: () => ThemeReset
28
25
  });
29
26
  module.exports = __toCommonJS(ThemeReset_exports);
30
- var import_jsx_runtime = require("react/jsx-runtime");
31
27
  var import_react = __toESM(require("react"));
32
28
  var import_platform = require("../constants/platform");
33
- var import_ThemeManager = require("../helpers/ThemeManager");
29
+ var import_ThemeManager = require("../ThemeManager");
34
30
  var import_Theme = require("./Theme");
35
31
  import_react.default["createElement"];
36
32
  const ThemeReset = (props) => {
@@ -55,12 +51,11 @@ const ThemeReset = (props) => {
55
51
  if (!themeManager || !props.children) {
56
52
  return props.children || null;
57
53
  }
58
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
54
+ return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
59
55
  className: "tui-theme-reset",
60
56
  reset: true,
61
- name,
62
- children: props.children
63
- });
57
+ name
58
+ }, props.children);
64
59
  };
65
60
  // Annotate the CommonJS export names for ESM import in node:
66
61
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeReset.tsx"],
4
- "sourcesContent": ["import React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (!isWeb || typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCI;AAtCJ,mBAA6D;AAE7D,sBAAsB;AACtB,0BAAoC;AACpC,mBAAsB;AAGtB,aAAAA,QAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,mBAAe,yBAAW,uCAAmB;AACnD,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AAKpD,MAAI,CAAC,yBAAS,OAAO,aAAa,aAAa;AAC7C,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,6CAAc,UAAU,CAAC;AAE7B,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,4CAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
6
- "names": ["React"]
4
+ "sourcesContent": ["import React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { ThemeManagerContext } from '../ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (!isWeb || typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6D;AAE7D,sBAAsB;AACtB,0BAAoC;AACpC,mBAAsB;AAGtB,qBAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,eAAe,6BAAW,uCAAmB;AACnD,QAAM,CAAC,MAAM,WAAW,2BAAwB,IAAI;AAKpD,MAAI,CAAC,yBAAS,OAAO,aAAa,aAAa;AAC7C,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,6CAAc,UAAU,CAAC;AAE7B,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,mDAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,KACtC,MAAM,QACT;AAEJ;",
6
+ "names": []
7
7
  }
@@ -0,0 +1,7 @@
1
+ const Pressability = {};
2
+ const usePressability = {};
3
+ export {
4
+ Pressability,
5
+ usePressability
6
+ };
7
+ //# sourceMappingURL=Pressability.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Pressability.tsx"],
4
+ "sourcesContent": ["export const Pressability = {} as any\nexport const usePressability = {} as Function\n"],
5
+ "mappings": "AAAO,MAAM,eAAe,CAAC;AACtB,MAAM,kBAAkB,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ const Pressability = require("react-native/Libraries/Pressability/Pressability").default;
2
+ const usePressability = require("react-native/Libraries/Pressability/usePressability").default;
3
+ export {
4
+ Pressability,
5
+ usePressability
6
+ };
7
+ //# sourceMappingURL=Pressability.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Pressability.native.tsx"],
4
+ "sourcesContent": ["export const Pressability = require('react-native/Libraries/Pressability/Pressability').default\nexport const usePressability =\n require('react-native/Libraries/Pressability/usePressability').default\n"],
5
+ "mappings": "AAAO,MAAM,eAAe,QAAQ,kDAAkD,EAAE;AACjF,MAAM,kBACX,QAAQ,qDAAqD,EAAE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import { createContext } from "react";
2
+ const ThemeContext = createContext(null);
3
+ export {
4
+ ThemeContext
5
+ };
6
+ //# sourceMappingURL=ThemeContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ThemeContext.tsx"],
4
+ "sourcesContent": ["import { createContext } from 'react'\n\nimport { ThemeName, Themes } from './types'\n\nexport const ThemeContext = createContext<{ themes: Themes; defaultTheme: ThemeName } | null>(null)\n"],
5
+ "mappings": "AAAA;AAIO,MAAM,eAAe,cAAkE,IAAI;",
6
+ "names": []
7
+ }
@@ -0,0 +1,185 @@
1
+ import { createContext } from "react";
2
+ import { getThemes } from "./conf";
3
+ import { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from "./constants/constants";
4
+ import { getThemeUnwrapped } from "./hooks/getThemeUnwrapped";
5
+ class ThemeManager {
6
+ constructor(name = "", theme = null, parentManager = null, reset = false) {
7
+ this.name = name;
8
+ this.theme = theme;
9
+ this.parentManager = parentManager;
10
+ this.reset = reset;
11
+ this.keys = /* @__PURE__ */ new Map();
12
+ this.listeners = /* @__PURE__ */ new Map();
13
+ this.themeListeners = /* @__PURE__ */ new Set();
14
+ this.className = null;
15
+ let parent = parentManager;
16
+ let tries = 0;
17
+ while (true) {
18
+ tries++;
19
+ if (tries > 10) {
20
+ throw new Error(`Nested 10 of the same theme in a row, likely error`);
21
+ }
22
+ if (!parent)
23
+ break;
24
+ if (parent.name === name) {
25
+ parent = parent.parentManager;
26
+ } else {
27
+ this.parentManager = parent;
28
+ break;
29
+ }
30
+ }
31
+ }
32
+ get didChangeTheme() {
33
+ return this.parentManager && this.name !== this.parentManager.fullName;
34
+ }
35
+ get parentName() {
36
+ var _a;
37
+ return ((_a = this.parentManager) == null ? void 0 : _a.name) || null;
38
+ }
39
+ get fullName() {
40
+ return this.getNextTheme().name || this.name || "";
41
+ }
42
+ getValue(key) {
43
+ let theme = this.theme;
44
+ let manager = this;
45
+ while (true) {
46
+ if (!theme)
47
+ return;
48
+ if (key in theme) {
49
+ return theme[key];
50
+ }
51
+ manager = this.parentManager;
52
+ if (!manager) {
53
+ return;
54
+ }
55
+ if (manager.theme === theme) {
56
+ return;
57
+ }
58
+ theme = manager.theme;
59
+ }
60
+ }
61
+ update({ name, theme, className } = {}) {
62
+ const nameChanged = name !== this.name;
63
+ if (!nameChanged) {
64
+ return false;
65
+ }
66
+ this.className = className || null;
67
+ this.name = name || "";
68
+ this.theme = theme;
69
+ this.notifyListeners();
70
+ return true;
71
+ }
72
+ getNextTheme(props = {}, debug) {
73
+ var _a;
74
+ const { themes = getThemes(), name, componentName } = props;
75
+ if (props.reset && name) {
76
+ return {
77
+ name,
78
+ theme: themes[name],
79
+ className: this.getClassName(name)
80
+ };
81
+ }
82
+ const parentIsReset = (_a = this.parentManager) == null ? void 0 : _a.reset;
83
+ if (!name) {
84
+ if (componentName) {
85
+ const names = [
86
+ `${this.name}_${componentName}`,
87
+ `${withoutComponentName(this.name)}_${componentName}`
88
+ ];
89
+ for (const name2 of names) {
90
+ if (name2 in themes) {
91
+ const className = this.getClassName(name2);
92
+ return { name: name2, theme: themes[name2], className };
93
+ }
94
+ }
95
+ }
96
+ return {
97
+ name: this.name,
98
+ theme: this.theme
99
+ };
100
+ }
101
+ let nextName = name || this.name || "";
102
+ let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
103
+ while (true) {
104
+ if (nextName in themes) {
105
+ break;
106
+ }
107
+ nextName = `${parentName}_${name}`;
108
+ if (nextName in themes) {
109
+ break;
110
+ }
111
+ if (!parentName.includes(THEME_NAME_SEPARATOR)) {
112
+ console.warn("theme not found", name);
113
+ break;
114
+ }
115
+ parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR));
116
+ }
117
+ if (componentName) {
118
+ const names = [
119
+ `${nextName}_${componentName}`,
120
+ `${withoutComponentName(nextName)}_${componentName}`
121
+ ];
122
+ for (const name2 of names) {
123
+ if (name2 in themes) {
124
+ nextName = name2;
125
+ }
126
+ }
127
+ }
128
+ let theme = themes[nextName];
129
+ if (!theme) {
130
+ theme = themes[`light_${nextName}`];
131
+ }
132
+ if (process.env.NODE_ENV === "development") {
133
+ if (debug) {
134
+ console.log("getNextTheme", this.getClassName(nextName), { props, nextName, parentName });
135
+ }
136
+ }
137
+ return {
138
+ name: nextName,
139
+ theme: getThemeUnwrapped(theme),
140
+ className: this.getClassName(nextName)
141
+ };
142
+ }
143
+ getClassName(name) {
144
+ return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
145
+ }
146
+ track(uuid, keys) {
147
+ if (!this.name)
148
+ return;
149
+ this.keys.set(uuid, keys);
150
+ }
151
+ notifyListeners() {
152
+ var _a;
153
+ if (!this.name) {
154
+ this.keys.clear();
155
+ }
156
+ for (const [uuid, keys] of this.keys.entries()) {
157
+ if (keys.size) {
158
+ (_a = this.listeners.get(uuid)) == null ? void 0 : _a();
159
+ }
160
+ }
161
+ this.themeListeners.forEach((cb) => cb(this.name, this));
162
+ }
163
+ onChangeTheme(cb) {
164
+ this.themeListeners.add(cb);
165
+ return () => {
166
+ this.themeListeners.delete(cb);
167
+ };
168
+ }
169
+ onUpdate(uuid, cb) {
170
+ this.listeners.set(uuid, cb);
171
+ return () => {
172
+ this.listeners.delete(uuid);
173
+ this.keys.delete(uuid);
174
+ };
175
+ }
176
+ }
177
+ const ThemeManagerContext = createContext(null);
178
+ const emptyManager = new ThemeManager();
179
+ const withoutComponentName = (name) => name.replace(/(\_[A-Z][a-zA-Z]+)+$/g, "");
180
+ export {
181
+ ThemeManager,
182
+ ThemeManagerContext,
183
+ emptyManager
184
+ };
185
+ //# sourceMappingURL=ThemeManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ThemeManager.tsx"],
4
+ "sourcesContent": ["import { createContext } from 'react'\n\nimport { getThemes } from './conf'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from './constants/constants'\nimport { getThemeUnwrapped } from './hooks/getThemeUnwrapped'\nimport { ThemeObject, Themes } from './types'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n}\n\nexport type GetNextThemeProps = {\n themes?: Themes\n name?: string | null\n componentName?: string | null\n reset?: boolean\n}\n\nexport class ThemeManager {\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n className: string | null = null\n\n constructor(\n public name: string = '',\n public theme: ThemeObject | null = null,\n public parentManager: ThemeManager | null = null,\n public reset: boolean = false\n ) {\n // find the nearest different parentManager\n let parent = parentManager\n let tries = 0\n while (true) {\n tries++\n if (tries > 10) {\n throw new Error(`Nested 10 of the same theme in a row, likely error`)\n }\n if (!parent) break\n if (parent.name === name) {\n // go up if same\n parent = parent.parentManager\n } else {\n this.parentManager = parent\n break\n }\n }\n }\n\n get didChangeTheme() {\n return this.parentManager && this.name !== this.parentManager.fullName\n }\n\n get parentName() {\n return this.parentManager?.name || null\n }\n\n get fullName(): string {\n return this.getNextTheme().name || this.name || ''\n // const parentName = this.parentManager?.fullName || ''\n // const name = this.name || ''\n // const parts = [...new Set([...`${parentName}_${name}`.split('_')])].filter(Boolean)\n // return parts.join('_')\n }\n\n // gets value going up to parents\n getValue(key: string) {\n let theme = this.theme\n let manager = this as ThemeManager | null\n while (true) {\n if (!theme) return\n if (key in theme) {\n return theme[key]\n }\n manager = this.parentManager\n if (!manager) {\n return\n }\n if (manager.theme === theme) {\n return\n }\n theme = manager.theme\n }\n }\n\n update({ name, theme, className }: SetActiveThemeProps = {}) {\n // className compare on web, avoids light/dark re-renders\n const nameChanged = name !== this.name\n if (!nameChanged) {\n return false\n }\n this.className = className || null\n this.name = name || ''\n this.theme = theme\n this.notifyListeners()\n return true\n }\n\n getNextTheme(props: GetNextThemeProps = {}, debug?: any) {\n const { themes = getThemes(), name, componentName } = props\n\n if (props.reset && name) {\n return {\n name: name,\n theme: themes[name],\n className: this.getClassName(name),\n }\n }\n\n const parentIsReset = this.parentManager?.reset\n\n if (!name) {\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${this.name}_${componentName}`,\n `${withoutComponentName(this.name)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n const className = this.getClassName(name)\n return { name, theme: themes[name], className }\n }\n }\n }\n return {\n name: this.name,\n theme: this.theme,\n }\n }\n\n let nextName = name || this.name || ''\n let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName\n\n while (true) {\n if (nextName in themes) {\n break\n }\n nextName = `${parentName}_${name}`\n if (nextName in themes) {\n break\n }\n if (!parentName.includes(THEME_NAME_SEPARATOR)) {\n // not found!\n console.warn('theme not found', name)\n // this happens in next during _document.getInitialProps and has a terrible/non-existent stack trace\n // throw new Error(`Theme not found: ${name}`)\n break\n }\n // go up one\n parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR))\n }\n\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${nextName}_${componentName}`,\n `${withoutComponentName(nextName)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n nextName = name\n }\n }\n }\n\n let theme = themes[nextName]\n if (!theme) {\n theme = themes[`light_${nextName}`]\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (debug) {\n console.log('getNextTheme', this.getClassName(nextName), { props, nextName, parentName })\n }\n }\n\n return {\n name: nextName,\n theme: getThemeUnwrapped(theme),\n className: this.getClassName(nextName),\n }\n }\n\n getClassName(name: string) {\n return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace('light_', '').replace('dark_', '')\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n notifyListeners() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager | null>(null)\nexport const emptyManager = new ThemeManager()\n\nconst withoutComponentName = (name: string) => name.replace(/(\\_[A-Z][a-zA-Z]+)+$/g, '')\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,39 @@
1
+ let conf;
2
+ const setConfig = (next) => {
3
+ conf = next;
4
+ if (configListeners.size) {
5
+ configListeners.forEach((cb) => cb(conf));
6
+ configListeners.clear();
7
+ }
8
+ };
9
+ const setConfigFont = (name, font, fontParsed) => {
10
+ if (process.env.NODE_ENV === "development") {
11
+ if (!conf)
12
+ throw new Error(`Haven't called createTamagui yet`);
13
+ }
14
+ Object.assign(conf.fonts, { [name]: font });
15
+ Object.assign(conf.fontsParsed, { [`$${name}`]: fontParsed });
16
+ };
17
+ const getHasConfigured = () => !!conf;
18
+ const getConfig = () => conf;
19
+ const getTokens = () => conf.tokensParsed;
20
+ const getThemes = () => conf.themes;
21
+ const configListeners = /* @__PURE__ */ new Set();
22
+ const onConfiguredOnce = (cb) => {
23
+ if (conf) {
24
+ cb(conf);
25
+ } else {
26
+ configListeners.add(cb);
27
+ }
28
+ };
29
+ export {
30
+ configListeners,
31
+ getConfig,
32
+ getHasConfigured,
33
+ getThemes,
34
+ getTokens,
35
+ onConfiguredOnce,
36
+ setConfig,
37
+ setConfigFont
38
+ };
39
+ //# sourceMappingURL=conf.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/conf.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"],
5
+ "mappings": "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;",
6
+ "names": []
7
+ }
@@ -5,12 +5,9 @@ const isAndroid = ((_a = Platform) == null ? void 0 : _a.OS) === "android";
5
5
  const isIOS = ((_b = Platform) == null ? void 0 : _b.OS) === "ios";
6
6
  const isWeb = process.env.TAMAGUI_TARGET === "web";
7
7
  const isWindowDefined = typeof window !== "undefined";
8
- const isServer = isWeb && !isWindowDefined;
8
+ const isSSR = isWeb && !isWindowDefined;
9
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;
10
+ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
14
11
  const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
15
12
  const isWebTouchable = isClient && "ontouchstart" in window;
16
13
  const isTouchable = !isWeb || isWebTouchable;
@@ -19,8 +16,7 @@ export {
19
16
  isChrome,
20
17
  isClient,
21
18
  isIOS,
22
- isRSC,
23
- isServer,
19
+ isSSR,
24
20
  isTouchable,
25
21
  isWeb,
26
22
  isWebTouchable,
@@ -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 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"],
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;",
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;AACA;AAEO,MAAM,YAAY,uCAAU,QAAO;AACnC,MAAM,QAAQ,uCAAU,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,YAAY;AACtD,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,5 @@
1
+ const rnw = {};
2
+ export {
3
+ rnw
4
+ };
5
+ //# sourceMappingURL=rnw.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/rnw.native.tsx"],
4
+ "sourcesContent": ["export const rnw = {} as any\n"],
5
+ "mappings": "AAAO,MAAM,MAAM,CAAC;",
6
+ "names": []
7
+ }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/contexts/ButtonInsideButtonContext.tsx"],
4
4
  "sourcesContent": ["import { createContext } from 'react'\n\nexport const ButtonInsideButtonContext = createContext(false)\n"],
5
- "mappings": "AAAA,SAAS,qBAAqB;AAEvB,MAAM,4BAA4B,cAAc,KAAK;",
5
+ "mappings": "AAAA;AAEO,MAAM,4BAA4B,cAAc,KAAK;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,11 @@ import { isRSC, isWeb } from "@tamagui/constants";
2
2
  import { configListeners, setConfig } from "./config";
3
3
  import { createVariables } from "./createVariables";
4
4
  import { getThemeCSSRules } from "./helpers/getThemeCSSRules";
5
- import { getAllRules } from "./helpers/insertStyleRule";
5
+ import {
6
+ getAllRules,
7
+ listenForSheetChanges,
8
+ scanAllSheets
9
+ } from "./helpers/insertStyleRule";
6
10
  import {
7
11
  registerCSSVariable,
8
12
  tokensValueToVariable,
@@ -29,6 +33,8 @@ function createTamagui(configIn) {
29
33
  throw new Error("Must define fonts");
30
34
  }
31
35
  }
36
+ scanAllSheets();
37
+ listenForSheetChanges();
32
38
  const fontTokens = Object.fromEntries(
33
39
  Object.entries(configIn.fonts).map(([k, v]) => {
34
40
  return [k, createVariables(v, "f", true)];