@tamagui/core 1.0.0-beta.187 → 1.0.0-beta.2
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/Tamagui.js +18 -1
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/ThemeContext.js +4 -0
- package/dist/cjs/ThemeManager.js +30 -14
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/conf.js +10 -1
- package/dist/cjs/conf.js.map +2 -2
- package/dist/cjs/constants/constants.js +6 -0
- package/dist/cjs/constants/platform.js +15 -0
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/rnw.js +4 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +4 -0
- package/dist/cjs/createComponent.js +156 -130
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js +4 -0
- package/dist/cjs/createShorthands.js +4 -0
- package/dist/cjs/createTamagui.js +56 -27
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +4 -0
- package/dist/cjs/createTokens.js +7 -6
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +18 -2
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/defaultComponentState.js +0 -30
- package/dist/cjs/defaultComponentState.js.map +3 -3
- package/dist/cjs/helpers/RNComponents.js +38 -0
- package/dist/cjs/helpers/RNComponents.js.map +7 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js +19 -16
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +2 -2
- package/dist/cjs/helpers/areEqualSets.js +4 -0
- package/dist/cjs/helpers/createMediaStyle.js +5 -0
- package/dist/cjs/helpers/createPropMapper.js +63 -61
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +55 -0
- package/dist/cjs/helpers/createShallowUpdate.js.map +7 -0
- package/dist/cjs/helpers/createTamaguiProvider.js +5 -5
- package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +9 -6
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.js +4 -0
- package/dist/cjs/helpers/fixNativeShadow.native.js +6 -2
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/cjs/helpers/getExpandedShorthands.js +4 -0
- package/dist/cjs/helpers/getSize.js +35 -0
- package/dist/cjs/helpers/getSize.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +152 -64
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +20 -2
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +4 -0
- package/dist/cjs/helpers/insertStyleRule.js +46 -26
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/isObj.js +4 -0
- package/dist/cjs/helpers/isTamaguiElement.js +4 -0
- package/dist/cjs/helpers/matchMedia.js +4 -0
- package/dist/cjs/helpers/matchMedia.native.js +4 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +40 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +7 -2
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/validate.js +53 -11
- package/dist/cjs/helpers/validate.js.map +2 -2
- package/dist/cjs/helpers/withStaticProperties.js +4 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js +4 -0
- package/dist/cjs/hooks/useConstant.js +4 -0
- package/dist/cjs/hooks/useFeatures.js +101 -12
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useIsMounted.js +4 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +8 -4
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +30 -12
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePressable.js +4 -0
- package/dist/cjs/hooks/useTheme.js +36 -23
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js +4 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +3 -0
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +8 -15
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types-rnw.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Stack.js +5 -0
- package/dist/cjs/views/Stack.js.map +2 -2
- package/dist/cjs/views/Text.js +5 -0
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/TextAncestorContext.js +6 -0
- package/dist/cjs/views/Theme.js +11 -4
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +5 -0
- package/dist/cjs/views/ThemeProvider.js +6 -1
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +4 -0
- package/dist/esm/Tamagui.js +10 -2
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/ThemeManager.js +21 -11
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/conf.js +0 -1
- package/dist/esm/conf.js.map +2 -2
- package/dist/esm/constants/platform.js +2 -0
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/createComponent.js +146 -133
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +53 -28
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js +2 -6
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +8 -2
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/defaultComponentState.js +0 -11
- package/dist/esm/defaultComponentState.js.map +3 -3
- package/dist/esm/helpers/RNComponents.js +12 -0
- package/dist/esm/helpers/RNComponents.js.map +7 -0
- package/dist/esm/helpers/addStylesUsingClassname.js +16 -18
- package/dist/esm/helpers/addStylesUsingClassname.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +59 -61
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +19 -0
- package/dist/esm/helpers/createShallowUpdate.js.map +7 -0
- package/dist/esm/helpers/createTamaguiProvider.js +1 -4
- package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +9 -6
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/esm/helpers/getSize.js +13 -0
- package/dist/esm/helpers/getSize.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +152 -67
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +15 -2
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +36 -26
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/proxyThemeVariables.js +18 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/esm/helpers/themeable.js +3 -2
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/validate.js +24 -11
- package/dist/esm/helpers/validate.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +96 -17
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useIsTouchDevice.js +6 -6
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +19 -12
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +28 -23
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/static.js +3 -0
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +4 -12
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Stack.js +1 -0
- package/dist/esm/views/Stack.js.map +2 -2
- package/dist/esm/views/Text.js +1 -0
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/Theme.js +7 -4
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +2 -1
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/jsx/Tamagui.js +10 -2
- package/dist/jsx/ThemeManager.js +21 -11
- package/dist/jsx/conf.js +0 -1
- package/dist/jsx/constants/platform.js +2 -0
- package/dist/jsx/createComponent.js +139 -127
- package/dist/jsx/createTamagui.js +53 -28
- package/dist/jsx/createTokens.js +2 -6
- package/dist/jsx/createVariable.js +8 -2
- package/dist/jsx/defaultComponentState.js +0 -11
- package/dist/jsx/helpers/RNComponents.js +11 -0
- package/dist/jsx/helpers/addStylesUsingClassname.js +16 -18
- package/dist/jsx/helpers/createPropMapper.js +59 -61
- package/dist/jsx/helpers/createShallowUpdate.js +18 -0
- package/dist/jsx/helpers/createTamaguiProvider.js +1 -2
- package/dist/jsx/helpers/extendStaticConfig.js +9 -6
- package/dist/jsx/helpers/fixNativeShadow.native.js +2 -2
- package/dist/jsx/helpers/getSize.js +12 -0
- package/dist/jsx/helpers/getSplitStyles.js +152 -67
- package/dist/jsx/helpers/getStylesAtomic.js +15 -2
- package/dist/jsx/helpers/insertStyleRule.js +36 -26
- package/dist/jsx/helpers/proxyThemeVariables.js +17 -0
- package/dist/jsx/helpers/themeable.js +3 -3
- package/dist/jsx/helpers/validate.js +24 -11
- package/dist/jsx/hooks/useFeatures.js +96 -17
- package/dist/jsx/hooks/useIsTouchDevice.js +6 -6
- package/dist/jsx/hooks/useMedia.js +19 -12
- package/dist/jsx/hooks/useTheme.js +28 -23
- package/dist/jsx/index.js +4 -0
- package/dist/jsx/static.js +3 -0
- package/dist/jsx/styled.js +4 -12
- package/dist/jsx/views/Stack.js +1 -0
- package/dist/jsx/views/Text.js +1 -0
- package/dist/jsx/views/Theme.js +7 -4
- package/dist/jsx/views/ThemeProvider.js +2 -2
- package/package.json +6 -6
- package/types/Tamagui.d.ts +18 -1
- package/types/Tamagui.d.ts.map +1 -1
- package/types/ThemeManager.d.ts +3 -3
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/conf.d.ts +2 -0
- package/types/conf.d.ts.map +1 -1
- package/types/constants/platform.d.ts +1 -0
- package/types/constants/platform.d.ts.map +1 -1
- package/types/createComponent.d.ts +5 -7
- package/types/createComponent.d.ts.map +1 -1
- package/types/createFont.d.ts +1 -1
- package/types/createFont.d.ts.map +1 -1
- package/types/createTamagui.d.ts +3 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createTokens.d.ts +0 -26
- package/types/createTokens.d.ts.map +1 -1
- package/types/createVariable.d.ts +1 -0
- package/types/createVariable.d.ts.map +1 -1
- package/types/defaultComponentState.d.ts +0 -12
- package/types/defaultComponentState.d.ts.map +1 -1
- package/types/helpers/RNComponents.d.ts +2 -0
- package/types/helpers/RNComponents.d.ts.map +1 -0
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +2 -2
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/createShallowUpdate.d.ts +4 -0
- package/types/helpers/createShallowUpdate.d.ts.map +1 -0
- package/types/helpers/createTamaguiProvider.d.ts +1 -1
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/extendStaticConfig.d.ts +2 -2
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/getSize.d.ts +3 -0
- package/types/helpers/getSize.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +15 -18
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +2 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/proxyThemeVariables.d.ts +2 -0
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts +3 -1
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/helpers/validate.d.ts.map +1 -1
- package/types/hooks/useFeatures.d.ts +7 -5
- package/types/hooks/useFeatures.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts +2 -6
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/static.d.ts +3 -0
- package/types/static.d.ts.map +1 -1
- package/types/styled.d.ts +13 -8
- package/types/styled.d.ts.map +1 -1
- package/types/types-rnw.d.ts +0 -5
- package/types/types-rnw.d.ts.map +1 -1
- package/types/types.d.ts +147 -106
- package/types/types.d.ts.map +1 -1
- package/types/views/Stack.d.ts +2 -2
- package/types/views/Stack.d.ts.map +1 -1
- package/types/views/Text.d.ts +2 -2
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/Theme.d.ts +1 -0
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeProvider.d.ts +1 -0
- package/types/views/ThemeProvider.d.ts.map +1 -1
- package/LICENSE +0 -21
- package/dist/cjs/spacedChildren.js +0 -86
- package/dist/cjs/spacedChildren.js.map +0 -7
- package/dist/esm/spacedChildren.js +0 -52
- package/dist/esm/spacedChildren.js.map +0 -7
- package/dist/jsx/spacedChildren.js +0 -44
- package/types/spacedChildren.d.ts +0 -9
- package/types/spacedChildren.d.ts.map +0 -1
|
@@ -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'\n\nexport const isWeb =\n process.env.TAMAGUI_TARGET !== 'native' &&\n (process.env.TAMAGUI_TARGET === 'web' || Platform?.OS === 'web')\n\nexport const isSSR = isWeb && typeof window === 'undefined'\nexport const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const supportsTouchWeb = typeof window !== 'undefined' && 'ontouchstart' in window\nexport const isTouchDevice = !isWeb || supportsTouchWeb\nexport const isWebIOS =\n isWeb &&\n typeof navigator !== 'undefined' &&\n (/iPad|iPhone|iPod/.test(navigator.platform) ||\n (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&\n !window['MSStream']\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA;AACA;AAEO,MAAM,YAAY,uCAAU,QAAO;AACnC,MAAM,QAAQ,uCAAU,QAAO;AAE/B,MAAM,QACX,QAAQ,IAAI,mBAAmB,YAC9B,SAAQ,IAAI,mBAAmB,SAAS,uCAAU,QAAO;AAErD,MAAM,QAAQ,SAAS,OAAO,WAAW;AACzC,MAAM,4BAA4B,QAAQ,YAAY;AACtD,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,mBAAmB,OAAO,WAAW,eAAe,kBAAkB;AAC5E,MAAM,gBAAgB,CAAC,SAAS;AAChC,MAAM,WACX,SACA,OAAO,cAAc,eACpB,oBAAmB,KAAK,UAAU,QAAQ,KACxC,UAAU,aAAa,cAAc,UAAU,iBAAiB,MACnE,CAAC,OAAO;",
|
|
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'\n\nexport const isWeb =\n process.env.TAMAGUI_TARGET !== 'native' &&\n (process.env.TAMAGUI_TARGET === 'web' || Platform?.OS === 'web')\n\nexport const isSSR = isWeb && typeof window === 'undefined'\nexport const isClient = isWeb && typeof window !== 'undefined'\nexport const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const supportsTouchWeb = typeof window !== 'undefined' && 'ontouchstart' in window\nexport const isTouchDevice = !isWeb || supportsTouchWeb\nexport const isWebIOS =\n isWeb &&\n typeof navigator !== 'undefined' &&\n (/iPad|iPhone|iPod/.test(navigator.platform) ||\n (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&\n !window['MSStream']\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA;AACA;AAEO,MAAM,YAAY,uCAAU,QAAO;AACnC,MAAM,QAAQ,uCAAU,QAAO;AAE/B,MAAM,QACX,QAAQ,IAAI,mBAAmB,YAC9B,SAAQ,IAAI,mBAAmB,SAAS,uCAAU,QAAO;AAErD,MAAM,QAAQ,SAAS,OAAO,WAAW;AACzC,MAAM,WAAW,SAAS,OAAO,WAAW;AAC5C,MAAM,4BAA4B,QAAQ,YAAY;AACtD,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,mBAAmB,OAAO,WAAW,eAAe,kBAAkB;AAC5E,MAAM,gBAAgB,CAAC,SAAS;AAChC,MAAM,WACX,SACA,OAAO,cAAc,eACpB,oBAAmB,KAAK,UAAU,QAAQ,KACxC,UAAU,aAAa,cAAc,UAAU,iBAAiB,MACnE,CAAC,OAAO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,103 +10,119 @@ import React, {
|
|
|
10
10
|
memo,
|
|
11
11
|
useCallback,
|
|
12
12
|
useContext,
|
|
13
|
-
useEffect,
|
|
14
13
|
useRef,
|
|
15
14
|
useState
|
|
16
15
|
} from "react";
|
|
17
16
|
import { StyleSheet, Text, View } from "react-native";
|
|
18
17
|
import { onConfiguredOnce } from "./conf";
|
|
19
18
|
import { stackDefaultStyles } from "./constants/constants";
|
|
20
|
-
import { isAndroid,
|
|
19
|
+
import { isAndroid, isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
|
|
21
20
|
import { rnw } from "./constants/rnw";
|
|
22
21
|
import { isVariable } from "./createVariable";
|
|
23
|
-
import {
|
|
22
|
+
import { createShallowUpdate } from "./helpers/createShallowUpdate";
|
|
24
23
|
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
} from "./helpers/
|
|
24
|
+
import { insertSplitStyles, useSplitStyles } from "./helpers/getSplitStyles";
|
|
25
|
+
import { getAllSelectors } from "./helpers/insertStyleRule";
|
|
26
|
+
import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
|
|
28
27
|
import { wrapThemeManagerContext } from "./helpers/wrapThemeManagerContext";
|
|
29
28
|
import { useFeatures } from "./hooks/useFeatures";
|
|
29
|
+
import { useIsTouchDevice } from "./hooks/useIsTouchDevice";
|
|
30
30
|
import { usePressable } from "./hooks/usePressable";
|
|
31
31
|
import { getThemeManagerIfChanged, useTheme } from "./hooks/useTheme";
|
|
32
32
|
import { TextAncestorContext } from "./views/TextAncestorContext";
|
|
33
|
+
React["keep"];
|
|
34
|
+
const defaultComponentState = {
|
|
35
|
+
hover: false,
|
|
36
|
+
press: false,
|
|
37
|
+
pressIn: false,
|
|
38
|
+
focus: false,
|
|
39
|
+
mounted: false,
|
|
40
|
+
animation: null
|
|
41
|
+
};
|
|
33
42
|
const mouseUps = /* @__PURE__ */ new Set();
|
|
34
43
|
if (typeof document !== "undefined") {
|
|
35
44
|
document.addEventListener("mouseup", () => {
|
|
36
45
|
mouseUps.forEach((x) => x());
|
|
37
46
|
mouseUps.clear();
|
|
38
47
|
});
|
|
48
|
+
document.addEventListener("touchend", () => {
|
|
49
|
+
mouseUps.forEach((x) => x());
|
|
50
|
+
mouseUps.clear();
|
|
51
|
+
});
|
|
52
|
+
document.addEventListener("touchcancel", () => {
|
|
53
|
+
mouseUps.forEach((x) => x());
|
|
54
|
+
mouseUps.clear();
|
|
55
|
+
});
|
|
39
56
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (const key in next) {
|
|
44
|
-
if (prev[key] !== next[key]) {
|
|
45
|
-
return { ...prev, ...next };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return prev;
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
__name(createShallowUpdate, "createShallowUpdate");
|
|
53
|
-
function createComponent(configIn) {
|
|
54
|
-
let staticConfig;
|
|
55
|
-
if ("parsed" in configIn) {
|
|
56
|
-
staticConfig = configIn;
|
|
57
|
-
} else {
|
|
58
|
-
staticConfig = parseStaticConfig(configIn);
|
|
57
|
+
function mergeShorthands({ defaultProps }, { shorthands }) {
|
|
58
|
+
for (const key in defaultProps) {
|
|
59
|
+
defaultProps[shorthands[key] || key] = defaultProps[key];
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
}
|
|
62
|
+
__name(mergeShorthands, "mergeShorthands");
|
|
63
|
+
let initialTheme;
|
|
64
|
+
function createComponent(configIn, ParentComponent) {
|
|
65
|
+
const staticConfig = (() => {
|
|
66
|
+
const config = extendStaticConfig(configIn, ParentComponent);
|
|
67
|
+
if ("parsed" in config) {
|
|
68
|
+
return config;
|
|
69
|
+
} else {
|
|
70
|
+
return parseStaticConfig(config);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
const componentClassName = `is_${staticConfig.componentName}`;
|
|
63
74
|
let tamaguiConfig;
|
|
64
75
|
let AnimatedText;
|
|
65
76
|
let AnimatedView;
|
|
66
|
-
let avoidClasses =
|
|
67
|
-
let defaultPseudos = {};
|
|
77
|
+
let avoidClasses = true;
|
|
68
78
|
let defaultNativeStyle;
|
|
69
|
-
let defaultNativeStyleSheet
|
|
70
|
-
let
|
|
71
|
-
let
|
|
72
|
-
let splitStyleResult = null;
|
|
79
|
+
let defaultNativeStyleSheet;
|
|
80
|
+
let tamaguiDefaultProps;
|
|
81
|
+
let initialSplitStyles;
|
|
73
82
|
function addPseudoToStyles(styles, name, pseudos) {
|
|
74
83
|
const pseudoStyle = pseudos[name];
|
|
84
|
+
const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
75
85
|
if (pseudoStyle) {
|
|
76
|
-
styles.push(
|
|
86
|
+
styles.push(shouldNestObject ? { [name]: pseudoStyle } : pseudoStyle);
|
|
77
87
|
}
|
|
78
|
-
const defaultPseudoStyle =
|
|
88
|
+
const defaultPseudoStyle = initialSplitStyles.pseudos[name];
|
|
79
89
|
if (defaultPseudoStyle) {
|
|
80
|
-
styles.push(
|
|
90
|
+
styles.push(shouldNestObject ? { [name]: defaultPseudoStyle } : defaultPseudoStyle);
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
93
|
__name(addPseudoToStyles, "addPseudoToStyles");
|
|
84
94
|
const component = forwardRef((props, forwardedRef) => {
|
|
85
95
|
var _a, _b, _c, _d;
|
|
96
|
+
props = tamaguiDefaultProps ? { ...tamaguiDefaultProps, ...props } : props;
|
|
97
|
+
const { Component, componentName, isText, isZStack } = staticConfig;
|
|
86
98
|
if (process.env.NODE_ENV === "development") {
|
|
87
99
|
if (props["debug"]) {
|
|
88
|
-
console.warn(componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "
|
|
100
|
+
console.warn(staticConfig.componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
|
|
101
|
+
console.log("props in:", props, Object.keys(props));
|
|
89
102
|
if (props["debug"] === "break")
|
|
90
103
|
debugger;
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
106
|
const forceUpdate = useForceUpdate();
|
|
94
|
-
const theme = useTheme(props.theme, componentName, props, forceUpdate);
|
|
107
|
+
const theme = useTheme(props.theme, staticConfig.componentName, props, forceUpdate);
|
|
95
108
|
const [state, set_] = useState(defaultComponentState);
|
|
96
109
|
const setStateShallow = createShallowUpdate(set_);
|
|
97
|
-
const shouldAvoidClasses = !!(
|
|
98
|
-
const
|
|
99
|
-
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } =
|
|
110
|
+
const shouldAvoidClasses = !!(props.animation && avoidClasses);
|
|
111
|
+
const splitStyles = useSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, shouldAvoidClasses ? null : initialSplitStyles.classNames);
|
|
112
|
+
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
|
|
100
113
|
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
101
114
|
const isAnimated = !!(useAnimations && props.animation);
|
|
102
|
-
const
|
|
115
|
+
const hasEnterStyle = !!props.enterStyle;
|
|
103
116
|
const features = useFeatures(props, {
|
|
104
117
|
forceUpdate,
|
|
105
118
|
setStateShallow,
|
|
106
119
|
useAnimations,
|
|
107
120
|
state,
|
|
108
|
-
style:
|
|
109
|
-
pseudos
|
|
121
|
+
style: props.animation ? { ...defaultNativeStyle, ...style } : null,
|
|
122
|
+
pseudos,
|
|
123
|
+
staticConfig,
|
|
124
|
+
theme,
|
|
125
|
+
onDidAnimate: props.onDidAnimate
|
|
110
126
|
});
|
|
111
127
|
const {
|
|
112
128
|
tag,
|
|
@@ -145,6 +161,7 @@ function createComponent(configIn) {
|
|
|
145
161
|
accessibilityRole,
|
|
146
162
|
collapsable,
|
|
147
163
|
focusable,
|
|
164
|
+
onClick,
|
|
148
165
|
theme: _themeProp,
|
|
149
166
|
defaultVariants,
|
|
150
167
|
onLayout,
|
|
@@ -160,15 +177,14 @@ function createComponent(configIn) {
|
|
|
160
177
|
}
|
|
161
178
|
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
|
|
162
179
|
const hostRef = useRef(null);
|
|
163
|
-
const hasEnterStyle = !!props.enterStyle;
|
|
164
180
|
const internal = useRef();
|
|
165
181
|
if (!internal.current) {
|
|
166
182
|
internal.current = {
|
|
167
183
|
isMounted: true
|
|
168
184
|
};
|
|
169
185
|
}
|
|
170
|
-
|
|
171
|
-
if (hasEnterStyle) {
|
|
186
|
+
useIsomorphicLayoutEffect(() => {
|
|
187
|
+
if (typeof window !== "undefined" && (hasEnterStyle || props.animation)) {
|
|
172
188
|
setStateShallow({
|
|
173
189
|
mounted: true
|
|
174
190
|
});
|
|
@@ -178,7 +194,7 @@ function createComponent(configIn) {
|
|
|
178
194
|
mouseUps.delete(unPress);
|
|
179
195
|
internal.current.isMounted = false;
|
|
180
196
|
};
|
|
181
|
-
}, []);
|
|
197
|
+
}, [hasEnterStyle, props.animation]);
|
|
182
198
|
if (nativeID) {
|
|
183
199
|
viewProps.id = nativeID;
|
|
184
200
|
}
|
|
@@ -236,6 +252,7 @@ function createComponent(configIn) {
|
|
|
236
252
|
medias
|
|
237
253
|
];
|
|
238
254
|
if (!animationStyles) {
|
|
255
|
+
!state.mounted && addPseudoToStyles(styles, "enterStyle", pseudos);
|
|
239
256
|
state.hover && addPseudoToStyles(styles, "hoverStyle", pseudos);
|
|
240
257
|
state.focus && addPseudoToStyles(styles, "focusStyle", pseudos);
|
|
241
258
|
state.press && addPseudoToStyles(styles, "pressStyle", pseudos);
|
|
@@ -254,10 +271,11 @@ function createComponent(configIn) {
|
|
|
254
271
|
const className = classList.join(" ");
|
|
255
272
|
if (process.env.NODE_ENV === "development") {
|
|
256
273
|
if (props["debug"]) {
|
|
257
|
-
console.log(" \xBB className", { isStringElement, pseudos, state,
|
|
274
|
+
console.log(" \xBB className", { isStringElement, pseudos, state, classNames, propsClassName: props.className, style, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
|
|
258
275
|
}
|
|
259
276
|
}
|
|
260
277
|
viewProps.className = className;
|
|
278
|
+
viewProps.style = animationStyles;
|
|
261
279
|
} else {
|
|
262
280
|
viewProps.style = styles;
|
|
263
281
|
}
|
|
@@ -294,8 +312,10 @@ function createComponent(configIn) {
|
|
|
294
312
|
viewProps.ref = forwardedRef;
|
|
295
313
|
}
|
|
296
314
|
}
|
|
297
|
-
const
|
|
298
|
-
const
|
|
315
|
+
const initialPseudos = initialSplitStyles.pseudos;
|
|
316
|
+
const attachPress = !!(pseudos && pseudos.pressStyle || initialPseudos && initialPseudos.pressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
317
|
+
const isTouch = useIsTouchDevice();
|
|
318
|
+
const isHoverable = isWeb && !isTouch;
|
|
299
319
|
const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
300
320
|
const pressEventKey = isStringElement ? "onClick" : "onPress";
|
|
301
321
|
const shouldAttach = attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props);
|
|
@@ -353,8 +373,12 @@ function createComponent(configIn) {
|
|
|
353
373
|
});
|
|
354
374
|
onPressIn == null ? void 0 : onPressIn(e);
|
|
355
375
|
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
376
|
+
if (isWeb) {
|
|
377
|
+
mouseUps.add(unPress);
|
|
378
|
+
}
|
|
356
379
|
} : null,
|
|
357
380
|
[pressEventKey]: attachPress ? (e) => {
|
|
381
|
+
onClick == null ? void 0 : onClick(e);
|
|
358
382
|
onPress == null ? void 0 : onPress(e);
|
|
359
383
|
unPress();
|
|
360
384
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
@@ -377,22 +401,6 @@ function createComponent(configIn) {
|
|
|
377
401
|
} : {
|
|
378
402
|
disabled: true
|
|
379
403
|
});
|
|
380
|
-
if (events) {
|
|
381
|
-
if (!isStringElement) {
|
|
382
|
-
Object.assign(viewProps, pressProps);
|
|
383
|
-
} else {
|
|
384
|
-
Object.assign(viewProps, events);
|
|
385
|
-
}
|
|
386
|
-
if (isWeb && isHoverable) {
|
|
387
|
-
childEls = /* @__PURE__ */ React.createElement("span", {
|
|
388
|
-
style: {
|
|
389
|
-
display: "contents"
|
|
390
|
-
},
|
|
391
|
-
onMouseEnter: events.onMouseEnter,
|
|
392
|
-
onMouseLeave: events.onMouseLeave
|
|
393
|
-
}, children);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
404
|
let content;
|
|
397
405
|
if (isWeb) {
|
|
398
406
|
if (staticConfig.isReactNativeWeb) {
|
|
@@ -409,11 +417,28 @@ function createComponent(configIn) {
|
|
|
409
417
|
}
|
|
410
418
|
}
|
|
411
419
|
}
|
|
420
|
+
if (events) {
|
|
421
|
+
if (!isStringElement) {
|
|
422
|
+
Object.assign(viewProps, pressProps);
|
|
423
|
+
} else {
|
|
424
|
+
Object.assign(viewProps, events);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
412
427
|
content = createElement(ViewComponent, viewProps, childEls);
|
|
428
|
+
if (isWeb && events && attachHover) {
|
|
429
|
+
content = /* @__PURE__ */ React.createElement("span", {
|
|
430
|
+
className: "tui_Hoverable",
|
|
431
|
+
style: {
|
|
432
|
+
display: "contents"
|
|
433
|
+
},
|
|
434
|
+
onMouseEnter: events.onMouseEnter,
|
|
435
|
+
onMouseLeave: events.onMouseLeave
|
|
436
|
+
}, content);
|
|
437
|
+
}
|
|
413
438
|
if (process.env.NODE_ENV === "development") {
|
|
414
439
|
if (props["debug"]) {
|
|
415
440
|
viewProps["debug"] = true;
|
|
416
|
-
console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps,
|
|
441
|
+
console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, state, splitStyles, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
|
|
417
442
|
}
|
|
418
443
|
}
|
|
419
444
|
if (features.length) {
|
|
@@ -421,23 +446,28 @@ function createComponent(configIn) {
|
|
|
421
446
|
}
|
|
422
447
|
return content;
|
|
423
448
|
});
|
|
449
|
+
component.displayName = staticConfig.componentName;
|
|
424
450
|
onConfiguredOnce((conf) => {
|
|
425
451
|
var _a, _b, _c, _d;
|
|
426
|
-
|
|
452
|
+
if (process.env.IS_STATIC === "is_static") {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
427
455
|
tamaguiConfig = conf;
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
456
|
+
mergeShorthands(staticConfig, tamaguiConfig);
|
|
457
|
+
avoidClasses = !!((_a = tamaguiConfig.animations) == null ? void 0 : _a.avoidClasses);
|
|
458
|
+
AnimatedText = (_b = tamaguiConfig.animations) == null ? void 0 : _b.Text;
|
|
459
|
+
AnimatedView = (_c = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _c.View;
|
|
460
|
+
initialTheme = initialTheme || proxyThemeVariables(conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]);
|
|
461
|
+
initialSplitStyles = insertSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, {
|
|
433
462
|
mounted: true,
|
|
434
|
-
|
|
463
|
+
hover: false,
|
|
464
|
+
press: false,
|
|
465
|
+
pressIn: false,
|
|
466
|
+
focus: false,
|
|
467
|
+
resolveVariablesAs: "both",
|
|
468
|
+
keepVariantsAsProps: true
|
|
435
469
|
});
|
|
436
|
-
const {
|
|
437
|
-
if (isWeb) {
|
|
438
|
-
defaultsClassName = classNames;
|
|
439
|
-
}
|
|
440
|
-
defaultPseudos = pseudos;
|
|
470
|
+
const { style, viewProps } = initialSplitStyles;
|
|
441
471
|
defaultNativeStyle = {};
|
|
442
472
|
for (const key in style) {
|
|
443
473
|
const v = style[key];
|
|
@@ -446,13 +476,20 @@ function createComponent(configIn) {
|
|
|
446
476
|
defaultNativeStyleSheet = StyleSheet.create({
|
|
447
477
|
base: defaultNativeStyle
|
|
448
478
|
});
|
|
449
|
-
|
|
450
|
-
component.defaultProps = {
|
|
479
|
+
const defaults = {
|
|
451
480
|
...viewProps,
|
|
452
481
|
...component.defaultProps
|
|
453
482
|
};
|
|
454
|
-
if (
|
|
455
|
-
|
|
483
|
+
if (Object.keys(defaults).length) {
|
|
484
|
+
tamaguiDefaultProps = defaults;
|
|
485
|
+
}
|
|
486
|
+
if (process.env.NODE_ENV === "development" && ((_d = staticConfig.defaultProps) == null ? void 0 : _d.debug)) {
|
|
487
|
+
if (process.env.IS_STATIC !== "is_static") {
|
|
488
|
+
console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, {
|
|
489
|
+
staticConfig,
|
|
490
|
+
initialSplitStyles
|
|
491
|
+
});
|
|
492
|
+
}
|
|
456
493
|
}
|
|
457
494
|
});
|
|
458
495
|
let res = component;
|
|
@@ -460,25 +497,30 @@ function createComponent(configIn) {
|
|
|
460
497
|
res = memo(res);
|
|
461
498
|
}
|
|
462
499
|
res["staticConfig"] = {
|
|
463
|
-
validStyles:
|
|
500
|
+
validStyles: staticConfig.validStyles || stylePropsView,
|
|
464
501
|
...staticConfig
|
|
465
502
|
};
|
|
466
|
-
|
|
467
|
-
|
|
503
|
+
if (process.env.NODE_ENV === "development") {
|
|
504
|
+
res["whyDidYouRender"] = true;
|
|
505
|
+
}
|
|
506
|
+
res["extractable"] = (Component, conf) => {
|
|
507
|
+
Component["staticConfig"] = extendStaticConfig({
|
|
508
|
+
Component,
|
|
468
509
|
...conf,
|
|
469
510
|
neverFlatten: true,
|
|
470
511
|
defaultProps: {
|
|
471
|
-
...
|
|
512
|
+
...Component.defaultProps,
|
|
472
513
|
...conf == null ? void 0 : conf.defaultProps
|
|
473
514
|
}
|
|
474
|
-
});
|
|
475
|
-
return
|
|
515
|
+
}, res);
|
|
516
|
+
return Component;
|
|
476
517
|
};
|
|
477
518
|
return res;
|
|
478
519
|
}
|
|
479
520
|
__name(createComponent, "createComponent");
|
|
480
521
|
const Spacer = createComponent({
|
|
481
522
|
memo: true,
|
|
523
|
+
componentName: "Spacer",
|
|
482
524
|
defaultProps: {
|
|
483
525
|
...stackDefaultStyles,
|
|
484
526
|
size: true
|
|
@@ -558,49 +600,20 @@ function spacedChildren({
|
|
|
558
600
|
return next;
|
|
559
601
|
}
|
|
560
602
|
__name(spacedChildren, "spacedChildren");
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
continue;
|
|
570
|
-
for (const key in cur) {
|
|
571
|
-
const val = cur[key];
|
|
572
|
-
if (key !== "transform") {
|
|
573
|
-
if (!(key in res)) {
|
|
574
|
-
res[key] = val;
|
|
575
|
-
}
|
|
576
|
-
continue;
|
|
577
|
-
}
|
|
578
|
-
if (!res.transform) {
|
|
579
|
-
res.transform = val;
|
|
580
|
-
continue;
|
|
581
|
-
}
|
|
582
|
-
for (const t of val) {
|
|
583
|
-
const tkey = Object.keys(t)[0];
|
|
584
|
-
if (res.transform.find((existing) => tkey in existing)) {
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
res.transform.push(t);
|
|
588
|
-
}
|
|
603
|
+
function AbsoluteFill(props) {
|
|
604
|
+
return isWeb ? /* @__PURE__ */ React.createElement("div", {
|
|
605
|
+
style: {
|
|
606
|
+
position: "absolute",
|
|
607
|
+
top: 0,
|
|
608
|
+
left: 0,
|
|
609
|
+
right: 0,
|
|
610
|
+
bottom: 0
|
|
589
611
|
}
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
},
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
position: "absolute",
|
|
596
|
-
top: 0,
|
|
597
|
-
left: 0,
|
|
598
|
-
right: 0,
|
|
599
|
-
bottom: 0
|
|
600
|
-
}
|
|
601
|
-
}, props.children) : /* @__PURE__ */ React.createElement(View, {
|
|
602
|
-
style: StyleSheet.absoluteFill
|
|
603
|
-
}, props.child), "AbsoluteFill");
|
|
612
|
+
}, props.children) : /* @__PURE__ */ React.createElement(View, {
|
|
613
|
+
style: StyleSheet.absoluteFill
|
|
614
|
+
}, props.child);
|
|
615
|
+
}
|
|
616
|
+
__name(AbsoluteFill, "AbsoluteFill");
|
|
604
617
|
export {
|
|
605
618
|
AbsoluteFill,
|
|
606
619
|
Spacer,
|