@tamagui/core 1.0.6 → 1.0.8

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 (192) hide show
  1. package/dist/cjs/createComponent.js.map +2 -2
  2. package/dist/cjs/helpers/ThemeManager.js +4 -24
  3. package/dist/cjs/helpers/ThemeManager.js.map +2 -2
  4. package/dist/cjs/helpers/createPropMapper.js +11 -16
  5. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  6. package/dist/cjs/helpers/expandStyles.js +10 -3
  7. package/dist/cjs/helpers/expandStyles.js.map +3 -3
  8. package/dist/cjs/helpers/getSplitStyles.js +8 -0
  9. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  10. package/dist/cjs/helpers/normalizeColor.js +16 -37
  11. package/dist/cjs/helpers/normalizeColor.js.map +3 -3
  12. package/dist/cjs/helpers/normalizeValueWithProperty.js +1 -1
  13. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
  14. package/dist/esm/createComponent.js.map +2 -2
  15. package/dist/esm/helpers/ThemeManager.js +4 -5
  16. package/dist/esm/helpers/ThemeManager.js.map +2 -2
  17. package/dist/esm/helpers/createPropMapper.js +11 -16
  18. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  19. package/dist/esm/helpers/expandStyles.js +5 -4
  20. package/dist/esm/helpers/expandStyles.js.map +2 -2
  21. package/dist/esm/helpers/getSplitStyles.js +8 -0
  22. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  23. package/dist/esm/helpers/normalizeColor.js +14 -35
  24. package/dist/esm/helpers/normalizeColor.js.map +3 -3
  25. package/dist/esm/helpers/normalizeValueWithProperty.js +1 -1
  26. package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
  27. package/package.json +11 -11
  28. package/src/createComponent.tsx +1 -0
  29. package/src/helpers/ThemeManager.tsx +4 -4
  30. package/src/helpers/createPropMapper.ts +12 -16
  31. package/src/helpers/expandStyles.ts +5 -4
  32. package/src/helpers/getSplitStyles.tsx +10 -0
  33. package/src/helpers/normalizeColor.ts +14 -38
  34. package/src/helpers/normalizeValueWithProperty.ts +1 -1
  35. package/types/helpers/ThemeManager.d.ts +1 -1
  36. package/types/helpers/normalizeColor.d.ts +2 -2
  37. package/dist/cjs/Pressability.js +0 -32
  38. package/dist/cjs/Pressability.js.map +0 -7
  39. package/dist/cjs/Pressability.native.js +0 -32
  40. package/dist/cjs/Pressability.native.js.map +0 -7
  41. package/dist/cjs/ThemeContext.js +0 -30
  42. package/dist/cjs/ThemeContext.js.map +0 -7
  43. package/dist/cjs/ThemeManager.js +0 -211
  44. package/dist/cjs/ThemeManager.js.map +0 -7
  45. package/dist/cjs/conf.js +0 -70
  46. package/dist/cjs/conf.js.map +0 -7
  47. package/dist/cjs/constants/platform.js +0 -59
  48. package/dist/cjs/constants/platform.js.map +0 -7
  49. package/dist/cjs/constants/platform.native.js +0 -62
  50. package/dist/cjs/constants/platform.native.js.map +0 -7
  51. package/dist/cjs/constants/rnw.native.js +0 -28
  52. package/dist/cjs/constants/rnw.native.js.map +0 -7
  53. package/dist/cjs/contexts/ButtonInsideButtonContext.js +0 -30
  54. package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +0 -7
  55. package/dist/cjs/contexts/ThemeContext.js +0 -30
  56. package/dist/cjs/contexts/ThemeContext.js.map +0 -7
  57. package/dist/cjs/defaultComponentState.js +0 -2
  58. package/dist/cjs/defaultComponentState.js.map +0 -7
  59. package/dist/cjs/helpers/Unwrap.js +0 -29
  60. package/dist/cjs/helpers/Unwrap.js.map +0 -7
  61. package/dist/cjs/helpers/areEqualSets.js +0 -38
  62. package/dist/cjs/helpers/areEqualSets.js.map +0 -7
  63. package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -188
  64. package/dist/cjs/helpers/assignNativePropsToWeb.js.map +0 -7
  65. package/dist/cjs/helpers/assignNativePropsToWeb.native.js +0 -30
  66. package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +0 -7
  67. package/dist/cjs/helpers/cache.js +0 -39
  68. package/dist/cjs/helpers/cache.js.map +0 -7
  69. package/dist/cjs/helpers/calc.js +0 -71
  70. package/dist/cjs/helpers/calc.js.map +0 -7
  71. package/dist/cjs/helpers/createShallowUpdate.js +0 -41
  72. package/dist/cjs/helpers/createShallowUpdate.js.map +0 -7
  73. package/dist/cjs/helpers/createTamaguiProvider.js +0 -65
  74. package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
  75. package/dist/cjs/helpers/cssHash.js +0 -51
  76. package/dist/cjs/helpers/cssHash.js.map +0 -7
  77. package/dist/cjs/helpers/expandStyle.test.js +0 -10
  78. package/dist/cjs/helpers/expandStyle.test.js.map +0 -7
  79. package/dist/cjs/helpers/getFont.js +0 -62
  80. package/dist/cjs/helpers/getFont.js.map +0 -7
  81. package/dist/cjs/helpers/getSize.js +0 -48
  82. package/dist/cjs/helpers/getSize.js.map +0 -7
  83. package/dist/cjs/helpers/getStackSize.js +0 -46
  84. package/dist/cjs/helpers/getStackSize.js.map +0 -7
  85. package/dist/cjs/helpers/nativeGestureHandler.native.js +0 -19
  86. package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
  87. package/dist/cjs/helpers/startTransition.js +0 -33
  88. package/dist/cjs/helpers/startTransition.js.map +0 -7
  89. package/dist/cjs/helpers/validate.js +0 -2
  90. package/dist/cjs/helpers/validate.js.map +0 -7
  91. package/dist/cjs/helpers/wrapThemeManagerContext.js +0 -37
  92. package/dist/cjs/helpers/wrapThemeManagerContext.js.map +0 -7
  93. package/dist/cjs/hooks/useConstant.js +0 -36
  94. package/dist/cjs/hooks/useConstant.js.map +0 -7
  95. package/dist/cjs/hooks/useFeatures.js +0 -201
  96. package/dist/cjs/hooks/useFeatures.js.map +0 -7
  97. package/dist/cjs/hooks/useIsMounted.js +0 -40
  98. package/dist/cjs/hooks/useIsMounted.js.map +0 -7
  99. package/dist/cjs/hooks/useIsSSR.js +0 -42
  100. package/dist/cjs/hooks/useIsSSR.js.map +0 -7
  101. package/dist/cjs/hooks/usePressable.js +0 -36
  102. package/dist/cjs/hooks/usePressable.js.map +0 -7
  103. package/dist/cjs/hooks/usePrevious.js +0 -1
  104. package/dist/cjs/hooks/usePrevious.js.map +0 -7
  105. package/dist/cjs/hooks/useUnmountEffect.js +0 -32
  106. package/dist/cjs/hooks/useUnmountEffect.js.map +0 -7
  107. package/dist/cjs/injectStyles.js +0 -40
  108. package/dist/cjs/injectStyles.js.map +0 -7
  109. package/dist/cjs/views/TextAncestorContext.js +0 -44
  110. package/dist/cjs/views/TextAncestorContext.js.map +0 -7
  111. package/dist/cjs/views/ThemeInverse.js +0 -55
  112. package/dist/cjs/views/ThemeInverse.js.map +0 -7
  113. package/dist/cjs/views/ThemeReset.js +0 -64
  114. package/dist/cjs/views/ThemeReset.js.map +0 -7
  115. package/dist/esm/Pressability.js +0 -7
  116. package/dist/esm/Pressability.js.map +0 -7
  117. package/dist/esm/Pressability.native.js +0 -7
  118. package/dist/esm/Pressability.native.js.map +0 -7
  119. package/dist/esm/ThemeContext.js +0 -6
  120. package/dist/esm/ThemeContext.js.map +0 -7
  121. package/dist/esm/ThemeManager.js +0 -185
  122. package/dist/esm/ThemeManager.js.map +0 -7
  123. package/dist/esm/conf.js +0 -39
  124. package/dist/esm/conf.js.map +0 -7
  125. package/dist/esm/constants/platform.js +0 -26
  126. package/dist/esm/constants/platform.js.map +0 -7
  127. package/dist/esm/constants/platform.native.js +0 -28
  128. package/dist/esm/constants/platform.native.js.map +0 -7
  129. package/dist/esm/constants/rnw.native.js +0 -5
  130. package/dist/esm/constants/rnw.native.js.map +0 -7
  131. package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -6
  132. package/dist/esm/contexts/ButtonInsideButtonContext.js.map +0 -7
  133. package/dist/esm/contexts/ThemeContext.js +0 -6
  134. package/dist/esm/contexts/ThemeContext.js.map +0 -7
  135. package/dist/esm/defaultComponentState.js +0 -1
  136. package/dist/esm/defaultComponentState.js.map +0 -7
  137. package/dist/esm/helpers/Unwrap.js +0 -5
  138. package/dist/esm/helpers/Unwrap.js.map +0 -7
  139. package/dist/esm/helpers/areEqualSets.js +0 -14
  140. package/dist/esm/helpers/areEqualSets.js.map +0 -7
  141. package/dist/esm/helpers/assignNativePropsToWeb.js +0 -164
  142. package/dist/esm/helpers/assignNativePropsToWeb.js.map +0 -7
  143. package/dist/esm/helpers/assignNativePropsToWeb.native.js +0 -6
  144. package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +0 -7
  145. package/dist/esm/helpers/cache.js +0 -15
  146. package/dist/esm/helpers/cache.js.map +0 -7
  147. package/dist/esm/helpers/calc.js +0 -47
  148. package/dist/esm/helpers/calc.js.map +0 -7
  149. package/dist/esm/helpers/createShallowUpdate.js +0 -17
  150. package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
  151. package/dist/esm/helpers/createTamaguiProvider.js +0 -38
  152. package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
  153. package/dist/esm/helpers/cssHash.js +0 -27
  154. package/dist/esm/helpers/cssHash.js.map +0 -7
  155. package/dist/esm/helpers/expandStyle.test.js +0 -9
  156. package/dist/esm/helpers/expandStyle.test.js.map +0 -7
  157. package/dist/esm/helpers/getFont.js +0 -38
  158. package/dist/esm/helpers/getFont.js.map +0 -7
  159. package/dist/esm/helpers/getSize.js +0 -23
  160. package/dist/esm/helpers/getSize.js.map +0 -7
  161. package/dist/esm/helpers/getStackSize.js +0 -22
  162. package/dist/esm/helpers/getStackSize.js.map +0 -7
  163. package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
  164. package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
  165. package/dist/esm/helpers/startTransition.js +0 -6
  166. package/dist/esm/helpers/startTransition.js.map +0 -7
  167. package/dist/esm/helpers/validate.js +0 -1
  168. package/dist/esm/helpers/validate.js.map +0 -7
  169. package/dist/esm/helpers/wrapThemeManagerContext.js +0 -11
  170. package/dist/esm/helpers/wrapThemeManagerContext.js.map +0 -7
  171. package/dist/esm/hooks/useConstant.js +0 -12
  172. package/dist/esm/hooks/useConstant.js.map +0 -7
  173. package/dist/esm/hooks/useFeatures.js +0 -174
  174. package/dist/esm/hooks/useFeatures.js.map +0 -7
  175. package/dist/esm/hooks/useIsMounted.js +0 -16
  176. package/dist/esm/hooks/useIsMounted.js.map +0 -7
  177. package/dist/esm/hooks/useIsSSR.js +0 -18
  178. package/dist/esm/hooks/useIsSSR.js.map +0 -7
  179. package/dist/esm/hooks/usePressable.js +0 -12
  180. package/dist/esm/hooks/usePressable.js.map +0 -7
  181. package/dist/esm/hooks/usePrevious.js +0 -1
  182. package/dist/esm/hooks/usePrevious.js.map +0 -7
  183. package/dist/esm/hooks/useUnmountEffect.js +0 -8
  184. package/dist/esm/hooks/useUnmountEffect.js.map +0 -7
  185. package/dist/esm/injectStyles.js +0 -16
  186. package/dist/esm/injectStyles.js.map +0 -7
  187. package/dist/esm/views/TextAncestorContext.js +0 -15
  188. package/dist/esm/views/TextAncestorContext.js.map +0 -7
  189. package/dist/esm/views/ThemeInverse.js +0 -27
  190. package/dist/esm/views/ThemeInverse.js.map +0 -7
  191. package/dist/esm/views/ThemeReset.js +0 -37
  192. package/dist/esm/views/ThemeReset.js.map +0 -7
