@tamagui/core 1.0.0-alpha.10 → 1.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.js +2 -1
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +2 -0
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createVariable.js +1 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +20 -13
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +4 -2
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Text.js +2 -2
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/Theme.js +15 -12
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/{constants → esm/constants}/constants.js +0 -0
- package/dist/{constants → esm/constants}/constants.js.map +1 -1
- package/dist/{constants → esm/constants}/platform.js +0 -0
- package/dist/{constants → esm/constants}/platform.js.map +1 -1
- package/dist/{constants → esm/constants}/pseudos.js +0 -0
- package/dist/{constants → esm/constants}/pseudos.js.map +1 -1
- package/dist/{constants → esm/constants}/rnw.js +0 -0
- package/dist/{constants → esm/constants}/rnw.js.map +1 -1
- package/dist/{createComponent.js → esm/createComponent.js} +2 -1
- package/dist/esm/createComponent.js.map +7 -0
- package/dist/{createFont.js → esm/createFont.js} +0 -0
- package/dist/{createFont.js.map → esm/createFont.js.map} +1 -1
- package/dist/{createShorthands.js → esm/createShorthands.js} +0 -0
- package/dist/{createShorthands.js.map → esm/createShorthands.js.map} +1 -1
- package/dist/{createTamagui.js → esm/createTamagui.js} +2 -0
- package/dist/esm/createTamagui.js.map +7 -0
- package/dist/{createTheme.js → esm/createTheme.js} +0 -0
- package/dist/{createTheme.js.map → esm/createTheme.js.map} +1 -1
- package/dist/{createTokens.js → esm/createTokens.js} +0 -0
- package/dist/{createTokens.js.map → esm/createTokens.js.map} +1 -1
- package/dist/{createVariable.js → esm/createVariable.js} +1 -1
- package/dist/{createVariable.js.map → esm/createVariable.js.map} +3 -3
- package/dist/{helpers → esm/helpers}/addStylesUsingClassname.js +0 -0
- package/dist/{helpers → esm/helpers}/addStylesUsingClassname.js.map +1 -1
- package/dist/{helpers → esm/helpers}/createMediaStyle.js +0 -0
- package/dist/{helpers → esm/helpers}/createMediaStyle.js.map +1 -1
- package/dist/{helpers → esm/helpers}/createPropMapper.js +14 -7
- package/dist/esm/helpers/createPropMapper.js.map +7 -0
- package/dist/{helpers → esm/helpers}/createTamaguiProvider.js +0 -0
- package/dist/{helpers → esm/helpers}/createTamaguiProvider.js.map +1 -1
- package/dist/{helpers → esm/helpers}/extendStaticConfig.js +0 -0
- package/dist/{helpers → esm/helpers}/extendStaticConfig.js.map +1 -1
- package/dist/{helpers → esm/helpers}/fixNativeShadow.js +0 -0
- package/dist/{helpers → esm/helpers}/fixNativeShadow.js.map +1 -1
- package/dist/{helpers → esm/helpers}/fixNativeShadow.native.js +0 -0
- package/dist/{helpers → esm/helpers}/fixNativeShadow.native.js.map +1 -1
- package/dist/{helpers → esm/helpers}/getSplitStyles.js +0 -0
- package/dist/{helpers → esm/helpers}/getSplitStyles.js.map +1 -1
- package/dist/{helpers → esm/helpers}/getStylesAtomic.js +0 -0
- package/dist/{helpers → esm/helpers}/getStylesAtomic.js.map +1 -1
- package/dist/{helpers → esm/helpers}/getStylesAtomic.native.js +0 -0
- package/dist/{helpers → esm/helpers}/getStylesAtomic.native.js.map +1 -1
- package/dist/{helpers → esm/helpers}/insertStyleRule.js +0 -0
- package/dist/{helpers → esm/helpers}/insertStyleRule.js.map +1 -1
- package/dist/{helpers → esm/helpers}/isObj.js +0 -0
- package/dist/{helpers → esm/helpers}/isObj.js.map +1 -1
- package/dist/{helpers → esm/helpers}/isTamaguiElement.js +0 -0
- package/dist/{helpers → esm/helpers}/isTamaguiElement.js.map +1 -1
- package/dist/{helpers → esm/helpers}/matchMedia.js +0 -0
- package/dist/{helpers → esm/helpers}/matchMedia.js.map +1 -1
- package/dist/{helpers → esm/helpers}/matchMedia.native.js +0 -0
- package/dist/{helpers → esm/helpers}/matchMedia.native.js.map +1 -1
- package/dist/{helpers → esm/helpers}/themeable.js +0 -0
- package/dist/{helpers → esm/helpers}/themeable.js.map +1 -1
- package/dist/{helpers → esm/helpers}/validate.js +0 -0
- package/dist/{helpers → esm/helpers}/validate.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useConstant.js +0 -0
- package/dist/{hooks → esm/hooks}/useConstant.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useFeatures.js +0 -0
- package/dist/{hooks → esm/hooks}/useFeatures.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useMedia.js +4 -2
- package/dist/esm/hooks/useMedia.js.map +7 -0
- package/dist/{hooks → esm/hooks}/usePressable.js +0 -0
- package/dist/{hooks → esm/hooks}/usePressable.js.map +1 -1
- package/dist/{hooks → esm/hooks}/useTheme.js +0 -0
- package/dist/{hooks → esm/hooks}/useTheme.js.map +1 -1
- package/dist/{index.js → esm/index.js} +0 -0
- package/dist/{index.js.map → esm/index.js.map} +1 -1
- package/dist/{static → esm/static}/postProcessStyles.js +0 -0
- package/dist/{static → esm/static}/postProcessStyles.js.map +1 -1
- package/dist/{static.js → esm/static.js} +0 -0
- package/dist/{static.js.map → esm/static.js.map} +1 -1
- package/dist/{styled.js → esm/styled.js} +0 -0
- package/dist/{styled.js.map → esm/styled.js.map} +1 -1
- package/dist/{types.js → esm/types.js} +0 -0
- package/dist/{types.js.map → esm/types.js.map} +0 -0
- package/dist/{views → esm/views}/Animated.js +0 -0
- package/dist/{views → esm/views}/Animated.js.map +1 -1
- package/dist/{views → esm/views}/Stack.js +0 -0
- package/dist/{views → esm/views}/Stack.js.map +1 -1
- package/dist/{views → esm/views}/Text.js +1 -1
- package/dist/esm/views/Text.js.map +7 -0
- package/dist/{views → esm/views}/TextAncestorContext.js +0 -0
- package/dist/{views → esm/views}/TextAncestorContext.js.map +1 -1
- package/dist/{views → esm/views}/Theme.js +15 -12
- package/dist/esm/views/Theme.js.map +7 -0
- package/dist/{views → esm/views}/ThemeContext.js +0 -0
- package/dist/{views → esm/views}/ThemeContext.js.map +1 -1
- package/dist/{views → esm/views}/ThemeInverse.js +0 -0
- package/dist/{views → esm/views}/ThemeInverse.js.map +1 -1
- package/dist/{views → esm/views}/ThemeManagerContext.js +0 -0
- package/dist/{views → esm/views}/ThemeManagerContext.js.map +1 -1
- package/dist/{views → esm/views}/ThemeProvider.js +0 -0
- package/dist/{views → esm/views}/ThemeProvider.js.map +1 -1
- package/dist/jsx/constants/constants.js +13 -0
- package/dist/jsx/constants/platform.js +18 -0
- package/dist/jsx/constants/pseudos.js +17 -0
- package/dist/jsx/constants/rnw.js +21 -0
- package/dist/jsx/createComponent.js +458 -0
- package/dist/jsx/createFont.js +27 -0
- package/dist/jsx/createShorthands.js +9 -0
- package/dist/jsx/createTamagui.js +169 -0
- package/dist/jsx/createTheme.js +19 -0
- package/dist/jsx/createTokens.js +32 -0
- package/dist/jsx/createVariable.js +24 -0
- package/dist/jsx/helpers/addStylesUsingClassname.js +56 -0
- package/dist/jsx/helpers/createMediaStyle.js +33 -0
- package/dist/jsx/helpers/createPropMapper.js +159 -0
- package/dist/jsx/helpers/createTamaguiProvider.js +19 -0
- package/dist/jsx/helpers/extendStaticConfig.js +58 -0
- package/dist/jsx/helpers/fixNativeShadow.js +7 -0
- package/dist/jsx/helpers/fixNativeShadow.native.js +29 -0
- package/dist/jsx/helpers/getSplitStyles.js +149 -0
- package/dist/jsx/helpers/getStylesAtomic.js +82 -0
- package/dist/jsx/helpers/getStylesAtomic.native.js +9 -0
- package/dist/jsx/helpers/insertStyleRule.js +23 -0
- package/dist/jsx/helpers/isObj.js +6 -0
- package/dist/{helpers/isTamaguiComponent.js → jsx/helpers/isTamaguiElement.js} +3 -4
- package/dist/jsx/helpers/matchMedia.js +17 -0
- package/dist/jsx/helpers/matchMedia.native.js +8 -0
- package/dist/jsx/helpers/themeable.js +23 -0
- package/dist/{helpers/validateConfig.js → jsx/helpers/validate.js} +35 -22
- package/dist/jsx/hooks/useConstant.js +14 -0
- package/dist/jsx/hooks/useFeatures.js +57 -0
- package/dist/jsx/hooks/useMedia.js +172 -0
- package/dist/jsx/hooks/usePressable.js +12 -0
- package/dist/jsx/hooks/useTheme.js +88 -0
- package/dist/jsx/index.js +31 -0
- package/dist/jsx/static/postProcessStyles.js +17 -0
- package/dist/jsx/static.js +14 -0
- package/dist/jsx/styled.js +20 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Animated.js +74 -0
- package/dist/jsx/views/Stack.js +11 -0
- package/dist/jsx/views/Text.js +59 -0
- package/dist/jsx/views/TextAncestorContext.js +14 -0
- package/dist/jsx/views/Theme.js +62 -0
- package/dist/jsx/views/ThemeContext.js +5 -0
- package/dist/jsx/views/ThemeInverse.js +22 -0
- package/dist/jsx/views/ThemeManagerContext.js +60 -0
- package/dist/jsx/views/ThemeProvider.js +39 -0
- package/package.json +10 -11
- package/src/createComponent.tsx +4 -2
- package/src/createTamagui.ts +1 -0
- package/src/createVariable.ts +1 -1
- package/src/helpers/createPropMapper.ts +14 -6
- package/src/hooks/useMedia.tsx +5 -3
- package/src/types.tsx +6 -6
- package/src/views/Text.tsx +2 -1
- package/src/views/Theme.tsx +24 -20
- package/{dist/packages/core/src → types}/constants/constants.d.ts +0 -0
- package/types/constants/constants.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/platform.d.ts +0 -0
- package/types/constants/platform.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/pseudos.d.ts +0 -0
- package/types/constants/pseudos.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/rnw.d.ts +0 -0
- package/types/constants/rnw.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createComponent.d.ts +3 -2
- package/types/createComponent.d.ts.map +1 -0
- package/types/createFont.d.ts +3 -0
- package/types/createFont.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createShorthands.d.ts +0 -0
- package/types/createShorthands.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTamagui.d.ts +18 -1
- package/types/createTamagui.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTheme.d.ts +0 -0
- package/types/createTheme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTokens.d.ts +24 -14
- package/types/createTokens.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createVariable.d.ts +1 -0
- package/types/createVariable.d.ts.map +1 -0
- package/types/helpers/addStylesUsingClassname.d.ts +3 -0
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/createMediaStyle.d.ts +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -0
- package/types/helpers/createPropMapper.d.ts +3 -0
- package/types/helpers/createPropMapper.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/createTamaguiProvider.d.ts +0 -0
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/extendStaticConfig.d.ts +1 -1
- package/types/helpers/extendStaticConfig.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/fixNativeShadow.d.ts +0 -0
- package/types/helpers/fixNativeShadow.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/fixNativeShadow.native.d.ts +0 -0
- package/types/helpers/fixNativeShadow.native.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getSplitStyles.d.ts +0 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getStylesAtomic.d.ts +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getStylesAtomic.native.d.ts +0 -0
- package/types/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/insertStyleRule.d.ts +0 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -0
- package/types/helpers/isObj.d.ts +2 -0
- package/types/helpers/isObj.d.ts.map +1 -0
- package/types/helpers/isTamaguiElement.d.ts +3 -0
- package/types/helpers/isTamaguiElement.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/matchMedia.d.ts +0 -0
- package/types/helpers/matchMedia.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/matchMedia.native.d.ts +0 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/themeable.d.ts +0 -0
- package/types/helpers/themeable.d.ts.map +1 -0
- package/types/helpers/validate.d.ts +4 -0
- package/types/helpers/validate.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useConstant.d.ts +0 -0
- package/types/hooks/useConstant.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useFeatures.d.ts +0 -0
- package/types/hooks/useFeatures.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useMedia.d.ts +0 -0
- package/types/hooks/useMedia.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/usePressable.d.ts +0 -0
- package/types/hooks/usePressable.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useTheme.d.ts +3 -1
- package/types/hooks/useTheme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/index.d.ts +3 -1
- package/types/index.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/static/postProcessStyles.d.ts +0 -0
- package/types/static/postProcessStyles.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/static.d.ts +3 -0
- package/types/static.d.ts.map +1 -0
- package/types/styled.d.ts +21 -0
- package/types/styled.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/types.d.ts +71 -70
- package/types/types.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/Animated.d.ts +0 -0
- package/types/views/Animated.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/Stack.d.ts +0 -0
- package/types/views/Stack.d.ts.map +1 -0
- package/types/views/Text.d.ts +3 -0
- package/types/views/Text.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/TextAncestorContext.d.ts +0 -0
- package/types/views/TextAncestorContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/Theme.d.ts +1 -1
- package/types/views/Theme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeContext.d.ts +0 -0
- package/types/views/ThemeContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeInverse.d.ts +0 -0
- package/types/views/ThemeInverse.d.ts.map +1 -0
- package/types/views/ThemeManagerContext.d.ts +22 -0
- package/types/views/ThemeManagerContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeProvider.d.ts +0 -0
- package/types/views/ThemeProvider.d.ts.map +1 -0
- package/dist/constants/styleConstants.js +0 -46
- package/dist/constants/styleConstants.js.map +0 -7
- package/dist/createComponent.js.map +0 -7
- package/dist/createTamagui.js.map +0 -7
- package/dist/helpers/createPropMapper.js.map +0 -7
- package/dist/helpers/isComponent.js +0 -10
- package/dist/helpers/isComponent.js.map +0 -7
- package/dist/helpers/isTamaguiComponent.js.map +0 -7
- package/dist/helpers/pseudos.js +0 -1
- package/dist/helpers/pseudos.js.map +0 -7
- package/dist/helpers/validateConfig.js.map +0 -7
- package/dist/helpers/validateTokens.js +0 -29
- package/dist/helpers/validateTokens.js.map +0 -7
- package/dist/hooks/useForceUpdate.js +0 -28
- package/dist/hooks/useForceUpdate.js.map +0 -7
- package/dist/hooks/useMedia.js.map +0 -7
- package/dist/index.cjs +0 -2202
- package/dist/index.cjs.map +0 -7
- package/dist/packages/core/src/constants/constants.d.ts.map +0 -1
- package/dist/packages/core/src/constants/platform.d.ts.map +0 -1
- package/dist/packages/core/src/constants/pseudos.d.ts.map +0 -1
- package/dist/packages/core/src/constants/rnw.d.ts.map +0 -1
- package/dist/packages/core/src/createComponent.d.ts.map +0 -1
- package/dist/packages/core/src/createShorthands.d.ts.map +0 -1
- package/dist/packages/core/src/createTamagui.d.ts.map +0 -1
- package/dist/packages/core/src/createTheme.d.ts.map +0 -1
- package/dist/packages/core/src/createTokens.d.ts.map +0 -1
- package/dist/packages/core/src/createVariable.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts +0 -2
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/themeable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useConstant.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useFeatures.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts +0 -2
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useMedia.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/usePressable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useTheme.d.ts.map +0 -1
- package/dist/packages/core/src/index.d.ts.map +0 -1
- package/dist/packages/core/src/static/postProcessStyles.d.ts.map +0 -1
- package/dist/packages/core/src/static.d.ts.map +0 -1
- package/dist/packages/core/src/styled.d.ts +0 -16
- package/dist/packages/core/src/styled.d.ts.map +0 -1
- package/dist/packages/core/src/types.d.ts.map +0 -1
- package/dist/packages/core/src/views/Animated.d.ts.map +0 -1
- package/dist/packages/core/src/views/Stack.d.ts.map +0 -1
- package/dist/packages/core/src/views/Text.d.ts +0 -3
- package/dist/packages/core/src/views/Text.d.ts.map +0 -1
- package/dist/packages/core/src/views/TextAncestorContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/Theme.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeInverse.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts +0 -15
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeProvider.d.ts.map +0 -1
- package/dist/packages/helpers/src/AllRules.d.ts +0 -3
- package/dist/packages/helpers/src/AllRules.d.ts.map +0 -1
- package/dist/packages/helpers/src/concatClassName.d.ts +0 -2
- package/dist/packages/helpers/src/concatClassName.d.ts.map +0 -1
- package/dist/packages/helpers/src/index.d.ts +0 -5
- package/dist/packages/helpers/src/index.d.ts.map +0 -1
- package/dist/packages/helpers/src/types.d.ts +0 -8
- package/dist/packages/helpers/src/types.d.ts.map +0 -1
- package/dist/packages/helpers/src/validStyleProps.d.ts +0 -475
- package/dist/packages/helpers/src/validStyleProps.d.ts.map +0 -1
- package/dist/views/SafeAreaProvider.js +0 -30
- package/dist/views/SafeAreaProvider.js.map +0 -7
- package/dist/views/Text.js.map +0 -7
- package/dist/views/Theme.js.map +0 -7
- package/types.d.ts +0 -559
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { createVariable } from "./createVariable";
|
|
4
|
+
import { validateTokens } from "./helpers/validate";
|
|
5
|
+
function createTokens(tokens) {
|
|
6
|
+
if (process.env.NODE_ENV === "development") {
|
|
7
|
+
validateTokens(tokens);
|
|
8
|
+
}
|
|
9
|
+
return setupTokens(tokens);
|
|
10
|
+
}
|
|
11
|
+
__name(createTokens, "createTokens");
|
|
12
|
+
function setupTokens(tokens) {
|
|
13
|
+
return mapTokensToVariables(tokens);
|
|
14
|
+
}
|
|
15
|
+
__name(setupTokens, "setupTokens");
|
|
16
|
+
const mapTokensToVariables = /* @__PURE__ */ __name((tokens, parentPath = "") => {
|
|
17
|
+
const res = {};
|
|
18
|
+
for (const key in tokens) {
|
|
19
|
+
const val = tokens[key];
|
|
20
|
+
const name = parentPath ? `${parentPath}-${key}` : key;
|
|
21
|
+
if (val && typeof val === "object") {
|
|
22
|
+
res[key] = mapTokensToVariables(tokens[key], name);
|
|
23
|
+
} else {
|
|
24
|
+
res[key] = createVariable({ val, name });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return res;
|
|
28
|
+
}, "mapTokensToVariables");
|
|
29
|
+
export {
|
|
30
|
+
createTokens,
|
|
31
|
+
mapTokensToVariables
|
|
32
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { isWeb } from "./constants/platform";
|
|
4
|
+
class Variable {
|
|
5
|
+
constructor({ val, name }) {
|
|
6
|
+
this.val = val;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.variable = isWeb ? `var(--${name})` : this.val;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return `${isWeb ? this.variable : this.val}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
__name(Variable, "Variable");
|
|
15
|
+
const createVariable = /* @__PURE__ */ __name((props) => new Variable(props), "createVariable");
|
|
16
|
+
function isVariable(v) {
|
|
17
|
+
return v instanceof Variable;
|
|
18
|
+
}
|
|
19
|
+
__name(isVariable, "isVariable");
|
|
20
|
+
export {
|
|
21
|
+
Variable,
|
|
22
|
+
createVariable,
|
|
23
|
+
isVariable
|
|
24
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { useInsertionEffect } from "react";
|
|
4
|
+
import { getStylesAtomic } from "./getStylesAtomic";
|
|
5
|
+
import { insertStyleRule } from "./insertStyleRule";
|
|
6
|
+
let added = new Set();
|
|
7
|
+
function useStylesAsClassname(styles) {
|
|
8
|
+
if (!useInsertionEffect) {
|
|
9
|
+
return addStylesUsingClassname(styles);
|
|
10
|
+
} else {
|
|
11
|
+
const insertions = [];
|
|
12
|
+
const className = addStylesUsingClassname(styles, (_, rules) => {
|
|
13
|
+
for (const rule of rules) {
|
|
14
|
+
insertions.push(rule);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
useInsertionEffect(() => {
|
|
18
|
+
for (const ruleset of insertions) {
|
|
19
|
+
insertStyleRule(ruleset);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return className;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
__name(useStylesAsClassname, "useStylesAsClassname");
|
|
26
|
+
function addStylesUsingClassname(styles, onAdd) {
|
|
27
|
+
let className = "";
|
|
28
|
+
for (const style of styles) {
|
|
29
|
+
if (!style)
|
|
30
|
+
continue;
|
|
31
|
+
if (Array.isArray(style)) {
|
|
32
|
+
className += " " + addStylesUsingClassname(style);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
for (const { identifier, rules } of getStylesAtomic(style)) {
|
|
36
|
+
className += ` ${identifier}`;
|
|
37
|
+
if (added.has(identifier)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
added.add(identifier);
|
|
41
|
+
if (onAdd) {
|
|
42
|
+
onAdd(identifier, rules);
|
|
43
|
+
} else {
|
|
44
|
+
for (const rule of rules) {
|
|
45
|
+
insertStyleRule(rule);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return className;
|
|
51
|
+
}
|
|
52
|
+
__name(addStylesUsingClassname, "addStylesUsingClassname");
|
|
53
|
+
export {
|
|
54
|
+
addStylesUsingClassname,
|
|
55
|
+
useStylesAsClassname
|
|
56
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { mediaObjectToString } from "../hooks/useMedia";
|
|
4
|
+
const MEDIA_SEP = "_";
|
|
5
|
+
const createMediaStyle = /* @__PURE__ */ __name(({ identifier, rules }, mediaKey, mediaQueries, negate, importance = 0) => {
|
|
6
|
+
const mediaKeys = Object.keys(mediaQueries);
|
|
7
|
+
const mediaKeyPrecendence = mediaKeys.reduce((acc, cur, i) => {
|
|
8
|
+
acc[cur] = new Array(importance + 1).fill(":root").join("");
|
|
9
|
+
return acc;
|
|
10
|
+
}, {});
|
|
11
|
+
const negKey = negate ? "0" : "";
|
|
12
|
+
const ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1);
|
|
13
|
+
const nextIdentifier = `${identifier.replace(ogPrefix, `${ogPrefix}${MEDIA_SEP}${mediaKey}${negKey}${MEDIA_SEP}`)}`;
|
|
14
|
+
const screenStr = negate ? "not all" : "screen";
|
|
15
|
+
const mediaSelector = mediaObjectToString(mediaQueries[mediaKey]);
|
|
16
|
+
const mediaQuery = `${screenStr} and ${mediaSelector}`;
|
|
17
|
+
const precendencePrefix = mediaKeyPrecendence[mediaKey];
|
|
18
|
+
const styleInner = rules[0].replace(identifier, nextIdentifier);
|
|
19
|
+
let styleRule = "";
|
|
20
|
+
if (styleInner.includes("@media")) {
|
|
21
|
+
styleRule = styleInner.replace("{", ` and ${mediaQuery} {`);
|
|
22
|
+
} else {
|
|
23
|
+
styleRule = `@media ${mediaQuery} { ${precendencePrefix} ${styleInner} }`;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
styleRule,
|
|
27
|
+
identifier: nextIdentifier
|
|
28
|
+
};
|
|
29
|
+
}, "createMediaStyle");
|
|
30
|
+
export {
|
|
31
|
+
MEDIA_SEP,
|
|
32
|
+
createMediaStyle
|
|
33
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { isWeb } from "../constants/platform";
|
|
4
|
+
import { getTamagui } from "../createTamagui";
|
|
5
|
+
import { Variable } from "../createVariable";
|
|
6
|
+
import { isObj } from "./isObj";
|
|
7
|
+
const createPropMapper = /* @__PURE__ */ __name((c) => {
|
|
8
|
+
const variants = c.variants;
|
|
9
|
+
let variantsParsed;
|
|
10
|
+
const defaultProps = c.defaultProps || {};
|
|
11
|
+
return (key, value, theme, props) => {
|
|
12
|
+
const conf = getTamagui();
|
|
13
|
+
if (!conf) {
|
|
14
|
+
console.trace("no conf! err");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (variants && !variantsParsed) {
|
|
18
|
+
variantsParsed = parseVariants(variants, conf);
|
|
19
|
+
}
|
|
20
|
+
let fontFamily = props.fontFamily || defaultProps.fontFamily || "$body";
|
|
21
|
+
const variant = variantsParsed?.[key];
|
|
22
|
+
if (variant && typeof value !== "undefined") {
|
|
23
|
+
const val = value === true ? variant["$true"] || variant["true"] : variant[value] ?? variant["..."] ?? value;
|
|
24
|
+
const res = typeof val === "function" ? val(value, { tokens: conf.tokensParsed, theme, props }) : isObj(val) ? { ...val } : val;
|
|
25
|
+
if (isObj(res)) {
|
|
26
|
+
resolveTokens(res, conf, theme, fontFamily);
|
|
27
|
+
}
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
let shouldReturn = false;
|
|
31
|
+
if (conf.shorthands[key]) {
|
|
32
|
+
shouldReturn = true;
|
|
33
|
+
key = conf.shorthands[key];
|
|
34
|
+
}
|
|
35
|
+
if (value && value[0] === "$") {
|
|
36
|
+
shouldReturn = true;
|
|
37
|
+
value = getToken(key, value, conf, theme, fontFamily);
|
|
38
|
+
}
|
|
39
|
+
if (value instanceof Variable) {
|
|
40
|
+
shouldReturn = true;
|
|
41
|
+
value = value.variable;
|
|
42
|
+
}
|
|
43
|
+
if (shouldReturn) {
|
|
44
|
+
return {
|
|
45
|
+
[key]: value
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}, "createPropMapper");
|
|
50
|
+
const resolveTokens = /* @__PURE__ */ __name((res, conf, theme, fontFamily) => {
|
|
51
|
+
for (const rKey in res) {
|
|
52
|
+
const fKey = conf.shorthands[rKey] || rKey;
|
|
53
|
+
const val = res[rKey];
|
|
54
|
+
if (val instanceof Variable) {
|
|
55
|
+
res[fKey] = val.variable;
|
|
56
|
+
} else if (typeof val === "string") {
|
|
57
|
+
const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily) : val;
|
|
58
|
+
res[fKey] = fVal;
|
|
59
|
+
} else {
|
|
60
|
+
if (isObj(val)) {
|
|
61
|
+
resolveTokens(val, conf, theme, fontFamily);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, "resolveTokens");
|
|
66
|
+
const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, themeParsed }, theme, fontFamily = "$body") => {
|
|
67
|
+
if (themeParsed[value]) {
|
|
68
|
+
if (isWeb && themeParsed[value].variable) {
|
|
69
|
+
return themeParsed[value].variable;
|
|
70
|
+
} else {
|
|
71
|
+
if (value && value[0] === "$") {
|
|
72
|
+
return theme[`${value.slice(1)}`]?.val || themeParsed[value]?.val;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
let valOrVar;
|
|
77
|
+
if (key === "fontFamily") {
|
|
78
|
+
valOrVar = tokensParsed.font[value]?.family || value;
|
|
79
|
+
}
|
|
80
|
+
if (key === "fontSize") {
|
|
81
|
+
valOrVar = tokensParsed.font[fontFamily]?.size[value] || value;
|
|
82
|
+
}
|
|
83
|
+
if (key === "lineHeight") {
|
|
84
|
+
valOrVar = tokensParsed.font[fontFamily]?.lineHeight[value] || value;
|
|
85
|
+
}
|
|
86
|
+
if (key === "letterSpacing") {
|
|
87
|
+
valOrVar = tokensParsed.font[fontFamily]?.letterSpacing[value] || value;
|
|
88
|
+
}
|
|
89
|
+
if (key === "fontWeight") {
|
|
90
|
+
valOrVar = tokensParsed.font[fontFamily]?.weight[value] || value;
|
|
91
|
+
}
|
|
92
|
+
if (typeof valOrVar !== "undefined") {
|
|
93
|
+
if (valOrVar instanceof Variable) {
|
|
94
|
+
return valOrVar.variable;
|
|
95
|
+
} else {
|
|
96
|
+
return valOrVar;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const cat in tokenCategories) {
|
|
100
|
+
if (tokenCategories[cat][key]) {
|
|
101
|
+
const res = tokensParsed[cat][value];
|
|
102
|
+
if (res) {
|
|
103
|
+
return res.variable;
|
|
104
|
+
} else {
|
|
105
|
+
const themeVar = themeParsed[value];
|
|
106
|
+
if (themeVar) {
|
|
107
|
+
return themeVar.variable;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const spaceVar = tokensParsed.space[value];
|
|
113
|
+
if (spaceVar) {
|
|
114
|
+
return spaceVar.variable;
|
|
115
|
+
}
|
|
116
|
+
return value;
|
|
117
|
+
}, "getToken");
|
|
118
|
+
const tokenCategories = {
|
|
119
|
+
size: {
|
|
120
|
+
width: true,
|
|
121
|
+
height: true,
|
|
122
|
+
minWidth: true,
|
|
123
|
+
minHeight: true,
|
|
124
|
+
maxWidth: true,
|
|
125
|
+
maxHeight: true
|
|
126
|
+
},
|
|
127
|
+
color: {
|
|
128
|
+
color: true,
|
|
129
|
+
backgroundColor: true,
|
|
130
|
+
borderColor: true,
|
|
131
|
+
borderBottomColor: true,
|
|
132
|
+
borderTopColor: true,
|
|
133
|
+
borderLeftColor: true,
|
|
134
|
+
borderRightColor: true
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
function parseVariants(variants, conf) {
|
|
138
|
+
return Object.keys(variants).reduce((acc, key) => {
|
|
139
|
+
acc[key] = Object.keys(variants[key]).reduce((vacc, vkey) => {
|
|
140
|
+
const variantVal = variants[key][vkey];
|
|
141
|
+
if (vkey.startsWith("...")) {
|
|
142
|
+
vacc["..."] = variantVal;
|
|
143
|
+
const tokenKey = vkey.slice(3);
|
|
144
|
+
const tokens = conf.tokens[tokenKey];
|
|
145
|
+
for (const tkey in tokens) {
|
|
146
|
+
vacc[`$${tkey}`] = variantVal;
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
vacc[vkey] = variantVal;
|
|
150
|
+
}
|
|
151
|
+
return vacc;
|
|
152
|
+
}, {});
|
|
153
|
+
return acc;
|
|
154
|
+
}, {});
|
|
155
|
+
}
|
|
156
|
+
__name(parseVariants, "parseVariants");
|
|
157
|
+
export {
|
|
158
|
+
createPropMapper
|
|
159
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { TextAncestorProvider } from "../views/TextAncestorContext";
|
|
5
|
+
import { ThemeProvider } from "../views/ThemeProvider";
|
|
6
|
+
function createTamaguiProvider(themeProps) {
|
|
7
|
+
return /* @__PURE__ */ __name(function TamaguiProvider({
|
|
8
|
+
initialWindowMetrics,
|
|
9
|
+
fallback,
|
|
10
|
+
children,
|
|
11
|
+
...themePropsProvider
|
|
12
|
+
}) {
|
|
13
|
+
return <TextAncestorProvider><ThemeProvider {...themeProps} {...themePropsProvider}><React.Suspense fallback={fallback || null}>{children}</React.Suspense></ThemeProvider></TextAncestorProvider>;
|
|
14
|
+
}, "TamaguiProvider");
|
|
15
|
+
}
|
|
16
|
+
__name(createTamaguiProvider, "createTamaguiProvider");
|
|
17
|
+
export {
|
|
18
|
+
createTamaguiProvider
|
|
19
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { createPropMapper } from "./createPropMapper";
|
|
4
|
+
function extendStaticConfig(Component, config = {}) {
|
|
5
|
+
const parent = Component || {};
|
|
6
|
+
if (!parent.staticConfig) {
|
|
7
|
+
parent.staticConfig = {
|
|
8
|
+
Component
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const variants = {
|
|
12
|
+
...parent.staticConfig.variants
|
|
13
|
+
};
|
|
14
|
+
if (config.variants) {
|
|
15
|
+
for (const key in config.variants) {
|
|
16
|
+
if (variants[key]) {
|
|
17
|
+
variants[key] = {
|
|
18
|
+
...variants[key],
|
|
19
|
+
...config.variants[key]
|
|
20
|
+
};
|
|
21
|
+
} else {
|
|
22
|
+
variants[key] = config.variants[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return parseStaticConfig({
|
|
27
|
+
...parent.staticConfig,
|
|
28
|
+
isZStack: config.isZStack || parent.staticConfig.isZStack,
|
|
29
|
+
variants,
|
|
30
|
+
isText: config.isText || parent.staticConfig.isText || false,
|
|
31
|
+
neverFlatten: config.neverFlatten ?? parent.staticConfig.neverFlatten,
|
|
32
|
+
ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp,
|
|
33
|
+
validStyles: config.validStyles ? {
|
|
34
|
+
...parent.staticConfig.validStyles,
|
|
35
|
+
...config.validStyles
|
|
36
|
+
} : parent.staticConfig.validStyles,
|
|
37
|
+
validPropsExtra: {
|
|
38
|
+
...parent.staticConfig.validPropsExtra,
|
|
39
|
+
...config.validPropsExtra
|
|
40
|
+
},
|
|
41
|
+
defaultProps: {
|
|
42
|
+
...parent.staticConfig.defaultProps,
|
|
43
|
+
...config.defaultProps
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
__name(extendStaticConfig, "extendStaticConfig");
|
|
48
|
+
const parseStaticConfig = /* @__PURE__ */ __name((config) => {
|
|
49
|
+
return {
|
|
50
|
+
...config,
|
|
51
|
+
parsed: true,
|
|
52
|
+
propMapper: createPropMapper(config)
|
|
53
|
+
};
|
|
54
|
+
}, "parseStaticConfig");
|
|
55
|
+
export {
|
|
56
|
+
extendStaticConfig,
|
|
57
|
+
parseStaticConfig
|
|
58
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const matchRgba = /rgba\(\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*\)$/;
|
|
4
|
+
function fixNativeShadow(props) {
|
|
5
|
+
if (props.shadowColor) {
|
|
6
|
+
if (!!!("shadowOffset" in props)) {
|
|
7
|
+
props.shadowOffset = {
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (!!!("shadowOpacity" in props)) {
|
|
13
|
+
const c = `${props.shadowColor}`;
|
|
14
|
+
if (c[0] === "r" && c[3] === "a") {
|
|
15
|
+
const [_, r, g, b, a] = c.match(matchRgba) || [];
|
|
16
|
+
if (typeof a !== "string") {
|
|
17
|
+
console.warn("non valid rgba", c);
|
|
18
|
+
return props;
|
|
19
|
+
}
|
|
20
|
+
props.shadowColor = `rgb(${r},${g},${b})`;
|
|
21
|
+
props.shadowOpacity = +a;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
__name(fixNativeShadow, "fixNativeShadow");
|
|
27
|
+
export {
|
|
28
|
+
fixNativeShadow
|
|
29
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import {
|
|
4
|
+
AllRules,
|
|
5
|
+
stylePropsText,
|
|
6
|
+
stylePropsTransform,
|
|
7
|
+
validStyles,
|
|
8
|
+
validStylesPseudo
|
|
9
|
+
} from "@tamagui/helpers";
|
|
10
|
+
import { isWeb } from "../constants/platform";
|
|
11
|
+
import { mediaQueryConfig, mediaState } from "../hooks/useMedia";
|
|
12
|
+
import { createMediaStyle } from "./createMediaStyle";
|
|
13
|
+
import { fixNativeShadow } from "./fixNativeShadow";
|
|
14
|
+
import { getStylesAtomic } from "./getStylesAtomic";
|
|
15
|
+
import { insertStyleRule } from "./insertStyleRule";
|
|
16
|
+
const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, isSplittingDefaultProps) => {
|
|
17
|
+
const validStyleProps = staticConfig.isText ? stylePropsText : validStyles;
|
|
18
|
+
const viewProps = {};
|
|
19
|
+
const style = [];
|
|
20
|
+
let pseudos = null;
|
|
21
|
+
let cur = null;
|
|
22
|
+
let classNames = null;
|
|
23
|
+
for (const keyInit in props) {
|
|
24
|
+
const valInit = props[keyInit];
|
|
25
|
+
if (keyInit[0] === "$") {
|
|
26
|
+
const mediaKey = keyInit.slice(1);
|
|
27
|
+
if (!mediaQueryConfig[mediaKey]) {
|
|
28
|
+
viewProps[keyInit] = valInit;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const mediaProps = { ...props, ...valInit };
|
|
32
|
+
const mediaStyle = getSubStyle(valInit, staticConfig, theme, props);
|
|
33
|
+
if (isWeb) {
|
|
34
|
+
const mediaStyles = getStylesAtomic(mediaStyle);
|
|
35
|
+
if (process.env.NODE_ENV === "development") {
|
|
36
|
+
if (props["debug"]) {
|
|
37
|
+
console.log("mediaStyles", keyInit, { mediaProps, mediaStyle, mediaStyles });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const style2 of mediaStyles) {
|
|
41
|
+
const out2 = createMediaStyle(style2, mediaKey, mediaQueryConfig);
|
|
42
|
+
classNames = classNames || [];
|
|
43
|
+
classNames.push(out2.identifier);
|
|
44
|
+
AllRules.add(out2.styleRule);
|
|
45
|
+
insertStyleRule(out2.styleRule);
|
|
46
|
+
if (process.env.NODE_ENV === "development" && props["debug"]) {
|
|
47
|
+
console.log("mediaProp", style2.identifier, out2, mediaProps, mediaStyle, mediaStyles);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
if (mediaState[mediaKey]) {
|
|
52
|
+
style.push(mediaStyle);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (validStylesPseudo[keyInit]) {
|
|
58
|
+
if (!valInit)
|
|
59
|
+
continue;
|
|
60
|
+
pseudos = pseudos || {};
|
|
61
|
+
pseudos[keyInit] = getSubStyle(valInit, staticConfig, theme, props);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const out = staticConfig.propMapper(keyInit, valInit, theme, props);
|
|
65
|
+
const expanded = out === true || !out ? [[keyInit, valInit]] : Object.entries(out);
|
|
66
|
+
for (const [key, val] of expanded) {
|
|
67
|
+
const keyFirstChar = key[0];
|
|
68
|
+
if (key === "style" || keyFirstChar === "_" && key.startsWith("_style")) {
|
|
69
|
+
if (cur) {
|
|
70
|
+
fixNativeShadow(cur);
|
|
71
|
+
style.push(cur);
|
|
72
|
+
cur = null;
|
|
73
|
+
}
|
|
74
|
+
fixNativeShadow(val);
|
|
75
|
+
style.push(val);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (key === "flex") {
|
|
79
|
+
cur = cur || {};
|
|
80
|
+
Object.assign(cur, {
|
|
81
|
+
flexGrow: val,
|
|
82
|
+
flexShrink: 1
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (!isWeb && key === "pointerEvents") {
|
|
87
|
+
viewProps[key] = val;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (validStyleProps[key]) {
|
|
91
|
+
if (key in stylePropsTransform) {
|
|
92
|
+
cur = cur || {};
|
|
93
|
+
mergeTransform(cur, key, val);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
cur = cur || {};
|
|
97
|
+
cur[key] = val;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (!staticConfig.variants || !(key in staticConfig.variants)) {
|
|
101
|
+
viewProps[key] = val;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (cur) {
|
|
106
|
+
fixNativeShadow(cur);
|
|
107
|
+
style.push(cur);
|
|
108
|
+
}
|
|
109
|
+
if (process.env.NODE_ENV === "development") {
|
|
110
|
+
if (props["debug"]) {
|
|
111
|
+
console.log(" \u{1F95A} splitProps:", { props, viewProps, style });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
viewProps,
|
|
116
|
+
style,
|
|
117
|
+
pseudos,
|
|
118
|
+
classNames
|
|
119
|
+
};
|
|
120
|
+
}, "getSplitStyles");
|
|
121
|
+
const getSubStyle = /* @__PURE__ */ __name((styleIn, staticConfig, theme, props) => {
|
|
122
|
+
const styleOut = {};
|
|
123
|
+
for (const key in styleIn) {
|
|
124
|
+
const val = styleIn[key];
|
|
125
|
+
const out = staticConfig.propMapper(key, val, theme, props);
|
|
126
|
+
const expanded = out === true || !out ? [[key, val]] : Object.entries(out);
|
|
127
|
+
for (const [skey, sval] of expanded) {
|
|
128
|
+
if (skey in stylePropsTransform) {
|
|
129
|
+
mergeTransform(styleOut, skey, sval);
|
|
130
|
+
} else {
|
|
131
|
+
styleOut[skey] = sval;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
fixNativeShadow(styleOut);
|
|
136
|
+
return styleOut;
|
|
137
|
+
}, "getSubStyle");
|
|
138
|
+
const mapTransformKeys = {
|
|
139
|
+
x: "translateX",
|
|
140
|
+
y: "translateY"
|
|
141
|
+
};
|
|
142
|
+
const mergeTransform = /* @__PURE__ */ __name((obj, key, val) => {
|
|
143
|
+
const transform = obj.transform ? Array.isArray(obj.transform) ? obj.transform : [obj.transform] : [];
|
|
144
|
+
transform.push({ [mapTransformKeys[key] || key]: val });
|
|
145
|
+
obj.transform = transform;
|
|
146
|
+
}, "mergeTransform");
|
|
147
|
+
export {
|
|
148
|
+
getSplitStyles
|
|
149
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { AllRules } from "@tamagui/helpers";
|
|
4
|
+
import { pseudos } from "../constants/pseudos";
|
|
5
|
+
import { rnw } from "../constants/rnw";
|
|
6
|
+
const generateStyle = /* @__PURE__ */ __name((style) => {
|
|
7
|
+
const { atomic, createCompileableStyle, createReactDOMStyle, i18Style } = rnw;
|
|
8
|
+
return {
|
|
9
|
+
...atomic(createCompileableStyle(createReactDOMStyle(i18Style(style))))
|
|
10
|
+
};
|
|
11
|
+
}, "generateStyle");
|
|
12
|
+
const borderDefaults = {
|
|
13
|
+
borderWidth: "borderStyle",
|
|
14
|
+
borderBottomWidth: "borderBottomStyle",
|
|
15
|
+
borderTopWidth: "borderTopStyle",
|
|
16
|
+
borderLeftWidth: "borderLeftStyle",
|
|
17
|
+
borderRightWidth: "borderRightStyle"
|
|
18
|
+
};
|
|
19
|
+
function getStylesAtomic(style, avoidCollection = false) {
|
|
20
|
+
const styles = {
|
|
21
|
+
base: {}
|
|
22
|
+
};
|
|
23
|
+
for (const key in style) {
|
|
24
|
+
if (!!pseudos[key]) {
|
|
25
|
+
styles[key] = style[key];
|
|
26
|
+
} else {
|
|
27
|
+
styles.base[key] = style[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Object.keys(styles).map((key) => {
|
|
31
|
+
return getAtomicStyle(styles[key], pseudos[key], avoidCollection);
|
|
32
|
+
}).flat();
|
|
33
|
+
}
|
|
34
|
+
__name(getStylesAtomic, "getStylesAtomic");
|
|
35
|
+
const importantRegex = /\!important*/g;
|
|
36
|
+
function getAtomicStyle(style, pseudo, avoidCollection) {
|
|
37
|
+
if (style == null || typeof style !== "object") {
|
|
38
|
+
throw new Error(`Wrong style type: "${typeof style}": ${style}`);
|
|
39
|
+
}
|
|
40
|
+
for (const key in borderDefaults) {
|
|
41
|
+
if (key in style) {
|
|
42
|
+
style[borderDefaults[key]] = style[borderDefaults[key]] ?? "solid";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const all = generateStyle(style);
|
|
46
|
+
return Object.keys(all).map((key) => {
|
|
47
|
+
const val = all[key];
|
|
48
|
+
const hash = val.identifier.slice(`${val.identifier}`.lastIndexOf("-") + 1);
|
|
49
|
+
const psuedoPrefix = pseudo ? `-${pseudo.name}-` : "";
|
|
50
|
+
const identifier = `_${val.property}-${psuedoPrefix}${hash}`;
|
|
51
|
+
const className = `.${identifier}`;
|
|
52
|
+
const rules = val.rules.map((rule) => {
|
|
53
|
+
if (pseudo) {
|
|
54
|
+
const psuedoPrefixSelect = [...Array(pseudo.priority)].map(() => ":root").join("") + " ";
|
|
55
|
+
let res = rule.replace(`.${val.identifier}`, `${psuedoPrefixSelect} ${className}`).replace("{", `:${pseudo.name}{`);
|
|
56
|
+
if (pseudo.name === "hover") {
|
|
57
|
+
res = `@media not all and (hover: none) { ${res} }`;
|
|
58
|
+
}
|
|
59
|
+
return res;
|
|
60
|
+
}
|
|
61
|
+
return rule.replace(`.${val.identifier}`, className).replace(importantRegex, "");
|
|
62
|
+
});
|
|
63
|
+
if (!avoidCollection) {
|
|
64
|
+
if (rules.length > 1) {
|
|
65
|
+
console.warn("have never seen more than one, verifying");
|
|
66
|
+
}
|
|
67
|
+
AllRules.add(rules[0]);
|
|
68
|
+
}
|
|
69
|
+
const result = {
|
|
70
|
+
property: val.property,
|
|
71
|
+
value: val.value,
|
|
72
|
+
identifier,
|
|
73
|
+
className,
|
|
74
|
+
rules
|
|
75
|
+
};
|
|
76
|
+
return result;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
__name(getAtomicStyle, "getAtomicStyle");
|
|
80
|
+
export {
|
|
81
|
+
getStylesAtomic
|
|
82
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function getStylesAtomic() {
|
|
4
|
+
console.warn("no-op native");
|
|
5
|
+
}
|
|
6
|
+
__name(getStylesAtomic, "getStylesAtomic");
|
|
7
|
+
export {
|
|
8
|
+
getStylesAtomic
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { isWeb } from "../constants/platform";
|
|
4
|
+
function insertStyleRule(rule) {
|
|
5
|
+
if (typeof window === "undefined") {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (process.env.NODE_ENV === "development") {
|
|
9
|
+
if (!isWeb) {
|
|
10
|
+
console.warn("non web platform, dont use this");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const sheet = window.document.styleSheets[0];
|
|
15
|
+
if (!sheet) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
19
|
+
}
|
|
20
|
+
__name(insertStyleRule, "insertStyleRule");
|
|
21
|
+
export {
|
|
22
|
+
insertStyleRule
|
|
23
|
+
};
|