@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
|
@@ -2,7 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,111 +17,108 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
18
|
var createPropMapper_exports = {};
|
|
20
19
|
__export(createPropMapper_exports, {
|
|
21
|
-
createPropMapper: () => createPropMapper
|
|
20
|
+
createPropMapper: () => createPropMapper,
|
|
21
|
+
getReturnVariablesAs: () => getReturnVariablesAs
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(createPropMapper_exports);
|
|
24
24
|
var import_conf = require("../conf");
|
|
25
25
|
var import_platform = require("../constants/platform");
|
|
26
26
|
var import_createVariable = require("../createVariable");
|
|
27
|
+
var import_expandStyle = require("./expandStyle");
|
|
28
|
+
var import_expandStyles = require("./expandStyles");
|
|
29
|
+
var import_getVariantExtras = require("./getVariantExtras");
|
|
27
30
|
var import_isObj = require("./isObj");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (key in tokenCategories[cat]) {
|
|
34
|
-
const spreadVariant = variant[`...${cat}`];
|
|
35
|
-
if (spreadVariant) {
|
|
36
|
-
return spreadVariant;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
let fn;
|
|
41
|
-
if (typeof value === "number") {
|
|
42
|
-
fn = variant[":number"];
|
|
43
|
-
} else if (typeof value === "string") {
|
|
44
|
-
fn = variant[":string"];
|
|
45
|
-
} else if (value === true || value === false) {
|
|
46
|
-
fn = variant[":boolean"];
|
|
47
|
-
}
|
|
48
|
-
fn = fn || variant[value];
|
|
49
|
-
return fn || variant["..."] || variant["...size"];
|
|
50
|
-
}
|
|
51
|
-
__name(getVariantFunction, "getVariantFunction");
|
|
52
|
-
const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
|
|
31
|
+
var import_mergeProps = require("./mergeProps");
|
|
32
|
+
const getReturnVariablesAs = (props, state) => {
|
|
33
|
+
return !!props.animation || state.resolveVariablesAs === "value" ? import_platform.isWeb ? "non-color-value" : "value" : "auto";
|
|
34
|
+
};
|
|
35
|
+
const createPropMapper = (staticConfig) => {
|
|
53
36
|
const variants = staticConfig.variants || {};
|
|
54
|
-
const defaultProps = staticConfig.defaultProps || {};
|
|
55
|
-
|
|
37
|
+
const defaultProps = (0, import_mergeProps.mergeProps)(staticConfig.defaultProps || {}, {}, true)[0];
|
|
38
|
+
const mapper = (key, value, theme, propsIn, state, avoidDefaultProps = false, debug) => {
|
|
56
39
|
const conf = (0, import_conf.getConfig)();
|
|
57
40
|
if (!conf) {
|
|
58
41
|
console.trace("no conf! err");
|
|
59
42
|
return;
|
|
60
43
|
}
|
|
44
|
+
const props = state.fallbackProps || propsIn;
|
|
45
|
+
const returnVariablesAs = getReturnVariablesAs(props, state);
|
|
61
46
|
const fontFamily = props.fontFamily || defaultProps.fontFamily || "$body";
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
if (variantValue) {
|
|
66
|
-
if (typeof variantValue === "function") {
|
|
67
|
-
const fn = variantValue;
|
|
68
|
-
variantValue = fn(value, {
|
|
69
|
-
fonts: conf.fontsParsed,
|
|
70
|
-
tokens: conf.tokensParsed,
|
|
71
|
-
theme,
|
|
72
|
-
props: avoidDefaultProps ? props : new Proxy(props, {
|
|
73
|
-
get(target, key2) {
|
|
74
|
-
if (Reflect.has(target, key2)) {
|
|
75
|
-
return Reflect.get(target, key2);
|
|
76
|
-
}
|
|
77
|
-
if (defaultProps) {
|
|
78
|
-
return Reflect.get(defaultProps, key2);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if ((0, import_isObj.isObj)(variantValue)) {
|
|
85
|
-
variantValue = resolveTokens(variantValue, conf, theme, fontFamily, returnVariablesAs);
|
|
86
|
-
}
|
|
87
|
-
return expansions(variantValue);
|
|
88
|
-
}
|
|
47
|
+
const variantValue = resolveVariants(key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, "", avoidDefaultProps);
|
|
48
|
+
if (variantValue) {
|
|
49
|
+
return variantValue;
|
|
89
50
|
}
|
|
90
|
-
let shouldReturn =
|
|
51
|
+
let shouldReturn = value !== void 0 && value !== null;
|
|
91
52
|
if (conf.shorthands[key]) {
|
|
92
53
|
shouldReturn = true;
|
|
93
54
|
key = conf.shorthands[key];
|
|
94
55
|
}
|
|
95
56
|
if (value) {
|
|
96
|
-
shouldReturn = true;
|
|
97
57
|
if (value[0] === "$") {
|
|
98
|
-
value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs);
|
|
58
|
+
value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs, debug);
|
|
99
59
|
} else if ((0, import_createVariable.isVariable)(value)) {
|
|
100
|
-
value = getVariableValue(value, returnVariablesAs);
|
|
60
|
+
value = getVariableValue(key, value, returnVariablesAs);
|
|
101
61
|
}
|
|
102
62
|
}
|
|
103
63
|
if (shouldReturn) {
|
|
104
|
-
return
|
|
105
|
-
[key]: value
|
|
106
|
-
});
|
|
64
|
+
return (0, import_expandStyle.expandStyle)(key, value) || [[key, value]];
|
|
107
65
|
}
|
|
108
66
|
};
|
|
109
|
-
|
|
110
|
-
|
|
67
|
+
return mapper;
|
|
68
|
+
};
|
|
69
|
+
const resolveVariants = (key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps = false, debug) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const variant = variants && variants[key];
|
|
72
|
+
if (variant && value !== void 0) {
|
|
73
|
+
let variantValue = getVariantDefinition(variant, key, value, conf);
|
|
74
|
+
if (variantValue) {
|
|
75
|
+
if (typeof variantValue === "function") {
|
|
76
|
+
const fn = variantValue;
|
|
77
|
+
variantValue = fn(value, (0, import_getVariantExtras.getVariantExtras)(props, theme, defaultProps, avoidDefaultProps));
|
|
78
|
+
}
|
|
79
|
+
if ((0, import_isObj.isObj)(variantValue)) {
|
|
80
|
+
variantValue = resolveTokensAndVariants(key, variantValue, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug);
|
|
81
|
+
}
|
|
82
|
+
if (variantValue) {
|
|
83
|
+
return Object.entries((0, import_expandStyles.expandStyles)(variantValue));
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
if (process.env.NODE_ENV === "development") {
|
|
87
|
+
if ((_a = staticConfig.validStyles) == null ? void 0 : _a[key]) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (value === false) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const name = staticConfig.componentName || "[UnnamedComponent]";
|
|
94
|
+
console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const resolveTokensAndVariants = (key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug) => {
|
|
111
101
|
var _a;
|
|
112
|
-
|
|
113
|
-
for (const rKey in
|
|
102
|
+
const res = {};
|
|
103
|
+
for (const rKey in value) {
|
|
114
104
|
const fKey = conf.shorthands[rKey] || rKey;
|
|
115
|
-
const val =
|
|
105
|
+
const val = value[rKey];
|
|
116
106
|
if ((0, import_createVariable.isVariable)(val)) {
|
|
117
|
-
res[fKey] =
|
|
107
|
+
res[fKey] = !import_platform.isWeb || returnVariablesAs === "value" ? val.val : val.variable;
|
|
108
|
+
} else if (variants[fKey]) {
|
|
109
|
+
if (parentVariantKey === key) {
|
|
110
|
+
res[fKey] = val;
|
|
111
|
+
} else {
|
|
112
|
+
Object.assign(res, Object.fromEntries(resolveVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug)));
|
|
113
|
+
}
|
|
118
114
|
} else if (typeof val === "string") {
|
|
119
|
-
const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily,
|
|
115
|
+
const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs, debug) : val;
|
|
120
116
|
res[fKey] = fVal;
|
|
121
117
|
} else {
|
|
122
118
|
if ((0, import_isObj.isObj)(val)) {
|
|
123
|
-
res[fKey] =
|
|
119
|
+
res[fKey] = resolveTokensAndVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug);
|
|
124
120
|
} else {
|
|
125
|
-
res[fKey] =
|
|
121
|
+
res[fKey] = value[fKey];
|
|
126
122
|
}
|
|
127
123
|
}
|
|
128
124
|
if (process.env.NODE_ENV === "development") {
|
|
@@ -132,16 +128,49 @@ const resolveTokens = /* @__PURE__ */ __name((input, conf, theme, fontFamily, re
|
|
|
132
128
|
}
|
|
133
129
|
}
|
|
134
130
|
return res;
|
|
135
|
-
}
|
|
131
|
+
};
|
|
132
|
+
function getVariantDefinition(variant, key, value, conf) {
|
|
133
|
+
if (typeof variant === "function") {
|
|
134
|
+
return variant;
|
|
135
|
+
}
|
|
136
|
+
if (variant[value]) {
|
|
137
|
+
return variant[value];
|
|
138
|
+
}
|
|
139
|
+
const { tokensParsed } = conf;
|
|
140
|
+
if (variant["...size"] && value in tokensParsed.size) {
|
|
141
|
+
return variant["...size"];
|
|
142
|
+
}
|
|
143
|
+
if (variant["...color"] && value in tokensParsed.color) {
|
|
144
|
+
return variant["...color"];
|
|
145
|
+
}
|
|
146
|
+
if (variant["...radius"] && value in tokensParsed.radius) {
|
|
147
|
+
return variant["...radius"];
|
|
148
|
+
}
|
|
149
|
+
if (variant["...space"] && value in tokensParsed.space) {
|
|
150
|
+
return variant["...space"];
|
|
151
|
+
}
|
|
152
|
+
if (variant["...zIndex"] && value in tokensParsed.zIndex) {
|
|
153
|
+
return variant["...zIndex"];
|
|
154
|
+
}
|
|
155
|
+
let fn;
|
|
156
|
+
if (typeof value === "number") {
|
|
157
|
+
fn = variant[":number"];
|
|
158
|
+
} else if (typeof value === "string") {
|
|
159
|
+
fn = variant[":string"];
|
|
160
|
+
} else if (value === true || value === false) {
|
|
161
|
+
fn = variant[":boolean"];
|
|
162
|
+
}
|
|
163
|
+
return fn || variant["..."] || variant["...size"];
|
|
164
|
+
}
|
|
136
165
|
const fontShorthand = {
|
|
137
166
|
fontSize: "size",
|
|
138
167
|
fontWeight: "weight"
|
|
139
168
|
};
|
|
140
|
-
const getToken =
|
|
169
|
+
const getToken = (key, value, { tokensParsed, fontsParsed }, theme, fontFamily = "$body", resolveAs, debug) => {
|
|
141
170
|
var _a, _b, _c;
|
|
142
171
|
let valOrVar;
|
|
143
172
|
let hasSet = false;
|
|
144
|
-
if (value
|
|
173
|
+
if (theme[value]) {
|
|
145
174
|
valOrVar = theme[value];
|
|
146
175
|
hasSet = true;
|
|
147
176
|
} else {
|
|
@@ -176,21 +205,39 @@ const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, fontsParsed
|
|
|
176
205
|
}
|
|
177
206
|
}
|
|
178
207
|
if (hasSet) {
|
|
179
|
-
return getVariableValue(valOrVar, resolveAs);
|
|
208
|
+
return getVariableValue(key, valOrVar, resolveAs);
|
|
180
209
|
}
|
|
181
210
|
if (process.env.NODE_ENV === "development") {
|
|
182
211
|
if (value && value[0] === "$") {
|
|
183
|
-
console.
|
|
212
|
+
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}".
|
|
213
|
+
|
|
214
|
+
Set the debug prop to true to see more detailed debug information.`);
|
|
215
|
+
if (debug) {
|
|
216
|
+
if (typeof window !== "undefined") {
|
|
217
|
+
console.log("Looked in:");
|
|
218
|
+
console.log("Theme:", theme);
|
|
219
|
+
console.log("Tokens:", tokensParsed);
|
|
220
|
+
console.log("Fonts:", fontsParsed);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
184
223
|
return null;
|
|
185
224
|
}
|
|
186
225
|
}
|
|
187
226
|
return value;
|
|
188
|
-
}
|
|
189
|
-
function getVariableValue(valOrVar, resolveAs = "auto") {
|
|
227
|
+
};
|
|
228
|
+
function getVariableValue(key, valOrVar, resolveAs = "auto") {
|
|
190
229
|
if ((0, import_createVariable.isVariable)(valOrVar)) {
|
|
191
230
|
if (resolveAs === "variable") {
|
|
192
231
|
return valOrVar;
|
|
193
232
|
}
|
|
233
|
+
if (resolveAs === "non-color-value") {
|
|
234
|
+
if (import_platform.isWeb) {
|
|
235
|
+
if (key in tokenCategories.color) {
|
|
236
|
+
return valOrVar.variable;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return valOrVar.val;
|
|
240
|
+
}
|
|
194
241
|
if (!import_platform.isWeb || resolveAs === "value") {
|
|
195
242
|
return valOrVar.val;
|
|
196
243
|
}
|
|
@@ -198,10 +245,13 @@ function getVariableValue(valOrVar, resolveAs = "auto") {
|
|
|
198
245
|
}
|
|
199
246
|
return valOrVar;
|
|
200
247
|
}
|
|
201
|
-
__name(getVariableValue, "getVariableValue");
|
|
202
248
|
const tokenCategories = {
|
|
203
249
|
radius: {
|
|
204
|
-
borderRadius: true
|
|
250
|
+
borderRadius: true,
|
|
251
|
+
borderTopLeftRadius: true,
|
|
252
|
+
borderTopRightRadius: true,
|
|
253
|
+
borderBottomLeftRadius: true,
|
|
254
|
+
borderBottomRightRadius: true
|
|
205
255
|
},
|
|
206
256
|
size: {
|
|
207
257
|
width: true,
|
|
@@ -221,39 +271,9 @@ const tokenCategories = {
|
|
|
221
271
|
borderRightColor: true
|
|
222
272
|
}
|
|
223
273
|
};
|
|
224
|
-
const sidesX = ["Left", "Right"];
|
|
225
|
-
const sidesY = ["Top", "Bottom"];
|
|
226
|
-
const sidesXY = [...sidesX, ...sidesY];
|
|
227
|
-
const expand = {
|
|
228
|
-
padding: sidesXY.map((x) => `padding${x}`),
|
|
229
|
-
paddingHorizontal: sidesX.map((x) => `padding${x}`),
|
|
230
|
-
paddingVertical: sidesY.map((x) => `padding${x}`),
|
|
231
|
-
margin: sidesXY.map((x) => `margin${x}`),
|
|
232
|
-
marginHorizontal: sidesX.map((x) => `margin${x}`),
|
|
233
|
-
marginVertical: sidesY.map((x) => `margin${x}`),
|
|
234
|
-
borderWidth: sidesXY.map((x) => `border${x}Width`)
|
|
235
|
-
};
|
|
236
|
-
function expansions(styleObj) {
|
|
237
|
-
for (const key in expand) {
|
|
238
|
-
if (key in styleObj) {
|
|
239
|
-
for (const expandKey of expand[key]) {
|
|
240
|
-
styleObj[expandKey] = styleObj[key];
|
|
241
|
-
}
|
|
242
|
-
delete styleObj[key];
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if ("flex" in styleObj) {
|
|
246
|
-
if (typeof styleObj.flex === "number") {
|
|
247
|
-
styleObj.flexGrow = styleObj.flexGrow ?? styleObj.flex;
|
|
248
|
-
styleObj.flexShrink = styleObj.flexShrink ?? 1;
|
|
249
|
-
delete styleObj.flex;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return styleObj;
|
|
253
|
-
}
|
|
254
|
-
__name(expansions, "expansions");
|
|
255
274
|
// Annotate the CommonJS export names for ESM import in node:
|
|
256
275
|
0 && (module.exports = {
|
|
257
|
-
createPropMapper
|
|
276
|
+
createPropMapper,
|
|
277
|
+
getReturnVariablesAs
|
|
258
278
|
});
|
|
259
279
|
//# 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
|
}
|
|
@@ -16,7 +16,6 @@ var __spreadValues = (a, b) => {
|
|
|
16
16
|
}
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
20
19
|
var __export = (target, all) => {
|
|
21
20
|
for (var name in all)
|
|
22
21
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -35,8 +34,9 @@ __export(createShallowUpdate_exports, {
|
|
|
35
34
|
createShallowUpdate: () => createShallowUpdate
|
|
36
35
|
});
|
|
37
36
|
module.exports = __toCommonJS(createShallowUpdate_exports);
|
|
37
|
+
var import_react = require("react");
|
|
38
38
|
function createShallowUpdate(setter) {
|
|
39
|
-
return (next) => {
|
|
39
|
+
return (0, import_react.useCallback)((next) => {
|
|
40
40
|
setter((prev) => {
|
|
41
41
|
for (const key in next) {
|
|
42
42
|
if (prev[key] !== next[key]) {
|
|
@@ -45,9 +45,8 @@ function createShallowUpdate(setter) {
|
|
|
45
45
|
}
|
|
46
46
|
return prev;
|
|
47
47
|
});
|
|
48
|
-
};
|
|
48
|
+
}, [setter]);
|
|
49
49
|
}
|
|
50
|
-
__name(createShallowUpdate, "createShallowUpdate");
|
|
51
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
51
|
0 && (module.exports = {
|
|
53
52
|
createShallowUpdate
|
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AAE5B,6BACL,QACA;AACA,SAAO,8BACL,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
|
}
|
|
@@ -18,7 +18,6 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
22
21
|
var __objRest = (source, exclude) => {
|
|
23
22
|
var target = {};
|
|
24
23
|
for (var prop in source)
|
|
@@ -54,38 +53,37 @@ var React = __toESM(require("react"));
|
|
|
54
53
|
var import_ButtonInsideButtonContext = require("../contexts/ButtonInsideButtonContext");
|
|
55
54
|
var import_TextAncestorContext = require("../views/TextAncestorContext");
|
|
56
55
|
var import_ThemeProvider = require("../views/ThemeProvider");
|
|
57
|
-
function createTamaguiProvider(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"getCSS"
|
|
62
|
-
]);
|
|
63
|
-
return /* @__PURE__ */ __name(function TamaguiProvider(_a2) {
|
|
64
|
-
var _b2 = _a2, {
|
|
65
|
-
injectCSS,
|
|
56
|
+
function createTamaguiProvider(config) {
|
|
57
|
+
return function TamaguiProvider(_a) {
|
|
58
|
+
var _b = _a, {
|
|
59
|
+
disableInjectCSS,
|
|
66
60
|
children
|
|
67
|
-
} =
|
|
68
|
-
"
|
|
61
|
+
} = _b, themePropsProvider = __objRest(_b, [
|
|
62
|
+
"disableInjectCSS",
|
|
69
63
|
"children"
|
|
70
64
|
]);
|
|
71
65
|
if (typeof document !== "undefined") {
|
|
72
66
|
React.useLayoutEffect(() => {
|
|
73
|
-
if (
|
|
67
|
+
if (disableInjectCSS)
|
|
74
68
|
return;
|
|
75
69
|
const style = document.createElement("style");
|
|
76
|
-
style.appendChild(document.createTextNode(getCSS()));
|
|
70
|
+
style.appendChild(document.createTextNode(config.getCSS()));
|
|
77
71
|
document.head.appendChild(style);
|
|
78
72
|
return () => {
|
|
79
73
|
document.head.removeChild(style);
|
|
80
74
|
};
|
|
81
|
-
}, []);
|
|
75
|
+
}, [disableInjectCSS]);
|
|
82
76
|
}
|
|
83
77
|
return /* @__PURE__ */ React.createElement(import_ButtonInsideButtonContext.ButtonInsideButtonContext.Provider, {
|
|
84
78
|
value: false
|
|
85
|
-
}, /* @__PURE__ */ React.createElement(import_TextAncestorContext.TextAncestorProvider, null, /* @__PURE__ */ React.createElement(import_ThemeProvider.ThemeProvider, __spreadValues(
|
|
86
|
-
|
|
79
|
+
}, /* @__PURE__ */ React.createElement(import_TextAncestorContext.TextAncestorProvider, null, /* @__PURE__ */ React.createElement(import_ThemeProvider.ThemeProvider, __spreadValues({
|
|
80
|
+
themes: config.themes,
|
|
81
|
+
defaultTheme: config.defaultTheme || "light",
|
|
82
|
+
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
83
|
+
disableRootThemeClass: config.disableRootThemeClass
|
|
84
|
+
}, themePropsProvider), children)));
|
|
85
|
+
};
|
|
87
86
|
}
|
|
88
|
-
__name(createTamaguiProvider, "createTamaguiProvider");
|
|
89
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
90
88
|
0 && (module.exports = {
|
|
91
89
|
createTamaguiProvider
|
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,uCAA0C;AAE1C,iCAAqC;AACrC,2BAA8B;AAEvB,+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,2DAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,uDACC,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,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var cssHash_exports = {};
|
|
19
|
+
__export(cssHash_exports, {
|
|
20
|
+
cssHash: () => cssHash
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(cssHash_exports);
|
|
23
|
+
var import_helpers = require("@tamagui/helpers");
|
|
24
|
+
function cssHash(val, maxLen = 10) {
|
|
25
|
+
if (val.length < maxLen) {
|
|
26
|
+
let res = "";
|
|
27
|
+
for (let i = 0; i < val.length; i++) {
|
|
28
|
+
const char = val[i];
|
|
29
|
+
if (specials[char]) {
|
|
30
|
+
res += specials[char];
|
|
31
|
+
} else {
|
|
32
|
+
res += validCSS.test(char) ? char : "_" + char.charCodeAt(0).toString();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
return (0, import_helpers.simpleHash)(val);
|
|
38
|
+
}
|
|
39
|
+
const validCSS = /[a-z0-9]/i;
|
|
40
|
+
const specials = {
|
|
41
|
+
".": "dot",
|
|
42
|
+
",": "_",
|
|
43
|
+
"%": "pct",
|
|
44
|
+
"-": "neg"
|
|
45
|
+
};
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
cssHash
|
|
49
|
+
});
|
|
50
|
+
//# 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;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2B;AAIpB,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,+BAAW,GAAG;AACvB;AAEA,MAAM,WAAW;AAEjB,MAAM,WAAW;AAAA,EACf,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|