@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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createVariables.ts"],
|
|
4
|
-
"sourcesContent": ["import { Variable, createVariable, isVariable } from './createVariable'\n\ntype DeepTokenObject<Val extends string | number = any> = {\n [key: string]: Val | DeepTokenObject<Val>\n}\n\nexport type DeepVariableObject<A extends DeepTokenObject> = {\n [Key in keyof A]: A[Key] extends string | number\n ? Variable<A[Key]>\n : A[Key] extends DeepTokenObject\n ? DeepVariableObject<A[Key]>\n : never\n}\n\nexport const createVariables = <A extends DeepTokenObject>(\n tokens: A,\n parentPath = '',\n isFont = false\n): DeepVariableObject<A> => {\n const res: any = {}\n let i = 0\n for (const key in tokens) {\n i++\n const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAqD;AAc9C,MAAM,kBAAkB,CAC7B,QACA,aAAa,IACb,SAAS,UACiB;AAC1B,QAAM,MAAW,CAAC;AAClB,MAAI,IAAI;AACR,aAAW,OAAO,QAAQ;AACxB;AACA,UAAM,
|
|
4
|
+
"sourcesContent": ["import { simpleHash } from '@tamagui/helpers'\n\nimport { Variable, createVariable, isVariable } from './createVariable'\n\ntype DeepTokenObject<Val extends string | number = any> = {\n [key: string]: Val | DeepTokenObject<Val>\n}\n\nexport type DeepVariableObject<A extends DeepTokenObject> = {\n [Key in keyof A]: A[Key] extends string | number\n ? Variable<A[Key]>\n : A[Key] extends DeepTokenObject\n ? DeepVariableObject<A[Key]>\n : never\n}\n\nexport const createVariables = <A extends DeepTokenObject>(\n tokens: A,\n parentPath = '',\n isFont = false\n): DeepVariableObject<A> => {\n const res: any = {}\n let i = 0\n for (const key in tokens) {\n i++\n const val = tokens[key]\n if (isVariable(val)) {\n res[key] = val\n continue\n }\n const niceKey = simpleHash(key)\n let name = isFont ? niceKey.slice(0, 2) : i\n name = parentPath ? `${parentPath}-${name}` : niceKey\n if (val && typeof val === 'object') {\n // recurse\n res[key] = createVariables(tokens[key] as any, name)\n continue\n }\n res[key] = isVariable(val) ? val : createVariable({ val, name, key: niceKey })\n }\n return res\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2B;AAE3B,4BAAqD;AAc9C,MAAM,kBAAkB,CAC7B,QACA,aAAa,IACb,SAAS,UACiB;AAC1B,QAAM,MAAW,CAAC;AAClB,MAAI,IAAI;AACR,aAAW,OAAO,QAAQ;AACxB;AACA,UAAM,MAAM,OAAO;AACnB,YAAI,kCAAW,GAAG,GAAG;AACnB,UAAI,OAAO;AACX;AAAA,IACF;AACA,UAAM,cAAU,2BAAW,GAAG;AAC9B,QAAI,OAAO,SAAS,QAAQ,MAAM,GAAG,CAAC,IAAI;AAC1C,WAAO,aAAa,GAAG,cAAc,SAAS;AAC9C,QAAI,OAAO,OAAO,QAAQ,UAAU;AAElC,UAAI,OAAO,gBAAgB,OAAO,MAAa,IAAI;AACnD;AAAA,IACF;AACA,QAAI,WAAO,kCAAW,GAAG,IAAI,UAAM,sCAAe,EAAE,KAAK,MAAM,KAAK,QAAQ,CAAC;AAAA,EAC/E;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,191 +16,205 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __accessCheck = (obj, member, msg) => {
|
|
20
|
+
if (!member.has(obj))
|
|
21
|
+
throw TypeError("Cannot " + msg);
|
|
22
|
+
};
|
|
23
|
+
var __privateGet = (obj, member, getter) => {
|
|
24
|
+
__accessCheck(obj, member, "read from private field");
|
|
25
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
26
|
+
};
|
|
27
|
+
var __privateAdd = (obj, member, value) => {
|
|
28
|
+
if (member.has(obj))
|
|
29
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
30
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
31
|
+
};
|
|
32
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
33
|
+
__accessCheck(obj, member, "write to private field");
|
|
34
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
35
|
+
return value;
|
|
36
|
+
};
|
|
19
37
|
var ThemeManager_exports = {};
|
|
20
38
|
__export(ThemeManager_exports, {
|
|
21
39
|
ThemeManager: () => ThemeManager,
|
|
22
|
-
|
|
23
|
-
emptyManager: () => emptyManager
|
|
40
|
+
hasNoThemeUpdatingProps: () => hasNoThemeUpdatingProps
|
|
24
41
|
});
|
|
25
42
|
module.exports = __toCommonJS(ThemeManager_exports);
|
|
26
|
-
var import_react = require("react");
|
|
27
43
|
var import_config = require("../config");
|
|
28
|
-
var
|
|
44
|
+
var import_constants2 = require("../constants/constants");
|
|
29
45
|
var import_getThemeUnwrapped = require("../hooks/getThemeUnwrapped");
|
|
46
|
+
var _allKeys;
|
|
47
|
+
const emptyState = { name: "" };
|
|
48
|
+
function hasNoThemeUpdatingProps(props) {
|
|
49
|
+
return !props.name && !props.componentName && !props.inverse && !props.reset;
|
|
50
|
+
}
|
|
30
51
|
class ThemeManager {
|
|
31
|
-
constructor(
|
|
32
|
-
this.
|
|
33
|
-
this.className = className;
|
|
34
|
-
this.theme = theme;
|
|
35
|
-
this.parentManager = parentManager;
|
|
36
|
-
this.reset = reset;
|
|
37
|
-
this.keys = /* @__PURE__ */ new Map();
|
|
38
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
52
|
+
constructor(props = {}, parentManager) {
|
|
53
|
+
this.props = props;
|
|
39
54
|
this.themeListeners = /* @__PURE__ */ new Set();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
this.parentManager = null;
|
|
56
|
+
this.state = emptyState;
|
|
57
|
+
__privateAdd(this, _allKeys, null);
|
|
58
|
+
if (parentManager === "root") {
|
|
59
|
+
this.updateState(props, false);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!parentManager) {
|
|
63
|
+
throw new Error(`Must set up root first`);
|
|
64
|
+
}
|
|
65
|
+
if (hasNoThemeUpdatingProps(props)) {
|
|
66
|
+
return parentManager;
|
|
67
|
+
}
|
|
68
|
+
if (parentManager) {
|
|
69
|
+
this.parentManager = parentManager;
|
|
70
|
+
}
|
|
71
|
+
const updatedState = this.getStateIfChanged(props);
|
|
72
|
+
if (updatedState) {
|
|
73
|
+
this.state = updatedState;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
return parentManager || this;
|
|
77
|
+
}
|
|
78
|
+
updateState(props = this.props || {}, notify = true) {
|
|
79
|
+
const shouldFlush = (() => {
|
|
80
|
+
if (props.forceTheme) {
|
|
81
|
+
this.state.theme = props.forceTheme;
|
|
82
|
+
this.state.name = props.name || "";
|
|
83
|
+
return true;
|
|
46
84
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
this.parentManager = parent;
|
|
53
|
-
break;
|
|
85
|
+
const nextState = this.getStateIfChanged(props);
|
|
86
|
+
if (nextState) {
|
|
87
|
+
this.state = nextState;
|
|
88
|
+
return true;
|
|
54
89
|
}
|
|
90
|
+
})();
|
|
91
|
+
if (shouldFlush) {
|
|
92
|
+
__privateSet(this, _allKeys, null);
|
|
93
|
+
notify && this.notify();
|
|
94
|
+
return this.state;
|
|
55
95
|
}
|
|
56
96
|
}
|
|
57
|
-
|
|
58
|
-
|
|
97
|
+
getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
|
|
98
|
+
const _ = getState(props, parentManager) || (process.env.TAMAGUI_TARGET === "native" ? parentManager == null ? void 0 : parentManager.state : void 0);
|
|
99
|
+
if (!_ || !_.theme || _.theme === state.theme) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return _;
|
|
59
103
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return ((_a = this.parentManager) == null ? void 0 : _a.name) || null;
|
|
104
|
+
getState(props = this.props) {
|
|
105
|
+
return getState(props, this.parentManager);
|
|
63
106
|
}
|
|
64
|
-
get
|
|
65
|
-
|
|
107
|
+
get allKeys() {
|
|
108
|
+
var _a;
|
|
109
|
+
__privateGet(this, _allKeys) ?? __privateSet(this, _allKeys, /* @__PURE__ */ new Set([
|
|
110
|
+
...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
|
|
111
|
+
...Object.keys(this.state.theme || {})
|
|
112
|
+
]));
|
|
113
|
+
return __privateGet(this, _allKeys);
|
|
66
114
|
}
|
|
67
|
-
getValue(key) {
|
|
68
|
-
let theme = this.theme;
|
|
115
|
+
getValue(key, state) {
|
|
116
|
+
let theme = (state || this.state).theme;
|
|
69
117
|
let manager = this;
|
|
70
|
-
while (
|
|
71
|
-
if (!theme)
|
|
72
|
-
return;
|
|
118
|
+
while (theme && manager) {
|
|
73
119
|
if (key in theme) {
|
|
74
120
|
return theme[key];
|
|
75
121
|
}
|
|
76
|
-
manager =
|
|
77
|
-
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
theme = manager.theme;
|
|
122
|
+
manager = manager.parentManager;
|
|
123
|
+
theme = manager == null ? void 0 : manager.state.theme;
|
|
81
124
|
}
|
|
82
125
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return Boolean((_a = this.keys.get(uuid)) == null ? void 0 : _a.size);
|
|
126
|
+
notify() {
|
|
127
|
+
this.themeListeners.forEach((cb) => cb(this.state.name, this));
|
|
86
128
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
129
|
+
onChangeTheme(cb) {
|
|
130
|
+
this.themeListeners.add(cb);
|
|
131
|
+
return () => {
|
|
132
|
+
this.themeListeners.delete(cb);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
_allKeys = new WeakMap();
|
|
137
|
+
function getNextThemeClassName(name, isInverting = false) {
|
|
138
|
+
const next = `${import_constants2.THEME_CLASSNAME_PREFIX}${name}`;
|
|
139
|
+
if (isInverting) {
|
|
140
|
+
return next;
|
|
141
|
+
}
|
|
142
|
+
return next.replace("light_", "").replace("dark_", "");
|
|
143
|
+
}
|
|
144
|
+
function getState(props, parentManager) {
|
|
145
|
+
var _a, _b, _c;
|
|
146
|
+
const themes = (0, import_config.getThemes)();
|
|
147
|
+
if (props.name && props.reset) {
|
|
148
|
+
throw new Error(`Cannot reset + set new name`);
|
|
149
|
+
}
|
|
150
|
+
if (props.reset && !(parentManager == null ? void 0 : parentManager.parentManager)) {
|
|
151
|
+
throw new Error(`Cannot reset no grandparent exists`);
|
|
152
|
+
}
|
|
153
|
+
const nextName = props.reset ? ((_b = (_a = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _a.state) == null ? void 0 : _b.name) || "" : props.name || "";
|
|
154
|
+
const { componentName } = props;
|
|
155
|
+
const parentName = ((_c = parentManager == null ? void 0 : parentManager.state) == null ? void 0 : _c.name) || "";
|
|
156
|
+
const base = parentName.split(import_constants2.THEME_NAME_SEPARATOR);
|
|
157
|
+
const lastSegment = base[base.length - 1];
|
|
158
|
+
const isParentAComponentTheme = parentName && lastSegment[0].toUpperCase() === lastSegment[0];
|
|
159
|
+
if (isParentAComponentTheme) {
|
|
160
|
+
base.pop();
|
|
161
|
+
}
|
|
162
|
+
const parentBaseTheme = isParentAComponentTheme ? base.slice(0, base.length).join(import_constants2.THEME_NAME_SEPARATOR) : parentName;
|
|
163
|
+
const max = base.length;
|
|
164
|
+
const min = componentName ? max : 0;
|
|
165
|
+
if (process.env.NODE_ENV === "development" && props.debug === "verbose")
|
|
166
|
+
console.log("getState", props, { parentName, parentBaseTheme, base, min, max, isParentAComponentTheme, parentManager });
|
|
167
|
+
for (let i = max; i >= min; i--) {
|
|
168
|
+
let prefix = base.slice(0, i).join(import_constants2.THEME_NAME_SEPARATOR);
|
|
169
|
+
if (props.inverse) {
|
|
170
|
+
prefix = inverseThemeName(prefix);
|
|
93
171
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (notify) {
|
|
98
|
-
this.notify();
|
|
172
|
+
const potentials = [];
|
|
173
|
+
if (prefix && prefix !== parentBaseTheme) {
|
|
174
|
+
potentials.push(prefix);
|
|
99
175
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
getNextTheme(props = {}, debug) {
|
|
103
|
-
var _a;
|
|
104
|
-
const { themes = (0, import_config.getThemes)(), name, componentName } = props;
|
|
105
|
-
if (props.reset && name) {
|
|
106
|
-
return {
|
|
107
|
-
name,
|
|
108
|
-
theme: themes[name],
|
|
109
|
-
className: this.getCN(name)
|
|
110
|
-
};
|
|
176
|
+
if (nextName) {
|
|
177
|
+
potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName);
|
|
111
178
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
`${this.name}_${componentName}`,
|
|
117
|
-
`${withoutComponentName(this.name)}_${componentName}`
|
|
118
|
-
];
|
|
119
|
-
for (const name2 of names) {
|
|
120
|
-
if (name2 in themes) {
|
|
121
|
-
const className = this.getCN(name2);
|
|
122
|
-
return { name: name2, theme: themes[name2], className };
|
|
123
|
-
}
|
|
124
|
-
}
|
|
179
|
+
if (i === 1) {
|
|
180
|
+
const lastSegment2 = potentials.findIndex((x) => !x.includes("_"));
|
|
181
|
+
if (lastSegment2 > 0) {
|
|
182
|
+
potentials.splice(lastSegment2, 0, nextName);
|
|
125
183
|
}
|
|
126
|
-
return {
|
|
127
|
-
name: this.name,
|
|
128
|
-
theme: this.theme,
|
|
129
|
-
className: this.className
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
let nextName = name || this.name || "";
|
|
133
|
-
let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
|
|
134
|
-
while (true) {
|
|
135
|
-
if (nextName in themes)
|
|
136
|
-
break;
|
|
137
|
-
nextName = `${parentName}_${name}`;
|
|
138
|
-
if (nextName in themes)
|
|
139
|
-
break;
|
|
140
|
-
if (!parentName.includes(import_constants.THEME_NAME_SEPARATOR))
|
|
141
|
-
break;
|
|
142
|
-
parentName = parentName.slice(0, parentName.lastIndexOf(import_constants.THEME_NAME_SEPARATOR));
|
|
143
184
|
}
|
|
144
185
|
if (componentName) {
|
|
145
|
-
|
|
146
|
-
`${nextName}_${componentName}
|
|
147
|
-
`${withoutComponentName(nextName)}_${componentName}`
|
|
148
|
-
];
|
|
149
|
-
for (const name2 of names) {
|
|
150
|
-
if (name2 in themes) {
|
|
151
|
-
nextName = name2;
|
|
152
|
-
}
|
|
186
|
+
if (nextName) {
|
|
187
|
+
potentials.push(`${prefix.replace(/_.*$/, "")}_${nextName}_${componentName}`);
|
|
153
188
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
theme = themes[`light_${nextName}`];
|
|
158
|
-
}
|
|
159
|
-
if (process.env.NODE_ENV === "development") {
|
|
160
|
-
if (debug) {
|
|
161
|
-
console.log("getNextTheme", this.getCN(nextName), { props, nextName, parentName });
|
|
189
|
+
potentials.push(`${prefix}_${componentName}`);
|
|
190
|
+
if (nextName) {
|
|
191
|
+
potentials.unshift(`${prefix}_${nextName}_${componentName}`);
|
|
162
192
|
}
|
|
163
193
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
getCN(name) {
|
|
171
|
-
return `${import_constants.THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
|
|
172
|
-
}
|
|
173
|
-
track(uuid, keys) {
|
|
174
|
-
if (!this.name)
|
|
175
|
-
return;
|
|
176
|
-
this.keys.set(uuid, keys);
|
|
177
|
-
}
|
|
178
|
-
notify() {
|
|
179
|
-
var _a;
|
|
180
|
-
if (!this.name) {
|
|
181
|
-
this.keys.clear();
|
|
182
|
-
}
|
|
183
|
-
for (const [uuid, keys] of this.keys.entries()) {
|
|
184
|
-
if (keys.size) {
|
|
185
|
-
(_a = this.listeners.get(uuid)) == null ? void 0 : _a();
|
|
194
|
+
if (process.env.NODE_ENV === "development" && props.debug === "verbose")
|
|
195
|
+
console.log("getState potentials", potentials);
|
|
196
|
+
const found = potentials.find((t) => t in themes);
|
|
197
|
+
if (found) {
|
|
198
|
+
if (found === parentName) {
|
|
199
|
+
return null;
|
|
186
200
|
}
|
|
201
|
+
const theme = themes[found];
|
|
202
|
+
return {
|
|
203
|
+
name: found,
|
|
204
|
+
theme: (0, import_getThemeUnwrapped.getThemeUnwrapped)(theme),
|
|
205
|
+
className: getNextThemeClassName(found, props.inverse),
|
|
206
|
+
parentName
|
|
207
|
+
};
|
|
187
208
|
}
|
|
188
|
-
this.themeListeners.forEach((cb) => cb(this.name, this));
|
|
189
|
-
}
|
|
190
|
-
onChangeTheme(cb) {
|
|
191
|
-
this.themeListeners.add(cb);
|
|
192
|
-
return () => {
|
|
193
|
-
this.themeListeners.delete(cb);
|
|
194
|
-
};
|
|
195
209
|
}
|
|
210
|
+
return null;
|
|
196
211
|
}
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
const inverseThemeName = (themeName) => {
|
|
213
|
+
return themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
|
|
214
|
+
};
|
|
200
215
|
// Annotate the CommonJS export names for ESM import in node:
|
|
201
216
|
0 && (module.exports = {
|
|
202
217
|
ThemeManager,
|
|
203
|
-
|
|
204
|
-
emptyManager
|
|
218
|
+
hasNoThemeUpdatingProps
|
|
205
219
|
});
|
|
206
220
|
//# 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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA0B;AAC1B,IAAAA,oBAA6D;AAC7D,+BAAkC;AAJlC;AAwBA,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,iCAA+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,wBAAwB,KAAK,GAAG;AAClC,aAAO;AAAA,IACT;AACA,QAAI,eAAe;AACjB,WAAK,gBAAgB;AAAA,IACvB;AACA,UAAM,eAAe,KAAK,kBAAkB,KAAK;AACjD,QAAI,cAAc;AAChB,WAAK,QAAQ;AACb;AAAA,IACF;AACA,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EAEA,YAAY,QAAmD,KAAK,SAAS,CAAC,GAAG,SAAS,MAAM;AAC9F,UAAM,eAAe,MAAM;AACzB,UAAI,MAAM,YAAY;AACpB,aAAK,MAAM,QAAQ,MAAM;AACzB,aAAK,MAAM,OAAO,MAAM,QAAQ;AAChC,eAAO;AAAA,MACT;AACA,YAAM,YAAY,KAAK,kBAAkB,KAAK;AAC9C,UAAI,WAAW;AACb,aAAK,QAAQ;AACb,eAAO;AAA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