@tamagui/core 1.0.5 → 1.0.7
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.
- package/dist/cjs/helpers/ThemeManager.js +4 -24
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +4 -5
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/package.json +10 -10
- package/src/helpers/ThemeManager.tsx +4 -4
- package/types/helpers/ThemeManager.d.ts +1 -1
- package/dist/cjs/Pressability.js +0 -32
- package/dist/cjs/Pressability.js.map +0 -7
- package/dist/cjs/Pressability.native.js +0 -32
- package/dist/cjs/Pressability.native.js.map +0 -7
- package/dist/cjs/ThemeContext.js +0 -30
- package/dist/cjs/ThemeContext.js.map +0 -7
- package/dist/cjs/ThemeManager.js +0 -211
- package/dist/cjs/ThemeManager.js.map +0 -7
- package/dist/cjs/conf.js +0 -70
- package/dist/cjs/conf.js.map +0 -7
- package/dist/cjs/constants/platform.js +0 -59
- package/dist/cjs/constants/platform.js.map +0 -7
- package/dist/cjs/constants/platform.native.js +0 -62
- package/dist/cjs/constants/platform.native.js.map +0 -7
- package/dist/cjs/constants/rnw.native.js +0 -28
- package/dist/cjs/constants/rnw.native.js.map +0 -7
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +0 -30
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +0 -7
- package/dist/cjs/contexts/ThemeContext.js +0 -30
- package/dist/cjs/contexts/ThemeContext.js.map +0 -7
- package/dist/cjs/defaultComponentState.js +0 -2
- package/dist/cjs/defaultComponentState.js.map +0 -7
- package/dist/cjs/helpers/Unwrap.js +0 -29
- package/dist/cjs/helpers/Unwrap.js.map +0 -7
- package/dist/cjs/helpers/areEqualSets.js +0 -38
- package/dist/cjs/helpers/areEqualSets.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -188
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +0 -30
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +0 -7
- package/dist/cjs/helpers/cache.js +0 -39
- package/dist/cjs/helpers/cache.js.map +0 -7
- package/dist/cjs/helpers/calc.js +0 -71
- package/dist/cjs/helpers/calc.js.map +0 -7
- package/dist/cjs/helpers/createShallowUpdate.js +0 -41
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js +0 -65
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/cssHash.js +0 -51
- package/dist/cjs/helpers/cssHash.js.map +0 -7
- package/dist/cjs/helpers/expandStyle.test.js +0 -10
- package/dist/cjs/helpers/expandStyle.test.js.map +0 -7
- package/dist/cjs/helpers/getFont.js +0 -62
- package/dist/cjs/helpers/getFont.js.map +0 -7
- package/dist/cjs/helpers/getSize.js +0 -48
- package/dist/cjs/helpers/getSize.js.map +0 -7
- package/dist/cjs/helpers/getStackSize.js +0 -46
- package/dist/cjs/helpers/getStackSize.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.native.js +0 -19
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/helpers/startTransition.js +0 -33
- package/dist/cjs/helpers/startTransition.js.map +0 -7
- package/dist/cjs/helpers/validate.js +0 -2
- package/dist/cjs/helpers/validate.js.map +0 -7
- package/dist/cjs/helpers/wrapThemeManagerContext.js +0 -37
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/cjs/hooks/useConstant.js +0 -36
- package/dist/cjs/hooks/useConstant.js.map +0 -7
- package/dist/cjs/hooks/useFeatures.js +0 -201
- package/dist/cjs/hooks/useFeatures.js.map +0 -7
- package/dist/cjs/hooks/useIsMounted.js +0 -40
- package/dist/cjs/hooks/useIsMounted.js.map +0 -7
- package/dist/cjs/hooks/useIsSSR.js +0 -42
- package/dist/cjs/hooks/useIsSSR.js.map +0 -7
- package/dist/cjs/hooks/usePressable.js +0 -36
- package/dist/cjs/hooks/usePressable.js.map +0 -7
- package/dist/cjs/hooks/usePrevious.js +0 -1
- package/dist/cjs/hooks/usePrevious.js.map +0 -7
- package/dist/cjs/hooks/useUnmountEffect.js +0 -32
- package/dist/cjs/hooks/useUnmountEffect.js.map +0 -7
- package/dist/cjs/injectStyles.js +0 -40
- package/dist/cjs/injectStyles.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js +0 -44
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/cjs/views/ThemeInverse.js +0 -55
- package/dist/cjs/views/ThemeInverse.js.map +0 -7
- package/dist/cjs/views/ThemeReset.js +0 -64
- package/dist/cjs/views/ThemeReset.js.map +0 -7
- package/dist/esm/Pressability.js +0 -7
- package/dist/esm/Pressability.js.map +0 -7
- package/dist/esm/Pressability.native.js +0 -7
- package/dist/esm/Pressability.native.js.map +0 -7
- package/dist/esm/ThemeContext.js +0 -6
- package/dist/esm/ThemeContext.js.map +0 -7
- package/dist/esm/ThemeManager.js +0 -185
- package/dist/esm/ThemeManager.js.map +0 -7
- package/dist/esm/conf.js +0 -39
- package/dist/esm/conf.js.map +0 -7
- package/dist/esm/constants/platform.js +0 -26
- package/dist/esm/constants/platform.js.map +0 -7
- package/dist/esm/constants/platform.native.js +0 -28
- package/dist/esm/constants/platform.native.js.map +0 -7
- package/dist/esm/constants/rnw.native.js +0 -5
- package/dist/esm/constants/rnw.native.js.map +0 -7
- package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -6
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +0 -7
- package/dist/esm/contexts/ThemeContext.js +0 -6
- package/dist/esm/contexts/ThemeContext.js.map +0 -7
- package/dist/esm/defaultComponentState.js +0 -1
- package/dist/esm/defaultComponentState.js.map +0 -7
- package/dist/esm/helpers/Unwrap.js +0 -5
- package/dist/esm/helpers/Unwrap.js.map +0 -7
- package/dist/esm/helpers/areEqualSets.js +0 -14
- package/dist/esm/helpers/areEqualSets.js.map +0 -7
- package/dist/esm/helpers/assignNativePropsToWeb.js +0 -164
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +0 -6
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +0 -7
- package/dist/esm/helpers/cache.js +0 -15
- package/dist/esm/helpers/cache.js.map +0 -7
- package/dist/esm/helpers/calc.js +0 -47
- package/dist/esm/helpers/calc.js.map +0 -7
- package/dist/esm/helpers/createShallowUpdate.js +0 -17
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js +0 -38
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/cssHash.js +0 -27
- package/dist/esm/helpers/cssHash.js.map +0 -7
- package/dist/esm/helpers/expandStyle.test.js +0 -9
- package/dist/esm/helpers/expandStyle.test.js.map +0 -7
- package/dist/esm/helpers/getFont.js +0 -38
- package/dist/esm/helpers/getFont.js.map +0 -7
- package/dist/esm/helpers/getSize.js +0 -23
- package/dist/esm/helpers/getSize.js.map +0 -7
- package/dist/esm/helpers/getStackSize.js +0 -22
- package/dist/esm/helpers/getStackSize.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/helpers/startTransition.js +0 -6
- package/dist/esm/helpers/startTransition.js.map +0 -7
- package/dist/esm/helpers/validate.js +0 -1
- package/dist/esm/helpers/validate.js.map +0 -7
- package/dist/esm/helpers/wrapThemeManagerContext.js +0 -11
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/esm/hooks/useConstant.js +0 -12
- package/dist/esm/hooks/useConstant.js.map +0 -7
- package/dist/esm/hooks/useFeatures.js +0 -174
- package/dist/esm/hooks/useFeatures.js.map +0 -7
- package/dist/esm/hooks/useIsMounted.js +0 -16
- package/dist/esm/hooks/useIsMounted.js.map +0 -7
- package/dist/esm/hooks/useIsSSR.js +0 -18
- package/dist/esm/hooks/useIsSSR.js.map +0 -7
- package/dist/esm/hooks/usePressable.js +0 -12
- package/dist/esm/hooks/usePressable.js.map +0 -7
- package/dist/esm/hooks/usePrevious.js +0 -1
- package/dist/esm/hooks/usePrevious.js.map +0 -7
- package/dist/esm/hooks/useUnmountEffect.js +0 -8
- package/dist/esm/hooks/useUnmountEffect.js.map +0 -7
- package/dist/esm/injectStyles.js +0 -16
- package/dist/esm/injectStyles.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -15
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/views/ThemeInverse.js +0 -27
- package/dist/esm/views/ThemeInverse.js.map +0 -7
- package/dist/esm/views/ThemeReset.js +0 -37
- package/dist/esm/views/ThemeReset.js.map +0 -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,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
|
-
}
|
package/dist/cjs/injectStyles.js
DELETED
|
@@ -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
|
-
}
|
|
@@ -1,64 +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 ThemeReset_exports = {};
|
|
23
|
-
__export(ThemeReset_exports, {
|
|
24
|
-
ThemeReset: () => ThemeReset
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(ThemeReset_exports);
|
|
27
|
-
var import_react = __toESM(require("react"));
|
|
28
|
-
var import_platform = require("../constants/platform");
|
|
29
|
-
var import_ThemeManager = require("../ThemeManager");
|
|
30
|
-
var import_Theme = require("./Theme");
|
|
31
|
-
import_react.default["createElement"];
|
|
32
|
-
const ThemeReset = (props) => {
|
|
33
|
-
const themeManager = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
|
|
34
|
-
const [name, setName] = (0, import_react.useState)(null);
|
|
35
|
-
if (!import_platform.isWeb || typeof document !== "undefined") {
|
|
36
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
37
|
-
if (!themeManager)
|
|
38
|
-
return;
|
|
39
|
-
if (name !== themeManager.parentName) {
|
|
40
|
-
setName(themeManager.parentName);
|
|
41
|
-
}
|
|
42
|
-
}, [themeManager == null ? void 0 : themeManager.parentName]);
|
|
43
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
44
|
-
if (!themeManager)
|
|
45
|
-
return;
|
|
46
|
-
return themeManager.onChangeTheme(() => {
|
|
47
|
-
setName(themeManager.parentName);
|
|
48
|
-
});
|
|
49
|
-
}, []);
|
|
50
|
-
}
|
|
51
|
-
if (!themeManager || !props.children) {
|
|
52
|
-
return props.children || null;
|
|
53
|
-
}
|
|
54
|
-
return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
|
|
55
|
-
className: "tui-theme-reset",
|
|
56
|
-
reset: true,
|
|
57
|
-
name
|
|
58
|
-
}, props.children);
|
|
59
|
-
};
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
ThemeReset
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=ThemeReset.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 '../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
|
-
}
|
package/dist/esm/Pressability.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/esm/ThemeContext.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/esm/ThemeManager.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
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
|