@tamagui/core 1.0.1-beta.227 → 1.0.1-beta.228

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 (109) hide show
  1. package/dist/cjs/constants/platform.js +65 -0
  2. package/dist/cjs/constants/platform.js.map +7 -0
  3. package/dist/cjs/constants/platform.native.js +62 -0
  4. package/dist/cjs/constants/platform.native.js.map +7 -0
  5. package/dist/cjs/createComponent.js +17 -24
  6. package/dist/cjs/createComponent.js.map +2 -2
  7. package/dist/cjs/createVariable.js +1 -1
  8. package/dist/cjs/createVariable.js.map +2 -2
  9. package/dist/cjs/helpers/ThemeManager.js +1 -1
  10. package/dist/cjs/helpers/ThemeManager.js.map +2 -2
  11. package/dist/cjs/helpers/ThemeManager.test.js +16 -0
  12. package/dist/cjs/helpers/ThemeManager.test.js.map +2 -2
  13. package/dist/cjs/helpers/assignNativePropsToWeb.js +188 -0
  14. package/dist/cjs/helpers/assignNativePropsToWeb.js.map +7 -0
  15. package/dist/cjs/helpers/assignNativePropsToWeb.native.js +30 -0
  16. package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +7 -0
  17. package/dist/cjs/helpers/calc.js +71 -0
  18. package/dist/cjs/helpers/calc.js.map +7 -0
  19. package/dist/cjs/helpers/createPropMapper.js +3 -5
  20. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  21. package/dist/cjs/helpers/createShallowUpdate.js +44 -0
  22. package/dist/cjs/helpers/createShallowUpdate.js.map +7 -0
  23. package/dist/cjs/helpers/getFont.js +66 -0
  24. package/dist/cjs/helpers/getFont.js.map +7 -0
  25. package/dist/cjs/helpers/getSplitStyles.js +24 -24
  26. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  27. package/dist/cjs/helpers/getStackSize.js +46 -0
  28. package/dist/cjs/helpers/getStackSize.js.map +7 -0
  29. package/dist/cjs/helpers/startTransition.js +36 -0
  30. package/dist/cjs/helpers/startTransition.js.map +7 -0
  31. package/dist/cjs/helpers/timer.js +35 -0
  32. package/dist/cjs/helpers/timer.js.map +7 -0
  33. package/dist/cjs/helpers/validate.js +2 -0
  34. package/dist/cjs/helpers/validate.js.map +7 -0
  35. package/dist/cjs/hooks/useConstant.js +39 -0
  36. package/dist/cjs/hooks/useConstant.js.map +7 -0
  37. package/dist/cjs/hooks/useIsMounted.js +40 -0
  38. package/dist/cjs/hooks/useIsMounted.js.map +7 -0
  39. package/dist/cjs/hooks/useIsSSR.js +46 -0
  40. package/dist/cjs/hooks/useIsSSR.js.map +7 -0
  41. package/dist/cjs/hooks/usePressable.js +36 -0
  42. package/dist/cjs/hooks/usePressable.js.map +7 -0
  43. package/dist/cjs/hooks/useUnmountEffect.js +32 -0
  44. package/dist/cjs/hooks/useUnmountEffect.js.map +7 -0
  45. package/dist/cjs/injectStyles.js +40 -0
  46. package/dist/cjs/injectStyles.js.map +7 -0
  47. package/dist/cjs/views/ThemeInverse.js +18 -25
  48. package/dist/cjs/views/ThemeInverse.js.map +2 -2
  49. package/dist/cjs/views/ThemeReset.js +12 -12
  50. package/dist/cjs/views/ThemeReset.js.map +2 -2
  51. package/dist/esm/constants/platform.js +30 -0
  52. package/dist/esm/constants/platform.js.map +7 -0
  53. package/dist/esm/constants/platform.native.js +28 -0
  54. package/dist/esm/constants/platform.native.js.map +7 -0
  55. package/dist/esm/createComponent.js +17 -24
  56. package/dist/esm/createComponent.js.map +2 -2
  57. package/dist/esm/createVariable.js +1 -1
  58. package/dist/esm/createVariable.js.map +2 -2
  59. package/dist/esm/helpers/ThemeManager.js +1 -1
  60. package/dist/esm/helpers/ThemeManager.js.map +2 -2
  61. package/dist/esm/helpers/ThemeManager.test.js +16 -0
  62. package/dist/esm/helpers/ThemeManager.test.js.map +2 -2
  63. package/dist/esm/helpers/assignNativePropsToWeb.js +164 -0
  64. package/dist/esm/helpers/assignNativePropsToWeb.js.map +7 -0
  65. package/dist/esm/helpers/assignNativePropsToWeb.native.js +6 -0
  66. package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +7 -0
  67. package/dist/esm/helpers/calc.js +47 -0
  68. package/dist/esm/helpers/calc.js.map +7 -0
  69. package/dist/esm/helpers/createPropMapper.js +3 -5
  70. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  71. package/dist/esm/helpers/createShallowUpdate.js +20 -0
  72. package/dist/esm/helpers/createShallowUpdate.js.map +7 -0
  73. package/dist/esm/helpers/getFont.js +42 -0
  74. package/dist/esm/helpers/getFont.js.map +7 -0
  75. package/dist/esm/helpers/getSplitStyles.js +24 -24
  76. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  77. package/dist/esm/helpers/getStackSize.js +22 -0
  78. package/dist/esm/helpers/getStackSize.js.map +7 -0
  79. package/dist/esm/helpers/startTransition.js +6 -0
  80. package/dist/esm/helpers/startTransition.js.map +7 -0
  81. package/dist/esm/helpers/timer.js +11 -0
  82. package/dist/esm/helpers/timer.js.map +7 -0
  83. package/dist/esm/helpers/validate.js +1 -0
  84. package/dist/esm/helpers/validate.js.map +7 -0
  85. package/dist/esm/hooks/useConstant.js +15 -0
  86. package/dist/esm/hooks/useConstant.js.map +7 -0
  87. package/dist/esm/hooks/useIsMounted.js +16 -0
  88. package/dist/esm/hooks/useIsMounted.js.map +7 -0
  89. package/dist/esm/hooks/useIsSSR.js +22 -0
  90. package/dist/esm/hooks/useIsSSR.js.map +7 -0
  91. package/dist/esm/hooks/usePressable.js +12 -0
  92. package/dist/esm/hooks/usePressable.js.map +7 -0
  93. package/dist/esm/hooks/useUnmountEffect.js +8 -0
  94. package/dist/esm/hooks/useUnmountEffect.js.map +7 -0
  95. package/dist/esm/injectStyles.js +16 -0
  96. package/dist/esm/injectStyles.js.map +7 -0
  97. package/dist/esm/views/ThemeInverse.js +17 -23
  98. package/dist/esm/views/ThemeInverse.js.map +2 -2
  99. package/dist/esm/views/ThemeReset.js +12 -12
  100. package/dist/esm/views/ThemeReset.js.map +2 -2
  101. package/package.json +11 -11
  102. package/src/createComponent.tsx +15 -35
  103. package/src/createVariable.ts +1 -1
  104. package/src/helpers/ThemeManager.test.tsx +17 -0
  105. package/src/helpers/ThemeManager.tsx +4 -3
  106. package/src/helpers/createPropMapper.ts +4 -5
  107. package/src/helpers/getSplitStyles.tsx +26 -29
  108. package/src/helpers/timer.ts +9 -0
  109. package/types/helpers/timer.d.ts +2 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,39 @@
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
+ if (typeof document === "undefined") {
27
+ return (0, import_react.useMemo)(() => fn(), []);
28
+ }
29
+ const ref = (0, import_react.useRef)();
30
+ if (!ref.current) {
31
+ ref.current = { v: fn() };
32
+ }
33
+ return ref.current.v;
34
+ }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ useConstant
38
+ });
39
+ //# sourceMappingURL=useConstant.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hooks/useConstant.tsx"],
4
+ "sourcesContent": ["import { useMemo, useRef } from 'react'\n\ntype ResultBox<T> = { v: T }\n\nexport function useConstant<T>(fn: () => T): T {\n // RSC compat\n if (typeof document === 'undefined') {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => fn(), [])\n }\n\n const ref = useRef<ResultBox<T>>()\n\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n\n return ref.current.v\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAIzB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,aAAa,aAAa;AAEnC,eAAO,sBAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAAA,EAC/B;AAEA,QAAM,UAAM,qBAAqB;AAEjC,MAAI,CAAC,IAAI,SAAS;AAChB,QAAI,UAAU,EAAE,GAAG,GAAG,EAAE;AAAA,EAC1B;AAEA,SAAO,IAAI,QAAQ;AACrB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
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
@@ -0,0 +1,7 @@
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,SAAS,eAAe;AAC7B,QAAM,gBAAY,qBAAO,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
+ }
@@ -0,0 +1,46 @@
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 = (props) => {
28
+ const [val, setVal] = (0, import_react.useState)(true);
29
+ (0, import_platform.useIsomorphicLayoutEffect)(() => {
30
+ if (import_platform.isWeb && !import_platform.isServer) {
31
+ if (props == null ? void 0 : props.immediate) {
32
+ setVal(false);
33
+ } else {
34
+ (0, import_startTransition.startTransition)(() => {
35
+ setVal(false);
36
+ });
37
+ }
38
+ }
39
+ }, []);
40
+ return val;
41
+ };
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ useIsSSR
45
+ });
46
+ //# sourceMappingURL=useIsSSR.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hooks/useIsSSR.tsx"],
4
+ "sourcesContent": ["import { useState } from 'react'\n\nimport { isServer, isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\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 useIsomorphicLayoutEffect(() => {\n if (isWeb && !isServer) {\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,mBAAyB;AAEzB,sBAA2D;AAC3D,6BAAgC;AAIzB,MAAM,WAAW,CAAC,UAAoC;AAC3D,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,IAAI;AAEnC,iDAA0B,MAAM;AAC9B,QAAI,yBAAS,CAAC,0BAAU;AAEtB,UAAI,+BAAO,WAAW;AACpB,eAAO,KAAK;AAAA,MACd,OAAO;AACL,oDAAgB,MAAM;AACpB,iBAAO,KAAK;AAAA,QACd,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
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
@@ -0,0 +1,7 @@
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,gBAAe,gEAAY,YAAZ,mBAAsB;AAEpC,MAAM,eAAe,CAAC,UAA0B;AACrD,QAAM,MAAM,aAAa,KAAK;AAC9B,QAAM,EAAE,UAAU,UAAU,eAAe,IAAI,IAAI;AACnD,SAAO,CAAC,gBAAgB,KAAK;AAC/B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,7 @@
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,SAAS,iBAAiB,UAAsB;AACrD,aAAO,wBAAU,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC;AAC7C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
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
@@ -0,0 +1,7 @@
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
+ }
@@ -18,46 +18,39 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var ThemeInverse_exports = {};
20
20
  __export(ThemeInverse_exports, {
21
- ThemeInverse: () => ThemeInverse,
22
- useThemeInverse: () => useThemeInverse
21
+ ThemeInverse: () => ThemeInverse
23
22
  });
