@tamagui/core 1.0.0-beta.8 → 1.0.1-beta.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Pressability.js +28 -0
- package/dist/cjs/Pressability.js.map +7 -0
- package/dist/cjs/Pressability.native.js +28 -0
- package/dist/cjs/Pressability.native.js.map +7 -0
- package/dist/cjs/Tamagui.js +6 -8
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/ThemeManager.js +25 -32
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/conf.js +20 -15
- package/dist/cjs/conf.js.map +2 -2
- package/dist/cjs/constants/constants.js +1 -1
- package/dist/cjs/constants/constants.js.map +1 -1
- package/dist/cjs/constants/platform.js +8 -8
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/rnw.js +5 -19
- package/dist/cjs/constants/rnw.js.map +2 -2
- package/dist/cjs/constants/rnw.native.js +28 -0
- package/dist/cjs/constants/rnw.native.js.map +7 -0
- package/dist/cjs/createComponent.js +612 -295
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js +2 -3
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/createShorthands.js +0 -2
- package/dist/cjs/createShorthands.js.map +1 -1
- package/dist/cjs/createTamagui.js +147 -100
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +3 -2
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/createTokens.js +4 -21
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +39 -14
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +55 -0
- package/dist/cjs/createVariables.js.map +7 -0
- package/dist/cjs/helpers/areEqualSets.js +2 -3
- package/dist/cjs/helpers/areEqualSets.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js +187 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +29 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/cjs/helpers/calc.js +70 -0
- package/dist/cjs/helpers/calc.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +4 -4
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +133 -113
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +3 -4
- package/dist/cjs/helpers/createShallowUpdate.js.map +2 -2
- package/dist/cjs/helpers/createTamaguiProvider.js +16 -18
- package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/cjs/helpers/cssHash.js +50 -0
- package/dist/cjs/helpers/cssHash.js.map +7 -0
- package/dist/cjs/helpers/expandStyle.js +111 -0
- package/dist/cjs/helpers/expandStyle.js.map +7 -0
- package/dist/cjs/helpers/expandStyles.js +126 -0
- package/dist/cjs/helpers/expandStyles.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +25 -17
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.js +2 -3
- package/dist/cjs/helpers/fixNativeShadow.js.map +1 -1
- package/dist/cjs/helpers/getExpandedShorthands.js +0 -2
- package/dist/cjs/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/cjs/helpers/getFont.js +61 -0
- package/dist/cjs/helpers/getFont.js.map +7 -0
- package/dist/cjs/helpers/getSize.js +17 -9
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +268 -168
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js +45 -0
- package/dist/cjs/helpers/getStackSize.js.map +7 -0
- package/dist/cjs/helpers/getStylesAtomic.js +178 -118
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +0 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getTextSize.js +3 -4
- package/dist/cjs/helpers/getTextSize.js.map +2 -2
- package/dist/cjs/helpers/getVariantExtras.js +46 -0
- package/dist/cjs/helpers/getVariantExtras.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +55 -37
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/isObj.js +1 -2
- package/dist/cjs/helpers/isObj.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiComponent.js +36 -0
- package/dist/cjs/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/cjs/helpers/isTamaguiElement.js +4 -5
- package/dist/cjs/helpers/isTamaguiElement.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js +2 -3
- package/dist/cjs/helpers/matchMedia.js.map +1 -1
- package/dist/cjs/helpers/matchMedia.native.js +1 -2
- package/dist/cjs/helpers/matchMedia.native.js.map +1 -1
- package/dist/cjs/helpers/mergeProps.js +49 -0
- package/dist/cjs/helpers/mergeProps.js.map +7 -0
- package/dist/cjs/helpers/mergeTransform.js +41 -0
- package/dist/cjs/helpers/mergeTransform.js.map +7 -0
- package/dist/cjs/helpers/nativeGestureHandler.native.js +18 -0
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +7 -0
- package/dist/cjs/helpers/normalizeColor.js +76 -0
- package/dist/cjs/helpers/normalizeColor.js.map +7 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +90 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +1 -3
- package/dist/cjs/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/cjs/helpers/pseudoDescriptors.js +41 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/cjs/helpers/registerCSSVariable.js +40 -0
- package/dist/cjs/helpers/registerCSSVariable.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +3 -5
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/validate.js +39 -37
- package/dist/cjs/helpers/validate.js.map +2 -2
- package/dist/cjs/helpers/withStaticProperties.js +2 -3
- package/dist/cjs/helpers/withStaticProperties.js.map +1 -1
- package/dist/cjs/helpers/wrapThemeManagerContext.js +0 -2
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +2 -2
- package/dist/cjs/hooks/useConstant.js +0 -2
- package/dist/cjs/hooks/useConstant.js.map +1 -1
- package/dist/cjs/hooks/useFeatures.js +22 -20
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useId.js +5 -6
- package/dist/cjs/hooks/useId.js.map +2 -2
- package/dist/cjs/hooks/useIsMounted.js +2 -4
- package/dist/cjs/hooks/useIsMounted.js.map +2 -2
- package/dist/cjs/hooks/useIsTouchDevice.js +3 -4
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +11 -15
- package/dist/cjs/hooks/useMedia.js.map +1 -1
- package/dist/cjs/hooks/usePressable.js +2 -3
- package/dist/cjs/hooks/usePressable.js.map +1 -1
- package/dist/cjs/hooks/usePrevious.js +1 -0
- package/dist/cjs/hooks/usePrevious.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +21 -33
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js +0 -2
- package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
- package/dist/cjs/index.js +21 -12
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/insertFont.js +89 -0
- package/dist/cjs/insertFont.js.map +7 -0
- package/dist/cjs/static.js +3 -1
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +0 -3
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types-rnw.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +40 -26
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/Text.js +11 -15
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/TextAncestorContext.js +4 -6
- package/dist/cjs/views/TextAncestorContext.js.map +2 -2
- package/dist/cjs/views/Theme.js +6 -9
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +7 -5
- package/dist/cjs/views/ThemeInverse.js.map +2 -2
- package/dist/cjs/views/ThemeProvider.js +6 -6
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +3 -3
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/Pressability.js +5 -0
- package/dist/esm/Pressability.js.map +7 -0
- package/dist/esm/Pressability.native.js +5 -0
- package/dist/esm/Pressability.native.js.map +7 -0
- package/dist/esm/Tamagui.js +5 -8
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/ThemeManager.js +25 -33
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/conf.js +18 -15
- package/dist/esm/conf.js.map +2 -2
- package/dist/esm/constants/constants.js +24 -9
- package/dist/esm/constants/constants.js.map +2 -2
- package/dist/esm/constants/platform.js +6 -6
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/rnw.js +2 -20
- package/dist/esm/constants/rnw.js.map +2 -2
- package/dist/esm/constants/rnw.native.js +5 -0
- package/dist/esm/constants/rnw.native.js.map +7 -0
- package/dist/esm/createComponent.js +705 -331
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createFont.js +2 -4
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/createShorthands.js +0 -3
- package/dist/esm/createShorthands.js.map +1 -1
- package/dist/esm/createTamagui.js +172 -105
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +3 -3
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/createTokens.js +3 -20
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +38 -14
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +32 -0
- package/dist/esm/createVariables.js.map +7 -0
- package/dist/esm/helpers/areEqualSets.js +2 -4
- package/dist/esm/helpers/areEqualSets.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js +164 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +6 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/esm/helpers/calc.js +47 -0
- package/dist/esm/helpers/calc.js.map +7 -0
- package/dist/esm/helpers/createMediaStyle.js +4 -5
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +131 -114
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +19 -5
- package/dist/esm/helpers/createShallowUpdate.js.map +2 -2
- package/dist/esm/helpers/createTamaguiProvider.js +46 -19
- package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/esm/helpers/cssHash.js +27 -0
- package/dist/esm/helpers/cssHash.js.map +7 -0
- package/dist/esm/helpers/expandStyle.js +90 -0
- package/dist/esm/helpers/expandStyle.js.map +7 -0
- package/dist/esm/helpers/expandStyles.js +103 -0
- package/dist/esm/helpers/expandStyles.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +46 -40
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.js +2 -4
- package/dist/esm/helpers/fixNativeShadow.js.map +1 -1
- package/dist/esm/helpers/getExpandedShorthands.js +0 -3
- package/dist/esm/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/{jsx/helpers/getTextSize.js → esm/helpers/getFont.js} +12 -7
- package/dist/esm/helpers/getFont.js.map +7 -0
- package/dist/esm/helpers/getSize.js +15 -9
- package/dist/esm/helpers/getSize.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +282 -176
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +22 -0
- package/dist/esm/helpers/getStackSize.js.map +7 -0
- package/dist/esm/helpers/getStylesAtomic.js +188 -110
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -3
- package/dist/esm/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getTextSize.js +3 -5
- package/dist/esm/helpers/getTextSize.js.map +2 -2
- package/dist/esm/helpers/getVariantExtras.js +23 -0
- package/dist/esm/helpers/getVariantExtras.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +55 -38
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/isObj.js +1 -3
- package/dist/esm/helpers/isObj.js.map +1 -1
- package/dist/esm/helpers/isTamaguiComponent.js +13 -0
- package/dist/esm/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/esm/helpers/isTamaguiElement.js +4 -6
- package/dist/esm/helpers/isTamaguiElement.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js +2 -4
- package/dist/esm/helpers/matchMedia.js.map +1 -1
- package/dist/esm/helpers/matchMedia.native.js +1 -3
- package/dist/esm/helpers/matchMedia.native.js.map +1 -1
- package/dist/esm/helpers/mergeProps.js +26 -0
- package/dist/esm/helpers/mergeProps.js.map +7 -0
- package/dist/esm/helpers/mergeTransform.js +17 -0
- package/dist/esm/helpers/mergeTransform.js.map +7 -0
- package/dist/esm/helpers/nativeGestureHandler.native.js +2 -0
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +7 -0
- package/dist/esm/helpers/normalizeColor.js +49 -0
- package/dist/esm/helpers/normalizeColor.js.map +7 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js +67 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/esm/helpers/proxyThemeVariables.js +1 -4
- package/dist/esm/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/esm/helpers/pseudoDescriptors.js +18 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/esm/helpers/registerCSSVariable.js +15 -0
- package/dist/esm/helpers/registerCSSVariable.js.map +7 -0
- package/dist/esm/helpers/themeable.js +34 -5
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/validate.js +42 -19
- package/dist/esm/helpers/validate.js.map +2 -2
- package/dist/esm/helpers/withStaticProperties.js +2 -4
- package/dist/esm/helpers/withStaticProperties.js.map +1 -1
- package/dist/esm/helpers/wrapThemeManagerContext.js +0 -3
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +2 -2
- package/dist/esm/hooks/useConstant.js +0 -3
- package/dist/esm/hooks/useConstant.js.map +1 -1
- package/dist/esm/hooks/useFeatures.js +59 -26
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useId.js +8 -11
- package/dist/esm/hooks/useId.js.map +2 -2
- package/dist/esm/hooks/useIsMounted.js +1 -4
- package/dist/esm/hooks/useIsMounted.js.map +2 -2
- package/dist/esm/hooks/useIsTouchDevice.js +4 -6
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +28 -21
- package/dist/esm/hooks/useMedia.js.map +1 -1
- package/dist/esm/hooks/usePressable.js +18 -5
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/usePrevious.js +1 -0
- package/dist/esm/hooks/usePrevious.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +45 -41
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useUnmountEffect.js +0 -3
- package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
- package/dist/esm/index.js +18 -9
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/insertFont.js +64 -0
- package/dist/esm/insertFont.js.map +7 -0
- package/dist/esm/static.js +3 -1
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +37 -12
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Slot.js +74 -34
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/Stack.js +21 -3
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/Text.js +27 -19
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/TextAncestorContext.js +4 -7
- package/dist/esm/views/TextAncestorContext.js.map +2 -2
- package/dist/esm/views/Theme.js +6 -10
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +8 -7
- package/dist/esm/views/ThemeInverse.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +6 -7
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +3 -4
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +18 -11
- package/reset.css +41 -0
- package/types/Pressability.d.ts +2 -0
- package/types/Pressability.native.d.ts +2 -0
- package/types/Tamagui.d.ts +4 -6
- package/types/Tamagui.d.ts.map +1 -1
- package/types/ThemeContext.d.ts +0 -0
- package/types/ThemeContext.d.ts.map +0 -0
- package/types/ThemeManager.d.ts +10 -7
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/conf.d.ts +3 -4
- package/types/conf.d.ts.map +1 -1
- package/types/constants/constants.d.ts +1 -1
- package/types/constants/platform.d.ts +2 -2
- package/types/constants/rnw.d.ts +1 -1
- package/types/constants/rnw.d.ts.map +1 -1
- package/types/constants/rnw.native.d.ts +2 -0
- package/types/contexts/ButtonInsideButtonContext.d.ts +0 -0
- package/types/createComponent.d.ts +40 -15
- package/types/createComponent.d.ts.map +1 -1
- package/types/createFont.d.ts +0 -0
- package/types/createFont.d.ts.map +0 -0
- package/types/createShorthands.d.ts +0 -0
- package/types/createTamagui.d.ts +10 -2
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createTheme.d.ts +1 -1
- package/types/createTokens.d.ts +0 -1
- package/types/createTokens.d.ts.map +1 -1
- package/types/createVariable.d.ts +16 -11
- package/types/createVariables.d.ts +10 -0
- package/types/defaultComponentState.d.ts +0 -0
- package/types/helpers/RNComponents.d.ts +0 -0
- package/types/helpers/areEqualSets.d.ts +0 -0
- package/types/helpers/assignNativePropsToWeb.d.ts +2 -0
- package/types/helpers/assignNativePropsToWeb.d.ts.map +1 -0
- package/types/helpers/assignNativePropsToWeb.native.d.ts +2 -0
- package/types/helpers/calc.d.ts +12 -0
- package/types/helpers/calc.d.ts.map +1 -0
- package/types/helpers/createMediaStyle.d.ts +1 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +4 -3
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/createShallowUpdate.d.ts +1 -2
- package/types/helpers/createTamaguiProvider.d.ts +2 -6
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/cssHash.d.ts +2 -0
- package/types/helpers/cssHash.d.ts.map +1 -0
- package/types/helpers/expandStyle.d.ts +2 -0
- package/types/helpers/expandStyle.d.ts.map +1 -0
- package/types/helpers/expandStyles.d.ts +7 -0
- package/types/helpers/expandStyles.d.ts.map +1 -0
- package/types/helpers/extendStaticConfig.d.ts +0 -0
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/fixNativeShadow.d.ts +0 -0
- package/types/helpers/getExpandedShorthands.d.ts +0 -0
- package/types/helpers/getExpandedShorthands.d.ts.map +0 -0
- package/types/helpers/getFont.d.ts +3 -0
- package/types/helpers/getFont.d.ts.map +1 -0
- package/types/helpers/getSize.d.ts +3 -2
- package/types/helpers/getSize.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +10 -7
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStackSize.d.ts +8 -0
- package/types/helpers/getStackSize.d.ts.map +1 -0
- package/types/helpers/getStylesAtomic.d.ts +7 -17
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.native.d.ts +0 -0
- package/types/helpers/getVariantExtras.d.ts +7 -0
- package/types/helpers/getVariantExtras.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts +1 -1
- package/types/helpers/isObj.d.ts +0 -0
- package/types/helpers/isTamaguiComponent.d.ts +5 -0
- package/types/helpers/isTamaguiComponent.d.ts.map +1 -0
- package/types/helpers/isTamaguiElement.d.ts +1 -1
- package/types/helpers/isTamaguiElement.d.ts.map +1 -1
- package/types/helpers/matchMedia.d.ts +0 -0
- package/types/helpers/matchMedia.native.d.ts +0 -0
- package/types/helpers/mergeProps.d.ts +2 -0
- package/types/helpers/mergeTransform.d.ts +7 -0
- package/types/helpers/nativeGestureHandler.native.d.ts +2 -0
- package/types/helpers/normalizeColor.d.ts +3 -0
- package/types/helpers/normalizeColor.d.ts.map +1 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +2 -0
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
- package/types/helpers/proxyThemeVariables.d.ts +0 -0
- package/types/helpers/pseudoDescriptors.d.ts +16 -0
- package/types/helpers/registerCSSVariable.d.ts +5 -0
- package/types/helpers/themeable.d.ts +0 -0
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/helpers/validate.d.ts +0 -0
- package/types/helpers/withStaticProperties.d.ts +0 -0
- package/types/helpers/wrapThemeManagerContext.d.ts +0 -0
- package/types/helpers/wrapThemeManagerContext.d.ts.map +0 -0
- package/types/hooks/useConstant.d.ts +0 -0
- package/types/hooks/useFeatures.d.ts +11 -5
- package/types/hooks/useFeatures.d.ts.map +1 -1
- package/types/hooks/useId.d.ts +0 -0
- package/types/hooks/useIsMounted.d.ts +0 -0
- package/types/hooks/useIsTouchDevice.d.ts +0 -0
- package/types/hooks/useMedia.d.ts +0 -0
- package/types/hooks/useMedia.d.ts.map +0 -0
- package/types/hooks/usePressable.d.ts +0 -0
- package/types/hooks/usePrevious.d.ts +1 -0
- package/types/hooks/useTheme.d.ts +15 -6
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/hooks/useUnmountEffect.d.ts +0 -0
- package/types/index.d.ts +16 -6
- package/types/index.d.ts.map +1 -1
- package/types/insertFont.d.ts +6 -0
- package/types/insertFont.d.ts.map +1 -0
- package/types/static.d.ts +3 -1
- package/types/static.d.ts.map +1 -1
- package/types/styled.d.ts +2 -2
- package/types/styled.d.ts.map +1 -1
- package/types/types-rnw.d.ts +0 -0
- package/types/types.d.ts +71 -51
- package/types/types.d.ts.map +1 -1
- package/types/views/Slot.d.ts +1 -0
- package/types/views/Stack.d.ts +0 -0
- package/types/views/Stack.d.ts.map +0 -0
- package/types/views/Text.d.ts +0 -0
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/TextAncestorContext.d.ts +0 -0
- package/types/views/TextAncestorContext.d.ts.map +1 -1
- package/types/views/Theme.d.ts +1 -9
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeInverse.d.ts +0 -0
- package/types/views/ThemeInverse.d.ts.map +1 -1
- package/types/views/ThemeProvider.d.ts +2 -0
- package/types/views/ThemeProvider.d.ts.map +1 -1
- package/types/views/ThemeReset.d.ts +0 -0
- package/types/views/ThemeReset.d.ts.map +0 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js +0 -87
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/cjs/helpers/fixNativeShadow.native.js +0 -63
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/cjs/helpers/getButtonSize.js +0 -45
- package/dist/cjs/helpers/getButtonSize.js.map +0 -7
- package/dist/esm/helpers/addStylesUsingClassname.js +0 -64
- package/dist/esm/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.native.js +0 -41
- package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/esm/helpers/getButtonSize.js +0 -24
- package/dist/esm/helpers/getButtonSize.js.map +0 -7
- package/dist/jsx/Tamagui.js +0 -41
- package/dist/jsx/ThemeContext.js +0 -5
- package/dist/jsx/ThemeManager.js +0 -186
- package/dist/jsx/conf.js +0 -35
- package/dist/jsx/constants/constants.js +0 -17
- package/dist/jsx/constants/platform.js +0 -25
- package/dist/jsx/constants/rnw.js +0 -23
- package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
- package/dist/jsx/createComponent.js +0 -617
- package/dist/jsx/createFont.js +0 -27
- package/dist/jsx/createShorthands.js +0 -9
- package/dist/jsx/createTamagui.js +0 -201
- package/dist/jsx/createTheme.js +0 -6
- package/dist/jsx/createTokens.js +0 -28
- package/dist/jsx/createVariable.js +0 -48
- package/dist/jsx/defaultComponentState.js +0 -0
- package/dist/jsx/helpers/RNComponents.js +0 -11
- package/dist/jsx/helpers/addStylesUsingClassname.js +0 -63
- package/dist/jsx/helpers/areEqualSets.js +0 -15
- package/dist/jsx/helpers/createMediaStyle.js +0 -30
- package/dist/jsx/helpers/createPropMapper.js +0 -237
- package/dist/jsx/helpers/createShallowUpdate.js +0 -18
- package/dist/jsx/helpers/createTamaguiProvider.js +0 -34
- package/dist/jsx/helpers/extendStaticConfig.js +0 -61
- package/dist/jsx/helpers/fixNativeShadow.js +0 -7
- package/dist/jsx/helpers/fixNativeShadow.native.js +0 -40
- package/dist/jsx/helpers/getButtonSize.js +0 -23
- package/dist/jsx/helpers/getExpandedShorthands.js +0 -18
- package/dist/jsx/helpers/getSize.js +0 -12
- package/dist/jsx/helpers/getSplitStyles.js +0 -302
- package/dist/jsx/helpers/getStylesAtomic.js +0 -130
- package/dist/jsx/helpers/getStylesAtomic.native.js +0 -9
- package/dist/jsx/helpers/insertStyleRule.js +0 -94
- package/dist/jsx/helpers/isObj.js +0 -6
- package/dist/jsx/helpers/isTamaguiElement.js +0 -10
- package/dist/jsx/helpers/matchMedia.js +0 -17
- package/dist/jsx/helpers/matchMedia.native.js +0 -8
- package/dist/jsx/helpers/proxyThemeVariables.js +0 -17
- package/dist/jsx/helpers/themeable.js +0 -24
- package/dist/jsx/helpers/validate.js +0 -75
- package/dist/jsx/helpers/withStaticProperties.js +0 -9
- package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -10
- package/dist/jsx/hooks/useConstant.js +0 -14
- package/dist/jsx/hooks/useFeatures.js +0 -167
- package/dist/jsx/hooks/useId.js +0 -34
- package/dist/jsx/hooks/useIsMounted.js +0 -18
- package/dist/jsx/hooks/useIsTouchDevice.js +0 -16
- package/dist/jsx/hooks/useMedia.js +0 -158
- package/dist/jsx/hooks/usePressable.js +0 -13
- package/dist/jsx/hooks/useTheme.js +0 -177
- package/dist/jsx/hooks/useUnmountEffect.js +0 -10
- package/dist/jsx/index.js +0 -54
- package/dist/jsx/static.js +0 -16
- package/dist/jsx/styled.js +0 -48
- package/dist/jsx/types-rnw.js +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Slot.js +0 -56
- package/dist/jsx/views/Stack.js +0 -12
- package/dist/jsx/views/Text.js +0 -61
- package/dist/jsx/views/TextAncestorContext.js +0 -15
- package/dist/jsx/views/Theme.js +0 -31
- package/dist/jsx/views/ThemeInverse.js +0 -22
- package/dist/jsx/views/ThemeProvider.js +0 -35
- package/dist/jsx/views/ThemeReset.js +0 -34
- package/types/constants/constants.d.ts.map +0 -1
- package/types/constants/platform.d.ts.map +0 -1
- package/types/contexts/ButtonInsideButtonContext.d.ts.map +0 -1
- package/types/createShorthands.d.ts.map +0 -1
- package/types/createTheme.d.ts.map +0 -1
- package/types/createVariable.d.ts.map +0 -1
- package/types/defaultComponentState.d.ts.map +0 -1
- package/types/helpers/RNComponents.d.ts.map +0 -1
- package/types/helpers/addStylesUsingClassname.d.ts +0 -3
- package/types/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/types/helpers/areEqualSets.d.ts.map +0 -1
- package/types/helpers/createShallowUpdate.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.native.d.ts +0 -2
- package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/types/helpers/getButtonSize.d.ts +0 -8
- package/types/helpers/getButtonSize.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/types/helpers/getTextSize.d.ts +0 -3
- package/types/helpers/getTextSize.d.ts.map +0 -1
- package/types/helpers/insertStyleRule.d.ts.map +0 -1
- package/types/helpers/isObj.d.ts.map +0 -1
- package/types/helpers/matchMedia.d.ts.map +0 -1
- package/types/helpers/matchMedia.native.d.ts.map +0 -1
- package/types/helpers/proxyThemeVariables.d.ts.map +0 -1
- package/types/helpers/validate.d.ts.map +0 -1
- package/types/helpers/withStaticProperties.d.ts.map +0 -1
- package/types/hooks/useConstant.d.ts.map +0 -1
- package/types/hooks/useId.d.ts.map +0 -1
- package/types/hooks/useIsMounted.d.ts.map +0 -1
- package/types/hooks/useIsTouchDevice.d.ts.map +0 -1
- package/types/hooks/usePressable.d.ts.map +0 -1
- package/types/hooks/useUnmountEffect.d.ts.map +0 -1
- package/types/types-rnw.d.ts.map +0 -1
- package/types/views/Slot.d.ts.map +0 -1
|
@@ -1,107 +1,101 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import { getConfig } from "../conf";
|
|
4
2
|
import { isWeb } from "../constants/platform";
|
|
5
3
|
import { isVariable } from "../createVariable";
|
|
4
|
+
import { expandStyle } from "./expandStyle";
|
|
5
|
+
import { expandStyles } from "./expandStyles";
|
|
6
|
+
import { getVariantExtras } from "./getVariantExtras";
|
|
6
7
|
import { isObj } from "./isObj";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (key in tokenCategories[cat]) {
|
|
13
|
-
const spreadVariant = variant[`...${cat}`];
|
|
14
|
-
if (spreadVariant) {
|
|
15
|
-
return spreadVariant;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
let fn;
|
|
20
|
-
if (typeof value === "number") {
|
|
21
|
-
fn = variant[":number"];
|
|
22
|
-
} else if (typeof value === "string") {
|
|
23
|
-
fn = variant[":string"];
|
|
24
|
-
} else if (value === true || value === false) {
|
|
25
|
-
fn = variant[":boolean"];
|
|
26
|
-
}
|
|
27
|
-
fn = fn || variant[value];
|
|
28
|
-
return fn || variant["..."] || variant["...size"];
|
|
29
|
-
}
|
|
30
|
-
__name(getVariantFunction, "getVariantFunction");
|
|
31
|
-
const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
|
|
8
|
+
import { mergeProps } from "./mergeProps";
|
|
9
|
+
const getReturnVariablesAs = (props, state) => {
|
|
10
|
+
return !!props.animation || state.resolveVariablesAs === "value" ? isWeb ? "non-color-value" : "value" : "auto";
|
|
11
|
+
};
|
|
12
|
+
const createPropMapper = (staticConfig) => {
|
|
32
13
|
const variants = staticConfig.variants || {};
|
|
33
|
-
const defaultProps = staticConfig.defaultProps || {};
|
|
34
|
-
|
|
14
|
+
const defaultProps = mergeProps(staticConfig.defaultProps || {}, {}, true)[0];
|
|
15
|
+
const mapper = (key, value, theme, propsIn, state, avoidDefaultProps = false, debug) => {
|
|
35
16
|
const conf = getConfig();
|
|
36
17
|
if (!conf) {
|
|
37
18
|
console.trace("no conf! err");
|
|
38
19
|
return;
|
|
39
20
|
}
|
|
21
|
+
const props = state.fallbackProps || propsIn;
|
|
22
|
+
const returnVariablesAs = getReturnVariablesAs(props, state);
|
|
40
23
|
const fontFamily = props.fontFamily || defaultProps.fontFamily || "$body";
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
if (variantValue) {
|
|
45
|
-
if (typeof variantValue === "function") {
|
|
46
|
-
const fn = variantValue;
|
|
47
|
-
variantValue = fn(value, {
|
|
48
|
-
fonts: conf.fontsParsed,
|
|
49
|
-
tokens: conf.tokensParsed,
|
|
50
|
-
theme,
|
|
51
|
-
props: avoidDefaultProps ? props : new Proxy(props, {
|
|
52
|
-
get(target, key2) {
|
|
53
|
-
if (Reflect.has(target, key2)) {
|
|
54
|
-
return Reflect.get(target, key2);
|
|
55
|
-
}
|
|
56
|
-
if (defaultProps) {
|
|
57
|
-
return Reflect.get(defaultProps, key2);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (isObj(variantValue)) {
|
|
64
|
-
variantValue = resolveTokens(variantValue, conf, theme, fontFamily, returnVariablesAs);
|
|
65
|
-
}
|
|
66
|
-
return expansions(variantValue);
|
|
67
|
-
}
|
|
24
|
+
const variantValue = resolveVariants(key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, "", avoidDefaultProps);
|
|
25
|
+
if (variantValue) {
|
|
26
|
+
return variantValue;
|
|
68
27
|
}
|
|
69
|
-
let shouldReturn =
|
|
28
|
+
let shouldReturn = value !== void 0 && value !== null;
|
|
70
29
|
if (conf.shorthands[key]) {
|
|
71
30
|
shouldReturn = true;
|
|
72
31
|
key = conf.shorthands[key];
|
|
73
32
|
}
|
|
74
33
|
if (value) {
|
|
75
|
-
shouldReturn = true;
|
|
76
34
|
if (value[0] === "$") {
|
|
77
|
-
value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs);
|
|
35
|
+
value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs, debug);
|
|
78
36
|
} else if (isVariable(value)) {
|
|
79
|
-
value = getVariableValue(value, returnVariablesAs);
|
|
37
|
+
value = getVariableValue(key, value, returnVariablesAs);
|
|
80
38
|
}
|
|
81
39
|
}
|
|
82
40
|
if (shouldReturn) {
|
|
83
|
-
return
|
|
84
|
-
[key]: value
|
|
85
|
-
});
|
|
41
|
+
return expandStyle(key, value) || [[key, value]];
|
|
86
42
|
}
|
|
87
43
|
};
|
|
88
|
-
|
|
89
|
-
|
|
44
|
+
return mapper;
|
|
45
|
+
};
|
|
46
|
+
const resolveVariants = (key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps = false, debug) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const variant = variants && variants[key];
|
|
49
|
+
if (variant && value !== void 0) {
|
|
50
|
+
let variantValue = getVariantDefinition(variant, key, value, conf);
|
|
51
|
+
if (variantValue) {
|
|
52
|
+
if (typeof variantValue === "function") {
|
|
53
|
+
const fn = variantValue;
|
|
54
|
+
variantValue = fn(value, getVariantExtras(props, theme, defaultProps, avoidDefaultProps));
|
|
55
|
+
}
|
|
56
|
+
if (isObj(variantValue)) {
|
|
57
|
+
variantValue = resolveTokensAndVariants(key, variantValue, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug);
|
|
58
|
+
}
|
|
59
|
+
if (variantValue) {
|
|
60
|
+
return Object.entries(expandStyles(variantValue));
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if (process.env.NODE_ENV === "development") {
|
|
64
|
+
if ((_a = staticConfig.validStyles) == null ? void 0 : _a[key]) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (value === false) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const name = staticConfig.componentName || "[UnnamedComponent]";
|
|
71
|
+
console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const resolveTokensAndVariants = (key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug) => {
|
|
90
78
|
var _a;
|
|
91
|
-
|
|
92
|
-
for (const rKey in
|
|
79
|
+
const res = {};
|
|
80
|
+
for (const rKey in value) {
|
|
93
81
|
const fKey = conf.shorthands[rKey] || rKey;
|
|
94
|
-
const val =
|
|
82
|
+
const val = value[rKey];
|
|
95
83
|
if (isVariable(val)) {
|
|
96
|
-
res[fKey] =
|
|
84
|
+
res[fKey] = !isWeb || returnVariablesAs === "value" ? val.val : val.variable;
|
|
85
|
+
} else if (variants[fKey]) {
|
|
86
|
+
if (parentVariantKey === key) {
|
|
87
|
+
res[fKey] = val;
|
|
88
|
+
} else {
|
|
89
|
+
Object.assign(res, Object.fromEntries(resolveVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug)));
|
|
90
|
+
}
|
|
97
91
|
} else if (typeof val === "string") {
|
|
98
|
-
const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily,
|
|
92
|
+
const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs, debug) : val;
|
|
99
93
|
res[fKey] = fVal;
|
|
100
94
|
} else {
|
|
101
95
|
if (isObj(val)) {
|
|
102
|
-
res[fKey] =
|
|
96
|
+
res[fKey] = resolveTokensAndVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug);
|
|
103
97
|
} else {
|
|
104
|
-
res[fKey] =
|
|
98
|
+
res[fKey] = value[fKey];
|
|
105
99
|
}
|
|
106
100
|
}
|
|
107
101
|
if (process.env.NODE_ENV === "development") {
|
|
@@ -111,16 +105,49 @@ const resolveTokens = /* @__PURE__ */ __name((input, conf, theme, fontFamily, re
|
|
|
111
105
|
}
|
|
112
106
|
}
|
|
113
107
|
return res;
|
|
114
|
-
}
|
|
108
|
+
};
|
|
109
|
+
function getVariantDefinition(variant, key, value, conf) {
|
|
110
|
+
if (typeof variant === "function") {
|
|
111
|
+
return variant;
|
|
112
|
+
}
|
|
113
|
+
if (variant[value]) {
|
|
114
|
+
return variant[value];
|
|
115
|
+
}
|
|
116
|
+
const { tokensParsed } = conf;
|
|
117
|
+
if (variant["...size"] && value in tokensParsed.size) {
|
|
118
|
+
return variant["...size"];
|
|
119
|
+
}
|
|
120
|
+
if (variant["...color"] && value in tokensParsed.color) {
|
|
121
|
+
return variant["...color"];
|
|
122
|
+
}
|
|
123
|
+
if (variant["...radius"] && value in tokensParsed.radius) {
|
|
124
|
+
return variant["...radius"];
|
|
125
|
+
}
|
|
126
|
+
if (variant["...space"] && value in tokensParsed.space) {
|
|
127
|
+
return variant["...space"];
|
|
128
|
+
}
|
|
129
|
+
if (variant["...zIndex"] && value in tokensParsed.zIndex) {
|
|
130
|
+
return variant["...zIndex"];
|
|
131
|
+
}
|
|
132
|
+
let fn;
|
|
133
|
+
if (typeof value === "number") {
|
|
134
|
+
fn = variant[":number"];
|
|
135
|
+
} else if (typeof value === "string") {
|
|
136
|
+
fn = variant[":string"];
|
|
137
|
+
} else if (value === true || value === false) {
|
|
138
|
+
fn = variant[":boolean"];
|
|
139
|
+
}
|
|
140
|
+
return fn || variant["..."] || variant["...size"];
|
|
141
|
+
}
|
|
115
142
|
const fontShorthand = {
|
|
116
143
|
fontSize: "size",
|
|
117
144
|
fontWeight: "weight"
|
|
118
145
|
};
|
|
119
|
-
const getToken =
|
|
146
|
+
const getToken = (key, value, { tokensParsed, fontsParsed }, theme, fontFamily = "$body", resolveAs, debug) => {
|
|
120
147
|
var _a, _b, _c;
|
|
121
148
|
let valOrVar;
|
|
122
149
|
let hasSet = false;
|
|
123
|
-
if (value
|
|
150
|
+
if (theme[value]) {
|
|
124
151
|
valOrVar = theme[value];
|
|
125
152
|
hasSet = true;
|
|
126
153
|
} else {
|
|
@@ -155,21 +182,39 @@ const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, fontsParsed
|
|
|
155
182
|
}
|
|
156
183
|
}
|
|
157
184
|
if (hasSet) {
|
|
158
|
-
return getVariableValue(valOrVar, resolveAs);
|
|
185
|
+
return getVariableValue(key, valOrVar, resolveAs);
|
|
159
186
|
}
|
|
160
187
|
if (process.env.NODE_ENV === "development") {
|
|
161
188
|
if (value && value[0] === "$") {
|
|
162
|
-
console.
|
|
189
|
+
console.trace(`\u26A0\uFE0F You've passed the value "${value}" to the style property "${key}", but there's no theme or token with the key "${value}". Using theme "${theme.name}".
|
|
190
|
+
|
|
191
|
+
Set the debug prop to true to see more detailed debug information.`);
|
|
192
|
+
if (debug) {
|
|
193
|
+
if (typeof window !== "undefined") {
|
|
194
|
+
console.log("Looked in:");
|
|
195
|
+
console.log("Theme:", theme);
|
|
196
|
+
console.log("Tokens:", tokensParsed);
|
|
197
|
+
console.log("Fonts:", fontsParsed);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
163
200
|
return null;
|
|
164
201
|
}
|
|
165
202
|
}
|
|
166
203
|
return value;
|
|
167
|
-
}
|
|
168
|
-
function getVariableValue(valOrVar, resolveAs = "auto") {
|
|
204
|
+
};
|
|
205
|
+
function getVariableValue(key, valOrVar, resolveAs = "auto") {
|
|
169
206
|
if (isVariable(valOrVar)) {
|
|
170
207
|
if (resolveAs === "variable") {
|
|
171
208
|
return valOrVar;
|
|
172
209
|
}
|
|
210
|
+
if (resolveAs === "non-color-value") {
|
|
211
|
+
if (isWeb) {
|
|
212
|
+
if (key in tokenCategories.color) {
|
|
213
|
+
return valOrVar.variable;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return valOrVar.val;
|
|
217
|
+
}
|
|
173
218
|
if (!isWeb || resolveAs === "value") {
|
|
174
219
|
return valOrVar.val;
|
|
175
220
|
}
|
|
@@ -177,10 +222,13 @@ function getVariableValue(valOrVar, resolveAs = "auto") {
|
|
|
177
222
|
}
|
|
178
223
|
return valOrVar;
|
|
179
224
|
}
|
|
180
|
-
__name(getVariableValue, "getVariableValue");
|
|
181
225
|
const tokenCategories = {
|
|
182
226
|
radius: {
|
|
183
|
-
borderRadius: true
|
|
227
|
+
borderRadius: true,
|
|
228
|
+
borderTopLeftRadius: true,
|
|
229
|
+
borderTopRightRadius: true,
|
|
230
|
+
borderBottomLeftRadius: true,
|
|
231
|
+
borderBottomRightRadius: true
|
|
184
232
|
},
|
|
185
233
|
size: {
|
|
186
234
|
width: true,
|
|
@@ -200,39 +248,8 @@ const tokenCategories = {
|
|
|
200
248
|
borderRightColor: true
|
|
201
249
|
}
|
|
202
250
|
};
|
|
203
|
-
const sidesX = ["Left", "Right"];
|
|
204
|
-
const sidesY = ["Top", "Bottom"];
|
|
205
|
-
const sidesXY = [...sidesX, ...sidesY];
|
|
206
|
-
const expand = {
|
|
207
|
-
padding: sidesXY.map((x) => `padding${x}`),
|
|
208
|
-
paddingHorizontal: sidesX.map((x) => `padding${x}`),
|
|
209
|
-
paddingVertical: sidesY.map((x) => `padding${x}`),
|
|
210
|
-
margin: sidesXY.map((x) => `margin${x}`),
|
|
211
|
-
marginHorizontal: sidesX.map((x) => `margin${x}`),
|
|
212
|
-
marginVertical: sidesY.map((x) => `margin${x}`),
|
|
213
|
-
borderWidth: sidesXY.map((x) => `border${x}Width`)
|
|
214
|
-
};
|
|
215
|
-
function expansions(styleObj) {
|
|
216
|
-
var _a, _b;
|
|
217
|
-
for (const key in expand) {
|
|
218
|
-
if (key in styleObj) {
|
|
219
|
-
for (const expandKey of expand[key]) {
|
|
220
|
-
styleObj[expandKey] = styleObj[key];
|
|
221
|
-
}
|
|
222
|
-
delete styleObj[key];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if ("flex" in styleObj) {
|
|
226
|
-
if (typeof styleObj.flex === "number") {
|
|
227
|
-
styleObj.flexGrow = (_a = styleObj.flexGrow) != null ? _a : styleObj.flex;
|
|
228
|
-
styleObj.flexShrink = (_b = styleObj.flexShrink) != null ? _b : 1;
|
|
229
|
-
delete styleObj.flex;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return styleObj;
|
|
233
|
-
}
|
|
234
|
-
__name(expansions, "expansions");
|
|
235
251
|
export {
|
|
236
|
-
createPropMapper
|
|
252
|
+
createPropMapper,
|
|
253
|
+
getReturnVariablesAs
|
|
237
254
|
};
|
|
238
255
|
//# sourceMappingURL=createPropMapper.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createPropMapper.ts"],
|
|
4
|
-
"sourcesContent": ["import { getConfig } from '../conf'\nimport { isWeb } from '../constants/platform'\nimport { Variable, isVariable } from '../createVariable'\nimport { StaticConfig, TamaguiInternalConfig, VariantSpreadFunction } from '../types'\nimport { isObj } from './isObj'\n\nexport type ResolveVariableTypes = 'auto' | 'value' | 'variable' | 'both'\n\n// goes through specificity finding best matching variant function\nfunction getVariantFunction(variant: any, key: string, value: any) {\n if (typeof variant === 'function') {\n return variant\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const spreadVariant = variant[`...${cat}`]\n if (spreadVariant) {\n return spreadVariant\n }\n }\n }\n let fn: any\n if (typeof value === 'number') {\n fn = variant[':number']\n } else if (typeof value === 'string') {\n fn = variant[':string']\n } else if (value === true || value === false) {\n fn = variant[':boolean']\n }\n fn = fn || variant[value]\n // fallback to size ultimately - could do token level detection\n return fn || variant['...'] || variant['...size']\n}\n\nexport const createPropMapper = (staticConfig: Partial<StaticConfig>) => {\n const variants = staticConfig.variants || {}\n const defaultProps = staticConfig.defaultProps || {}\n\n return (\n key: string,\n value: any,\n theme: any,\n props: any,\n returnVariablesAs: ResolveVariableTypes = !!props.animation ? 'value' : 'auto',\n avoidDefaultProps = false\n ) => {\n const conf = getConfig()\n if (!conf) {\n console.trace('no conf! err')\n return\n }\n\n // handled here because we need to resolve this off tokens, its the only one-off like this\n const fontFamily = props.fontFamily || defaultProps.fontFamily || '$body'\n const variant = variants && variants[key]\n\n if (variant && value !== undefined) {\n let variantValue = getVariantFunction(variant, key, value)\n\n if (variantValue) {\n if (typeof variantValue === 'function') {\n const fn = variantValue as VariantSpreadFunction<any>\n variantValue = fn(value, {\n fonts: conf.fontsParsed,\n tokens: conf.tokensParsed,\n theme,\n // TODO do this in splitstlye\n // we avoid passing in default props for media queries because that would confuse things like SizableText.size:\n props: avoidDefaultProps\n ? props\n : new Proxy(props, {\n get(target, key) {\n if (Reflect.has(target, key)) {\n return Reflect.get(target, key)\n }\n // these props may be extracted into classNames, but we still want to access them\n // at runtime, so we proxy back to defaultProps but don't pass them\n if (defaultProps) {\n return Reflect.get(defaultProps, key)\n }\n },\n }),\n })\n }\n\n if (isObj(variantValue)) {\n variantValue = resolveTokens(variantValue, conf, theme, fontFamily, returnVariablesAs)\n }\n\n return expansions(variantValue)\n }\n }\n\n let shouldReturn = false\n\n // handle shorthands\n if (conf.shorthands[key]) {\n shouldReturn = true\n key = conf.shorthands[key]\n }\n\n if (value) {\n shouldReturn = true\n if (value[0] === '$') {\n value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs)\n } else if (isVariable(value)) {\n value = getVariableValue(value, returnVariablesAs)\n }\n }\n\n if (shouldReturn) {\n return expansions({\n [key]: value,\n })\n }\n }\n}\n\nconst resolveTokens = (\n input: Object,\n conf: TamaguiInternalConfig,\n theme: any,\n fontFamily: any,\n resolveAs?: ResolveVariableTypes\n) => {\n let res = {}\n for (const rKey in input) {\n const fKey = conf.shorthands[rKey] || rKey\n const val = input[rKey]\n if (isVariable(val)) {\n res[fKey] =\n resolveAs === 'variable' ? val : !isWeb || resolveAs === 'value' ? val.val : val.variable\n } else if (typeof val === 'string') {\n const fVal = val[0] === '$' ? getToken(fKey, val, conf, theme, fontFamily, resolveAs) : val\n res[fKey] = fVal\n } else {\n if (isObj(val)) {\n // for things like shadowOffset, hoverStyle which is a sub-object\n res[fKey] = resolveTokens(val, conf, theme, fontFamily, resolveAs)\n } else {\n // nullish values cant be tokens so need no exrta parsing\n res[fKey] = input[fKey]\n }\n }\n if (process.env.NODE_ENV === 'development') {\n if (res[fKey]?.[0] === '$') {\n console.warn(`\u26A0\uFE0F Missing token in theme ${theme.name}:`, fKey, res[fKey])\n }\n }\n }\n return res\n}\n\nconst fontShorthand = {\n fontSize: 'size',\n fontWeight: 'weight',\n}\n\nconst getToken = (\n key: string,\n value: string,\n { tokensParsed, fontsParsed }: TamaguiInternalConfig,\n theme: any,\n fontFamily: string | undefined = '$body',\n resolveAs?: ResolveVariableTypes\n) => {\n let valOrVar: any\n let hasSet = false\n if (value in theme) {\n valOrVar = theme[value]\n hasSet = true\n } else {\n switch (key) {\n case 'fontFamily':\n valOrVar = fontsParsed[value]?.family || value\n hasSet = true\n break\n case 'fontSize':\n case 'lineHeight':\n case 'letterSpacing':\n case 'fontWeight':\n valOrVar = fontsParsed[fontFamily]?.[fontShorthand[key] || key]?.[value] || value\n hasSet = true\n break\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const res = tokensParsed[cat][value]\n if (res) {\n valOrVar = res\n hasSet = true\n }\n }\n }\n if (!hasSet) {\n const spaceVar = tokensParsed.space[value]\n if (spaceVar) {\n valOrVar = spaceVar\n hasSet = true\n }\n }\n }\n if (hasSet) {\n return getVariableValue(valOrVar, resolveAs)\n }\n if (process.env.NODE_ENV === 'development') {\n if (value && value[0] === '$') {\n console.warn(`\u26A0\uFE0F Missing token:`, key, value, fontFamily, theme, fontsParsed)\n return null\n }\n }\n return value\n}\n\nfunction getVariableValue(valOrVar: Variable | any, resolveAs: ResolveVariableTypes = 'auto') {\n if (isVariable(valOrVar)) {\n if (resolveAs === 'variable') {\n return valOrVar\n }\n if (!isWeb || resolveAs === 'value') {\n return valOrVar.val\n }\n return valOrVar.variable\n }\n return valOrVar\n}\n\n// just specificy the least costly, all else go to `space` (most keys - we can exclude)\nconst tokenCategories = {\n radius: {\n borderRadius: true,\n },\n size: {\n width: true,\n height: true,\n minWidth: true,\n minHeight: true,\n maxWidth: true,\n maxHeight: true,\n },\n color: {\n color: true,\n backgroundColor: true,\n borderColor: true,\n borderBottomColor: true,\n borderTopColor: true,\n borderLeftColor: true,\n borderRightColor: true,\n },\n}\n\n// TODO need to move to own engine for all this... duplicating some functionality temporarily\n\nconst sidesX = ['Left', 'Right']\nconst sidesY = ['Top', 'Bottom']\nconst sidesXY = [...sidesX, ...sidesY]\nconst expand = {\n padding: sidesXY.map((x) => `padding${x}`),\n paddingHorizontal: sidesX.map((x) => `padding${x}`),\n paddingVertical: sidesY.map((x) => `padding${x}`),\n margin: sidesXY.map((x) => `margin${x}`),\n marginHorizontal: sidesX.map((x) => `margin${x}`),\n marginVertical: sidesY.map((x) => `margin${x}`),\n borderWidth: sidesXY.map((x) => `border${x}Width`),\n}\n\nfunction expansions(styleObj: Record<string, any>) {\n for (const key in expand) {\n if (key in styleObj) {\n for (const expandKey of expand[key]) {\n styleObj[expandKey] = styleObj[key]\n }\n delete styleObj[key]\n }\n }\n if ('flex' in styleObj) {\n // see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex\n if (typeof styleObj.flex === 'number') {\n styleObj.flexGrow = styleObj.flexGrow ?? styleObj.flex\n styleObj.flexShrink = styleObj.flexShrink ?? 1\n delete styleObj.flex\n }\n }\n return styleObj\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { getConfig } from '../conf'\nimport { isWeb } from '../constants/platform'\nimport { Variable, isVariable } from '../createVariable'\nimport {\n DebugProp,\n GenericVariantDefinitions,\n PropMapper,\n SplitStyleState,\n StaticConfigParsed,\n TamaguiInternalConfig,\n VariantSpreadFunction,\n} from '../types'\nimport { expandStyle } from './expandStyle'\nimport { expandStyles } from './expandStyles'\nimport { getVariantExtras } from './getVariantExtras'\nimport { isObj } from './isObj'\nimport { mergeProps } from './mergeProps'\n\nexport type ResolveVariableTypes = 'auto' | 'value' | 'variable' | 'both' | 'non-color-value'\n\nexport const getReturnVariablesAs = (props: any, state: Partial<SplitStyleState>) => {\n return !!props.animation || state.resolveVariablesAs === 'value'\n ? isWeb\n ? 'non-color-value'\n : 'value'\n : 'auto'\n}\n\nexport const createPropMapper = (staticConfig: StaticConfigParsed) => {\n const variants = staticConfig.variants || {}\n\n // temp remove classnames\n const defaultProps = mergeProps(staticConfig.defaultProps || {}, {}, true)[0]\n\n const mapper: PropMapper = (\n key,\n value,\n theme,\n propsIn,\n state,\n avoidDefaultProps = false,\n debug\n ) => {\n const conf = getConfig()\n if (!conf) {\n console.trace('no conf! err')\n return\n }\n\n const props = state.fallbackProps || propsIn\n const returnVariablesAs = getReturnVariablesAs(props, state)\n\n // handled here because we need to resolve this off tokens, its the only one-off like this\n const fontFamily = props.fontFamily || defaultProps.fontFamily || '$body'\n\n const variantValue = resolveVariants(\n key,\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n '',\n avoidDefaultProps\n )\n\n if (variantValue) {\n return variantValue\n }\n\n let shouldReturn = value !== undefined && value !== null\n\n // handle shorthands\n if (conf.shorthands[key]) {\n shouldReturn = true\n key = conf.shorthands[key]\n }\n\n if (value) {\n if (value[0] === '$') {\n // prettier-ignore\n value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs, debug)\n } else if (isVariable(value)) {\n value = getVariableValue(key, value, returnVariablesAs)\n }\n }\n\n if (shouldReturn) {\n return expandStyle(key, value) || [[key, value]]\n }\n }\n\n return mapper\n}\n\ntype StyleResolver = (\n key: string,\n value: any,\n props: Record<string, any>,\n defaultProps: any,\n theme: any,\n variants: GenericVariantDefinitions,\n fontFamily: string,\n conf: TamaguiInternalConfig,\n returnVariablesAs: 'auto' | 'value' | 'non-color-value',\n staticConfig: StaticConfigParsed,\n parentVariantKey: string,\n avoidDefaultProps?: boolean,\n debug?: DebugProp\n) => any\n\nconst resolveVariants: StyleResolver = (\n key,\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps = false,\n debug\n) => {\n const variant = variants && variants[key]\n if (variant && value !== undefined) {\n let variantValue = getVariantDefinition(variant, key, value, conf)\n\n if (variantValue) {\n if (typeof variantValue === 'function') {\n const fn = variantValue as VariantSpreadFunction<any>\n variantValue = fn(value, getVariantExtras(props, theme, defaultProps, avoidDefaultProps))\n }\n\n if (isObj(variantValue)) {\n variantValue = resolveTokensAndVariants(\n key,\n variantValue,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps,\n debug\n )\n }\n\n if (variantValue) {\n return Object.entries(expandStyles(variantValue))\n }\n } else {\n // variant at key exists, but no matching variant value, return nothing\n if (process.env.NODE_ENV === 'development') {\n if (staticConfig.validStyles?.[key]) {\n return null\n }\n if (value === false) {\n // don't warn on missing false values, common to only use true\n return null\n }\n const name = staticConfig.componentName || '[UnnamedComponent]'\n console.warn(\n `No variant found: ${name} has variant \"${key}\", but no matching value \"${value}\"`\n )\n }\n return null\n }\n }\n}\n\nconst resolveTokensAndVariants: StyleResolver = (\n key, // we dont use key assume value is object instead\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps,\n debug\n) => {\n const res = {}\n for (const rKey in value) {\n const fKey = conf.shorthands[rKey] || rKey\n const val = value[rKey]\n if (isVariable(val)) {\n res[fKey] = !isWeb || returnVariablesAs === 'value' ? val.val : val.variable\n } else if (variants[fKey]) {\n // avoids infinite loop if variant is matching a style prop\n // eg: { variants: { flex: { true: { flex: 2 } } } }\n if (parentVariantKey === key) {\n res[fKey] = val\n } else {\n Object.assign(\n res,\n Object.fromEntries(\n resolveVariants(\n fKey,\n val,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n key,\n avoidDefaultProps,\n debug\n )\n )\n )\n }\n } else if (typeof val === 'string') {\n const fVal =\n val[0] === '$'\n ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs, debug)\n : val\n res[fKey] = fVal\n } else {\n if (isObj(val)) {\n // sub-objects: media queries, pseudos, shadowOffset\n res[fKey] = resolveTokensAndVariants(\n fKey,\n val,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n key,\n avoidDefaultProps,\n debug\n )\n } else {\n // nullish values cant be tokens, need no extra parsing\n res[fKey] = value[fKey]\n }\n }\n if (process.env.NODE_ENV === 'development') {\n if (res[fKey]?.[0] === '$') {\n console.warn(`\u26A0\uFE0F Missing token in theme ${theme.name}:`, fKey, res[fKey])\n }\n }\n }\n return res\n}\n\n// goes through specificity finding best matching variant function\nfunction getVariantDefinition(variant: any, key: string, value: any, conf: TamaguiInternalConfig) {\n if (typeof variant === 'function') {\n return variant\n }\n if (variant[value]) {\n return variant[value]\n }\n const { tokensParsed } = conf\n if (variant['...size'] && value in tokensParsed.size) {\n return variant['...size']\n }\n if (variant['...color'] && value in tokensParsed.color) {\n return variant['...color']\n }\n if (variant['...radius'] && value in tokensParsed.radius) {\n return variant['...radius']\n }\n if (variant['...space'] && value in tokensParsed.space) {\n return variant['...space']\n }\n if (variant['...zIndex'] && value in tokensParsed.zIndex) {\n return variant['...zIndex']\n }\n let fn: any\n if (typeof value === 'number') {\n fn = variant[':number']\n } else if (typeof value === 'string') {\n fn = variant[':string']\n } else if (value === true || value === false) {\n fn = variant[':boolean']\n }\n // fallback to catch all or size\n return fn || variant['...'] || variant['...size']\n}\n\nconst fontShorthand = {\n fontSize: 'size',\n fontWeight: 'weight',\n}\n\nconst getToken = (\n key: string,\n value: string,\n { tokensParsed, fontsParsed }: TamaguiInternalConfig,\n theme: any,\n fontFamily: string | undefined = '$body',\n resolveAs?: ResolveVariableTypes,\n debug?: DebugProp\n) => {\n let valOrVar: any\n let hasSet = false\n if (theme[value]) {\n valOrVar = theme[value]\n hasSet = true\n } else {\n switch (key) {\n case 'fontFamily':\n valOrVar = fontsParsed[value]?.family || value\n hasSet = true\n break\n case 'fontSize':\n case 'lineHeight':\n case 'letterSpacing':\n case 'fontWeight':\n valOrVar = fontsParsed[fontFamily]?.[fontShorthand[key] || key]?.[value] || value\n hasSet = true\n break\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const res = tokensParsed[cat][value]\n if (res) {\n valOrVar = res\n hasSet = true\n }\n }\n }\n if (!hasSet) {\n const spaceVar = tokensParsed.space[value]\n if (spaceVar) {\n valOrVar = spaceVar\n hasSet = true\n }\n }\n }\n if (hasSet) {\n return getVariableValue(key, valOrVar, resolveAs)\n }\n if (process.env.NODE_ENV === 'development') {\n if (value && value[0] === '$') {\n console.trace(\n `\u26A0\uFE0F You've passed the value \"${value}\" to the style property \"${key}\", but there's no theme or token with the key \"${value}\". Using theme \"${theme.name}\".\n\nSet the debug prop to true to see more detailed debug information.`\n )\n if (debug) {\n if (typeof window !== 'undefined') {\n console.log('Looked in:')\n console.log('Theme:', theme)\n console.log('Tokens:', tokensParsed)\n console.log('Fonts:', fontsParsed)\n }\n }\n return null\n }\n }\n return value\n}\n\nfunction getVariableValue(\n key: string,\n valOrVar: Variable | any,\n resolveAs: ResolveVariableTypes = 'auto'\n) {\n if (isVariable(valOrVar)) {\n if (resolveAs === 'variable') {\n return valOrVar\n }\n if (resolveAs === 'non-color-value') {\n if (isWeb) {\n if (key in tokenCategories.color) {\n return valOrVar.variable\n }\n }\n return valOrVar.val\n }\n if (!isWeb || resolveAs === 'value') {\n return valOrVar.val\n }\n return valOrVar.variable\n }\n return valOrVar\n}\n\n// just specificy the least costly, all else go to `space` (most keys - we can exclude)\nconst tokenCategories = {\n radius: {\n borderRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n },\n size: {\n width: true,\n height: true,\n minWidth: true,\n minHeight: true,\n maxWidth: true,\n maxHeight: true,\n },\n color: {\n color: true,\n backgroundColor: true,\n borderColor: true,\n borderBottomColor: true,\n borderTopColor: true,\n borderLeftColor: true,\n borderRightColor: true,\n },\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { useCallback } from "react";
|
|
3
18
|
function createShallowUpdate(setter) {
|
|
4
|
-
return (next) => {
|
|
19
|
+
return useCallback((next) => {
|
|
5
20
|
setter((prev) => {
|
|
6
21
|
for (const key in next) {
|
|
7
22
|
if (prev[key] !== next[key]) {
|
|
8
|
-
return {
|
|
23
|
+
return __spreadValues(__spreadValues({}, prev), next);
|
|
9
24
|
}
|
|
10
25
|
}
|
|
11
26
|
return prev;
|
|
12
27
|
});
|
|
13
|
-
};
|
|
28
|
+
}, [setter]);
|
|
14
29
|
}
|
|
15
|
-
__name(createShallowUpdate, "createShallowUpdate");
|
|
16
30
|
export {
|
|
17
31
|
createShallowUpdate
|
|
18
32
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createShallowUpdate.tsx"],
|
|
4
|
-
"sourcesContent": ["import React
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from 'react'\n\nexport function createShallowUpdate<State extends Object>(\n setter: React.Dispatch<React.SetStateAction<State>>\n) {\n return useCallback(\n (next: Partial<State>) => {\n setter((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 [setter]\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAEO,6BACL,QACA;AACA,SAAO,YACL,CAAC,SAAyB;AACxB,WAAO,CAAC,SAAS;AACf,iBAAW,OAAO,MAAM;AACtB,YAAI,KAAK,SAAS,KAAK,MAAM;AAC3B,iBAAO,kCAAK,OAAS;AAAA,QACvB;AAAA,MACF;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GACA,CAAC,MAAM,CACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,66 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
3
29
|
import * as React from "react";
|
|
4
30
|
import { ButtonInsideButtonContext } from "../contexts/ButtonInsideButtonContext";
|
|
5
31
|
import { TextAncestorProvider } from "../views/TextAncestorContext";
|
|
6
32
|
import { ThemeProvider } from "../views/ThemeProvider";
|
|
7
|
-
function createTamaguiProvider({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
33
|
+
function createTamaguiProvider(config) {
|
|
34
|
+
return function TamaguiProvider(_a) {
|
|
35
|
+
var _b = _a, {
|
|
36
|
+
disableInjectCSS,
|
|
37
|
+
children
|
|
38
|
+
} = _b, themePropsProvider = __objRest(_b, [
|
|
39
|
+
"disableInjectCSS",
|
|
40
|
+
"children"
|
|
41
|
+
]);
|
|
16
42
|
if (typeof document !== "undefined") {
|
|
17
43
|
React.useLayoutEffect(() => {
|
|
18
|
-
if (
|
|
44
|
+
if (disableInjectCSS)
|
|
19
45
|
return;
|
|
20
46
|
const style = document.createElement("style");
|
|
21
|
-
style.appendChild(document.createTextNode(getCSS()));
|
|
47
|
+
style.appendChild(document.createTextNode(config.getCSS()));
|
|
22
48
|
document.head.appendChild(style);
|
|
23
49
|
return () => {
|
|
24
50
|
document.head.removeChild(style);
|
|
25
51
|
};
|
|
26
|
-
}, []);
|
|
52
|
+
}, [disableInjectCSS]);
|
|
27
53
|
}
|
|
28
54
|
return /* @__PURE__ */ React.createElement(ButtonInsideButtonContext.Provider, {
|
|
29
55
|
value: false
|
|
30
|
-
}, /* @__PURE__ */ React.createElement(TextAncestorProvider, null, /* @__PURE__ */ React.createElement(ThemeProvider, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
56
|
+
}, /* @__PURE__ */ React.createElement(TextAncestorProvider, null, /* @__PURE__ */ React.createElement(ThemeProvider, __spreadValues({
|
|
57
|
+
themes: config.themes,
|
|
58
|
+
defaultTheme: config.defaultTheme || "light",
|
|
59
|
+
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
60
|
+
disableRootThemeClass: config.disableRootThemeClass
|
|
61
|
+
}, themePropsProvider), children)));
|
|
62
|
+
};
|
|
35
63
|
}
|
|
36
|
-
__name(createTamaguiProvider, "createTamaguiProvider");
|
|
37
64
|
export {
|
|
38
65
|
createTamaguiProvider
|
|
39
66
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createTamaguiProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiInternalConfig, TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider(config: TamaguiInternalConfig) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (typeof document !== 'undefined') {\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(config.getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [disableInjectCSS])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider\n themes={config.themes}\n defaultTheme={config.defaultTheme || 'light'}\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n >\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AAEA;AACA;AAEO,+BAA+B,QAA+B;AACnE,SAAO,yBAAyB,IAIP;AAJO,iBAC9B;AAAA;AAAA,MACA;AAAA,QAF8B,IAG3B,+BAH2B,IAG3B;AAAA,MAFH;AAAA,MACA;AAAA;AAIA,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC;AAC1D,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,gBAAgB,CAAC;AAAA,IACvB;AAEA,WACE,oCAAC,0BAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,4BACC,oCAAC;AAAA,MACC,QAAQ,OAAO;AAAA,MACf,cAAc,OAAO,gBAAgB;AAAA,MACrC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,OAC1B,qBAEH,QACH,CACF,CACF;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { simpleHash } from "@tamagui/helpers";
|
|
2
|
+
function cssHash(val, maxLen = 10) {
|
|
3
|
+
if (val.length < maxLen) {
|
|
4
|
+
let res = "";
|
|
5
|
+
for (let i = 0; i < val.length; i++) {
|
|
6
|
+
const char = val[i];
|
|
7
|
+
if (specials[char]) {
|
|
8
|
+
res += specials[char];
|
|
9
|
+
} else {
|
|
10
|
+
res += validCSS.test(char) ? char : "_" + char.charCodeAt(0).toString();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return res;
|
|
14
|
+
}
|
|
15
|
+
return simpleHash(val);
|
|
16
|
+
}
|
|
17
|
+
const validCSS = /[a-z0-9]/i;
|
|
18
|
+
const specials = {
|
|
19
|
+
".": "dot",
|
|
20
|
+
",": "_",
|
|
21
|
+
"%": "pct",
|
|
22
|
+
"-": "neg"
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
cssHash
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=cssHash.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/cssHash.ts"],
|
|
4
|
+
"sourcesContent": ["import { simpleHash } from '@tamagui/helpers'\n\n// not sure it's worth the extra weight, could be dev time though\n// affordances for simple values\nexport function cssHash(val: string, maxLen = 10) {\n if (val.length < maxLen) {\n let res = ''\n for (let i = 0; i < val.length; i++) {\n const char = val[i]\n if (specials[char]) {\n res += specials[char]\n } else {\n res += validCSS.test(char) ? char : '_' + char.charCodeAt(0).toString()\n }\n }\n return res\n }\n return simpleHash(val)\n}\n\nconst validCSS = /[a-z0-9]/i\n\nconst specials = {\n '.': 'dot',\n ',': '_',\n '%': 'pct',\n '-': 'neg',\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAIO,iBAAiB,KAAa,SAAS,IAAI;AAChD,MAAI,IAAI,SAAS,QAAQ;AACvB,QAAI,MAAM;AACV,aAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,YAAM,OAAO,IAAI;AACjB,UAAI,SAAS,OAAO;AAClB,eAAO,SAAS;AAAA,MAClB,OAAO;AACL,eAAO,SAAS,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,CAAC,EAAE,SAAS;AAAA,MACxE;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,SAAO,WAAW,GAAG;AACvB;AAEA,MAAM,WAAW;AAEjB,MAAM,WAAW;AAAA,EACf,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|