@tamagui/web 3.0.0-beta.765.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 +9 -7
- package/dist/cjs/createTamagui.native.cjs +9 -7
- package/dist/cjs/createTamagui.native.js +9 -7
- package/dist/cjs/createTamagui.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 +2 -1
- package/dist/cjs/helpers/insertStyleRule.native.cjs +68 -5
- package/dist/cjs/helpers/insertStyleRule.native.js +68 -5
- 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 +9 -7
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +9 -7
- package/dist/esm/createTamagui.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 +2 -1
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +69 -3
- 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 +10 -9
- 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 +4 -2
- 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 +40 -30
- 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/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 +29 -22
- 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,534 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StyleObjectIdentifier,
|
|
3
|
+
StyleObjectRules,
|
|
4
|
+
type StyleObject,
|
|
5
|
+
} from '@tamagui/helpers'
|
|
6
|
+
import { finalizeTransformAccumulator } from '@tamagui/style-grammar/runtime'
|
|
7
|
+
|
|
8
|
+
import type { GetStyleState } from '../types'
|
|
9
|
+
import {
|
|
10
|
+
buildAtomicSlotCSS,
|
|
11
|
+
probeRawSlotIdentity,
|
|
12
|
+
storeRawSlotIdentity,
|
|
13
|
+
type AtomicSlotEntry,
|
|
14
|
+
} from './getCSSStylesAtomic'
|
|
15
|
+
import { normalizeValueWithProperty } from './normalizeValueWithProperty'
|
|
16
|
+
import { shouldInsertStyleRules, updateRules } from './insertStyleRule'
|
|
17
|
+
import { transformsToString } from './transformsToString'
|
|
18
|
+
|
|
19
|
+
export const canGenerateCSS =
|
|
20
|
+
process.env.TAMAGUI_TARGET === 'web' && !process.env.TAMAGUI_DID_OUTPUT_CSS
|
|
21
|
+
|
|
22
|
+
type DirectAtomicState = GetStyleState & {
|
|
23
|
+
flatAtomics?: Record<string, StyleObject>
|
|
24
|
+
flatBorderDefaultRequests?: AtomicSlotEntry[]
|
|
25
|
+
flatTransitions?: AtomicSlotEntry[]
|
|
26
|
+
/** first streamed entry per property when it carried a condition */
|
|
27
|
+
flatSingleEntries?: Record<string, AtomicSlotEntry>
|
|
28
|
+
/** properties with 2+ contributions: combined at completion, ordered by
|
|
29
|
+
* precedence, restoring the deferred slot the cascade tie-break requires
|
|
30
|
+
* (clauseOrderIndependence pins state-after-media at equal specificity) */
|
|
31
|
+
flatSlots?: Record<string, AtomicSlotEntry[]>
|
|
32
|
+
/** the current value carries clauses: open the combined slot up front */
|
|
33
|
+
flatExpectMulti?: boolean
|
|
34
|
+
/** a platform driver may flip this whole pass inline at completion: defer
|
|
35
|
+
* every contribution into slots so the policy stays choosable */
|
|
36
|
+
flatDeferCSS?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A border width was authored, so its edge needs `borderStyle: solid` unless
|
|
41
|
+
* an authored border style owns the property by completion time. Requests key
|
|
42
|
+
* off the authored (pre-expansion) property, matching the emitted class.
|
|
43
|
+
*/
|
|
44
|
+
export function requestBorderStyleDefault(
|
|
45
|
+
state: GetStyleState,
|
|
46
|
+
property: string,
|
|
47
|
+
condition: number,
|
|
48
|
+
identity: string,
|
|
49
|
+
selector: string,
|
|
50
|
+
wrapperSource: readonly string[] | undefined,
|
|
51
|
+
wrapperStart: number,
|
|
52
|
+
wrapperCount: number
|
|
53
|
+
) {
|
|
54
|
+
if (!canGenerateCSS || !state.flatShouldDoClasses) return
|
|
55
|
+
if (state.styleProps.noNormalize === false) return
|
|
56
|
+
const target = borderStyleDefaults[property]
|
|
57
|
+
if (!target) return
|
|
58
|
+
const requests = ((state as DirectAtomicState).flatBorderDefaultRequests ||= [])
|
|
59
|
+
for (let index = 0; index < requests.length; index++) {
|
|
60
|
+
if (requests[index].property === target && requests[index].identity === identity) {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
let wrappers: string[] | undefined
|
|
65
|
+
if (wrapperSource && wrapperCount) {
|
|
66
|
+
wrappers = new Array(wrapperCount)
|
|
67
|
+
for (let index = 0; index < wrapperCount; index++) {
|
|
68
|
+
wrappers[index] = wrapperSource[wrapperStart + index]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
requests.push({
|
|
72
|
+
property: target,
|
|
73
|
+
value: 'solid',
|
|
74
|
+
condition,
|
|
75
|
+
identity,
|
|
76
|
+
selector,
|
|
77
|
+
wrappers,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function directStyleSignature(
|
|
82
|
+
property: string,
|
|
83
|
+
value: unknown,
|
|
84
|
+
conditionKey = ''
|
|
85
|
+
) {
|
|
86
|
+
return `\u001f${property}\u001f${conditionKey}\u001e${String(value)}`
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const borderStyleDefaults: Record<string, string> = {
|
|
90
|
+
borderWidth: 'borderStyle',
|
|
91
|
+
borderTopWidth: 'borderTopStyle',
|
|
92
|
+
borderRightWidth: 'borderRightStyle',
|
|
93
|
+
borderBottomWidth: 'borderBottomStyle',
|
|
94
|
+
borderLeftWidth: 'borderLeftStyle',
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function registerSlot(
|
|
98
|
+
state: DirectAtomicState,
|
|
99
|
+
atomicKey: string,
|
|
100
|
+
entries: readonly AtomicSlotEntry[]
|
|
101
|
+
) {
|
|
102
|
+
// identity derives from the slot's winning content AFTER normalization and
|
|
103
|
+
// AFTER ordering (base first, conditionals ascending precedence): the same
|
|
104
|
+
// final rules are the same class, whatever order they were contributed in
|
|
105
|
+
const ordered: AtomicSlotEntry[] = []
|
|
106
|
+
for (let index = 0; index < entries.length; index++) {
|
|
107
|
+
const entry = entries[index]
|
|
108
|
+
let value = entry.value
|
|
109
|
+
if (entry.property === 'transform' && Array.isArray(value)) {
|
|
110
|
+
value = transformsToString(value)
|
|
111
|
+
}
|
|
112
|
+
;(entry as AtomicSlotEntry).value = normalizeValueWithProperty(value, entry.property)
|
|
113
|
+
const precedence = entry.condition ? Math.floor(entry.condition / 256) : -1
|
|
114
|
+
let insertAt = ordered.length
|
|
115
|
+
while (insertAt > 0) {
|
|
116
|
+
const before = ordered[insertAt - 1]
|
|
117
|
+
const beforePrecedence = before.condition ? Math.floor(before.condition / 256) : -1
|
|
118
|
+
if (beforePrecedence <= precedence) break
|
|
119
|
+
insertAt--
|
|
120
|
+
}
|
|
121
|
+
ordered.splice(insertAt, 0, entry)
|
|
122
|
+
}
|
|
123
|
+
let signature = ''
|
|
124
|
+
for (let index = 0; index < ordered.length; index++) {
|
|
125
|
+
const entry = ordered[index]
|
|
126
|
+
signature += directStyleSignature(entry.property, entry.value, entry.identity)
|
|
127
|
+
}
|
|
128
|
+
const built = buildAtomicSlotCSS(atomicKey, ordered, signature)
|
|
129
|
+
if (!built) return
|
|
130
|
+
const styleObject = ((built as any).styleObject ||= [
|
|
131
|
+
atomicKey,
|
|
132
|
+
built.value,
|
|
133
|
+
built.identifier,
|
|
134
|
+
undefined,
|
|
135
|
+
built.rules,
|
|
136
|
+
]) as StyleObject
|
|
137
|
+
;(state.flatAtomics ||= {})[atomicKey] = styleObject
|
|
138
|
+
state.classNames[atomicKey] = built.identifier
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// shared scratch for streamed single-contribution slots: buildAtomicSlotCSS
|
|
142
|
+
// reads its entries synchronously and retains only the built identity
|
|
143
|
+
const streamEntry: AtomicSlotEntry = {
|
|
144
|
+
property: '',
|
|
145
|
+
value: '',
|
|
146
|
+
condition: 0,
|
|
147
|
+
identity: '',
|
|
148
|
+
selector: '',
|
|
149
|
+
wrappers: undefined,
|
|
150
|
+
}
|
|
151
|
+
const streamSlot: AtomicSlotEntry[] = [streamEntry]
|
|
152
|
+
|
|
153
|
+
function appendSlotEntry(
|
|
154
|
+
list: AtomicSlotEntry[],
|
|
155
|
+
property: string,
|
|
156
|
+
value: any,
|
|
157
|
+
condition: number,
|
|
158
|
+
identity: string,
|
|
159
|
+
selector: string,
|
|
160
|
+
wrapperSource: readonly string[] | undefined,
|
|
161
|
+
wrapperStart: number,
|
|
162
|
+
wrapperCount: number,
|
|
163
|
+
weak: boolean,
|
|
164
|
+
original?: any
|
|
165
|
+
) {
|
|
166
|
+
for (let index = 0; index < list.length; index++) {
|
|
167
|
+
if (list[index].identity === identity) {
|
|
168
|
+
// a weak write never displaces the identity's existing contribution
|
|
169
|
+
if (weak) return
|
|
170
|
+
list[index].value = value
|
|
171
|
+
list[index].condition = condition
|
|
172
|
+
list[index].original = original
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
let wrappers: string[] | undefined
|
|
177
|
+
if (wrapperSource && wrapperCount) {
|
|
178
|
+
wrappers = new Array(wrapperCount)
|
|
179
|
+
for (let index = 0; index < wrapperCount; index++) {
|
|
180
|
+
wrappers[index] = wrapperSource[wrapperStart + index]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
list.push({ property, value, condition, identity, selector, wrappers, original })
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Stream one CSS contribution. A property's first contribution serializes its
|
|
188
|
+
* class immediately (the overwhelmingly common case pays one cached build and
|
|
189
|
+
* no entry). A second contribution promotes the property to a combined slot,
|
|
190
|
+
* finished at completion by precedence order - the deferred arrangement the
|
|
191
|
+
* equal-specificity cascade tie-break requires (clauseOrderIndependence).
|
|
192
|
+
*/
|
|
193
|
+
export function streamAtomic(
|
|
194
|
+
state: GetStyleState,
|
|
195
|
+
property: string,
|
|
196
|
+
value: any,
|
|
197
|
+
condition: number,
|
|
198
|
+
identity: string,
|
|
199
|
+
selector: string,
|
|
200
|
+
wrapperSource: readonly string[] | undefined,
|
|
201
|
+
wrapperStart: number,
|
|
202
|
+
wrapperCount: number,
|
|
203
|
+
weak: boolean,
|
|
204
|
+
original?: any
|
|
205
|
+
) {
|
|
206
|
+
if (!canGenerateCSS) return
|
|
207
|
+
const direct = state as DirectAtomicState
|
|
208
|
+
|
|
209
|
+
// an existing combined slot absorbs everything for its property
|
|
210
|
+
const slots = direct.flatSlots
|
|
211
|
+
if (slots) {
|
|
212
|
+
const slot = slots[property]
|
|
213
|
+
if (slot) {
|
|
214
|
+
appendSlotEntry(
|
|
215
|
+
slot,
|
|
216
|
+
property,
|
|
217
|
+
value,
|
|
218
|
+
condition,
|
|
219
|
+
identity,
|
|
220
|
+
selector,
|
|
221
|
+
wrapperSource,
|
|
222
|
+
wrapperStart,
|
|
223
|
+
wrapperCount,
|
|
224
|
+
weak,
|
|
225
|
+
original
|
|
226
|
+
)
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const singleEntries = direct.flatSingleEntries
|
|
232
|
+
const singleEntry = singleEntries ? singleEntries[property] : undefined
|
|
233
|
+
const atomics = direct.flatAtomics
|
|
234
|
+
const streamed = atomics ? atomics[property] : undefined
|
|
235
|
+
if (singleEntry) {
|
|
236
|
+
if (singleEntry.identity !== identity) {
|
|
237
|
+
// second distinct contribution: promote the single into a combined slot
|
|
238
|
+
delete singleEntries![property]
|
|
239
|
+
const list = ((direct.flatSlots ||= {})[property] = [singleEntry])
|
|
240
|
+
appendSlotEntry(
|
|
241
|
+
list,
|
|
242
|
+
property,
|
|
243
|
+
value,
|
|
244
|
+
condition,
|
|
245
|
+
identity,
|
|
246
|
+
selector,
|
|
247
|
+
wrapperSource,
|
|
248
|
+
wrapperStart,
|
|
249
|
+
wrapperCount,
|
|
250
|
+
weak,
|
|
251
|
+
original
|
|
252
|
+
)
|
|
253
|
+
return
|
|
254
|
+
}
|
|
255
|
+
// repeat write for the same identity replaces the single in place below
|
|
256
|
+
if (weak) return
|
|
257
|
+
} else if (streamed !== undefined) {
|
|
258
|
+
// a plain single was streamed: its normalized value lives in its own
|
|
259
|
+
// style object, so promotion needs no side record
|
|
260
|
+
if (identity) {
|
|
261
|
+
const list = ((direct.flatSlots ||= {})[property] = [
|
|
262
|
+
{
|
|
263
|
+
property,
|
|
264
|
+
value: (streamed as any)[1],
|
|
265
|
+
condition: 0,
|
|
266
|
+
identity: '',
|
|
267
|
+
selector: '',
|
|
268
|
+
wrappers: undefined,
|
|
269
|
+
},
|
|
270
|
+
])
|
|
271
|
+
appendSlotEntry(
|
|
272
|
+
list,
|
|
273
|
+
property,
|
|
274
|
+
value,
|
|
275
|
+
condition,
|
|
276
|
+
identity,
|
|
277
|
+
selector,
|
|
278
|
+
wrapperSource,
|
|
279
|
+
wrapperStart,
|
|
280
|
+
wrapperCount,
|
|
281
|
+
weak,
|
|
282
|
+
original
|
|
283
|
+
)
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
if (weak) return
|
|
287
|
+
// repeat plain write replaces the single in place below
|
|
288
|
+
} else if (weak && state.classNames[property] !== undefined) {
|
|
289
|
+
// an externally merged class owns the property; the styled-default
|
|
290
|
+
// restore never displaces it
|
|
291
|
+
return
|
|
292
|
+
} else if (direct.flatExpectMulti === true || direct.flatDeferCSS === true) {
|
|
293
|
+
// the value is known to carry more contributions for this property, or a
|
|
294
|
+
// platform driver may flip this pass inline at completion: open the
|
|
295
|
+
// combined slot directly instead of building a single class
|
|
296
|
+
const list: AtomicSlotEntry[] = ((direct.flatSlots ||= {})[property] = [])
|
|
297
|
+
appendSlotEntry(
|
|
298
|
+
list,
|
|
299
|
+
property,
|
|
300
|
+
value,
|
|
301
|
+
condition,
|
|
302
|
+
identity,
|
|
303
|
+
selector,
|
|
304
|
+
wrapperSource,
|
|
305
|
+
wrapperStart,
|
|
306
|
+
wrapperCount,
|
|
307
|
+
weak,
|
|
308
|
+
original
|
|
309
|
+
)
|
|
310
|
+
return
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// repeat authored base values hit the raw memo and skip normalization,
|
|
314
|
+
// signature building, and the identity lookup chain entirely
|
|
315
|
+
if (!identity) {
|
|
316
|
+
const memo = probeRawSlotIdentity(property, value)
|
|
317
|
+
if (memo) {
|
|
318
|
+
const styleObject = ((memo as any).styleObject ||= [
|
|
319
|
+
property,
|
|
320
|
+
memo.value,
|
|
321
|
+
memo.identifier,
|
|
322
|
+
undefined,
|
|
323
|
+
memo.rules,
|
|
324
|
+
]) as StyleObject
|
|
325
|
+
;(direct.flatAtomics ||= {})[property] = styleObject
|
|
326
|
+
state.classNames[property] = memo.identifier
|
|
327
|
+
return
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
const rawValue = value
|
|
331
|
+
if (property === 'transform' && Array.isArray(value)) {
|
|
332
|
+
value = transformsToString(value)
|
|
333
|
+
}
|
|
334
|
+
const normalized = normalizeValueWithProperty(value, property)
|
|
335
|
+
streamEntry.property = property
|
|
336
|
+
streamEntry.value = normalized
|
|
337
|
+
streamEntry.condition = condition
|
|
338
|
+
streamEntry.identity = identity
|
|
339
|
+
streamEntry.selector = selector
|
|
340
|
+
let wrappers: string[] | undefined
|
|
341
|
+
if (wrapperSource && wrapperCount) {
|
|
342
|
+
wrappers = new Array(wrapperCount)
|
|
343
|
+
for (let index = 0; index < wrapperCount; index++) {
|
|
344
|
+
wrappers[index] = wrapperSource[wrapperStart + index]
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
streamEntry.wrappers = wrappers
|
|
348
|
+
const built = buildAtomicSlotCSS(
|
|
349
|
+
property,
|
|
350
|
+
streamSlot,
|
|
351
|
+
directStyleSignature(property, normalized, identity)
|
|
352
|
+
)
|
|
353
|
+
streamEntry.wrappers = undefined
|
|
354
|
+
streamEntry.value = ''
|
|
355
|
+
if (!built) return
|
|
356
|
+
if (!identity) {
|
|
357
|
+
storeRawSlotIdentity(property, rawValue, built)
|
|
358
|
+
}
|
|
359
|
+
if (identity) {
|
|
360
|
+
;(direct.flatSingleEntries ||= {})[property] = {
|
|
361
|
+
property,
|
|
362
|
+
value: normalized,
|
|
363
|
+
condition,
|
|
364
|
+
identity,
|
|
365
|
+
selector,
|
|
366
|
+
wrappers,
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const styleObject = ((built as any).styleObject ||= [
|
|
370
|
+
property,
|
|
371
|
+
built.value,
|
|
372
|
+
built.identifier,
|
|
373
|
+
undefined,
|
|
374
|
+
built.rules,
|
|
375
|
+
]) as StyleObject
|
|
376
|
+
;(direct.flatAtomics ||= {})[property] = styleObject
|
|
377
|
+
state.classNames[property] = built.identifier
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* The CSS residue that genuinely cannot stream: border-style defaults resolve
|
|
382
|
+
* against what the pass authored, promoted multi-contribution slots combine
|
|
383
|
+
* in precedence order, transition longhands group into one record, and the
|
|
384
|
+
* transform accumulator becomes the transform slot's base.
|
|
385
|
+
*/
|
|
386
|
+
export function completeStreamingCSS(state: GetStyleState) {
|
|
387
|
+
if (!canGenerateCSS) return
|
|
388
|
+
const direct = state as DirectAtomicState
|
|
389
|
+
const cssMode = !!state.flatShouldDoClasses
|
|
390
|
+
const singleEntries = direct.flatSingleEntries
|
|
391
|
+
|
|
392
|
+
const requests = direct.flatBorderDefaultRequests
|
|
393
|
+
if (cssMode && requests) {
|
|
394
|
+
direct.flatBorderDefaultRequests = undefined
|
|
395
|
+
for (let index = 0; index < requests.length; index++) {
|
|
396
|
+
const request = requests[index]
|
|
397
|
+
const target = request.property
|
|
398
|
+
const targetSingle = singleEntries ? singleEntries[target] : undefined
|
|
399
|
+
if (targetSingle) {
|
|
400
|
+
if (targetSingle.identity === request.identity) continue
|
|
401
|
+
// promote so the synthetic joins the target's combined slot
|
|
402
|
+
delete singleEntries![target]
|
|
403
|
+
;((direct.flatSlots ||= {})[target] = [targetSingle]).push(request)
|
|
404
|
+
continue
|
|
405
|
+
}
|
|
406
|
+
const slot = direct.flatSlots ? direct.flatSlots[target] : undefined
|
|
407
|
+
if (slot) {
|
|
408
|
+
let covered = false
|
|
409
|
+
for (let t = 0; t < slot.length; t++) {
|
|
410
|
+
if (!slot[t].condition || slot[t].identity === request.identity) {
|
|
411
|
+
covered = true
|
|
412
|
+
break
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (!covered) slot.push(request)
|
|
416
|
+
continue
|
|
417
|
+
}
|
|
418
|
+
// an unconditioned streamed single owns the property outright
|
|
419
|
+
if (direct.flatAtomics && direct.flatAtomics[target] !== undefined) continue
|
|
420
|
+
// nothing authored: an externally merged class still suppresses it
|
|
421
|
+
if (state.classNames[target] !== undefined) continue
|
|
422
|
+
registerSlot(direct, target, [request])
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// the transform accumulator is the transform slot's base contribution
|
|
427
|
+
if (cssMode && state.transformAccumulator) {
|
|
428
|
+
const transform = finalizeTransformAccumulator(state.transformAccumulator)
|
|
429
|
+
state.transformAccumulator = undefined
|
|
430
|
+
const accumulated: AtomicSlotEntry = {
|
|
431
|
+
property: 'transform',
|
|
432
|
+
value: Array.isArray(transform) ? transformsToString(transform) : transform,
|
|
433
|
+
condition: 0,
|
|
434
|
+
identity: '',
|
|
435
|
+
selector: '',
|
|
436
|
+
wrappers: undefined,
|
|
437
|
+
}
|
|
438
|
+
const slot = direct.flatSlots ? direct.flatSlots.transform : undefined
|
|
439
|
+
const transformSingle = singleEntries ? singleEntries.transform : undefined
|
|
440
|
+
if (slot) {
|
|
441
|
+
slot.unshift(accumulated)
|
|
442
|
+
} else if (transformSingle) {
|
|
443
|
+
delete singleEntries!.transform
|
|
444
|
+
;(direct.flatSlots ||= {}).transform = [accumulated, transformSingle]
|
|
445
|
+
} else {
|
|
446
|
+
;(direct.flatSlots ||= {}).transform = [accumulated]
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const slots = direct.flatSlots
|
|
451
|
+
if (slots) {
|
|
452
|
+
direct.flatSlots = undefined
|
|
453
|
+
for (const property in slots) {
|
|
454
|
+
registerSlot(direct, property, slots[property])
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const transitions = direct.flatTransitions
|
|
459
|
+
if (transitions) {
|
|
460
|
+
direct.flatTransitions = undefined
|
|
461
|
+
registerSlot(direct, 'transition', transitions)
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export function flushDirectStyles(state: GetStyleState, clear = false) {
|
|
466
|
+
if (!canGenerateCSS) {
|
|
467
|
+
if (clear) (state as DirectAtomicState).flatAtomics = undefined
|
|
468
|
+
return
|
|
469
|
+
}
|
|
470
|
+
const direct = state as DirectAtomicState
|
|
471
|
+
const atomics = direct.flatAtomics
|
|
472
|
+
if (!atomics) return
|
|
473
|
+
for (const property in atomics) {
|
|
474
|
+
const styleObject = atomics[property]
|
|
475
|
+
const identifier = styleObject[StyleObjectIdentifier]
|
|
476
|
+
if (shouldInsertStyleRules(identifier)) {
|
|
477
|
+
// rulesToInsert owns its array; never expose the cache's copy
|
|
478
|
+
const rules = styleObject[StyleObjectRules].slice()
|
|
479
|
+
styleObject[StyleObjectRules] = rules
|
|
480
|
+
updateRules(identifier, rules)
|
|
481
|
+
state.flatRulesToInsert![identifier] = styleObject
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (clear) direct.flatAtomics = undefined
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const compositionEntry: AtomicSlotEntry = {
|
|
488
|
+
property: '',
|
|
489
|
+
value: '',
|
|
490
|
+
condition: 0,
|
|
491
|
+
identity: '',
|
|
492
|
+
selector: '',
|
|
493
|
+
wrappers: undefined,
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export function addComposition(state: GetStyleState, property: 'translate' | 'scale') {
|
|
497
|
+
if (!canGenerateCSS || state.classNames[property]) return
|
|
498
|
+
const value =
|
|
499
|
+
property === 'translate'
|
|
500
|
+
? 'var(--t-x, 0px) var(--t-y, 0px)'
|
|
501
|
+
: 'var(--t-scale-x, 1) var(--t-scale-y, 1)'
|
|
502
|
+
const defaults =
|
|
503
|
+
property === 'translate' ? '--t-x:0px;--t-y:0px' : '--t-scale-x:1;--t-scale-y:1'
|
|
504
|
+
compositionEntry.property = property
|
|
505
|
+
compositionEntry.value = value
|
|
506
|
+
const built = buildAtomicSlotCSS(
|
|
507
|
+
property,
|
|
508
|
+
[compositionEntry],
|
|
509
|
+
directStyleSignature(property, value, '')
|
|
510
|
+
)
|
|
511
|
+
if (!built) return
|
|
512
|
+
const identifier = built.identifier
|
|
513
|
+
const rules = built.rules.slice()
|
|
514
|
+
rules.unshift(`:where(.${identifier}){${defaults}}`)
|
|
515
|
+
if (shouldInsertStyleRules(identifier)) {
|
|
516
|
+
updateRules(identifier, rules)
|
|
517
|
+
state.flatRulesToInsert![identifier] = [
|
|
518
|
+
property,
|
|
519
|
+
built.value,
|
|
520
|
+
identifier,
|
|
521
|
+
undefined,
|
|
522
|
+
rules,
|
|
523
|
+
] as any
|
|
524
|
+
}
|
|
525
|
+
state.classNames[property] = identifier
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export function clearFrameAtomic(state: GetStyleState, atomicKey: string) {
|
|
529
|
+
const direct = state as DirectAtomicState
|
|
530
|
+
if (direct.flatAtomics) delete direct.flatAtomics[atomicKey]
|
|
531
|
+
if (direct.flatSingleEntries) delete direct.flatSingleEntries[atomicKey]
|
|
532
|
+
if (direct.flatSlots) delete direct.flatSlots[atomicKey]
|
|
533
|
+
if (atomicKey === 'transition') direct.flatTransitions = undefined
|
|
534
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { GetStyleState } from '../types'
|
|
2
|
+
|
|
3
|
+
export const canGenerateCSS = false
|
|
4
|
+
export const directStyleSignature = () => ''
|
|
5
|
+
|
|
6
|
+
export function streamAtomic(
|
|
7
|
+
_state: GetStyleState,
|
|
8
|
+
_property: string,
|
|
9
|
+
_value: any,
|
|
10
|
+
_condition: number,
|
|
11
|
+
_identity: string,
|
|
12
|
+
_selector: string,
|
|
13
|
+
_wrapperSource: readonly string[] | undefined,
|
|
14
|
+
_wrapperStart: number,
|
|
15
|
+
_wrapperCount: number,
|
|
16
|
+
_weak: boolean,
|
|
17
|
+
_original?: any
|
|
18
|
+
) {}
|
|
19
|
+
export function completeStreamingCSS(_state: GetStyleState) {}
|
|
20
|
+
export function requestBorderStyleDefault(
|
|
21
|
+
_state: GetStyleState,
|
|
22
|
+
_property: string,
|
|
23
|
+
_condition: number,
|
|
24
|
+
_identity: string,
|
|
25
|
+
_selector: string,
|
|
26
|
+
_wrapperSource: readonly string[] | undefined,
|
|
27
|
+
_wrapperStart: number,
|
|
28
|
+
_wrapperCount: number
|
|
29
|
+
) {}
|
|
30
|
+
export function flushDirectStyles(_state: GetStyleState, _clear = false) {}
|
|
31
|
+
export function addComposition(_state: GetStyleState, _property: 'translate' | 'scale') {}
|
|
32
|
+
export function clearFrameAtomic(_state: GetStyleState, _atomicKey: string) {}
|