24
23
  module.exports = __toCommonJS(ThemeInverse_exports);
25
24
  var import_jsx_runtime = require("react/jsx-runtime");
26
- var import_constants = require("@tamagui/constants");
27
25
  var import_react = require("react");
26
+ var import_platform = require("../constants/platform");
28
27
  var import_useTheme = require("../hooks/useTheme");
29
28
  var import_Theme = require("./Theme");
30
- const toggleTheme = (themeName) => {
31
- return themeName.startsWith("light") ? "dark" : "light";
32
- };
33
- const useThemeInverse = (props = {}) => {
34
- const themeName = (0, import_useTheme.useThemeName)();
35
- const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
36
- const [name, setName] = (0, import_react.useState)(null);
37
- const curName = themeName || defaultTheme || "";
38
- if (import_constants.isWeb) {
39
- (0, import_constants.useIsomorphicLayoutEffect)(() => {
40
- setName(toggleTheme(curName));
41
- }, [defaultTheme, themeName]);
42
- return props.disable ? null : name;
43
- }
44
- return props.disable ? null : toggleTheme(curName);
45
- };
46
29
  const ThemeInverse = ({
47
30
  children,
48
31
  disable
49
32
  }) => {
50
- const inverseTheme = useThemeInverse({
51
- disable
52
- });
33
+ const themeName = (0, import_useTheme.useThemeName)();
34
+ const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
35
+ const [name, setName] = (0, import_react.useState)(null);
36
+ (0, import_platform.useIsomorphicLayoutEffect)(() => {
37
+ if (themeName.startsWith("dark")) {
38
+ setName("light");
39
+ }
40
+ if (themeName.startsWith("light")) {
41
+ setName("dark");
42
+ }
43
+ }, [defaultTheme, themeName]);
44
+ if (disable) {
45
+ return children;
46
+ }
53
47
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
54
- name: inverseTheme,
48
+ name,
55
49
  children
56
50
  });
