@tamagui/core 1.0.0-alpha.10 → 1.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.js +2 -1
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +2 -0
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createVariable.js +1 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +20 -13
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +4 -2
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Text.js +2 -2
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/Theme.js +15 -12
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/{constants → esm/constants}/constants.js +0 -0
- package/dist/{constants → esm/constants}/constants.js.map +1 -1
- package/dist/{constants → esm/constants}/platform.js +0 -0
- package/dist/{constants → esm/constants}/platform.js.map +1 -1
- package/dist/{constants → esm/constants}/pseudos.js +0 -0
- package/dist/{constants → esm/constants}/pseudos.js.map +1 -1
- package/dist/{constants → esm/constants}/rnw.js +0 -0
- package/dist/{constants → esm/constants}/rnw.js.map +1 -1
- package/dist/{createComponent.js → esm/createComponent.js} +2 -1
- package/dist/esm/createComponent.js.map +7 -0
- package/dist/{createFont.js → esm/createFont.js} +0 -0
- package/dist/{createFont.js.map → esm/createFont.js.map} +1 -1
- package/dist/{createShorthands.js → esm/createShorthands.js} +0 -0
- package/dist/{createShorthands.js.map → esm/createShorthands.js.map} +1 -1
- package/dist/{createTamagui.js → esm/createTamagui.js} +2 -0
- package/dist/esm/createTamagui.js.map +7 -0
- package/dist/{createTheme.js → esm/createTheme.js} +0 -0
- package/dist/{createTheme.js.map → esm/createTheme.js.map} +1 -1
- package/dist/{createTokens.js → esm/createTokens.js} +0 -0
- package/dist/{createTokens.js.map → esm/createTokens.js.map} +1 -1
- package/dist/{createVariable.js → esm/createVariable.js} +1 -1
- package/dist/{createVariable.js.map → esm/createVariable.js.map} +3 -3
- package/dist/{helpers → esm/helpers}/addStylesUsingClassname.js +0 -0
- package/dist/{helpers → esm/helpers}/addStylesUsingClassname.js.map +1 -1
- package/dist/{helpers → esm/helpers}/createMediaStyle.js +0 -0
- package/dist/{helpers → esm/helpers}/createMediaStyle.js.map +1 -1
- package/dist/{helpers → esm/helpers}/createPropMapper.js +14 -7
- package/dist/esm/helpers/createPropMapper.js.map +7 -0
- package/dist/{helpers → esm/helpers}/createTamaguiProvider.js +0 -0
- package/dist/{helpers → esm/helpers}/createTamaguiProvider.js.map +1 -1
- package/dist/{helpers → esm/helpers}/extendStaticConfig.js +0 -0
- package/dist/{helpers → esm/helpers}/extendStaticConfig.js.map +1 -1
- package/dist/{helpers → esm/helpers}/fixNativeShadow.js +0 -0
- package/dist/{helpers → esm/helpers}/fixNativeShadow.js.map +1 -1
- package/dist/{helpers → esm/helpers}/fixNativeShadow.native.js +0 -0
- package/dist/{helpers → esm/helpers}/fixNativeShadow.native.js.map +1 -1
- package/dist/{helpers → esm/helpers}/getSplitStyles.js +0 -0
- package/dist/{helpers → esm/helpers}/getSplitStyles.js.map +1 -1
- package/dist/{helpers → esm/helpers}/getStylesAtomic.js +0 -0
- package/dist/{helpers → esm/helpers}/getStylesAtomic.js.map +1 -1
- package/dist/{helpers → esm/helpers}/getStylesAtomic.native.js +0 -0
- package/dist/{helpers → esm/helpers}/getStylesAtomic.native.js.map +1 -1
- package/dist/{helpers → esm/helpers}/insertStyleRule.js +0 -0
- package/dist/{helpers → esm/helpers}/insertStyleRule.js.map +1 -1
- package/dist/{helpers → esm/helpers}/isObj.js +0 -0
- package/dist/{helpers → esm/helpers}/isObj.js.map +1 -1
- package/dist/{helpers → esm/helpers}/isTamaguiElement.js +0 -0
- package/dist/{helpers → esm/helpers}/isTamaguiElement.js.map +1 -1
- package/dist/{helpers → esm/helpers}/matchMedia.js +0 -0
- package/dist/{helpers → esm/helpers}/matchMedia.js.map +1 -1
- package/dist/{helpers → esm/helpers}/matchMedia.native.js +0 -0
- package/dist/{helpers → esm/helpers}/matchMedia.native.js.map +1 -1
- package/dist/{helpers → esm/helpers}/themeable.js +0 -0
- package/dist/{helpers → esm/helpers}/themeable.js.map +1 -1
- package/dist/{helpers → esm/helpers}/validate.js +0 -0
- package/dist/{helpers → esm/helpers}/validate.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useConstant.js +0 -0
- package/dist/{hooks → esm/hooks}/useConstant.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useFeatures.js +0 -0
- package/dist/{hooks → esm/hooks}/useFeatures.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useMedia.js +4 -2
- package/dist/esm/hooks/useMedia.js.map +7 -0
- package/dist/{hooks → esm/hooks}/usePressable.js +0 -0
- package/dist/{hooks → esm/hooks}/usePressable.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useTheme.js +0 -0
- package/dist/{hooks → esm/hooks}/useTheme.js.map +1 -1
- package/dist/{index.js → esm/index.js} +0 -0
- package/dist/{index.js.map → esm/index.js.map} +1 -1
- package/dist/{static → esm/static}/postProcessStyles.js +0 -0
- package/dist/{static → esm/static}/postProcessStyles.js.map +1 -1
- package/dist/{static.js → esm/static.js} +0 -0
- package/dist/{static.js.map → esm/static.js.map} +1 -1
- package/dist/{styled.js → esm/styled.js} +0 -0
- package/dist/{styled.js.map → esm/styled.js.map} +1 -1
- package/dist/{types.js → esm/types.js} +0 -0
- package/dist/{types.js.map → esm/types.js.map} +0 -0
- package/dist/{views → esm/views}/Animated.js +0 -0
- package/dist/{views → esm/views}/Animated.js.map +1 -1
- package/dist/{views → esm/views}/Stack.js +0 -0
- package/dist/{views → esm/views}/Stack.js.map +1 -1
- package/dist/{views → esm/views}/Text.js +1 -1
- package/dist/esm/views/Text.js.map +7 -0
- package/dist/{views → esm/views}/TextAncestorContext.js +0 -0
- package/dist/{views → esm/views}/TextAncestorContext.js.map +1 -1
- package/dist/{views → esm/views}/Theme.js +15 -12
- package/dist/esm/views/Theme.js.map +7 -0
- package/dist/{views → esm/views}/ThemeContext.js +0 -0
- package/dist/{views → esm/views}/ThemeContext.js.map +1 -1
- package/dist/{views → esm/views}/ThemeInverse.js +0 -0
- package/dist/{views → esm/views}/ThemeInverse.js.map +1 -1
- package/dist/{views → esm/views}/ThemeManagerContext.js +0 -0
- package/dist/{views → esm/views}/ThemeManagerContext.js.map +1 -1
- package/dist/{views → esm/views}/ThemeProvider.js +0 -0
- package/dist/{views → esm/views}/ThemeProvider.js.map +1 -1
- package/dist/jsx/constants/constants.js +13 -0
- package/dist/jsx/constants/platform.js +18 -0
- package/dist/jsx/constants/pseudos.js +17 -0
- package/dist/jsx/constants/rnw.js +21 -0
- package/dist/jsx/createComponent.js +458 -0
- package/dist/jsx/createFont.js +27 -0
- package/dist/jsx/createShorthands.js +9 -0
- package/dist/jsx/createTamagui.js +169 -0
- package/dist/jsx/createTheme.js +19 -0
- package/dist/jsx/createTokens.js +32 -0
- package/dist/jsx/createVariable.js +24 -0
- package/dist/jsx/helpers/addStylesUsingClassname.js +56 -0
- package/dist/jsx/helpers/createMediaStyle.js +33 -0
- package/dist/jsx/helpers/createPropMapper.js +159 -0
- package/dist/jsx/helpers/createTamaguiProvider.js +19 -0
- package/dist/jsx/helpers/extendStaticConfig.js +58 -0
- package/dist/jsx/helpers/fixNativeShadow.js +7 -0
- package/dist/jsx/helpers/fixNativeShadow.native.js +29 -0
- package/dist/jsx/helpers/getSplitStyles.js +149 -0
- package/dist/jsx/helpers/getStylesAtomic.js +82 -0
- package/dist/jsx/helpers/getStylesAtomic.native.js +9 -0
- package/dist/jsx/helpers/insertStyleRule.js +23 -0
- package/dist/jsx/helpers/isObj.js +6 -0
- package/dist/{helpers/isTamaguiComponent.js → jsx/helpers/isTamaguiElement.js} +3 -4
- package/dist/jsx/helpers/matchMedia.js +17 -0
- package/dist/jsx/helpers/matchMedia.native.js +8 -0
- package/dist/jsx/helpers/themeable.js +23 -0
- package/dist/{helpers/validateConfig.js → jsx/helpers/validate.js} +35 -22
- package/dist/jsx/hooks/useConstant.js +14 -0
- package/dist/jsx/hooks/useFeatures.js +57 -0
- package/dist/jsx/hooks/useMedia.js +172 -0
- package/dist/jsx/hooks/usePressable.js +12 -0
- package/dist/jsx/hooks/useTheme.js +88 -0
- package/dist/jsx/index.js +31 -0
- package/dist/jsx/static/postProcessStyles.js +17 -0
- package/dist/jsx/static.js +14 -0
- package/dist/jsx/styled.js +20 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Animated.js +74 -0
- package/dist/jsx/views/Stack.js +11 -0
- package/dist/jsx/views/Text.js +59 -0
- package/dist/jsx/views/TextAncestorContext.js +14 -0
- package/dist/jsx/views/Theme.js +62 -0
- package/dist/jsx/views/ThemeContext.js +5 -0
- package/dist/jsx/views/ThemeInverse.js +22 -0
- package/dist/jsx/views/ThemeManagerContext.js +60 -0
- package/dist/jsx/views/ThemeProvider.js +39 -0
- package/package.json +10 -11
- package/src/createComponent.tsx +4 -2
- package/src/createTamagui.ts +1 -0
- package/src/createVariable.ts +1 -1
- package/src/helpers/createPropMapper.ts +14 -6
- package/src/hooks/useMedia.tsx +5 -3
- package/src/types.tsx +6 -6
- package/src/views/Text.tsx +2 -1
- package/src/views/Theme.tsx +24 -20
- package/{dist/packages/core/src → types}/constants/constants.d.ts +0 -0
- package/types/constants/constants.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/platform.d.ts +0 -0
- package/types/constants/platform.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/pseudos.d.ts +0 -0
- package/types/constants/pseudos.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/rnw.d.ts +0 -0
- package/types/constants/rnw.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createComponent.d.ts +3 -2
- package/types/createComponent.d.ts.map +1 -0
- package/types/createFont.d.ts +3 -0
- package/types/createFont.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createShorthands.d.ts +0 -0
- package/types/createShorthands.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTamagui.d.ts +18 -1
- package/types/createTamagui.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTheme.d.ts +0 -0
- package/types/createTheme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTokens.d.ts +24 -14
- package/types/createTokens.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createVariable.d.ts +1 -0
- package/types/createVariable.d.ts.map +1 -0
- package/types/helpers/addStylesUsingClassname.d.ts +3 -0
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/createMediaStyle.d.ts +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -0
- package/types/helpers/createPropMapper.d.ts +3 -0
- package/types/helpers/createPropMapper.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/createTamaguiProvider.d.ts +0 -0
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/extendStaticConfig.d.ts +1 -1
- package/types/helpers/extendStaticConfig.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/fixNativeShadow.d.ts +0 -0
- package/types/helpers/fixNativeShadow.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/fixNativeShadow.native.d.ts +0 -0
- package/types/helpers/fixNativeShadow.native.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getSplitStyles.d.ts +0 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getStylesAtomic.d.ts +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getStylesAtomic.native.d.ts +0 -0
- package/types/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/insertStyleRule.d.ts +0 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -0
- package/types/helpers/isObj.d.ts +2 -0
- package/types/helpers/isObj.d.ts.map +1 -0
- package/types/helpers/isTamaguiElement.d.ts +3 -0
- package/types/helpers/isTamaguiElement.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/matchMedia.d.ts +0 -0
- package/types/helpers/matchMedia.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/matchMedia.native.d.ts +0 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/themeable.d.ts +0 -0
- package/types/helpers/themeable.d.ts.map +1 -0
- package/types/helpers/validate.d.ts +4 -0
- package/types/helpers/validate.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useConstant.d.ts +0 -0
- package/types/hooks/useConstant.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useFeatures.d.ts +0 -0
- package/types/hooks/useFeatures.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useMedia.d.ts +0 -0
- package/types/hooks/useMedia.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/usePressable.d.ts +0 -0
- package/types/hooks/usePressable.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useTheme.d.ts +3 -1
- package/types/hooks/useTheme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/index.d.ts +3 -1
- package/types/index.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/static/postProcessStyles.d.ts +0 -0
- package/types/static/postProcessStyles.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/static.d.ts +3 -0
- package/types/static.d.ts.map +1 -0
- package/types/styled.d.ts +21 -0
- package/types/styled.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/types.d.ts +71 -70
- package/types/types.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/Animated.d.ts +0 -0
- package/types/views/Animated.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/Stack.d.ts +0 -0
- package/types/views/Stack.d.ts.map +1 -0
- package/types/views/Text.d.ts +3 -0
- package/types/views/Text.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/TextAncestorContext.d.ts +0 -0
- package/types/views/TextAncestorContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/Theme.d.ts +1 -1
- package/types/views/Theme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeContext.d.ts +0 -0
- package/types/views/ThemeContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeInverse.d.ts +0 -0
- package/types/views/ThemeInverse.d.ts.map +1 -0
- package/types/views/ThemeManagerContext.d.ts +22 -0
- package/types/views/ThemeManagerContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeProvider.d.ts +0 -0
- package/types/views/ThemeProvider.d.ts.map +1 -0
- package/dist/constants/styleConstants.js +0 -46
- package/dist/constants/styleConstants.js.map +0 -7
- package/dist/createComponent.js.map +0 -7
- package/dist/createTamagui.js.map +0 -7
- package/dist/helpers/createPropMapper.js.map +0 -7
- package/dist/helpers/isComponent.js +0 -10
- package/dist/helpers/isComponent.js.map +0 -7
- package/dist/helpers/isTamaguiComponent.js.map +0 -7
- package/dist/helpers/pseudos.js +0 -1
- package/dist/helpers/pseudos.js.map +0 -7
- package/dist/helpers/validateConfig.js.map +0 -7
- package/dist/helpers/validateTokens.js +0 -29
- package/dist/helpers/validateTokens.js.map +0 -7
- package/dist/hooks/useForceUpdate.js +0 -28
- package/dist/hooks/useForceUpdate.js.map +0 -7
- package/dist/hooks/useMedia.js.map +0 -7
- package/dist/index.cjs +0 -2202
- package/dist/index.cjs.map +0 -7
- package/dist/packages/core/src/constants/constants.d.ts.map +0 -1
- package/dist/packages/core/src/constants/platform.d.ts.map +0 -1
- package/dist/packages/core/src/constants/pseudos.d.ts.map +0 -1
- package/dist/packages/core/src/constants/rnw.d.ts.map +0 -1
- package/dist/packages/core/src/createComponent.d.ts.map +0 -1
- package/dist/packages/core/src/createShorthands.d.ts.map +0 -1
- package/dist/packages/core/src/createTamagui.d.ts.map +0 -1
- package/dist/packages/core/src/createTheme.d.ts.map +0 -1
- package/dist/packages/core/src/createTokens.d.ts.map +0 -1
- package/dist/packages/core/src/createVariable.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts +0 -2
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/themeable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useConstant.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useFeatures.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts +0 -2
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useMedia.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/usePressable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useTheme.d.ts.map +0 -1
- package/dist/packages/core/src/index.d.ts.map +0 -1
- package/dist/packages/core/src/static/postProcessStyles.d.ts.map +0 -1
- package/dist/packages/core/src/static.d.ts.map +0 -1
- package/dist/packages/core/src/styled.d.ts +0 -16
- package/dist/packages/core/src/styled.d.ts.map +0 -1
- package/dist/packages/core/src/types.d.ts.map +0 -1
- package/dist/packages/core/src/views/Animated.d.ts.map +0 -1
- package/dist/packages/core/src/views/Stack.d.ts.map +0 -1
- package/dist/packages/core/src/views/Text.d.ts +0 -3
- package/dist/packages/core/src/views/Text.d.ts.map +0 -1
- package/dist/packages/core/src/views/TextAncestorContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/Theme.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeInverse.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts +0 -15
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeProvider.d.ts.map +0 -1
- package/dist/packages/helpers/src/AllRules.d.ts +0 -3
- package/dist/packages/helpers/src/AllRules.d.ts.map +0 -1
- package/dist/packages/helpers/src/concatClassName.d.ts +0 -2
- package/dist/packages/helpers/src/concatClassName.d.ts.map +0 -1
- package/dist/packages/helpers/src/index.d.ts +0 -5
- package/dist/packages/helpers/src/index.d.ts.map +0 -1
- package/dist/packages/helpers/src/types.d.ts +0 -8
- package/dist/packages/helpers/src/types.d.ts.map +0 -1
- package/dist/packages/helpers/src/validStyleProps.d.ts +0 -475
- package/dist/packages/helpers/src/validStyleProps.d.ts.map +0 -1
- package/dist/views/SafeAreaProvider.js +0 -30
- package/dist/views/SafeAreaProvider.js.map +0 -7
- package/dist/views/Text.js.map +0 -7
- package/dist/views/Theme.js.map +0 -7
- package/types.d.ts +0 -559
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/insertStyleRule.tsx"],
|
|
4
4
|
"sourcesContent": ["import { isWeb } from '../constants/platform'\n\nexport function insertStyleRule(rule: string) {\n if (typeof window === 'undefined') {\n return\n }\n if (process.env.NODE_ENV === 'development') {\n if (!isWeb) {\n console.warn('non web platform, dont use this')\n return\n }\n }\n const sheet = window.document.styleSheets[0]\n if (!sheet) {\n return\n }\n sheet.insertRule(rule, sheet.cssRules.length)\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEO,yBAAyB,MAAc;AAC5C,MAAI,OAAO,WAAW,aAAa;AACjC;AAAA;AAEF,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,OAAO;AACV,cAAQ,KAAK;AACb;AAAA;AAAA;AAGJ,QAAM,QAAQ,OAAO,SAAS,YAAY;AAC1C,MAAI,CAAC,OAAO;AACV;AAAA;AAEF,QAAM,WAAW,MAAM,MAAM,SAAS;AAAA;AAdxB;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/isObj.ts"],
|
|
4
4
|
"sourcesContent": ["export const isObj = (x: any) => x && !Array.isArray(x) && typeof x === 'object'\n"],
|
|
5
5
|
"mappings": ";;AAAO,MAAM,QAAQ,wBAAC,MAAW,KAAK,CAAC,MAAM,QAAQ,MAAM,OAAO,MAAM,UAAnD;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/isTamaguiElement.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { isValidElement } from 'react'\n\nexport const isTamaguiElement = (child: any): child is React.ReactElement => {\n return isValidElement(child) && !!child.type['staticConfig']?.parsed\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEO,MAAM,mBAAmB,wBAAC,UAA4C;AAC3E,SAAO,eAAe,UAAU,CAAC,CAAC,MAAM,KAAK,iBAAiB;AAAA,GADhC;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/matchMedia.ts"],
|
|
4
4
|
"sourcesContent": ["export const matchMedia =\n (typeof window !== 'undefined' && window.matchMedia) ||\n (function matchMediaFallback(query: string) {\n return {\n addListener() {\n if (\n process.env.NODE_ENV === 'development' &&\n !process.env.IS_STATIC &&\n process.env.TAMAGUI_TARGET !== 'web'\n ) {\n console.log('warning: matchMedia not loading! Is native picking up .native.js files?')\n }\n },\n removeListener() {},\n matches: false,\n }\n } as any)\n"],
|
|
5
5
|
"mappings": ";;AAAO,MAAM,aACV,OAAO,WAAW,eAAe,OAAO,cACxC,mDAA4B,OAAe;AAC1C,SAAO;AAAA,IACL,cAAc;AACZ,UACE,QAAQ,IAAI,aAAa,iBACzB,CAAC,QAAQ,IAAI,aACb,QAAQ,IAAI,mBAAmB,OAC/B;AACA,gBAAQ,IAAI;AAAA;AAAA;AAAA,IAGhB,iBAAiB;AAAA;AAAA,IACjB,SAAS;AAAA;AAAA,GAZZ;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/matchMedia.native.ts"],
|
|
4
4
|
"sourcesContent": ["import MediaQueryList from '@expo/match-media/build/MediaQueryList.js'\n\nexport const matchMedia = (media: string) => new MediaQueryList(media)\n\n// @ts-ignore\nglobalThis['matchMedia'] = matchMedia\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEO,MAAM,aAAa,wBAAC,UAAkB,IAAI,eAAe,QAAtC;AAG1B,WAAW,gBAAgB;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/themeable.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { ReactElement, forwardRef } from 'react'\n\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: string | null\n themeInverse?: boolean\n}\n\nexport const themeable: ThemeableHOC = function graphql<\n R extends ReactElement<any, any> | null,\n P extends ThemeableProps = {}\n>(component: (props: P) => R) {\n const withThemeComponent = forwardRef(function WithTheme({ themeInverse, ...rest }: P, ref) {\n const el = React.createElement(component, { ...rest, ref } as any) as R\n if (themeInverse) {\n return (<ThemeInverse>{el}</ThemeInverse>) as R\n }\n if (rest.theme) {\n return (<Theme name={rest.theme || null}>{el}</Theme>) as R\n }\n return el\n })\n\n const withTheme: {\n (props: P): R\n displayName: string\n } = withThemeComponent as any\n\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme\n}\n\nexport interface ThemeableHOC {\n <R extends ReactElement<any, any> | null, P extends ThemeableProps = {}>(\n component: (props: P) => R\n ): (props: P) => R\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA;AACA;AAOO,MAAM,YAA0B,wCAGrC,WAA4B;AAC5B,QAAM,qBAAqB,WAAW,0CAAmB,EAAE,iBAAiB,QAAW,KAAK;AAC1F,UAAM,KAAK,MAAM,cAAc,WAAW,KAAK,MAAM;AACrD,QAAI,cAAc;AAChB,aAAQ,oCAAC,cAAD,MAAe;AAAA;AAEzB,QAAI,KAAK,OAAO;AACd,aAAQ,oCAAC,OAAD;AAAA,QAAO,MAAM,KAAK,SAAS;AAAA,SAAO;AAAA;AAE5C,WAAO;AAAA,KAR6B;AAWtC,QAAM,YAGF;AAEJ,YAAU,cAAc,UACrB,WAAmB,eAAgB,WAAmB,QAAQ;AAGjE,SAAO;AAAA,GAxB8B;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/helpers/validate.ts"],
|
|
4
4
|
"sourcesContent": ["// published a patched version that works on native\nimport ow from '@tamagui/ow'\n\nexport const validateConfig = (conf: any) => {\n if (!conf) {\n console.warn('no conf?')\n return\n }\n try {\n ow(conf, validConfig)\n } catch (err: any) {\n console.log('Given config:\\n', JSON.stringify(conf, null, 2))\n throw err\n }\n}\n\nconst validConfig = ow.object.exactShape({\n defaultTheme: ow.optional.string,\n disableRootThemeClass: ow.optional.boolean,\n shorthands: ow.optional.object.valuesOfType(ow.string),\n themes: ow.object.valuesOfType(ow.object),\n tokens: ow.object.valuesOfType(ow.object),\n media: ow.object.valuesOfType(ow.object),\n})\n\nconst validFont = ow.object.exactShape({\n family: ow.string,\n size: ow.object.nonEmpty.valuesOfType(ow.number),\n lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),\n weight: ow.object.nonEmpty.valuesOfType(ow.string),\n letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number),\n})\n\nconst validTokens = ow.object.exactShape({\n font: ow.object.valuesOfType(validFont),\n size: ow.object.nonEmpty.valuesOfType(ow.number),\n space: ow.object.nonEmpty.valuesOfType(ow.number),\n zIndex: ow.object.nonEmpty.valuesOfType(ow.number),\n radius: ow.object.nonEmpty.valuesOfType(ow.number),\n color: ow.object.nonEmpty.valuesOfType(ow.string),\n})\n\nexport const validateTokens = (tokens: any) => {\n try {\n ow(tokens, validTokens)\n } catch (err: any) {\n console.log('Given tokens:\\n', JSON.stringify(tokens, null, 2))\n throw err\n }\n}\n\nexport const validateFont = (font: any) => {\n try {\n ow(font, validFont)\n } catch (err: any) {\n console.log('Given font:\\n', JSON.stringify(font, null, 2))\n throw err\n }\n}\n"],
|
|
5
5
|
"mappings": ";;AACA;AAEO,MAAM,iBAAiB,wBAAC,SAAc;AAC3C,MAAI,CAAC,MAAM;AACT,YAAQ,KAAK;AACb;AAAA;AAEF,MAAI;AACF,OAAG,MAAM;AAAA,WACF,KAAP;AACA,YAAQ,IAAI,mBAAmB,KAAK,UAAU,MAAM,MAAM;AAC1D,UAAM;AAAA;AAAA,GAToB;AAa9B,MAAM,cAAc,GAAG,OAAO,WAAW;AAAA,EACvC,cAAc,GAAG,SAAS;AAAA,EAC1B,uBAAuB,GAAG,SAAS;AAAA,EACnC,YAAY,GAAG,SAAS,OAAO,aAAa,GAAG;AAAA,EAC/C,QAAQ,GAAG,OAAO,aAAa,GAAG;AAAA,EAClC,QAAQ,GAAG,OAAO,aAAa,GAAG;AAAA,EAClC,OAAO,GAAG,OAAO,aAAa,GAAG;AAAA;AAGnC,MAAM,YAAY,GAAG,OAAO,WAAW;AAAA,EACrC,QAAQ,GAAG;AAAA,EACX,MAAM,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EACzC,YAAY,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EAC/C,QAAQ,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EAC3C,eAAe,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA;AAGpD,MAAM,cAAc,GAAG,OAAO,WAAW;AAAA,EACvC,MAAM,GAAG,OAAO,aAAa;AAAA,EAC7B,MAAM,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EACzC,OAAO,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EAC1C,QAAQ,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EAC3C,QAAQ,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA,EAC3C,OAAO,GAAG,OAAO,SAAS,aAAa,GAAG;AAAA;AAGrC,MAAM,iBAAiB,wBAAC,WAAgB;AAC7C,MAAI;AACF,OAAG,QAAQ;AAAA,WACJ,KAAP;AACA,YAAQ,IAAI,mBAAmB,KAAK,UAAU,QAAQ,MAAM;AAC5D,UAAM;AAAA;AAAA,GALoB;AASvB,MAAM,eAAe,wBAAC,SAAc;AACzC,MAAI;AACF,OAAG,MAAM;AAAA,WACF,KAAP;AACA,YAAQ,IAAI,iBAAiB,KAAK,UAAU,MAAM,MAAM;AACxD,UAAM;AAAA;AAAA,GALkB;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/hooks/useConstant.tsx"],
|
|
4
4
|
"sourcesContent": ["import { useRef } from 'react'\n\ntype ResultBox<T> = { v: T }\nexport function useConstant<T>(fn: () => T): T {\n const ref = useRef<ResultBox<T>>()\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n return ref.current.v\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAGO,qBAAwB,IAAgB;AAC7C,QAAM,MAAM;AACZ,MAAI,CAAC,IAAI,SAAS;AAChB,QAAI,UAAU,EAAE,GAAG;AAAA;AAErB,SAAO,IAAI,QAAQ;AAAA;AALL;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/hooks/useFeatures.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: any\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\n\nexport const useFeatures = (props: any, utils?: { forceUpdate?: Function }) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const features: JSX.Element[] = []\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n features.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return features\n}\n\nfunction loadFeatures(): Record<string, FeatureDefinition> {\n return {\n // TODO\n // measureLayout: createDefinition({\n // Component: (props) => {\n // console.log('measure', props)\n // return null\n // },\n // propNames: ['onLayout'],\n // }),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n ...(!isWeb && {\n mediaQuery: loadMediaQueryFeature(),\n }),\n }\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const keys = mediaPropNames.flatMap((x) => (x in props ? x.slice(1) : []))\n\n useIsomorphicLayoutEffect(() => {\n for (const key of keys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of keys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [keys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA;AACA;AAOA,MAAM,mBAAmB,wBAAC;AAAA,EACxB;AAAA,EACA;AAAA,MAIwB;AAAA,EACxB,WAAW,CAAC,UAAe,UAAU,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM;AAAA,EAC5D;AAAA,IARuB;AAWzB,IAAI,qBAA+D;AAE5D,MAAM,cAAc,wBAAC,OAAY,UAAuC;AAC7E,MAAI,CAAC,oBAAoB;AACvB,yBAAqB;AAAA;AAEvB,QAAM,WAA0B;AAChC,aAAW,QAAQ,oBAAoB;AACrC,UAAM,EAAE,WAAW,cAAc,mBAAmB;AACpD,QAAI,UAAU,UAAU,WAAW;AACjC,eAAS,KAAK,oCAAC,WAAD;AAAA,QAAW,KAAK;AAAA,WAAU;AAAA,QAAO,QAAQ;AAAA;AAAA;AAAA;AAG3D,SAAO;AAAA,GAXkB;AAc3B,wBAA2D;AACzD,SAAO;AAAA,OAYD,CAAC,SAAS;AAAA,MACZ,YAAY;AAAA;AAAA;AAAA;AAdT;AAmBT,iCAAiC;AAC/B,QAAM,iBAAiB,OAAO,KAAK;AAEnC,SAAO,iBAAiB;AAAA,IACtB,WAAW,CAAC,UAAe;AACzB,YAAM,OAAO,eAAe,QAAQ,CAAC,MAAO,KAAK,QAAQ,EAAE,MAAM,KAAK;AAEtE,gCAA0B,MAAM;AAC9B,mBAAW,OAAO,MAAM;AACtB,gCAAsB,KAAK,MAAM,OAAO;AAAA;AAE1C,eAAO,MAAM;AACX,qBAAW,OAAO,MAAM;AACtB,qCAAyB,KAAK,MAAM,OAAO;AAAA;AAAA;AAAA,SAG9C,CAAC,KAAK,KAAK;AAEd,aAAO;AAAA;AAAA,IAET,WAAW;AAAA;AAAA;AApBN;",
|
|
6
6
|
"names": []
|
|
@@ -18,13 +18,15 @@ let conf = null;
|
|
|
18
18
|
const mediaQueryConfig = new Proxy({}, {
|
|
19
19
|
get(target, key) {
|
|
20
20
|
if (!conf) {
|
|
21
|
-
|
|
21
|
+
console.warn("Warning: accessing media query before init");
|
|
22
|
+
return null;
|
|
22
23
|
}
|
|
23
24
|
return Reflect.get(conf, key);
|
|
24
25
|
},
|
|
25
26
|
ownKeys() {
|
|
26
27
|
if (!conf) {
|
|
27
|
-
|
|
28
|
+
console.warn("Warning: accessing media query before init");
|
|
29
|
+
return [];
|
|
28
30
|
}
|
|
29
31
|
return Object.keys(conf);
|
|
30
32
|
},
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useMedia.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport { useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { matchMedia } from '../helpers/matchMedia'\nimport {\n ConfigureMediaQueryOptions,\n MediaQueries,\n MediaQueryObject,\n MediaQueryState,\n} from '../types'\nimport { useConstant } from './useConstant'\n\nexport const mediaState: { [key in keyof MediaQueryState]: boolean } = {} as any\nconst mediaQueryListeners: { [key: string]: Set<Function> } = {}\n\nexport const addMediaQueryListener = (key: string, cb: any) => {\n mediaQueryListeners[key] = mediaQueryListeners[key] || new Set()\n mediaQueryListeners[key].add(cb)\n}\n\nexport const removeMediaQueryListener = (key: string, cb: any) => {\n mediaQueryListeners[key].delete(cb)\n}\n\nlet conf: MediaQueries | null = null\n\nexport const mediaQueryConfig = new Proxy<MediaQueries>({} as any, {\n get(target, key) {\n if (!conf) {\n console.warn('Warning: accessing media query before init')\n return null\n }\n return Reflect.get(conf, key)\n },\n ownKeys() {\n if (!conf) {\n console.warn('Warning: accessing media query before init')\n return []\n }\n return Object.keys(conf)\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n }\n },\n})\n\nexport const getMedia = () => {\n if (!conf) {\n throw new Error(`not configured yet`)\n }\n return mediaState\n}\n\nexport const configureMedia = ({\n queries,\n defaultActive = ['sm', 'xs'],\n}: ConfigureMediaQueryOptions = {}) => {\n if (conf) {\n console.warn(\n `Already configured mediaQueries once (you may have called getMedia() before configureMedia())`\n )\n }\n\n if (queries) {\n conf = queries\n }\n\n // setup\n for (const key in queries) {\n const str = mediaObjectToString(queries[key])\n try {\n const getMatch = () => matchMedia(str)\n const match = getMatch()\n if (!match || typeof match.addListener !== 'function') {\n // caught below\n throw new Error('\u26A0\uFE0F No match (seeing this in RN sometimes)')\n }\n mediaState[key] = !!match.matches\n match.addListener(() => {\n const next = !!getMatch().matches\n if (next === mediaState[key]) return\n mediaState[key] = next\n const listeners = mediaQueryListeners[key]\n if (listeners?.size) {\n for (const cb of [...listeners]) {\n cb()\n }\n }\n })\n } catch (err: any) {\n console.error('Error running media query', str, err.message, err.stack)\n const isDefaultActive = defaultActive?.includes(key as any) ?? true\n mediaState[key] = isDefaultActive\n }\n }\n}\n\ntype UseMediaState = {\n selections: { [key: string]: boolean }\n nextSelections: { [key: string]: boolean }\n isRendering: boolean\n isUnmounted: boolean\n}\n\nexport const useMedia = () => {\n const forceUpdate = useForceUpdate()\n const state = useRef() as React.MutableRefObject<UseMediaState>\n if (!state.current) {\n state.current = {\n selections: {},\n nextSelections: {},\n isUnmounted: false,\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n // delete old\n for (const key in st.selections) {\n if (!(key in st.nextSelections)) {\n removeMediaQueryListener(key, forceUpdate)\n }\n }\n // add new\n for (const key in st.nextSelections) {\n if (!(key in st.selections)) {\n addMediaQueryListener(key, forceUpdate)\n }\n }\n })\n\n // unmount\n useIsomorphicLayoutEffect(() => {\n return () => {\n const st = state.current\n st.isUnmounted = true\n const allKeys = {\n ...st.selections,\n ...st.nextSelections,\n }\n for (const key in allKeys) {\n removeMediaQueryListener(key, forceUpdate)\n }\n }\n }, [])\n\n return useConstant(() => {\n const st = state.current\n return new Proxy(mediaState, {\n get(target, key: string) {\n if (!(key in mediaState)) {\n return Reflect.get(target, key)\n }\n if (!st.isUnmounted) {\n if (st.isRendering) {\n st.nextSelections[key] = true\n }\n }\n if (key in mediaState) {\n return mediaState[key]\n }\n return Reflect.get(mediaState, key)\n },\n })\n })\n}\n\nfunction camelToHyphen(str: string) {\n return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).toLowerCase()\n}\n\nexport function mediaObjectToString(query: string | MediaQueryObject) {\n if (typeof query === 'string') {\n return query\n }\n return Object.entries(query)\n .map(([feature, value]) => {\n feature = camelToHyphen(feature)\n if (typeof value === 'string') {\n return `(${feature}: ${value})`\n }\n if (typeof value === 'number' && /[height|width]$/.test(feature)) {\n value = `${value}px`\n }\n return `(${feature}: ${value})`\n })\n .join(' and ')\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AACA;AAEA;AACA;AAOA;AAEO,MAAM,aAA0D;AACvE,MAAM,sBAAwD;AAEvD,MAAM,wBAAwB,wBAAC,KAAa,OAAY;AAC7D,sBAAoB,OAAO,oBAAoB,QAAQ,IAAI;AAC3D,sBAAoB,KAAK,IAAI;AAAA,GAFM;AAK9B,MAAM,2BAA2B,wBAAC,KAAa,OAAY;AAChE,sBAAoB,KAAK,OAAO;AAAA,GADM;AAIxC,IAAI,OAA4B;AAEzB,MAAM,mBAAmB,IAAI,MAAoB,IAAW;AAAA,EACjE,IAAI,QAAQ,KAAK;AACf,QAAI,CAAC,MAAM;AACT,cAAQ,KAAK;AACb,aAAO;AAAA;AAET,WAAO,QAAQ,IAAI,MAAM;AAAA;AAAA,EAE3B,UAAU;AACR,QAAI,CAAC,MAAM;AACT,cAAQ,KAAK;AACb,aAAO;AAAA;AAET,WAAO,OAAO,KAAK;AAAA;AAAA,EAErB,2BAA2B;AACzB,WAAO;AAAA,MACL,YAAY;AAAA,MACZ,cAAc;AAAA;AAAA;AAAA;AAKb,MAAM,WAAW,6BAAM;AAC5B,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM;AAAA;AAElB,SAAO;AAAA,GAJe;AAOjB,MAAM,iBAAiB,wBAAC;AAAA,EAC7B;AAAA,EACA,gBAAgB,CAAC,MAAM;AAAA,IACO,OAAO;AACrC,MAAI,MAAM;AACR,YAAQ,KACN;AAAA;AAIJ,MAAI,SAAS;AACX,WAAO;AAAA;AAIT,aAAW,OAAO,SAAS;AACzB,UAAM,MAAM,oBAAoB,QAAQ;AACxC,QAAI;AACF,YAAM,WAAW,6BAAM,WAAW,MAAjB;AACjB,YAAM,QAAQ;AACd,UAAI,CAAC,SAAS,OAAO,MAAM,gBAAgB,YAAY;AAErD,cAAM,IAAI,MAAM;AAAA;AAElB,iBAAW,OAAO,CAAC,CAAC,MAAM;AAC1B,YAAM,YAAY,MAAM;AACtB,cAAM,OAAO,CAAC,CAAC,WAAW;AAC1B,YAAI,SAAS,WAAW;AAAM;AAC9B,mBAAW,OAAO;AAClB,cAAM,YAAY,oBAAoB;AACtC,YAAI,WAAW,MAAM;AACnB,qBAAW,MAAM,CAAC,GAAG,YAAY;AAC/B;AAAA;AAAA;AAAA;AAAA,aAIC,KAAP;AACA,cAAQ,MAAM,6BAA6B,KAAK,IAAI,SAAS,IAAI;AACjE,YAAM,kBAAkB,eAAe,SAAS,QAAe;AAC/D,iBAAW,OAAO;AAAA;AAAA;AAAA,GAvCM;AAmDvB,MAAM,WAAW,6BAAM;AAC5B,QAAM,cAAc;AACpB,QAAM,QAAQ;AACd,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,UAAU;AAAA,MACd,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,aAAa;AAAA;AAAA;AAGjB,QAAM,QAAQ,cAAc;AAG5B,4BAA0B,MAAM;AAC9B,UAAM,KAAK,MAAM;AACjB,OAAG,cAAc;AAEjB,eAAW,OAAO,GAAG,YAAY;AAC/B,UAAI,CAAE,QAAO,GAAG,iBAAiB;AAC/B,iCAAyB,KAAK;AAAA;AAAA;AAIlC,eAAW,OAAO,GAAG,gBAAgB;AACnC,UAAI,CAAE,QAAO,GAAG,aAAa;AAC3B,8BAAsB,KAAK;AAAA;AAAA;AAAA;AAMjC,4BAA0B,MAAM;AAC9B,WAAO,MAAM;AACX,YAAM,KAAK,MAAM;AACjB,SAAG,cAAc;AACjB,YAAM,UAAU;AAAA,WACX,GAAG;AAAA,WACH,GAAG;AAAA;AAER,iBAAW,OAAO,SAAS;AACzB,iCAAyB,KAAK;AAAA;AAAA;AAAA,KAGjC;AAEH,SAAO,YAAY,MAAM;AACvB,UAAM,KAAK,MAAM;AACjB,WAAO,IAAI,MAAM,YAAY;AAAA,MAC3B,IAAI,QAAQ,KAAa;AACvB,YAAI,CAAE,QAAO,aAAa;AACxB,iBAAO,QAAQ,IAAI,QAAQ;AAAA;AAE7B,YAAI,CAAC,GAAG,aAAa;AACnB,cAAI,GAAG,aAAa;AAClB,eAAG,eAAe,OAAO;AAAA;AAAA;AAG7B,YAAI,OAAO,YAAY;AACrB,iBAAO,WAAW;AAAA;AAEpB,eAAO,QAAQ,IAAI,YAAY;AAAA;AAAA;AAAA;AAAA,GA7Df;AAmExB,uBAAuB,KAAa;AAClC,SAAO,IAAI,QAAQ,UAAU,CAAC,MAAM,IAAI,EAAE,iBAAiB;AAAA;AADpD;AAIF,6BAA6B,OAAkC;AACpE,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA;AAET,SAAO,OAAO,QAAQ,OACnB,IAAI,CAAC,CAAC,SAAS,WAAW;AACzB,cAAU,cAAc;AACxB,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO,IAAI,YAAY;AAAA;AAEzB,QAAI,OAAO,UAAU,YAAY,kBAAkB,KAAK,UAAU;AAChE,cAAQ,GAAG;AAAA;AAEb,WAAO,IAAI,YAAY;AAAA,KAExB,KAAK;AAAA;AAfM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/hooks/usePressable.tsx"],
|
|
4
4
|
"sourcesContent": ["import { Pressable, PressableProps } from 'react-native'\n\nconst getPressable = Pressable?.['type']?.['render']\n\nexport const usePressable = (props: PressableProps) => {\n const out = getPressable(props)\n const { children, style, ...pressableProps } = out.props\n return [pressableProps, style] as const\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA,MAAM,eAAe,YAAY,UAAU;AAEpC,MAAM,eAAe,wBAAC,UAA0B;AACrD,QAAM,MAAM,aAAa;AACzB,QAAM,EAAE,UAAU,UAAU,mBAAmB,IAAI;AACnD,SAAO,CAAC,gBAAgB;AAAA,GAHE;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/hooks/useTheme.tsx"],
|
|
4
4
|
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { Variable } from '../createVariable'\nimport { ThemeName } from '../types'\nimport { ThemeContext } from '../views/ThemeContext'\nimport { ThemeManagerContext } from '../views/ThemeManagerContext'\nimport { GET_DEFAULT_THEME } from '../views/ThemeProvider'\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nconst areEqualSets = (a: Set<string>, b: Set<string>) => {\n if (a.size !== b.size) return false\n for (const val in a) {\n if (!b.has(val)) {\n return false\n }\n }\n return true\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent.name)\n\n useIsomorphicLayoutEffect(() => {\n return parent.onChangeTheme((next, manager) => {\n setName(opts?.parent ? manager.parentName : next)\n })\n }, [parent])\n\n return name || 'light'\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)[GET_DEFAULT_THEME] as any as ThemeName\n}\n\nexport const useTheme = () => {\n const forceUpdate = useForceUpdate()\n const manager = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = manager.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n manager.track(st.uuid, st.keys)\n }\n })\n\n useEffect(() => {\n return manager.onUpdate(state.current.uuid, forceUpdate)\n }, [])\n\n const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light\n\n return useMemo(\n () => {\n return new Proxy(theme, {\n get(_, key: string) {\n const name = manager.name\n if (!name) {\n return Reflect.get(_, key)\n }\n let activeTheme = themes[name]\n if (!activeTheme) {\n console.error('No theme by name', name, 'only:', themes, 'keeping current theme')\n activeTheme = theme\n }\n const val = activeTheme[key]\n if (process.env.NODE_ENV === 'development') {\n if (typeof val === 'undefined') {\n throw new Error(`No theme value \"${String(key)}\" in: ${Object.keys(activeTheme)}`)\n }\n }\n if (state.current.isRendering) {\n state.current.keys.add(key)\n }\n // TODO costly, can make faster (we need name mapping to og name, but val pointing to new val)\n // console.log('returning new variable', val, key)\n return new Variable({ val: val.val, name: key })\n },\n })\n },\n [\n /* if concurrent mode wanted put manager.name here */\n ]\n )\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAQA,MAAM,eAAe,wBAAC,GAAgB,MAAmB;AACvD,MAAI,EAAE,SAAS,EAAE;AAAM,WAAO;AAC9B,aAAW,OAAO,GAAG;AACnB,QAAI,CAAC,EAAE,IAAI,MAAM;AACf,aAAO;AAAA;AAAA;AAGX,SAAO;AAAA,GAPY;AAUd,MAAM,eAAe,wBAAC,SAA6B;AACxD,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,MAAM,WAAW,SAAS,OAAO;AAExC,4BAA0B,MAAM;AAC9B,WAAO,OAAO,cAAc,CAAC,MAAM,YAAY;AAC7C,cAAQ,MAAM,SAAS,QAAQ,aAAa;AAAA;AAAA,KAE7C,CAAC;AAEJ,SAAO,QAAQ;AAAA,GAVW;AAarB,MAAM,sBAAsB,6BAAM;AACvC,SAAO,WAAW,cAAc;AAAA,GADC;AAI5B,MAAM,WAAW,6BAAM;AAC5B,QAAM,cAAc;AACpB,QAAM,UAAU,WAAW;AAC3B,QAAM,SAAS,WAAW;AAC1B,QAAM,QAAQ;AACd,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,UAAU;AAAA,MACd,MAAM;AAAA,MACN,MAAM,IAAI;AAAA,MACV,aAAa;AAAA;AAAA;AAGjB,QAAM,QAAQ,cAAc;AAG5B,4BAA0B,MAAM;AAC9B,UAAM,KAAK,MAAM;AACjB,OAAG,cAAc;AACjB,UAAM,MAAM,QAAQ,KAAK,IAAI,GAAG;AAChC,QAAI,CAAC,OAAO,CAAC,aAAa,GAAG,MAAM,MAAM;AACvC,cAAQ,MAAM,GAAG,MAAM,GAAG;AAAA;AAAA;AAI9B,YAAU,MAAM;AACd,WAAO,QAAQ,SAAS,MAAM,QAAQ,MAAM;AAAA,KAC3C;AAEH,QAAM,QAAS,SAAQ,OAAO,OAAO,QAAQ,QAAQ,OAAO,UAAU,OAAO;AAE7E,SAAO,QACL,MAAM;AACJ,WAAO,IAAI,MAAM,OAAO;AAAA,MACtB,IAAI,GAAG,KAAa;AAClB,cAAM,OAAO,QAAQ;AACrB,YAAI,CAAC,MAAM;AACT,iBAAO,QAAQ,IAAI,GAAG;AAAA;AAExB,YAAI,cAAc,OAAO;AACzB,YAAI,CAAC,aAAa;AAChB,kBAAQ,MAAM,oBAAoB,MAAM,SAAS,QAAQ;AACzD,wBAAc;AAAA;AAEhB,cAAM,MAAM,YAAY;AACxB,YAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAI,OAAO,QAAQ,aAAa;AAC9B,kBAAM,IAAI,MAAM,mBAAmB,OAAO,aAAa,OAAO,KAAK;AAAA;AAAA;AAGvE,YAAI,MAAM,QAAQ,aAAa;AAC7B,gBAAM,QAAQ,KAAK,IAAI;AAAA;AAIzB,eAAO,IAAI,SAAS,EAAE,KAAK,IAAI,KAAK,MAAM;AAAA;AAAA;AAAA,KAIhD;AAAA,GA1DoB;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport { createTokens } from './createTokens'\nexport * from './createVariable'\nexport * from './styled'\nexport * from './types'\n\nexport * from './constants/pseudos'\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/isTamaguiElement'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './views/Animated'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/TextAncestorContext'\n"],
|
|
5
5
|
"mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/static/postProcessStyles.tsx"],
|
|
4
4
|
"sourcesContent": ["import { getSplitStyles } from '../helpers/getSplitStyles'\nimport { StaticConfigParsed, TamaguiInternalConfig, ThemeObject } from '../types'\n\n// used only by static extractor\n\nexport const postProcessStyles = (\n inStyles: any,\n staticConfig: StaticConfigParsed,\n theme: ThemeObject\n) => {\n const { style, viewProps, pseudos, classNames } = getSplitStyles(inStyles, staticConfig, theme)\n // flattening\n const next = {}\n for (const s of style) {\n if (!s) continue\n Object.assign(next, s)\n }\n Object.assign(next, pseudos)\n return { style: next, viewProps, classNames }\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAKO,MAAM,oBAAoB,wBAC/B,UACA,cACA,UACG;AACH,QAAM,EAAE,OAAO,WAAW,SAAS,eAAe,eAAe,UAAU,cAAc;AAEzF,QAAM,OAAO;AACb,aAAW,KAAK,OAAO;AACrB,QAAI,CAAC;AAAG;AACR,WAAO,OAAO,MAAM;AAAA;AAEtB,SAAO,OAAO,MAAM;AACpB,SAAO,EAAE,OAAO,MAAM,WAAW;AAAA,GAbF;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../src/static.ts"],
|
|
4
4
|
"sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createTamagui'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/pseudos'\n\n// -- below exports are only bundled compile-time --\n\nexport * from './static/postProcessStyles'\n"],
|
|
5
5
|
"mappings": "AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAIA;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../src/styled.ts"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { MediaProps, StaticComponent, StaticConfig, TamaguiConfig, Themes, Tokens } from './types'\n\nexport function styled<\n ParentComponent extends StaticComponent | React.Component<any>,\n Variants extends GetVariants<ParentComponent>\n>(\n Component: ParentComponent,\n options?: GetProps<ParentComponent> & {\n variants?: Variants\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps: StaticConfig = (() => {\n if (options) {\n const { variants, ...defaultProps } = options\n return { ...staticExtractionOptions, variants, defaultProps }\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n type VariantProps = GetVariantProps<Variants>\n return component as StaticComponent<\n Omit<GetProps<ParentComponent>, keyof VariantProps> & VariantProps & MediaProps<VariantProps>\n // leave this out it was causing infinite recursion type issues\n // VariantProps\n >\n}\n\n// type ParentVariants = A extends StaticComponent<any, infer Variants> ? Variants : {}\n\nexport type GetProps<A> = A extends StaticComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? Props\n : {}\n\nexport type GetVariants<ParentComponent extends StaticComponent | React.Component<any>> = void | {\n [key: string]: {\n [key: string]:\n | Partial<GetProps<ParentComponent>>\n | ((\n val: any,\n config: {\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: GetProps<ParentComponent>\n }\n ) => Partial<GetProps<ParentComponent>>)\n }\n}\n\nexport type GetVariantProps<Variants> = Variants extends void\n ? {}\n : {\n // ensure variants actually defined\n [Key in keyof Variants]?: keyof Variants[Key] extends `...${infer VariantSpread}`\n ? VariantSpread extends keyof Tokens\n ? keyof Tokens[VariantSpread] extends string | number\n ? `$${keyof Tokens[VariantSpread]}`\n : unknown\n : unknown\n : keyof Variants[Key] extends 'true'\n ? boolean\n : keyof Exclude<Variants[Key], undefined>\n }\n\n// type X = { ok: 1 }\n// type Y = { okk: 2; ok: 3 }\n// type Z = X & Y\n// type Z2 = Z\n\n// TODO get name\n// const displayName = `styled(Component)`\n// Object.defineProperty(component, 'name', {\n// value: displayName,\n// writable: false,\n// })\n"],
|
|
5
5
|
"mappings": ";;AAEA;AACA;AAGO,gBAIL,WACA,SAGA,yBACA;AACA,QAAM,oBAAmC,OAAM;AAC7C,QAAI,SAAS;AACX,YAAM,EAAE,aAAa,iBAAiB;AACtC,aAAO,KAAK,yBAAyB,UAAU;AAAA;AAEjD,WAAO;AAAA;AAET,QAAM,SAAS,mBAAmB,WAAW;AAC7C,QAAM,YAAY,gBAAgB;AAElC,SAAO;AAAA;AApBO;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/Animated.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useMemo } from 'react'\nimport {\n Animated,\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useConstant } from '../hooks/useConstant'\nimport { StackProps } from '../types'\nimport { Stack } from './Stack'\n\nconst defaultAnimation = {\n from: {\n opacity: 0,\n translateY: 12,\n },\n to: {\n opacity: 1,\n translateY: 0,\n },\n}\n\ntype AnimatableProps = Partial<\n Pick<StackProps, 'backgroundColor' | 'borderColor' | 'opacity'> &\n PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\n>\n\nconst styleKeys = {\n opacity: true,\n backgroundColor: true,\n borderColor: true,\n}\n\nexport type AnimatedStackProps = StackProps & {\n animateState?: 'in' | 'out'\n velocity?: number\n animation?: {\n from: AnimatableProps\n to: AnimatableProps\n }\n}\n\nexport const AnimatedStack = ({\n animateState = 'in',\n animation = defaultAnimation,\n velocity = 6,\n children,\n animated,\n ...props\n}: AnimatedStackProps) => {\n const driver = useConstant(() => {\n return new Animated.Value(0)\n })\n\n const animatedProps = useMemo(() => {\n if (!animated) {\n return null\n }\n\n const styleProps = {}\n const transform: any = []\n\n for (const key in animation.from) {\n const fromVal = animation.from[key]\n const toVal = animation.to[key]\n const interpolatedVal = driver.interpolate({\n inputRange: [0, 1],\n outputRange: [fromVal, toVal],\n })\n if (styleKeys[key]) {\n styleProps[key] = interpolatedVal\n } else {\n transform.push({\n [key]: interpolatedVal,\n })\n }\n }\n return { transform, ...styleProps }\n }, [animated, animateState])\n\n useIsomorphicLayoutEffect(() => {\n if (!animated) {\n return\n }\n Animated.spring(driver, {\n useNativeDriver: true,\n velocity,\n toValue: animateState === 'in' ? 1 : 0,\n }).start()\n }, [animated, animateState])\n\n const childrenMemo = useMemo(() => children, [children])\n\n return (\n <Stack animated={animated} {...props} {...animatedProps}>\n {childrenMemo}\n </Stack>\n )\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AACA;AAAA;AAAA;AAgBA;AACA;AAEA;AAEA,MAAM,mBAAmB;AAAA,EACvB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,EAEd,IAAI;AAAA,IACF,SAAS;AAAA,IACT,YAAY;AAAA;AAAA;AAoBhB,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,aAAa;AAAA;AAYR,MAAM,gBAAgB,wBAAC;AAAA,EAC5B,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AAAA,KACG;AAAA,MACqB;AACxB,QAAM,SAAS,YAAY,MAAM;AAC/B,WAAO,IAAI,SAAS,MAAM;AAAA;AAG5B,QAAM,gBAAgB,QAAQ,MAAM;AAClC,QAAI,CAAC,UAAU;AACb,aAAO;AAAA;AAGT,UAAM,aAAa;AACnB,UAAM,YAAiB;AAEvB,eAAW,OAAO,UAAU,MAAM;AAChC,YAAM,UAAU,UAAU,KAAK;AAC/B,YAAM,QAAQ,UAAU,GAAG;AAC3B,YAAM,kBAAkB,OAAO,YAAY;AAAA,QACzC,YAAY,CAAC,GAAG;AAAA,QAChB,aAAa,CAAC,SAAS;AAAA;AAEzB,UAAI,UAAU,MAAM;AAClB,mBAAW,OAAO;AAAA,aACb;AACL,kBAAU,KAAK;AAAA,WACZ,MAAM;AAAA;AAAA;AAAA;AAIb,WAAO,EAAE,cAAc;AAAA,KACtB,CAAC,UAAU;AAEd,4BAA0B,MAAM;AAC9B,QAAI,CAAC,UAAU;AACb;AAAA;AAEF,aAAS,OAAO,QAAQ;AAAA,MACtB,iBAAiB;AAAA,MACjB;AAAA,MACA,SAAS,iBAAiB,OAAO,IAAI;AAAA,OACpC;AAAA,KACF,CAAC,UAAU;AAEd,QAAM,eAAe,QAAQ,MAAM,UAAU,CAAC;AAE9C,SACE,oCAAC,OAAD;AAAA,IAAO;AAAA,OAAwB;AAAA,OAAW;AAAA,KACvC;AAAA,GArDsB;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/Stack.tsx"],
|
|
4
4
|
"sourcesContent": ["import { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps } from '../types'\n\nexport const Stack = createComponent<StackProps>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
|
|
5
5
|
"mappings": "AAAA;AACA;AAGO,MAAM,QAAQ,gBAA4B;AAAA,EAC/C,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { stylePropsTextOnly, validStyles } from "@tamagui/helpers";
|
|
1
2
|
import { isWeb } from "../constants/platform";
|
|
2
3
|
import { createComponent } from "../createComponent";
|
|
3
|
-
import { stylePropsTextOnly, validStyles } from "../static";
|
|
4
4
|
const ellipseStyle = {
|
|
5
5
|
maxWidth: "100%",
|
|
6
6
|
overflow: "hidden",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/Text.tsx"],
|
|
4
|
+
"sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'inline-flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n '[number]': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n // TODO document\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA;AAGP,MAAM,OAAO,gBAA2B;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,EAEZ,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,YAAY,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,MAAM;AAAA;AAAA,IAG/D,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA;AAAA,MAEd,OAAO;AAAA,QACL,YAAY;AAAA;AAAA;AAAA,IAIhB,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA;AAAA;AAAA,IAIZ,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA;AAAA;AAAA;AAAA,EAKzB,YAAY,IAAI,IAAI,QAAQ,KAAK,CAAC;AAAA,EAClC,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/TextAncestorContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\n\nimport { rnw } from '../constants/rnw'\n\nexport const TextAncestorContext = rnw?.TextAncestorContext\n\nexport const TextAncestorProvider = (props) => {\n if (TextAncestorContext) {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n }\n return props.children\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA;AAEO,MAAM,sBAAsB,KAAK;AAEjC,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,MAAI,qBAAqB;AACvB,WAAO,oCAAC,oBAAoB,UAArB;AAAA,MAA8B,OAAO;AAAA,OAAQ,MAAM;AAAA;AAE5D,SAAO,MAAM;AAAA,GAJqB;",
|
|
6
6
|
"names": []
|
|
@@ -14,11 +14,10 @@ const Theme = /* @__PURE__ */ __name((props) => {
|
|
|
14
14
|
console.warn("Error, no themes in context", props);
|
|
15
15
|
return props.children;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const theme = activeName ? themes[activeName] : null;
|
|
17
|
+
const nextNameParent = `${props.name}-${parentName}`;
|
|
18
|
+
const nextNameParentParent = `${props.name}-${parent.parentName}`;
|
|
19
|
+
const name = !props.name ? null : props.name in themes ? props.name : nextNameParent in themes ? nextNameParent : nextNameParentParent in themes ? nextNameParentParent : null;
|
|
20
|
+
const theme = name ? themes[name] : null;
|
|
22
21
|
const themeManager = useConstant(() => {
|
|
23
22
|
if (!theme) {
|
|
24
23
|
return null;
|
|
@@ -33,14 +32,16 @@ const Theme = /* @__PURE__ */ __name((props) => {
|
|
|
33
32
|
if (!themeManager) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
if (name) {
|
|
36
|
+
themeManager.setActiveTheme({ name, theme, parentName });
|
|
37
|
+
}
|
|
37
38
|
return parent.onChangeTheme((next) => {
|
|
38
39
|
if (next) {
|
|
39
40
|
themeManager.setActiveTheme({ name: next, theme: themes[next], parentName });
|
|
40
41
|
setParentName(next);
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
|
-
}, [themes,
|
|
44
|
+
}, [themes, name, parentName]);
|
|
44
45
|
if (!name || !theme) {
|
|
45
46
|
return props.children;
|
|
46
47
|
}
|
|
@@ -51,11 +52,13 @@ const Theme = /* @__PURE__ */ __name((props) => {
|
|
|
51
52
|
if (props.disableThemeClass) {
|
|
52
53
|
return contents;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (name) {
|
|
56
|
+
const color = themes[name]?.["color"]?.["variable"];
|
|
57
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
58
|
+
className: getThemeParentClassName(props.name),
|
|
59
|
+
style: { display: "contents", color }
|
|
60
|
+
}, contents);
|
|
61
|
+
}
|
|
59
62
|
}
|
|
60
63
|
return contents;
|
|
61
64
|
}, "Theme");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/Theme.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('Error, no themes in context', props)\n return props.children\n }\n\n const nextNameParent = `${props.name}-${parentName}`\n const nextNameParentParent = `${props.name}-${parent.parentName}`\n const name = !props.name\n ? null\n : props.name in themes\n ? props.name\n : nextNameParent in themes\n ? nextNameParent\n : nextNameParentParent in themes\n ? nextNameParentParent\n : null\n const theme = name ? themes[name] : null\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!theme) {\n return null\n }\n const manager = new ThemeManager()\n if (name) {\n manager.setActiveTheme({ name, theme: themes[name], parentName })\n }\n return manager\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!themeManager) {\n return\n }\n if (name) {\n themeManager.setActiveTheme({ name, theme, parentName })\n }\n return parent.onChangeTheme((next) => {\n if (next) {\n themeManager.setActiveTheme({ name: next, theme: themes[next], parentName })\n setParentName(next)\n }\n })\n }, [themes, name, parentName])\n\n if (!name || !theme) {\n return props.children\n }\n\n const contents = themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {props.children}\n </ThemeManagerContext.Provider>\n ) : (\n props.children\n )\n\n if (isWeb) {\n if (props.disableThemeClass) {\n return contents\n }\n if (name) {\n const color = themes[name]?.['color']?.['variable']\n return (\n <div\n className={getThemeParentClassName(props.name)}\n // in order to provide currentColor, set color by default\n style={{ display: 'contents', color }}\n >\n {contents}\n </div>\n )\n }\n }\n\n return contents\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAC1C,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,+BAA+B;AAC5C,WAAO,MAAM;AAAA;AAGf,QAAM,iBAAiB,GAAG,MAAM,QAAQ;AACxC,QAAM,uBAAuB,GAAG,MAAM,QAAQ,OAAO;AACrD,QAAM,OAAO,CAAC,MAAM,OAChB,OACA,MAAM,QAAQ,SACd,MAAM,OACN,kBAAkB,SAClB,iBACA,wBAAwB,SACxB,uBACA;AACJ,QAAM,QAAQ,OAAO,OAAO,QAAQ;AACpC,QAAM,eAAe,YAAiC,MAAM;AAC1D,QAAI,CAAC,OAAO;AACV,aAAO;AAAA;AAET,UAAM,UAAU,IAAI;AACpB,QAAI,MAAM;AACR,cAAQ,eAAe,EAAE,MAAM,OAAO,OAAO,OAAO;AAAA;AAEtD,WAAO;AAAA;AAGT,4BAA0B,MAAM;AAC9B,QAAI,CAAC,cAAc;AACjB;AAAA;AAEF,QAAI,MAAM;AACR,mBAAa,eAAe,EAAE,MAAM,OAAO;AAAA;AAE7C,WAAO,OAAO,cAAc,CAAC,SAAS;AACpC,UAAI,MAAM;AACR,qBAAa,eAAe,EAAE,MAAM,MAAM,OAAO,OAAO,OAAO;AAC/D,sBAAc;AAAA;AAAA;AAAA,KAGjB,CAAC,QAAQ,MAAM;AAElB,MAAI,CAAC,QAAQ,CAAC,OAAO;AACnB,WAAO,MAAM;AAAA;AAGf,QAAM,WAAW,eACf,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAClC,MAAM,YAGT,MAAM;AAGR,MAAI,OAAO;AACT,QAAI,MAAM,mBAAmB;AAC3B,aAAO;AAAA;AAET,QAAI,MAAM;AACR,YAAM,QAAQ,OAAO,QAAQ,WAAW;AACxC,aACE,oCAAC,OAAD;AAAA,QACE,WAAW,wBAAwB,MAAM;AAAA,QAEzC,OAAO,EAAE,SAAS,YAAY;AAAA,SAE7B;AAAA;AAAA;AAMT,SAAO;AAAA,GA7EY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/ThemeContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import { createContext } from 'react'\n\nimport { Themes } from '../types'\n\nexport const ThemeContext = createContext<Themes>(null as any)\n"],
|
|
5
5
|
"mappings": "AAAA;AAIO,MAAM,eAAe,cAAsB;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/ThemeInverse.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme] || null\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,4BAA4B,MAAoB;AACrD,eAAa;AAAA;AADC;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY;AAClB,QAAM,eAAe;AACrB,QAAM,OAAO,WAAW,cAAc,WAAW,iBAAiB;AAClE,SAAO,oCAAC,OAAD;AAAA,IAAO;AAAA,KAAa,MAAM;AAAA,GAJP;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/ThemeManagerContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import { createContext } from 'react'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport class ThemeManager {\n name: string | null = 'light'\n parentName: string | null = null\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n theme = null\n\n setActiveTheme({\n name,\n theme,\n parentName,\n }: {\n parentName?: string | null\n name: string | null\n theme?: any\n }) {\n if (name === this.name) return\n this.name = name\n this.theme = theme\n this.parentName = parentName || null\n this.update()\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n update() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager>(new ThemeManager())\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAIO,mBAAmB;AAAA,EAAnB,cAJP;AAKE,gBAAsB;AACtB,sBAA4B;AAC5B,gBAAO,IAAI;AACX,qBAAY,IAAI;AAChB,0BAAiB,IAAI;AACrB,iBAAQ;AAAA;AAAA,EAER,eAAe;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,KAKC;AACD,QAAI,SAAS,KAAK;AAAM;AACxB,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,aAAa,cAAc;AAChC,SAAK;AAAA;AAAA,EAGP,MAAM,MAAW,MAAmB;AAClC,QAAI,CAAC,KAAK;AAAM;AAChB,SAAK,KAAK,IAAI,MAAM;AAAA;AAAA,EAGtB,SAAS;AACP,QAAI,CAAC,KAAK,MAAM;AACd,WAAK,KAAK;AAAA;AAEZ,eAAW,CAAC,MAAM,SAAS,KAAK,KAAK,WAAW;AAC9C,UAAI,KAAK,MAAM;AACb,aAAK,UAAU,IAAI;AAAA;AAAA;AAGvB,SAAK,eAAe,QAAQ,CAAC,OAAO,GAAG,KAAK,MAAM;AAAA;AAAA,EAGpD,cAAc,IAAmB;AAC/B,SAAK,eAAe,IAAI;AACxB,WAAO,MAAM;AACX,WAAK,eAAe,OAAO;AAAA;AAAA;AAAA,EAI/B,SAAS,MAAW,IAAc;AAChC,SAAK,UAAU,IAAI,MAAM;AACzB,WAAO,MAAM;AACX,WAAK,UAAU,OAAO;AACtB,WAAK,KAAK,OAAO;AAAA;AAAA;AAAA;AApDhB;AAyDA,MAAM,sBAAsB,cAA4B,IAAI;",
|
|
6
6
|
"names": []
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useMemo } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getHasConfigured, getThemeParentClassName } from '../createTamagui'\nimport { Theme } from './Theme'\nimport { ThemeContext } from './ThemeContext'\n\nexport type ThemeProviderProps = {\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const GET_DEFAULT_THEME = '___TGUI'\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n useIsomorphicLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n if (typeof document !== 'undefined') {\n const cns = getThemeParentClassName(`${props.defaultTheme}`).split(' ')\n cns.forEach((cn) => document.body.classList.add(cn))\n return () => {\n cns.forEach((cn) => document.body.classList.remove(cn))\n }\n }\n }, [])\n\n const themeContext = useMemo(() => {\n return new Proxy(props.themes, {\n get(target, key) {\n if (key === GET_DEFAULT_THEME) return props.defaultTheme\n return Reflect.get(target, key)\n },\n })\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AASO,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,oBAAoB;AACvB,UAAM,IAAI,MAAM;AAAA;AAIlB,4BAA0B,MAAM;AAC9B,QAAI,MAAM,uBAAuB;AAC/B;AAAA;AAEF,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,MAAM,wBAAwB,GAAG,MAAM,gBAAgB,MAAM;AACnE,UAAI,QAAQ,CAAC,OAAO,SAAS,KAAK,UAAU,IAAI;AAChD,aAAO,MAAM;AACX,YAAI,QAAQ,CAAC,OAAO,SAAS,KAAK,UAAU,OAAO;AAAA;AAAA;AAAA,KAGtD;AAEH,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO,IAAI,MAAM,MAAM,QAAQ;AAAA,MAC7B,IAAI,QAAQ,KAAK;AACf,YAAI,QAAQ;AAAmB,iBAAO,MAAM;AAC5C,eAAO,QAAQ,IAAI,QAAQ;AAAA;AAAA;AAAA,KAG9B,CAAC,MAAM;AAEV,SACE,oCAAC,aAAa,UAAd;AAAA,IAAuB,OAAO;AAAA,KAC5B,oCAAC,OAAD;AAAA,IAAO,MAAM,MAAM;AAAA,IAAc,mBAAmB,MAAM;AAAA,KACvD,MAAM;AAAA,GA/Bc;",
|
|
6
6
|
"names": []
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : Platform?.OS === "web";
|
|
4
|
+
const isSSR = isWeb && typeof window === "undefined";
|
|
5
|
+
const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
6
|
+
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
7
|
+
const supportsTouchWeb = typeof window !== "undefined" && "ontouchstart" in window;
|
|
8
|
+
const isTouchDevice = !isWeb || supportsTouchWeb;
|
|
9
|
+
const isWebIOS = isWeb && typeof navigator !== "undefined" && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window["MSStream"];
|
|
10
|
+
export {
|
|
11
|
+
isChrome,
|
|
12
|
+
isSSR,
|
|
13
|
+
isTouchDevice,
|
|
14
|
+
isWeb,
|
|
15
|
+
isWebIOS,
|
|
16
|
+
supportsTouchWeb,
|
|
17
|
+
useIsomorphicLayoutEffect
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|