@tamagui/core 1.0.0-alpha.37 → 1.0.0-alpha.38
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/constants/constants.js +32 -0
- package/dist/constants/constants.js.map +7 -0
- package/dist/{esm/constants → constants}/platform.js +2 -3
- package/dist/constants/platform.js.map +7 -0
- package/dist/constants/rnw.js +10 -0
- package/dist/constants/rnw.js.map +7 -0
- package/dist/constants/styleConstants.js +59 -0
- package/dist/constants/styleConstants.js.map +7 -0
- package/dist/createComponent.js +395 -0
- package/dist/createComponent.js.map +7 -0
- package/dist/{esm/createShorthands.js → createShorthands.js} +0 -0
- package/dist/createShorthands.js.map +7 -0
- package/dist/createTamagui.js +107 -0
- package/dist/createTamagui.js.map +7 -0
- package/dist/{esm/createTokens.js → createTokens.js} +0 -4
- package/dist/createTokens.js.map +7 -0
- package/dist/{esm/createVariable.js → createVariable.js} +2 -6
- package/dist/createVariable.js.map +7 -0
- package/dist/helpers/addStylesUsingClassname.js +28 -0
- package/dist/helpers/addStylesUsingClassname.js.map +7 -0
- package/dist/{esm/helpers → helpers}/createMediaStyle.js +0 -0
- package/dist/{esm/helpers → helpers}/createMediaStyle.js.map +1 -1
- package/dist/{esm/helpers → helpers}/createTamaguiProvider.js +20 -2
- package/dist/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/helpers/extendStaticConfig.js +158 -0
- package/dist/helpers/extendStaticConfig.js.map +7 -0
- package/dist/helpers/fixNativeShadow.js +38 -0
- package/dist/helpers/fixNativeShadow.js.map +7 -0
- package/dist/{esm/helpers → helpers}/getSplitStyles.js +40 -43
- package/dist/helpers/getSplitStyles.js.map +7 -0
- package/dist/{esm/helpers → helpers}/insertStyleRule.js +0 -7
- package/dist/helpers/insertStyleRule.js.map +7 -0
- package/dist/{esm/helpers → helpers}/matchMedia.js +0 -3
- package/dist/helpers/matchMedia.js.map +7 -0
- package/dist/{esm/helpers → helpers}/matchMedia.native.js +0 -1
- package/dist/{esm/helpers → helpers}/matchMedia.native.js.map +3 -3
- package/dist/helpers/setIfChanged.js +17 -0
- package/dist/helpers/setIfChanged.js.map +7 -0
- package/dist/{esm/helpers → helpers}/themeable.js +1 -1
- package/dist/{esm/helpers → helpers}/themeable.js.map +3 -3
- package/dist/{esm/hooks → hooks}/useConstant.js +0 -0
- package/dist/{esm/hooks → hooks}/useConstant.js.map +1 -1
- package/dist/{esm/hooks → hooks}/useFeatures.js +51 -39
- package/dist/hooks/useFeatures.js.map +7 -0
- package/dist/hooks/useForceUpdate.js +28 -0
- package/dist/hooks/useForceUpdate.js.map +7 -0
- package/dist/{esm/hooks → hooks}/useMedia.js +18 -20
- package/dist/hooks/useMedia.js.map +7 -0
- package/dist/{esm/hooks → hooks}/usePressable.js +1 -2
- package/dist/{esm/hooks → hooks}/usePressable.js.map +2 -2
- package/dist/{esm/hooks → hooks}/useTheme.js +25 -28
- package/dist/hooks/useTheme.js.map +7 -0
- package/dist/index.cjs +1837 -0
- package/dist/index.cjs.map +7 -0
- package/dist/{esm/index.js → index.js} +4 -6
- package/dist/index.js.map +7 -0
- package/dist/{esm/static → static}/postProcessStyles.js +3 -3
- package/dist/static/postProcessStyles.js.map +7 -0
- package/dist/{esm/static.js → static.js} +1 -6
- package/dist/static.js.map +7 -0
- package/dist/styled.js +28 -0
- package/dist/styled.js.map +7 -0
- package/dist/testtypes.js +1 -0
- package/dist/{esm/types.js.map → testtypes.js.map} +0 -0
- package/dist/{esm/types.js → types.js} +0 -0
- package/dist/types.js.map +7 -0
- package/dist/{esm/views → views}/Animated.js +0 -0
- package/dist/{esm/views → views}/Animated.js.map +3 -3
- package/dist/{esm/views → views}/Stack.js +1 -1
- package/dist/views/Stack.js.map +7 -0
- package/dist/views/Text.js +36 -0
- package/dist/views/Text.js.map +7 -0
- package/dist/views/TextAncestorContext.js +18 -0
- package/dist/views/TextAncestorContext.js.map +7 -0
- package/dist/{esm/views → views}/Theme.js +23 -29
- package/dist/views/Theme.js.map +7 -0
- package/dist/{esm/views → views}/ThemeContext.js +0 -0
- package/dist/{esm/views → views}/ThemeContext.js.map +1 -1
- package/dist/{esm/views → views}/ThemeInverse.js +1 -0
- package/dist/{esm/views → views}/ThemeInverse.js.map +3 -3
- package/dist/{esm/views → views}/ThemeManagerContext.js +6 -13
- package/dist/views/ThemeManagerContext.js.map +7 -0
- package/dist/{esm/views → views}/ThemeProvider.js +10 -10
- package/dist/views/ThemeProvider.js.map +7 -0
- package/package.json +6 -9
- package/dist/cjs/constants/constants.js +0 -50
- package/dist/cjs/constants/constants.js.map +0 -7
- package/dist/cjs/constants/platform.js +0 -43
- package/dist/cjs/constants/platform.js.map +0 -7
- package/dist/cjs/constants/pseudos.js +0 -25
- package/dist/cjs/constants/pseudos.js.map +0 -7
- package/dist/cjs/constants/rnw.js +0 -28
- package/dist/cjs/constants/rnw.js.map +0 -7
- package/dist/cjs/createComponent.js +0 -529
- package/dist/cjs/createComponent.js.map +0 -7
- package/dist/cjs/createFont.js +0 -50
- package/dist/cjs/createFont.js.map +0 -7
- package/dist/cjs/createShorthands.js +0 -16
- package/dist/cjs/createShorthands.js.map +0 -7
- package/dist/cjs/createTamagui.js +0 -223
- package/dist/cjs/createTamagui.js.map +0 -7
- package/dist/cjs/createTheme.js +0 -13
- package/dist/cjs/createTheme.js.map +0 -7
- package/dist/cjs/createTokens.js +0 -55
- package/dist/cjs/createTokens.js.map +0 -7
- package/dist/cjs/createVariable.js +0 -47
- package/dist/cjs/createVariable.js.map +0 -7
- package/dist/cjs/helpers/addStylesUsingClassname.js +0 -79
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/cjs/helpers/createMediaStyle.js +0 -56
- package/dist/cjs/helpers/createMediaStyle.js.map +0 -7
- package/dist/cjs/helpers/createPropMapper.js +0 -197
- package/dist/cjs/helpers/createPropMapper.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js +0 -74
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/extendStaticConfig.js +0 -82
- package/dist/cjs/helpers/extendStaticConfig.js.map +0 -7
- package/dist/cjs/helpers/fixNativeShadow.js +0 -14
- package/dist/cjs/helpers/fixNativeShadow.js.map +0 -7
- package/dist/cjs/helpers/fixNativeShadow.native.js +0 -40
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/cjs/helpers/getSplitStyles.js +0 -180
- package/dist/cjs/helpers/getSplitStyles.js.map +0 -7
- package/dist/cjs/helpers/getStylesAtomic.js +0 -117
- package/dist/cjs/helpers/getStylesAtomic.js.map +0 -7
- package/dist/cjs/helpers/getStylesAtomic.native.js +0 -16
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +0 -7
- package/dist/cjs/helpers/insertStyleRule.js +0 -46
- package/dist/cjs/helpers/insertStyleRule.js.map +0 -7
- package/dist/cjs/helpers/isObj.js +0 -13
- package/dist/cjs/helpers/isObj.js.map +0 -7
- package/dist/cjs/helpers/isTamaguiElement.js +0 -33
- package/dist/cjs/helpers/isTamaguiElement.js.map +0 -7
- package/dist/cjs/helpers/matchMedia.js +0 -24
- package/dist/cjs/helpers/matchMedia.js.map +0 -7
- package/dist/cjs/helpers/matchMedia.native.js +0 -31
- package/dist/cjs/helpers/matchMedia.native.js.map +0 -7
- package/dist/cjs/helpers/themeable.js +0 -78
- package/dist/cjs/helpers/themeable.js.map +0 -7
- package/dist/cjs/helpers/validate.js +0 -82
- package/dist/cjs/helpers/validate.js.map +0 -7
- package/dist/cjs/hooks/useConstant.js +0 -37
- package/dist/cjs/hooks/useConstant.js.map +0 -7
- package/dist/cjs/hooks/useFeatures.js +0 -100
- package/dist/cjs/hooks/useFeatures.js.map +0 -7
- package/dist/cjs/hooks/useMedia.js +0 -207
- package/dist/cjs/hooks/useMedia.js.map +0 -7
- package/dist/cjs/hooks/usePressable.js +0 -50
- package/dist/cjs/hooks/usePressable.js.map +0 -7
- package/dist/cjs/hooks/useTheme.js +0 -118
- package/dist/cjs/hooks/useTheme.js.map +0 -7
- package/dist/cjs/index.js +0 -55
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/static/postProcessStyles.js +0 -40
- package/dist/cjs/static/postProcessStyles.js.map +0 -7
- package/dist/cjs/static.js +0 -34
- package/dist/cjs/static.js.map +0 -7
- package/dist/cjs/styled.js +0 -72
- package/dist/cjs/styled.js.map +0 -7
- package/dist/cjs/types.js +0 -4
- package/dist/cjs/types.js.map +0 -7
- package/dist/cjs/views/Animated.js +0 -129
- package/dist/cjs/views/Animated.js.map +0 -7
- package/dist/cjs/views/Stack.js +0 -51
- package/dist/cjs/views/Stack.js.map +0 -7
- package/dist/cjs/views/Text.js +0 -93
- package/dist/cjs/views/Text.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js +0 -40
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/cjs/views/Theme.js +0 -91
- package/dist/cjs/views/Theme.js.map +0 -7
- package/dist/cjs/views/ThemeContext.js +0 -29
- package/dist/cjs/views/ThemeContext.js.map +0 -7
- package/dist/cjs/views/ThemeInverse.js +0 -48
- package/dist/cjs/views/ThemeInverse.js.map +0 -7
- package/dist/cjs/views/ThemeManagerContext.js +0 -84
- package/dist/cjs/views/ThemeManagerContext.js.map +0 -7
- package/dist/cjs/views/ThemeProvider.js +0 -67
- package/dist/cjs/views/ThemeProvider.js.map +0 -7
- package/dist/esm/constants/constants.js +0 -14
- package/dist/esm/constants/constants.js.map +0 -7
- package/dist/esm/constants/platform.js.map +0 -7
- package/dist/esm/constants/pseudos.js +0 -18
- package/dist/esm/constants/pseudos.js.map +0 -7
- package/dist/esm/constants/rnw.js +0 -22
- package/dist/esm/constants/rnw.js.map +0 -7
- package/dist/esm/createComponent.js +0 -465
- package/dist/esm/createComponent.js.map +0 -7
- package/dist/esm/createFont.js +0 -28
- package/dist/esm/createFont.js.map +0 -7
- package/dist/esm/createShorthands.js.map +0 -7
- package/dist/esm/createTamagui.js +0 -185
- package/dist/esm/createTamagui.js.map +0 -7
- package/dist/esm/createTheme.js +0 -7
- package/dist/esm/createTheme.js.map +0 -7
- package/dist/esm/createTokens.js.map +0 -7
- package/dist/esm/createVariable.js.map +0 -7
- package/dist/esm/helpers/addStylesUsingClassname.js +0 -57
- package/dist/esm/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/esm/helpers/createPropMapper.js +0 -162
- package/dist/esm/helpers/createPropMapper.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/extendStaticConfig.js +0 -60
- package/dist/esm/helpers/extendStaticConfig.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.js +0 -8
- package/dist/esm/helpers/fixNativeShadow.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.native.js +0 -34
- package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/esm/helpers/getSplitStyles.js.map +0 -7
- package/dist/esm/helpers/getStylesAtomic.js +0 -84
- package/dist/esm/helpers/getStylesAtomic.js.map +0 -7
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -10
- package/dist/esm/helpers/getStylesAtomic.native.js.map +0 -7
- package/dist/esm/helpers/insertStyleRule.js.map +0 -7
- package/dist/esm/helpers/isObj.js +0 -7
- package/dist/esm/helpers/isObj.js.map +0 -7
- package/dist/esm/helpers/isTamaguiElement.js +0 -11
- package/dist/esm/helpers/isTamaguiElement.js.map +0 -7
- package/dist/esm/helpers/matchMedia.js.map +0 -7
- package/dist/esm/helpers/validate.js +0 -60
- package/dist/esm/helpers/validate.js.map +0 -7
- package/dist/esm/hooks/useFeatures.js.map +0 -7
- package/dist/esm/hooks/useMedia.js.map +0 -7
- package/dist/esm/hooks/useTheme.js.map +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/static/postProcessStyles.js.map +0 -7
- package/dist/esm/static.js.map +0 -7
- package/dist/esm/styled.js +0 -21
- package/dist/esm/styled.js.map +0 -7
- package/dist/esm/views/Stack.js.map +0 -7
- package/dist/esm/views/Text.js +0 -60
- package/dist/esm/views/Text.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -18
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/views/Theme.js.map +0 -7
- package/dist/esm/views/ThemeManagerContext.js.map +0 -7
- package/dist/esm/views/ThemeProvider.js.map +0 -7
- package/dist/jsx/constants/constants.js +0 -13
- package/dist/jsx/constants/platform.js +0 -19
- package/dist/jsx/constants/pseudos.js +0 -17
- package/dist/jsx/constants/rnw.js +0 -21
- package/dist/jsx/createComponent.js +0 -459
- package/dist/jsx/createFont.js +0 -27
- package/dist/jsx/createShorthands.js +0 -9
- package/dist/jsx/createTamagui.js +0 -184
- package/dist/jsx/createTheme.js +0 -6
- package/dist/jsx/createTokens.js +0 -32
- package/dist/jsx/createVariable.js +0 -24
- package/dist/jsx/helpers/addStylesUsingClassname.js +0 -56
- package/dist/jsx/helpers/createMediaStyle.js +0 -33
- package/dist/jsx/helpers/createPropMapper.js +0 -161
- package/dist/jsx/helpers/createTamaguiProvider.js +0 -19
- package/dist/jsx/helpers/extendStaticConfig.js +0 -59
- package/dist/jsx/helpers/fixNativeShadow.js +0 -7
- package/dist/jsx/helpers/fixNativeShadow.native.js +0 -33
- package/dist/jsx/helpers/getSplitStyles.js +0 -149
- package/dist/jsx/helpers/getStylesAtomic.js +0 -83
- package/dist/jsx/helpers/getStylesAtomic.native.js +0 -9
- package/dist/jsx/helpers/insertStyleRule.js +0 -23
- package/dist/jsx/helpers/isObj.js +0 -6
- package/dist/jsx/helpers/isTamaguiElement.js +0 -10
- package/dist/jsx/helpers/matchMedia.js +0 -17
- package/dist/jsx/helpers/matchMedia.native.js +0 -8
- package/dist/jsx/helpers/themeable.js +0 -23
- package/dist/jsx/helpers/validate.js +0 -59
- package/dist/jsx/hooks/useConstant.js +0 -14
- package/dist/jsx/hooks/useFeatures.js +0 -57
- package/dist/jsx/hooks/useMedia.js +0 -174
- package/dist/jsx/hooks/usePressable.js +0 -13
- package/dist/jsx/hooks/useTheme.js +0 -96
- package/dist/jsx/index.js +0 -31
- package/dist/jsx/static/postProcessStyles.js +0 -17
- package/dist/jsx/static.js +0 -14
- package/dist/jsx/styled.js +0 -20
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Animated.js +0 -74
- package/dist/jsx/views/Stack.js +0 -11
- package/dist/jsx/views/Text.js +0 -59
- package/dist/jsx/views/TextAncestorContext.js +0 -15
- package/dist/jsx/views/Theme.js +0 -63
- package/dist/jsx/views/ThemeContext.js +0 -5
- package/dist/jsx/views/ThemeInverse.js +0 -22
- package/dist/jsx/views/ThemeManagerContext.js +0 -61
- package/dist/jsx/views/ThemeProvider.js +0 -39
- package/types/constants/constants.d.ts.map +0 -1
- package/types/constants/platform.d.ts.map +0 -1
- package/types/constants/pseudos.d.ts.map +0 -1
- package/types/constants/rnw.d.ts.map +0 -1
- package/types/createComponent.d.ts.map +0 -1
- package/types/createFont.d.ts.map +0 -1
- package/types/createShorthands.d.ts.map +0 -1
- package/types/createTamagui.d.ts.map +0 -1
- package/types/createTheme.d.ts.map +0 -1
- package/types/createTokens.d.ts.map +0 -1
- package/types/createVariable.d.ts.map +0 -1
- package/types/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +0 -1
- package/types/helpers/createPropMapper.d.ts.map +0 -1
- package/types/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/types/helpers/extendStaticConfig.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/types/helpers/getSplitStyles.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/types/helpers/insertStyleRule.d.ts.map +0 -1
- package/types/helpers/isObj.d.ts.map +0 -1
- package/types/helpers/isTamaguiElement.d.ts.map +0 -1
- package/types/helpers/matchMedia.d.ts.map +0 -1
- package/types/helpers/matchMedia.native.d.ts.map +0 -1
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/helpers/validate.d.ts.map +0 -1
- package/types/hooks/useConstant.d.ts.map +0 -1
- package/types/hooks/useFeatures.d.ts.map +0 -1
- package/types/hooks/useMedia.d.ts.map +0 -1
- package/types/hooks/usePressable.d.ts.map +0 -1
- package/types/hooks/useTheme.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/static/postProcessStyles.d.ts.map +0 -1
- package/types/static.d.ts.map +0 -1
- package/types/styled.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- package/types/views/Animated.d.ts.map +0 -1
- package/types/views/Stack.d.ts.map +0 -1
- package/types/views/Text.d.ts.map +0 -1
- package/types/views/TextAncestorContext.d.ts.map +0 -1
- package/types/views/Theme.d.ts.map +0 -1
- package/types/views/ThemeContext.d.ts.map +0 -1
- package/types/views/ThemeInverse.d.ts.map +0 -1
- package/types/views/ThemeManagerContext.d.ts.map +0 -1
- package/types/views/ThemeProvider.d.ts.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { stylePropsTextOnly, validStyles } from "@tamagui/helpers";
|
|
2
|
+
import { isWeb } from "./platform";
|
|
3
|
+
const webOnlySpecificStyleKeys = {
|
|
4
|
+
userSelect: true,
|
|
5
|
+
textOverflow: true,
|
|
6
|
+
whiteSpace: true,
|
|
7
|
+
wordWrap: true,
|
|
8
|
+
selectable: true,
|
|
9
|
+
cursor: true
|
|
10
|
+
};
|
|
11
|
+
const validStylesText = {
|
|
12
|
+
...validStyles,
|
|
13
|
+
...stylePropsTextOnly,
|
|
14
|
+
...isWeb && {
|
|
15
|
+
...webOnlySpecificStyleKeys
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const stackDefaultStyles = {
|
|
19
|
+
alignItems: "stretch",
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
...isWeb && {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexBasis: "auto",
|
|
24
|
+
boxSizing: "border-box"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
stackDefaultStyles,
|
|
29
|
+
validStylesText,
|
|
30
|
+
webOnlySpecificStyleKeys
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/constants.ts"],
|
|
4
|
+
"sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\n\nimport { isWeb } from './platform'\n\nexport const webOnlySpecificStyleKeys = {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n}\n\nexport const validStylesText = {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n ...webOnlySpecificStyleKeys,\n }),\n}\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n // more accurately match react-native defaults on web\n ...(isWeb && {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n }),\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AAEO,MAAM,2BAA2B;AAAA,EACtC,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA;AAGH,MAAM,kBAAkB;AAAA,KAC1B;AAAA,KACA;AAAA,KACC,SAAS;AAAA,OACR;AAAA;AAAA;AAIA,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,KAER,SAAS;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { useEffect, useLayoutEffect } from "react";
|
|
3
2
|
import { Platform } from "react-native";
|
|
4
|
-
const isWeb = process.env.
|
|
3
|
+
const isWeb = process.env.TARGET !== "native" || Platform.OS === "web";
|
|
5
4
|
const isSSR = isWeb && typeof window === "undefined";
|
|
6
5
|
const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
6
|
+
const isWebIOS = isWeb && typeof window !== "undefined" && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window["MSStream"];
|
|
7
7
|
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
8
8
|
const supportsTouchWeb = typeof window !== "undefined" && "ontouchstart" in window;
|
|
9
9
|
const isTouchDevice = !isWeb || supportsTouchWeb;
|
|
10
|
-
const isWebIOS = isWeb && typeof navigator !== "undefined" && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window["MSStream"];
|
|
11
10
|
export {
|
|
12
11
|
isChrome,
|
|
13
12
|
isSSR,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/platform.ts"],
|
|
4
|
+
"sourcesContent": ["// dont import things (why?)\n\nimport { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isWeb = process.env.TARGET !== 'native' || Platform.OS === 'web'\nexport const isSSR = isWeb && typeof window === 'undefined'\n\nexport const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect\n\nexport const isWebIOS =\n isWeb &&\n typeof window !== 'undefined' &&\n (/iPad|iPhone|iPod/.test(navigator.platform) ||\n (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&\n !window['MSStream']\n\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\n\nexport const supportsTouchWeb = typeof window !== 'undefined' && 'ontouchstart' in window\nexport const isTouchDevice = !isWeb || supportsTouchWeb\n"],
|
|
5
|
+
"mappings": "AAEA;AACA;AAEO,MAAM,QAAQ,QAAQ,IAAI,WAAW,YAAY,SAAS,OAAO;AACjE,MAAM,QAAQ,SAAS,OAAO,WAAW;AAEzC,MAAM,4BAA4B,QAAQ,YAAY;AAEtD,MAAM,WACX,SACA,OAAO,WAAW,eACjB,oBAAmB,KAAK,UAAU,aAChC,UAAU,aAAa,cAAc,UAAU,iBAAiB,MACnE,CAAC,OAAO;AAEH,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa;AAE1F,MAAM,mBAAmB,OAAO,WAAW,eAAe,kBAAkB;AAC5E,MAAM,gBAAgB,CAAC,SAAS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { isWeb } from "./platform";
|
|
4
|
+
const loadRNW = process.env.IS_STATIC !== "is_static" && isWeb;
|
|
5
|
+
const interopRequire = /* @__PURE__ */ __name((src) => "default" in src ? src.default : src, "interopRequire");
|
|
6
|
+
const rnw = loadRNW ? interopRequire(require("react-native-web").TamaguiExports) : null;
|
|
7
|
+
export {
|
|
8
|
+
rnw
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=rnw.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/rnw.tsx"],
|
|
4
|
+
"sourcesContent": ["import { isWeb } from './platform'\n\nconst loadRNW = process.env.IS_STATIC !== 'is_static' && isWeb\n\nconst interopRequire = (src: any) => ('default' in src ? src.default : src)\n\nexport const rnw: any | null = loadRNW ? interopRequire(require('react-native-web').TamaguiExports) : null\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAEA,MAAM,UAAU,QAAQ,IAAI,cAAc,eAAe;AAEzD,MAAM,iBAAiB,wBAAC,QAAc,aAAa,MAAM,IAAI,UAAU,KAAhD;AAEhB,MAAM,MAAkB,UAAU,eAAe,QAAQ,oBAAoB,kBAAkB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { isWeb } from "./platform";
|
|
3
|
+
import { rnw } from "./rnw";
|
|
4
|
+
const cssTextStyles = {
|
|
5
|
+
text: {
|
|
6
|
+
display: isWeb ? "inline" : "flex",
|
|
7
|
+
boxSizing: "border-box",
|
|
8
|
+
fontFamily: "System",
|
|
9
|
+
whiteSpace: "pre-wrap",
|
|
10
|
+
wordWrap: "break-word"
|
|
11
|
+
},
|
|
12
|
+
textHasAncestor: {
|
|
13
|
+
color: "inherit",
|
|
14
|
+
font: "inherit",
|
|
15
|
+
whiteSpace: "inherit"
|
|
16
|
+
},
|
|
17
|
+
textOneLine: {
|
|
18
|
+
maxWidth: "100%",
|
|
19
|
+
overflow: "hidden",
|
|
20
|
+
textOverflow: "ellipsis",
|
|
21
|
+
whiteSpace: "nowrap"
|
|
22
|
+
},
|
|
23
|
+
textMultiLine: {
|
|
24
|
+
display: "-webkit-box",
|
|
25
|
+
maxWidth: "100%",
|
|
26
|
+
overflow: "hidden",
|
|
27
|
+
textOverflow: "ellipsis",
|
|
28
|
+
WebkitBoxOrient: "vertical"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const cssText = isWeb ? rnw?.css.create(cssTextStyles) : {};
|
|
32
|
+
const disabledStyle = {
|
|
33
|
+
pointerEvents: "none",
|
|
34
|
+
userSelect: "none"
|
|
35
|
+
};
|
|
36
|
+
const viewStyles = StyleSheet.create({
|
|
37
|
+
inline: isWeb ? {
|
|
38
|
+
display: "inline-flex"
|
|
39
|
+
} : {}
|
|
40
|
+
});
|
|
41
|
+
const textStyles = isWeb ? StyleSheet.create({
|
|
42
|
+
notSelectable: {
|
|
43
|
+
userSelect: "none"
|
|
44
|
+
},
|
|
45
|
+
selectable: {
|
|
46
|
+
userSelect: "text"
|
|
47
|
+
},
|
|
48
|
+
pressable: {
|
|
49
|
+
cursor: "pointer"
|
|
50
|
+
}
|
|
51
|
+
}) : {};
|
|
52
|
+
export {
|
|
53
|
+
cssText,
|
|
54
|
+
cssTextStyles,
|
|
55
|
+
disabledStyle,
|
|
56
|
+
textStyles,
|
|
57
|
+
viewStyles
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=styleConstants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/styleConstants.tsx"],
|
|
4
|
+
"sourcesContent": ["import { StyleSheet } from 'react-native'\n\nimport { isWeb } from './platform'\nimport { rnw } from './rnw'\n\nexport const cssTextStyles = {\n text: {\n display: isWeb ? 'inline' : 'flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n },\n textHasAncestor: {\n color: 'inherit',\n font: 'inherit',\n whiteSpace: 'inherit',\n },\n textOneLine: {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n textMultiLine: {\n display: '-webkit-box',\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n },\n}\n\nexport const cssText = isWeb ? rnw?.css.create(cssTextStyles) : {}\n\nexport const disabledStyle = {\n pointerEvents: 'none',\n userSelect: 'none',\n} as const\n\nexport const viewStyles = StyleSheet.create({\n inline: isWeb\n ? {\n display: 'inline-flex' as any,\n }\n : {},\n})\n\nexport const textStyles = isWeb\n ? StyleSheet.create({\n notSelectable: {\n // @ts-ignore\n userSelect: 'none',\n },\n selectable: {\n // @ts-ignore\n userSelect: 'text',\n },\n pressable: {\n // @ts-ignore\n cursor: 'pointer',\n },\n })\n : {}\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AACA;AAEO,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,IACJ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,EAEZ,iBAAiB;AAAA,IACf,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA;AAAA,EAEd,aAAa;AAAA,IACX,UAAU;AAAA,IACV,UAAU;AAAA,IACV,cAAc;AAAA,IACd,YAAY;AAAA;AAAA,EAEd,eAAe;AAAA,IACb,SAAS;AAAA,IACT,UAAU;AAAA,IACV,UAAU;AAAA,IACV,cAAc;AAAA,IACd,iBAAiB;AAAA;AAAA;AAId,MAAM,UAAU,QAAQ,KAAK,IAAI,OAAO,iBAAiB;AAEzD,MAAM,gBAAgB;AAAA,EAC3B,eAAe;AAAA,EACf,YAAY;AAAA;AAGP,MAAM,aAAa,WAAW,OAAO;AAAA,EAC1C,QAAQ,QACJ;AAAA,IACE,SAAS;AAAA,MAEX;AAAA;AAGC,MAAM,aAAa,QACtB,WAAW,OAAO;AAAA,EAChB,eAAe;AAAA,IAEb,YAAY;AAAA;AAAA,EAEd,YAAY;AAAA,IAEV,YAAY;AAAA;AAAA,EAEd,WAAW;AAAA,IAET,QAAQ;AAAA;AAAA,KAGZ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { concatClassName, stylePropsView } from "@tamagui/helpers";
|
|
4
|
+
import React, {
|
|
5
|
+
Children,
|
|
6
|
+
Fragment,
|
|
7
|
+
createElement,
|
|
8
|
+
forwardRef,
|
|
9
|
+
useCallback,
|
|
10
|
+
useContext,
|
|
11
|
+
useEffect,
|
|
12
|
+
useRef,
|
|
13
|
+
useState
|
|
14
|
+
} from "react";
|
|
15
|
+
import { View } from "react-native";
|
|
16
|
+
import { stackDefaultStyles } from "./constants/constants";
|
|
17
|
+
import { isTouchDevice, isWeb } from "./constants/platform";
|
|
18
|
+
import { rnw } from "./constants/rnw";
|
|
19
|
+
import { cssText, disabledStyle, textStyles, viewStyles } from "./constants/styleConstants";
|
|
20
|
+
import { onConfiguredOnce } from "./createTamagui";
|
|
21
|
+
import { addStylesUsingClassname } from "./helpers/addStylesUsingClassname";
|
|
22
|
+
import { parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
23
|
+
import { getSplitStyles } from "./helpers/getSplitStyles";
|
|
24
|
+
import { setIfChanged } from "./helpers/setIfChanged";
|
|
25
|
+
import { useFeatures } from "./hooks/useFeatures";
|
|
26
|
+
import { useForceUpdate } from "./hooks/useForceUpdate";
|
|
27
|
+
import { usePressable } from "./hooks/usePressable";
|
|
28
|
+
import { TextAncestorContext } from "./views/TextAncestorContext";
|
|
29
|
+
import { ThemeManagerContext } from "./views/ThemeManagerContext";
|
|
30
|
+
const mouseUps = new Set();
|
|
31
|
+
if (typeof document !== "undefined") {
|
|
32
|
+
document.addEventListener("mouseup", () => {
|
|
33
|
+
mouseUps.forEach((x) => x());
|
|
34
|
+
mouseUps.clear();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function createComponent(configIn) {
|
|
38
|
+
let staticConfig;
|
|
39
|
+
if ("parsed" in configIn) {
|
|
40
|
+
staticConfig = configIn;
|
|
41
|
+
} else {
|
|
42
|
+
staticConfig = parseStaticConfig(configIn);
|
|
43
|
+
}
|
|
44
|
+
const { defaultProps, Component, validStyles, isText } = staticConfig;
|
|
45
|
+
const validStyleProps = validStyles ?? stylePropsView;
|
|
46
|
+
let splitDefaults;
|
|
47
|
+
let tamaguiConfig;
|
|
48
|
+
let defaultsClassName = "";
|
|
49
|
+
onConfiguredOnce((conf) => {
|
|
50
|
+
tamaguiConfig = conf;
|
|
51
|
+
splitDefaults = getSplitStyles(defaultProps, staticConfig, conf);
|
|
52
|
+
if (splitDefaults.classNames) {
|
|
53
|
+
defaultsClassName += splitDefaults.classNames + " ";
|
|
54
|
+
}
|
|
55
|
+
if (splitDefaults.style) {
|
|
56
|
+
defaultsClassName += addStylesUsingClassname([splitDefaults.style]);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const component = forwardRef((props, forwardedRef) => {
|
|
60
|
+
const {
|
|
61
|
+
tag,
|
|
62
|
+
hitSlop,
|
|
63
|
+
children,
|
|
64
|
+
pointerEvents,
|
|
65
|
+
onPress,
|
|
66
|
+
onPressIn,
|
|
67
|
+
onPressOut,
|
|
68
|
+
onHoverIn,
|
|
69
|
+
onHoverOut,
|
|
70
|
+
spacing,
|
|
71
|
+
disabled,
|
|
72
|
+
onMouseEnter,
|
|
73
|
+
onMouseLeave,
|
|
74
|
+
hrefAttrs,
|
|
75
|
+
onMoveShouldSetResponder,
|
|
76
|
+
onMoveShouldSetResponderCapture,
|
|
77
|
+
onResponderEnd,
|
|
78
|
+
onResponderGrant,
|
|
79
|
+
onResponderMove,
|
|
80
|
+
onResponderReject,
|
|
81
|
+
onResponderRelease,
|
|
82
|
+
onResponderStart,
|
|
83
|
+
onResponderTerminate,
|
|
84
|
+
onResponderTerminationRequest,
|
|
85
|
+
onScrollShouldSetResponder,
|
|
86
|
+
onScrollShouldSetResponderCapture,
|
|
87
|
+
onSelectionChangeShouldSetResponder,
|
|
88
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
89
|
+
onStartShouldSetResponder,
|
|
90
|
+
onStartShouldSetResponderCapture,
|
|
91
|
+
onMouseDown,
|
|
92
|
+
onClick,
|
|
93
|
+
onLayout
|
|
94
|
+
} = props;
|
|
95
|
+
const forceUpdate = useForceUpdate();
|
|
96
|
+
const features = useFeatures(props, { forceUpdate });
|
|
97
|
+
const manager = useContext(ThemeManagerContext);
|
|
98
|
+
const [state, set_] = useState(() => ({
|
|
99
|
+
hover: false,
|
|
100
|
+
press: false,
|
|
101
|
+
pressIn: false,
|
|
102
|
+
theme: manager.name
|
|
103
|
+
}));
|
|
104
|
+
const set = setIfChanged.bind(null, set_);
|
|
105
|
+
if (process.env.NODE_ENV !== "production" && !isText && isWeb) {
|
|
106
|
+
Children.toArray(props.children).forEach((item) => {
|
|
107
|
+
if (typeof item === "string") {
|
|
108
|
+
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const hasTextAncestor = useContext(TextAncestorContext);
|
|
113
|
+
const hostRef = useRef(null);
|
|
114
|
+
if (isWeb) {
|
|
115
|
+
rnw.useResponderEvents(hostRef, {
|
|
116
|
+
onMoveShouldSetResponder,
|
|
117
|
+
onMoveShouldSetResponderCapture,
|
|
118
|
+
onResponderEnd,
|
|
119
|
+
onResponderGrant,
|
|
120
|
+
onResponderMove,
|
|
121
|
+
onResponderReject,
|
|
122
|
+
onResponderRelease,
|
|
123
|
+
onResponderStart,
|
|
124
|
+
onResponderTerminate,
|
|
125
|
+
onResponderTerminationRequest,
|
|
126
|
+
onScrollShouldSetResponder,
|
|
127
|
+
onScrollShouldSetResponderCapture,
|
|
128
|
+
onSelectionChangeShouldSetResponder,
|
|
129
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
130
|
+
onStartShouldSetResponder,
|
|
131
|
+
onStartShouldSetResponderCapture
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const isTracking = useRef(false);
|
|
135
|
+
const { viewProps, psuedos, style, classNames } = getSplitStyles(props, staticConfig, tamaguiConfig);
|
|
136
|
+
const internal = useRef();
|
|
137
|
+
if (!internal.current) {
|
|
138
|
+
internal.current = {
|
|
139
|
+
isMounted: true
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
internal.current.isMounted = true;
|
|
144
|
+
const dispose = manager?.onChangeTheme((name) => {
|
|
145
|
+
if (isTracking.current) {
|
|
146
|
+
set({ theme: name });
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return () => {
|
|
150
|
+
dispose();
|
|
151
|
+
mouseUps.delete(unPress);
|
|
152
|
+
isTracking.current = false;
|
|
153
|
+
internal.current.isMounted = false;
|
|
154
|
+
};
|
|
155
|
+
}, [manager]);
|
|
156
|
+
const element = isWeb ? !Component || typeof Component === "string" ? tag || Component : Component : Component;
|
|
157
|
+
const ReactView = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
|
|
158
|
+
const ReactText = !isWeb ? Text : element || "span";
|
|
159
|
+
const ViewComponent = isText ? ReactText : ReactView;
|
|
160
|
+
const numberOfLines = props["numberOfLines"];
|
|
161
|
+
const selectable = props["selectable"];
|
|
162
|
+
const styles = [
|
|
163
|
+
hasTextAncestor ? viewStyles.inline : null,
|
|
164
|
+
...isWeb && isText ? [
|
|
165
|
+
numberOfLines != null && numberOfLines > 1 && { WebkitLineClamp: numberOfLines },
|
|
166
|
+
selectable === true && textStyles.selectable,
|
|
167
|
+
selectable === false && textStyles.notSelectable,
|
|
168
|
+
onPress && textStyles.pressable
|
|
169
|
+
] : [],
|
|
170
|
+
style,
|
|
171
|
+
!isTouchDevice && !disabled && psuedos && state.hover ? psuedos.hoverStyle || null : null,
|
|
172
|
+
!disabled && psuedos && state.press ? psuedos.pressStyle || null : null,
|
|
173
|
+
disabled ? disabledStyle : null
|
|
174
|
+
];
|
|
175
|
+
const stylesClassNames = addStylesUsingClassname(styles);
|
|
176
|
+
const classList = staticConfig.isText ? [
|
|
177
|
+
defaultsClassName,
|
|
178
|
+
hasTextAncestor === true && cssText.textHasAncestor,
|
|
179
|
+
numberOfLines === 1 && cssText.textOneLine,
|
|
180
|
+
numberOfLines != null && numberOfLines > 1 && cssText.textMultiLine,
|
|
181
|
+
props.className,
|
|
182
|
+
classNames,
|
|
183
|
+
stylesClassNames
|
|
184
|
+
] : [defaultsClassName, props.className, classNames, stylesClassNames];
|
|
185
|
+
const supportedProps = viewProps;
|
|
186
|
+
if (isWeb) {
|
|
187
|
+
const classListFlat = classList.flat().filter(Boolean).join(" ");
|
|
188
|
+
const className = concatClassName(classListFlat);
|
|
189
|
+
if (process.env.NODE_ENV === "development") {
|
|
190
|
+
if (props["debug"]) {
|
|
191
|
+
console.log("className", { styles, stylesClassNames, classList, classListFlat, className });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
supportedProps.className = className;
|
|
195
|
+
} else {
|
|
196
|
+
supportedProps.style = classList;
|
|
197
|
+
}
|
|
198
|
+
if (pointerEvents) {
|
|
199
|
+
supportedProps.pointerEvents = pointerEvents;
|
|
200
|
+
}
|
|
201
|
+
if (isWeb) {
|
|
202
|
+
const platformMethodsRef = rnw.usePlatformMethods(supportedProps);
|
|
203
|
+
const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
|
|
204
|
+
supportedProps.ref = setRef;
|
|
205
|
+
if (props.href != null && hrefAttrs != null) {
|
|
206
|
+
const { download, rel, target } = hrefAttrs;
|
|
207
|
+
if (download != null) {
|
|
208
|
+
supportedProps.download = download;
|
|
209
|
+
}
|
|
210
|
+
if (rel != null) {
|
|
211
|
+
supportedProps.rel = rel;
|
|
212
|
+
}
|
|
213
|
+
if (typeof target === "string") {
|
|
214
|
+
supportedProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
if (forwardedRef) {
|
|
219
|
+
supportedProps.ref = forwardedRef;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const createEl = createElement;
|
|
223
|
+
const attachPress = !!(psuedos && psuedos.pressStyle || onPress || onPressOut || onPressIn);
|
|
224
|
+
const attachHover = isWeb && !isTouchDevice && !!(psuedos && psuedos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
225
|
+
const shouldAttach = internal.current.hasEverHadEvents || 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);
|
|
226
|
+
if (shouldAttach) {
|
|
227
|
+
internal.current.hasEverHadEvents = true;
|
|
228
|
+
}
|
|
229
|
+
const unPress = useCallback(() => {
|
|
230
|
+
if (!internal.current.isMounted)
|
|
231
|
+
return;
|
|
232
|
+
set({
|
|
233
|
+
press: false,
|
|
234
|
+
pressIn: false
|
|
235
|
+
});
|
|
236
|
+
}, []);
|
|
237
|
+
const events = shouldAttach ? {
|
|
238
|
+
...!isWeb && {
|
|
239
|
+
onPressOut: (e) => {
|
|
240
|
+
unPress();
|
|
241
|
+
onPressOut?.(e);
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
...isWeb && !isTouchDevice && {
|
|
245
|
+
onMouseEnter: attachHover || attachPress ? (e) => {
|
|
246
|
+
let next = {};
|
|
247
|
+
if (attachHover) {
|
|
248
|
+
next.hover = true;
|
|
249
|
+
}
|
|
250
|
+
if (state.pressIn) {
|
|
251
|
+
next.press = true;
|
|
252
|
+
}
|
|
253
|
+
if (Object.keys(next).length) {
|
|
254
|
+
set(next);
|
|
255
|
+
}
|
|
256
|
+
onHoverIn?.(e);
|
|
257
|
+
onMouseEnter?.(e);
|
|
258
|
+
} : void 0,
|
|
259
|
+
onMouseLeave: attachHover || attachPress ? (e) => {
|
|
260
|
+
let next = {};
|
|
261
|
+
mouseUps.add(unPress);
|
|
262
|
+
if (attachHover) {
|
|
263
|
+
next.hover = false;
|
|
264
|
+
}
|
|
265
|
+
if (state.pressIn) {
|
|
266
|
+
next.press = false;
|
|
267
|
+
next.pressIn = false;
|
|
268
|
+
}
|
|
269
|
+
if (Object.keys(next).length) {
|
|
270
|
+
set(next);
|
|
271
|
+
}
|
|
272
|
+
onHoverOut?.(e);
|
|
273
|
+
onMouseLeave?.(e);
|
|
274
|
+
} : void 0
|
|
275
|
+
},
|
|
276
|
+
onMouseDown: attachPress ? (e) => {
|
|
277
|
+
set({
|
|
278
|
+
press: true,
|
|
279
|
+
pressIn: true
|
|
280
|
+
});
|
|
281
|
+
onPressIn?.(e);
|
|
282
|
+
onMouseDown?.(e);
|
|
283
|
+
} : onPressIn,
|
|
284
|
+
onClick: attachPress ? (e) => {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
unPress();
|
|
287
|
+
onPressOut?.(e);
|
|
288
|
+
onPress?.(e);
|
|
289
|
+
onClick?.(e);
|
|
290
|
+
} : onPressOut
|
|
291
|
+
} : null;
|
|
292
|
+
if (events) {
|
|
293
|
+
if (typeof ViewComponent !== "string") {
|
|
294
|
+
const [pressProps] = usePressable({
|
|
295
|
+
disabled,
|
|
296
|
+
hitSlop,
|
|
297
|
+
onPressIn: events.onMouseDown,
|
|
298
|
+
onPressOut: events.onPressOut,
|
|
299
|
+
onPress
|
|
300
|
+
});
|
|
301
|
+
Object.assign(supportedProps, pressProps);
|
|
302
|
+
} else {
|
|
303
|
+
Object.assign(supportedProps, events);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
const spacedChildrenEl = spacedChildren({
|
|
307
|
+
children,
|
|
308
|
+
spacing,
|
|
309
|
+
flexDirection: props.flexDirection || defaultProps?.flexDirection
|
|
310
|
+
});
|
|
311
|
+
let content = createEl(ViewComponent, supportedProps, spacedChildrenEl);
|
|
312
|
+
const shouldWrapTextAncestor = isWeb && staticConfig.isText && !hasTextAncestor;
|
|
313
|
+
if (shouldWrapTextAncestor) {
|
|
314
|
+
content = createElement(TextAncestorContext.Provider, { value: true }, content);
|
|
315
|
+
}
|
|
316
|
+
if (process.env.NODE_ENV === "development") {
|
|
317
|
+
if (props["debug"]) {
|
|
318
|
+
supportedProps["debug"] = true;
|
|
319
|
+
console.log(" \u{1F351} props in: ", props);
|
|
320
|
+
console.log(" \u{1F351} props out: ", supportedProps);
|
|
321
|
+
console.log(" \u{1F351} other: ", { ViewComponent, viewProps, styles, psuedos, createEl, content, spacedChildrenEl, staticConfig, splitDefaults, tamaguiConfig });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, features, content);
|
|
325
|
+
});
|
|
326
|
+
const config = {
|
|
327
|
+
validStyles: validStyleProps,
|
|
328
|
+
...staticConfig,
|
|
329
|
+
validPropsExtra: {
|
|
330
|
+
...staticConfig.validPropsExtra,
|
|
331
|
+
disabled: true,
|
|
332
|
+
fullscreen: true
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
component["staticConfig"] = config;
|
|
336
|
+
return component;
|
|
337
|
+
}
|
|
338
|
+
__name(createComponent, "createComponent");
|
|
339
|
+
const Spacer = createComponent({
|
|
340
|
+
defaultProps: stackDefaultStyles,
|
|
341
|
+
variants: {
|
|
342
|
+
size: {
|
|
343
|
+
"...size": (size, { tokens }) => {
|
|
344
|
+
return {
|
|
345
|
+
width: tokens.size[size] ?? size,
|
|
346
|
+
height: tokens.size[size] ?? size
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
direction: {
|
|
351
|
+
horizontal: {
|
|
352
|
+
height: 0
|
|
353
|
+
},
|
|
354
|
+
vertical: {
|
|
355
|
+
width: 0
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
function spacedChildren({
|
|
361
|
+
children,
|
|
362
|
+
spacing,
|
|
363
|
+
flexDirection
|
|
364
|
+
}) {
|
|
365
|
+
if (!spacing) {
|
|
366
|
+
return children;
|
|
367
|
+
}
|
|
368
|
+
const next = [];
|
|
369
|
+
const childrenList = Children.toArray(children);
|
|
370
|
+
const len = childrenList.length;
|
|
371
|
+
if (len === 1) {
|
|
372
|
+
return children;
|
|
373
|
+
}
|
|
374
|
+
const spacer = /* @__PURE__ */ React.createElement(Spacer, {
|
|
375
|
+
direction: flexDirection === "row" || flexDirection === "row-reverse" ? "horizontal" : "vertical",
|
|
376
|
+
size: spacing
|
|
377
|
+
});
|
|
378
|
+
for (const [index, child] of childrenList.entries()) {
|
|
379
|
+
next.push(child);
|
|
380
|
+
if (index === len - 1) {
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
const key = `${child?.["key"] ?? index}`;
|
|
384
|
+
next.push(createElement(Fragment, { key: key + "_spacer" }, spacer));
|
|
385
|
+
}
|
|
386
|
+
return next;
|
|
387
|
+
}
|
|
388
|
+
__name(spacedChildren, "spacedChildren");
|
|
389
|
+
export {
|
|
390
|
+
Spacer,
|
|
391
|
+
createComponent,
|
|
392
|
+
mouseUps,
|
|
393
|
+
spacedChildren
|
|
394
|
+
};
|
|
395
|
+
//# sourceMappingURL=createComponent.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createComponent.tsx"],
|
|
4
|
+
"sourcesContent": ["import { concatClassName, stylePropsView } from '@tamagui/helpers'\nimport React, {\n Children,\n Fragment,\n createElement,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport { View, ViewStyle } from 'react-native'\n\nimport { stackDefaultStyles } from './constants/constants'\nimport { isTouchDevice, isWeb } from './constants/platform'\nimport { rnw } from './constants/rnw'\nimport { cssText, disabledStyle, textStyles, viewStyles } from './constants/styleConstants'\nimport { onConfiguredOnce } from './createTamagui'\nimport { addStylesUsingClassname } from './helpers/addStylesUsingClassname'\nimport { parseStaticConfig } from './helpers/extendStaticConfig'\nimport { SplitStyles, getSplitStyles } from './helpers/getSplitStyles'\nimport { setIfChanged } from './helpers/setIfChanged'\nimport { useFeatures } from './hooks/useFeatures'\nimport { useForceUpdate } from './hooks/useForceUpdate'\nimport { usePressable } from './hooks/usePressable'\nimport { StaticComponent, StaticConfig, StaticConfigParsed } from './types'\nimport { TextAncestorContext } from './views/TextAncestorContext'\nimport { ThemeManagerContext } from './views/ThemeManagerContext'\nimport { TamaguiInternalConfig } from '.'\n\nexport const mouseUps = new Set<Function>()\n\nif (typeof document !== 'undefined') {\n document.addEventListener('mouseup', () => {\n mouseUps.forEach((x) => x())\n mouseUps.clear()\n })\n}\n\ntype DefaultProps = {}\n\nexport function createComponent<A extends Object = DefaultProps>(\n configIn: Partial<StaticConfig> | StaticConfigParsed\n) {\n let staticConfig: StaticConfigParsed\n if ('parsed' in configIn) {\n staticConfig = configIn\n } else {\n staticConfig = parseStaticConfig(configIn)\n }\n\n const { defaultProps, Component, validStyles, isText } = staticConfig\n const validStyleProps = validStyles ?? stylePropsView\n\n // split out default styles vs props so we can assign it to component.defaultProps\n let splitDefaults: SplitStyles\n let tamaguiConfig: TamaguiInternalConfig\n let defaultsClassName = ''\n\n onConfiguredOnce((conf) => {\n tamaguiConfig = conf\n splitDefaults = getSplitStyles(defaultProps, staticConfig, conf)\n if (splitDefaults.classNames) {\n defaultsClassName += splitDefaults.classNames + ' '\n }\n if (splitDefaults.style) {\n defaultsClassName += addStylesUsingClassname([splitDefaults.style])\n }\n })\n\n const component = forwardRef<View, A>((props: any, forwardedRef) => {\n const {\n tag,\n hitSlop,\n children,\n pointerEvents,\n onPress,\n onPressIn,\n onPressOut,\n onHoverIn,\n onHoverOut,\n spacing,\n disabled,\n onMouseEnter,\n onMouseLeave,\n hrefAttrs,\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n onMouseDown,\n onClick,\n // TODO feature load layou hook\n onLayout,\n } = props\n\n const forceUpdate = useForceUpdate()\n const features = useFeatures(props, { forceUpdate })\n const manager = useContext(ThemeManagerContext)\n const [state, set_] = useState(() => ({\n hover: false,\n press: false,\n pressIn: false,\n theme: manager.name,\n }))\n const set = setIfChanged.bind(null, set_)\n\n // from react-native-web\n if (process.env.NODE_ENV !== 'production' && !isText && isWeb) {\n Children.toArray(props.children).forEach((item) => {\n if (typeof item === 'string') {\n console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`)\n }\n })\n }\n\n // from react-native-web\n const hasTextAncestor = useContext(TextAncestorContext)\n const hostRef = useRef(null)\n\n if (isWeb) {\n // from react-native-web\n rnw.useResponderEvents(hostRef, {\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n })\n }\n\n const isTracking = useRef(false)\n\n // TODO only handles tracking for re-renders i think now since conversion can be entirely done in splitprops\n // const varToVal = (value: string) => {\n // // TODO convert back to theme variable\n // isTracking.current = true\n // // TODO run over this, can likely remove\n // if (value && manager.theme && typeof manager.theme[value] !== 'undefined') {\n // return manager.theme[value]\n // }\n // return value\n // }\n\n const { viewProps, psuedos, style, classNames } = getSplitStyles(\n props,\n staticConfig,\n tamaguiConfig\n )\n\n // hasEverHadEvents prevents repareting if you remove onPress or similar...\n const internal = useRef<{ isMounted: boolean; hasEverHadEvents?: boolean }>()\n if (!internal.current) {\n internal.current = {\n isMounted: true,\n }\n }\n\n useEffect(() => {\n internal.current!.isMounted = true\n const dispose = manager?.onChangeTheme((name) => {\n if (isTracking.current) {\n set({ theme: name })\n }\n })\n return () => {\n dispose()\n mouseUps.delete(unPress)\n isTracking.current = false\n internal.current!.isMounted = false\n }\n }, [manager])\n\n // default to component\n const element = isWeb\n ? !Component || typeof Component === 'string'\n ? // default to tag, fallback to component (when both strings)\n tag || Component\n : Component\n : Component\n const ReactView = !isWeb ? View : element || (hasTextAncestor ? 'span' : 'div')\n const ReactText = !isWeb ? Text : element || 'span'\n // TODO handle onLayout\n const ViewComponent = isText ? ReactText : ReactView\n\n const numberOfLines = props['numberOfLines']\n const selectable = props['selectable']\n\n const styles = [\n hasTextAncestor ? viewStyles.inline : null,\n // from react-native-web\n ...(isWeb && isText\n ? [\n // TODO MOVE TO VARIANTS\n numberOfLines != null && numberOfLines > 1 && { WebkitLineClamp: numberOfLines },\n selectable === true && textStyles.selectable,\n selectable === false && textStyles.notSelectable,\n onPress && textStyles.pressable,\n ]\n : []),\n style,\n !isTouchDevice && !disabled && psuedos && state.hover ? psuedos.hoverStyle || null : null,\n !disabled && psuedos && state.press ? psuedos.pressStyle || null : null,\n disabled ? disabledStyle : null,\n ]\n\n const stylesClassNames = addStylesUsingClassname(styles)\n\n const classList = staticConfig.isText\n ? [\n defaultsClassName,\n // TODO MOVE TO VARIANTS\n hasTextAncestor === true && cssText.textHasAncestor,\n numberOfLines === 1 && cssText.textOneLine,\n numberOfLines != null && numberOfLines > 1 && cssText.textMultiLine,\n props.className,\n classNames,\n stylesClassNames,\n ]\n : [defaultsClassName, props.className, classNames, stylesClassNames]\n\n const supportedProps: any = viewProps //{ ...viewProps }\n\n if (isWeb) {\n const classListFlat = classList.flat().filter(Boolean).join(' ')\n const className = concatClassName(classListFlat)\n if (process.env.NODE_ENV === 'development') {\n if (props['debug']) {\n // prettier-ignore\n console.log('className', { styles, stylesClassNames, classList, classListFlat, className })\n }\n }\n supportedProps.className = className\n } else {\n // TODO\n supportedProps.style = classList\n }\n\n if (pointerEvents) {\n supportedProps.pointerEvents = pointerEvents\n }\n\n if (isWeb) {\n // from react-native-web\n const platformMethodsRef = rnw.usePlatformMethods(supportedProps)\n const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef)\n supportedProps.ref = setRef\n if (props.href != null && hrefAttrs != null) {\n const { download, rel, target } = hrefAttrs\n if (download != null) {\n supportedProps.download = download\n }\n if (rel != null) {\n supportedProps.rel = rel\n }\n if (typeof target === 'string') {\n supportedProps.target = target.charAt(0) !== '_' ? '_' + target : target\n }\n }\n } else {\n if (forwardedRef) {\n supportedProps.ref = forwardedRef\n }\n }\n\n const createEl = createElement //isWeb ? rnw.createElement : createElement\n\n //\n // TODO\n //\n // all these press events can be moved into a component that optionally renders if shouldAttach is true\n // and then calls back with props. this would do a few things:\n // 1. isolate logic for all pseudo press/hover stuff into one area more nicely\n // 2. a lot less hooks would be rendered on average\n // 3. should then let us use usePressability on web (should make ViewComponent a View if string)\n //\n //\n // see how framer motion does this:\n // https://github.com/framer/motion/blob/1d1eb5fd2bc712658a83a7881a3adb68ac56a242/src/motion/features/use-features.tsx#L16\n //\n\n const attachPress = !!((psuedos && psuedos.pressStyle) || onPress || onPressOut || onPressIn)\n const attachHover =\n isWeb &&\n !isTouchDevice &&\n !!((psuedos && psuedos.hoverStyle) || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave)\n\n // check presence to prevent reparenting bugs, allows for onPress={x ? function : undefined} usage\n // while avoiding reparenting...\n // once proper reparenting is supported, we can remove this and use that...\n const shouldAttach =\n internal.current.hasEverHadEvents ||\n attachPress ||\n attachHover ||\n 'pressStyle' in props ||\n 'onPress' in props ||\n 'onPressIn' in props ||\n 'onPressOut' in props ||\n (isWeb &&\n ('hoverStyle' in props ||\n 'onHoverIn' in props ||\n 'onHoverOut' in props ||\n 'onMouseEnter' in props ||\n 'onMouseLeave' in props))\n\n // never remove events as we wrap in a div (for now, may be able to remove..)\n if (shouldAttach) {\n internal.current.hasEverHadEvents = true\n }\n\n const unPress = useCallback(() => {\n if (!internal.current!.isMounted) return\n set({\n press: false,\n pressIn: false,\n })\n }, [])\n\n const events = shouldAttach\n ? {\n ...(!isWeb && {\n // non web\n onPressOut: (e) => {\n unPress()\n onPressOut?.(e)\n },\n }),\n ...(isWeb &&\n !isTouchDevice && {\n onMouseEnter:\n attachHover || attachPress\n ? (e) => {\n let next: Partial<typeof state> = {}\n if (attachHover) {\n next.hover = true\n }\n if (state.pressIn) {\n next.press = true\n }\n if (Object.keys(next).length) {\n set(next)\n }\n onHoverIn?.(e)\n onMouseEnter?.(e)\n }\n : undefined,\n onMouseLeave:\n attachHover || attachPress\n ? (e) => {\n let next: Partial<typeof state> = {}\n mouseUps.add(unPress)\n if (attachHover) {\n next.hover = false\n }\n if (state.pressIn) {\n next.press = false\n next.pressIn = false\n }\n if (Object.keys(next).length) {\n set(next)\n }\n onHoverOut?.(e)\n onMouseLeave?.(e)\n }\n : undefined,\n }),\n onMouseDown: attachPress\n ? (e) => {\n set({\n press: true,\n pressIn: true,\n })\n onPressIn?.(e)\n onMouseDown?.(e)\n }\n : (onPressIn as any),\n onClick: attachPress\n ? (e) => {\n e.preventDefault()\n unPress()\n onPressOut?.(e)\n onPress?.(e)\n onClick?.(e)\n }\n : (onPressOut as any),\n }\n : null\n\n if (events) {\n if (typeof ViewComponent !== 'string') {\n // TODO once we do the above we can then rely entirely on pressStyle returned here isntead of above pressStyle logic\n const [pressProps] = usePressable({\n disabled,\n hitSlop,\n onPressIn: events.onMouseDown,\n onPressOut: events.onPressOut,\n onPress,\n })\n Object.assign(supportedProps, pressProps)\n } else {\n Object.assign(supportedProps, events)\n }\n }\n\n const spacedChildrenEl = spacedChildren({\n children,\n spacing,\n flexDirection: props.flexDirection || defaultProps?.flexDirection,\n })\n\n let content = createEl(ViewComponent, supportedProps, spacedChildrenEl)\n\n const shouldWrapTextAncestor = isWeb && staticConfig.isText && !hasTextAncestor\n if (shouldWrapTextAncestor) {\n // from react-native-web\n // @ts-ignore\n content = createElement(TextAncestorContext.Provider, { value: true }, content)\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug']) {\n supportedProps['debug'] = true\n console.log(' \uD83C\uDF51 props in: ', props)\n console.log(' \uD83C\uDF51 props out: ', supportedProps)\n // prettier-ignore\n console.log(' \uD83C\uDF51 other: ', { ViewComponent, viewProps, styles, psuedos, createEl, content, spacedChildrenEl, staticConfig, splitDefaults, tamaguiConfig })\n }\n }\n\n return (\n <>\n {features}\n {content}\n </>\n )\n })\n\n const config: StaticConfig = {\n validStyles: validStyleProps,\n ...staticConfig,\n // TODO shouldnt need this spread / disbaled / fullscreen\n validPropsExtra: {\n ...staticConfig.validPropsExtra,\n disabled: true,\n fullscreen: true,\n },\n }\n component['staticConfig'] = config\n\n return component as any as StaticComponent<A, void>\n}\n\n// dont used styled() here to avoid circular deps\n// keep inline to avoid circular deps\n\nexport const Spacer = createComponent({\n defaultProps: stackDefaultStyles,\n variants: {\n size: {\n '...size': (size, { tokens }) => {\n return {\n width: tokens.size[size] ?? size,\n height: tokens.size[size] ?? size,\n }\n },\n },\n direction: {\n horizontal: {\n height: 0,\n },\n vertical: {\n width: 0,\n },\n },\n },\n})\n\nexport function spacedChildren({\n children,\n spacing,\n flexDirection,\n}: {\n children: any\n spacing?: any\n flexDirection?: ViewStyle['flexDirection']\n}) {\n if (!spacing) {\n return children\n }\n const next: any[] = []\n const childrenList = Children.toArray(children)\n const len = childrenList.length\n if (len === 1) {\n return children\n }\n const spacer = (\n <Spacer\n // @ts-ignore TODO\n direction={\n flexDirection === 'row' || flexDirection === 'row-reverse' ? 'horizontal' : 'vertical'\n }\n size={spacing}\n />\n )\n for (const [index, child] of childrenList.entries()) {\n next.push(child)\n if (index === len - 1) {\n break\n }\n const key = `${child?.['key'] ?? index}`\n next.push(createElement(Fragment, { key: key + '_spacer' }, spacer))\n }\n return next\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAGO,MAAM,WAAW,IAAI;AAE5B,IAAI,OAAO,aAAa,aAAa;AACnC,WAAS,iBAAiB,WAAW,MAAM;AACzC,aAAS,QAAQ,CAAC,MAAM;AACxB,aAAS;AAAA;AAAA;AAMN,yBACL,UACA;AACA,MAAI;AACJ,MAAI,YAAY,UAAU;AACxB,mBAAe;AAAA,SACV;AACL,mBAAe,kBAAkB;AAAA;AAGnC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,CAAC,MAAM,EAAE,aAAa;AAC/B,eAAO;AAAA,UACL,OAAO,OAAO,KAAK,SAAS;AAAA,UAC5B,QAAQ,OAAO,KAAK,SAAS;AAAA;AAAA;AAAA;AAAA,IAInC,WAAW;AAAA,MACT,YAAY;AAAA,QACV,QAAQ;AAAA;AAAA,MAEV,UAAU;AAAA,QACR,OAAO;AAAA;AAAA;AAAA;AAAA;AAMR,wBAAwB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,GAKC;AACD,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA;AAET,QAAM,OAAc;AACpB,QAAM,eAAe,SAAS,QAAQ;AACtC,QAAM,MAAM,aAAa;AACzB,MAAI,QAAQ,GAAG;AACb,WAAO;AAAA;AAET,QAAM,SACJ,oCAAC,QAAD;AAAA,IAEE,WACE,kBAAkB,SAAS,kBAAkB,gBAAgB,eAAe;AAAA,IAE9E,MAAM;AAAA;AAGV,aAAW,CAAC,OAAO,UAAU,aAAa,WAAW;AACnD,SAAK,KAAK;AACV,QAAI,UAAU,MAAM,GAAG;AACrB;AAAA;AAEF,UAAM,MAAM,GAAG,QAAQ,UAAU;AACjC,SAAK,KAAK,cAAc,UAAU,EAAE,KAAK,MAAM,aAAa;AAAA;AAE9D,SAAO;AAAA;AAnCO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createShorthands.ts"],
|
|
4
|
+
"sourcesContent": ["import { GenericShorthands } from './types'\n\n// type helper\n\nexport function createShorthands<A extends Record<string, string>>(shorthands: A): A {\n return Object.freeze(shorthands) as any\n}\n"],
|
|
5
|
+
"mappings": ";;AAIO,0BAA4D,YAAkB;AACnF,SAAO,OAAO,OAAO;AAAA;AADP;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|