@@ -1,36 +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 useConstant_exports = {};
20
- __export(useConstant_exports, {
21
- useConstant: () => useConstant
22
- });
23
- module.exports = __toCommonJS(useConstant_exports);
24
- var import_react = require("react");
25
- function useConstant(fn) {
26
- const ref = (0, import_react.useRef)();
27
- if (!ref.current) {
28
- ref.current = { v: fn() };
29
- }
30
- return ref.current.v;
31
- }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- useConstant
35
- });
36
- //# sourceMappingURL=useConstant.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useConstant.tsx"],
4
- "sourcesContent": ["import { useRef } from 'react'\n\ntype ResultBox<T> = { v: T }\nexport function useConstant<T>(fn: () => T): T {\n const ref = useRef<ResultBox<T>>()\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n return ref.current.v\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAGhB,qBAAwB,IAAgB;AAC7C,QAAM,MAAM,yBAAqB;AACjC,MAAI,CAAC,IAAI,SAAS;AAChB,QAAI,UAAU,EAAE,GAAG,GAAG,EAAE;AAAA,EAC1B;AACA,SAAO,IAAI,QAAQ;AACrB;",
6
- "names": []
7
- }
@@ -1,201 +0,0 @@
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 useFeatures_exports = {};
23
- __export(useFeatures_exports, {
24
- useFeatures: () => useFeatures
25
- });
26
- module.exports = __toCommonJS(useFeatures_exports);
27
- var import_react = __toESM(require("react"));
28
- var import_conf = require("../conf");
29
- var import_platform = require("../constants/platform");
30
- var import_getSplitStyles = require("../helpers/getSplitStyles");
31
- var import_useMedia = require("./useMedia");
32
- const createDefinition = ({
33
- Component,
34
- propNames
35
- }) => ({
36
- isEnabled: (props) => propNames.some((name) => !!props[name]),
37
- Component
38
- });
39
- let featureDefinitions = null;
40
- let tamaguiConfig;
41
- const useFeatures = (props, utils) => {
42
- if (!featureDefinitions) {
43
- featureDefinitions = loadFeatures();
44
- }
45
- const elements = [];
46
- const enabled = {};
47
- for (const name in featureDefinitions) {
48
- const { isEnabled, Component } = featureDefinitions[name];
49
- if (isEnabled(props) && Component) {
50
- enabled[name] = true;
51
- elements.push(/* @__PURE__ */ import_react.default.createElement(Component, {
52
- key: name,
53
- ...props,
54
- _utils: utils
55
- }));
56
- }
57
- }
58
- return {
59
- elements,
60
- enabled
61
- };
62
- };
63
- function loadFeatures() {
64
- return {
65
- animation: loadAnimationFeature(),
66
- mediaQuery: loadMediaQueryFeature()
67
- };
68
- }
69
- function loadAnimationFeature() {
70
- tamaguiConfig = tamaguiConfig || (0, import_conf.getConfig)();
71
- return createDefinition({
72
- Component: ({ _utils, ...props }) => {
73
- const {
74
- state,
75
- useAnimations,
76
- pseudos,
77
- style: inStyle,
78
- setStateShallow,
79
- staticConfig,
80
- theme,
81
- onDidAnimate
82
- } = _utils;
83
- if (!useAnimations) {
84
- console.error("no useAnimations hook provided");
85
- return null;
86
- }
87
- const propsWithAnimation = props;
88
- const res = useAnimations(propsWithAnimation, {
89
- state,
90
- pseudos,
91
- onDidAnimate,
92
- staticConfig,
93
- getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
94
- var _a, _b, _c, _d;
95
- const style = inStyle || {};
96
- const enterStyle = isEntering ? enterVariant && ((_a = staticConfig.variants) == null ? void 0 : _a[enterVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)("", (_b = staticConfig.variants) == null ? void 0 : _b[enterVariant]["true"], staticConfig, theme, props, state, tamaguiConfig) || pseudos.enterStyle : pseudos.enterStyle : null;
97
- const exitStyle = isExiting ? exitVariant && ((_c = staticConfig.variants) == null ? void 0 : _c[exitVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)("", (_d = staticConfig.variants) == null ? void 0 : _d[exitVariant]["true"], staticConfig, theme, props, state, tamaguiConfig) || pseudos.exitStyle : pseudos.exitStyle : null;
98
- ensureBaseHasDefaults(style, enterStyle, pseudos.hoverStyle, pseudos.focusStyle, pseudos.pressStyle, pseudos.pressStyle);
99
- enterStyle && merge(style, enterStyle);
100
- state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle);
101
- state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle);
102
- state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle);
103
- exitStyle && merge(style, exitStyle);
104
- return style;
105
- }
106
- });
107
- (0, import_platform.useIsomorphicLayoutEffect)(() => {
108
- setStateShallow({
109
- animation: res
110
- });
111
- }, [res]);
112
- return null;
113
- },
114
- propNames: ["animation"]
115
- });
116
- }
117
- const defaults = {
118
- left: 0,
119
- right: 0,
120
- top: 0,
121
- bottom: 0,
122
- opacity: 1,
123
- translateX: 0,
124
- translateY: 0,
125
- skew: 0,
126
- skewX: 0,
127
- skewY: 0,
128
- scale: 1,
129
- rotate: "0deg",
130
- rotateY: "0deg",
131
- rotateX: "0deg"
132
- };
133
- function ensureBaseHasDefaults(base, ...pseudos) {
134
- for (const pseudo of pseudos) {
135
- if (!pseudo)
136
- continue;
137
- for (const key in pseudo) {
138
- const val = pseudo[key];
139
- if (key === "transform") {
140
- for (const t of val) {
141
- const tkey = Object.keys(t)[0];
142
- const defaultVal = defaults[tkey];
143
- const tDefaultVal = { [tkey]: defaultVal };
144
- if (!base.transform) {
145
- base.transform = [tDefaultVal];
146
- } else {
147
- if (!base.transform.find((x) => x[tkey])) {
148
- base.transform.push(tDefaultVal);
149
- }
150
- }
151
- }
152
- } else {
153
- if (!(key in base)) {
154
- base[key] = defaults[key];
155
- }
156
- }
157
- }
158
- }
159
- }
160
- function merge(base, next) {
161
- if (!next.transform || !base.transform) {
162
- Object.assign(base, next);
163
- return;
164
- }
165
- const { transform, ...rest } = next;
166
- Object.assign(base, rest);
167
- for (const t of transform) {
168
- const key = Object.keys(t)[0];
169
- const existing = base.transform.find((x) => key in x);
170
- if (existing) {
171
- existing[key] = t[key];
172
- } else {
173
- base.transform.push(t);
174
- }
175
- }
176
- }
177
- function loadMediaQueryFeature() {
178
- const mediaPropNames = Object.keys(import_useMedia.mediaState);
179
- return createDefinition({
180
- Component: (props) => {
181
- const mediaKeys = mediaPropNames.filter((x) => x in props);
182
- (0, import_platform.useIsomorphicLayoutEffect)(() => {
183
- for (const key of mediaKeys) {
184
- (0, import_useMedia.addMediaQueryListener)(key, props._utils.forceUpdate);
185
- }
186
- return () => {
187
- for (const key of mediaKeys) {
188
- (0, import_useMedia.removeMediaQueryListener)(key, props._utils.forceUpdate);
189
- }
190
- };
191
- }, [mediaKeys.join(",")]);
192
- return null;
193
- },
194
- propNames: mediaPropNames
195
- });
196
- }
197
- // Annotate the CommonJS export names for ESM import in node:
198
- 0 && (module.exports = {
199
- useFeatures
200
- });
201
- //# sourceMappingURL=useFeatures.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useFeatures.tsx"],
4
- "sourcesContent": ["import React from 'react'\nimport { RefObject } from 'react'\nimport { View, ViewStyle } from 'react-native'\n\nimport { getConfig } from '../conf'\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getSubStyle } from '../helpers/getSplitStyles'\nimport {\n PseudoStyles,\n SplitStyleState,\n StaticConfigParsed,\n TamaguiComponentState,\n TamaguiInternalConfig,\n UseAnimationHook,\n UseAnimationProps,\n} from '../types'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\ntype FeatureUtils = {\n forceUpdate: Function\n state: SplitStyleState\n setStateShallow: (next: Partial<TamaguiComponentState>) => void\n useAnimations?: UseAnimationHook\n pseudos: PseudoStyles\n style: ViewStyle | null | undefined\n staticConfig: StaticConfigParsed\n theme: any\n onDidAnimate?: () => void\n hostRef: RefObject<HTMLElement | View>\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: (props: { _utils: FeatureUtils; [key: string]: any }) => void\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\nlet tamaguiConfig: TamaguiInternalConfig\n\ntype FeatureKeys = keyof ReturnType<typeof loadFeatures>\n\nexport const useFeatures = (props: any, utils?: FeatureUtils) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const elements: JSX.Element[] = []\n const enabled: { [key in FeatureKeys]?: boolean } = {}\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n enabled[name] = true\n elements.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return {\n elements,\n enabled,\n }\n}\n\nfunction loadFeatures() {\n return {\n // loads animations and sets state with the results\n animation: loadAnimationFeature(),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n mediaQuery: loadMediaQueryFeature(),\n } as const\n}\n\nfunction loadAnimationFeature() {\n tamaguiConfig = tamaguiConfig || getConfig()\n\n return createDefinition({\n Component: ({ _utils, ...props }) => {\n const {\n state,\n useAnimations,\n pseudos,\n style: inStyle,\n setStateShallow,\n staticConfig,\n theme,\n onDidAnimate,\n } = _utils\n\n if (!useAnimations) {\n console.error('no useAnimations hook provided')\n return null\n }\n\n // we always have .animation set\n const propsWithAnimation = props as UseAnimationProps\n\n const res = useAnimations(propsWithAnimation, {\n state,\n pseudos,\n onDidAnimate,\n staticConfig,\n getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {\n // we have to merge such that transforms keys all exist\n const style = inStyle || {}\n\n const enterStyle = isEntering\n ? enterVariant && staticConfig.variants?.[enterVariant]['true']\n ? getSubStyle(\n '',\n staticConfig.variants?.[enterVariant]['true'],\n staticConfig,\n theme,\n props,\n state,\n tamaguiConfig\n ) || pseudos.enterStyle\n : null || pseudos.enterStyle\n : null\n\n const exitStyle = isExiting\n ? exitVariant && staticConfig.variants?.[exitVariant]['true']\n ? getSubStyle(\n '',\n staticConfig.variants?.[exitVariant]['true'],\n staticConfig,\n theme,\n props,\n state,\n tamaguiConfig\n ) || pseudos.exitStyle\n : null || pseudos.exitStyle\n : null\n\n // if you have hoverStyle={{ scale: 1.1 }} and don't have scale set on the base style\n // no animation will run! this is really confusing. this will look at all variants,\n // and fill in base styles if they don't exist. eg:\n // input:\n // base: {}\n // hoverStyle: { scale: 2 }\n // enterStyle: { x: 100 }\n // output:\n // base: { x: 0, scale: 1 }\n ensureBaseHasDefaults(\n style,\n enterStyle,\n pseudos.hoverStyle,\n pseudos.focusStyle,\n pseudos.pressStyle,\n pseudos.pressStyle\n )\n\n enterStyle && merge(style, enterStyle)\n state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle)\n state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle)\n state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle)\n exitStyle && merge(style, exitStyle)\n\n return style\n },\n //, delay\n })\n\n useIsomorphicLayoutEffect(() => {\n setStateShallow({\n animation: res,\n })\n }, [res])\n\n return null\n },\n propNames: ['animation'],\n })\n}\n\nconst defaults = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n opacity: 1,\n translateX: 0,\n translateY: 0,\n skew: 0,\n skewX: 0,\n skewY: 0,\n scale: 1,\n rotate: '0deg',\n rotateY: '0deg',\n rotateX: '0deg',\n}\n\nfunction ensureBaseHasDefaults(base: ViewStyle, ...pseudos: (ViewStyle | null | undefined)[]) {\n for (const pseudo of pseudos) {\n if (!pseudo) continue\n for (const key in pseudo) {\n const val = pseudo[key]\n if (key === 'transform') {\n for (const t of val) {\n const tkey = Object.keys(t)[0]\n const defaultVal = defaults[tkey]\n const tDefaultVal = { [tkey]: defaultVal } as any\n if (!base.transform) {\n base.transform = [tDefaultVal]\n } else {\n if (!base.transform.find((x) => x[tkey])) {\n base.transform.push(tDefaultVal)\n }\n }\n }\n } else {\n if (!(key in base)) {\n base[key] = defaults[key]\n }\n }\n }\n }\n}\n\nfunction merge(base: ViewStyle, next: ViewStyle) {\n if (!next.transform || !base.transform) {\n Object.assign(base, next)\n return\n }\n const { transform, ...rest } = next\n Object.assign(base, rest)\n for (const t of transform) {\n const key = Object.keys(t)[0]\n const existing = base.transform.find((x) => key in x)\n if (existing) {\n existing[key] = t[key]\n } else {\n base.transform.push(t)\n }\n }\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const mediaKeys = mediaPropNames.filter((x) => x in props)\n\n useIsomorphicLayoutEffect(() => {\n for (const key of mediaKeys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of mediaKeys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [mediaKeys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n\n// TODO\n// measureLayout: createDefinition({\n// Component: (props) => {\n// console.log('measure', props)\n// return null\n// },\n// propNames: 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AY,eAAe,OAAO,CAAC,MAAM,KAAK,KAAK;AAEzD,qDAA0B,MAAM;AAC9B,mBAAW,OAAO,WAAW;AAC3B,qDAAsB,KAAK,MAAM,OAAO,WAAW;AAAA,QACrD;AACA,eAAO,MAAM;AACX,qBAAW,OAAO,WAAW;AAC3B,0DAAyB,KAAK,MAAM,OAAO,WAAW;AAAA,UACxD;AAAA,QACF;AAAA,MACF,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;AAExB,aAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;",
6
- "names": []
7
- }
@@ -1,40 +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 useIsMounted_exports = {};
20
- __export(useIsMounted_exports, {
21
- useIsMounted: () => useIsMounted
22
- });
23
- module.exports = __toCommonJS(useIsMounted_exports);
24
- var import_react = require("react");
25
- var import_platform = require("../constants/platform");
26
- function useIsMounted() {
27
- const isMounted = (0, import_react.useRef)(false);
28
- (0, import_platform.useIsomorphicLayoutEffect)(() => {
29
- isMounted.current = true;
30
- return () => {
31
- isMounted.current = false;
32
- };
33
- }, []);
34
- return isMounted;
35
- }
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- useIsMounted
39
- });
40
- //# sourceMappingURL=useIsMounted.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useIsMounted.ts"],
4
- "sourcesContent": ["import { useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\n\nexport function useIsMounted() {\n const isMounted = useRef(false)\n\n useIsomorphicLayoutEffect(() => {\n isMounted.current = true\n\n return () => {\n isMounted.current = false\n }\n }, [])\n\n return isMounted\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAEvB,sBAA0C;AAEnC,wBAAwB;AAC7B,QAAM,YAAY,yBAAO,KAAK;AAE9B,iDAA0B,MAAM;AAC9B,cAAU,UAAU;AAEpB,WAAO,MAAM;AACX,gBAAU,UAAU;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,42 +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 useIsSSR_exports = {};
20
- __export(useIsSSR_exports, {
21
- useIsSSR: () => useIsSSR
22
- });
23
- module.exports = __toCommonJS(useIsSSR_exports);
24
- var import_react = require("react");
25
- var import_platform = require("../constants/platform");
26
- var import_startTransition = require("../helpers/startTransition");
27
- const useIsSSR = () => {
28
- const [val, setVal] = (0, import_react.useState)(import_platform.isSSR);
29
- (0, import_react.useEffect)(() => {
30
- if (import_platform.isWeb && !import_platform.isSSR) {
31
- (0, import_startTransition.startTransition)(() => {
32
- setVal(false);
33
- });
34
- }
35
- }, []);
36
- return val;
37
- };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- useIsSSR
41
- });
42
- //# sourceMappingURL=useIsSSR.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useIsSSR.tsx"],
4
- "sourcesContent": ["import { useEffect, useState } from 'react'\n\nimport { isSSR, isWeb } from '../constants/platform'\nimport { startTransition } from '../helpers/startTransition'\n\n// because any change before first useEffect causes hydration / mismatch issues\n\nexport const useIsSSR = () => {\n const [val, setVal] = useState(isSSR)\n\n useEffect(() => {\n if (isWeb && !isSSR) {\n startTransition(() => {\n setVal(false)\n })\n }\n }, [])\n\n return val\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAEpC,sBAA6B;AAC7B,6BAAgC;AAIzB,MAAM,WAAW,MAAM;AAC5B,QAAM,CAAC,KAAK,UAAU,2BAAS,qBAAK;AAEpC,8BAAU,MAAM;AACd,QAAI,yBAAS,CAAC,uBAAO;AACnB,kDAAgB,MAAM;AACpB,eAAO,KAAK;AAAA,MACd,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,36 +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 usePressable_exports = {};
20
- __export(usePressable_exports, {
21
- usePressable: () => usePressable
22
- });
23
- module.exports = __toCommonJS(usePressable_exports);
24
- var import_react_native = require("react-native");
25
- var _a, _b;
26
- const getPressable = (_b = (_a = import_react_native.Pressable) == null ? void 0 : _a["type"]) == null ? void 0 : _b["render"];
27
- const usePressable = (props) => {
28
- const out = getPressable(props);
29
- const { children, style, ...pressableProps } = out.props;
30
- return [pressableProps, style];
31
- };
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- usePressable
35
- });
36
- //# sourceMappingURL=usePressable.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/usePressable.tsx"],
4
- "sourcesContent": ["import { Pressable, PressableProps } from 'react-native'\n\nconst getPressable = Pressable?.['type']?.['render']\n\nexport const usePressable = (props: PressableProps) => {\n const out = getPressable(props)\n const { children, style, ...pressableProps } = out.props\n return [pressableProps, style] as const\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA0C;AAA1C;AAEA,MAAM,eAAe,iEAAY,YAAZ,mBAAsB;AAEpC,MAAM,eAAe,CAAC,UAA0B;AACrD,QAAM,MAAM,aAAa,KAAK;AAC9B,QAAM,EAAE,UAAU,UAAU,mBAAmB,IAAI;AACnD,SAAO,CAAC,gBAAgB,KAAK;AAC/B;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=usePrevious.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,32 +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 useUnmountEffect_exports = {};
20
- __export(useUnmountEffect_exports, {
21
- useUnmountEffect: () => useUnmountEffect
22
- });
23
- module.exports = __toCommonJS(useUnmountEffect_exports);
24
- var import_react = require("react");
25
- function useUnmountEffect(callback) {
26
- return (0, import_react.useEffect)(() => () => callback(), []);
27
- }
28
- // Annotate the CommonJS export names for ESM import in node:
29
- 0 && (module.exports = {
30
- useUnmountEffect
31
- });
32
- //# sourceMappingURL=useUnmountEffect.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useUnmountEffect.ts"],
4
- "sourcesContent": ["import { useEffect } from 'react'\n\nexport function useUnmountEffect(callback: () => void) {\n return useEffect(() => () => callback(), [])\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAEnB,0BAA0B,UAAsB;AACrD,SAAO,4BAAU,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC;AAC7C;",
6
- "names": []
7
- }
@@ -1,40 +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 injectStyles_exports = {};
20
- __export(injectStyles_exports, {
21
- injectStyles: () => injectStyles
22
- });
23
- module.exports = __toCommonJS(injectStyles_exports);
24
- const stylesheets = {};
25
- const injectStyles = ({ filePath, css }) => {
26
- let stylesheet = stylesheets[filePath];
27
- if (!stylesheet) {
28
- const styleEl = document.createElement("style");
29
- styleEl.setAttribute("data-file", filePath);
30
- styleEl.setAttribute("type", "text/css");
31
- stylesheet = stylesheets[filePath] = styleEl;
32
- document.head.appendChild(styleEl);
33
- }
34
- stylesheet.innerHTML = css;
35
- };
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- injectStyles
39
- });
40
- //# sourceMappingURL=injectStyles.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/injectStyles.ts"],
4
- "sourcesContent": ["// for vite dev mode\n\nconst stylesheets: Record<string, HTMLElement> = {}\n\ninterface InjectStylesOptions {\n filePath: string\n css: string\n}\n\nexport const injectStyles = ({ filePath, css }: InjectStylesOptions) => {\n let stylesheet = stylesheets[filePath]\n if (!stylesheet) {\n const styleEl = document.createElement('style')\n styleEl.setAttribute('data-file', filePath)\n styleEl.setAttribute('type', 'text/css')\n stylesheet = stylesheets[filePath] = styleEl\n document.head.appendChild(styleEl)\n }\n stylesheet.innerHTML = css\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,cAA2C,CAAC;AAO3C,MAAM,eAAe,CAAC,EAAE,UAAU,IAAI,MAA2B;AACtE,MAAI,aAAa,YAAY;AAC7B,MAAI,CAAC,YAAY;AACf,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,aAAa,aAAa,QAAQ;AAC1C,YAAQ,aAAa,QAAQ,UAAU;AACvC,iBAAa,YAAY,YAAY;AACrC,aAAS,KAAK,YAAY,OAAO;AAAA,EACnC;AACA,aAAW,YAAY;AACzB;",
6
- "names": []
7
- }
@@ -1,44 +0,0 @@
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
@@ -1,7 +0,0 @@
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,55 +0,0 @@
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 ThemeInverse_exports = {};
23
- __export(ThemeInverse_exports, {
24
- ThemeInverse: () => ThemeInverse,
25
- setThemeInversions: () => setThemeInversions
26
- });
27
- module.exports = __toCommonJS(ThemeInverse_exports);
28
- var import_react = __toESM(require("react"));
29
- var import_platform = require("../constants/platform");
30
- var import_useTheme = require("../hooks/useTheme");
31
- var import_Theme = require("./Theme");
32
- let inversions = {
33
- light: "dark",
34
- dark: "light"
35
- };
36
- function setThemeInversions(next) {
37
- inversions = next;
38
- }
39
- const ThemeInverse = (props) => {
40
- const themeName = (0, import_useTheme.useThemeName)();
41
- const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
42
- const [name, setName] = (0, import_react.useState)(null);
43
- (0, import_platform.useIsomorphicLayoutEffect)(() => {
44
- setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
45
- }, [defaultTheme, themeName]);
46
- return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
47
- name
48
- }, props.children);
49
- };
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- ThemeInverse,
53
- setThemeInversions
54
- });
55
- //# sourceMappingURL=ThemeInverse.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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\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
- "names": []
7
- }