@tamagui/core 1.0.1-rc.1.5 → 1.0.1-rc.11
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/Pressability.js +32 -0
- package/dist/cjs/Pressability.js.map +7 -0
- package/dist/cjs/Pressability.native.js +32 -0
- package/dist/cjs/Pressability.native.js.map +7 -0
- package/dist/cjs/ThemeContext.js +30 -0
- package/dist/cjs/ThemeContext.js.map +7 -0
- package/dist/cjs/ThemeManager.js +211 -0
- package/dist/cjs/ThemeManager.js.map +7 -0
- package/dist/cjs/addTheme.js +1 -1
- package/dist/cjs/addTheme.js.map +1 -1
- package/dist/cjs/conf.js +70 -0
- package/dist/cjs/conf.js.map +7 -0
- package/dist/cjs/config.js +1 -1
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/constants/constants.js +1 -1
- package/dist/cjs/constants/constants.js.map +1 -1
- package/dist/cjs/constants/platform.js +4 -10
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/rnw.native.js +28 -0
- package/dist/cjs/constants/rnw.native.js.map +7 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/cjs/createComponent.js +109 -45
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createTamagui.js +12 -5
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/defaultComponentState.js +2 -0
- package/dist/cjs/defaultComponentState.js.map +7 -0
- package/dist/cjs/helpers/ThemeManager.js +21 -7
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.test.js +5 -5
- package/dist/cjs/helpers/ThemeManager.test.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +1 -1
- package/dist/cjs/helpers/calc.js.map +2 -2
- package/dist/cjs/helpers/createMediaStyle.js +1 -1
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +12 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createProxy.js +1 -1
- package/dist/cjs/helpers/createProxy.js.map +1 -1
- package/dist/cjs/helpers/createShallowUpdate.js +9 -12
- package/dist/cjs/helpers/createShallowUpdate.js.map +1 -1
- package/dist/cjs/helpers/createTamaguiProvider.js +65 -0
- package/dist/cjs/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/cjs/helpers/cssHash.js +51 -0
- package/dist/cjs/helpers/cssHash.js.map +7 -0
- package/dist/cjs/helpers/expandStyle.js +18 -3
- package/dist/cjs/helpers/expandStyle.js.map +2 -2
- package/dist/cjs/helpers/expandStyle.test.js +10 -0
- package/dist/cjs/helpers/expandStyle.test.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +1 -1
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/cjs/helpers/getFont.js +2 -6
- package/dist/cjs/helpers/getFont.js.map +2 -2
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +69 -20
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js.map +1 -1
- package/dist/cjs/helpers/getStylesAtomic.js +15 -13
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getThemeCSSRules.js +5 -3
- package/dist/cjs/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +60 -26
- package/dist/cjs/helpers/insertStyleRule.js.map +3 -3
- package/dist/cjs/helpers/isTamaguiComponent.js +1 -1
- package/dist/cjs/helpers/isTamaguiComponent.js.map +2 -2
- package/dist/cjs/helpers/isTamaguiElement.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js.map +2 -2
- package/dist/cjs/helpers/mergeTransform.js +3 -1
- package/dist/cjs/helpers/mergeTransform.js.map +2 -2
- package/dist/cjs/helpers/nativeGestureHandler.native.js +19 -0
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +7 -0
- package/dist/cjs/helpers/normalizeColor.js +1 -1
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js +11 -5
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/registerCSSVariable.js.map +2 -2
- package/dist/cjs/helpers/startTransition.js +1 -4
- package/dist/cjs/helpers/startTransition.js.map +2 -2
- package/dist/cjs/helpers/themeable.js +2 -2
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/wrapThemeManagerContext.js +37 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +7 -0
- package/dist/cjs/hooks/useConstant.js +0 -3
- package/dist/cjs/hooks/useConstant.js.map +2 -2
- package/dist/cjs/hooks/useFeatures.js +201 -0
- package/dist/cjs/hooks/useFeatures.js.map +7 -0
- package/dist/cjs/hooks/useIsMounted.js.map +1 -1
- package/dist/cjs/hooks/useIsSSR.js +6 -10
- package/dist/cjs/hooks/useIsSSR.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +10 -4
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePressable.js.map +1 -1
- package/dist/cjs/hooks/usePrevious.js +1 -0
- package/dist/cjs/hooks/usePrevious.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +33 -9
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/styled.js +15 -1
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/vendor/Pressability.native.js.map +2 -2
- package/dist/cjs/views/FontLanguage.native.js.map +2 -2
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/Stack.test.js +1 -1
- package/dist/cjs/views/Stack.test.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +4 -1
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/Text.js +3 -1
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/TextAncestorContext.js +44 -0
- package/dist/cjs/views/TextAncestorContext.js.map +7 -0
- package/dist/cjs/views/Theme.js +5 -2
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +20 -21
- package/dist/cjs/views/ThemeInverse.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +5 -10
- package/dist/cjs/views/ThemeReset.js.map +3 -3
- package/dist/esm/Pressability.js +7 -0
- package/dist/esm/Pressability.js.map +7 -0
- package/dist/esm/Pressability.native.js +7 -0
- package/dist/esm/Pressability.native.js.map +7 -0
- package/dist/esm/ThemeContext.js +6 -0
- package/dist/esm/ThemeContext.js.map +7 -0
- package/dist/esm/ThemeManager.js +185 -0
- package/dist/esm/ThemeManager.js.map +7 -0
- package/dist/esm/addTheme.js +1 -1
- package/dist/esm/addTheme.js.map +1 -1
- package/dist/esm/conf.js +39 -0
- package/dist/esm/conf.js.map +7 -0
- package/dist/esm/config.js +1 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/constants/constants.js +1 -1
- package/dist/esm/constants/constants.js.map +1 -1
- package/dist/esm/constants/platform.js +3 -7
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/rnw.native.js +5 -0
- package/dist/esm/constants/rnw.native.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/esm/createComponent.js +116 -47
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createTamagui.js +17 -6
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/defaultComponentState.js +1 -0
- package/dist/esm/defaultComponentState.js.map +7 -0
- package/dist/esm/helpers/ThemeManager.js +21 -7
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.test.js +5 -5
- package/dist/esm/helpers/ThemeManager.test.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +1 -1
- package/dist/esm/helpers/calc.js.map +2 -2
- package/dist/esm/helpers/createMediaStyle.js +1 -1
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +12 -3
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createProxy.js +1 -1
- package/dist/esm/helpers/createProxy.js.map +1 -1
- package/dist/esm/helpers/createShallowUpdate.js +9 -12
- package/dist/esm/helpers/createShallowUpdate.js.map +1 -1
- package/dist/esm/helpers/createTamaguiProvider.js +38 -0
- package/dist/esm/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/esm/helpers/cssHash.js +27 -0
- package/dist/esm/helpers/cssHash.js.map +7 -0
- package/dist/esm/helpers/expandStyle.js +18 -3
- package/dist/esm/helpers/expandStyle.js.map +2 -2
- package/dist/esm/helpers/expandStyle.test.js +9 -0
- package/dist/esm/helpers/expandStyle.test.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +1 -1
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/esm/helpers/getFont.js +2 -6
- package/dist/esm/helpers/getFont.js.map +2 -2
- package/dist/esm/helpers/getSize.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +78 -22
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js.map +1 -1
- package/dist/esm/helpers/getStylesAtomic.js +15 -13
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getThemeCSSRules.js +5 -3
- package/dist/esm/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +58 -25
- package/dist/esm/helpers/insertStyleRule.js.map +3 -3
- package/dist/esm/helpers/isTamaguiComponent.js +1 -1
- package/dist/esm/helpers/isTamaguiComponent.js.map +2 -2
- package/dist/esm/helpers/isTamaguiElement.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js +3 -1
- package/dist/esm/helpers/mergeTransform.js.map +2 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js +2 -0
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +7 -0
- package/dist/esm/helpers/normalizeColor.js +1 -1
- package/dist/esm/helpers/normalizeColor.js.map +2 -2
- package/dist/esm/helpers/normalizeValueWithProperty.js +11 -5
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/registerCSSVariable.js.map +2 -2
- package/dist/esm/helpers/startTransition.js.map +1 -1
- package/dist/esm/helpers/themeable.js +2 -2
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/wrapThemeManagerContext.js +11 -0
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +7 -0
- package/dist/esm/hooks/useConstant.js +1 -4
- package/dist/esm/hooks/useConstant.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +174 -0
- package/dist/esm/hooks/useFeatures.js.map +7 -0
- package/dist/esm/hooks/useIsMounted.js.map +1 -1
- package/dist/esm/hooks/useIsSSR.js +8 -12
- package/dist/esm/hooks/useIsSSR.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +9 -4
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/usePrevious.js +1 -0
- package/dist/esm/hooks/usePrevious.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +37 -10
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
- package/dist/esm/insertFont.js.map +2 -2
- package/dist/esm/styled.js +15 -1
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/vendor/Pressability.native.js.map +2 -2
- package/dist/esm/views/FontLanguage.native.js.map +2 -2
- package/dist/esm/views/Slot.js +6 -1
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/Stack.test.js +1 -1
- package/dist/esm/views/Stack.test.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +4 -1
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/Text.js +3 -1
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/TextAncestorContext.js +15 -0
- package/dist/esm/views/TextAncestorContext.js.map +7 -0
- package/dist/esm/views/Theme.js +5 -2
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +15 -20
- package/dist/esm/views/ThemeInverse.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +4 -6
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +17 -20
- package/src/addTheme.ts +1 -1
- package/src/config.ts +1 -1
- package/src/constants/constants.ts +1 -1
- package/src/createComponent.tsx +160 -68
- package/src/createTamagui.ts +26 -8
- package/src/helpers/ThemeManager.test.tsx +5 -5
- package/src/helpers/ThemeManager.tsx +36 -14
- package/src/helpers/createMediaStyle.ts +4 -2
- package/src/helpers/createPropMapper.ts +26 -5
- package/src/helpers/createProxy.ts +1 -1
- package/src/helpers/expandStyle.ts +18 -3
- package/src/helpers/extendStaticConfig.ts +5 -2
- package/src/helpers/getExpandedShorthands.ts +3 -1
- package/src/helpers/getSize.ts +2 -1
- package/src/helpers/getSplitStyles.tsx +111 -37
- package/src/helpers/getStylesAtomic.ts +19 -14
- package/src/helpers/getThemeCSSRules.ts +10 -4
- package/src/helpers/insertStyleRule.tsx +81 -41
- package/src/helpers/isTamaguiComponent.tsx +1 -1
- package/src/helpers/isTamaguiElement.tsx +4 -1
- package/src/helpers/matchMedia.ts +2 -1
- package/src/helpers/mergeTransform.ts +9 -2
- package/src/helpers/normalizeColor.ts +1 -1
- package/src/helpers/normalizeValueWithProperty.ts +11 -5
- package/src/helpers/registerCSSVariable.ts +3 -1
- package/src/helpers/themeable.tsx +3 -3
- package/src/hooks/useMedia.tsx +8 -6
- package/src/hooks/useTheme.tsx +59 -18
- package/src/insertFont.ts +4 -1
- package/src/styled.tsx +37 -10
- package/src/types.tsx +57 -27
- package/src/vendor/Pressability.native.tsx +2 -1
- package/src/views/FontLanguage.native.tsx +3 -1
- package/src/views/Slot.tsx +14 -3
- package/src/views/Stack.test.tsx +1 -1
- package/src/views/TamaguiProvider.tsx +7 -1
- package/src/views/Text.tsx +11 -6
- package/src/views/Theme.tsx +10 -3
- package/types/helpers/insertStyleRule.d.ts +2 -1
- package/types/helpers/themeable.d.ts +1 -1
- package/types/hooks/useMedia.d.ts +1 -0
- package/types/types.d.ts +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Pressability_exports = {};
|
|
20
|
+
__export(Pressability_exports, {
|
|
21
|
+
Pressability: () => Pressability,
|
|
22
|
+
usePressability: () => usePressability
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Pressability_exports);
|
|
25
|
+
const Pressability = {};
|
|
26
|
+
const usePressability = {};
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
Pressability,
|
|
30
|
+
usePressability
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=Pressability.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Pressability.tsx"],
|
|
4
|
+
"sourcesContent": ["export const Pressability = {} as any\nexport const usePressability = {} as Function\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,eAAe,CAAC;AACtB,MAAM,kBAAkB,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Pressability_native_exports = {};
|
|
20
|
+
__export(Pressability_native_exports, {
|
|
21
|
+
Pressability: () => Pressability,
|
|
22
|
+
usePressability: () => usePressability
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Pressability_native_exports);
|
|
25
|
+
const Pressability = require("react-native/Libraries/Pressability/Pressability").default;
|
|
26
|
+
const usePressability = require("react-native/Libraries/Pressability/usePressability").default;
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
Pressability,
|
|
30
|
+
usePressability
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=Pressability.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,eAAe,QAAQ,kDAAkD,EAAE;AACjF,MAAM,kBACX,QAAQ,qDAAqD,EAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 ThemeContext_exports = {};
|
|
20
|
+
__export(ThemeContext_exports, {
|
|
21
|
+
ThemeContext: () => ThemeContext
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ThemeContext_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
const ThemeContext = (0, import_react.createContext)(null);
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
ThemeContext
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=ThemeContext.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAIvB,MAAM,eAAe,gCAAkE,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
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 ThemeManager_exports = {};
|
|
20
|
+
__export(ThemeManager_exports, {
|
|
21
|
+
ThemeManager: () => ThemeManager,
|
|
22
|
+
ThemeManagerContext: () => ThemeManagerContext,
|
|
23
|
+
emptyManager: () => emptyManager
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(ThemeManager_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_conf = require("./conf");
|
|
28
|
+
var import_constants = require("./constants/constants");
|
|
29
|
+
var import_getThemeUnwrapped = require("./hooks/getThemeUnwrapped");
|
|
30
|
+
class ThemeManager {
|
|
31
|
+
constructor(name = "", theme = null, parentManager = null, reset = false) {
|
|
32
|
+
this.name = name;
|
|
33
|
+
this.theme = theme;
|
|
34
|
+
this.parentManager = parentManager;
|
|
35
|
+
this.reset = reset;
|
|
36
|
+
this.keys = /* @__PURE__ */ new Map();
|
|
37
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
38
|
+
this.themeListeners = /* @__PURE__ */ new Set();
|
|
39
|
+
this.className = null;
|
|
40
|
+
let parent = parentManager;
|
|
41
|
+
let tries = 0;
|
|
42
|
+
while (true) {
|
|
43
|
+
tries++;
|
|
44
|
+
if (tries > 10) {
|
|
45
|
+
throw new Error(`Nested 10 of the same theme in a row, likely error`);
|
|
46
|
+
}
|
|
47
|
+
if (!parent)
|
|
48
|
+
break;
|
|
49
|
+
if (parent.name === name) {
|
|
50
|
+
parent = parent.parentManager;
|
|
51
|
+
} else {
|
|
52
|
+
this.parentManager = parent;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
get didChangeTheme() {
|
|
58
|
+
return this.parentManager && this.name !== this.parentManager.fullName;
|
|
59
|
+
}
|
|
60
|
+
get parentName() {
|
|
61
|
+
var _a;
|
|
62
|
+
return ((_a = this.parentManager) == null ? void 0 : _a.name) || null;
|
|
63
|
+
}
|
|
64
|
+
get fullName() {
|
|
65
|
+
return this.getNextTheme().name || this.name || "";
|
|
66
|
+
}
|
|
67
|
+
getValue(key) {
|
|
68
|
+
let theme = this.theme;
|
|
69
|
+
let manager = this;
|
|
70
|
+
while (true) {
|
|
71
|
+
if (!theme)
|
|
72
|
+
return;
|
|
73
|
+
if (key in theme) {
|
|
74
|
+
return theme[key];
|
|
75
|
+
}
|
|
76
|
+
manager = this.parentManager;
|
|
77
|
+
if (!manager) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (manager.theme === theme) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
theme = manager.theme;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
update({ name, theme, className } = {}) {
|
|
87
|
+
const nameChanged = name !== this.name;
|
|
88
|
+
if (!nameChanged) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
this.className = className || null;
|
|
92
|
+
this.name = name || "";
|
|
93
|
+
this.theme = theme;
|
|
94
|
+
this.notifyListeners();
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
getNextTheme(props = {}, debug) {
|
|
98
|
+
var _a;
|
|
99
|
+
const { themes = (0, import_conf.getThemes)(), name, componentName } = props;
|
|
100
|
+
if (props.reset && name) {
|
|
101
|
+
return {
|
|
102
|
+
name,
|
|
103
|
+
theme: themes[name],
|
|
104
|
+
className: this.getClassName(name)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const parentIsReset = (_a = this.parentManager) == null ? void 0 : _a.reset;
|
|
108
|
+
if (!name) {
|
|
109
|
+
if (componentName) {
|
|
110
|
+
const names = [
|
|
111
|
+
`${this.name}_${componentName}`,
|
|
112
|
+
`${withoutComponentName(this.name)}_${componentName}`
|
|
113
|
+
];
|
|
114
|
+
for (const name2 of names) {
|
|
115
|
+
if (name2 in themes) {
|
|
116
|
+
const className = this.getClassName(name2);
|
|
117
|
+
return { name: name2, theme: themes[name2], className };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
name: this.name,
|
|
123
|
+
theme: this.theme
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
let nextName = name || this.name || "";
|
|
127
|
+
let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
|
|
128
|
+
while (true) {
|
|
129
|
+
if (nextName in themes) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
nextName = `${parentName}_${name}`;
|
|
133
|
+
if (nextName in themes) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
if (!parentName.includes(import_constants.THEME_NAME_SEPARATOR)) {
|
|
137
|
+
console.warn("theme not found", name);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
parentName = parentName.slice(0, parentName.lastIndexOf(import_constants.THEME_NAME_SEPARATOR));
|
|
141
|
+
}
|
|
142
|
+
if (componentName) {
|
|
143
|
+
const names = [
|
|
144
|
+
`${nextName}_${componentName}`,
|
|
145
|
+
`${withoutComponentName(nextName)}_${componentName}`
|
|
146
|
+
];
|
|
147
|
+
for (const name2 of names) {
|
|
148
|
+
if (name2 in themes) {
|
|
149
|
+
nextName = name2;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let theme = themes[nextName];
|
|
154
|
+
if (!theme) {
|
|
155
|
+
theme = themes[`light_${nextName}`];
|
|
156
|
+
}
|
|
157
|
+
if (process.env.NODE_ENV === "development") {
|
|
158
|
+
if (debug) {
|
|
159
|
+
console.log("getNextTheme", this.getClassName(nextName), { props, nextName, parentName });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
name: nextName,
|
|
164
|
+
theme: (0, import_getThemeUnwrapped.getThemeUnwrapped)(theme),
|
|
165
|
+
className: this.getClassName(nextName)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
getClassName(name) {
|
|
169
|
+
return `${import_constants.THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
|
|
170
|
+
}
|
|
171
|
+
track(uuid, keys) {
|
|
172
|
+
if (!this.name)
|
|
173
|
+
return;
|
|
174
|
+
this.keys.set(uuid, keys);
|
|
175
|
+
}
|
|
176
|
+
notifyListeners() {
|
|
177
|
+
var _a;
|
|
178
|
+
if (!this.name) {
|
|
179
|
+
this.keys.clear();
|
|
180
|
+
}
|
|
181
|
+
for (const [uuid, keys] of this.keys.entries()) {
|
|
182
|
+
if (keys.size) {
|
|
183
|
+
(_a = this.listeners.get(uuid)) == null ? void 0 : _a();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
this.themeListeners.forEach((cb) => cb(this.name, this));
|
|
187
|
+
}
|
|
188
|
+
onChangeTheme(cb) {
|
|
189
|
+
this.themeListeners.add(cb);
|
|
190
|
+
return () => {
|
|
191
|
+
this.themeListeners.delete(cb);
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
onUpdate(uuid, cb) {
|
|
195
|
+
this.listeners.set(uuid, cb);
|
|
196
|
+
return () => {
|
|
197
|
+
this.listeners.delete(uuid);
|
|
198
|
+
this.keys.delete(uuid);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const ThemeManagerContext = (0, import_react.createContext)(null);
|
|
203
|
+
const emptyManager = new ThemeManager();
|
|
204
|
+
const withoutComponentName = (name) => name.replace(/(\_[A-Z][a-zA-Z]+)+$/g, "");
|
|
205
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
206
|
+
0 && (module.exports = {
|
|
207
|
+
ThemeManager,
|
|
208
|
+
ThemeManagerContext,
|
|
209
|
+
emptyManager
|
|
210
|
+
});
|
|
211
|
+
//# sourceMappingURL=ThemeManager.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ThemeManager.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react'\n\nimport { getThemes } from './conf'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from './constants/constants'\nimport { getThemeUnwrapped } from './hooks/getThemeUnwrapped'\nimport { ThemeObject, Themes } 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}\n\nexport type GetNextThemeProps = {\n themes?: Themes\n name?: string | null\n componentName?: string | null\n reset?: boolean\n}\n\nexport class ThemeManager {\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n className: string | null = null\n\n constructor(\n public name: string = '',\n public theme: ThemeObject | null = null,\n public parentManager: ThemeManager | null = null,\n public reset: boolean = false\n ) {\n // find the nearest different parentManager\n let parent = parentManager\n let tries = 0\n while (true) {\n tries++\n if (tries > 10) {\n throw new Error(`Nested 10 of the same theme in a row, likely error`)\n }\n if (!parent) break\n if (parent.name === name) {\n // go up if same\n parent = parent.parentManager\n } else {\n this.parentManager = parent\n break\n }\n }\n }\n\n get didChangeTheme() {\n return this.parentManager && this.name !== this.parentManager.fullName\n }\n\n get parentName() {\n return this.parentManager?.name || null\n }\n\n get fullName(): string {\n return this.getNextTheme().name || this.name || ''\n // const parentName = this.parentManager?.fullName || ''\n // const name = this.name || ''\n // const parts = [...new Set([...`${parentName}_${name}`.split('_')])].filter(Boolean)\n // return parts.join('_')\n }\n\n // gets value going up to parents\n getValue(key: string) {\n let theme = this.theme\n let manager = this as ThemeManager | null\n while (true) {\n if (!theme) return\n if (key in theme) {\n return theme[key]\n }\n manager = this.parentManager\n if (!manager) {\n return\n }\n if (manager.theme === theme) {\n return\n }\n theme = manager.theme\n }\n }\n\n update({ name, theme, className }: SetActiveThemeProps = {}) {\n // className compare on web, avoids light/dark re-renders\n const nameChanged = name !== this.name\n if (!nameChanged) {\n return false\n }\n this.className = className || null\n this.name = name || ''\n this.theme = theme\n this.notifyListeners()\n return true\n }\n\n getNextTheme(props: GetNextThemeProps = {}, debug?: any) {\n const { themes = getThemes(), name, componentName } = props\n\n if (props.reset && name) {\n return {\n name: name,\n theme: themes[name],\n className: this.getClassName(name),\n }\n }\n\n const parentIsReset = this.parentManager?.reset\n\n if (!name) {\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${this.name}_${componentName}`,\n `${withoutComponentName(this.name)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n const className = this.getClassName(name)\n return { name, theme: themes[name], className }\n }\n }\n }\n return {\n name: this.name,\n theme: this.theme,\n }\n }\n\n let nextName = name || this.name || ''\n let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName\n\n while (true) {\n if (nextName in themes) {\n break\n }\n nextName = `${parentName}_${name}`\n if (nextName in themes) {\n break\n }\n if (!parentName.includes(THEME_NAME_SEPARATOR)) {\n // not found!\n console.warn('theme not found', name)\n // this happens in next during _document.getInitialProps and has a terrible/non-existent stack trace\n // throw new Error(`Theme not found: ${name}`)\n break\n }\n // go up one\n parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR))\n }\n\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${nextName}_${componentName}`,\n `${withoutComponentName(nextName)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n nextName = name\n }\n }\n }\n\n let theme = themes[nextName]\n if (!theme) {\n theme = themes[`light_${nextName}`]\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (debug) {\n console.log('getNextTheme', this.getClassName(nextName), { props, nextName, parentName })\n }\n }\n\n return {\n name: nextName,\n theme: getThemeUnwrapped(theme),\n className: this.getClassName(nextName),\n }\n }\n\n getClassName(name: string) {\n return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace('light_', '').replace('dark_', '')\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n notifyListeners() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager | null>(null)\nexport const emptyManager = new ThemeManager()\n\nconst withoutComponentName = (name: string) => name.replace(/(\\_[A-Z][a-zA-Z]+)+$/g, '')\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/addTheme.js
CHANGED
|
@@ -30,7 +30,7 @@ function addTheme(props) {
|
|
|
30
30
|
const config = (0, import_config.getConfig)();
|
|
31
31
|
if (process.env.NODE_ENV === "development") {
|
|
32
32
|
if (!config) {
|
|
33
|
-
throw new Error(
|
|
33
|
+
throw new Error("No config");
|
|
34
34
|
}
|
|
35
35
|
const theme2 = config.themes[props.name];
|
|
36
36
|
if (!props.update && theme2) {
|
package/dist/cjs/addTheme.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/addTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getConfig, updateConfig } from './config'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeDefinition, ThemeParsed } from './types'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error(
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getConfig, updateConfig } from './config'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeDefinition, ThemeParsed } from './types'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error('No config')\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEtB,oBAAwC;AACxC,8BAAiC;AACjC,oBAAyD;AAGlD,SAAS,SAAS,OAKtB;AAZH;AAaE,QAAM,aAAS,yBAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM;AAClC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,2CAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,mBAAe,mCAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,aAAa;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,wBAAO;AACT,QAAI,WAAW;AACb,qBAAW,0CAAiB;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,kCAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,YAAY,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["theme"]
|
|
7
7
|
}
|
package/dist/cjs/conf.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
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 conf_exports = {};
|
|
20
|
+
__export(conf_exports, {
|
|
21
|
+
configListeners: () => configListeners,
|
|
22
|
+
getConfig: () => getConfig,
|
|
23
|
+
getHasConfigured: () => getHasConfigured,
|
|
24
|
+
getThemes: () => getThemes,
|
|
25
|
+
getTokens: () => getTokens,
|
|
26
|
+
onConfiguredOnce: () => onConfiguredOnce,
|
|
27
|
+
setConfig: () => setConfig,
|
|
28
|
+
setConfigFont: () => setConfigFont
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(conf_exports);
|
|
31
|
+
let conf;
|
|
32
|
+
const setConfig = (next) => {
|
|
33
|
+
conf = next;
|
|
34
|
+
if (configListeners.size) {
|
|
35
|
+
configListeners.forEach((cb) => cb(conf));
|
|
36
|
+
configListeners.clear();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const setConfigFont = (name, font, fontParsed) => {
|
|
40
|
+
if (process.env.NODE_ENV === "development") {
|
|
41
|
+
if (!conf)
|
|
42
|
+
throw new Error(`Haven't called createTamagui yet`);
|
|
43
|
+
}
|
|
44
|
+
Object.assign(conf.fonts, { [name]: font });
|
|
45
|
+
Object.assign(conf.fontsParsed, { [`$${name}`]: fontParsed });
|
|
46
|
+
};
|
|
47
|
+
const getHasConfigured = () => !!conf;
|
|
48
|
+
const getConfig = () => conf;
|
|
49
|
+
const getTokens = () => conf.tokensParsed;
|
|
50
|
+
const getThemes = () => conf.themes;
|
|
51
|
+
const configListeners = /* @__PURE__ */ new Set();
|
|
52
|
+
const onConfiguredOnce = (cb) => {
|
|
53
|
+
if (conf) {
|
|
54
|
+
cb(conf);
|
|
55
|
+
} else {
|
|
56
|
+
configListeners.add(cb);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
configListeners,
|
|
62
|
+
getConfig,
|
|
63
|
+
getHasConfigured,
|
|
64
|
+
getThemes,
|
|
65
|
+
getTokens,
|
|
66
|
+
onConfiguredOnce,
|
|
67
|
+
setConfig,
|
|
68
|
+
setConfigFont
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=conf.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/conf.ts"],
|
|
4
|
+
"sourcesContent": ["import { ConfigListener, TamaguiInternalConfig } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(conf!))\n configListeners.clear()\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const getHasConfigured = () => !!conf\nexport const getConfig = () => conf!\nexport const getTokens = () => conf!.tokensParsed\nexport const getThemes = () => conf!.themes\n\nexport const configListeners = new Set<ConfigListener>()\n\nexport const onConfiguredOnce = (cb: ConfigListener) => {\n if (conf) {\n cb(conf!)\n } else {\n configListeners.add(cb)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAI;AAEG,MAAM,YAAY,CAAC,SAAgC;AACxD,SAAO;AACP,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAK,CAAC;AACzC,oBAAgB,MAAM;AAAA,EACxB;AACF;AAEO,MAAM,gBAAgB,CAAC,MAAc,MAAW,eAAoB;AACzE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC;AAAM,YAAM,IAAI,MAAM,kCAAkC;AAAA,EAC/D;AACA,SAAO,OAAO,KAAM,OAAO,EAAE,CAAC,OAAO,KAAK,CAAC;AAC3C,SAAO,OAAO,KAAM,aAAa,EAAE,CAAC,IAAI,SAAS,WAAW,CAAC;AAC/D;AAEO,MAAM,mBAAmB,MAAM,CAAC,CAAC;AACjC,MAAM,YAAY,MAAM;AACxB,MAAM,YAAY,MAAM,KAAM;AAC9B,MAAM,YAAY,MAAM,KAAM;AAE9B,MAAM,kBAAkB,oBAAI,IAAoB;AAEhD,MAAM,mBAAmB,CAAC,OAAuB;AACtD,MAAI,MAAM;AACR,OAAG,IAAK;AAAA,EACV,OAAO;AACL,oBAAgB,IAAI,EAAE;AAAA,EACxB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/config.js
CHANGED
|
@@ -47,7 +47,7 @@ const setConfigFont = (name, font, fontParsed) => {
|
|
|
47
47
|
const getConfig = () => {
|
|
48
48
|
if (!conf) {
|
|
49
49
|
throw new Error(
|
|
50
|
-
process.env.NODE_ENV === "development" ? `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.` :
|
|
50
|
+
process.env.NODE_ENV === "development" ? `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.` : "Err0"
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
return conf;
|
package/dist/cjs/config.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/config.ts"],
|
|
4
|
-
"sourcesContent": ["import { ConfigListener, TamaguiInternalConfig, ThemeParsed, Tokens } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(next))\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const getConfig = () => {\n if (!conf) {\n throw new Error(\n process.env.NODE_ENV === 'development'\n ? `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.`\n :
|
|
4
|
+
"sourcesContent": ["import { ConfigListener, TamaguiInternalConfig, ThemeParsed, Tokens } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(next))\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const getConfig = () => {\n if (!conf) {\n throw new Error(\n process.env.NODE_ENV === 'development'\n ? `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.`\n : 'Err0'\n )\n }\n return conf\n}\nexport const getTokens = (prefixed?: boolean): Tokens =>\n prefixed ? conf!.tokensParsed : conf!.tokens\n\n/**\n * Note: this is the same as `getTokens`\n */\nexport const useTokens = getTokens\n\nexport const getThemes = () => conf!.themes\n\nexport const configListeners = new Set<ConfigListener>()\n\nexport const onConfiguredOnce = (cb: ConfigListener) => {\n if (conf) {\n cb(conf)\n } else {\n configListeners.add(cb)\n }\n}\n\nexport const updateConfig = (key: string, value: any) => {\n Object.assign(key, value)\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAI;AAEG,MAAM,YAAY,CAAC,SAAgC;AACxD,SAAO;AACP,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1C;AACF;AAEO,MAAM,gBAAgB,CAAC,MAAc,MAAW,eAAoB;AACzE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC;AAAM,YAAM,IAAI,MAAM,kCAAkC;AAAA,EAC/D;AACA,SAAO,OAAO,KAAM,OAAO,EAAE,CAAC,OAAO,KAAK,CAAC;AAC3C,SAAO,OAAO,KAAM,aAAa,EAAE,CAAC,IAAI,SAAS,WAAW,CAAC;AAC/D;AAEO,MAAM,YAAY,MAAM;AAC7B,MAAI,CAAC,MAAM;AACT,UAAM,IAAI;AAAA,MACR,QAAQ,IAAI,aAAa,gBACrB,wIACA;AAAA,IACN;AAAA,EACF;AACA,SAAO;AACT;AACO,MAAM,YAAY,CAAC,aACxB,WAAW,KAAM,eAAe,KAAM;AAKjC,MAAM,YAAY;AAElB,MAAM,YAAY,MAAM,KAAM;AAE9B,MAAM,kBAAkB,oBAAI,IAAoB;AAEhD,MAAM,mBAAmB,CAAC,OAAuB;AACtD,MAAI,MAAM;AACR,OAAG,IAAI;AAAA,EACT,OAAO;AACL,oBAAgB,IAAI,EAAE;AAAA,EACxB;AACF;AAEO,MAAM,eAAe,CAAC,KAAa,UAAe;AACvD,SAAO,OAAO,KAAK,KAAK;AAC1B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,7 +25,7 @@ __export(constants_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(constants_exports);
|
|
27
27
|
const THEME_NAME_SEPARATOR = "_";
|
|
28
|
-
const THEME_CLASSNAME_PREFIX =
|
|
28
|
+
const THEME_CLASSNAME_PREFIX = "t_";
|
|
29
29
|
const webOnlyDefaultStyles = {
|
|
30
30
|
display: "flex",
|
|
31
31
|
flexBasis: "auto",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/constants.ts"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nexport const THEME_NAME_SEPARATOR = '_'\nexport const THEME_CLASSNAME_PREFIX =
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nexport const THEME_NAME_SEPARATOR = '_'\nexport const THEME_CLASSNAME_PREFIX = 't_'\n\nexport const webOnlyDefaultStyles = {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n position: 'relative',\n minHeight: 0,\n minWidth: 0,\n}\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n ...webOnlyDefaultStyles,\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;AAE/B,MAAM,uBAAuB;AAAA,EAClC,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,UAAU;AACZ;AAEO,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,GAAG;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,8 +22,7 @@ __export(platform_exports, {
|
|
|
22
22
|
isChrome: () => isChrome,
|
|
23
23
|
isClient: () => isClient,
|
|
24
24
|
isIOS: () => isIOS,
|
|
25
|
-
|
|
26
|
-
isServer: () => isServer,
|
|
25
|
+
isSSR: () => isSSR,
|
|
27
26
|
isTouchable: () => isTouchable,
|
|
28
27
|
isWeb: () => isWeb,
|
|
29
28
|
isWebTouchable: () => isWebTouchable,
|
|
@@ -33,18 +32,14 @@ __export(platform_exports, {
|
|
|
33
32
|
module.exports = __toCommonJS(platform_exports);
|
|
34
33
|
var import_react = require("react");
|
|
35
34
|
var import_react_native = require("react-native");
|
|
36
|
-
const import_meta = {};
|
|
37
35
|
var _a, _b;
|
|
38
36
|
const isAndroid = ((_a = import_react_native.Platform) == null ? void 0 : _a.OS) === "android";
|
|
39
37
|
const isIOS = ((_b = import_react_native.Platform) == null ? void 0 : _b.OS) === "ios";
|
|
40
38
|
const isWeb = process.env.TAMAGUI_TARGET === "web";
|
|
41
39
|
const isWindowDefined = typeof window !== "undefined";
|
|
42
|
-
const
|
|
40
|
+
const isSSR = isWeb && !isWindowDefined;
|
|
43
41
|
const isClient = isWeb && isWindowDefined;
|
|
44
|
-
const
|
|
45
|
-
const idFn = () => {
|
|
46
|
-
};
|
|
47
|
-
const useIsomorphicLayoutEffect = isRSC ? idFn : isServer ? import_react.useEffect : import_react.useLayoutEffect;
|
|
42
|
+
const useIsomorphicLayoutEffect = isSSR ? import_react.useEffect : import_react.useLayoutEffect;
|
|
48
43
|
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
49
44
|
const isWebTouchable = isClient && "ontouchstart" in window;
|
|
50
45
|
const isTouchable = !isWeb || isWebTouchable;
|
|
@@ -54,8 +49,7 @@ const isTouchable = !isWeb || isWebTouchable;
|
|
|
54
49
|
isChrome,
|
|
55
50
|
isClient,
|
|
56
51
|
isIOS,
|
|
57
|
-
|
|
58
|
-
isServer,
|
|
52
|
+
isSSR,
|
|
59
53
|
isTouchable,
|
|
60
54
|
isWeb,
|
|
61
55
|
isWebTouchable,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/platform.ts"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const isSSR = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\nexport const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const isWebTouchable = isClient && 'ontouchstart' in window\nexport const isTouchable = !isWeb || isWebTouchable\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,0BAAyB;AADzB;AAGO,MAAM,YAAY,2DAAU,QAAO;AACnC,MAAM,QAAQ,2DAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,QAAQ,SAAS,CAAC;AACxB,MAAM,WAAW,SAAS;AAC1B,MAAM,4BAA4B,QAAQ,yBAAY;AACtD,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,iBAAiB,YAAY,kBAAkB;AACrD,MAAM,cAAc,CAAC,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var rnw_native_exports = {};
|
|
19
|
+
__export(rnw_native_exports, {
|
|
20
|
+
rnw: () => rnw
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(rnw_native_exports);
|
|
23
|
+
const rnw = {};
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
rnw
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=rnw.native.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/contexts/ButtonInsideButtonContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import { createContext } from 'react'\n\nexport const ButtonInsideButtonContext = createContext(false)\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAEvB,MAAM,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAEvB,MAAM,4BAA4B,gCAAc,KAAK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|