57
51
  };
58
52
  // Annotate the CommonJS export names for ESM import in node:
59
53
  0 && (module.exports = {
60
- ThemeInverse,
61
- useThemeInverse
54
+ ThemeInverse
62
55
  });
63
56
  //# sourceMappingURL=ThemeInverse.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeInverse.tsx"],
4
- "sourcesContent": ["import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport React, { useState } from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\nexport type ThemeInverseProps = {\n disable?: boolean\n}\n\nconst toggleTheme = (themeName: string) => {\n return themeName.startsWith('light') ? 'dark' : 'light'\n}\n\nexport const useThemeInverse = (props: ThemeInverseProps = {}) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n const curName = themeName || defaultTheme || ''\n\n if (isWeb) {\n // for SSR must be in effect\n useIsomorphicLayoutEffect(() => {\n setName(toggleTheme(curName))\n }, [defaultTheme, themeName])\n\n return props.disable ? null : name\n }\n\n return props.disable ? null : toggleTheme(curName)\n}\n\nexport const ThemeInverse = ({\n children,\n disable,\n}: ThemeInverseProps & {\n children: React.ReactNode\n}) => {\n const inverseTheme = useThemeInverse({\n disable,\n })\n return <Theme name={inverseTheme}>{children}</Theme>\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCS;AAzCT,uBAAiD;AACjD,mBAAgC;AAEhC,sBAAkD;AAClD,mBAAsB;AAMtB,MAAM,cAAc,CAAC,cAAsB;AACzC,SAAO,UAAU,WAAW,OAAO,IAAI,SAAS;AAClD;AAEO,MAAM,kBAAkB,CAAC,QAA2B,CAAC,MAAM;AAChE,QAAM,gBAAY,8BAAa;AAC/B,QAAM,mBAAe,qCAAoB;AACzC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AACpD,QAAM,UAAU,aAAa,gBAAgB;AAE7C,MAAI,wBAAO;AAET,oDAA0B,MAAM;AAC9B,cAAQ,YAAY,OAAO,CAAC;AAAA,IAC9B,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,WAAO,MAAM,UAAU,OAAO;AAAA,EAChC;AAEA,SAAO,MAAM,UAAU,OAAO,YAAY,OAAO;AACnD;AAEO,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAEM;AACJ,QAAM,eAAe,gBAAgB;AAAA,IACnC;AAAA,EACF,CAAC;AACD,SAAO,4CAAC;AAAA,IAAM,MAAM;AAAA,IAAe;AAAA,GAAS;AAC9C;",
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;",
6
6
  "names": []
7
7
  }
