@tamagui/core 1.0.1-beta.220 → 1.0.1-beta.221
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/addTheme.js +7 -10
- package/dist/cjs/addTheme.js.map +3 -3
- package/dist/cjs/config.js +8 -4
- package/dist/cjs/config.js.map +2 -2
- package/dist/cjs/{hooks/useUnmountEffect.js → contexts/ButtonNestingContext.js} +7 -9
- package/dist/cjs/contexts/ButtonNestingContext.js.map +7 -0
- package/dist/cjs/createComponent.js +63 -67
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createTamagui.js +13 -12
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createTokens.test.js +27 -0
- package/dist/cjs/createTokens.test.js.map +7 -0
- package/dist/cjs/createVariable.js +4 -9
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariable.test.js +7 -0
- package/dist/cjs/createVariable.test.js.map +7 -0
- package/dist/cjs/createVariables.js +6 -7
- package/dist/cjs/createVariables.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +161 -147
- package/dist/cjs/helpers/ThemeManager.js.map +3 -3
- package/dist/cjs/helpers/ThemeManager.test.js +421 -34
- package/dist/cjs/helpers/ThemeManager.test.js.map +2 -2
- package/dist/cjs/helpers/{getTokens.js → ThemeManagerContext.js} +8 -8
- package/dist/cjs/helpers/ThemeManagerContext.js.map +7 -0
- package/dist/cjs/helpers/createPropMapper.js +4 -4
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +2 -4
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/{assignNativePropsToWeb.native.js → getBoundingClientRect.js} +15 -8
- package/dist/cjs/helpers/getBoundingClientRect.js.map +7 -0
- package/dist/cjs/{hooks/useConstant.js → helpers/getRect.js} +14 -17
- package/dist/cjs/helpers/getRect.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +82 -85
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getThemeCSSRules.js +6 -2
- package/dist/cjs/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +1 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/mergeTransform.js +11 -8
- package/dist/cjs/helpers/mergeTransform.js.map +2 -2
- package/dist/cjs/helpers/pseudoDescriptors.js +1 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +2 -2
- package/dist/cjs/helpers/themeable.js +9 -9
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/hooks/useElementLayout.js +4 -12
- package/dist/cjs/hooks/useElementLayout.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +2 -1
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +114 -156
- package/dist/cjs/hooks/useTheme.js.map +3 -3
- package/dist/cjs/hooks/{useIsMounted.js → useThemeName.js} +23 -14
- package/dist/cjs/hooks/useThemeName.js.map +7 -0
- package/dist/cjs/index.js +2 -5
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/setupReactNative.js +20 -7
- package/dist/cjs/setupReactNative.js.map +2 -2
- package/dist/cjs/styled.js +2 -19
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/updateTheme.js +9 -9
- package/dist/cjs/updateTheme.js.map +2 -2
- package/dist/cjs/views/TamaguiProvider.js +3 -3
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/Theme.js +39 -28
- package/dist/cjs/views/Theme.js.map +3 -3
- package/dist/cjs/views/ThemeProvider.js +8 -33
- package/dist/cjs/views/ThemeProvider.js.map +3 -3
- package/dist/esm/addTheme.js +7 -10
- package/dist/esm/addTheme.js.map +3 -3
- package/dist/esm/config.js +8 -3
- package/dist/esm/config.js.map +2 -2
- package/dist/esm/contexts/ButtonNestingContext.js +6 -0
- package/dist/esm/contexts/ButtonNestingContext.js.map +7 -0
- package/dist/esm/createComponent.js +65 -70
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createTamagui.js +13 -12
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createTokens.test.js +26 -0
- package/dist/esm/createTokens.test.js.map +7 -0
- package/dist/esm/createVariable.js +4 -9
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariable.test.js +6 -0
- package/dist/esm/createVariable.test.js.map +7 -0
- package/dist/esm/createVariables.js +6 -7
- package/dist/esm/createVariables.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +140 -144
- package/dist/esm/helpers/ThemeManager.js.map +3 -3
- package/dist/esm/helpers/ThemeManager.test.js +421 -34
- package/dist/esm/helpers/ThemeManager.test.js.map +2 -2
- package/dist/esm/helpers/ThemeManagerContext.js +6 -0
- package/dist/esm/helpers/ThemeManagerContext.js.map +7 -0
- package/dist/esm/helpers/createPropMapper.js +4 -4
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +2 -4
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/getBoundingClientRect.js +13 -0
- package/dist/esm/helpers/getBoundingClientRect.js.map +7 -0
- package/dist/esm/helpers/getRect.js +12 -0
- package/dist/esm/helpers/getRect.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +90 -87
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getThemeCSSRules.js +6 -2
- package/dist/esm/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +1 -1
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js +8 -6
- package/dist/esm/helpers/mergeTransform.js.map +2 -2
- package/dist/esm/helpers/pseudoDescriptors.js +1 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +2 -2
- package/dist/esm/helpers/themeable.js +9 -9
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +2 -9
- package/dist/esm/hooks/useElementLayout.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +3 -2
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +114 -159
- package/dist/esm/hooks/useTheme.js.map +3 -3
- package/dist/esm/hooks/useThemeName.js +25 -0
- package/dist/esm/hooks/useThemeName.js.map +7 -0
- package/dist/esm/index.js +3 -5
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/setupReactNative.js +18 -6
- package/dist/esm/setupReactNative.js.map +2 -2
- package/dist/esm/styled.js +3 -20
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/updateTheme.js +9 -9
- package/dist/esm/updateTheme.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +4 -4
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/Theme.js +40 -29
- package/dist/esm/views/Theme.js.map +3 -3
- package/dist/esm/views/ThemeProvider.js +8 -27
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/package.json +12 -12
- package/src/__snapshots__/createTokens.test.ts.snap +877 -0
- package/src/addTheme.ts +9 -12
- package/src/config.ts +10 -2
- package/src/contexts/ButtonNestingContext.tsx +3 -0
- package/src/createComponent.tsx +117 -108
- package/src/createTamagui.ts +16 -14
- package/src/createTokens.test.ts +29 -0
- package/src/createTokens.ts +1 -1
- package/src/createVariable.test.ts +7 -0
- package/src/createVariable.ts +4 -10
- package/src/createVariables.ts +7 -7
- package/src/helpers/ThemeManager.test.tsx +480 -0
- package/src/helpers/ThemeManager.tsx +171 -166
- package/src/helpers/ThemeManagerContext.tsx +5 -0
- package/src/helpers/createPropMapper.ts +4 -4
- package/src/helpers/extendStaticConfig.ts +4 -4
- package/src/helpers/getBoundingClientRect.tsx +7 -0
- package/src/helpers/getRect.tsx +8 -0
- package/src/helpers/getSplitStyles.tsx +98 -93
- package/src/helpers/getThemeCSSRules.ts +9 -2
- package/src/helpers/insertStyleRule.tsx +2 -2
- package/src/helpers/mergeTransform.ts +13 -6
- package/src/helpers/pseudoDescriptors.ts +1 -0
- package/src/helpers/themeable.tsx +17 -9
- package/src/hooks/useElementLayout.tsx +3 -8
- package/src/hooks/useMedia.tsx +3 -3
- package/src/hooks/useTheme.tsx +138 -211
- package/src/hooks/useThemeName.tsx +25 -0
- package/src/index.ts +3 -4
- package/src/setupReactNative.ts +16 -5
- package/src/styled.tsx +4 -23
- package/src/types.tsx +42 -17
- package/src/updateTheme.ts +12 -9
- package/src/views/TamaguiProvider.tsx +5 -5
- package/src/views/Theme.tsx +48 -39
- package/src/views/ThemeProvider.tsx +11 -33
- package/types/Tamagui.d.ts +1 -1
- package/types/addTheme.d.ts +23 -2
- package/types/config.d.ts +0 -1
- package/types/contexts/ButtonNestingContext.d.ts +3 -0
- package/types/createTokens.test.d.ts +2 -0
- package/types/createVariable.d.ts +2 -2
- package/types/createVariable.test.d.ts +2 -0
- package/types/helpers/ThemeManager.d.ts +20 -30
- package/types/helpers/ThemeManager.test.d.ts +2 -0
- package/types/helpers/ThemeManagerContext.d.ts +4 -0
- package/types/helpers/getBoundingClientRect.d.ts +2 -0
- package/types/helpers/getRect.d.ts +9 -0
- package/types/helpers/insertStyleRule.d.ts +1 -1
- package/types/helpers/mergeTransform.d.ts +5 -3
- package/types/helpers/themeable.d.ts +3 -0
- package/types/hooks/useElementLayout.d.ts +0 -8
- package/types/hooks/useTheme.d.ts +10 -20
- package/types/hooks/useThemeName.d.ts +5 -0
- package/types/index.d.ts +3 -4
- package/types/setupReactNative.d.ts +4 -2
- package/types/types.d.ts +35 -10
- package/types/updateTheme.d.ts +23 -2
- package/types/views/Theme.d.ts +3 -4
- package/dist/cjs/constants/platform.js +0 -74
- 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/helpers/assignNativePropsToWeb.js +0 -188
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.native.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/getFont.js +0 -66
- package/dist/cjs/helpers/getFont.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/getTokens.js.map +0 -7
- package/dist/cjs/helpers/startTransition.js +0 -36
- 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/hooks/useConstant.js.map +0 -7
- package/dist/cjs/hooks/useIsMounted.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/useUnmountEffect.js.map +0 -7
- package/dist/cjs/injectStyles.js +0 -40
- package/dist/cjs/injectStyles.js.map +0 -7
- package/dist/cjs/react-native.js +0 -22
- package/dist/cjs/react-native.js.map +0 -7
- package/dist/esm/constants/platform.js +0 -39
- 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/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/calc.js +0 -47
- package/dist/esm/helpers/calc.js.map +0 -7
- package/dist/esm/helpers/getFont.js +0 -42
- package/dist/esm/helpers/getFont.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/getTokens.js +0 -6
- package/dist/esm/helpers/getTokens.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/hooks/useConstant.js +0 -15
- package/dist/esm/hooks/useConstant.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/usePressable.js +0 -12
- package/dist/esm/hooks/usePressable.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/react-native.js +0 -3
- package/dist/esm/react-native.js.map +0 -7
- package/src/contexts/ButtonInsideButtonContext.tsx +0 -3
- package/src/contexts/ThemeContext.tsx +0 -5
- package/src/helpers/areEqualSets.tsx +0 -9
- package/src/views/ThemeInverse.tsx +0 -43
- package/src/views/ThemeReset.tsx +0 -43
- package/types/constants/platform.d.ts +0 -13
- package/types/constants/platform.native.d.ts +0 -13
- package/types/contexts/ButtonInsideButtonContext.d.ts +0 -3
- package/types/contexts/ThemeContext.d.ts +0 -7
- package/types/helpers/areEqualSets.d.ts +0 -2
- package/types/helpers/assignNativePropsToWeb.d.ts +0 -2
- package/types/helpers/assignNativePropsToWeb.native.d.ts +0 -2
- package/types/helpers/calc.d.ts +0 -1
- package/types/helpers/getFont.d.ts +0 -3
- package/types/helpers/getStackSize.d.ts +0 -8
- package/types/helpers/getTokens.d.ts +0 -2
- package/types/helpers/startTransition.d.ts +0 -3
- package/types/helpers/validate.d.ts +0 -1
- package/types/hooks/useConstant.d.ts +0 -2
- package/types/hooks/useIsMounted.d.ts +0 -3
- package/types/hooks/useMedia.test.d.ts +0 -1
- package/types/hooks/usePressable.d.ts +0 -3
- package/types/hooks/usePressablePressResponder.d.ts +0 -84
- package/types/hooks/useUnmountEffect.d.ts +0 -2
- package/types/injectStyles.d.ts +0 -7
- package/types/react-native.d.ts +0 -8
- package/types/views/AbsoluteFill.d.ts +0 -5
- package/types/views/AbsoluteFill.native.d.ts +0 -3
- package/types/views/ThemeInverse.d.ts +0 -9
- package/types/views/ThemeReset.d.ts +0 -4
|
@@ -1,180 +1,176 @@
|
|
|
1
|
-
import { createContext } from "react";
|
|
2
1
|
import { getThemes } from "../config";
|
|
3
2
|
import { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from "../constants/constants";
|
|
4
3
|
import { getThemeUnwrapped } from "../hooks/getThemeUnwrapped";
|
|
4
|
+
const emptyState = { name: "" };
|
|
5
|
+
function hasNoThemeUpdatingProps(props) {
|
|
6
|
+
return !props.name && !props.componentName && !props.inverse && !props.reset;
|
|
7
|
+
}
|
|
5
8
|
class ThemeManager {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
8
|
-
this.className = className;
|
|
9
|
-
this.theme = theme;
|
|
10
|
-
this.parentManager = parentManager;
|
|
11
|
-
this.reset = reset;
|
|
12
|
-
this.keys = /* @__PURE__ */ new Map();
|
|
13
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
9
|
+
constructor(props = {}, parentManager) {
|
|
10
|
+
this.props = props;
|
|
14
11
|
this.themeListeners = /* @__PURE__ */ new Set();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
this.parentManager = null;
|
|
13
|
+
this.state = emptyState;
|
|
14
|
+
this.#allKeys = null;
|
|
15
|
+
if (parentManager === "root") {
|
|
16
|
+
this.updateState(props, false);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!parentManager) {
|
|
20
|
+
throw new Error(`Must set up root first`);
|
|
21
|
+
}
|
|
22
|
+
if (hasNoThemeUpdatingProps(props)) {
|
|
23
|
+
return parentManager;
|
|
24
|
+
}
|
|
25
|
+
if (parentManager) {
|
|
26
|
+
this.parentManager = parentManager;
|
|
27
|
+
}
|
|
28
|
+
const updatedState = this.getStateIfChanged(props);
|
|
29
|
+
if (updatedState) {
|
|
30
|
+
this.state = updatedState;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return parentManager || this;
|
|
34
|
+
}
|
|
35
|
+
updateState(props = this.props || {}, notify = true) {
|
|
36
|
+
const shouldFlush = (() => {
|
|
37
|
+
if (props.forceTheme) {
|
|
38
|
+
this.state.theme = props.forceTheme;
|
|
39
|
+
this.state.name = props.name || "";
|
|
40
|
+
return true;
|
|
21
41
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
this.parentManager = parent;
|
|
28
|
-
break;
|
|
42
|
+
const nextState = this.getStateIfChanged(props);
|
|
43
|
+
if (nextState) {
|
|
44
|
+
this.state = nextState;
|
|
45
|
+
return true;
|
|
29
46
|
}
|
|
47
|
+
})();
|
|
48
|
+
if (shouldFlush) {
|
|
49
|
+
this.#allKeys = null;
|
|
50
|
+
notify && this.notify();
|
|
51
|
+
return this.state;
|
|
30
52
|
}
|
|
31
53
|
}
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
|
|
55
|
+
const _ = getState(props, parentManager) || (process.env.TAMAGUI_TARGET === "native" ? parentManager == null ? void 0 : parentManager.state : void 0);
|
|
56
|
+
if (!_ || !_.theme || _.theme === state.theme) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return _;
|
|
34
60
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return ((_a = this.parentManager) == null ? void 0 : _a.name) || null;
|
|
61
|
+
getState(props = this.props) {
|
|
62
|
+
return getState(props, this.parentManager);
|
|
38
63
|
}
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
#allKeys;
|
|
65
|
+
get allKeys() {
|
|
66
|
+
var _a;
|
|
67
|
+
this.#allKeys ??= /* @__PURE__ */ new Set([
|
|
68
|
+
...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
|
|
69
|
+
...Object.keys(this.state.theme || {})
|
|
70
|
+
]);
|
|
71
|
+
return this.#allKeys;
|
|
41
72
|
}
|
|
42
|
-
getValue(key) {
|
|
43
|
-
let theme = this.theme;
|
|
73
|
+
getValue(key, state) {
|
|
74
|
+
let theme = (state || this.state).theme;
|
|
44
75
|
let manager = this;
|
|
45
|
-
while (
|
|
46
|
-
if (!theme)
|
|
47
|
-
return;
|
|
76
|
+
while (theme && manager) {
|
|
48
77
|
if (key in theme) {
|
|
49
78
|
return theme[key];
|
|
50
79
|
}
|
|
51
|
-
manager =
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
theme = manager.theme;
|
|
80
|
+
manager = manager.parentManager;
|
|
81
|
+
theme = manager == null ? void 0 : manager.state.theme;
|
|
56
82
|
}
|
|
57
83
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return Boolean((_a = this.keys.get(uuid)) == null ? void 0 : _a.size);
|
|
84
|
+
notify() {
|
|
85
|
+
this.themeListeners.forEach((cb) => cb(this.state.name, this));
|
|
61
86
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
87
|
+
onChangeTheme(cb) {
|
|
88
|
+
this.themeListeners.add(cb);
|
|
89
|
+
return () => {
|
|
90
|
+
this.themeListeners.delete(cb);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function getNextThemeClassName(name, isInverting = false) {
|
|
95
|
+
const next = `${THEME_CLASSNAME_PREFIX}${name}`;
|
|
96
|
+
if (isInverting) {
|
|
97
|
+
return next;
|
|
98
|
+
}
|
|
99
|
+
return next.replace("light_", "").replace("dark_", "");
|
|
100
|
+
}
|
|
101
|
+
function getState(props, parentManager) {
|
|
102
|
+
var _a, _b, _c;
|
|
103
|
+
const themes = getThemes();
|
|
104
|
+
if (props.name && props.reset) {
|
|
105
|
+
throw new Error(`Cannot reset + set new name`);
|
|
106
|
+
}
|
|
107
|
+
if (props.reset && !(parentManager == null ? void 0 : parentManager.parentManager)) {
|
|
108
|
+
throw new Error(`Cannot reset no grandparent exists`);
|
|
109
|
+
}
|
|
110
|
+
const nextName = props.reset ? ((_b = (_a = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _a.state) == null ? void 0 : _b.name) || "" : props.name || "";
|
|
111
|
+
const { componentName } = props;
|
|
112
|
+
const parentName = ((_c = parentManager == null ? void 0 : parentManager.state) == null ? void 0 : _c.name) || "";
|
|
113
|
+
const base = parentName.split(THEME_NAME_SEPARATOR);
|
|
114
|
+
const lastSegment = base[base.length - 1];
|
|
115
|
+
const isParentAComponentTheme = parentName && lastSegment[0].toUpperCase() === lastSegment[0];
|
|
116
|
+
if (isParentAComponentTheme) {
|
|
117
|
+
base.pop();
|
|
118
|
+
}
|
|
119
|
+
const parentBaseTheme = isParentAComponentTheme ? base.slice(0, base.length).join(THEME_NAME_SEPARATOR) : parentName;
|
|
120
|
+
const max = base.length;
|
|
121
|
+
const min = componentName ? max : 0;
|
|
122
|
+
if (process.env.NODE_ENV === "development" && props.debug === "verbose")
|
|
123
|
+
console.log("getState", props, { parentName, parentBaseTheme, base, min, max, isParentAComponentTheme, parentManager });
|
|
124
|
+
for (let i = max; i >= min; i--) {
|
|
125
|
+
let prefix = base.slice(0, i).join(THEME_NAME_SEPARATOR);
|
|
126
|
+
if (props.inverse) {
|
|
127
|
+
prefix = inverseThemeName(prefix);
|
|
68
128
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (notify) {
|
|
73
|
-
this.notify();
|
|
129
|
+
const potentials = [];
|
|
130
|
+
if (prefix && prefix !== parentBaseTheme) {
|
|
131
|
+
potentials.push(prefix);
|
|
74
132
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
getNextTheme(props = {}, debug) {
|
|
78
|
-
var _a;
|
|
79
|
-
const { themes = getThemes(), name, componentName } = props;
|
|
80
|
-
if (props.reset && name) {
|
|
81
|
-
return {
|
|
82
|
-
name,
|
|
83
|
-
theme: themes[name],
|
|
84
|
-
className: this.getCN(name)
|
|
85
|
-
};
|
|
133
|
+
if (nextName) {
|
|
134
|
+
potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName);
|
|
86
135
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
`${this.name}_${componentName}`,
|
|
92
|
-
`${withoutComponentName(this.name)}_${componentName}`
|
|
93
|
-
];
|
|
94
|
-
for (const name2 of names) {
|
|
95
|
-
if (name2 in themes) {
|
|
96
|
-
const className = this.getCN(name2);
|
|
97
|
-
return { name: name2, theme: themes[name2], className };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
136
|
+
if (i === 1) {
|
|
137
|
+
const lastSegment2 = potentials.findIndex((x) => !x.includes("_"));
|
|
138
|
+
if (lastSegment2 > 0) {
|
|
139
|
+
potentials.splice(lastSegment2, 0, nextName);
|
|
100
140
|
}
|
|
101
|
-
return {
|
|
102
|
-
name: this.name,
|
|
103
|
-
theme: this.theme,
|
|
104
|
-
className: this.className
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
let nextName = name || this.name || "";
|
|
108
|
-
let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
|
|
109
|
-
while (true) {
|
|
110
|
-
if (nextName in themes)
|
|
111
|
-
break;
|
|
112
|
-
nextName = `${parentName}_${name}`;
|
|
113
|
-
if (nextName in themes)
|
|
114
|
-
break;
|
|
115
|
-
if (!parentName.includes(THEME_NAME_SEPARATOR))
|
|
116
|
-
break;
|
|
117
|
-
parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR));
|
|
118
141
|
}
|
|
119
142
|
if (componentName) {
|
|
120
|
-
|
|
121
|
-
`${nextName}_${componentName}
|
|
122
|
-
`${withoutComponentName(nextName)}_${componentName}`
|
|
123
|
-
];
|
|
124
|
-
for (const name2 of names) {
|
|
125
|
-
if (name2 in themes) {
|
|
126
|
-
nextName = name2;
|
|
127
|
-
}
|
|
143
|
+
if (nextName) {
|
|
144
|
+
potentials.push(`${prefix.replace(/_.*$/, "")}_${nextName}_${componentName}`);
|
|
128
145
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
theme = themes[`light_${nextName}`];
|
|
133
|
-
}
|
|
134
|
-
if (process.env.NODE_ENV === "development") {
|
|
135
|
-
if (debug) {
|
|
136
|
-
console.log("getNextTheme", this.getCN(nextName), { props, nextName, parentName });
|
|
146
|
+
potentials.push(`${prefix}_${componentName}`);
|
|
147
|
+
if (nextName) {
|
|
148
|
+
potentials.unshift(`${prefix}_${nextName}_${componentName}`);
|
|
137
149
|
}
|
|
138
150
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
getCN(name) {
|
|
146
|
-
return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
|
|
147
|
-
}
|
|
148
|
-
track(uuid, keys) {
|
|
149
|
-
if (!this.name)
|
|
150
|
-
return;
|
|
151
|
-
this.keys.set(uuid, keys);
|
|
152
|
-
}
|
|
153
|
-
notify() {
|
|
154
|
-
var _a;
|
|
155
|
-
if (!this.name) {
|
|
156
|
-
this.keys.clear();
|
|
157
|
-
}
|
|
158
|
-
for (const [uuid, keys] of this.keys.entries()) {
|
|
159
|
-
if (keys.size) {
|
|
160
|
-
(_a = this.listeners.get(uuid)) == null ? void 0 : _a();
|
|
151
|
+
if (process.env.NODE_ENV === "development" && props.debug === "verbose")
|
|
152
|
+
console.log("getState potentials", potentials);
|
|
153
|
+
const found = potentials.find((t) => t in themes);
|
|
154
|
+
if (found) {
|
|
155
|
+
if (found === parentName) {
|
|
156
|
+
return null;
|
|
161
157
|
}
|
|
158
|
+
const theme = themes[found];
|
|
159
|
+
return {
|
|
160
|
+
name: found,
|
|
161
|
+
theme: getThemeUnwrapped(theme),
|
|
162
|
+
className: getNextThemeClassName(found, props.inverse),
|
|
163
|
+
parentName
|
|
164
|
+
};
|
|
162
165
|
}
|
|
163
|
-
this.themeListeners.forEach((cb) => cb(this.name, this));
|
|
164
|
-
}
|
|
165
|
-
onChangeTheme(cb) {
|
|
166
|
-
this.themeListeners.add(cb);
|
|
167
|
-
return () => {
|
|
168
|
-
this.themeListeners.delete(cb);
|
|
169
|
-
};
|
|
170
166
|
}
|
|
167
|
+
return null;
|
|
171
168
|
}
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
const inverseThemeName = (themeName) => {
|
|
170
|
+
return themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
|
|
171
|
+
};
|
|
175
172
|
export {
|
|
176
173
|
ThemeManager,
|
|
177
|
-
|
|
178
|
-
emptyManager
|
|
174
|
+
hasNoThemeUpdatingProps
|
|
179
175
|
};
|
|
180
176
|
//# sourceMappingURL=ThemeManager.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/ThemeManager.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getThemes } from '../config'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from '../constants/constants'\nimport { getThemeUnwrapped } from '../hooks/getThemeUnwrapped'\nimport { ThemeParsed, ThemeProps } from '../types'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n reset?: boolean\n}\n\nexport type ThemeManagerState = {\n name: string\n theme?: ThemeParsed | null\n className?: string\n parentName?: string\n}\n\nconst emptyState: ThemeManagerState = { name: '' }\n\nexport function hasNoThemeUpdatingProps(props: ThemeProps) {\n return !props.name && !props.componentName && !props.inverse && !props.reset\n}\n\nexport class ThemeManager {\n themeListeners = new Set<ThemeListener>()\n parentManager: ThemeManager | null = null\n state: ThemeManagerState = emptyState\n\n constructor(\n public props: ThemeProps = {},\n parentManager?: ThemeManager | 'root' | null | undefined\n ) {\n if (parentManager === 'root') {\n this.updateState(props, false)\n return\n }\n if (!parentManager) {\n throw new Error(`Must set up root first`)\n }\n // no change no props\n if (hasNoThemeUpdatingProps(props)) {\n return parentManager\n }\n if (parentManager) {\n this.parentManager = parentManager\n }\n const updatedState = this.getStateIfChanged(props)\n if (updatedState) {\n this.state = updatedState\n return\n }\n return parentManager || this\n }\n\n updateState(props: ThemeProps & { forceTheme?: ThemeParsed } = this.props || {}, notify = true) {\n const shouldFlush = (() => {\n if (props.forceTheme) {\n this.state.theme = props.forceTheme\n this.state.name = props.name || ''\n return true\n }\n const nextState = this.getStateIfChanged(props)\n if (nextState) {\n this.state = nextState\n return true\n }\n })()\n if (shouldFlush) {\n // reset any derived state\n this.#allKeys = null\n notify && this.notify()\n return this.state\n }\n }\n\n getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {\n const _ =\n getState(props, parentManager) ||\n (process.env.TAMAGUI_TARGET === 'native' ? parentManager?.state : undefined)\n if (!_ || !_.theme || _.theme === state.theme) {\n return null\n }\n return _\n }\n\n getState(props = this.props) {\n return getState(props, this.parentManager)\n }\n\n #allKeys: Set<string> | null = null\n get allKeys() {\n this.#allKeys ??= new Set([\n ...(this.parentManager?.allKeys || []),\n ...Object.keys(this.state.theme || {}),\n ])\n return this.#allKeys\n }\n\n // gets value going up to parents\n getValue(key: string, state?: ThemeManagerState) {\n let theme = (state || this.state).theme\n let manager = this as ThemeManager | null\n while (theme && manager) {\n if (key in theme) {\n return theme[key]\n }\n manager = manager.parentManager\n theme = manager?.state.theme\n }\n }\n\n notify() {\n this.themeListeners.forEach((cb) => cb(this.state.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n}\n\nfunction getNextThemeClassName(name: string, isInverting = false) {\n const next = `${THEME_CLASSNAME_PREFIX}${name}`\n if (isInverting) {\n return next\n }\n return next.replace('light_', '').replace('dark_', '')\n}\n\nfunction getState(\n props: ThemeProps,\n parentManager?: ThemeManager | null\n): ThemeManagerState | null {\n const themes = getThemes()\n\n if (props.name && props.reset) {\n throw new Error(`Cannot reset + set new name`)\n }\n if (props.reset && !parentManager?.parentManager) {\n throw new Error(`Cannot reset no grandparent exists`)\n }\n\n const nextName = props.reset ? parentManager?.parentManager?.state?.name || '' : props.name || ''\n const { componentName } = props\n const parentName = parentManager?.state?.name || ''\n\n // components look for most specific, fallback upwards\n const base = parentName.split(THEME_NAME_SEPARATOR)\n const lastSegment = base[base.length - 1]\n const isParentAComponentTheme = parentName && lastSegment[0].toUpperCase() === lastSegment[0]\n if (isParentAComponentTheme) {\n base.pop() // always remove componentName they can't nest\n }\n const parentBaseTheme = isParentAComponentTheme\n ? base.slice(0, base.length).join(THEME_NAME_SEPARATOR)\n : parentName\n const max = base.length\n const min = componentName\n ? max // component themes don't search upwards\n : 0\n\n // prettier-ignore\n // eslint-disable-next-line no-console\n if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') console.log('getState', props, { parentName, parentBaseTheme, base, min, max, isParentAComponentTheme, parentManager })\n\n for (let i = max; i >= min; i--) {\n let prefix = base.slice(0, i).join(THEME_NAME_SEPARATOR)\n if (props.inverse) {\n prefix = inverseThemeName(prefix)\n }\n const potentials: string[] = []\n if (prefix && prefix !== parentBaseTheme) {\n potentials.push(prefix)\n }\n if (nextName) {\n potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName)\n }\n if (i === 1) {\n const lastSegment = potentials.findIndex((x) => !x.includes('_'))\n if (lastSegment > 0) {\n potentials.splice(lastSegment, 0, nextName) // last try prefer our new name to parent\n }\n }\n if (componentName) {\n // components only look for component themes\n if (nextName) {\n potentials.push(`${prefix.replace(/_.*$/, '')}_${nextName}_${componentName}`)\n }\n potentials.push(`${prefix}_${componentName}`)\n if (nextName) {\n potentials.unshift(`${prefix}_${nextName}_${componentName}`)\n }\n }\n\n // prettier-ignore\n // eslint-disable-next-line no-console\n if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') console.log('getState potentials', potentials)\n\n const found = potentials.find((t) => t in themes)\n if (found) {\n // optimization return null if not changed\n if (found === parentName) {\n return null\n }\n const theme = themes[found]\n return {\n // need to put concurrent safe things here\n name: found,\n theme: getThemeUnwrapped(theme),\n className: getNextThemeClassName(found, props.inverse),\n parentName,\n }\n }\n }\n\n return null\n}\n\nconst inverseThemeName = (themeName: string) => {\n return themeName.startsWith('light')\n ? themeName.replace(/^light/, 'dark')\n : themeName.replace(/^dark/, 'light')\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB,4BAA4B;AAC7D,SAAS,yBAAyB;AAoBlC,MAAM,aAAgC,EAAE,MAAM,GAAG;AAE1C,SAAS,wBAAwB,OAAmB;AACzD,SAAO,CAAC,MAAM,QAAQ,CAAC,MAAM,iBAAiB,CAAC,MAAM,WAAW,CAAC,MAAM;AACzE;AAEO,MAAM,aAAa;AAAA,EAKxB,YACS,QAAoB,CAAC,GAC5B,eACA;AAFO;AALT,0BAAiB,oBAAI,IAAmB;AACxC,yBAAqC;AACrC,iBAA2B;AA+D3B,oBAA+B;AAzD7B,QAAI,kBAAkB,QAAQ;AAC5B,WAAK,YAAY,OAAO,KAAK;AAC7B;AAAA,IACF;AACA,QAAI,CAAC,eAAe;AAClB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IAC1C;AAEA,QAAI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