@tamagui/core 1.0.0-alpha.0
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/.ultra.cache.json +1 -0
- package/_/constants/constants.js +14 -0
- package/_/constants/constants.js.map +7 -0
- package/_/constants/platform.js +20 -0
- package/_/constants/platform.js.map +7 -0
- package/_/constants/pseudos.js +18 -0
- package/_/constants/pseudos.js.map +7 -0
- package/_/constants/rnw.js +22 -0
- package/_/constants/rnw.js.map +7 -0
- package/_/createComponent.js +427 -0
- package/_/createComponent.js.map +7 -0
- package/_/createShorthands.js +10 -0
- package/_/createShorthands.js.map +7 -0
- package/_/createTamagui.js +122 -0
- package/_/createTamagui.js.map +7 -0
- package/_/createTheme.js +20 -0
- package/_/createTheme.js.map +7 -0
- package/_/createTokens.js +29 -0
- package/_/createTokens.js.map +7 -0
- package/_/createVariable.js +22 -0
- package/_/createVariable.js.map +7 -0
- package/_/helpers/addStylesUsingClassname.js +32 -0
- package/_/helpers/addStylesUsingClassname.js.map +7 -0
- package/_/helpers/createMediaStyle.js +34 -0
- package/_/helpers/createMediaStyle.js.map +7 -0
- package/_/helpers/createTamaguiProvider.js +42 -0
- package/_/helpers/createTamaguiProvider.js.map +7 -0
- package/_/helpers/extendStaticConfig.js +176 -0
- package/_/helpers/extendStaticConfig.js.map +7 -0
- package/_/helpers/fixNativeShadow.js +8 -0
- package/_/helpers/fixNativeShadow.js.map +7 -0
- package/_/helpers/fixNativeShadow.native.js +30 -0
- package/_/helpers/fixNativeShadow.native.js.map +7 -0
- package/_/helpers/getSplitStyles.js +160 -0
- package/_/helpers/getSplitStyles.js.map +7 -0
- package/_/helpers/getStylesAtomic.js +84 -0
- package/_/helpers/getStylesAtomic.js.map +7 -0
- package/_/helpers/getStylesAtomic.native.js +10 -0
- package/_/helpers/getStylesAtomic.native.js.map +7 -0
- package/_/helpers/insertStyleRule.js +24 -0
- package/_/helpers/insertStyleRule.js.map +7 -0
- package/_/helpers/matchMedia.js +15 -0
- package/_/helpers/matchMedia.js.map +7 -0
- package/_/helpers/matchMedia.native.js +8 -0
- package/_/helpers/matchMedia.native.js.map +7 -0
- package/_/helpers/themeable.js +26 -0
- package/_/helpers/themeable.js.map +7 -0
- package/_/hooks/useConstant.js +15 -0
- package/_/hooks/useConstant.js.map +7 -0
- package/_/hooks/useFeatures.js +75 -0
- package/_/hooks/useFeatures.js.map +7 -0
- package/_/hooks/useForceUpdate.js +28 -0
- package/_/hooks/useForceUpdate.js.map +7 -0
- package/_/hooks/useMedia.js +173 -0
- package/_/hooks/useMedia.js.map +7 -0
- package/_/hooks/usePressable.js +14 -0
- package/_/hooks/usePressable.js.map +7 -0
- package/_/hooks/useTheme.js +94 -0
- package/_/hooks/useTheme.js.map +7 -0
- package/_/index.js +30 -0
- package/_/index.js.map +7 -0
- package/_/static/postProcessStyles.js +18 -0
- package/_/static/postProcessStyles.js.map +7 -0
- package/_/static.js +12 -0
- package/_/static.js.map +7 -0
- package/_/styled.js +21 -0
- package/_/styled.js.map +7 -0
- package/_/types.js +1 -0
- package/_/types.js.map +7 -0
- package/_/views/Animated.js +79 -0
- package/_/views/Animated.js.map +7 -0
- package/_/views/Stack.js +12 -0
- package/_/views/Stack.js.map +7 -0
- package/_/views/Text.js +60 -0
- package/_/views/Text.js.map +7 -0
- package/_/views/TextAncestorContext.js +19 -0
- package/_/views/TextAncestorContext.js.map +7 -0
- package/_/views/Theme.js +57 -0
- package/_/views/Theme.js.map +7 -0
- package/_/views/ThemeContext.js +6 -0
- package/_/views/ThemeContext.js.map +7 -0
- package/_/views/ThemeInverse.js +27 -0
- package/_/views/ThemeInverse.js.map +7 -0
- package/_/views/ThemeManagerContext.js +56 -0
- package/_/views/ThemeManagerContext.js.map +7 -0
- package/_/views/ThemeProvider.js +45 -0
- package/_/views/ThemeProvider.js.map +7 -0
- package/dist/constants/constants.js +14 -0
- package/dist/constants/constants.js.map +7 -0
- package/dist/constants/platform.js +19 -0
- package/dist/constants/platform.js.map +7 -0
- package/dist/constants/pseudos.js +18 -0
- package/dist/constants/pseudos.js.map +7 -0
- package/dist/constants/rnw.js +22 -0
- package/dist/constants/rnw.js.map +7 -0
- package/dist/constants/styleConstants.js +46 -0
- package/dist/constants/styleConstants.js.map +7 -0
- package/dist/createComponent.js +445 -0
- package/dist/createComponent.js.map +7 -0
- package/dist/createFont.js +24 -0
- package/dist/createFont.js.map +7 -0
- package/dist/createShorthands.js +10 -0
- package/dist/createShorthands.js.map +7 -0
- package/dist/createTamagui.js +159 -0
- package/dist/createTamagui.js.map +7 -0
- package/dist/createTheme.js +20 -0
- package/dist/createTheme.js.map +7 -0
- package/dist/createTokens.js +29 -0
- package/dist/createTokens.js.map +7 -0
- package/dist/createVariable.js +22 -0
- package/dist/createVariable.js.map +7 -0
- package/dist/helpers/addStylesUsingClassname.js +57 -0
- package/dist/helpers/addStylesUsingClassname.js.map +7 -0
- package/dist/helpers/createMediaStyle.js +34 -0
- package/dist/helpers/createMediaStyle.js.map +7 -0
- package/dist/helpers/createPropMapper.js +153 -0
- package/dist/helpers/createPropMapper.js.map +7 -0
- package/dist/helpers/createTamaguiProvider.js +25 -0
- package/dist/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/helpers/extendStaticConfig.js +59 -0
- package/dist/helpers/extendStaticConfig.js.map +7 -0
- package/dist/helpers/fixNativeShadow.js +8 -0
- package/dist/helpers/fixNativeShadow.js.map +7 -0
- package/dist/helpers/fixNativeShadow.native.js +30 -0
- package/dist/helpers/fixNativeShadow.native.js.map +7 -0
- package/dist/helpers/getSplitStyles.js +160 -0
- package/dist/helpers/getSplitStyles.js.map +7 -0
- package/dist/helpers/getStylesAtomic.js +83 -0
- package/dist/helpers/getStylesAtomic.js.map +7 -0
- package/dist/helpers/getStylesAtomic.native.js +10 -0
- package/dist/helpers/getStylesAtomic.native.js.map +7 -0
- package/dist/helpers/insertStyleRule.js +24 -0
- package/dist/helpers/insertStyleRule.js.map +7 -0
- package/dist/helpers/isObj.js +7 -0
- package/dist/helpers/isObj.js.map +7 -0
- package/dist/helpers/matchMedia.js +15 -0
- package/dist/helpers/matchMedia.js.map +7 -0
- package/dist/helpers/matchMedia.native.js +8 -0
- package/dist/helpers/matchMedia.native.js.map +7 -0
- package/dist/helpers/pseudos.js +1 -0
- package/dist/helpers/pseudos.js.map +7 -0
- package/dist/helpers/themeable.js +26 -0
- package/dist/helpers/themeable.js.map +7 -0
- package/dist/hooks/useConstant.js +15 -0
- package/dist/hooks/useConstant.js.map +7 -0
- package/dist/hooks/useFeatures.js +75 -0
- 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/hooks/useMedia.js +171 -0
- package/dist/hooks/useMedia.js.map +7 -0
- package/dist/hooks/usePressable.js +13 -0
- package/dist/hooks/usePressable.js.map +7 -0
- package/dist/hooks/useTheme.js +93 -0
- package/dist/hooks/useTheme.js.map +7 -0
- package/dist/index.cjs +2125 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +7 -0
- package/dist/packages/core/src/constants/constants.d.ts +8 -0
- package/dist/packages/core/src/constants/constants.d.ts.map +1 -0
- package/dist/packages/core/src/constants/platform.d.ts +9 -0
- package/dist/packages/core/src/constants/platform.d.ts.map +1 -0
- package/dist/packages/core/src/constants/pseudos.d.ts +15 -0
- package/dist/packages/core/src/constants/pseudos.d.ts.map +1 -0
- package/dist/packages/core/src/constants/rnw.d.ts +2 -0
- package/dist/packages/core/src/constants/rnw.d.ts.map +1 -0
- package/dist/packages/core/src/createComponent.d.ts +16 -0
- package/dist/packages/core/src/createComponent.d.ts.map +1 -0
- package/dist/packages/core/src/createShorthands.d.ts +2 -0
- package/dist/packages/core/src/createShorthands.d.ts.map +1 -0
- package/dist/packages/core/src/createTamagui.d.ts +37 -0
- package/dist/packages/core/src/createTamagui.d.ts.map +1 -0
- package/dist/packages/core/src/createTheme.d.ts +5 -0
- package/dist/packages/core/src/createTheme.d.ts.map +1 -0
- package/dist/packages/core/src/createTokens.d.ts +45 -0
- package/dist/packages/core/src/createTokens.d.ts.map +1 -0
- package/dist/packages/core/src/createVariable.d.ts +14 -0
- package/dist/packages/core/src/createVariable.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts +2 -0
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts +8 -0
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts +5 -0
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts +5 -0
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts +2 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts +2 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts +15 -0
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts +3 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts +2 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts +2 -0
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/matchMedia.d.ts +2 -0
- package/dist/packages/core/src/helpers/matchMedia.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts +3 -0
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/themeable.d.ts +10 -0
- package/dist/packages/core/src/helpers/themeable.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useConstant.d.ts +2 -0
- package/dist/packages/core/src/hooks/useConstant.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useFeatures.d.ts +5 -0
- package/dist/packages/core/src/hooks/useFeatures.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts +2 -0
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useMedia.d.ts +16 -0
- package/dist/packages/core/src/hooks/useMedia.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/usePressable.d.ts +3 -0
- package/dist/packages/core/src/hooks/usePressable.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useTheme.d.ts +18 -0
- package/dist/packages/core/src/hooks/useTheme.d.ts.map +1 -0
- package/dist/packages/core/src/index.d.ts +27 -0
- package/dist/packages/core/src/index.d.ts.map +1 -0
- package/dist/packages/core/src/static/postProcessStyles.d.ts +7 -0
- package/dist/packages/core/src/static/postProcessStyles.d.ts.map +1 -0
- package/dist/packages/core/src/static.d.ts +12 -0
- package/dist/packages/core/src/static.d.ts.map +1 -0
- package/dist/packages/core/src/styled.d.ts +16 -0
- package/dist/packages/core/src/styled.d.ts.map +1 -0
- package/dist/packages/core/src/types.d.ts +305 -0
- package/dist/packages/core/src/types.d.ts.map +1 -0
- package/dist/packages/core/src/views/Animated.d.ts +15 -0
- package/dist/packages/core/src/views/Animated.d.ts.map +1 -0
- package/dist/packages/core/src/views/Stack.d.ts +3 -0
- package/dist/packages/core/src/views/Stack.d.ts.map +1 -0
- package/dist/packages/core/src/views/Text.d.ts +3 -0
- package/dist/packages/core/src/views/Text.d.ts.map +1 -0
- package/dist/packages/core/src/views/TextAncestorContext.d.ts +3 -0
- package/dist/packages/core/src/views/TextAncestorContext.d.ts.map +1 -0
- package/dist/packages/core/src/views/Theme.d.ts +8 -0
- package/dist/packages/core/src/views/Theme.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeContext.d.ts +18 -0
- package/dist/packages/core/src/views/ThemeContext.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeInverse.d.ts +10 -0
- package/dist/packages/core/src/views/ThemeInverse.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts +15 -0
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeProvider.d.ts +10 -0
- package/dist/packages/core/src/views/ThemeProvider.d.ts.map +1 -0
- package/dist/packages/helpers/src/AllRules.d.ts +3 -0
- package/dist/packages/helpers/src/AllRules.d.ts.map +1 -0
- package/dist/packages/helpers/src/concatClassName.d.ts +2 -0
- package/dist/packages/helpers/src/concatClassName.d.ts.map +1 -0
- package/dist/packages/helpers/src/index.d.ts +5 -0
- package/dist/packages/helpers/src/index.d.ts.map +1 -0
- package/dist/packages/helpers/src/types.d.ts +8 -0
- package/dist/packages/helpers/src/types.d.ts.map +1 -0
- package/dist/packages/helpers/src/validStyleProps.d.ts +475 -0
- package/dist/packages/helpers/src/validStyleProps.d.ts.map +1 -0
- package/dist/static/postProcessStyles.js +18 -0
- package/dist/static/postProcessStyles.js.map +7 -0
- package/dist/static.js +15 -0
- package/dist/static.js.map +7 -0
- package/dist/styled.js +21 -0
- package/dist/styled.js.map +7 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +7 -0
- package/dist/views/Animated.js +79 -0
- package/dist/views/Animated.js.map +7 -0
- package/dist/views/SafeAreaProvider.js +30 -0
- package/dist/views/SafeAreaProvider.js.map +7 -0
- package/dist/views/Stack.js +12 -0
- package/dist/views/Stack.js.map +7 -0
- package/dist/views/Text.js +60 -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/views/Theme.js +56 -0
- package/dist/views/Theme.js.map +7 -0
- package/dist/views/ThemeContext.js +6 -0
- package/dist/views/ThemeContext.js.map +7 -0
- package/dist/views/ThemeInverse.js +27 -0
- package/dist/views/ThemeInverse.js.map +7 -0
- package/dist/views/ThemeManagerContext.js +55 -0
- package/dist/views/ThemeManagerContext.js.map +7 -0
- package/dist/views/ThemeProvider.js +45 -0
- package/dist/views/ThemeProvider.js.map +7 -0
- package/package.json +33 -0
- package/src/constants/constants.ts +12 -0
- package/src/constants/platform.ts +15 -0
- package/src/constants/pseudos.ts +14 -0
- package/src/constants/rnw.tsx +20 -0
- package/src/createComponent.tsx +596 -0
- package/src/createFont.ts +26 -0
- package/src/createShorthands.ts +5 -0
- package/src/createTamagui.ts +207 -0
- package/src/createTheme.ts +19 -0
- package/src/createTokens.ts +83 -0
- package/src/createVariable.ts +22 -0
- package/src/helpers/addStylesUsingClassname.tsx +60 -0
- package/src/helpers/createMediaStyle.ts +46 -0
- package/src/helpers/createPropMapper.ts +184 -0
- package/src/helpers/createTamaguiProvider.tsx +22 -0
- package/src/helpers/extendStaticConfig.ts +68 -0
- package/src/helpers/fixNativeShadow.native.tsx +27 -0
- package/src/helpers/fixNativeShadow.tsx +2 -0
- package/src/helpers/getSplitStyles.tsx +210 -0
- package/src/helpers/getStylesAtomic.native.ts +3 -0
- package/src/helpers/getStylesAtomic.ts +103 -0
- package/src/helpers/insertStyleRule.tsx +18 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/matchMedia.native.ts +3 -0
- package/src/helpers/matchMedia.ts +9 -0
- package/src/helpers/themeable.tsx +42 -0
- package/src/hooks/useConstant.tsx +10 -0
- package/src/hooks/useFeatures.tsx +78 -0
- package/src/hooks/useForceUpdate.tsx +26 -0
- package/src/hooks/useMedia.tsx +194 -0
- package/src/hooks/usePressable.tsx +9 -0
- package/src/hooks/useTheme.tsx +107 -0
- package/src/index.ts +33 -0
- package/src/static/postProcessStyles.tsx +20 -0
- package/src/static.ts +22 -0
- package/src/styled.ts +82 -0
- package/src/types.tsx +561 -0
- package/src/views/Animated.tsx +121 -0
- package/src/views/SafeAreaProvider.tsx +33 -0
- package/src/views/Stack.tsx +21 -0
- package/src/views/Text.tsx +66 -0
- package/src/views/TextAncestorContext.tsx +12 -0
- package/src/views/Theme.tsx +73 -0
- package/src/views/ThemeContext.tsx +5 -0
- package/src/views/ThemeInverse.tsx +23 -0
- package/src/views/ThemeManagerContext.tsx +50 -0
- package/src/views/ThemeProvider.tsx +52 -0
- package/tsconfig.json +8 -0
- package/types.d.ts +558 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"files":{"_":"1637340237894.082","dist":"1637340239389.5557",".npmignore":"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391","package.json":"de60daa54e38522f2f7718f7ea2811a470c0abb6","src/constants/constants.ts":"557e9930ddfa8fad6d74219ae7245c80551b8794","src/constants/platform.ts":"07382a90f555a7ec9d23ff16082ee088d64855a1","src/constants/pseudos.ts":"52c7655f92eaa265601eaf4a31b6db1688875321","src/constants/rnw.tsx":"ebc4ce292c30d344945b75e151a272023461f784","src/createComponent.tsx":"eb42db3252cf09744e49e5db195b1bbfa68c606a","src/createShorthands.ts":"7b5ce250bc5d049fcf9f5898efc60fdc91f2988d","src/createTamagui.ts":"f1df54b6772668e2e7ba8f229b4cbf64abd5aa58","src/createTheme.ts":"aa9b7c08901c1dff621a371912f3cbf1c2507301","src/createTokens.ts":"e9666b97efc926535f1edf1d0f757559b9008a03","src/createVariable.ts":"da248891d943b04d940205762b1239751af6c7cc","src/helpers/addStylesUsingClassname.tsx":"a08eb2d83f80fe8dbb2fd72ad4f44945c16b5ee9","src/helpers/createMediaStyle.ts":"3c5ff33628b5cc8de55bdcedc3133b968b5fb210","src/helpers/createTamaguiProvider.tsx":"f16ad749794f1bb20fada1444716d0264e60b9f9","src/helpers/extendStaticConfig.ts":"90cc21f26174b621635984e455d11b574e2b28d2","src/helpers/fixNativeShadow.native.tsx":"ff1ed30ed9ace81433046e719939a04190b477cc","src/helpers/fixNativeShadow.tsx":"7fb6e7d9604025d2023469f23aab7280244bbb03","src/helpers/getSplitStyles.tsx":"7626000da0d5016c1b4a08ae4101b5e16d2b3e34","src/helpers/getStylesAtomic.native.ts":"9054085df65d873432d974b369ac9dcb80f387ff","src/helpers/getStylesAtomic.ts":"e85e8ae07227d5b05f0f1aad7fae77b40e30c09d","src/helpers/insertStyleRule.tsx":"2fe177cb7efe1b2fb5b38c57835a6a3ea5e35443","src/helpers/matchMedia.native.ts":"7e28a480a564ba5d341d5d559cf1ddcaf5f0b76b","src/helpers/matchMedia.ts":"071b4358b4a141c8f55645e478af1e2527e88b67","src/helpers/themeable.tsx":"16e605a7ae27cec3e4d725817370ac3c250c52a4","src/hooks/useConstant.tsx":"f23ca6031dd13f73f4c5eb7089b5745dc2cdaedd","src/hooks/useFeatures.tsx":"3b917df55d6478ef6f3b9c21d7bef3e5bdcefe1b","src/hooks/useForceUpdate.tsx":"bd991b41de300151e93b2d7e8cdca6a0accefacc","src/hooks/useMedia.tsx":"aa6e326abbcc4bbcfdff75f6b0d6d43dba349a2b","src/hooks/usePressable.tsx":"4f55bdca7250e2d22d88f3578d8c8e62ce5c8453","src/hooks/useTheme.tsx":"9c11c3a5da0844cfb93ccbbfa861aedbe10b2552","src/index.ts":"0a4c125f40a30dbf9207ade1d1a8ccd26293200d","src/static.ts":"a6121ec395e37e7536a9c5bd5916fb054de2e2cc","src/static/postProcessStyles.tsx":"5e5579249eb99caab9f406af6ec801b7ff1db830","src/styled.ts":"734ad3b404f1782c2579771f5a421e9bebf28642","src/types.tsx":"10c0fd38a09701107a94a311413c7612f46324b3","src/views/Animated.tsx":"eac498149091b087c84a5d92c4a9b57bafd6c149","src/views/Stack.tsx":"62ef6b9307bb434ad08f4ab7f3f6d0ccb975a359","src/views/Text.tsx":"476bdde93a89840681bf981cfc06e10fc0bc837d","src/views/TextAncestorContext.tsx":"73b13b84778bddb2b4198d32daf1de668132b0bb","src/views/Theme.tsx":"4e9357aac5fc201f2dc359a8f6fd4a8581ceb9bf","src/views/ThemeContext.tsx":"788e2d26d8727dd9493944b5ae9c7ea241fd7ed4","src/views/ThemeInverse.tsx":"614b626451a57955e896cc709d28043bc9bbf391","src/views/ThemeManagerContext.tsx":"30f5f195c2d4b326c5b44f587ff88a1dd1a848ff","src/views/ThemeProvider.tsx":"dcdd80d625e61e9598baf4cb10fc7921962efb50","tsconfig.json":"d3effa0a1380f9664793b92aefd77a1bc96ce071","types.d.ts":"47dcbac539e5744c2d841f341661d351b546b3ef"},"deps":{"@tamagui/helpers":1637340256961.1,"@tamagui/esdx":1637340256835.24}}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isWeb } from "./platform";
|
|
2
|
+
const stackDefaultStyles = {
|
|
3
|
+
alignItems: "stretch",
|
|
4
|
+
flexShrink: 0,
|
|
5
|
+
...isWeb && {
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexBasis: "auto",
|
|
8
|
+
boxSizing: "border-box"
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
stackDefaultStyles
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/constants.ts"],
|
|
4
|
+
"sourcesContent": ["import { isWeb } from './platform'\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;AAEO,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
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
const isWeb = process.env.TAMAGUI_TARGET === "web" || ((_a = Platform) == null ? void 0 : _a.OS) === "web";
|
|
5
|
+
const isSSR = isWeb && typeof window === "undefined";
|
|
6
|
+
const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
7
|
+
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
8
|
+
const supportsTouchWeb = typeof window !== "undefined" && "ontouchstart" in window;
|
|
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
|
+
export {
|
|
12
|
+
isChrome,
|
|
13
|
+
isSSR,
|
|
14
|
+
isTouchDevice,
|
|
15
|
+
isWeb,
|
|
16
|
+
isWebIOS,
|
|
17
|
+
supportsTouchWeb,
|
|
18
|
+
useIsomorphicLayoutEffect
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/platform.ts"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web' || Platform?.OS === 'web'\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,QAAQ,QAAQ,IAAI,mBAAmB,SAAS,uCAAU,QAAO;AACvE,MAAM,QAAQ,SAAS,OAAO,WAAW;AACzC,MAAM,4BAA4B,QAAQ,YAAY;AACtD,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa;AAC1F,MAAM,mBAAmB,OAAO,WAAW,eAAe,kBAAkB;AAC5E,MAAM,gBAAgB,CAAC,SAAS;AAChC,MAAM,WACX,SACA,OAAO,cAAc,eACpB,oBAAmB,KAAK,UAAU,aAChC,UAAU,aAAa,cAAc,UAAU,iBAAiB,MACnE,CAAC,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const pseudos = {
|
|
2
|
+
focusStyle: {
|
|
3
|
+
name: "focus",
|
|
4
|
+
priority: 3
|
|
5
|
+
},
|
|
6
|
+
pressStyle: {
|
|
7
|
+
name: "active",
|
|
8
|
+
priority: 2
|
|
9
|
+
},
|
|
10
|
+
hoverStyle: {
|
|
11
|
+
name: "hover",
|
|
12
|
+
priority: 1
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
pseudos
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=pseudos.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/pseudos.ts"],
|
|
4
|
+
"sourcesContent": ["export const pseudos = {\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA;AAAA,EAEZ,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA;AAAA,EAEZ,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const interopRequire = /* @__PURE__ */ __name((src) => "default" in src ? src.default : src, "interopRequire");
|
|
4
|
+
const rnw = {};
|
|
5
|
+
if (process.env.IS_STATIC === "is_static") {
|
|
6
|
+
const createCompileableStyle = require("react-native-web/dist/cjs/exports/StyleSheet/createCompileableStyle");
|
|
7
|
+
const createReactDOMStyle = require("react-native-web/dist/cjs/exports/StyleSheet/createReactDOMStyle");
|
|
8
|
+
const i18Style = require("react-native-web/dist/cjs/exports/StyleSheet/i18nStyle");
|
|
9
|
+
const atomic = require("react-native-web/dist/cjs/exports/StyleSheet/compile").atomic;
|
|
10
|
+
Object.assign(rnw, {
|
|
11
|
+
createCompileableStyle,
|
|
12
|
+
createReactDOMStyle,
|
|
13
|
+
i18Style,
|
|
14
|
+
atomic
|
|
15
|
+
});
|
|
16
|
+
} else if (process.env.TAMAGUI_TARGET === "web") {
|
|
17
|
+
Object.assign(rnw, interopRequire(require("react-native-web").TamaguiExports));
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
rnw
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=rnw.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants/rnw.tsx"],
|
|
4
|
+
"sourcesContent": ["const interopRequire = (src: any) => ('default' in src ? src.default : src)\n\nexport const rnw: Record<string, any> = {}\n\n// in static mode, require them directly since we can't import react-native-web at all (it has flow stuff in it)\nif (process.env.IS_STATIC === 'is_static') {\n const createCompileableStyle = require('react-native-web/dist/cjs/exports/StyleSheet/createCompileableStyle')\n const createReactDOMStyle = require('react-native-web/dist/cjs/exports/StyleSheet/createReactDOMStyle')\n const i18Style = require('react-native-web/dist/cjs/exports/StyleSheet/i18nStyle')\n const atomic = require('react-native-web/dist/cjs/exports/StyleSheet/compile').atomic\n Object.assign(rnw, {\n createCompileableStyle,\n createReactDOMStyle,\n i18Style,\n atomic,\n })\n} else if (process.env.TAMAGUI_TARGET === 'web') {\n // when targeting web (client) import it like so\n Object.assign(rnw, interopRequire(require('react-native-web').TamaguiExports))\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA,MAAM,iBAAiB,wBAAC,QAAc,aAAa,MAAM,IAAI,UAAU,KAAhD;AAEhB,MAAM,MAA2B;AAGxC,IAAI,QAAQ,IAAI,cAAc,aAAa;AACzC,QAAM,yBAAyB,QAAQ;AACvC,QAAM,sBAAsB,QAAQ;AACpC,QAAM,WAAW,QAAQ;AACzB,QAAM,SAAS,QAAQ,wDAAwD;AAC/E,SAAO,OAAO,KAAK;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,WAEO,QAAQ,IAAI,mBAAmB,OAAO;AAE/C,SAAO,OAAO,KAAK,eAAe,QAAQ,oBAAoB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,427 @@
|
|
|
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 { Text, 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 { onConfiguredOnce } from "./createTamagui";
|
|
20
|
+
import { addStylesUsingClassname } from "./helpers/addStylesUsingClassname";
|
|
21
|
+
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
22
|
+
import { getSplitStyles } from "./helpers/getSplitStyles";
|
|
23
|
+
import { useFeatures } from "./hooks/useFeatures";
|
|
24
|
+
import { useForceUpdate } from "./hooks/useForceUpdate";
|
|
25
|
+
import { usePressable } from "./hooks/usePressable";
|
|
26
|
+
import { TextAncestorContext } from "./views/TextAncestorContext";
|
|
27
|
+
import { ThemeManagerContext } from "./views/ThemeManagerContext";
|
|
28
|
+
const mouseUps = new Set();
|
|
29
|
+
if (typeof document !== "undefined") {
|
|
30
|
+
document.addEventListener("mouseup", () => {
|
|
31
|
+
mouseUps.forEach((x) => x());
|
|
32
|
+
mouseUps.clear();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function createComponent(configIn) {
|
|
36
|
+
let staticConfig;
|
|
37
|
+
if ("parsed" in configIn) {
|
|
38
|
+
staticConfig = configIn;
|
|
39
|
+
} else {
|
|
40
|
+
staticConfig = parseStaticConfig(configIn);
|
|
41
|
+
}
|
|
42
|
+
const { Component, validStyles, isText } = staticConfig;
|
|
43
|
+
const validStyleProps = validStyles != null ? validStyles : stylePropsView;
|
|
44
|
+
let defaultProps = null;
|
|
45
|
+
let tamaguiConfig;
|
|
46
|
+
let defaultsStyle;
|
|
47
|
+
let defaultsClassName = "";
|
|
48
|
+
let initialTheme;
|
|
49
|
+
const component = forwardRef((props, forwardedRef) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const {
|
|
52
|
+
tag,
|
|
53
|
+
hitSlop,
|
|
54
|
+
children,
|
|
55
|
+
pointerEvents,
|
|
56
|
+
onPress,
|
|
57
|
+
onPressIn,
|
|
58
|
+
onPressOut,
|
|
59
|
+
onHoverIn,
|
|
60
|
+
onHoverOut,
|
|
61
|
+
space,
|
|
62
|
+
disabled,
|
|
63
|
+
onMouseEnter,
|
|
64
|
+
onMouseLeave,
|
|
65
|
+
hrefAttrs,
|
|
66
|
+
onMoveShouldSetResponder,
|
|
67
|
+
onMoveShouldSetResponderCapture,
|
|
68
|
+
onResponderEnd,
|
|
69
|
+
onResponderGrant,
|
|
70
|
+
onResponderMove,
|
|
71
|
+
onResponderReject,
|
|
72
|
+
onResponderRelease,
|
|
73
|
+
onResponderStart,
|
|
74
|
+
onResponderTerminate,
|
|
75
|
+
onResponderTerminationRequest,
|
|
76
|
+
onScrollShouldSetResponder,
|
|
77
|
+
onScrollShouldSetResponderCapture,
|
|
78
|
+
onSelectionChangeShouldSetResponder,
|
|
79
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
80
|
+
onStartShouldSetResponder,
|
|
81
|
+
onStartShouldSetResponderCapture,
|
|
82
|
+
onMouseDown,
|
|
83
|
+
onClick,
|
|
84
|
+
onLayout
|
|
85
|
+
} = props;
|
|
86
|
+
const forceUpdate = useForceUpdate();
|
|
87
|
+
const features = useFeatures(props, { forceUpdate });
|
|
88
|
+
const manager = useContext(ThemeManagerContext);
|
|
89
|
+
const [state, set_] = useState(() => ({
|
|
90
|
+
hover: false,
|
|
91
|
+
press: false,
|
|
92
|
+
pressIn: false,
|
|
93
|
+
theme: manager.name
|
|
94
|
+
}));
|
|
95
|
+
const set = /* @__PURE__ */ __name((next) => set_((prev) => {
|
|
96
|
+
for (const key in next) {
|
|
97
|
+
if (prev[key] !== next[key]) {
|
|
98
|
+
return { ...prev, ...next };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return prev;
|
|
102
|
+
}), "set");
|
|
103
|
+
if (process.env.NODE_ENV === "development" && !isText && isWeb) {
|
|
104
|
+
Children.toArray(props.children).forEach((item) => {
|
|
105
|
+
if (typeof item === "string") {
|
|
106
|
+
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
|
|
111
|
+
const hostRef = useRef(null);
|
|
112
|
+
if (isWeb) {
|
|
113
|
+
rnw.useResponderEvents(hostRef, {
|
|
114
|
+
onMoveShouldSetResponder,
|
|
115
|
+
onMoveShouldSetResponderCapture,
|
|
116
|
+
onResponderEnd,
|
|
117
|
+
onResponderGrant,
|
|
118
|
+
onResponderMove,
|
|
119
|
+
onResponderReject,
|
|
120
|
+
onResponderRelease,
|
|
121
|
+
onResponderStart,
|
|
122
|
+
onResponderTerminate,
|
|
123
|
+
onResponderTerminationRequest,
|
|
124
|
+
onScrollShouldSetResponder,
|
|
125
|
+
onScrollShouldSetResponderCapture,
|
|
126
|
+
onSelectionChangeShouldSetResponder,
|
|
127
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
128
|
+
onStartShouldSetResponder,
|
|
129
|
+
onStartShouldSetResponderCapture
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const isTracking = useRef(false);
|
|
133
|
+
const { viewProps, pseudos, style, classNames } = getSplitStyles(props, staticConfig, manager.theme || initialTheme);
|
|
134
|
+
const internal = useRef();
|
|
135
|
+
if (!internal.current) {
|
|
136
|
+
internal.current = {
|
|
137
|
+
isMounted: true
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
internal.current.isMounted = true;
|
|
142
|
+
const dispose = manager == null ? void 0 : manager.onChangeTheme((name) => {
|
|
143
|
+
if (isTracking.current) {
|
|
144
|
+
set({ theme: name });
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return () => {
|
|
148
|
+
dispose();
|
|
149
|
+
mouseUps.delete(unPress);
|
|
150
|
+
isTracking.current = false;
|
|
151
|
+
internal.current.isMounted = false;
|
|
152
|
+
};
|
|
153
|
+
}, [manager]);
|
|
154
|
+
const element = isWeb ? !Component || typeof Component === "string" ? tag || Component : Component : Component;
|
|
155
|
+
const ReactView = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
|
|
156
|
+
const ReactText = !isWeb ? Text : element || "span";
|
|
157
|
+
const ViewComponent = isText ? ReactText : ReactView;
|
|
158
|
+
const isHovering = !isTouchDevice && !disabled && pseudos && state.hover;
|
|
159
|
+
const isPressing = !disabled && pseudos && state.press;
|
|
160
|
+
const styles = [
|
|
161
|
+
style,
|
|
162
|
+
isHovering ? pseudos.hoverStyle || null : null,
|
|
163
|
+
isPressing ? pseudos.pressStyle || null : null
|
|
164
|
+
];
|
|
165
|
+
if (isWeb) {
|
|
166
|
+
const stylesClassNames = addStylesUsingClassname(styles);
|
|
167
|
+
const classList = staticConfig.isText ? [
|
|
168
|
+
defaultsClassName,
|
|
169
|
+
classNames,
|
|
170
|
+
stylesClassNames,
|
|
171
|
+
props.className
|
|
172
|
+
] : [defaultsClassName, props.className, classNames, stylesClassNames];
|
|
173
|
+
const classListFlat = classList.flat(1).filter(Boolean).join(" ");
|
|
174
|
+
const className = concatClassName(classListFlat);
|
|
175
|
+
if (process.env.NODE_ENV === "development") {
|
|
176
|
+
if (props["debug"]) {
|
|
177
|
+
console.log("\u{1F95A} className", { style, styles, stylesClassNames, classListFlat: classListFlat.split(" "), className });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
viewProps.className = className;
|
|
181
|
+
} else {
|
|
182
|
+
viewProps.style = styles;
|
|
183
|
+
}
|
|
184
|
+
if (pointerEvents) {
|
|
185
|
+
viewProps.pointerEvents = pointerEvents;
|
|
186
|
+
}
|
|
187
|
+
if (isWeb) {
|
|
188
|
+
const platformMethodsRef = rnw.usePlatformMethods(viewProps);
|
|
189
|
+
const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
|
|
190
|
+
viewProps.ref = setRef;
|
|
191
|
+
if (props.href != null && hrefAttrs != null) {
|
|
192
|
+
const { download, rel, target } = hrefAttrs;
|
|
193
|
+
if (download != null) {
|
|
194
|
+
viewProps.download = download;
|
|
195
|
+
}
|
|
196
|
+
if (rel != null) {
|
|
197
|
+
viewProps.rel = rel;
|
|
198
|
+
}
|
|
199
|
+
if (typeof target === "string") {
|
|
200
|
+
viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
if (forwardedRef) {
|
|
205
|
+
viewProps.ref = forwardedRef;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const attachPress = !!(pseudos && pseudos.pressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
209
|
+
const attachHover = isWeb && !isTouchDevice && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
210
|
+
const shouldAttach = internal.current.hasEverHadEvents || attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onClick" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props);
|
|
211
|
+
if (shouldAttach) {
|
|
212
|
+
internal.current.hasEverHadEvents = true;
|
|
213
|
+
}
|
|
214
|
+
const unPress = useCallback(() => {
|
|
215
|
+
if (!internal.current.isMounted)
|
|
216
|
+
return;
|
|
217
|
+
set({
|
|
218
|
+
press: false,
|
|
219
|
+
pressIn: false
|
|
220
|
+
});
|
|
221
|
+
}, []);
|
|
222
|
+
const events = shouldAttach ? {
|
|
223
|
+
...!isWeb && {
|
|
224
|
+
onPressOut: (e) => {
|
|
225
|
+
unPress();
|
|
226
|
+
onPressOut == null ? void 0 : onPressOut(e);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
...isWeb && !isTouchDevice && {
|
|
230
|
+
onMouseEnter: attachHover || attachPress ? (e) => {
|
|
231
|
+
let next = {};
|
|
232
|
+
if (attachHover) {
|
|
233
|
+
next.hover = true;
|
|
234
|
+
}
|
|
235
|
+
if (state.pressIn) {
|
|
236
|
+
next.press = true;
|
|
237
|
+
}
|
|
238
|
+
if (Object.keys(next).length) {
|
|
239
|
+
set(next);
|
|
240
|
+
}
|
|
241
|
+
onHoverIn == null ? void 0 : onHoverIn(e);
|
|
242
|
+
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
243
|
+
} : void 0,
|
|
244
|
+
onMouseLeave: attachHover || attachPress ? (e) => {
|
|
245
|
+
let next = {};
|
|
246
|
+
mouseUps.add(unPress);
|
|
247
|
+
if (attachHover) {
|
|
248
|
+
next.hover = false;
|
|
249
|
+
}
|
|
250
|
+
if (state.pressIn) {
|
|
251
|
+
next.press = false;
|
|
252
|
+
next.pressIn = false;
|
|
253
|
+
}
|
|
254
|
+
if (Object.keys(next).length) {
|
|
255
|
+
set(next);
|
|
256
|
+
}
|
|
257
|
+
onHoverOut == null ? void 0 : onHoverOut(e);
|
|
258
|
+
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
259
|
+
} : void 0
|
|
260
|
+
},
|
|
261
|
+
onMouseDown: attachPress ? (e) => {
|
|
262
|
+
set({
|
|
263
|
+
press: true,
|
|
264
|
+
pressIn: true
|
|
265
|
+
});
|
|
266
|
+
onPressIn == null ? void 0 : onPressIn(e);
|
|
267
|
+
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
268
|
+
} : onPressIn,
|
|
269
|
+
onClick: attachPress ? (e) => {
|
|
270
|
+
onPress == null ? void 0 : onPress(e);
|
|
271
|
+
onClick == null ? void 0 : onClick(e);
|
|
272
|
+
unPress();
|
|
273
|
+
onPressOut == null ? void 0 : onPressOut(e);
|
|
274
|
+
} : onPressOut
|
|
275
|
+
} : null;
|
|
276
|
+
if (events) {
|
|
277
|
+
if (typeof ViewComponent !== "string") {
|
|
278
|
+
const [pressProps] = usePressable({
|
|
279
|
+
disabled,
|
|
280
|
+
hitSlop,
|
|
281
|
+
onPressIn: events.onMouseDown,
|
|
282
|
+
onPressOut: events.onPressOut,
|
|
283
|
+
onPress: events.onClick
|
|
284
|
+
});
|
|
285
|
+
Object.assign(viewProps, pressProps);
|
|
286
|
+
} else {
|
|
287
|
+
Object.assign(viewProps, events);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const spacedChildrenEl = spacedChildren({
|
|
291
|
+
children,
|
|
292
|
+
space,
|
|
293
|
+
flexDirection: props.flexDirection || (defaultProps == null ? void 0 : defaultProps.flexDirection)
|
|
294
|
+
});
|
|
295
|
+
let content;
|
|
296
|
+
if (isWeb && rnw) {
|
|
297
|
+
const domProps = rnw.createDOMProps(viewProps);
|
|
298
|
+
const className = domProps.className && domProps.className !== viewProps.className ? `${domProps.className} ${viewProps.className}` : viewProps.className;
|
|
299
|
+
Object.assign(viewProps, domProps);
|
|
300
|
+
viewProps.className = className;
|
|
301
|
+
content = createElement(ViewComponent, viewProps, spacedChildrenEl);
|
|
302
|
+
} else {
|
|
303
|
+
content = createElement(ViewComponent, viewProps, spacedChildrenEl);
|
|
304
|
+
}
|
|
305
|
+
const shouldWrapTextAncestor = isWeb && staticConfig.isText && !hasTextAncestor;
|
|
306
|
+
if (shouldWrapTextAncestor) {
|
|
307
|
+
content = createElement(TextAncestorContext.Provider, { value: true }, content);
|
|
308
|
+
}
|
|
309
|
+
if (process.env.NODE_ENV === "development") {
|
|
310
|
+
if (props["debug"]) {
|
|
311
|
+
viewProps["debug"] = true;
|
|
312
|
+
console.log("\u{1F95A} props in:", props);
|
|
313
|
+
console.log("\u{1F95A} props out:", viewProps);
|
|
314
|
+
console.log((_a = props.onClick) == null ? void 0 : _a.toString());
|
|
315
|
+
console.log("\u{1F95A} etc:", { shouldAttach, ViewComponent, viewProps, styles, pseudos, content, spacedChildrenEl });
|
|
316
|
+
if (isWeb) {
|
|
317
|
+
console.log("\u{1F95A} component info", { staticConfig, tamaguiConfig });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, features, content);
|
|
322
|
+
});
|
|
323
|
+
onConfiguredOnce((conf) => {
|
|
324
|
+
var _a;
|
|
325
|
+
tamaguiConfig = conf;
|
|
326
|
+
initialTheme = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]];
|
|
327
|
+
const next = getSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, true);
|
|
328
|
+
if (isWeb) {
|
|
329
|
+
if (next.classNames) {
|
|
330
|
+
defaultsClassName += next.classNames + " ";
|
|
331
|
+
}
|
|
332
|
+
defaultsClassName += addStylesUsingClassname([next.style, next.pseudos]);
|
|
333
|
+
} else {
|
|
334
|
+
console.log("we need to account for default styles for media queries", next);
|
|
335
|
+
}
|
|
336
|
+
component.defaultProps = {
|
|
337
|
+
...next.viewProps,
|
|
338
|
+
...component.defaultProps
|
|
339
|
+
};
|
|
340
|
+
if (process.env.NODE_ENV === "development") {
|
|
341
|
+
if ((_a = staticConfig.defaultProps) == null ? void 0 : _a.debug) {
|
|
342
|
+
console.log("tamagui debug component:", next, defaultsClassName, component.defaultProps);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
component["staticConfig"] = {
|
|
347
|
+
validStyles: validStyleProps,
|
|
348
|
+
...staticConfig
|
|
349
|
+
};
|
|
350
|
+
const res = component;
|
|
351
|
+
res["extractable"] = (Component2) => {
|
|
352
|
+
Component2["staticConfig"] = extendStaticConfig(res, {
|
|
353
|
+
neverFlatten: true,
|
|
354
|
+
defaultProps: Component2.defaultProps
|
|
355
|
+
});
|
|
356
|
+
return Component2;
|
|
357
|
+
};
|
|
358
|
+
return res;
|
|
359
|
+
}
|
|
360
|
+
__name(createComponent, "createComponent");
|
|
361
|
+
const Spacer = createComponent({
|
|
362
|
+
defaultProps: stackDefaultStyles,
|
|
363
|
+
variants: {
|
|
364
|
+
size: {
|
|
365
|
+
"...size": (size, { tokens }) => {
|
|
366
|
+
var _a, _b;
|
|
367
|
+
return {
|
|
368
|
+
width: (_a = tokens.size[size]) != null ? _a : size,
|
|
369
|
+
height: (_b = tokens.size[size]) != null ? _b : size
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
direction: {
|
|
374
|
+
horizontal: {
|
|
375
|
+
height: 0
|
|
376
|
+
},
|
|
377
|
+
vertical: {
|
|
378
|
+
width: 0
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
function spacedChildren({
|
|
384
|
+
children,
|
|
385
|
+
space,
|
|
386
|
+
flexDirection
|
|
387
|
+
}) {
|
|
388
|
+
var _a, _b;
|
|
389
|
+
if (!space) {
|
|
390
|
+
return children;
|
|
391
|
+
}
|
|
392
|
+
const childrenList = Children.toArray(children);
|
|
393
|
+
const len = childrenList.length;
|
|
394
|
+
if (len === 1) {
|
|
395
|
+
return children;
|
|
396
|
+
}
|
|
397
|
+
const next = [];
|
|
398
|
+
for (const [index, child] of childrenList.entries()) {
|
|
399
|
+
if (child === null || child === void 0) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
const key = `${(_a = child == null ? void 0 : child["key"]) != null ? _a : index}`;
|
|
403
|
+
next.push(/* @__PURE__ */ React.createElement(Fragment, {
|
|
404
|
+
key
|
|
405
|
+
}, child));
|
|
406
|
+
if ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isVisuallyHidden"]) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (index === len - 1) {
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
next.push(/* @__PURE__ */ React.createElement(Spacer, {
|
|
413
|
+
key: `${key}_spacer`,
|
|
414
|
+
direction: flexDirection === "row" || flexDirection === "row-reverse" ? "horizontal" : "vertical",
|
|
415
|
+
size: space
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
return next;
|
|
419
|
+
}
|
|
420
|
+
__name(spacedChildren, "spacedChildren");
|
|
421
|
+
export {
|
|
422
|
+
Spacer,
|
|
423
|
+
createComponent,
|
|
424
|
+
mouseUps,
|
|
425
|
+
spacedChildren
|
|
426
|
+
};
|
|
427
|
+
//# 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 { Text, View, ViewStyle } from 'react-native'\n\nimport { stackDefaultStyles } from './constants/constants'\nimport { isTouchDevice, isWeb } from './constants/platform'\nimport { rnw } from './constants/rnw'\nimport { onConfiguredOnce } from './createTamagui'\nimport { addStylesUsingClassname } from './helpers/addStylesUsingClassname'\nimport { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig'\nimport { getSplitStyles } from './helpers/getSplitStyles'\nimport { useFeatures } from './hooks/useFeatures'\nimport { useForceUpdate } from './hooks/useForceUpdate'\nimport { usePressable } from './hooks/usePressable'\nimport { StaticComponent, StaticConfig, StaticConfigParsed, TamaguiInternalConfig } from './types'\nimport { TextAncestorContext } from './views/TextAncestorContext'\nimport { ThemeManagerContext } from './views/ThemeManagerContext'\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 { 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 defaultProps = null as any\n let tamaguiConfig: TamaguiInternalConfig\n\n // web uses className, native uses style\n let defaultsStyle: any\n let defaultsClassName = ''\n let initialTheme: any\n\n // see onConfiguredOnce below which attaches a name then to this component\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 space,\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 = (next: Partial<typeof state>) =>\n set_((prev) => {\n for (const key in next) {\n if (prev[key] !== next[key]) {\n return { ...prev, ...next }\n }\n }\n return prev\n })\n\n // from react-native-web\n if (process.env.NODE_ENV === 'development' && !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 const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false\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 const { viewProps, pseudos, style, classNames } = getSplitStyles(\n props,\n staticConfig,\n (manager.theme as any) || initialTheme\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 // element\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 const ViewComponent = isText ? ReactText : ReactView\n\n // styles\n const isHovering = !isTouchDevice && !disabled && pseudos && state.hover\n const isPressing = !disabled && pseudos && state.press\n\n const styles = [\n // parity w react-native-web, only for text in text\n // TODO this should be able to be done w css to replicate after extraction:\n // (.text .text { display: inline-flex; }) (but if they set display we'd need stronger precendence)\n // isText && hasTextAncestor && isWeb ? { display: 'inline-flex' } : null,\n style,\n isHovering ? pseudos.hoverStyle || null : null,\n isPressing ? pseudos.pressStyle || null : null,\n ]\n\n if (isWeb) {\n const stylesClassNames = addStylesUsingClassname(styles)\n const classList = staticConfig.isText\n ? [\n defaultsClassName,\n // hasTextAncestor === true && cssText.textHasAncestor,\n // TODO MOVE TO VARIANTS [number] [any]\n // numberOfLines != null && numberOfLines > 1 && cssText.textMultiLine,\n classNames,\n stylesClassNames,\n props.className,\n ]\n : [defaultsClassName, props.className, classNames, stylesClassNames]\n const classListFlat = classList.flat(1).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('\uD83E\uDD5A className', { style, styles, stylesClassNames, classListFlat: classListFlat.split(' '), className })\n }\n }\n viewProps.className = className\n } else {\n viewProps.style = styles\n }\n\n if (pointerEvents) {\n viewProps.pointerEvents = pointerEvents\n }\n\n if (isWeb) {\n // from react-native-web\n const platformMethodsRef = rnw.usePlatformMethods(viewProps)\n const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef)\n viewProps.ref = setRef\n if (props.href != null && hrefAttrs != null) {\n const { download, rel, target } = hrefAttrs\n if (download != null) {\n viewProps.download = download\n }\n if (rel != null) {\n viewProps.rel = rel\n }\n if (typeof target === 'string') {\n viewProps.target = target.charAt(0) !== '_' ? '_' + target : target\n }\n }\n } else {\n if (forwardedRef) {\n viewProps.ref = forwardedRef\n }\n }\n\n const attachPress = !!(\n (pseudos && pseudos.pressStyle) ||\n onPress ||\n onPressOut ||\n onPressIn ||\n onClick\n )\n const attachHover =\n isWeb &&\n !isTouchDevice &&\n !!((pseudos && pseudos.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 'onClick' 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 // this caused issue with next.js passing href\n // e.preventDefault()\n onPress?.(e)\n onClick?.(e)\n unPress()\n onPressOut?.(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: events.onClick,\n })\n Object.assign(viewProps, pressProps)\n } else {\n Object.assign(viewProps, events)\n }\n }\n\n const spacedChildrenEl = spacedChildren({\n children,\n space,\n flexDirection: props.flexDirection || defaultProps?.flexDirection,\n })\n\n let content: any\n\n // replicate react-native-web's `createElement`\n if (isWeb && rnw) {\n const domProps = rnw.createDOMProps(viewProps)\n const className =\n domProps.className && domProps.className !== viewProps.className\n ? `${domProps.className} ${viewProps.className}`\n : viewProps.className\n Object.assign(viewProps, domProps)\n viewProps.className = className\n content = createElement(ViewComponent, viewProps, spacedChildrenEl)\n } else {\n content = createElement(ViewComponent, viewProps, spacedChildrenEl)\n }\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 viewProps['debug'] = true\n console.log('\uD83E\uDD5A props in:', props)\n console.log('\uD83E\uDD5A props out:', viewProps)\n console.log(props.onClick?.toString())\n // prettier-ignore\n console.log('\uD83E\uDD5A etc:', { shouldAttach, ViewComponent, viewProps, styles, pseudos, content, spacedChildrenEl })\n // only on browser because node expands it huge\n if (isWeb) {\n console.log('\uD83E\uDD5A component info', { staticConfig, tamaguiConfig })\n }\n }\n }\n\n return (\n <>\n {features}\n {content}\n </>\n )\n })\n\n // Once configuration is run and all components are registered\n // get default props + className and analyze styles\n onConfiguredOnce((conf) => {\n tamaguiConfig = conf\n initialTheme = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]\n const next = getSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, true)\n if (isWeb) {\n if (next.classNames) {\n defaultsClassName += next.classNames + ' '\n }\n defaultsClassName += addStylesUsingClassname([next.style, next.pseudos])\n } else {\n console.log('we need to account for default styles for media queries', next)\n }\n // @ts-ignore\n component.defaultProps = {\n ...next.viewProps,\n ...component.defaultProps,\n }\n if (process.env.NODE_ENV === 'development') {\n if (staticConfig.defaultProps?.debug) {\n console.log('tamagui debug component:', next, defaultsClassName, component.defaultProps)\n }\n }\n })\n\n component['staticConfig'] = {\n validStyles: validStyleProps,\n ...staticConfig,\n }\n\n const res = component as any as StaticComponent<A, void>\n\n // add extractable HoC\n res['extractable'] = (Component: any) => {\n Component['staticConfig'] = extendStaticConfig(res, {\n neverFlatten: true,\n defaultProps: Component.defaultProps,\n })\n return Component\n }\n\n return res\n}\n\n// dont used styled() here to avoid circular deps\n// keep inline to avoid circular deps\n\nexport const Spacer = createComponent<{ size?: number; flex?: boolean | number }>({\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 space,\n flexDirection,\n}: {\n children: any\n space?: any\n flexDirection?: ViewStyle['flexDirection']\n}) {\n if (!space) {\n return children\n }\n const childrenList = Children.toArray(children)\n const len = childrenList.length\n if (len === 1) {\n return children\n }\n const next: any[] = []\n for (const [index, child] of childrenList.entries()) {\n if (child === null || child === undefined) {\n continue\n }\n\n const key = `${child?.['key'] ?? index}`\n next.push(<Fragment key={key}>{child}</Fragment>)\n\n // allows for custom visually hidden components that dont insert spacing\n if (child?.['type']?.['isVisuallyHidden']) {\n continue\n }\n\n if (index === len - 1) {\n break\n }\n\n next.push(\n <Spacer\n key={`${key}_spacer`}\n // @ts-ignore TODO\n direction={\n flexDirection === 'row' || flexDirection === 'row-reverse' ? 'horizontal' : 'vertical'\n }\n size={space}\n />\n )\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;AAEA;AACA;AAEO,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,QAAM,EAAE,WAAW,aAAa,WAAW;AAC3C,QAAM,kBAAkB,oCAAe;AAGvC,MAAI,eAAe;AACnB,MAAI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AAGF,SAAK,KACH,oCAAC,QAAD;AAAA,MACE,KAAK,GAAG;AAAA,MAER,WACE,kBAAkB,SAAS,kBAAkB,gBAAgB,eAAe;AAAA,MAE9E,MAAM;AAAA;AAAA;AAIZ,SAAO;AAAA;AA9CO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function createShorthands(shorthands) {
|
|
4
|
+
return Object.freeze(shorthands);
|
|
5
|
+
}
|
|
6
|
+
__name(createShorthands, "createShorthands");
|
|
7
|
+
export {
|
|
8
|
+
createShorthands
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=createShorthands.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createShorthands.ts"],
|
|
4
|
+
"sourcesContent": ["// 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": ";;AAEO,0BAA4D,YAAkB;AACnF,SAAO,OAAO,OAAO;AAAA;AADP;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|