@@ -28,31 +28,31 @@ __export(ThemeReset_exports, {
28
28
  });
29
29
  module.exports = __toCommonJS(ThemeReset_exports);
30
30
  var import_jsx_runtime = require("react/jsx-runtime");
31
- var import_constants = require("@tamagui/constants");
32
31
  var import_react = __toESM(require("react"));
32
+ var import_platform = require("../constants/platform");
33
33
  var import_ThemeManager = require("../helpers/ThemeManager");
34
34
  var import_Theme = require("./Theme");
35
35
  import_react.default["createElement"];
36
36
  const ThemeReset = (props) => {
37
- const manager = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
37
+ const themeManager = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
38
38
  const [name, setName] = (0, import_react.useState)(null);
39
- if (import_constants.isClient) {
39
+ if (!import_platform.isWeb || typeof document !== "undefined") {
40
40
  (0, import_react.useLayoutEffect)(() => {
41
- if (!manager)
41
+ if (!themeManager)
42
42
  return;
43
- if (name !== manager.parentName) {
44
- setName(manager.parentName);
43
+ if (name !== themeManager.parentName) {
44
+ setName(themeManager.parentName);
45
45
  }
46
- }, [name, manager, manager == null ? void 0 : manager.parentName]);
46
+ }, [themeManager == null ? void 0 : themeManager.parentName]);
47
47
  (0, import_react.useLayoutEffect)(() => {
48
- if (!manager)
48
+ if (!themeManager)
49
49
  return;
50
- return manager.onChangeTheme(() => {
51
- setName(manager.parentName);
50
+ return themeManager.onChangeTheme(() => {
51
+ setName(themeManager.parentName);
52
52
  });
53
- }, [manager]);
53
+ }, []);
54
54
  }
55
- if (!manager || !props.children) {
55
+ if (!themeManager || !props.children) {
56
56
  return props.children || null;
57
57
  }
58
58
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeReset.tsx"],
4
- "sourcesContent": ["import { isClient } from '@tamagui/constants'\nimport React, { useContext, useLayoutEffect, useState } from 'react'\n\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 manager = 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 (isClient) {\n useLayoutEffect(() => {\n if (!manager) return\n if (name !== manager.parentName) {\n setName(manager.parentName)\n }\n }, [name, manager, manager?.parentName])\n\n useLayoutEffect(() => {\n if (!manager) return\n return manager.onChangeTheme(() => {\n setName(manager.parentName)\n })\n }, [manager])\n }\n\n if (!manager || !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,uBAAyB;AACzB,mBAA6D;AAE7D,0BAAoC;AACpC,mBAAsB;AAGtB,aAAAA,QAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,cAAU,yBAAW,uCAAmB;AAC9C,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AAKpD,MAAI,2BAAU;AACZ,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAS;AACd,UAAI,SAAS,QAAQ,YAAY;AAC/B,gBAAQ,QAAQ,UAAU;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,SAAS,mCAAS,UAAU,CAAC;AAEvC,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAS;AACd,aAAO,QAAQ,cAAc,MAAM;AACjC,gBAAQ,QAAQ,UAAU;AAAA,MAC5B,CAAC;AAAA,IACH,GAAG,CAAC,OAAO,CAAC;AAAA,EACd;AAEA,MAAI,CAAC,WAAW,CAAC,MAAM,UAAU;AAC/B,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,4CAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
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
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,30 @@
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
+ export {
18
+ isAndroid,
19
+ isChrome,
20
+ isClient,
21
+ isIOS,
22
+ isRSC,
23
+ isServer,
24
+ isTouchable,
25
+ isWeb,
26
+ isWebTouchable,
27
+ isWindowDefined,
28
+ useIsomorphicLayoutEffect
29
+ };
30
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1,7 @@
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"],
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;",
6
+ "names": []
7
+ }
@@ -0,0 +1,28 @@
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 isSSR = 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
+ isSSR,
22
+ isTouchable,
23
+ isWeb,
24
+ isWebTouchable,
25
+ isWindowDefined,
26
+ useIsomorphicLayoutEffect
27
+ };
28
+ //# sourceMappingURL=platform.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/platform.native.ts"],
4
+ "sourcesContent": ["import { useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = false\nexport const isWindowDefined = false\nexport const isSSR = false\nexport const isClient = false\nexport const isRSC = false\nexport const useIsomorphicLayoutEffect = useLayoutEffect\nexport const isChrome = false\nexport const isWebTouchable = false\nexport const isTouchable = true\n"],
5
+ "mappings": "AAAA;AAAA,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AAElB,MAAM,cAAY,qCAAU,QAAO;AACnC,MAAM,UAAQ,qCAAU,QAAO;AAC/B,MAAM,QAAQ;AACd,MAAM,kBAAkB;AACxB,MAAM,QAAQ;AACd,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,4BAA4B;AAClC,MAAM,WAAW;AACjB,MAAM,iBAAiB;AACvB,MAAM,cAAc;",
6
+ "names": []
7
+ }
@@ -239,31 +239,24 @@ function createComponent(configIn, ParentComponent) {
239
239
  }
