@tamagui/web 3.0.0-beta.755.1 → 3.0.0-beta.804.1
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.cjs +83 -86
- package/dist/cjs/createComponent.native.cjs +96 -103
- package/dist/cjs/createComponent.native.js +96 -103
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createTamagui.cjs +10 -8
- package/dist/cjs/createTamagui.native.cjs +10 -8
- package/dist/cjs/createTamagui.native.js +10 -8
- package/dist/cjs/createTamagui.native.js.map +1 -1
- package/dist/cjs/dom/htmlRuntime.native.cjs +1 -0
- package/dist/cjs/dom/htmlRuntime.native.js +1 -0
- package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
- package/dist/cjs/helpers/defaultAnimationDriver.cjs +0 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.cjs +0 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.js +0 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.js.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +348 -0
- package/dist/cjs/helpers/directStyleCSS.native.cjs +20 -0
- package/dist/cjs/helpers/directStyleCSS.native.js +22 -0
- package/dist/cjs/helpers/directStyleCSS.native.js.map +1 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.cjs +40 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +46 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js +48 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +1 -0
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +92 -74
- package/dist/cjs/helpers/{getFontLanguage.native.cjs → getCSSStylesAtomicCompiled.cjs} +12 -8
- package/dist/cjs/helpers/{getFontLanguage.native.js → getCSSStylesAtomicCompiled.native.cjs} +12 -8
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +36 -0
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -0
- package/dist/cjs/helpers/getSplitStyles.cjs +2417 -548
- package/dist/cjs/helpers/getSplitStyles.native.cjs +2758 -621
- package/dist/cjs/helpers/getSplitStyles.native.js +2758 -621
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.cjs +8 -3
- package/dist/cjs/helpers/getVariantExtras.native.cjs +8 -3
- package/dist/cjs/helpers/getVariantExtras.native.js +8 -3
- package/dist/cjs/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +3 -2
- package/dist/cjs/helpers/insertStyleRule.native.cjs +70 -7
- package/dist/cjs/helpers/insertStyleRule.native.js +70 -7
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/mediaState.cjs +12 -0
- package/dist/cjs/helpers/mediaState.native.cjs +12 -0
- package/dist/cjs/helpers/mediaState.native.js +12 -0
- package/dist/cjs/helpers/mediaState.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeStyle.cjs +16 -2
- package/dist/cjs/helpers/normalizeStyle.native.cjs +16 -2
- package/dist/cjs/helpers/normalizeStyle.native.js +16 -2
- package/dist/cjs/helpers/normalizeStyle.native.js.map +1 -1
- package/dist/cjs/helpers/resolveRem.cjs +1 -1
- package/dist/cjs/helpers/skipProps.cjs +6 -1
- package/dist/cjs/helpers/skipProps.native.cjs +6 -1
- package/dist/cjs/helpers/skipProps.native.js +6 -1
- package/dist/cjs/helpers/skipProps.native.js.map +1 -1
- package/dist/cjs/helpers/styleFrontend.cjs +2 -8
- package/dist/cjs/helpers/styleFrontend.native.cjs +2 -10
- package/dist/cjs/helpers/styleFrontend.native.js +2 -10
- package/dist/cjs/helpers/styleFrontend.native.js.map +1 -1
- package/dist/cjs/helpers/styleToCSS.cjs +59 -0
- package/dist/cjs/helpers/{normalizeStylePropKeys.cjs → styleToCSS.native.cjs} +6 -4
- package/dist/cjs/helpers/{getFontLanguage.cjs → styleToCSS.native.js} +8 -4
- package/dist/cjs/helpers/styleToCSS.native.js.map +1 -0
- package/dist/cjs/helpers/subscribeToContextGroup.cjs +28 -1
- package/dist/cjs/helpers/subscribeToContextGroup.native.cjs +45 -1
- package/dist/cjs/helpers/subscribeToContextGroup.native.js +45 -1
- package/dist/cjs/helpers/subscribeToContextGroup.native.js.map +1 -1
- package/dist/cjs/helpers/variables.cjs +3 -2
- package/dist/cjs/helpers/variables.native.cjs +3 -2
- package/dist/cjs/helpers/variables.native.js +3 -2
- package/dist/cjs/helpers/variables.native.js.map +1 -1
- package/dist/cjs/helpers/wrapStyleTags.cjs +5 -3
- package/dist/cjs/helpers/wrapStyleTags.native.cjs +3 -1
- package/dist/cjs/helpers/wrapStyleTags.native.js +3 -1
- package/dist/cjs/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +70 -89
- package/dist/cjs/hooks/useComponentState.native.cjs +70 -88
- package/dist/cjs/hooks/useComponentState.native.js +70 -88
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +3 -15
- package/dist/cjs/hooks/useMedia.native.cjs +3 -15
- package/dist/cjs/hooks/useMedia.native.js +3 -15
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/hooks/useProps.cjs +7 -5
- package/dist/cjs/hooks/useProps.native.cjs +7 -5
- package/dist/cjs/hooks/useProps.native.js +7 -5
- package/dist/cjs/hooks/useProps.native.js.map +1 -1
- package/dist/cjs/hooks/useSplitStyles.cjs +42 -0
- package/dist/cjs/hooks/useSplitStyles.native.cjs +42 -0
- package/dist/cjs/hooks/useSplitStyles.native.js +44 -0
- package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -0
- package/dist/cjs/index.cjs +184 -70
- package/dist/cjs/index.native.cjs +184 -70
- package/dist/cjs/index.native.js +184 -70
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/insertFont.cjs +1 -1
- package/dist/cjs/insertFont.native.cjs +1 -0
- package/dist/cjs/insertFont.native.js +1 -0
- package/dist/cjs/insertFont.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +33 -6
- package/dist/cjs/internal-runtime.native.cjs +33 -6
- package/dist/cjs/internal-runtime.native.js +33 -6
- package/dist/cjs/internal-runtime.native.js.map +1 -1
- package/dist/cjs/setupReactNative.cjs +1 -29
- package/dist/cjs/setupReactNative.native.cjs +1 -3
- package/dist/cjs/setupReactNative.native.js +1 -3
- package/dist/cjs/setupReactNative.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +229 -0
- package/dist/cjs/static-resolve.native.cjs +242 -0
- package/dist/cjs/static-resolve.native.js +244 -0
- package/dist/cjs/static-resolve.native.js.map +1 -0
- package/dist/cjs/styled.cjs +23 -37
- package/dist/cjs/styled.native.cjs +22 -37
- package/dist/cjs/styled.native.js +22 -37
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.cjs +4 -8
- package/dist/cjs/views/TamaguiProvider.native.cjs +4 -8
- package/dist/cjs/views/TamaguiProvider.native.js +4 -8
- package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
- package/dist/cjs/views/ThemeUpdate.cjs +1 -1
- package/dist/cjs/views/ThemeUpdate.native.cjs +1 -1
- package/dist/cjs/views/ThemeUpdate.native.js +1 -1
- package/dist/cjs/views/ThemeUpdate.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +85 -88
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +98 -105
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createTamagui.mjs +10 -8
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +10 -8
- package/dist/esm/createTamagui.native.js.map +1 -1
- package/dist/esm/dom/htmlRuntime.native.js +1 -0
- package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.mjs +0 -1
- package/dist/esm/helpers/defaultAnimationDriver.mjs.map +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.native.js +0 -1
- package/dist/esm/helpers/defaultAnimationDriver.native.js.map +1 -1
- package/dist/esm/helpers/directStyleCSS.mjs +320 -0
- package/dist/esm/helpers/directStyleCSS.mjs.map +1 -0
- package/dist/esm/helpers/directStyleCSS.native.js +1 -0
- package/dist/esm/helpers/directStyleCSSCompiled.mjs +11 -0
- package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +1 -0
- package/dist/esm/helpers/directStyleCSSCompiled.native.js +15 -0
- package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +1 -0
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +86 -72
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +9 -0
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -0
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +9 -0
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -0
- package/dist/esm/helpers/getSplitStyles.mjs +2406 -545
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +2751 -618
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.mjs +8 -3
- package/dist/esm/helpers/getVariantExtras.mjs.map +1 -1
- package/dist/esm/helpers/getVariantExtras.native.js +8 -3
- package/dist/esm/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +3 -2
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +71 -5
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/mediaState.mjs +12 -1
- package/dist/esm/helpers/mediaState.mjs.map +1 -1
- package/dist/esm/helpers/mediaState.native.js +12 -1
- package/dist/esm/helpers/mediaState.native.js.map +1 -1
- package/dist/esm/helpers/normalizeStyle.mjs +16 -2
- package/dist/esm/helpers/normalizeStyle.mjs.map +1 -1
- package/dist/esm/helpers/normalizeStyle.native.js +16 -2
- package/dist/esm/helpers/normalizeStyle.native.js.map +1 -1
- package/dist/esm/helpers/resolveRem.mjs +1 -1
- package/dist/esm/helpers/resolveRem.mjs.map +1 -1
- package/dist/esm/helpers/skipProps.mjs +3 -1
- package/dist/esm/helpers/skipProps.mjs.map +1 -1
- package/dist/esm/helpers/skipProps.native.js +3 -1
- package/dist/esm/helpers/skipProps.native.js.map +1 -1
- package/dist/esm/helpers/styleFrontend.mjs +2 -4
- package/dist/esm/helpers/styleFrontend.mjs.map +1 -1
- package/dist/esm/helpers/styleFrontend.native.js +2 -6
- package/dist/esm/helpers/styleFrontend.native.js.map +1 -1
- package/dist/esm/helpers/styleToCSS.mjs +40 -0
- package/dist/esm/helpers/styleToCSS.mjs.map +1 -0
- package/dist/esm/helpers/styleToCSS.native.js +4 -0
- package/dist/esm/helpers/styleToCSS.native.js.map +1 -0
- package/dist/esm/helpers/subscribeToContextGroup.mjs +25 -1
- package/dist/esm/helpers/subscribeToContextGroup.mjs.map +1 -1
- package/dist/esm/helpers/subscribeToContextGroup.native.js +42 -1
- package/dist/esm/helpers/subscribeToContextGroup.native.js.map +1 -1
- package/dist/esm/helpers/variables.mjs +2 -1
- package/dist/esm/helpers/variables.mjs.map +1 -1
- package/dist/esm/helpers/variables.native.js +2 -1
- package/dist/esm/helpers/variables.native.js.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.mjs +5 -3
- package/dist/esm/helpers/wrapStyleTags.mjs.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.native.js +3 -1
- package/dist/esm/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +71 -90
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +71 -89
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +2 -15
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +2 -15
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useProps.mjs +7 -5
- package/dist/esm/hooks/useProps.mjs.map +1 -1
- package/dist/esm/hooks/useProps.native.js +7 -5
- package/dist/esm/hooks/useProps.native.js.map +1 -1
- package/dist/esm/hooks/useSplitStyles.mjs +17 -0
- package/dist/esm/hooks/useSplitStyles.mjs.map +1 -0
- package/dist/esm/hooks/useSplitStyles.native.js +14 -0
- package/dist/esm/hooks/useSplitStyles.native.js.map +1 -0
- package/dist/esm/index.js +57 -137
- package/dist/esm/index.mjs +57 -137
- package/dist/esm/index.native.js +57 -137
- package/dist/esm/insertFont.mjs +1 -1
- package/dist/esm/insertFont.mjs.map +1 -1
- package/dist/esm/insertFont.native.js +1 -0
- package/dist/esm/insertFont.native.js.map +1 -1
- package/dist/esm/internal-runtime.mjs +23 -4
- package/dist/esm/internal-runtime.mjs.map +1 -1
- package/dist/esm/internal-runtime.native.js +23 -4
- package/dist/esm/internal-runtime.native.js.map +1 -1
- package/dist/esm/setupReactNative.mjs +1 -29
- package/dist/esm/setupReactNative.mjs.map +1 -1
- package/dist/esm/setupReactNative.native.js +1 -3
- package/dist/esm/setupReactNative.native.js.map +1 -1
- package/dist/esm/static-resolve.mjs +194 -0
- package/dist/esm/static-resolve.mjs.map +1 -0
- package/dist/esm/static-resolve.native.js +205 -0
- package/dist/esm/static-resolve.native.js.map +1 -0
- package/dist/esm/styled.mjs +24 -40
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +23 -40
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.mjs +4 -8
- package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
- package/dist/esm/views/TamaguiProvider.native.js +4 -8
- package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
- package/dist/esm/views/ThemeUpdate.mjs +1 -1
- package/dist/esm/views/ThemeUpdate.mjs.map +1 -1
- package/dist/esm/views/ThemeUpdate.native.js +1 -1
- package/dist/esm/views/ThemeUpdate.native.js.map +1 -1
- package/package.json +25 -15
- package/reset.css +3 -3
- package/src/createComponent.tsx +175 -192
- package/src/createTamagui.ts +13 -10
- package/src/dom/html.native.tsx +99 -92
- package/src/dom/html.tsx +105 -98
- package/src/dom/htmlRuntime.native.tsx +1 -0
- package/src/helpers/defaultAnimationDriver.tsx +0 -1
- package/src/helpers/directStyleCSS.native.ts +1 -0
- package/src/helpers/directStyleCSS.ts +534 -0
- package/src/helpers/directStyleCSSCompiled.ts +32 -0
- package/src/helpers/getCSSStylesAtomic.ts +168 -88
- package/src/helpers/getCSSStylesAtomicCompiled.ts +9 -0
- package/src/helpers/getSplitStyles.tsx +4653 -1003
- package/src/helpers/getVariantExtras.tsx +15 -3
- package/src/helpers/insertStyleRule.tsx +8 -3
- package/src/helpers/mediaState.ts +15 -0
- package/src/helpers/normalizeStyle.ts +27 -2
- package/src/helpers/resolveRem.ts +1 -1
- package/src/helpers/skipProps.ts +3 -0
- package/src/helpers/styleFrontend.ts +20 -27
- package/src/helpers/styleToCSS.native.ts +1 -0
- package/src/helpers/styleToCSS.ts +43 -0
- package/src/helpers/subscribeToContextGroup.tsx +30 -0
- package/src/helpers/variables.ts +2 -1
- package/src/helpers/warnOnce.ts +3 -4
- package/src/helpers/wrapStyleTags.tsx +1 -1
- package/src/hooks/useComponentState.ts +118 -158
- package/src/hooks/useMedia.tsx +2 -18
- package/src/hooks/useProps.tsx +19 -15
- package/src/hooks/useSplitStyles.tsx +26 -0
- package/src/index.ts +298 -73
- package/src/insertFont.ts +5 -1
- package/src/internal-runtime.ts +49 -24
- package/src/internalRuntimeTypes.ts +2 -7
- package/src/setupReactNative.ts +7 -30
- package/src/static-resolve.ts +396 -0
- package/src/styled.tsx +34 -11
- package/src/types.tsx +41 -31
- package/src/views/TamaguiProvider.tsx +23 -22
- package/src/views/ThemeUpdate.tsx +3 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/dom/html.d.ts +54 -50
- package/types/dom/html.d.ts.map +1 -1
- package/types/dom/html.native.d.ts +51 -47
- package/types/dom/html.native.d.ts.map +1 -1
- package/types/dom/htmlRuntime.native.d.ts.map +1 -1
- package/types/helpers/defaultAnimationDriver.d.ts.map +1 -1
- package/types/helpers/directStyleCSS.d.ts +28 -0
- package/types/helpers/directStyleCSS.d.ts.map +1 -0
- package/types/helpers/directStyleCSS.native.d.ts +2 -0
- package/types/helpers/directStyleCSS.native.d.ts.map +1 -0
- package/types/helpers/directStyleCSSCompiled.d.ts +10 -0
- package/types/helpers/directStyleCSSCompiled.d.ts.map +1 -0
- package/types/helpers/getCSSStylesAtomic.d.ts +22 -1
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts +4 -0
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +11 -4
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getVariantExtras.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/mediaState.d.ts +4 -0
- package/types/helpers/mediaState.d.ts.map +1 -1
- package/types/helpers/normalizeStyle.d.ts +1 -1
- package/types/helpers/normalizeStyle.d.ts.map +1 -1
- package/types/helpers/skipProps.d.ts +2 -0
- package/types/helpers/skipProps.d.ts.map +1 -1
- package/types/helpers/styleFrontend.d.ts +13 -17
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleToCSS.d.ts +2 -0
- package/types/helpers/styleToCSS.d.ts.map +1 -0
- package/types/helpers/styleToCSS.native.d.ts +2 -0
- package/types/helpers/styleToCSS.native.d.ts.map +1 -0
- package/types/helpers/subscribeToContextGroup.d.ts +1 -0
- package/types/helpers/subscribeToContextGroup.d.ts.map +1 -1
- package/types/helpers/variables.d.ts.map +1 -1
- package/types/helpers/warnOnce.d.ts.map +1 -1
- package/types/helpers/webPropsToSkip.native.d.ts +5 -0
- package/types/helpers/webPropsToSkip.native.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts +3 -2
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts +1 -5
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useProps.d.ts.map +1 -1
- package/types/hooks/useSplitStyles.d.ts +3 -0
- package/types/hooks/useSplitStyles.d.ts.map +1 -0
- package/types/index.d.ts +58 -72
- package/types/index.d.ts.map +1 -1
- package/types/insertFont.d.ts.map +1 -1
- package/types/internal-runtime.d.ts +24 -11
- package/types/internal-runtime.d.ts.map +1 -1
- package/types/internalRuntimeTypes.d.ts +1 -6
- package/types/internalRuntimeTypes.d.ts.map +1 -1
- package/types/setupReactNative.d.ts +2 -3
- package/types/setupReactNative.d.ts.map +1 -1
- package/types/static-resolve.d.ts +79 -0
- package/types/static-resolve.d.ts.map +1 -0
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +30 -23
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.d.ts.map +1 -1
- package/types/views/ThemeUpdate.d.ts.map +1 -1
- package/dist/cjs/constants/accessibilityDirectMap.cjs +0 -34
- package/dist/cjs/constants/accessibilityDirectMap.native.cjs +0 -36
- package/dist/cjs/constants/accessibilityDirectMap.native.js +0 -38
- package/dist/cjs/constants/accessibilityDirectMap.native.js.map +0 -1
- package/dist/cjs/helpers/directStyle.cjs +0 -962
- package/dist/cjs/helpers/directStyle.native.cjs +0 -1165
- package/dist/cjs/helpers/directStyle.native.js +0 -1167
- package/dist/cjs/helpers/directStyle.native.js.map +0 -1
- package/dist/cjs/helpers/frontendProgram.cjs +0 -43
- package/dist/cjs/helpers/frontendProgram.native.cjs +0 -49
- package/dist/cjs/helpers/frontendProgram.native.js +0 -51
- package/dist/cjs/helpers/frontendProgram.native.js.map +0 -1
- package/dist/cjs/helpers/getFontLanguage.native.js.map +0 -1
- package/dist/cjs/helpers/normalizeStylePropKeys.native.cjs +0 -37
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js +0 -39
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js.map +0 -1
- package/dist/cjs/helpers/propMapper.cjs +0 -384
- package/dist/cjs/helpers/propMapper.native.cjs +0 -536
- package/dist/cjs/helpers/propMapper.native.js +0 -538
- package/dist/cjs/helpers/propMapper.native.js.map +0 -1
- package/dist/cjs/helpers/useRenderElement.cjs +0 -47
- package/dist/cjs/helpers/useRenderElement.native.cjs +0 -53
- package/dist/cjs/helpers/useRenderElement.native.js +0 -55
- package/dist/cjs/helpers/useRenderElement.native.js.map +0 -1
- package/dist/esm/constants/accessibilityDirectMap.mjs +0 -8
- package/dist/esm/constants/accessibilityDirectMap.mjs.map +0 -1
- package/dist/esm/constants/accessibilityDirectMap.native.js +0 -8
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +0 -1
- package/dist/esm/helpers/directStyle.mjs +0 -929
- package/dist/esm/helpers/directStyle.mjs.map +0 -1
- package/dist/esm/helpers/directStyle.native.js +0 -1132
- package/dist/esm/helpers/directStyle.native.js.map +0 -1
- package/dist/esm/helpers/frontendProgram.mjs +0 -20
- package/dist/esm/helpers/frontendProgram.mjs.map +0 -1
- package/dist/esm/helpers/frontendProgram.native.js +0 -24
- package/dist/esm/helpers/frontendProgram.native.js.map +0 -1
- package/dist/esm/helpers/getFontLanguage.mjs +0 -4
- package/dist/esm/helpers/getFontLanguage.mjs.map +0 -1
- package/dist/esm/helpers/getFontLanguage.native.js +0 -6
- package/dist/esm/helpers/getFontLanguage.native.js.map +0 -1
- package/dist/esm/helpers/normalizeStylePropKeys.mjs +0 -4
- package/dist/esm/helpers/normalizeStylePropKeys.mjs.map +0 -1
- package/dist/esm/helpers/normalizeStylePropKeys.native.js +0 -15
- package/dist/esm/helpers/normalizeStylePropKeys.native.js.map +0 -1
- package/dist/esm/helpers/propMapper.mjs +0 -360
- package/dist/esm/helpers/propMapper.mjs.map +0 -1
- package/dist/esm/helpers/propMapper.native.js +0 -511
- package/dist/esm/helpers/propMapper.native.js.map +0 -1
- package/dist/esm/helpers/useRenderElement.mjs +0 -26
- package/dist/esm/helpers/useRenderElement.mjs.map +0 -1
- package/dist/esm/helpers/useRenderElement.native.js +0 -31
- package/dist/esm/helpers/useRenderElement.native.js.map +0 -1
- package/src/constants/accessibilityDirectMap.native.tsx +0 -10
- package/src/constants/accessibilityDirectMap.tsx +0 -11
- package/src/helpers/directStyle.ts +0 -2294
- package/src/helpers/frontendProgram.ts +0 -48
- package/src/helpers/getFontLanguage.ts +0 -2
- package/src/helpers/normalizeStylePropKeys.native.ts +0 -12
- package/src/helpers/normalizeStylePropKeys.ts +0 -3
- package/src/helpers/propMapper.ts +0 -721
- package/src/helpers/useRenderElement.tsx +0 -73
- package/types/constants/accessibilityDirectMap.d.ts +0 -6
- package/types/constants/accessibilityDirectMap.d.ts.map +0 -1
- package/types/constants/accessibilityDirectMap.native.d.ts +0 -6
- package/types/constants/accessibilityDirectMap.native.d.ts.map +0 -1
- package/types/helpers/directStyle.d.ts +0 -15
- package/types/helpers/directStyle.d.ts.map +0 -1
- package/types/helpers/frontendProgram.d.ts +0 -10
- package/types/helpers/frontendProgram.d.ts.map +0 -1
- package/types/helpers/getFontLanguage.d.ts +0 -2
- package/types/helpers/getFontLanguage.d.ts.map +0 -1
- package/types/helpers/normalizeStylePropKeys.d.ts +0 -2
- package/types/helpers/normalizeStylePropKeys.d.ts.map +0 -1
- package/types/helpers/normalizeStylePropKeys.native.d.ts +0 -13
- package/types/helpers/normalizeStylePropKeys.native.d.ts.map +0 -1
- package/types/helpers/propMapper.d.ts +0 -6
- package/types/helpers/propMapper.d.ts.map +0 -1
- package/types/helpers/useRenderElement.d.ts +0 -13
- package/types/helpers/useRenderElement.d.ts.map +0 -1
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lean, side-effect-free static style resolution entry for @tamagui/web.
|
|
3
|
+
*
|
|
4
|
+
* Designed for build-time compilers (Rust one-bundler QuickJS host, Vite, static extractor)
|
|
5
|
+
* to evaluate config and resolve extracted static props with zero React/DOM/React Native
|
|
6
|
+
* runtime dependencies.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
StyleObjectIdentifier,
|
|
11
|
+
StyleObjectProperty,
|
|
12
|
+
StyleObjectRules,
|
|
13
|
+
stylePropsText,
|
|
14
|
+
validStyles as validStylesView,
|
|
15
|
+
} from '@tamagui/helpers'
|
|
16
|
+
import {
|
|
17
|
+
getConfig,
|
|
18
|
+
getConfigMaybe,
|
|
19
|
+
getThemes,
|
|
20
|
+
getToken,
|
|
21
|
+
getTokens,
|
|
22
|
+
getTokenValue,
|
|
23
|
+
setConfig,
|
|
24
|
+
updateConfig,
|
|
25
|
+
} from './config'
|
|
26
|
+
import { createTamagui, installTamaguiConfig } from './createTamagui'
|
|
27
|
+
import { getSplitStyles, prepareStyleStaticConfig } from './helpers/getSplitStyles'
|
|
28
|
+
import { mergeComponentProps } from './helpers/mergeProps'
|
|
29
|
+
import type {
|
|
30
|
+
SplitStyleProps,
|
|
31
|
+
StaticConfig,
|
|
32
|
+
TamaguiComponentState,
|
|
33
|
+
TamaguiInternalConfig,
|
|
34
|
+
ThemeParsed,
|
|
35
|
+
} from './types'
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
createTamagui,
|
|
39
|
+
getConfig,
|
|
40
|
+
getConfigMaybe,
|
|
41
|
+
getSplitStyles,
|
|
42
|
+
getThemes,
|
|
43
|
+
getToken,
|
|
44
|
+
getTokens,
|
|
45
|
+
getTokenValue,
|
|
46
|
+
installTamaguiConfig,
|
|
47
|
+
prepareStyleStaticConfig,
|
|
48
|
+
setConfig,
|
|
49
|
+
updateConfig,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type { StaticConfig, TamaguiComponentState, TamaguiInternalConfig, ThemeParsed }
|
|
53
|
+
|
|
54
|
+
export interface StaticResolveOptions {
|
|
55
|
+
resolveValues?: 'variable' | 'except-theme' | 'value' | 'none'
|
|
56
|
+
noClass?: boolean
|
|
57
|
+
isAnimated?: boolean
|
|
58
|
+
displayName?: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface StaticResolveElementPlan {
|
|
62
|
+
id: string | number
|
|
63
|
+
props: Record<string, any>
|
|
64
|
+
componentName?: string
|
|
65
|
+
staticConfig?: Partial<StaticConfig>
|
|
66
|
+
themeName?: string
|
|
67
|
+
componentState?: Partial<TamaguiComponentState>
|
|
68
|
+
options?: StaticResolveOptions
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface StaticResolveBatchPlan {
|
|
72
|
+
target?: 'web' | 'native'
|
|
73
|
+
defaultThemeName?: string
|
|
74
|
+
elements: StaticResolveElementPlan[]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface StaticResolveRuleOutput {
|
|
78
|
+
identifier: string
|
|
79
|
+
property?: string
|
|
80
|
+
rules: string[]
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface StaticResolveElementResult {
|
|
84
|
+
id: string | number
|
|
85
|
+
ok: boolean
|
|
86
|
+
className?: string
|
|
87
|
+
classNames?: Record<string, string>
|
|
88
|
+
rules?: StaticResolveRuleOutput[]
|
|
89
|
+
css?: string[]
|
|
90
|
+
style?: Record<string, any> | null
|
|
91
|
+
viewProps?: Record<string, any>
|
|
92
|
+
hasMedia?: string[] | boolean
|
|
93
|
+
pseudoGroups?: string[]
|
|
94
|
+
mediaGroups?: string[]
|
|
95
|
+
programStates?: string[]
|
|
96
|
+
dynamicThemeAccess?: boolean
|
|
97
|
+
fontFamily?: string
|
|
98
|
+
programLifecycleStyleKeys?: {
|
|
99
|
+
enter?: string[]
|
|
100
|
+
exit?: string[]
|
|
101
|
+
}
|
|
102
|
+
bailout?: {
|
|
103
|
+
reason: string
|
|
104
|
+
message: string
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface StaticResolveBatchResult {
|
|
109
|
+
results: StaticResolveElementResult[]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const DEFAULT_COMPONENT_STATE: TamaguiComponentState = {
|
|
113
|
+
hover: false,
|
|
114
|
+
focus: false,
|
|
115
|
+
focusVisible: false,
|
|
116
|
+
focusWithin: false,
|
|
117
|
+
press: false,
|
|
118
|
+
pressIn: false,
|
|
119
|
+
disabled: false,
|
|
120
|
+
unmounted: false,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const getGlobalProcessEnv = () => {
|
|
124
|
+
try {
|
|
125
|
+
return typeof process !== 'undefined' && process ? process.env : undefined
|
|
126
|
+
} catch {
|
|
127
|
+
return undefined
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Resolves static styles for a single element against the currently installed Tamagui config.
|
|
133
|
+
*/
|
|
134
|
+
export function resolveStaticElement(
|
|
135
|
+
element: StaticResolveElementPlan,
|
|
136
|
+
target: 'web' | 'native' = 'web',
|
|
137
|
+
defaultThemeName?: string
|
|
138
|
+
): StaticResolveElementResult {
|
|
139
|
+
const conf = getConfigMaybe()
|
|
140
|
+
if (!conf) {
|
|
141
|
+
return {
|
|
142
|
+
id: element.id,
|
|
143
|
+
ok: false,
|
|
144
|
+
bailout: {
|
|
145
|
+
reason: 'config-missing',
|
|
146
|
+
message:
|
|
147
|
+
'No Tamagui config installed. Call createTamagui or installTamaguiConfig first.',
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const themes = conf.themes || {}
|
|
153
|
+
const themeName =
|
|
154
|
+
element.themeName ||
|
|
155
|
+
defaultThemeName ||
|
|
156
|
+
(themes['light'] ? 'light' : Object.keys(themes)[0]) ||
|
|
157
|
+
'light'
|
|
158
|
+
const theme: ThemeParsed =
|
|
159
|
+
themes[themeName] ||
|
|
160
|
+
themes['light'] ||
|
|
161
|
+
themes['dark'] ||
|
|
162
|
+
Object.values(themes)[0] ||
|
|
163
|
+
({} as ThemeParsed)
|
|
164
|
+
|
|
165
|
+
const isTextLike = Boolean(
|
|
166
|
+
element.staticConfig?.isText || element.staticConfig?.isInput
|
|
167
|
+
)
|
|
168
|
+
const baseStaticConfig: StaticConfig = {
|
|
169
|
+
validStyles: isTextLike ? stylePropsText : validStylesView,
|
|
170
|
+
defaultProps: {},
|
|
171
|
+
acceptsClassName: target !== 'native',
|
|
172
|
+
...(target === 'native' && { isReactNative: true }),
|
|
173
|
+
...element.staticConfig,
|
|
174
|
+
}
|
|
175
|
+
if (target !== 'native') {
|
|
176
|
+
delete baseStaticConfig.isReactNative
|
|
177
|
+
}
|
|
178
|
+
prepareStyleStaticConfig(baseStaticConfig)
|
|
179
|
+
|
|
180
|
+
// merge component defaultProps if defined on staticConfig
|
|
181
|
+
let elementProps = element.props || {}
|
|
182
|
+
if (
|
|
183
|
+
baseStaticConfig.defaultProps &&
|
|
184
|
+
Object.keys(baseStaticConfig.defaultProps).length > 0
|
|
185
|
+
) {
|
|
186
|
+
const [merged] = mergeComponentProps(
|
|
187
|
+
baseStaticConfig.defaultProps,
|
|
188
|
+
undefined,
|
|
189
|
+
elementProps
|
|
190
|
+
)
|
|
191
|
+
elementProps = merged
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const componentState: TamaguiComponentState = {
|
|
195
|
+
...DEFAULT_COMPONENT_STATE,
|
|
196
|
+
...element.componentState,
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const styleProps: SplitStyleProps = {
|
|
200
|
+
resolveValues:
|
|
201
|
+
element.options?.resolveValues ??
|
|
202
|
+
(target === 'native' ? 'except-theme' : 'variable'),
|
|
203
|
+
noClass: element.options?.noClass ?? target === 'native',
|
|
204
|
+
isAnimated: element.options?.isAnimated ?? false,
|
|
205
|
+
displayName:
|
|
206
|
+
element.options?.displayName ??
|
|
207
|
+
element.componentName ??
|
|
208
|
+
element.staticConfig?.Component?.displayName ??
|
|
209
|
+
'TamaguiComponent',
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const env = getGlobalProcessEnv()
|
|
213
|
+
const prevStatic = env ? env['IS_STATIC'] : undefined
|
|
214
|
+
const prevTarget = env ? env['TAMAGUI_TARGET'] : undefined
|
|
215
|
+
if (env) {
|
|
216
|
+
if (target === 'native') {
|
|
217
|
+
env['IS_STATIC'] = 'is_static'
|
|
218
|
+
} else {
|
|
219
|
+
delete env['IS_STATIC']
|
|
220
|
+
}
|
|
221
|
+
env['TAMAGUI_TARGET'] = target
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let split: ReturnType<typeof getSplitStyles> | null = null
|
|
225
|
+
try {
|
|
226
|
+
split = getSplitStyles(
|
|
227
|
+
elementProps,
|
|
228
|
+
baseStaticConfig,
|
|
229
|
+
theme,
|
|
230
|
+
themeName,
|
|
231
|
+
componentState,
|
|
232
|
+
styleProps
|
|
233
|
+
)
|
|
234
|
+
} catch (err: any) {
|
|
235
|
+
return {
|
|
236
|
+
id: element.id,
|
|
237
|
+
ok: false,
|
|
238
|
+
bailout: {
|
|
239
|
+
reason: 'local/style-resolution-error',
|
|
240
|
+
message: err?.message || String(err),
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
} finally {
|
|
244
|
+
if (env) {
|
|
245
|
+
if (prevStatic === undefined) delete env['IS_STATIC']
|
|
246
|
+
else env['IS_STATIC'] = prevStatic
|
|
247
|
+
if (prevTarget === undefined) delete env['TAMAGUI_TARGET']
|
|
248
|
+
else env['TAMAGUI_TARGET'] = prevTarget
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (!split) {
|
|
253
|
+
return {
|
|
254
|
+
id: element.id,
|
|
255
|
+
ok: false,
|
|
256
|
+
bailout: {
|
|
257
|
+
reason: 'local/style-resolution-failed',
|
|
258
|
+
message: 'getSplitStyles returned no static result',
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Native target does not support static media queries, pseudos, or runtime lifecycle programs
|
|
264
|
+
if (target === 'native') {
|
|
265
|
+
const hasMedia =
|
|
266
|
+
split.hasMedia === true ||
|
|
267
|
+
(split.hasMedia instanceof Set && split.hasMedia.size > 0)
|
|
268
|
+
|
|
269
|
+
const hasPseudo =
|
|
270
|
+
Boolean(split.pseudoGroups && split.pseudoGroups.size > 0) ||
|
|
271
|
+
Boolean(split.mediaGroups && split.mediaGroups.size > 0) ||
|
|
272
|
+
Boolean(split.programStates && split.programStates.size > 0)
|
|
273
|
+
|
|
274
|
+
if (hasMedia || hasPseudo) {
|
|
275
|
+
return {
|
|
276
|
+
id: element.id,
|
|
277
|
+
ok: false,
|
|
278
|
+
bailout: {
|
|
279
|
+
reason: 'local/unsupported-target',
|
|
280
|
+
message: 'Native target does not support static media queries or pseudo styles',
|
|
281
|
+
},
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (
|
|
286
|
+
split.programLifecycleStyleKeys?.enter?.size ||
|
|
287
|
+
split.programLifecycleStyleKeys?.exit?.size
|
|
288
|
+
) {
|
|
289
|
+
return {
|
|
290
|
+
id: element.id,
|
|
291
|
+
ok: false,
|
|
292
|
+
bailout: {
|
|
293
|
+
reason: 'local/unsupported-target',
|
|
294
|
+
message: 'Lifecycle value programs remain on the runtime path',
|
|
295
|
+
},
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const rules: StaticResolveRuleOutput[] = []
|
|
301
|
+
const css: string[] = []
|
|
302
|
+
if (split.rulesToInsert) {
|
|
303
|
+
for (const key in split.rulesToInsert) {
|
|
304
|
+
const ruleObj = split.rulesToInsert[key]
|
|
305
|
+
if (ruleObj) {
|
|
306
|
+
const ruleList = ((ruleObj as any)[StyleObjectRules] || []) as string[]
|
|
307
|
+
rules.push({
|
|
308
|
+
identifier: (ruleObj as any)[StyleObjectIdentifier] || key,
|
|
309
|
+
property: (ruleObj as any)[StyleObjectProperty],
|
|
310
|
+
rules: ruleList,
|
|
311
|
+
})
|
|
312
|
+
for (let i = 0; i < ruleList.length; i++) {
|
|
313
|
+
css.push(ruleList[i])
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const classNames = split.classNames || {}
|
|
320
|
+
const classNamesList = Object.values(classNames).filter(Boolean)
|
|
321
|
+
const fullClassName = (split.viewProps?.className as string) || undefined
|
|
322
|
+
const className =
|
|
323
|
+
fullClassName || (classNamesList.length > 0 ? classNamesList.join(' ') : undefined)
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
id: element.id,
|
|
327
|
+
ok: true,
|
|
328
|
+
className,
|
|
329
|
+
classNames: Object.keys(classNames).length > 0 ? classNames : undefined,
|
|
330
|
+
rules: rules.length > 0 ? rules : undefined,
|
|
331
|
+
css: css.length > 0 ? css : undefined,
|
|
332
|
+
style: split.style || split.viewProps?.style || null,
|
|
333
|
+
viewProps: split.viewProps,
|
|
334
|
+
hasMedia:
|
|
335
|
+
split.hasMedia instanceof Set
|
|
336
|
+
? Array.from(split.hasMedia)
|
|
337
|
+
: split.hasMedia || undefined,
|
|
338
|
+
pseudoGroups:
|
|
339
|
+
split.pseudoGroups && split.pseudoGroups.size > 0
|
|
340
|
+
? Array.from(split.pseudoGroups)
|
|
341
|
+
: undefined,
|
|
342
|
+
mediaGroups:
|
|
343
|
+
split.mediaGroups && split.mediaGroups.size > 0
|
|
344
|
+
? Array.from(split.mediaGroups)
|
|
345
|
+
: undefined,
|
|
346
|
+
programStates:
|
|
347
|
+
split.programStates && split.programStates.size > 0
|
|
348
|
+
? Array.from(split.programStates)
|
|
349
|
+
: undefined,
|
|
350
|
+
dynamicThemeAccess: split.dynamicThemeAccess,
|
|
351
|
+
fontFamily: split.fontFamily,
|
|
352
|
+
programLifecycleStyleKeys: split.programLifecycleStyleKeys
|
|
353
|
+
? {
|
|
354
|
+
enter: split.programLifecycleStyleKeys.enter
|
|
355
|
+
? Array.from(split.programLifecycleStyleKeys.enter)
|
|
356
|
+
: undefined,
|
|
357
|
+
exit: split.programLifecycleStyleKeys.exit
|
|
358
|
+
? Array.from(split.programLifecycleStyleKeys.exit)
|
|
359
|
+
: undefined,
|
|
360
|
+
}
|
|
361
|
+
: undefined,
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Resolves a batch of element extraction plans against the active Tamagui config.
|
|
367
|
+
*/
|
|
368
|
+
export function resolveStaticBatch(
|
|
369
|
+
batch: StaticResolveBatchPlan
|
|
370
|
+
): StaticResolveBatchResult {
|
|
371
|
+
const target = batch.target || 'web'
|
|
372
|
+
const defaultThemeName = batch.defaultThemeName
|
|
373
|
+
const elements = batch.elements || []
|
|
374
|
+
const results: StaticResolveElementResult[] = new Array(elements.length)
|
|
375
|
+
|
|
376
|
+
for (let i = 0; i < elements.length; i++) {
|
|
377
|
+
results[i] = resolveStaticElement(elements[i], target, defaultThemeName)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return { results }
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Polymorphic batched static resolver. Accepts either a JSON string (for embedded C / QuickJS FFI)
|
|
385
|
+
* or a JavaScript StaticResolveBatchPlan object, returning matching JSON or result object.
|
|
386
|
+
*/
|
|
387
|
+
export function resolveStatic(
|
|
388
|
+
batch: string | StaticResolveBatchPlan
|
|
389
|
+
): string | StaticResolveBatchResult {
|
|
390
|
+
if (typeof batch === 'string') {
|
|
391
|
+
const parsed: StaticResolveBatchPlan = JSON.parse(batch)
|
|
392
|
+
const result = resolveStaticBatch(parsed)
|
|
393
|
+
return JSON.stringify(result)
|
|
394
|
+
}
|
|
395
|
+
return resolveStaticBatch(batch)
|
|
396
|
+
}
|
package/src/styled.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from './helpers/componentDisplayName'
|
|
16
16
|
import { mergeVariants } from './helpers/mergeVariants'
|
|
17
17
|
import type { FrontendComponent, StyleFrontend } from './helpers/styleFrontend'
|
|
18
|
+
import { warnOnce } from './helpers/warnOnce'
|
|
18
19
|
import type { GetRef } from './interfaces/GetRef'
|
|
19
20
|
import { getReactNativeConfig } from './setupReactNative'
|
|
20
21
|
import type {
|
|
@@ -378,7 +379,6 @@ export function styledHtml<
|
|
|
378
379
|
variants: variants as any,
|
|
379
380
|
defaultProps: defaultProps as any,
|
|
380
381
|
defaultVariants,
|
|
381
|
-
isReactNative: false,
|
|
382
382
|
isText,
|
|
383
383
|
acceptsClassName: true,
|
|
384
384
|
context,
|
|
@@ -556,9 +556,27 @@ function styledImpl<
|
|
|
556
556
|
|
|
557
557
|
const parentStaticConfig = ComponentIn['staticConfig'] as StaticConfig | undefined
|
|
558
558
|
|
|
559
|
+
const requestedReactNativeInterop = Boolean(
|
|
560
|
+
config?.isReactNative || parentStaticConfig?.isReactNative
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
if (
|
|
564
|
+
process.env.TAMAGUI_TARGET !== 'native' &&
|
|
565
|
+
process.env.NODE_ENV === 'development' &&
|
|
566
|
+
requestedReactNativeInterop
|
|
567
|
+
) {
|
|
568
|
+
warnOnce(
|
|
569
|
+
'isReactNative-web-removed',
|
|
570
|
+
'The isReactNative styled-component option is native-only in Tamagui v3. React Native Web hosts on web are no longer adapted; use a component that accepts className, data-* attributes, and DOM events.'
|
|
571
|
+
)
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const isReactNative =
|
|
575
|
+
process.env.TAMAGUI_TARGET === 'native' &&
|
|
576
|
+
Boolean(config?.isReactNative || parentStaticConfig?.isReactNative)
|
|
577
|
+
|
|
559
578
|
const isPlainStyledComponent =
|
|
560
|
-
!!parentStaticConfig &&
|
|
561
|
-
!(parentStaticConfig.isReactNative || parentStaticConfig.isHOC)
|
|
579
|
+
!!parentStaticConfig && !(isReactNative || parentStaticConfig.isHOC)
|
|
562
580
|
|
|
563
581
|
const isNonStyledHOC = parentStaticConfig?.isHOC && !parentStaticConfig?.isStyledHOC
|
|
564
582
|
|
|
@@ -567,13 +585,12 @@ function styledImpl<
|
|
|
567
585
|
? ComponentIn
|
|
568
586
|
: parentStaticConfig?.Component || ComponentIn
|
|
569
587
|
|
|
570
|
-
const reactNativeConfig =
|
|
571
|
-
|
|
572
|
-
|
|
588
|
+
const reactNativeConfig =
|
|
589
|
+
process.env.TAMAGUI_TARGET === 'native' && !parentStaticConfig
|
|
590
|
+
? getReactNativeConfig(Component)
|
|
591
|
+
: undefined
|
|
573
592
|
|
|
574
|
-
const
|
|
575
|
-
reactNativeConfig || config?.isReactNative || parentStaticConfig?.isReactNative
|
|
576
|
-
)
|
|
593
|
+
const resolvedIsReactNative = Boolean(reactNativeConfig || isReactNative)
|
|
577
594
|
|
|
578
595
|
const staticConfigProps = (() => {
|
|
579
596
|
let {
|
|
@@ -647,7 +664,7 @@ function styledImpl<
|
|
|
647
664
|
const acceptsClassName =
|
|
648
665
|
config?.acceptsClassName ??
|
|
649
666
|
(isPlainStyledComponent ||
|
|
650
|
-
|
|
667
|
+
resolvedIsReactNative ||
|
|
651
668
|
(parentStaticConfig?.isHOC && parentStaticConfig?.acceptsClassName))
|
|
652
669
|
|
|
653
670
|
const conf: Partial<StaticConfig> = {
|
|
@@ -661,7 +678,9 @@ function styledImpl<
|
|
|
661
678
|
baseClassName: mergedBaseClassName,
|
|
662
679
|
defaultProps,
|
|
663
680
|
defaultVariants,
|
|
664
|
-
|
|
681
|
+
...(process.env.TAMAGUI_TARGET === 'native' && {
|
|
682
|
+
isReactNative: resolvedIsReactNative,
|
|
683
|
+
}),
|
|
665
684
|
isText,
|
|
666
685
|
acceptsClassName,
|
|
667
686
|
context: mergedContext,
|
|
@@ -673,6 +692,10 @@ function styledImpl<
|
|
|
673
692
|
...(frontend && { styleFrontend: frontend }),
|
|
674
693
|
}
|
|
675
694
|
|
|
695
|
+
if (process.env.TAMAGUI_TARGET !== 'native') {
|
|
696
|
+
delete conf.isReactNative
|
|
697
|
+
}
|
|
698
|
+
|
|
676
699
|
// bail on non className views as well
|
|
677
700
|
if (defaultProps['children'] || !acceptsClassName || mergedContext) {
|
|
678
701
|
conf.neverFlatten = true
|
package/src/types.tsx
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { StyleObject } from '@tamagui/helpers'
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CoreStateModifierName,
|
|
4
|
+
TransformAccumulator,
|
|
5
|
+
} from '@tamagui/style-grammar/runtime'
|
|
3
6
|
import type { Properties } from 'csstype'
|
|
4
7
|
import type {
|
|
5
8
|
CSSProperties,
|
|
6
9
|
ComponentType,
|
|
7
10
|
Context,
|
|
11
|
+
Dispatch,
|
|
8
12
|
FunctionComponent,
|
|
9
13
|
HTMLAttributes,
|
|
10
14
|
ProviderExoticComponent,
|
|
11
15
|
Ref as ReactRef,
|
|
12
16
|
ReactNode,
|
|
13
17
|
RefObject,
|
|
18
|
+
SetStateAction,
|
|
14
19
|
} from 'react'
|
|
15
20
|
import type {
|
|
16
21
|
PressableProps,
|
|
@@ -318,15 +323,14 @@ export type TamaguiComponentPropsBaseBase = {
|
|
|
318
323
|
group?: GroupNames | (string & {}) | boolean
|
|
319
324
|
|
|
320
325
|
/**
|
|
321
|
-
* Marks this component as
|
|
322
|
-
*
|
|
323
|
-
* children measure against. Use the `containerName` / `containerType` style
|
|
324
|
-
* properties for named or full-size containers.
|
|
326
|
+
* Marks this component as an inline-size query container. A string names the
|
|
327
|
+
* container for matching `@sm/name:` clauses.
|
|
325
328
|
*/
|
|
326
|
-
container?: boolean
|
|
329
|
+
container?: boolean | (string & {})
|
|
327
330
|
|
|
328
331
|
/**
|
|
329
|
-
* Works
|
|
332
|
+
* Works alongside container. On native, children using container sizing can
|
|
333
|
+
* be hidden until the parent is measured.
|
|
330
334
|
* See: https://tamagui.dev/docs/intro/props
|
|
331
335
|
*/
|
|
332
336
|
untilMeasured?: 'hide' | 'show'
|
|
@@ -595,7 +599,7 @@ export type TamaguiProjectInfo = {
|
|
|
595
599
|
nameToPaths: NameToPaths
|
|
596
600
|
}
|
|
597
601
|
|
|
598
|
-
// base props
|
|
602
|
+
// base props accepted by createComponent in addition to the selected host's props
|
|
599
603
|
|
|
600
604
|
export type DivAttributes = HTMLAttributes<HTMLDivElement>
|
|
601
605
|
|
|
@@ -608,6 +612,8 @@ export type ComponentSetStateShallow = React.Dispatch<
|
|
|
608
612
|
React.SetStateAction<Partial<TamaguiComponentState>>
|
|
609
613
|
>
|
|
610
614
|
|
|
615
|
+
export type ComponentSetState = Dispatch<SetStateAction<TamaguiComponentState>>
|
|
616
|
+
|
|
611
617
|
export type ComponentContextI = {
|
|
612
618
|
disableSSR?: boolean
|
|
613
619
|
inText: boolean
|
|
@@ -628,6 +634,9 @@ export type TamaguiComponentStateRef = {
|
|
|
628
634
|
willHydrate?: boolean
|
|
629
635
|
hasMeasured?: boolean
|
|
630
636
|
hasAnimated?: boolean
|
|
637
|
+
shouldRegisterPresence?: boolean
|
|
638
|
+
didFinalizeInitialStyleFrame?: boolean
|
|
639
|
+
initialStyleFrameUnmounted?: TamaguiComponentState['unmounted']
|
|
631
640
|
themeShallow?: boolean
|
|
632
641
|
hasEverThemed?: boolean | 'wrapped'
|
|
633
642
|
hasEverResetPresence?: boolean
|
|
@@ -636,6 +645,7 @@ export type TamaguiComponentStateRef = {
|
|
|
636
645
|
isListeningToTheme?: boolean
|
|
637
646
|
unPress?: Function
|
|
638
647
|
setStateShallow?: ComponentSetStateShallow
|
|
648
|
+
setState?: ComponentSetState
|
|
639
649
|
// hoisted base shallow-setter that always calls the real React setState.
|
|
640
650
|
// kept on its own field so the avoidReRenders wrapper (which overwrites
|
|
641
651
|
// `setStateShallow`) can capture this as its real-re-render escape hatch.
|
|
@@ -1286,19 +1296,6 @@ export interface GenericTamaguiSettings {
|
|
|
1286
1296
|
*/
|
|
1287
1297
|
optimizeFor?: 'updates' | 'first-render'
|
|
1288
1298
|
|
|
1289
|
-
/**
|
|
1290
|
-
* On Web, this allows changing the behavior of container groups which by
|
|
1291
|
-
* default uses `container-type: inline-size`.
|
|
1292
|
-
*/
|
|
1293
|
-
webContainerType?:
|
|
1294
|
-
| 'normal'
|
|
1295
|
-
| 'size'
|
|
1296
|
-
| 'inline-size'
|
|
1297
|
-
| 'inherit'
|
|
1298
|
-
| 'initial'
|
|
1299
|
-
| 'revert'
|
|
1300
|
-
| 'revert-layer'
|
|
1301
|
-
|
|
1302
1299
|
/**
|
|
1303
1300
|
* Only allow shorthands when enabled. Recommended to be true to avoid having
|
|
1304
1301
|
* two ways to style the same property.
|
|
@@ -1488,7 +1485,7 @@ export type TamaguiInternalConfig<
|
|
|
1488
1485
|
defaultFontToken: `${string}`
|
|
1489
1486
|
// multi-driver animation config (e.g., { default: motionDriver, css: cssDriver })
|
|
1490
1487
|
// used for component-level driver selection via animatedBy prop
|
|
1491
|
-
animationDrivers?: Record<string,
|
|
1488
|
+
animationDrivers?: Record<string, AnimationDriverLike | null>
|
|
1492
1489
|
}
|
|
1493
1490
|
|
|
1494
1491
|
export type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']
|
|
@@ -1857,7 +1854,7 @@ export type GetTokenFontKeysFor<
|
|
|
1857
1854
|
> = keyof TamaguiConfig['fonts']['body'][A]
|
|
1858
1855
|
|
|
1859
1856
|
export type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>
|
|
1860
|
-
export type FontFamilyTokens =
|
|
1857
|
+
export type FontFamilyTokens = FontTokens
|
|
1861
1858
|
export type FontSize =
|
|
1862
1859
|
| GetTokenString<GetTokenFontKeysFor<'size'>>
|
|
1863
1860
|
| number
|
|
@@ -2954,7 +2951,7 @@ export type GetStyleState = {
|
|
|
2954
2951
|
avoidMergeTransform?: boolean
|
|
2955
2952
|
fontFamily?: string
|
|
2956
2953
|
debug?: DebugProp
|
|
2957
|
-
|
|
2954
|
+
transformAccumulator?: TransformAccumulator
|
|
2958
2955
|
// direct flat-value scan context and its subscription output
|
|
2959
2956
|
flatRulesToInsert?: RulesToInsert
|
|
2960
2957
|
flatShouldDoClasses?: boolean
|
|
@@ -2962,13 +2959,14 @@ export type GetStyleState = {
|
|
|
2962
2959
|
flatMediaState?: Record<string, boolean | undefined>
|
|
2963
2960
|
flatGroupContext?: AllGroupContexts | null
|
|
2964
2961
|
flatConditionOrder?: number
|
|
2965
|
-
flatActiveConditions?: Record<string, true>
|
|
2966
2962
|
flatStateKeys?: Set<string>
|
|
2967
2963
|
flatMediaKeys?: Set<string>
|
|
2968
2964
|
flatGroupKeys?: Set<string>
|
|
2969
2965
|
flatGroupMedia?: Set<string>
|
|
2970
2966
|
flatEnterKeys?: Set<string>
|
|
2971
2967
|
flatExitKeys?: Set<string>
|
|
2968
|
+
flatHasEnterStyle?: boolean
|
|
2969
|
+
flatHasPlatformPseudo?: boolean
|
|
2972
2970
|
flatUsesSafeArea?: boolean
|
|
2973
2971
|
// Track style values that override context props (for issues #3670, #3676)
|
|
2974
2972
|
overriddenContextProps?: Record<string, any>
|
|
@@ -2996,7 +2994,8 @@ export type PropMapper = (
|
|
|
2996
2994
|
value: any,
|
|
2997
2995
|
state: GetStyleState,
|
|
2998
2996
|
disabled: boolean,
|
|
2999
|
-
|
|
2997
|
+
parentCondition?: number,
|
|
2998
|
+
fallbackOriginal?: any
|
|
3000
2999
|
) => void
|
|
3001
3000
|
|
|
3002
3001
|
export type GenericVariantDefinitions = {
|
|
@@ -3076,9 +3075,7 @@ export type StaticConfigPublic = {
|
|
|
3076
3075
|
*/
|
|
3077
3076
|
isZStack?: boolean
|
|
3078
3077
|
|
|
3079
|
-
/**
|
|
3080
|
-
* Auto-detect, but can override, passes styles properly to react-native-web
|
|
3081
|
-
*/
|
|
3078
|
+
/** Native-only marker for components backed by a React Native host. */
|
|
3082
3079
|
isReactNative?: boolean
|
|
3083
3080
|
|
|
3084
3081
|
/**
|
|
@@ -3393,6 +3390,7 @@ export type ResolveVariableAs =
|
|
|
3393
3390
|
export type SplitStyleProps = {
|
|
3394
3391
|
displayName?: string
|
|
3395
3392
|
styledContext?: Record<string, any>
|
|
3393
|
+
styledContextKeys?: Set<string>
|
|
3396
3394
|
mediaState?: Record<string, boolean>
|
|
3397
3395
|
noClass?: boolean
|
|
3398
3396
|
noExpand?: boolean
|
|
@@ -3404,6 +3402,7 @@ export type SplitStyleProps = {
|
|
|
3404
3402
|
hasTextAncestor?: boolean
|
|
3405
3403
|
// for animations
|
|
3406
3404
|
willBeAnimated?: boolean // we need to track media queries even before animation
|
|
3405
|
+
canPlatformPseudo?: boolean
|
|
3407
3406
|
isAnimated: boolean
|
|
3408
3407
|
isExiting?: boolean
|
|
3409
3408
|
}
|
|
@@ -3426,6 +3425,10 @@ type NotPresent = [false, SafeToRemoveCallback, PresenceContextProps]
|
|
|
3426
3425
|
|
|
3427
3426
|
export type UsePresenceResult = AlwaysPresent | Present | NotPresent
|
|
3428
3427
|
|
|
3428
|
+
export type PresenceRegistration = {
|
|
3429
|
+
shouldRegisterPresence?: boolean
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3429
3432
|
// Animations:
|
|
3430
3433
|
|
|
3431
3434
|
type AnimationConfig = {
|
|
@@ -3478,7 +3481,6 @@ export type UseAnimatedNumber<
|
|
|
3478
3481
|
> = (initial: number) => N
|
|
3479
3482
|
|
|
3480
3483
|
type AnimationDriverBase<A extends AnimationConfig = AnimationConfig> = {
|
|
3481
|
-
isReactNative?: boolean
|
|
3482
3484
|
/** What style format the driver expects as input: 'css' (CSS variables) or 'value' (resolved values) */
|
|
3483
3485
|
inputStyle?: 'css' | 'value'
|
|
3484
3486
|
/** How the driver outputs styles: 'css' (className-based) or 'inline' (style object) */
|
|
@@ -3496,7 +3498,7 @@ export type AnimationDriver<A extends AnimationConfig = AnimationConfig> =
|
|
|
3496
3498
|
/** When true, this is a stub driver with no real animation support */
|
|
3497
3499
|
isStub?: boolean
|
|
3498
3500
|
useAnimations: UseAnimationHook
|
|
3499
|
-
usePresence: () => UsePresenceResult
|
|
3501
|
+
usePresence: (registration?: PresenceRegistration) => UsePresenceResult
|
|
3500
3502
|
ResetPresence: (props: {
|
|
3501
3503
|
children?: React.ReactNode
|
|
3502
3504
|
disabled?: boolean
|
|
@@ -3588,6 +3590,14 @@ export type GetStyleResult = {
|
|
|
3588
3590
|
enter?: Set<string>
|
|
3589
3591
|
exit?: Set<string>
|
|
3590
3592
|
}
|
|
3593
|
+
hasEnterStyle?: true
|
|
3594
|
+
platformPseudo?: true
|
|
3595
|
+
// behavior-bearing frontend candidates discovered by the same className
|
|
3596
|
+
// walk as styles. createComponent consumes these before it builds descendant
|
|
3597
|
+
// group/container context; they are never forwarded to the host.
|
|
3598
|
+
frontendGroup?: boolean | string
|
|
3599
|
+
frontendContainer?: boolean | string
|
|
3600
|
+
frontendContainerType?: string
|
|
3591
3601
|
}
|
|
3592
3602
|
|
|
3593
3603
|
export type ClassNamesObject = Record<string, string>
|