240
240
  }
241
241
  useIsomorphicLayoutEffect(() => {
242
- if (!mediaKeys.length)
243
- return;
244
- const disposers = [];
245
- for (const key of mediaKeys) {
246
- disposers.push(
247
- addMediaQueryListener(key, (next) => {
248
- setState((prev) => {
249
- if (prev.mediaState[key] !== next) {
250
- return {
251
- ...prev,
252
- mediaState: getMediaStateObject({
253
- ...prev.mediaState,
254
- [key]: next
255
- })
256
- };
257
- }
258
- return prev;
259
- });
260
- })
261
- );
262
- }
242
+ const disposers = mediaKeys.map((key) => {
243
+ return addMediaQueryListener(key, (next) => {
244
+ setState((prev) => {
245
+ if (prev.mediaState[key] !== next) {
246
+ return {
247
+ ...prev,
248
+ mediaState: getMediaStateObject({
249
+ ...prev.mediaState,
250
+ [key]: next
251
+ })
252
+ };
253
+ }
254
+ return prev;
255
+ });
256
+ });
257
+ });
263
258
  return () => {
264
- for (const disposer of disposers) {
265
- disposer();
266
- }
259
+ disposers.forEach((d) => d());
267
260
  };
268
261
  }, [mediaKeys.join(",")]);
269
262
  const {