@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
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all) __defProp(target, name, {
|
|
@@ -19,315 +17,768 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
17
|
}
|
|
20
18
|
return to;
|
|
21
19
|
};
|
|
22
|
-
var
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
26
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
22
|
var getSplitStyles_exports = {};
|
|
28
23
|
__export(getSplitStyles_exports, {
|
|
29
24
|
STYLE_TOKEN_PROVENANCE_KEY: () => import_styleProvenance2.STYLE_TOKEN_PROVENANCE_KEY,
|
|
25
|
+
clearDirectStyle: () => clearDirectStyle,
|
|
26
|
+
contributeStyleString: () => contributeStyleString,
|
|
27
|
+
directStyleSignature: () => import_directStyleCSS2.directStyleSignature,
|
|
28
|
+
flushDirectStyles: () => import_directStyleCSS2.flushDirectStyles,
|
|
29
|
+
getContextPropSet: () => getContextPropSet,
|
|
30
|
+
getDirectDynamicThemeAccess: () => getDirectDynamicThemeAccess,
|
|
31
|
+
getFontFamilyFromNameOrVariable: () => getFontFamilyFromNameOrVariable,
|
|
30
32
|
getSplitStyles: () => getSplitStyles,
|
|
31
33
|
getStyleTokenProvenance: () => import_styleProvenance2.getStyleTokenProvenance,
|
|
32
|
-
getSubStyle: () => getSubStyle,
|
|
33
34
|
isValidStyleKey: () => isValidStyleKey,
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
prepareStyleStaticConfig: () => prepareStyleStaticConfig,
|
|
36
|
+
styleOriginalValues: () => import_styleOriginalValues.styleOriginalValues
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(getSplitStyles_exports);
|
|
38
39
|
var import_constants = require("@tamagui/constants");
|
|
39
40
|
var import_helpers = require("@tamagui/helpers");
|
|
40
|
-
var import_react = __toESM(require("react"), 1);
|
|
41
|
-
var import_styleFrontend = require("./styleFrontend.cjs");
|
|
42
41
|
var import_config = require("../config.cjs");
|
|
43
42
|
var import_createVariable = require("../createVariable.cjs");
|
|
44
43
|
var import_isDevTools = require("../constants/isDevTools.cjs");
|
|
45
44
|
var import_mediaState = require("./mediaState.cjs");
|
|
45
|
+
var import_types = require("../types.cjs");
|
|
46
46
|
var import_runtime = require("@tamagui/style-grammar/runtime");
|
|
47
|
+
var import_mediaState2 = require("./mediaState.cjs");
|
|
48
|
+
var import_warnOnce = require("./warnOnce.cjs");
|
|
49
|
+
var import_expandStyle = require("./expandStyle.cjs");
|
|
47
50
|
var import_expandStyles = require("./expandStyles.cjs");
|
|
48
|
-
var
|
|
51
|
+
var import_styleToCSS = require("./styleToCSS.cjs");
|
|
52
|
+
var import_directStyleCSS = require("./directStyleCSS.cjs");
|
|
53
|
+
var import_directStyleCSS2 = require("./directStyleCSS.cjs");
|
|
54
|
+
var import_grammarConfig = require("./grammarConfig.cjs");
|
|
55
|
+
require("./getDynamicVal.cjs");
|
|
49
56
|
var import_getDefaultProps = require("./getDefaultProps.cjs");
|
|
50
|
-
|
|
57
|
+
require("./insertStyleRule.cjs");
|
|
51
58
|
var import_isObj = require("./isObj.cjs");
|
|
59
|
+
var import_isObj2 = require("./isObj.cjs");
|
|
52
60
|
var import_log = require("./log.cjs");
|
|
61
|
+
var import_normalizeStyle = require("./normalizeStyle.cjs");
|
|
62
|
+
var import_normalizeColor = require("./normalizeColor.cjs");
|
|
53
63
|
var import_normalizeValueWithProperty = require("./normalizeValueWithProperty.cjs");
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
64
|
+
require("./parseNativeStyle.native.cjs");
|
|
65
|
+
require("./parseNativeTransform.native.cjs");
|
|
66
|
+
var import_getVariantExtras = require("./getVariantExtras.cjs");
|
|
67
|
+
var import_resolveRem = require("./resolveRem.cjs");
|
|
68
|
+
var import_resolveSafeArea = require("./resolveSafeArea.cjs");
|
|
69
|
+
var import_resolveSafeAreaVariable = require("./resolveSafeAreaVariable.cjs");
|
|
70
|
+
var import_resolveVariableValue = require("./resolveVariableValue.cjs");
|
|
71
|
+
var import_themeRef = require("./themeRef.cjs");
|
|
72
|
+
var import_tokenCategories = require("./tokenCategories.cjs");
|
|
57
73
|
var import_skipProps = require("./skipProps.cjs");
|
|
58
|
-
var import_sortString = require("./sortString.cjs");
|
|
59
74
|
var import_styleOriginalValues = require("./styleOriginalValues.cjs");
|
|
60
75
|
var import_styleProvenance = require("./styleProvenance.cjs");
|
|
61
76
|
var import_transformsToString = require("./transformsToString.cjs");
|
|
62
77
|
var import_styleProvenance2 = require("./styleProvenance.cjs");
|
|
78
|
+
__reExport(getSplitStyles_exports, require("./tokenCategories.cjs"), module.exports);
|
|
79
|
+
const TAMAGUI_CLASS_PROPS = "$$tamaguiClassProps";
|
|
63
80
|
const shouldTrackStyleTokenProvenance = process.env.NODE_ENV === "development" && process.env.TAMAGUI_ENABLE_STYLE_TOKEN_PROVENANCE === "1";
|
|
64
|
-
const validComponentClassName = /^[A-Za-z_][A-Za-z0-9_-]*$/;
|
|
65
81
|
function compoundMatcherMatches(expected, actual) {
|
|
66
|
-
if (Array.isArray(expected))
|
|
67
|
-
|
|
82
|
+
if (Array.isArray(expected)) {
|
|
83
|
+
for (let index = 0; index < expected.length; index++) if (expected[index] === actual) return true;
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return expected === actual;
|
|
68
87
|
}
|
|
69
|
-
function compoundMatcherMatchesPayload(expected,
|
|
70
|
-
if (Array.isArray(expected))
|
|
71
|
-
|
|
88
|
+
function compoundMatcherMatchesPayload(expected, source, start, end) {
|
|
89
|
+
if (Array.isArray(expected)) {
|
|
90
|
+
for (let index = 0; index < expected.length; index++) if (compoundMatcherMatchesPayload(expected[index], source, start, end)) return true;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const expectedValue = typeof expected === "string" ? expected : String(expected);
|
|
94
|
+
if (expectedValue.length !== end - start) return false;
|
|
95
|
+
for (let index = 0; index < expectedValue.length; index++) if (expectedValue.charCodeAt(index) !== source.charCodeAt(start + index)) return false;
|
|
96
|
+
return true;
|
|
72
97
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
const preparedCompoundsKey = /* @__PURE__ */ Symbol();
|
|
99
|
+
function prepareStaticConfigCompounds(staticConfig) {
|
|
100
|
+
const compoundVariants = staticConfig.compoundVariants;
|
|
101
|
+
const preparedConfig = staticConfig;
|
|
102
|
+
if (!compoundVariants?.length) {
|
|
103
|
+
preparedConfig[preparedCompoundsKey] = null;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const selectorCounts = [];
|
|
107
|
+
const indexesByKey = /* @__PURE__ */ Object.create(null);
|
|
108
|
+
indexesByKey[preparedCompoundsKey] = selectorCounts;
|
|
109
|
+
for (let index = 0; index < compoundVariants.length; index++) {
|
|
110
|
+
const compoundVariant = compoundVariants[index];
|
|
111
|
+
let selectorCount = 0;
|
|
112
|
+
for (const key in compoundVariant) {
|
|
113
|
+
if (key === "style") continue;
|
|
114
|
+
selectorCount++;
|
|
115
|
+
(indexesByKey[key] ||= []).push(index);
|
|
116
|
+
}
|
|
117
|
+
selectorCounts[index] = selectorCount;
|
|
118
|
+
}
|
|
119
|
+
preparedConfig[preparedCompoundsKey] = indexesByKey;
|
|
120
|
+
}
|
|
121
|
+
const conditionWidth = 4;
|
|
122
|
+
const conditionValueOffset = 0;
|
|
123
|
+
const conditionFlagsOffset = 1;
|
|
124
|
+
const conditionPrecedenceOffset = 2;
|
|
125
|
+
const conditionWrapperOffset = 3;
|
|
126
|
+
const conditionActiveFlag = 1;
|
|
127
|
+
const conditionEmitFlag = 2;
|
|
128
|
+
const conditionResolvedFlag = 4;
|
|
129
|
+
const conditionEnterFlag = 8;
|
|
130
|
+
const conditionExitFlag = 16;
|
|
131
|
+
const conditionPlatformPseudoFlag = 32;
|
|
132
|
+
const conditionInitialFlags = conditionEmitFlag | 5;
|
|
133
|
+
const conditionTextWidth = 5;
|
|
134
|
+
const conditionKeyOffset = 0;
|
|
135
|
+
const conditionSelectorOffset = 1;
|
|
136
|
+
const conditionThemeOffset = 2;
|
|
137
|
+
const conditionUnsupportedStateOffset = 3;
|
|
138
|
+
const conditionUnresolvedNameOffset = 4;
|
|
139
|
+
let conditionNumbers = new Float64Array(2048);
|
|
140
|
+
const conditionTexts = [];
|
|
141
|
+
const conditionWrappers = [];
|
|
142
|
+
let conditionWrapperTop = 0;
|
|
143
|
+
let conditionCursorTop = conditionWidth;
|
|
144
|
+
function reserveConditionCursor(cursor) {
|
|
145
|
+
const required = cursor + conditionWidth;
|
|
146
|
+
if (required > conditionTexts.length) {
|
|
147
|
+
const previous2 = conditionTexts.length;
|
|
148
|
+
conditionTexts.length = required;
|
|
149
|
+
conditionTexts.fill("", previous2);
|
|
150
|
+
}
|
|
151
|
+
if (required <= conditionNumbers.length) return;
|
|
152
|
+
let length = conditionNumbers.length * 2;
|
|
153
|
+
while (length < required) length *= 2;
|
|
154
|
+
const previous = conditionNumbers;
|
|
155
|
+
conditionNumbers = new Float64Array(length);
|
|
156
|
+
conditionNumbers.set(previous);
|
|
157
|
+
}
|
|
158
|
+
function conditionWrapperCopy(cursor) {
|
|
159
|
+
const wrapper = conditionNumbers[cursor + conditionWrapperOffset];
|
|
160
|
+
const count = wrapper & 7;
|
|
161
|
+
if (!count) return void 0;
|
|
162
|
+
const start = wrapper >> 3;
|
|
163
|
+
const wrappers = new Array(count);
|
|
164
|
+
for (let index = 0; index < count; index++) wrappers[index] = conditionWrappers[start + index];
|
|
165
|
+
return wrappers;
|
|
166
|
+
}
|
|
167
|
+
function setConditionUnresolved(cursor, name = "") {
|
|
168
|
+
conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionResolvedFlag;
|
|
169
|
+
if (name) {
|
|
170
|
+
const text = cursor + conditionUnresolvedNameOffset;
|
|
171
|
+
conditionTexts[text] ||= name;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function appendConditionWrapper(cursor, wrapper) {
|
|
175
|
+
conditionWrappers[conditionWrapperTop++] = wrapper;
|
|
176
|
+
conditionNumbers[cursor + conditionWrapperOffset]++;
|
|
177
|
+
}
|
|
178
|
+
function copyConditionCursor(target, source) {
|
|
179
|
+
for (let offset = 0; offset <= conditionPrecedenceOffset; offset++) conditionNumbers[target + offset] = conditionNumbers[source + offset];
|
|
180
|
+
for (let offset = 0; offset < conditionTextWidth; offset++) conditionTexts[target + offset] = conditionTexts[source + offset] || "";
|
|
181
|
+
const wrapper = conditionNumbers[source + conditionWrapperOffset];
|
|
182
|
+
const wrapperStart = wrapper >> 3;
|
|
183
|
+
const wrapperCount = wrapper & 7;
|
|
184
|
+
for (let index = 0; index < wrapperCount; index++) conditionWrappers[conditionWrapperTop++] = conditionWrappers[wrapperStart + index];
|
|
185
|
+
conditionNumbers[target + conditionWrapperOffset] += wrapperCount;
|
|
186
|
+
}
|
|
187
|
+
function resetConditionCursor(cursor, parent) {
|
|
188
|
+
conditionNumbers[cursor + conditionValueOffset] = 0;
|
|
189
|
+
conditionNumbers[cursor + conditionFlagsOffset] = conditionInitialFlags;
|
|
190
|
+
conditionNumbers[cursor + conditionPrecedenceOffset] = 0;
|
|
191
|
+
conditionNumbers[cursor + conditionWrapperOffset] = conditionWrapperTop << 3;
|
|
192
|
+
conditionTexts.fill("", cursor, cursor + conditionTextWidth);
|
|
193
|
+
if (parent) copyConditionCursor(cursor, parent);
|
|
194
|
+
}
|
|
195
|
+
function acquireConditionCursor(parent = 0) {
|
|
196
|
+
const cursor = conditionCursorTop;
|
|
197
|
+
conditionCursorTop += conditionWidth;
|
|
198
|
+
reserveConditionCursor(cursor);
|
|
199
|
+
resetConditionCursor(cursor, parent);
|
|
200
|
+
return cursor;
|
|
201
|
+
}
|
|
202
|
+
function releaseConditionCursors(watermark) {
|
|
203
|
+
if (watermark >= conditionCursorTop) return;
|
|
204
|
+
conditionTexts.fill("", watermark, conditionCursorTop);
|
|
205
|
+
conditionCursorTop = watermark;
|
|
206
|
+
}
|
|
207
|
+
function releaseConditionPayloads(wrapperBase) {
|
|
208
|
+
conditionWrappers.fill("", wrapperBase, conditionWrapperTop);
|
|
209
|
+
conditionWrapperTop = wrapperBase;
|
|
210
|
+
}
|
|
211
|
+
function accumulateConditionAtom(state, cursor, kind, rank, name) {
|
|
212
|
+
const keySlot = cursor + conditionKeyOffset;
|
|
213
|
+
const key = conditionTexts[keySlot];
|
|
214
|
+
if (!key) conditionTexts[keySlot] = name;
|
|
215
|
+
else {
|
|
216
|
+
let slotStart = 0;
|
|
217
|
+
let inserted = false;
|
|
218
|
+
while (slotStart <= key.length) {
|
|
219
|
+
let slotEnd = key.indexOf(":", slotStart);
|
|
220
|
+
if (slotEnd === -1) slotEnd = key.length;
|
|
221
|
+
let order = 0;
|
|
222
|
+
const compareLength = Math.min(name.length, slotEnd - slotStart);
|
|
223
|
+
for (let offset = 0; offset < compareLength; offset++) {
|
|
224
|
+
order = name.charCodeAt(offset) - key.charCodeAt(slotStart + offset);
|
|
225
|
+
if (order) break;
|
|
226
|
+
}
|
|
227
|
+
order ||= name.length - (slotEnd - slotStart);
|
|
228
|
+
if (!order) return;
|
|
229
|
+
if (order < 0) {
|
|
230
|
+
conditionTexts[keySlot] = `${key.slice(0, slotStart)}${name}:${key.slice(slotStart)}`;
|
|
231
|
+
inserted = true;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
if (slotEnd === key.length) break;
|
|
235
|
+
slotStart = slotEnd + 1;
|
|
236
|
+
}
|
|
237
|
+
if (!inserted) conditionTexts[keySlot] = `${key}:${name}`;
|
|
238
|
+
}
|
|
239
|
+
if (kind === import_runtime.modifierKindPlatform) {
|
|
240
|
+
const precedence2 = conditionNumbers[cursor + conditionPrecedenceOffset];
|
|
241
|
+
if (rank > precedence2 >>> 26) conditionNumbers[cursor + conditionPrecedenceOffset] = precedence2 & 67108863 | rank << 26;
|
|
242
|
+
if (!(0, import_constants.platformMatches)(name)) conditionNumbers[cursor + conditionFlagsOffset] &= ~(conditionActiveFlag | conditionEmitFlag);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
let precedence = conditionNumbers[cursor + conditionPrecedenceOffset];
|
|
246
|
+
const depth = Math.min((precedence >> 23 & 7) + 1, 7);
|
|
247
|
+
const nextCategory = kind === import_runtime.modifierKindMedia ? 0 : kind === 6 ? 1 : kind === import_runtime.modifierKindTheme ? 2 : kind === 5 ? 3 : 4;
|
|
248
|
+
let categoryRank = precedence >> 20 & 7;
|
|
249
|
+
let withinRank = precedence & 1048575;
|
|
250
|
+
if (nextCategory > categoryRank) {
|
|
251
|
+
categoryRank = nextCategory;
|
|
252
|
+
withinRank = rank;
|
|
253
|
+
} else if (nextCategory === categoryRank && rank > withinRank) withinRank = rank;
|
|
254
|
+
precedence = precedence & -67108864 | depth << 23 | categoryRank << 20 | withinRank;
|
|
255
|
+
conditionNumbers[cursor + conditionPrecedenceOffset] = precedence;
|
|
256
|
+
const buildCSS = import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses;
|
|
257
|
+
if (kind === import_runtime.modifierKindMedia) {
|
|
258
|
+
const query = (0, import_grammarConfig.getConfigRevisionState)(state.conf).mediaQueries[name];
|
|
259
|
+
if (!query) {
|
|
260
|
+
setConditionUnresolved(cursor, name);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (buildCSS) appendConditionWrapper(cursor, `@media ${query}`);
|
|
264
|
+
if (!state.flatMediaState?.[name]) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
|
|
265
|
+
(state.flatMediaKeys ||= /* @__PURE__ */ new Set()).add(name);
|
|
266
|
+
} else if (kind === import_runtime.modifierKindTheme) {
|
|
267
|
+
conditionTexts[cursor + conditionThemeOffset] = name;
|
|
268
|
+
if (buildCSS) {
|
|
269
|
+
const selector = cursor + conditionSelectorOffset;
|
|
270
|
+
conditionTexts[selector] += `:where(.t_${name}, .t_${name} *)`;
|
|
271
|
+
}
|
|
272
|
+
if (state.flatThemeName !== name && state.flatThemeName?.startsWith(`${name}_`) !== true) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
|
|
273
|
+
} else if (kind === 5) {
|
|
274
|
+
const slash = name.indexOf("/");
|
|
275
|
+
const groupName = slash === -1 ? "true" : name.slice(slash + 1);
|
|
276
|
+
const stateSelector = import_runtime.stateModifierSelectors[rank];
|
|
277
|
+
const conditionStateName = import_runtime.canonicalStateModifierNames[rank];
|
|
278
|
+
if (buildCSS) {
|
|
279
|
+
const selector = cursor + conditionSelectorOffset;
|
|
280
|
+
conditionTexts[selector] += `:where(.t_group_${groupName}${stateSelector} *)`;
|
|
281
|
+
if (rank === 0) appendConditionWrapper(cursor, "@media (hover: hover)");
|
|
282
|
+
}
|
|
283
|
+
const component = state.componentState.group?.[groupName];
|
|
284
|
+
const context = state.flatGroupContext?.[groupName];
|
|
285
|
+
if (!(component?.pseudo ?? context?.state.pseudo)?.[conditionStateName]) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
|
|
286
|
+
(state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupName);
|
|
287
|
+
} else if (kind === 6) {
|
|
288
|
+
const slash = name.indexOf("/");
|
|
289
|
+
const containerSize = name.slice(1, slash === -1 ? name.length : slash);
|
|
290
|
+
const containerName = slash === -1 ? "" : name.slice(slash + 1);
|
|
291
|
+
const containerQuery = (0, import_grammarConfig.getConfigRevisionState)(state.conf).mediaQueries[containerSize];
|
|
292
|
+
const groupKey = `@${containerName}`;
|
|
293
|
+
if (buildCSS) appendConditionWrapper(cursor, containerName ? `@container ${containerName} ${containerQuery}` : `@container ${containerQuery}`);
|
|
294
|
+
const component = state.componentState.group?.[groupKey];
|
|
295
|
+
const context = state.flatGroupContext?.[groupKey];
|
|
296
|
+
if (process.env.NODE_ENV === "development" && containerName && !component && !context && state.flatGroupContext?.[containerName]) (0, import_warnOnce.warnOnce)(`group-container:${containerName}`, `@${containerSize}/${containerName}: targets group="${containerName}", but groups no longer establish query containers. Add container="${containerName}" to that group.`);
|
|
297
|
+
const match = component?.media?.[containerSize];
|
|
298
|
+
if (!(match === void 0 ? context?.state.layout && (0, import_mediaState2.mediaKeyMatch)(containerSize, context.state.layout) : match)) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
|
|
299
|
+
(state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupKey);
|
|
300
|
+
(state.flatGroupMedia ||= /* @__PURE__ */ new Set()).add(containerSize);
|
|
301
|
+
} else {
|
|
302
|
+
const stateSelector = import_runtime.stateModifierSelectors[rank];
|
|
303
|
+
conditionNumbers[cursor + conditionFlagsOffset] += 64;
|
|
304
|
+
if (rank === 6) conditionNumbers[cursor + conditionFlagsOffset] |= conditionEnterFlag;
|
|
305
|
+
else if (rank === 7) conditionNumbers[cursor + conditionFlagsOffset] |= conditionExitFlag;
|
|
306
|
+
else if (rank === 0 || rank === 2 || rank === 4) conditionNumbers[cursor + conditionFlagsOffset] |= conditionPlatformPseudoFlag;
|
|
307
|
+
if (buildCSS) {
|
|
308
|
+
const selector = cursor + conditionSelectorOffset;
|
|
309
|
+
if (stateSelector[0] === ".") conditionTexts[selector] += `:is(${stateSelector}, ${stateSelector} *)`;
|
|
310
|
+
else conditionTexts[selector] += stateSelector;
|
|
311
|
+
if (rank === 0) appendConditionWrapper(cursor, "@media (hover: hover)");
|
|
312
|
+
}
|
|
313
|
+
const component = state.componentState;
|
|
314
|
+
if (!(rank === 0 ? !!component.hover : rank === 4 ? !!(component.press || component.pressIn) : rank === 2 ? !!component.focus : rank === 3 ? !!component.focusVisible : rank === 1 ? !!component.focusWithin : rank === 5 ? !!(component.disabled || state.props.disabled) : rank === 6 ? !!component.unmounted : rank === 7 ? !!state.styleProps.isExiting : false)) conditionNumbers[cursor + conditionFlagsOffset] &= ~conditionActiveFlag;
|
|
315
|
+
if (stateSelector[0] === ":") (state.flatStateKeys ||= /* @__PURE__ */ new Set()).add(name);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function resolveConditionModifier(state, cursor, modifier) {
|
|
319
|
+
const compiled = (0, import_grammarConfig.getConfigRevisionState)(state.conf);
|
|
320
|
+
let code = compiled.modifiers[modifier];
|
|
321
|
+
let kind = code & 7;
|
|
322
|
+
let rank = code >> 3;
|
|
323
|
+
if (kind === import_runtime.modifierKindState) {
|
|
324
|
+
accumulateConditionAtom(state, cursor, kind, rank, import_runtime.canonicalStateModifierNames[rank]);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (!kind && modifier.startsWith("group-")) {
|
|
328
|
+
const slash = modifier.indexOf("/");
|
|
329
|
+
const authoredState = modifier.slice(6, slash === -1 ? void 0 : slash);
|
|
330
|
+
code = compiled.modifiers[authoredState];
|
|
331
|
+
if ((code & 7) === import_runtime.modifierKindState) {
|
|
332
|
+
rank = code >> 3;
|
|
333
|
+
const groupName = slash === -1 ? "true" : modifier.slice(slash + 1);
|
|
334
|
+
if (rank !== 6 && rank !== 7 && (slash === -1 || (0, import_runtime.isModifierName)(groupName, 0, groupName.length))) {
|
|
335
|
+
const stateName = import_runtime.canonicalStateModifierNames[rank];
|
|
336
|
+
accumulateConditionAtom(state, cursor, 5, rank, `group-${stateName}${slash === -1 ? "" : modifier.slice(slash)}`);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} else if (!kind && modifier.charCodeAt(0) === 64) {
|
|
341
|
+
const slash = modifier.indexOf("/");
|
|
342
|
+
const containerSize = modifier.slice(1, slash === -1 ? void 0 : slash);
|
|
343
|
+
const containerName = slash === -1 ? "" : modifier.slice(slash + 1);
|
|
344
|
+
let containerQuery = "";
|
|
345
|
+
if ((0, import_runtime.isModifierName)(containerSize, 0, containerSize.length) && (slash === -1 || (0, import_runtime.isModifierName)(containerName, 0, containerName.length)) && ((code = compiled.modifiers[containerSize]) & 7) === import_runtime.modifierKindMedia && (containerQuery = compiled.mediaQueries[containerSize]) && (0, import_runtime.isContainerSizeQueryText)(containerQuery)) {
|
|
346
|
+
accumulateConditionAtom(state, cursor, 6, code >> 3, modifier);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
} else if (kind) {
|
|
350
|
+
accumulateConditionAtom(state, cursor, kind, rank, modifier);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
setConditionUnresolved(cursor, modifier);
|
|
354
|
+
}
|
|
355
|
+
function resolveConditionText(state, cursor, text) {
|
|
356
|
+
let start = 0;
|
|
357
|
+
for (let index = 0; index <= text.length; index++) {
|
|
358
|
+
if (index !== text.length && text.charCodeAt(index) !== 58) continue;
|
|
359
|
+
if (index === start) {
|
|
360
|
+
setConditionUnresolved(cursor);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) return;
|
|
364
|
+
resolveConditionModifier(state, cursor, text.slice(start, index));
|
|
365
|
+
start = index + 1;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function commitConditionCursor(state, cursor) {
|
|
369
|
+
if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
|
|
370
|
+
conditionNumbers[cursor + conditionValueOffset] = 0;
|
|
371
|
+
return 0;
|
|
372
|
+
}
|
|
373
|
+
const key = conditionTexts[cursor + conditionKeyOffset] || "";
|
|
374
|
+
const precedence = conditionNumbers[cursor + conditionPrecedenceOffset];
|
|
375
|
+
const depth = precedence >> 23 & 7;
|
|
376
|
+
if (depth > 5) throw new Error(`a flat value clause supports at most 5 non-platform conditions; received ${depth} in "${key}:"`);
|
|
377
|
+
const flags = conditionNumbers[cursor + conditionFlagsOffset];
|
|
378
|
+
const condition = precedence * 256 + (flags >> 6) * 32 + 16 + (flags & conditionActiveFlag ? 1 : 0) + (flags & conditionEmitFlag ? 2 : 0) + (flags & conditionEnterFlag ? 4 : 0) + (flags & conditionExitFlag ? 8 : 0);
|
|
379
|
+
conditionNumbers[cursor + conditionValueOffset] = condition;
|
|
380
|
+
return condition;
|
|
381
|
+
}
|
|
382
|
+
function acquireConditionKeyCursor(state, key) {
|
|
383
|
+
const cursor = acquireConditionCursor();
|
|
384
|
+
if (key) {
|
|
385
|
+
resolveConditionText(state, cursor, key);
|
|
386
|
+
commitConditionCursor(state, cursor);
|
|
387
|
+
}
|
|
388
|
+
return cursor;
|
|
389
|
+
}
|
|
390
|
+
function combineConditionKeys(state, first, second) {
|
|
391
|
+
if (!first) return second;
|
|
392
|
+
if (!second || first === second) return first;
|
|
393
|
+
const watermark = conditionCursorTop;
|
|
394
|
+
const target = acquireConditionKeyCursor(state, first);
|
|
395
|
+
resolveConditionText(state, target, second);
|
|
396
|
+
commitConditionCursor(state, target);
|
|
397
|
+
const key = conditionTexts[target + conditionKeyOffset] || "";
|
|
398
|
+
releaseConditionCursors(watermark);
|
|
399
|
+
return key;
|
|
400
|
+
}
|
|
401
|
+
function freshCompoundState() {
|
|
402
|
+
return {
|
|
403
|
+
seen: 0,
|
|
404
|
+
failed: false,
|
|
405
|
+
matchedBase: false,
|
|
406
|
+
scanned: false,
|
|
407
|
+
pending: null,
|
|
408
|
+
combinations: null
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function beginCompoundEdges(indexes, states) {
|
|
412
|
+
if (!indexes) return;
|
|
413
|
+
for (let index = 0; index < indexes.length; index++) {
|
|
414
|
+
const state = states[indexes[index]] ||= freshCompoundState();
|
|
415
|
+
state.pending = null;
|
|
416
|
+
state.matchedBase = false;
|
|
417
|
+
state.scanned = false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function feedCompoundSegment(state, source, start, end, isBase, valid, conditionKey) {
|
|
421
|
+
if (state.flatCompoundOutputDepth) return;
|
|
422
|
+
const pass = state.flatPass;
|
|
423
|
+
const indexes = pass[passCompoundIndexes];
|
|
424
|
+
const states = pass[passCompoundStates];
|
|
425
|
+
const key = pass[passCompoundKey];
|
|
426
|
+
if (!indexes || !states || !key) return;
|
|
427
|
+
const compoundVariants = state.staticConfig.compoundVariants;
|
|
428
|
+
for (let index = 0; index < indexes.length; index++) {
|
|
429
|
+
const compoundIndex = indexes[index];
|
|
430
|
+
const compoundState = states[compoundIndex] ||= freshCompoundState();
|
|
431
|
+
compoundState.scanned = true;
|
|
432
|
+
if (!valid || start === end || !compoundMatcherMatchesPayload(compoundVariants[compoundIndex][key], source, start, end)) continue;
|
|
433
|
+
if (isBase) compoundState.matchedBase = true;
|
|
434
|
+
else if (!compoundState.matchedBase) (compoundState.pending ||= []).push(conditionKey);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const compoundOnlyHandler = {
|
|
438
|
+
segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
|
|
77
439
|
if (isBase) {
|
|
78
|
-
|
|
440
|
+
feedCompoundSegment(state, source, start, end, true, valid, "");
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const cursor = state.flatScanCursor;
|
|
444
|
+
if (!chainValid || !cursor || !(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) || !conditionNumbers[cursor + conditionValueOffset]) {
|
|
445
|
+
feedCompoundSegment(state, source, start, end, false, false, "");
|
|
79
446
|
return;
|
|
80
447
|
}
|
|
81
|
-
|
|
82
|
-
const chain = source.slice(chainStart, chainEnd);
|
|
83
|
-
if (ctx[2](chain)) ctx[3].push(chain);
|
|
448
|
+
feedCompoundSegment(state, source, start, end, false, valid, conditionTexts[cursor + conditionKeyOffset] || "");
|
|
84
449
|
},
|
|
85
|
-
|
|
86
|
-
|
|
450
|
+
modifier(state, start, end, valid, first, source) {
|
|
451
|
+
let cursor = state.flatScanCursor;
|
|
452
|
+
if (!cursor) cursor = state.flatScanCursor = acquireConditionCursor();
|
|
453
|
+
else if (first) resetConditionCursor(cursor, 0);
|
|
454
|
+
if (!valid) {
|
|
455
|
+
setConditionUnresolved(cursor);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(state, cursor, source.slice(start, end));
|
|
87
459
|
},
|
|
88
|
-
|
|
460
|
+
chain(state, _start, _end, valid) {
|
|
461
|
+
const cursor = state.flatScanCursor;
|
|
462
|
+
if (cursor) {
|
|
463
|
+
if (!valid) setConditionUnresolved(cursor);
|
|
464
|
+
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(state, cursor);
|
|
465
|
+
}
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
89
468
|
};
|
|
90
|
-
function
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
469
|
+
function finishCompoundEdges(pass, key, value, indexes, states) {
|
|
470
|
+
if (!indexes) return;
|
|
471
|
+
const state = pass[passStyleState];
|
|
472
|
+
pass[passCompoundIndexes] = indexes;
|
|
473
|
+
pass[passCompoundKey] = key;
|
|
474
|
+
pass[passCompoundStates] = states;
|
|
475
|
+
let needsScan = false;
|
|
476
|
+
for (let index = 0; index < indexes.length; index++) if (!(states[indexes[index]] ||= freshCompoundState()).scanned) {
|
|
477
|
+
needsScan = true;
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
if (needsScan) if (typeof value === "string") {
|
|
481
|
+
const watermark = conditionCursorTop;
|
|
482
|
+
const previousCursor = state.flatScanCursor;
|
|
483
|
+
state.flatScanCursor = null;
|
|
484
|
+
try {
|
|
485
|
+
(0, import_runtime.scanFlatValue)(value, compoundOnlyHandler, state);
|
|
486
|
+
} finally {
|
|
487
|
+
state.flatScanCursor = previousCursor;
|
|
488
|
+
releaseConditionCursors(watermark);
|
|
108
489
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
490
|
+
} else if (value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value) && Object.prototype.hasOwnProperty.call(value, "default")) for (const conditionKey in value) {
|
|
491
|
+
const payload = value[conditionKey];
|
|
492
|
+
if (conditionKey === "default") {
|
|
493
|
+
const payloadString = String(payload);
|
|
494
|
+
feedCompoundSegment(state, payloadString, 0, payloadString.length, true, true, "");
|
|
495
|
+
} else {
|
|
496
|
+
const watermark = conditionCursorTop;
|
|
497
|
+
const cursor = acquireConditionCursor();
|
|
498
|
+
resolveConditionText(state, cursor, conditionKey);
|
|
499
|
+
const condition = commitConditionCursor(state, cursor);
|
|
500
|
+
const payloadString = String(payload);
|
|
501
|
+
feedCompoundSegment(state, payloadString, 0, payloadString.length, false, Boolean(condition), condition ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
502
|
+
releaseConditionCursors(watermark);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
const variants2 = state.staticConfig.compoundVariants;
|
|
507
|
+
for (let index = 0; index < indexes.length; index++) {
|
|
508
|
+
const compoundIndex = indexes[index];
|
|
509
|
+
const compoundState = states[compoundIndex] ||= freshCompoundState();
|
|
510
|
+
compoundState.scanned = true;
|
|
511
|
+
if (compoundMatcherMatches(variants2[compoundIndex][key], value)) compoundState.matchedBase = true;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const variants = state.staticConfig.compoundVariants;
|
|
515
|
+
const selectorCounts = state.staticConfig[preparedCompoundsKey][preparedCompoundsKey];
|
|
516
|
+
for (let index = 0; index < indexes.length; index++) {
|
|
517
|
+
const compoundIndex = indexes[index];
|
|
518
|
+
const compoundState = states[compoundIndex];
|
|
519
|
+
if (compoundState.failed) continue;
|
|
520
|
+
const branches = compoundState.matchedBase ? [""] : compoundState.pending;
|
|
521
|
+
if (!branches || !branches.length) {
|
|
522
|
+
compoundState.failed = true;
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
if (!compoundState.seen) compoundState.combinations = branches;
|
|
526
|
+
else {
|
|
527
|
+
const previous = compoundState.combinations;
|
|
528
|
+
const next = [];
|
|
529
|
+
for (let left = 0; left < previous.length; left++) for (let right = 0; right < branches.length; right++) {
|
|
530
|
+
const conditionKey = combineConditionKeys(state, previous[left], branches[right]);
|
|
531
|
+
if (!next.includes(conditionKey)) next.push(conditionKey);
|
|
116
532
|
}
|
|
117
|
-
|
|
533
|
+
compoundState.combinations = next;
|
|
118
534
|
}
|
|
535
|
+
compoundState.seen++;
|
|
536
|
+
if (compoundState.seen !== selectorCounts[compoundIndex]) continue;
|
|
537
|
+
const style = variants[compoundIndex].style;
|
|
538
|
+
if (!(0, import_isObj.isPlainObject)(style)) continue;
|
|
539
|
+
const combinations = compoundState.combinations;
|
|
540
|
+
for (let combination = 0; combination < combinations.length; combination++) for (const styleKey in style) contributeProp(pass, styleKey, style[styleKey], void 0, states, combinations[combination]);
|
|
119
541
|
}
|
|
120
|
-
return compoundMatcherMatches(expected, actual) ? [""] : null;
|
|
121
542
|
}
|
|
122
|
-
function
|
|
123
|
-
if (Object.prototype.hasOwnProperty.call(value, "default")) return
|
|
124
|
-
for (const key in value)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
function compoundVariantMatchChains(compoundVariant, props, isChain) {
|
|
135
|
-
let chains = [""];
|
|
136
|
-
for (const key in compoundVariant) {
|
|
137
|
-
if (key === "style") continue;
|
|
138
|
-
const keyChains = matcherChains(compoundVariant[key], props[key], isChain);
|
|
139
|
-
if (!keyChains) return null;
|
|
140
|
-
const next = [];
|
|
141
|
-
for (const a of chains) for (const b of keyChains) {
|
|
142
|
-
const joined = joinChains(a, b);
|
|
143
|
-
if (!next.includes(joined)) next.push(joined);
|
|
543
|
+
function classifyConditionalObject(value, state, isChain, firstCursor) {
|
|
544
|
+
if (Object.prototype.hasOwnProperty.call(value, "default")) return -1;
|
|
545
|
+
for (const key in value) {
|
|
546
|
+
if (!key.length) return 0;
|
|
547
|
+
if (!state) return isChain?.(key) ? 1 : 0;
|
|
548
|
+
const watermark = conditionCursorTop;
|
|
549
|
+
const cursor = firstCursor || acquireConditionCursor();
|
|
550
|
+
try {
|
|
551
|
+
resolveConditionText(state, cursor, key);
|
|
552
|
+
return commitConditionCursor(state, cursor);
|
|
553
|
+
} finally {
|
|
554
|
+
if (!firstCursor) releaseConditionCursors(watermark);
|
|
144
555
|
}
|
|
145
|
-
chains = next;
|
|
146
556
|
}
|
|
147
|
-
return
|
|
557
|
+
return 0;
|
|
148
558
|
}
|
|
559
|
+
const passStyleState = 0;
|
|
560
|
+
const passClassName = 21;
|
|
561
|
+
const passShouldDoClasses = 22;
|
|
562
|
+
const passContainerValue = 23;
|
|
563
|
+
const passContainerName = 24;
|
|
564
|
+
const passContainerType = 25;
|
|
565
|
+
const passFrontendGroup = 26;
|
|
566
|
+
const passFrontendContainer = 27;
|
|
567
|
+
const passFrontendContainerType = 28;
|
|
568
|
+
const passHocMappedProperties = 29;
|
|
569
|
+
const passHocMappedClasses = 30;
|
|
570
|
+
const passCompoundIndexes = 31;
|
|
571
|
+
const passCompoundKey = 32;
|
|
572
|
+
const passCompoundStates = 33;
|
|
573
|
+
const passParentCursor = 35;
|
|
574
|
+
const passMapSourceKey = 36;
|
|
575
|
+
const passMapFlags = 37;
|
|
576
|
+
const passNoSkipFlag = 1;
|
|
577
|
+
const passDisableShorthandsFlag = 2;
|
|
578
|
+
const passNoExpandFlag = 4;
|
|
579
|
+
const passNoMergeFlag = 8;
|
|
580
|
+
const passHocFlag = 16;
|
|
581
|
+
const passTextFlag = 32;
|
|
582
|
+
const passInputFlag = 64;
|
|
583
|
+
const passAsChildStyleFlag = 128;
|
|
149
584
|
const styledDefaultsCache = /* @__PURE__ */ new WeakMap();
|
|
150
|
-
function getStyledDefaults(staticConfig) {
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
153
|
-
entries = null;
|
|
585
|
+
function getStyledDefaults(staticConfig, shorthands) {
|
|
586
|
+
let prepared = styledDefaultsCache.get(staticConfig);
|
|
587
|
+
if (prepared === void 0) {
|
|
588
|
+
let entries = null;
|
|
154
589
|
const defaults = staticConfig.defaultProps;
|
|
155
|
-
if (defaults) for (const key in defaults)
|
|
156
|
-
|
|
590
|
+
if (defaults) for (const key in defaults) {
|
|
591
|
+
if (!(key in import_helpers.stylePropsAll || key in shorthands)) continue;
|
|
592
|
+
const value = defaults[key];
|
|
593
|
+
if (maybeStyleProgram(value)) (entries ||= []).push(key, value);
|
|
594
|
+
}
|
|
595
|
+
prepared = entries;
|
|
596
|
+
styledDefaultsCache.set(staticConfig, prepared);
|
|
157
597
|
}
|
|
158
|
-
return
|
|
598
|
+
return prepared;
|
|
159
599
|
}
|
|
160
|
-
const maybeStyleProgram = (value) => typeof value === "string" ? value.
|
|
161
|
-
function contributeDisplacedStyledDefaults(styledDefaults, processedProps,
|
|
600
|
+
const maybeStyleProgram = (value) => typeof value === "string" ? value.indexOf(":") !== -1 : !!value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value);
|
|
601
|
+
function contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass) {
|
|
162
602
|
if (!styledDefaults) return;
|
|
163
|
-
for (let
|
|
164
|
-
const key = styledDefaults[
|
|
165
|
-
const
|
|
603
|
+
for (let offset = 0; offset < styledDefaults.length; offset += 2) {
|
|
604
|
+
const key = styledDefaults[offset];
|
|
605
|
+
const value = styledDefaults[offset + 1];
|
|
166
606
|
const propValue = processedProps[key];
|
|
167
|
-
if (
|
|
168
|
-
|
|
607
|
+
if (propValue !== void 0 && propValue !== value) contributeProp(pass, key, value);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function injectDisplacedStyledDefault(pass, key, value) {
|
|
611
|
+
const defaultValue = pass[4].defaultProps?.[key];
|
|
612
|
+
if (defaultValue === void 0 || value === void 0 || value === defaultValue || maybeStyleProgram(defaultValue)) return;
|
|
613
|
+
const state = pass[passStyleState];
|
|
614
|
+
state.flatWeakContribution = true;
|
|
615
|
+
try {
|
|
616
|
+
contributeProp(pass, key, defaultValue);
|
|
617
|
+
} finally {
|
|
618
|
+
state.flatWeakContribution = false;
|
|
169
619
|
}
|
|
170
620
|
}
|
|
171
|
-
function forEachPropInForwardOrder(
|
|
621
|
+
function forEachPropInForwardOrder(pass) {
|
|
622
|
+
const styleState = pass[passStyleState];
|
|
623
|
+
const staticConfig = styleState.staticConfig;
|
|
624
|
+
const processedProps = styleState.props;
|
|
625
|
+
const shorthands = styleState.conf.shorthands;
|
|
172
626
|
const processedBaseStyle = staticConfig.baseStyle;
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
627
|
+
const styledDefaults = getStyledDefaults(staticConfig, shorthands);
|
|
628
|
+
const directState = styleState;
|
|
629
|
+
const preparedCompounds = staticConfig[preparedCompoundsKey];
|
|
630
|
+
if (preparedCompounds === void 0 && staticConfig.compoundVariants?.length) throw new Error("A component with compoundVariants reached style resolution before its static config was prepared.");
|
|
631
|
+
const conditionWrapperBase = conditionWrapperTop;
|
|
632
|
+
if (!preparedCompounds) {
|
|
633
|
+
try {
|
|
634
|
+
if (processedBaseStyle) for (const key in processedBaseStyle) contributeProp(pass, key, processedBaseStyle[key]);
|
|
635
|
+
contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass);
|
|
636
|
+
for (const key in processedProps) {
|
|
637
|
+
const value = processedProps[key];
|
|
638
|
+
directState.flatPropSawCondition = false;
|
|
639
|
+
contributeProp(pass, key, value);
|
|
640
|
+
if (directState.flatPropSawCondition) injectDisplacedStyledDefault(pass, key, value);
|
|
641
|
+
}
|
|
642
|
+
} finally {
|
|
643
|
+
releaseConditionPayloads(conditionWrapperBase);
|
|
644
|
+
}
|
|
179
645
|
return;
|
|
180
646
|
}
|
|
181
|
-
const
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (selectorKey === "style") continue;
|
|
193
|
-
for (let index = propEntries.length - 1; index >= 0; index--) if (propEntries[index][0] === selectorKey) {
|
|
194
|
-
anchor = Math.max(anchor, index);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
647
|
+
const compoundVariants = staticConfig.compoundVariants;
|
|
648
|
+
const compoundStates = new Array(compoundVariants.length);
|
|
649
|
+
try {
|
|
650
|
+
if (processedBaseStyle) for (const key in processedBaseStyle) contributeProp(pass, key, processedBaseStyle[key]);
|
|
651
|
+
contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass);
|
|
652
|
+
const selectorCounts = preparedCompounds[preparedCompoundsKey];
|
|
653
|
+
for (let compoundIndex = 0; compoundIndex < compoundVariants.length; compoundIndex++) {
|
|
654
|
+
if (selectorCounts[compoundIndex]) continue;
|
|
655
|
+
const style = compoundVariants[compoundIndex].style;
|
|
656
|
+
if (!(0, import_isObj.isPlainObject)(style)) continue;
|
|
657
|
+
for (const key in style) contributeProp(pass, key, style[key]);
|
|
197
658
|
}
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
const value =
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value) && isConditionalObjectValue(value, isChain)) {
|
|
207
|
-
const composed = {};
|
|
208
|
-
for (const inner in value) composed[inner === "default" ? chain : `${chain}:${inner}`] = value[inner];
|
|
209
|
-
entries.push([key, composed]);
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
if (typeof value === "string" && value.includes(":")) {
|
|
213
|
-
if (process.env.NODE_ENV === "development") console.warn(`[tamagui] compound variant "${key}" carries a clause string and matched conditionally; dropping it. use the object form in the compound style`);
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
entries.push([key, { [chain]: value }]);
|
|
217
|
-
}
|
|
659
|
+
for (const key in processedProps) {
|
|
660
|
+
const compoundIndexes = preparedCompounds[key];
|
|
661
|
+
const value = processedProps[key];
|
|
662
|
+
beginCompoundEdges(compoundIndexes, compoundStates);
|
|
663
|
+
directState.flatPropSawCondition = false;
|
|
664
|
+
contributeProp(pass, key, value, compoundIndexes, compoundStates);
|
|
665
|
+
if (directState.flatPropSawCondition) injectDisplacedStyledDefault(pass, key, value);
|
|
666
|
+
finishCompoundEdges(pass, key, value, compoundIndexes, compoundStates);
|
|
218
667
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
for (let index = 0; index < orderedEntries.length; index++) contribute(orderedEntries[index][0], orderedEntries[index][1]);
|
|
222
|
-
const beforeProps = compoundsByAnchor.get(-1);
|
|
223
|
-
if (beforeProps) for (let index = 0; index < beforeProps.length; index++) contribute(beforeProps[index][0], beforeProps[index][1]);
|
|
224
|
-
for (let index = 0; index < propEntries.length; index++) {
|
|
225
|
-
contribute(propEntries[index][0], propEntries[index][1]);
|
|
226
|
-
const compounds = compoundsByAnchor.get(index);
|
|
227
|
-
if (compounds) for (let i = 0; i < compounds.length; i++) contribute(compounds[i][0], compounds[i][1]);
|
|
668
|
+
} finally {
|
|
669
|
+
releaseConditionPayloads(conditionWrapperBase);
|
|
228
670
|
}
|
|
229
671
|
}
|
|
230
672
|
function isValidStyleKey(key, validStyles, accept) {
|
|
231
|
-
return Boolean(key in validStyles ||
|
|
673
|
+
return Boolean(key in validStyles || accept && key in accept);
|
|
232
674
|
}
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
675
|
+
function flushForwardStylesToClasses(pass) {
|
|
676
|
+
const styleState = pass[passStyleState];
|
|
677
|
+
if (!pass[passShouldDoClasses]) return;
|
|
678
|
+
(0, import_directStyleCSS.completeStreamingCSS)(styleState);
|
|
679
|
+
(0, import_directStyleCSS.flushDirectStyles)(styleState, true);
|
|
680
|
+
}
|
|
681
|
+
function effectiveLifecycleKeys(keys) {
|
|
682
|
+
if (!keys) return;
|
|
683
|
+
const out = /* @__PURE__ */ new Set();
|
|
684
|
+
for (const key of keys) out.add(key === "--t-x" || key === "--t-y" ? "translate" : key === "--t-scale-x" || key === "--t-scale-y" ? "scale" : key);
|
|
685
|
+
return out;
|
|
686
|
+
}
|
|
687
|
+
function mapContributedProp(styleState, key, val, originalVal, condition) {
|
|
688
|
+
const pass = styleState.flatPass;
|
|
689
|
+
const keyInit = pass[passMapSourceKey];
|
|
690
|
+
const disablePropMap = Boolean(pass[passMapFlags]);
|
|
691
|
+
const [, conf, props, viewProps, , validStyles, accept, , variants, inlineProps, parentVariants, , styledContext, styledContextKeys, flags, debug] = pass;
|
|
692
|
+
const isHOC = Boolean(flags & passHocFlag);
|
|
693
|
+
const hocParentVariants = isHOC ? parentVariants : void 0;
|
|
694
|
+
const canResolveContextPrograms = !isHOC;
|
|
695
|
+
const isStyledContextProp = styledContextKeys?.has(key) || styledContext && key in styledContext;
|
|
696
|
+
if (key === "className") {
|
|
697
|
+
if (typeof val === "string" && val) pass[passClassName] = `${pass[passClassName]} ${val}`.trim();
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
if (canResolveContextPrograms && disablePropMap && !isStyledContextProp) {
|
|
701
|
+
if (key in import_helpers.stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
|
|
702
|
+
if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
viewProps[key] = val;
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
709
|
+
console.groupCollapsed(" 💠 expanded", keyInit, "=>", key);
|
|
710
|
+
(0, import_log.log)(val);
|
|
711
|
+
console.groupEnd();
|
|
712
|
+
}
|
|
713
|
+
if (val == null) return;
|
|
714
|
+
if (accept && key in accept) {
|
|
715
|
+
viewProps[key] = val;
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
const isHostStyleKey = isValidStyleKey(key, validStyles, accept) || false;
|
|
719
|
+
const isContextProgramKey = canResolveContextPrograms && Boolean(isStyledContextProp);
|
|
720
|
+
if (condition !== void 0) {
|
|
721
|
+
const conditionCursor = condition;
|
|
722
|
+
if (isHostStyleKey || isContextProgramKey) contributeValue(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey, conditionCursor);
|
|
723
|
+
else if (isHOC) {
|
|
724
|
+
const structured = mergeConditionTransport(styleState, viewProps[key], conditionCursor, val);
|
|
725
|
+
if (key in viewProps) delete viewProps[key];
|
|
726
|
+
viewProps[key] = structured;
|
|
727
|
+
} else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is not a valid style on this component; the conditional variant value is dropped.`);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
if (isHostStyleKey || isContextProgramKey) {
|
|
731
|
+
contributeValue(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const isVariant = Boolean(variants && key in variants);
|
|
735
|
+
if (inlineProps?.has(key)) viewProps[key] = props[key] ?? val;
|
|
736
|
+
if (Boolean(hocParentVariants && hocParentVariants[keyInit])) {
|
|
737
|
+
passDownProp(viewProps, key, val);
|
|
738
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
739
|
+
console.groupCollapsed(` - passing down prop ${key}`);
|
|
278
740
|
(0, import_log.log)({
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
shouldDoClasses,
|
|
282
|
-
styleProps,
|
|
283
|
-
rulesToInsert,
|
|
284
|
-
componentState,
|
|
285
|
-
styleState,
|
|
286
|
-
theme: { ...theme }
|
|
741
|
+
val,
|
|
742
|
+
after: { ...viewProps[key] }
|
|
287
743
|
});
|
|
744
|
+
console.groupEnd();
|
|
288
745
|
}
|
|
746
|
+
return;
|
|
289
747
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const styleFrontend = staticConfig.styleFrontend;
|
|
295
|
-
if (styleFrontend && !props[import_styleFrontend.STYLE_FRONTEND_PREPROCESSED]) processedProps = styleFrontend.preprocessProps(props, conf);
|
|
296
|
-
else processedProps = props;
|
|
297
|
-
const { webContainerType } = conf.settings;
|
|
298
|
-
const parentVariants = parentStaticConfig?.variants;
|
|
299
|
-
const mergeStylePropAtCurrentPosition = (styleProp) => {
|
|
300
|
-
if (styleProps.noMergeStyle || !styleProp) return;
|
|
301
|
-
if (isHOC) {
|
|
302
|
-
viewProps.style = normalizeStyle(styleProp);
|
|
748
|
+
if (!isVariant) {
|
|
749
|
+
if (isStyledContextProp) return;
|
|
750
|
+
if (key in import_helpers.stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
|
|
751
|
+
if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
|
|
303
752
|
return;
|
|
304
753
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
754
|
+
viewProps[key] = val;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function contributeProp(pass, keyOg, valOg, compoundIndexes, compoundStates, parentConditionKey) {
|
|
758
|
+
const parentWatermark = conditionCursorTop;
|
|
759
|
+
if (compoundIndexes) {
|
|
760
|
+
pass[passCompoundIndexes] = compoundIndexes;
|
|
761
|
+
pass[passCompoundKey] = keyOg;
|
|
762
|
+
pass[passCompoundStates] = compoundStates;
|
|
763
|
+
} else if (pass[passCompoundIndexes]) pass[passCompoundIndexes] = void 0;
|
|
764
|
+
if (parentConditionKey) pass[passParentCursor] = acquireConditionKeyCursor(pass[passStyleState], parentConditionKey);
|
|
765
|
+
try {
|
|
766
|
+
const [styleState, conf, props, viewProps, staticConfig, validStyles, accept, neverSkipProps, variants, inlineProps, parentVariants, styleFrontend, styledContext, styledContextKeys, flags, debug, parentStaticConfig, defaultProps, driverAnimations, driverOutputStyle, elementType] = pass;
|
|
767
|
+
const noSkip = Boolean(flags & passNoSkipFlag);
|
|
768
|
+
const disableExpandShorthands = Boolean(flags & passDisableShorthandsFlag);
|
|
769
|
+
const noExpand = Boolean(flags & passNoExpandFlag);
|
|
770
|
+
const noMergeStyle = Boolean(flags & passNoMergeFlag);
|
|
771
|
+
const isHOC = Boolean(flags & passHocFlag);
|
|
772
|
+
const isText = Boolean(flags & passTextFlag);
|
|
773
|
+
const isInput = Boolean(flags & passInputFlag);
|
|
774
|
+
const shorthands = conf.shorthands;
|
|
775
|
+
const shouldSkipDirectProps = !noSkip && !isHOC;
|
|
776
|
+
const shouldCheckSkipProps = !noSkip;
|
|
777
|
+
const asChildExceptStyleLike = Boolean(flags & passAsChildStyleFlag);
|
|
778
|
+
const isTextOrInput = isText || isInput;
|
|
779
|
+
const hocParentVariants = isHOC ? parentVariants : void 0;
|
|
328
780
|
let keyInit = keyOg;
|
|
329
781
|
let valInit = valOg;
|
|
330
|
-
if (styleFrontend && keyInit.startsWith(import_styleFrontend.STYLE_FRONTEND_PASSTHROUGH_PREFIX)) keyInit = "className";
|
|
331
782
|
if (keyInit === "children") {
|
|
332
783
|
viewProps[keyInit] = valInit;
|
|
333
784
|
return;
|
|
@@ -338,7 +789,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
338
789
|
if (accept) {
|
|
339
790
|
const accepted = accept[keyInit];
|
|
340
791
|
if ((accepted === "style" || accepted === "textStyle") && valInit && typeof valInit === "object") {
|
|
341
|
-
viewProps[keyInit] =
|
|
792
|
+
viewProps[keyInit] = resolveAcceptedStyle(styleState, valInit);
|
|
342
793
|
return;
|
|
343
794
|
}
|
|
344
795
|
}
|
|
@@ -346,68 +797,126 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
346
797
|
if (keyInit in shorthands) keyInit = shorthands[keyInit];
|
|
347
798
|
}
|
|
348
799
|
if (keyInit === "className") {
|
|
349
|
-
if (typeof valInit === "string" && valInit) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
800
|
+
if (typeof valInit === "string" && valInit && true) {
|
|
801
|
+
if (noMergeStyle) {
|
|
802
|
+
viewProps.className = valInit;
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
const hocClassNames = props[import_skipProps.HOC_CLASSNAME_MARKER];
|
|
806
|
+
if (hocClassNames && typeof hocClassNames === "object") {
|
|
807
|
+
flushForwardStylesToClasses(pass);
|
|
808
|
+
for (const property in hocClassNames) {
|
|
809
|
+
const generatedClass = hocClassNames[property];
|
|
810
|
+
if (typeof generatedClass !== "string") continue;
|
|
811
|
+
clearDirectStyle(styleState, property);
|
|
812
|
+
styleState.classNames[property] = generatedClass;
|
|
813
|
+
(pass[passHocMappedProperties] ||= /* @__PURE__ */ new Set()).add(property);
|
|
814
|
+
(pass[passHocMappedClasses] ||= /* @__PURE__ */ new Set()).add(generatedClass);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
const getClassPlan = styleFrontend?.getClassPlan;
|
|
818
|
+
let start = 0;
|
|
819
|
+
for (let index = 0; index <= valInit.length; index++) {
|
|
820
|
+
if (index !== valInit.length && valInit.charCodeAt(index) > 32) continue;
|
|
821
|
+
if (index === start) {
|
|
822
|
+
start = index + 1;
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
const candidate = valInit.slice(start, index);
|
|
826
|
+
if (pass[passHocMappedClasses]?.has(candidate)) {
|
|
827
|
+
start = index + 1;
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
const plan = getClassPlan ? getClassPlan(candidate, conf) : "raw";
|
|
831
|
+
if (plan === null) {
|
|
832
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`[tamagui] frontend candidate "${candidate}" is unavailable on this platform and was dropped.`);
|
|
833
|
+
} else if (plan === "raw") {
|
|
834
|
+
pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
|
|
835
|
+
if (getClassPlan) {
|
|
836
|
+
flushForwardStylesToClasses(pass);
|
|
837
|
+
pass[passShouldDoClasses] = false;
|
|
838
|
+
styleState.flatShouldDoClasses = false;
|
|
839
|
+
}
|
|
840
|
+
} else {
|
|
841
|
+
const parentPlan = plan;
|
|
842
|
+
if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
|
|
843
|
+
pass[passClassName] = pass[passClassName] ? `${pass[passClassName]} ${candidate}` : candidate;
|
|
844
|
+
flushForwardStylesToClasses(pass);
|
|
845
|
+
pass[passShouldDoClasses] = false;
|
|
846
|
+
styleState.flatShouldDoClasses = false;
|
|
847
|
+
}
|
|
848
|
+
const entries = Array.isArray(plan) ? plan : parentPlan.entries;
|
|
849
|
+
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
850
|
+
const entry = entries[entryIndex];
|
|
851
|
+
if (entry[2] !== void 0) {
|
|
852
|
+
if (isValidStyleKey(entry[0], validStyles, accept)) contributeValue(styleState, entry[0], entry[1], mergeStyle, void 0, false, entry[2]);
|
|
853
|
+
else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${entry[0]}" is not a valid style on this component; the frontend value is dropped.`);
|
|
854
|
+
} else {
|
|
855
|
+
if (entry[0] === "group") pass[passFrontendGroup] = entry[1];
|
|
856
|
+
else if (entry[0] === "container") pass[passFrontendContainer] = entry[1];
|
|
857
|
+
else if (entry[0] === "containerType") pass[passFrontendContainerType] = entry[1];
|
|
858
|
+
contributeProp(pass, entry[0], entry[1]);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
start = index + 1;
|
|
863
|
+
}
|
|
864
|
+
if (props[import_skipProps.HOC_CLASSNAME_MARKER] !== void 0) {
|
|
865
|
+
flushForwardStylesToClasses(pass);
|
|
866
|
+
pass[passShouldDoClasses] = false;
|
|
354
867
|
styleState.flatShouldDoClasses = false;
|
|
355
868
|
}
|
|
356
869
|
}
|
|
357
870
|
return;
|
|
358
871
|
}
|
|
359
872
|
if (keyInit === "style") {
|
|
360
|
-
|
|
873
|
+
if (!valInit) return;
|
|
874
|
+
if (noMergeStyle) {
|
|
875
|
+
viewProps.style = valInit;
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const isArray = Array.isArray(valInit);
|
|
879
|
+
const length = isArray ? valInit.length : 1;
|
|
880
|
+
for (let index = 0; index < length; index++) {
|
|
881
|
+
const style = isArray ? valInit[index] : valInit;
|
|
882
|
+
if (!style) continue;
|
|
883
|
+
const hocClassNames = style[TAMAGUI_CLASS_PROPS];
|
|
884
|
+
if (hocClassNames) {
|
|
885
|
+
for (const property in hocClassNames) {
|
|
886
|
+
clearDirectStyle(styleState, property);
|
|
887
|
+
styleState.classNames[property] = hocClassNames[property];
|
|
888
|
+
(pass[passHocMappedProperties] ||= /* @__PURE__ */ new Set()).add(property);
|
|
889
|
+
}
|
|
890
|
+
continue;
|
|
891
|
+
}
|
|
892
|
+
const normalized = (0, import_normalizeStyle.normalizeStyle)(style, false, true);
|
|
893
|
+
const styleOriginals = shouldTrackStyleTokenProvenance ? import_styleOriginalValues.styleOriginalValues.get(style) : void 0;
|
|
894
|
+
for (const key in normalized) {
|
|
895
|
+
if (normalized[key] == null) continue;
|
|
896
|
+
if (pass[passHocMappedProperties]?.delete(key)) clearDirectStyle(styleState, key);
|
|
897
|
+
if (key === "containerName" && typeof normalized[key] === "string" && normalized[key].indexOf(":") === -1) pass[passContainerName] = normalized[key];
|
|
898
|
+
if (key === "containerType" && typeof normalized[key] === "string" && normalized[key].indexOf(":") === -1) pass[passContainerType] = normalized[key];
|
|
899
|
+
contributeValue(styleState, key, normalized[key], mergeStyle, styleOriginals?.[key]);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
361
902
|
return;
|
|
362
903
|
}
|
|
363
|
-
if (
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
if (keyInit in import_skipProps.skipProps && !noSkip && !isHOC && !neverSkipProps?.[keyInit]) {
|
|
371
|
-
if (keyInit === "group") {
|
|
372
|
-
const identifier = `t_group_${valInit}`;
|
|
373
|
-
addStyleToInsertRules(rulesToInsert, [
|
|
374
|
-
"container",
|
|
375
|
-
void 0,
|
|
376
|
-
identifier,
|
|
377
|
-
void 0,
|
|
378
|
-
[`.${identifier} { container-name: ${valInit}; container-type: ${webContainerType || "inline-size"}; }`]
|
|
379
|
-
]);
|
|
380
|
-
}
|
|
381
|
-
if (keyInit === "container" && valInit) addStyleToInsertRules(rulesToInsert, [
|
|
382
|
-
"container",
|
|
383
|
-
void 0,
|
|
384
|
-
"t_container",
|
|
385
|
-
void 0,
|
|
386
|
-
[`.t_container { container-type: ${webContainerType || "inline-size"}; }`]
|
|
387
|
-
]);
|
|
904
|
+
if (defaultProps) {
|
|
905
|
+
const defaultVal = defaultProps[keyOg] ?? defaultProps[keyInit];
|
|
906
|
+
if (defaultVal !== void 0 && valInit === defaultVal) return;
|
|
907
|
+
}
|
|
908
|
+
if (keyInit in import_skipProps.skipProps && shouldSkipDirectProps && !neverSkipProps?.[keyInit]) {
|
|
909
|
+
if (keyInit === "container") pass[passContainerValue] = valInit;
|
|
388
910
|
if (keyInit === "transition" && typeof valInit === "string") {
|
|
389
|
-
const animationConfig =
|
|
390
|
-
if (animationConfig &&
|
|
911
|
+
const animationConfig = driverAnimations?.[valInit];
|
|
912
|
+
if (animationConfig && driverOutputStyle === "css" && process.env.IS_STATIC === "is_static") valInit = `all ${animationConfig}`;
|
|
391
913
|
else if (animationConfig) return;
|
|
392
914
|
} else return;
|
|
393
915
|
}
|
|
394
|
-
if ((0, import_frontendProgram.isFrontendProgram)(valInit)) {
|
|
395
|
-
if (isValidStyleKey(valInit.property, validStyles, accept)) (0, import_frontendProgram.contributeFrontendProgram)(styleState, valInit, mergeStyle);
|
|
396
|
-
else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${valInit.property}" is not a valid style on this component; the frontend value is dropped.`);
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
916
|
let isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles, accept);
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
viewProps["dataSet"] ||= {};
|
|
404
|
-
viewProps["dataSet"][keyInit] = valInit;
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
if (keyInit.startsWith("data-")) {
|
|
408
|
-
viewProps[keyInit] = valInit;
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
917
|
+
if (keyInit.startsWith("data-")) {
|
|
918
|
+
viewProps[keyInit] = valInit;
|
|
919
|
+
return;
|
|
411
920
|
}
|
|
412
921
|
if (!noExpand) {
|
|
413
922
|
if (keyInit === "disabled" && valInit === true) {
|
|
@@ -416,11 +925,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
416
925
|
if (!variants?.disabled) return;
|
|
417
926
|
}
|
|
418
927
|
if (keyInit === "testID") {
|
|
419
|
-
|
|
420
|
-
else {
|
|
421
|
-
viewProps["data-testid"] = valInit;
|
|
422
|
-
if ((styleProps.isAnimated || staticConfig.isHOC) && driver?.isReactNative) viewProps.testID = valInit;
|
|
423
|
-
}
|
|
928
|
+
viewProps["data-testid"] = valInit;
|
|
424
929
|
return;
|
|
425
930
|
}
|
|
426
931
|
if (keyInit === "id") {
|
|
@@ -431,10 +936,10 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
431
936
|
let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
|
|
432
937
|
const isStyleLikeKey = isValidStyleKeyInit || isVariant;
|
|
433
938
|
const isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
|
|
434
|
-
if (isStyleProp &&
|
|
435
|
-
const shouldPassProp = !isStyleProp && isHOC ||
|
|
939
|
+
if (isStyleProp && asChildExceptStyleLike) return;
|
|
940
|
+
const shouldPassProp = !isStyleProp && isHOC || hocParentVariants && keyInit in hocParentVariants || inlineProps?.has(keyInit);
|
|
436
941
|
const parentVariant = parentVariants?.[keyInit];
|
|
437
|
-
const isHOCShouldPassThrough = Boolean(isHOC && (
|
|
942
|
+
const isHOCShouldPassThrough = Boolean(isHOC && (parentVariant || keyInit in import_skipProps.skipProps));
|
|
438
943
|
const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
439
944
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
440
945
|
console.groupCollapsed(` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`);
|
|
@@ -456,121 +961,196 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
456
961
|
if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
|
|
457
962
|
if (!isVariant) return;
|
|
458
963
|
}
|
|
459
|
-
if (
|
|
460
|
-
if (keyInit in import_skipProps.skipProps && !(keyInit === "transition" && typeof valInit === "string" && !
|
|
964
|
+
if (shouldCheckSkipProps && !neverSkipProps?.[keyInit]) {
|
|
965
|
+
if (keyInit in import_skipProps.skipProps && !(keyInit === "transition" && typeof valInit === "string" && !driverAnimations?.[valInit])) {
|
|
461
966
|
if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
|
|
462
967
|
return;
|
|
463
968
|
}
|
|
464
969
|
}
|
|
465
|
-
if (
|
|
970
|
+
if (isTextOrInput) {
|
|
466
971
|
if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
|
|
467
972
|
}
|
|
468
973
|
const disablePropMap = !isStyleLikeKey;
|
|
469
|
-
if (
|
|
470
|
-
(
|
|
974
|
+
if (isValidStyleKeyInit && valInit != null && !(variants && keyInit in variants) && !(accept && keyInit in accept) && !(styledContextKeys?.has(keyInit) || styledContext && keyInit in styledContext)) {
|
|
975
|
+
contributeValue(styleState, keyInit, valInit, mergeStyle);
|
|
471
976
|
return;
|
|
472
977
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (typeof val === "string" && val) className = `${className} ${val}`.trim();
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
if (!isHOC && disablePropMap && !isStyledContextProp) {
|
|
480
|
-
if (key in import_helpers.stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
|
|
481
|
-
if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
viewProps[key] = val;
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
488
|
-
console.groupCollapsed(" 💠 expanded", keyInit, "=>", key);
|
|
489
|
-
(0, import_log.log)(val);
|
|
490
|
-
console.groupEnd();
|
|
491
|
-
}
|
|
492
|
-
if (val == null) return;
|
|
493
|
-
if (accept && key in accept) {
|
|
494
|
-
viewProps[key] = val;
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
const isHostStyleKey = !isHOC && isValidStyleKey(key, validStyles, accept) || false;
|
|
498
|
-
const isContextProgramKey = !isHOC && Boolean(isStyledContextProp);
|
|
499
|
-
if (conditionSource !== void 0) {
|
|
500
|
-
if (isHostStyleKey || isContextProgramKey) (0, import_directStyle.contributeVariantClauseValue)(styleState, key, val, conditionSource, mergeStyle, originalVal, !isHostStyleKey);
|
|
501
|
-
else if (isHOC) {
|
|
502
|
-
const appended = (0, import_propMapper.appendFlatClause)(styleState, viewProps[key], conditionSource, val);
|
|
503
|
-
if (appended !== void 0) viewProps[key] = appended;
|
|
504
|
-
else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] conditional variant value for "${key}" cannot join the existing clause string; dropping the clause`);
|
|
505
|
-
} else if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is not a valid style on this component; the conditional variant value is dropped.`);
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
if (isHostStyleKey || isContextProgramKey) {
|
|
509
|
-
(0, import_directStyle.contributeStyleValue)(styleState, key, val, mergeStyle, originalVal, !isHostStyleKey);
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
isVariant = variants && key in variants;
|
|
513
|
-
if (inlineProps?.has(key)) viewProps[key] = props[key] ?? val;
|
|
514
|
-
if (isHOC && Boolean(parentStaticConfig?.variants?.[keyInit])) {
|
|
515
|
-
passDownProp(viewProps, key, val);
|
|
516
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
517
|
-
console.groupCollapsed(` - passing down prop ${key}`);
|
|
518
|
-
(0, import_log.log)({
|
|
519
|
-
val,
|
|
520
|
-
after: { ...viewProps[key] }
|
|
521
|
-
});
|
|
522
|
-
console.groupEnd();
|
|
523
|
-
}
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
if (!isVariant) {
|
|
527
|
-
if (isStyledContextProp) return;
|
|
528
|
-
if (key in import_helpers.stylePropsAll && !isValidStyleKey(key, validStyles, accept)) {
|
|
529
|
-
if (process.env.NODE_ENV === "development") console.warn(`[tamagui] "${key}" is a text style prop and this component is not text \u2014 it would render on neither platform. Use a Text-based component, or html.* for raw web elements.`);
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
viewProps[key] = val;
|
|
533
|
-
}
|
|
534
|
-
});
|
|
978
|
+
pass[passMapSourceKey] = keyInit;
|
|
979
|
+
pass[passMapFlags] = disablePropMap ? 1 : 0;
|
|
980
|
+
contributeMappedValue(keyInit, valInit, styleState, disablePropMap);
|
|
535
981
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
536
982
|
try {
|
|
537
983
|
(0, import_log.log)(` \u2714\uFE0F expand complete`, keyInit);
|
|
538
984
|
(0, import_log.log)("style", { ...styleState.style });
|
|
539
985
|
(0, import_log.log)("viewProps", { ...viewProps });
|
|
540
|
-
(0, import_log.log)("transforms",
|
|
986
|
+
(0, import_log.log)("transforms", styleState.transformAccumulator);
|
|
541
987
|
} catch {}
|
|
542
988
|
console.groupEnd();
|
|
543
989
|
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
const conditionalStates = styleState.flatStateKeys || null;
|
|
548
|
-
const usesSafeArea = !!styleState.flatUsesSafeArea;
|
|
549
|
-
if (styleState.flatMediaKeys?.size) {
|
|
550
|
-
if (!hasMedia) hasMedia = /* @__PURE__ */ new Set();
|
|
551
|
-
if (typeof hasMedia !== "boolean") for (const key of styleState.flatMediaKeys) hasMedia.add(key);
|
|
552
|
-
}
|
|
553
|
-
if (styleState.flatGroupKeys?.size) {
|
|
554
|
-
pseudoGroups ||= /* @__PURE__ */ new Set();
|
|
555
|
-
for (const key of styleState.flatGroupKeys) pseudoGroups.add(key);
|
|
556
|
-
}
|
|
557
|
-
if (styleState.flatGroupMedia?.size) {
|
|
558
|
-
mediaGroups ||= /* @__PURE__ */ new Set();
|
|
559
|
-
for (const key of styleState.flatGroupMedia) mediaGroups.add(key);
|
|
990
|
+
} finally {
|
|
991
|
+
if (parentConditionKey) pass[passParentCursor] = null;
|
|
992
|
+
releaseConditionCursors(parentWatermark);
|
|
560
993
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
994
|
+
}
|
|
995
|
+
const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) => {
|
|
996
|
+
const conf = (0, import_config.getConfig)();
|
|
997
|
+
if (staticConfig.styleFrontend?.normalizeStaticConfig) staticConfig = staticConfig.styleFrontend.normalizeStaticConfig(staticConfig, conf);
|
|
998
|
+
const driver = animationDriver || componentContext?.animationDriver || conf.animations;
|
|
999
|
+
const driverAnimations = driver?.animations;
|
|
1000
|
+
const driverInputStyle = driver?.inputStyle;
|
|
1001
|
+
const driverOutputStyle = driver?.outputStyle;
|
|
1002
|
+
const resolvedDriver = driver?.isStub ? null : driver;
|
|
1003
|
+
if (props.passThrough) return null;
|
|
1004
|
+
const { shorthands } = conf;
|
|
1005
|
+
const { isHOC, isText, isInput, variants, inlineProps, parentStaticConfig, acceptsClassName } = staticConfig;
|
|
1006
|
+
const viewProps = {};
|
|
1007
|
+
const mediaState = styleProps.mediaState || import_mediaState.mediaState;
|
|
1008
|
+
let shouldDoClasses = !process.env.TAMAGUI_DID_OUTPUT_CSS && acceptsClassName && !styleProps.noClass;
|
|
1009
|
+
const rulesToInsert = {};
|
|
1010
|
+
const classNames = {};
|
|
1011
|
+
let hasMedia = false;
|
|
1012
|
+
let pseudoGroups;
|
|
1013
|
+
let mediaGroups;
|
|
1014
|
+
const staticPassthroughClassName = staticConfig.passthroughClassName || "";
|
|
1015
|
+
let className = staticPassthroughClassName;
|
|
1016
|
+
if (staticPassthroughClassName) shouldDoClasses = false;
|
|
1017
|
+
const validStyles = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles);
|
|
1018
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-setup`;
|
|
1019
|
+
const styleState = {
|
|
1020
|
+
classNames,
|
|
1021
|
+
conf,
|
|
1022
|
+
props,
|
|
1023
|
+
styleProps,
|
|
1024
|
+
componentState,
|
|
1025
|
+
staticConfig,
|
|
1026
|
+
style: null,
|
|
1027
|
+
theme,
|
|
1028
|
+
viewProps,
|
|
1029
|
+
context: componentContext,
|
|
1030
|
+
debug,
|
|
1031
|
+
flatRulesToInsert: rulesToInsert,
|
|
1032
|
+
flatShouldDoClasses: shouldDoClasses,
|
|
1033
|
+
flatThemeName: themeName,
|
|
1034
|
+
flatMediaState: mediaState,
|
|
1035
|
+
flatGroupContext: groupContext,
|
|
1036
|
+
animationDriver: resolvedDriver
|
|
1037
|
+
};
|
|
1038
|
+
if (import_directStyleCSS.canGenerateCSS && shouldDoClasses && styleProps.canPlatformPseudo) styleState.flatDeferCSS = true;
|
|
1039
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`style-state`;
|
|
1040
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && import_constants.isClient) {
|
|
1041
|
+
if (import_isDevTools.isDevTools) {
|
|
1042
|
+
console.groupCollapsed("🔹 getSplitStyles 👇");
|
|
1043
|
+
(0, import_log.log)({
|
|
1044
|
+
props,
|
|
1045
|
+
staticConfig,
|
|
1046
|
+
shouldDoClasses,
|
|
1047
|
+
styleProps,
|
|
1048
|
+
rulesToInsert,
|
|
1049
|
+
componentState,
|
|
1050
|
+
styleState,
|
|
1051
|
+
theme: { ...theme }
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
const { asChild } = props;
|
|
1056
|
+
const { accept, neverSkipProps } = staticConfig;
|
|
1057
|
+
const { noSkip, disableExpandShorthands, noExpand, noClass, noMergeStyle, noNormalize, isAnimated, styledContext, styledContextKeys } = styleProps;
|
|
1058
|
+
const styleFrontend = staticConfig.styleFrontend;
|
|
1059
|
+
let frontendGroup;
|
|
1060
|
+
let frontendContainer;
|
|
1061
|
+
let frontendContainerType;
|
|
1062
|
+
const processedProps = props;
|
|
1063
|
+
const parentVariants = parentStaticConfig?.variants;
|
|
1064
|
+
const defaultProps = asChild ? (0, import_getDefaultProps.getDefaultProps)(staticConfig) : void 0;
|
|
1065
|
+
const asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
|
|
1066
|
+
let containerValue;
|
|
1067
|
+
let containerName;
|
|
1068
|
+
let containerType;
|
|
1069
|
+
{
|
|
1070
|
+
const authoredContainerName = processedProps.containerName;
|
|
1071
|
+
const authoredContainerType = processedProps.containerType;
|
|
1072
|
+
containerName = typeof authoredContainerName === "string" && authoredContainerName.indexOf(":") === -1 ? authoredContainerName : void 0;
|
|
1073
|
+
containerType = typeof authoredContainerType === "string" && authoredContainerType.indexOf(":") === -1 ? authoredContainerType : void 0;
|
|
1074
|
+
}
|
|
1075
|
+
let hocMappedClassProperties;
|
|
1076
|
+
let hocMappedClasses;
|
|
1077
|
+
const stylePassFlags = (noSkip ? passNoSkipFlag : 0) | (disableExpandShorthands ? passDisableShorthandsFlag : 0) | (noExpand ? passNoExpandFlag : 0) | (noMergeStyle ? passNoMergeFlag : 0) | (isHOC ? passHocFlag : 0) | (isText ? passTextFlag : 0) | (isInput ? passInputFlag : 0) | (asChildExceptStyleLike ? passAsChildStyleFlag : 0);
|
|
1078
|
+
const pass = [
|
|
1079
|
+
styleState,
|
|
1080
|
+
conf,
|
|
1081
|
+
props,
|
|
1082
|
+
viewProps,
|
|
1083
|
+
staticConfig,
|
|
1084
|
+
validStyles,
|
|
1085
|
+
accept,
|
|
1086
|
+
neverSkipProps,
|
|
1087
|
+
variants,
|
|
1088
|
+
inlineProps,
|
|
1089
|
+
parentVariants,
|
|
1090
|
+
styleFrontend,
|
|
1091
|
+
styledContext,
|
|
1092
|
+
styledContextKeys,
|
|
1093
|
+
stylePassFlags,
|
|
1094
|
+
debug,
|
|
1095
|
+
parentStaticConfig,
|
|
1096
|
+
defaultProps,
|
|
1097
|
+
driverAnimations,
|
|
1098
|
+
driverOutputStyle,
|
|
1099
|
+
elementType,
|
|
1100
|
+
className,
|
|
1101
|
+
shouldDoClasses,
|
|
1102
|
+
containerValue,
|
|
1103
|
+
containerName,
|
|
1104
|
+
containerType,
|
|
1105
|
+
frontendGroup,
|
|
1106
|
+
frontendContainer,
|
|
1107
|
+
frontendContainerType,
|
|
1108
|
+
hocMappedClassProperties,
|
|
1109
|
+
hocMappedClasses
|
|
1110
|
+
];
|
|
1111
|
+
styleState.flatPass = pass;
|
|
1112
|
+
forEachPropInForwardOrder(pass);
|
|
1113
|
+
[, , , , , , , , , , , , , , , , , , , , , className, shouldDoClasses, containerValue, containerName, containerType, frontendGroup, frontendContainer, frontendContainerType, hocMappedClassProperties, hocMappedClasses] = pass;
|
|
1114
|
+
if (containerValue) {
|
|
1115
|
+
containerName ??= typeof containerValue === "string" ? containerValue : void 0;
|
|
1116
|
+
containerType ??= "inline-size";
|
|
1117
|
+
contributeValue(styleState, containerName ? "container" : "containerType", containerName ? `${containerName} / ${containerType}` : containerType, mergeStyle);
|
|
1118
|
+
}
|
|
1119
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-propsend`;
|
|
1120
|
+
const conditionalStates = styleState.flatStateKeys || null;
|
|
1121
|
+
const usesSafeArea = !!styleState.flatUsesSafeArea;
|
|
1122
|
+
if (styleState.flatMediaKeys?.size) {
|
|
1123
|
+
if (!hasMedia) hasMedia = /* @__PURE__ */ new Set();
|
|
1124
|
+
if (typeof hasMedia !== "boolean") for (const key of styleState.flatMediaKeys) hasMedia.add(key);
|
|
1125
|
+
}
|
|
1126
|
+
if (styleState.flatGroupKeys?.size) {
|
|
1127
|
+
pseudoGroups ||= /* @__PURE__ */ new Set();
|
|
1128
|
+
for (const key of styleState.flatGroupKeys) pseudoGroups.add(key);
|
|
1129
|
+
}
|
|
1130
|
+
if (styleState.flatGroupMedia?.size) {
|
|
1131
|
+
mediaGroups ||= /* @__PURE__ */ new Set();
|
|
1132
|
+
for (const key of styleState.flatGroupMedia) mediaGroups.add(key);
|
|
1133
|
+
}
|
|
1134
|
+
if (styleProps.canPlatformPseudo && styleState.flatHasPlatformPseudo) {
|
|
1135
|
+
shouldDoClasses = false;
|
|
1136
|
+
styleState.flatShouldDoClasses = false;
|
|
1137
|
+
if (styleState.transformAccumulator) {
|
|
1138
|
+
mergeStyle(styleState, "transform", (0, import_runtime.finalizeTransformAccumulator)(styleState.transformAccumulator), 1, true);
|
|
1139
|
+
styleState.transformAccumulator = void 0;
|
|
1140
|
+
}
|
|
1141
|
+
convertDeferredInline(styleState, mergeStyle);
|
|
1142
|
+
}
|
|
1143
|
+
completeStreaming(styleState, mergeStyle);
|
|
1144
|
+
const effectiveTransition = styleState.style?.transition;
|
|
1145
|
+
if (effectiveTransition != null && styleState.style && driverOutputStyle !== "css") delete styleState.style.transition;
|
|
1146
|
+
if (!(noNormalize === false)) {
|
|
1147
|
+
if (styleState.style) {
|
|
1148
|
+
(0, import_expandStyles.fixStyles)(styleState.style);
|
|
1149
|
+
if (!noExpand && !noMergeStyle) (0, import_styleToCSS.styleToCSS)(styleState.style);
|
|
1150
|
+
}
|
|
1151
|
+
if (styleState.transformAccumulator && !styleState.flatShouldDoClasses) {
|
|
572
1152
|
styleState.style ||= {};
|
|
573
|
-
|
|
1153
|
+
styleState.style.transform = (0, import_runtime.finalizeTransformAccumulator)(styleState.transformAccumulator);
|
|
574
1154
|
}
|
|
575
1155
|
if (parentSplitStyles) {
|
|
576
1156
|
if (shouldDoClasses) for (const key in parentSplitStyles.classNames) {
|
|
@@ -585,8 +1165,8 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
585
1165
|
}
|
|
586
1166
|
}
|
|
587
1167
|
}
|
|
588
|
-
if (!
|
|
589
|
-
(0,
|
|
1168
|
+
if (!noNormalize && !isHOC && (!isAnimated || driverInputStyle === "css") && Array.isArray(styleState.style?.transform)) styleState.style.transform = (0, import_transformsToString.transformsToString)(styleState.style.transform);
|
|
1169
|
+
(0, import_directStyleCSS.flushDirectStyles)(styleState);
|
|
590
1170
|
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-pre-result`;
|
|
591
1171
|
if (shouldTrackStyleTokenProvenance && styleState.style && styleState.tokenProvenance) {
|
|
592
1172
|
const provenance = {};
|
|
@@ -614,53 +1194,49 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
614
1194
|
if (effectiveTransition != null) result.effectiveTransition = effectiveTransition;
|
|
615
1195
|
if (conditionalStates) result.programStates = conditionalStates;
|
|
616
1196
|
if (usesSafeArea) result.usesSafeArea = true;
|
|
617
|
-
if (
|
|
618
|
-
if (styleState.flatEnterKeys || styleState.flatExitKeys) {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
const asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
|
|
631
|
-
if (!styleProps.noMergeStyle) {
|
|
1197
|
+
if (getDirectDynamicThemeAccess(styleState)) result.dynamicThemeAccess = true;
|
|
1198
|
+
if (styleState.flatEnterKeys || styleState.flatExitKeys) result.programLifecycleStyleKeys = {
|
|
1199
|
+
enter: effectiveLifecycleKeys(styleState.flatEnterKeys),
|
|
1200
|
+
exit: effectiveLifecycleKeys(styleState.flatExitKeys)
|
|
1201
|
+
};
|
|
1202
|
+
if (styleState.flatHasEnterStyle) result.hasEnterStyle = true;
|
|
1203
|
+
if (styleState.flatHasPlatformPseudo) result.platformPseudo = true;
|
|
1204
|
+
if (frontendGroup !== void 0) result.frontendGroup = frontendGroup;
|
|
1205
|
+
if (frontendContainer !== void 0) result.frontendContainer = frontendContainer;
|
|
1206
|
+
if (frontendContainerType !== void 0) result.frontendContainerType = frontendContainerType;
|
|
1207
|
+
if (!noMergeStyle) {
|
|
632
1208
|
if (!asChildExceptStyleLike) {
|
|
633
1209
|
const style = styleState.style;
|
|
634
1210
|
{
|
|
635
1211
|
const fontFamily = isText || isInput ? styleState.fontFamily : null;
|
|
636
1212
|
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "";
|
|
637
|
-
const
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
if (
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
if (groupClassName)
|
|
647
|
-
if (
|
|
648
|
-
if (
|
|
649
|
-
const finalClassName = classList.join(" ");
|
|
650
|
-
const needsCssStyles = isReactNative || styleProps.isAnimated && driver?.isReactNative;
|
|
651
|
-
if (styleProps.isAnimated && driver?.inputStyle === "css") {
|
|
1213
|
+
const group = props.group ?? frontendGroup;
|
|
1214
|
+
const groupClassName = group ? `t_group_${group}` : "";
|
|
1215
|
+
let finalClassName = isText ? "is_Text" : "is_View";
|
|
1216
|
+
if (fontFamilyClassName) finalClassName += ` ${fontFamilyClassName}`;
|
|
1217
|
+
let hasPropertyClassNames = false;
|
|
1218
|
+
if (classNames) for (const key in classNames) {
|
|
1219
|
+
hasPropertyClassNames = true;
|
|
1220
|
+
finalClassName += ` ${classNames[key]}`;
|
|
1221
|
+
}
|
|
1222
|
+
if (groupClassName) finalClassName += ` ${groupClassName}`;
|
|
1223
|
+
if (className) finalClassName += ` ${className}`;
|
|
1224
|
+
if (isAnimated && driverInputStyle === "css") {
|
|
652
1225
|
viewProps.className = finalClassName;
|
|
653
1226
|
if (style) viewProps.style = style;
|
|
654
|
-
} else if (needsCssStyles) {
|
|
655
|
-
let cnStyles;
|
|
656
|
-
for (const name of finalClassName.split(" ")) {
|
|
657
|
-
cnStyles ||= { $$css: true };
|
|
658
|
-
cnStyles[name] = name;
|
|
659
|
-
}
|
|
660
|
-
viewProps.style = cnStyles ? [...Array.isArray(style) ? style : [style], cnStyles] : [style];
|
|
661
1227
|
} else {
|
|
662
|
-
if (finalClassName)
|
|
663
|
-
|
|
1228
|
+
if (finalClassName) {
|
|
1229
|
+
if (isHOC) viewProps[import_skipProps.HOC_CLASSNAME_MARKER] = classNames;
|
|
1230
|
+
viewProps.className = finalClassName;
|
|
1231
|
+
}
|
|
1232
|
+
if (isHOC && hasPropertyClassNames) {
|
|
1233
|
+
const classStyle = {};
|
|
1234
|
+
Object.defineProperty(classStyle, TAMAGUI_CLASS_PROPS, {
|
|
1235
|
+
value: classNames,
|
|
1236
|
+
enumerable: false
|
|
1237
|
+
});
|
|
1238
|
+
viewProps.style = style ? [classStyle, style] : classStyle;
|
|
1239
|
+
} else if (style) viewProps.style = style;
|
|
664
1240
|
}
|
|
665
1241
|
}
|
|
666
1242
|
}
|
|
@@ -687,46 +1263,22 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
687
1263
|
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-done`;
|
|
688
1264
|
return result;
|
|
689
1265
|
};
|
|
690
|
-
function mergeFlatTransforms(target, flatTransforms) {
|
|
691
|
-
const transform = [];
|
|
692
|
-
if ("x" in flatTransforms) transform.push({ translateX: flatTransforms.x });
|
|
693
|
-
if ("y" in flatTransforms) transform.push({ translateY: flatTransforms.y });
|
|
694
|
-
if ("rotate" in flatTransforms) transform.push({ rotate: flatTransforms.rotate });
|
|
695
|
-
const hasScaleX = "scaleX" in flatTransforms;
|
|
696
|
-
const hasScaleY = "scaleY" in flatTransforms;
|
|
697
|
-
if (hasScaleX && hasScaleY && Object.is(flatTransforms.scaleX, flatTransforms.scaleY)) transform.push({ scale: flatTransforms.scaleX });
|
|
698
|
-
else {
|
|
699
|
-
if (hasScaleX) transform.push({ scaleX: flatTransforms.scaleX });
|
|
700
|
-
if (hasScaleY) transform.push({ scaleY: flatTransforms.scaleY });
|
|
701
|
-
if (!hasScaleX && !hasScaleY && "scale" in flatTransforms) transform.push({ scale: flatTransforms.scale });
|
|
702
|
-
}
|
|
703
|
-
const keys = [];
|
|
704
|
-
for (const key in flatTransforms) if (key !== "x" && key !== "y" && key !== "rotate" && key !== "scale" && key !== "scaleX" && key !== "scaleY") keys.push(key);
|
|
705
|
-
keys.sort(import_sortString.sortString);
|
|
706
|
-
for (const key of keys) transform.push({ [mapTransformKeys[key] || key]: flatTransforms[key] });
|
|
707
|
-
if (Array.isArray(target.transform)) transform.push(...target.transform);
|
|
708
|
-
target.transform = transform;
|
|
709
|
-
}
|
|
710
1266
|
function mergeStyle(styleState, key, val, _importance, disableNormalize = false, originalVal) {
|
|
711
1267
|
const { viewProps, styleProps, staticConfig } = styleState;
|
|
712
|
-
|
|
713
|
-
const contextProps = contextConfig?.props;
|
|
714
|
-
const inheritedContextPropKeys = !staticConfig.context || staticConfig.context === staticConfig.parentStaticConfig?.context ? staticConfig.parentStaticConfig?.contextProps : void 0;
|
|
715
|
-
const contextPropKeys = staticConfig.contextProps || inheritedContextPropKeys;
|
|
716
|
-
if (contextProps && key in contextProps || contextPropKeys?.includes(key) || contextConfig?.propKeys?.includes(key)) {
|
|
1268
|
+
if (getContextPropSet(staticConfig)?.has(key)) {
|
|
717
1269
|
styleState.overriddenContextProps ||= {};
|
|
718
1270
|
const originalFromState = styleState.originalContextPropValues?.[key];
|
|
719
1271
|
styleState.overriddenContextProps[key] = originalVal ?? originalFromState ?? val;
|
|
720
1272
|
}
|
|
721
|
-
if (key in import_helpers.stylePropsTransform) {
|
|
722
|
-
styleState.
|
|
723
|
-
styleState.
|
|
1273
|
+
if (key === "transform" || key in import_helpers.stylePropsTransform) {
|
|
1274
|
+
styleState.transformAccumulator ||= (0, import_runtime.createTransformAccumulator)();
|
|
1275
|
+
(0, import_runtime.addTransformValue)(styleState.transformAccumulator, key, val);
|
|
724
1276
|
} else {
|
|
725
|
-
const out =
|
|
1277
|
+
const out = !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
|
|
726
1278
|
if (staticConfig.accept && key in staticConfig.accept) viewProps[key] = out;
|
|
727
1279
|
else {
|
|
728
1280
|
styleState.style ||= {};
|
|
729
|
-
styleState.style[key] =
|
|
1281
|
+
styleState.style[key] = out;
|
|
730
1282
|
if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
|
|
731
1283
|
}
|
|
732
1284
|
}
|
|
@@ -741,105 +1293,1422 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
|
|
|
741
1293
|
if (tokenName !== "" && (Object.prototype.hasOwnProperty.call(styleState.theme, tokenName) || Object.prototype.hasOwnProperty.call(styleState.conf.themes?.[styleState.flatThemeName || ""] || {}, tokenName) || Object.values(styleState.conf.tokensParsed).some((category) => Object.prototype.hasOwnProperty.call(category, tokenName)))) (styleState.tokenProvenance ||= {})[key] = originalVal;
|
|
742
1294
|
else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
|
|
743
1295
|
}
|
|
744
|
-
const
|
|
745
|
-
const {
|
|
1296
|
+
const resolveAcceptedStyle = (styleState, styleIn) => {
|
|
1297
|
+
const { conf, styleProps } = styleState;
|
|
746
1298
|
const styleOut = {};
|
|
747
1299
|
let originalValues;
|
|
748
1300
|
const styleInOriginalValues = import_styleOriginalValues.styleOriginalValues.get(styleIn);
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1301
|
+
const childState = {
|
|
1302
|
+
...styleState,
|
|
1303
|
+
classNames: {},
|
|
1304
|
+
flatShouldDoClasses: false,
|
|
1305
|
+
props: styleIn,
|
|
1306
|
+
style: styleOut,
|
|
1307
|
+
transformAccumulator: void 0
|
|
1308
|
+
};
|
|
1309
|
+
childState.flatUsed = void 0;
|
|
1310
|
+
childState.flatTransitions = void 0;
|
|
1311
|
+
childState.flatAtomics = void 0;
|
|
1312
|
+
childState.flatSingleEntries = void 0;
|
|
1313
|
+
childState.flatSlots = void 0;
|
|
1314
|
+
childState.flatBorderDefaultRequests = void 0;
|
|
1315
|
+
const mergeAccepted = (_state, key, value, _importance, disableNormalize, originalValue) => {
|
|
1316
|
+
styleOut[key] = disableNormalize || styleProps.noNormalize ? value : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(value, key);
|
|
1317
|
+
const trackedOriginal = styleInOriginalValues?.[key] ?? originalValue;
|
|
1318
|
+
if (trackedOriginal !== void 0) (originalValues ||= {})[key] = trackedOriginal;
|
|
1319
|
+
};
|
|
1320
|
+
for (let key in styleIn) {
|
|
1321
|
+
const value = styleIn[key];
|
|
1322
|
+
key = conf.shorthands[key] || key;
|
|
1323
|
+
if (key in import_skipProps.skipProps || value == null) continue;
|
|
1324
|
+
contributeValue(childState, key, value, mergeAccepted);
|
|
1325
|
+
}
|
|
1326
|
+
completeStreaming(childState, mergeAccepted);
|
|
1327
|
+
if (childState.transformAccumulator) styleOut.transform = (0, import_runtime.finalizeTransformAccumulator)(childState.transformAccumulator);
|
|
1328
|
+
if (!styleProps.noNormalize) (0, import_expandStyles.fixStyles)(styleOut);
|
|
1329
|
+
if (originalValues) import_styleOriginalValues.styleOriginalValues.set(styleOut, originalValues);
|
|
1330
|
+
return styleOut;
|
|
1331
|
+
};
|
|
1332
|
+
function passDownProp(viewProps, key, val) {
|
|
1333
|
+
if (key in viewProps) delete viewProps[key];
|
|
1334
|
+
viewProps[key] = val;
|
|
1335
|
+
}
|
|
1336
|
+
let frameSequence = 0;
|
|
1337
|
+
function streamWriteCSS(state, property, value, cursor, original, conditionOverride = -1) {
|
|
1338
|
+
const direct = state;
|
|
1339
|
+
const condition = conditionOverride !== -1 ? conditionOverride : cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1340
|
+
const identity = cursor ? conditionTexts[cursor + conditionKeyOffset] || "" : "";
|
|
1341
|
+
if (property.charCodeAt(0) === 116 && property.startsWith("transition")) {
|
|
1342
|
+
const transitions = direct.flatTransitions ||= [];
|
|
1343
|
+
for (let index = 0; index < transitions.length; index++) if (transitions[index].property === property && transitions[index].identity === identity) {
|
|
1344
|
+
transitions[index].value = value;
|
|
1345
|
+
transitions[index].condition = condition;
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
transitions.push({
|
|
1349
|
+
property,
|
|
1350
|
+
value,
|
|
1351
|
+
condition,
|
|
1352
|
+
identity,
|
|
1353
|
+
selector: cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "",
|
|
1354
|
+
wrappers: cursor ? conditionWrapperCopy(cursor) : void 0
|
|
1355
|
+
});
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
(0, import_directStyleCSS.streamAtomic)(state, property, value, condition, identity, cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "", cursor ? conditionWrappers : void 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0, direct.flatWeakContribution === true, original);
|
|
1359
|
+
}
|
|
1360
|
+
function streamWriteInline(state, property, value, cursor, merge, original, normalize = false, conditionOverride = -1) {
|
|
1361
|
+
const direct = state;
|
|
1362
|
+
const condition = conditionOverride !== -1 ? conditionOverride : cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1363
|
+
const importance = condition ? Math.floor(condition / 256) + 1 : 0;
|
|
1364
|
+
const used = direct.flatUsed ||= {};
|
|
1365
|
+
const previous = used[property];
|
|
1366
|
+
if (previous !== void 0) {
|
|
1367
|
+
if (previous > importance) return;
|
|
1368
|
+
if (direct.flatWeakContribution === true) return;
|
|
1369
|
+
}
|
|
1370
|
+
used[property] = importance;
|
|
1371
|
+
merge(state, property, value, 1, !normalize, original);
|
|
1372
|
+
}
|
|
1373
|
+
function streamRetractInline(state, property, cursor) {
|
|
1374
|
+
const direct = state;
|
|
1375
|
+
const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1376
|
+
const importance = condition ? Math.floor(condition / 256) + 1 : 0;
|
|
1377
|
+
const used = direct.flatUsed ||= {};
|
|
1378
|
+
const previous = used[property];
|
|
1379
|
+
if (previous !== void 0 && previous > importance) return;
|
|
1380
|
+
used[property] = importance;
|
|
1381
|
+
if (state.style) delete state.style[property];
|
|
1382
|
+
}
|
|
1383
|
+
function convertDeferredInline(state, merge) {
|
|
1384
|
+
const direct = state;
|
|
1385
|
+
const used = direct.flatUsed ||= {};
|
|
1386
|
+
const consume = (entries) => {
|
|
1387
|
+
for (let index = 0; index < entries.length; index++) {
|
|
1388
|
+
const entry = entries[index];
|
|
1389
|
+
const condition = entry.condition;
|
|
1390
|
+
if (condition && !(condition & 1)) continue;
|
|
1391
|
+
const importance = condition ? Math.floor(condition / 256) + 1 : 0;
|
|
1392
|
+
const previous = used[entry.property];
|
|
1393
|
+
if (previous !== void 0 && previous > importance) continue;
|
|
1394
|
+
used[entry.property] = importance;
|
|
1395
|
+
merge(state, entry.property, entry.value, 1, true, entry.original !== void 0 ? entry.original : entry.value);
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
const slots = direct.flatSlots;
|
|
1399
|
+
if (slots) {
|
|
1400
|
+
direct.flatSlots = void 0;
|
|
1401
|
+
for (const property in slots) consume(slots[property]);
|
|
1402
|
+
}
|
|
1403
|
+
const transitions = direct.flatTransitions;
|
|
1404
|
+
if (transitions) {
|
|
1405
|
+
direct.flatTransitions = void 0;
|
|
1406
|
+
consume(transitions);
|
|
1407
|
+
}
|
|
1408
|
+
direct.flatBorderDefaultRequests = void 0;
|
|
1409
|
+
}
|
|
1410
|
+
function completeStreaming(state, merge) {
|
|
1411
|
+
const direct = state;
|
|
1412
|
+
const shadow = direct.flatWebShadow;
|
|
1413
|
+
if (shadow && (direct.flatBoxShadowSequence || 0) <= shadow[4]) {
|
|
1414
|
+
const offset = shadow[1] || {
|
|
1415
|
+
width: 0,
|
|
1416
|
+
height: 0
|
|
1417
|
+
};
|
|
1418
|
+
const color = (0, import_normalizeColor.normalizeColor)(shadow[0], shadow[2] ?? 1);
|
|
1419
|
+
if (color) {
|
|
1420
|
+
const next = `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow[3])} ${color}`;
|
|
1421
|
+
emitProperty(state, "boxShadow", direct.flatBoxShadow ? `${direct.flatBoxShadow}, ${next}` : next, null, merge, shadow[5], shadow[6]);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
(0, import_directStyleCSS.completeStreamingCSS)(state);
|
|
1425
|
+
}
|
|
1426
|
+
function emitAtParentCondition(state, property, value, merge, originalValue, contextOnly) {
|
|
1427
|
+
emitValue(state, property, value, state.flatPass?.[passParentCursor] || null, merge, originalValue, contextOnly);
|
|
1428
|
+
}
|
|
1429
|
+
function emitUnderCondition(state, property, value, cursor, merge, originalValue, contextOnly, warnMode, warnSource) {
|
|
1430
|
+
const condition = conditionNumbers[cursor + conditionValueOffset];
|
|
1431
|
+
if (merge && property && condition) state.flatPropSawCondition = true;
|
|
1432
|
+
if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
|
|
1433
|
+
if (warnMode && process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, warnSource, `unknown modifier "${conditionTexts[cursor + conditionUnresolvedNameOffset] || ""}"`);
|
|
1434
|
+
return 0;
|
|
1435
|
+
}
|
|
1436
|
+
const unsupportedState = conditionTexts[cursor + conditionUnsupportedStateOffset] || "";
|
|
1437
|
+
if (warnMode && unsupportedState && process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`${property}: "${unsupportedState}:" has no native component-state source; dropping the clause`);
|
|
1438
|
+
if (merge && property && condition & 2 && (condition & 1 || import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses || warnMode === 1 && false)) {
|
|
1439
|
+
emitValue(state, property, value, cursor, merge, warnMode === 2 ? originalValue : originalValue ?? value, contextOnly);
|
|
1440
|
+
const flags = conditionNumbers[cursor + conditionFlagsOffset];
|
|
1441
|
+
if (flags & conditionEnterFlag) state.flatHasEnterStyle = true;
|
|
1442
|
+
if (flags & conditionPlatformPseudoFlag) state.flatHasPlatformPseudo = true;
|
|
1443
|
+
} else if (merge && property && condition & 2) {
|
|
1444
|
+
const flags = conditionNumbers[cursor + conditionFlagsOffset];
|
|
1445
|
+
if (flags & conditionEnterFlag) state.flatHasEnterStyle = true;
|
|
1446
|
+
if (flags & conditionPlatformPseudoFlag) state.flatHasPlatformPseudo = true;
|
|
1447
|
+
}
|
|
1448
|
+
return condition;
|
|
1449
|
+
}
|
|
1450
|
+
const directStyleHandler = {
|
|
1451
|
+
segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid, chainCount, _result, failure, failureIndex, property, merge, originalValue, contextOnly) {
|
|
1452
|
+
if (isBase) {
|
|
1453
|
+
if (start === end) return;
|
|
1454
|
+
feedCompoundSegment(state, source, start, end, true, valid || failure === "invalid-character" || failure === "stray-comment-close", "");
|
|
1455
|
+
if (!valid) {
|
|
1456
|
+
if (failure === "invalid-character" || failure === "stray-comment-close") return 16;
|
|
1457
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, source, failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : "an unterminated \"(\"");
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
const value = source.slice(start, end);
|
|
1461
|
+
emitAtParentCondition(state, property, value, merge, value, contextOnly);
|
|
1462
|
+
return 5;
|
|
1463
|
+
}
|
|
1464
|
+
if (!chainValid) {
|
|
1465
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
if (start === end) {
|
|
1469
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, source, "a conditional clause has no value");
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
if (property === "aspectRatio" && chainCount === 1) {
|
|
1473
|
+
const left = Number(source.slice(chainStart, chainEnd));
|
|
1474
|
+
const right = Number(source.slice(start, end));
|
|
1475
|
+
if (chainStart < chainEnd && Number.isFinite(left) && left > 0 && Number.isFinite(right) && right > 0) return 12;
|
|
1476
|
+
}
|
|
1477
|
+
const directState = state;
|
|
1478
|
+
const cursor = directState.flatScanCursor;
|
|
1479
|
+
const condition = valid ? emitUnderCondition(state, property, source.slice(start, end), cursor, merge, void 0, contextOnly, 1, source) : conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1480
|
+
feedCompoundSegment(directState, source, start, end, false, valid && Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
1481
|
+
if (!condition) return;
|
|
1482
|
+
if (!valid) {
|
|
1483
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
return 4 | (condition & 12 ? 2 : 0);
|
|
1487
|
+
},
|
|
1488
|
+
modifier(state, start, end, valid, first, source) {
|
|
1489
|
+
const directState = state;
|
|
1490
|
+
let cursor = directState.flatScanCursor;
|
|
1491
|
+
if (!cursor) cursor = directState.flatScanCursor = acquireConditionCursor(directState.flatPass?.[passParentCursor] || null);
|
|
1492
|
+
else if (first) resetConditionCursor(cursor, directState.flatPass?.[passParentCursor] || null);
|
|
1493
|
+
if (!valid) {
|
|
1494
|
+
setConditionUnresolved(cursor);
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(state, cursor, source.slice(start, end));
|
|
1498
|
+
},
|
|
1499
|
+
chain(state, _start, _end, valid) {
|
|
1500
|
+
const cursor = state.flatScanCursor;
|
|
1501
|
+
if (cursor) {
|
|
1502
|
+
if (!valid) setConditionUnresolved(cursor);
|
|
1503
|
+
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(state, cursor);
|
|
1504
|
+
}
|
|
1505
|
+
return true;
|
|
1506
|
+
},
|
|
1507
|
+
end(state, source, result, lastPayloadStart, chainCount, property, merge, originalValue, contextOnly, failure, failureIndex) {
|
|
1508
|
+
let hasBase = !!(result & 1);
|
|
1509
|
+
if (result & 16) {
|
|
1510
|
+
if (chainCount === 0) {
|
|
1511
|
+
emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
|
|
1512
|
+
hasBase = true;
|
|
1513
|
+
} else if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnRefusedValue)(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
|
|
1514
|
+
}
|
|
1515
|
+
if (result & 8 && chainCount === 1) {
|
|
1516
|
+
emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
|
|
1517
|
+
hasBase = true;
|
|
1518
|
+
}
|
|
1519
|
+
if (process.env.NODE_ENV === "development" && !hasBase && result & 4 && (property in import_helpers.tokenCategories.color || property in import_tokenCategories.tokenCategoryByProperty) && splitComponents(source.slice(lastPayloadStart)).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${source}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1520
|
+
if ((!import_directStyleCSS.canGenerateCSS || !state.flatShouldDoClasses) && result & 2 && !hasBase) {
|
|
1521
|
+
const value = implicitLifecycleBase(property);
|
|
1522
|
+
if (value !== null) emitAtParentCondition(state, property, value, merge, value, contextOnly);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
function implicitLifecycleBase(property) {
|
|
1527
|
+
return property === "opacity" || property === "scale" || property === "scaleX" || property === "scaleY" ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
|
|
1528
|
+
}
|
|
1529
|
+
const legacyTransformParts = /* @__PURE__ */ new Set([
|
|
1530
|
+
"matrix",
|
|
1531
|
+
"perspective",
|
|
1532
|
+
"rotateX",
|
|
1533
|
+
"rotateY",
|
|
1534
|
+
"rotateZ",
|
|
1535
|
+
"scaleZ",
|
|
1536
|
+
"skewX",
|
|
1537
|
+
"skewY"
|
|
1538
|
+
]);
|
|
1539
|
+
const webShadowParts = {
|
|
1540
|
+
shadowColor: 1,
|
|
1541
|
+
shadowOffset: 2,
|
|
1542
|
+
shadowOpacity: 3,
|
|
1543
|
+
shadowRadius: 4
|
|
1544
|
+
};
|
|
1545
|
+
const webTextShadowParts = /* @__PURE__ */ new Set([
|
|
1546
|
+
"textShadowColor",
|
|
1547
|
+
"textShadowOffset",
|
|
1548
|
+
"textShadowRadius"
|
|
1549
|
+
]);
|
|
1550
|
+
const lineStyles = /* @__PURE__ */ new Set([
|
|
1551
|
+
"none",
|
|
1552
|
+
"hidden",
|
|
1553
|
+
"dotted",
|
|
1554
|
+
"dashed",
|
|
1555
|
+
"solid",
|
|
1556
|
+
"double",
|
|
1557
|
+
"groove",
|
|
1558
|
+
"ridge",
|
|
1559
|
+
"inset",
|
|
1560
|
+
"outset"
|
|
1561
|
+
]);
|
|
1562
|
+
const borderTargets = {
|
|
1563
|
+
border: {
|
|
1564
|
+
width: [
|
|
1565
|
+
"borderTopWidth",
|
|
1566
|
+
"borderRightWidth",
|
|
1567
|
+
"borderBottomWidth",
|
|
1568
|
+
"borderLeftWidth"
|
|
1569
|
+
],
|
|
1570
|
+
style: [
|
|
1571
|
+
"borderTopStyle",
|
|
1572
|
+
"borderRightStyle",
|
|
1573
|
+
"borderBottomStyle",
|
|
1574
|
+
"borderLeftStyle"
|
|
1575
|
+
],
|
|
1576
|
+
color: [
|
|
1577
|
+
"borderTopColor",
|
|
1578
|
+
"borderRightColor",
|
|
1579
|
+
"borderBottomColor",
|
|
1580
|
+
"borderLeftColor"
|
|
1581
|
+
]
|
|
1582
|
+
},
|
|
1583
|
+
borderTop: {
|
|
1584
|
+
width: ["borderTopWidth"],
|
|
1585
|
+
style: ["borderTopStyle"],
|
|
1586
|
+
color: ["borderTopColor"]
|
|
1587
|
+
},
|
|
1588
|
+
borderRight: {
|
|
1589
|
+
width: ["borderRightWidth"],
|
|
1590
|
+
style: ["borderRightStyle"],
|
|
1591
|
+
color: ["borderRightColor"]
|
|
1592
|
+
},
|
|
1593
|
+
borderBottom: {
|
|
1594
|
+
width: ["borderBottomWidth"],
|
|
1595
|
+
style: ["borderBottomStyle"],
|
|
1596
|
+
color: ["borderBottomColor"]
|
|
1597
|
+
},
|
|
1598
|
+
borderLeft: {
|
|
1599
|
+
width: ["borderLeftWidth"],
|
|
1600
|
+
style: ["borderLeftStyle"],
|
|
1601
|
+
color: ["borderLeftColor"]
|
|
1602
|
+
},
|
|
1603
|
+
outline: {
|
|
1604
|
+
width: ["outlineWidth"],
|
|
1605
|
+
style: ["outlineStyle"],
|
|
1606
|
+
color: ["outlineColor"]
|
|
1607
|
+
},
|
|
1608
|
+
borderBlock: {
|
|
1609
|
+
width: ["borderBlockStartWidth", "borderBlockEndWidth"],
|
|
1610
|
+
style: ["borderBlockStartStyle", "borderBlockEndStyle"],
|
|
1611
|
+
color: ["borderBlockStartColor", "borderBlockEndColor"]
|
|
1612
|
+
},
|
|
1613
|
+
borderInline: {
|
|
1614
|
+
width: ["borderInlineStartWidth", "borderInlineEndWidth"],
|
|
1615
|
+
style: ["borderInlineStartStyle", "borderInlineEndStyle"],
|
|
1616
|
+
color: ["borderInlineStartColor", "borderInlineEndColor"]
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
const tokenLookup = {
|
|
1620
|
+
value: void 0,
|
|
1621
|
+
fromTheme: false,
|
|
1622
|
+
themeKey: ""
|
|
1623
|
+
};
|
|
1624
|
+
function fillTokenLookup(value, fromTheme, themeKey) {
|
|
1625
|
+
tokenLookup.value = value;
|
|
1626
|
+
tokenLookup.fromTheme = fromTheme;
|
|
1627
|
+
tokenLookup.themeKey = themeKey;
|
|
1628
|
+
return tokenLookup;
|
|
1629
|
+
}
|
|
1630
|
+
function tokenVariable(state, property, name) {
|
|
1631
|
+
let lookupName = name.charCodeAt(0) === 36 ? name.slice(1) : name;
|
|
1632
|
+
if (property === "fontFamily") {
|
|
1633
|
+
const family = state.conf.fontsParsed[lookupName]?.family;
|
|
1634
|
+
return family ? fillTokenLookup(family, false, lookupName) : void 0;
|
|
1635
|
+
}
|
|
1636
|
+
const fontKey = property === "fontSize" ? "size" : property === "fontWeight" ? "weight" : property === "lineHeight" || property === "letterSpacing" ? property : void 0;
|
|
1637
|
+
if (fontKey) {
|
|
1638
|
+
const value = (state.conf.fontsParsed[state.fontFamily || state.conf.defaultFontToken] || state.conf.fontsParsed[state.conf.defaultFontToken])?.[fontKey]?.[lookupName];
|
|
1639
|
+
return value ? fillTokenLookup(value, false, lookupName) : void 0;
|
|
1640
|
+
}
|
|
1641
|
+
const category = (0, import_tokenCategories.getTokenCategoryForProperty)(property);
|
|
1642
|
+
const dot = lookupName.indexOf(".");
|
|
1643
|
+
if (dot !== -1) {
|
|
1644
|
+
const prefix = lookupName.slice(0, dot);
|
|
1645
|
+
if (!category || prefix === category || prefix === "color") lookupName = lookupName.slice(dot + 1);
|
|
1646
|
+
}
|
|
1647
|
+
if (category) {
|
|
1648
|
+
const own = state.conf.tokensParsed[category]?.[lookupName];
|
|
1649
|
+
if (own) return fillTokenLookup(own, false, lookupName);
|
|
1650
|
+
for (const sibling of [
|
|
1651
|
+
"color",
|
|
1652
|
+
"space",
|
|
1653
|
+
"size",
|
|
1654
|
+
"radius",
|
|
1655
|
+
"zIndex"
|
|
1656
|
+
]) if (sibling !== category && state.conf.tokensParsed[sibling]?.[lookupName]) return;
|
|
1657
|
+
} else {
|
|
1658
|
+
const first = lookupName.charCodeAt(0);
|
|
1659
|
+
if (first >= 48 && first <= 57 || first === 43 || first === 45 || first === 46) return;
|
|
1660
|
+
}
|
|
1661
|
+
const theme = state.theme?.[lookupName] || state.conf.themes?.[state.flatThemeName || ""]?.[lookupName];
|
|
1662
|
+
if (theme) return fillTokenLookup(theme, true, lookupName);
|
|
1663
|
+
if (category) return;
|
|
1664
|
+
const token = state.conf.tokensParsed.space?.[lookupName] || state.conf.tokensParsed.color?.[lookupName];
|
|
1665
|
+
return token ? fillTokenLookup(token, false, lookupName) : void 0;
|
|
1666
|
+
}
|
|
1667
|
+
let literalMissConf = null;
|
|
1668
|
+
let literalMissRevision = -1;
|
|
1669
|
+
let literalMisses = /* @__PURE__ */ new WeakMap();
|
|
1670
|
+
const literalMissRootTheme = {};
|
|
1671
|
+
function isFontKeyedProperty(property) {
|
|
1672
|
+
return property === "fontFamily" || property === "fontSize" || property === "fontWeight" || property === "lineHeight" || property === "letterSpacing";
|
|
1673
|
+
}
|
|
1674
|
+
function literalMissSet(state) {
|
|
1675
|
+
const revision = (0, import_grammarConfig.getConfigRevisionState)(state.conf).revision;
|
|
1676
|
+
if (state.conf !== literalMissConf || revision !== literalMissRevision) {
|
|
1677
|
+
literalMissConf = state.conf;
|
|
1678
|
+
literalMissRevision = revision;
|
|
1679
|
+
literalMisses = /* @__PURE__ */ new WeakMap();
|
|
1680
|
+
}
|
|
1681
|
+
const themeKey = state.theme && typeof state.theme === "object" ? state.theme : literalMissRootTheme;
|
|
1682
|
+
let set = literalMisses.get(themeKey);
|
|
1683
|
+
if (!set) {
|
|
1684
|
+
set = /* @__PURE__ */ new Set();
|
|
1685
|
+
literalMisses.set(themeKey, set);
|
|
1686
|
+
}
|
|
1687
|
+
return set;
|
|
1688
|
+
}
|
|
1689
|
+
function configuredValue(state, property, raw) {
|
|
1690
|
+
let name = raw;
|
|
1691
|
+
let opacity;
|
|
1692
|
+
const slash = raw.lastIndexOf("/");
|
|
1693
|
+
if (slash > 0) {
|
|
1694
|
+
const amount = Number(raw.slice(slash + 1));
|
|
1695
|
+
if (Number.isInteger(amount) && amount >= 0 && amount <= 100) {
|
|
1696
|
+
name = raw.slice(0, slash);
|
|
1697
|
+
opacity = amount;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
const safeArea = (0, import_resolveSafeAreaVariable.resolveSafeAreaVariable)(name);
|
|
1701
|
+
if (safeArea !== void 0) {
|
|
1702
|
+
state.flatUsesSafeArea = true;
|
|
1703
|
+
return safeArea;
|
|
1704
|
+
}
|
|
1705
|
+
const cacheable = !isFontKeyedProperty(property);
|
|
1706
|
+
let misses;
|
|
1707
|
+
let missKey = "";
|
|
1708
|
+
if (cacheable) {
|
|
1709
|
+
misses = literalMissSet(state);
|
|
1710
|
+
missKey = `${state.flatThemeName || ""}${property}${name}`;
|
|
1711
|
+
if (misses.has(missKey)) return raw;
|
|
1712
|
+
}
|
|
1713
|
+
const lookup = tokenVariable(state, property, name);
|
|
1714
|
+
if (!lookup || !(0, import_createVariable.isVariable)(lookup.value)) {
|
|
1715
|
+
if (misses) misses.add(missKey);
|
|
1716
|
+
if (process.env.NODE_ENV === "development" && import_tokenCategories.tokenCategoryByProperty[property] && state.conf.tokensParsed.color?.[name]) (0, import_warnOnce.warnOnce)(`"${name}" contributes to "color", not "${property}"; keeping it literal`);
|
|
1717
|
+
return raw;
|
|
1718
|
+
}
|
|
1719
|
+
const resolveValues = !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues;
|
|
1720
|
+
if (resolveValues === "except-theme" && lookup.fromTheme) return `${import_themeRef.THEME_REF_PREFIX}${lookup.themeKey}${opacity !== void 0 ? `/${opacity}` : ""}`;
|
|
1721
|
+
let value = (0, import_resolveVariableValue.resolveVariableValue)(property, lookup.value, resolveValues);
|
|
1722
|
+
if (opacity !== void 0) value = `color-mix(in srgb, ${value} ${opacity}%, transparent)`;
|
|
1723
|
+
return value;
|
|
1724
|
+
}
|
|
1725
|
+
function resolveEmbeddedTokens(state, property, raw) {
|
|
1726
|
+
let copyFrom = 0;
|
|
1727
|
+
let out = "";
|
|
1728
|
+
let quote = 0;
|
|
1729
|
+
for (let index = 0; index < raw.length; index++) {
|
|
1730
|
+
const code = raw.charCodeAt(index);
|
|
1731
|
+
if (quote) {
|
|
1732
|
+
if (code === 92) index++;
|
|
1733
|
+
else if (code === quote) quote = 0;
|
|
1734
|
+
continue;
|
|
1735
|
+
}
|
|
1736
|
+
if (code === 34 || code === 39) {
|
|
1737
|
+
quote = code;
|
|
1738
|
+
continue;
|
|
1739
|
+
}
|
|
1740
|
+
if (!(code === 36 || code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122)) continue;
|
|
1741
|
+
let end = index + 1;
|
|
1742
|
+
while (end < raw.length) {
|
|
1743
|
+
const next = raw.charCodeAt(end);
|
|
1744
|
+
if (next === 36 || next === 45 || next === 46 || next === 95 || next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122) end++;
|
|
1745
|
+
else break;
|
|
1746
|
+
}
|
|
1747
|
+
if (raw.charCodeAt(end) === 47) {
|
|
1748
|
+
let suffix = end + 1;
|
|
1749
|
+
while (suffix < raw.length) {
|
|
1750
|
+
const next = raw.charCodeAt(suffix);
|
|
1751
|
+
if (next < 48 || next > 57) break;
|
|
1752
|
+
suffix++;
|
|
1753
|
+
}
|
|
1754
|
+
if (suffix > end + 1) end = suffix;
|
|
1755
|
+
}
|
|
1756
|
+
const before = raw.charCodeAt(index - 1);
|
|
1757
|
+
if (code !== 36 && (before >= 48 && before <= 57 || before === 35 || before === 45 && raw.charCodeAt(index - 2) === 45 || raw.charCodeAt(end) === 40)) {
|
|
1758
|
+
index = end - 1;
|
|
1759
|
+
continue;
|
|
1760
|
+
}
|
|
1761
|
+
const word = raw.slice(index, end);
|
|
1762
|
+
const value = configuredValue(state, property, word);
|
|
1763
|
+
if (value !== word) {
|
|
1764
|
+
out += raw.slice(copyFrom, index);
|
|
1765
|
+
out += String(value);
|
|
1766
|
+
copyFrom = end;
|
|
1767
|
+
}
|
|
1768
|
+
index = end - 1;
|
|
1769
|
+
}
|
|
1770
|
+
return copyFrom ? out + raw.slice(copyFrom) : raw;
|
|
1771
|
+
}
|
|
1772
|
+
function normalizeTransitionNames(state, raw) {
|
|
1773
|
+
let quote = 0;
|
|
1774
|
+
let depth = 0;
|
|
1775
|
+
let copyFrom = 0;
|
|
1776
|
+
let out = "";
|
|
1777
|
+
for (let index = 0; index < raw.length; index++) {
|
|
1778
|
+
const code = raw.charCodeAt(index);
|
|
1779
|
+
if (quote) {
|
|
1780
|
+
if (code === 92) index++;
|
|
1781
|
+
else if (code === quote) quote = 0;
|
|
1782
|
+
continue;
|
|
1783
|
+
}
|
|
1784
|
+
if (code === 34 || code === 39) {
|
|
1785
|
+
quote = code;
|
|
1786
|
+
continue;
|
|
1787
|
+
}
|
|
1788
|
+
if (code === 40) {
|
|
1789
|
+
depth++;
|
|
1790
|
+
continue;
|
|
1791
|
+
}
|
|
1792
|
+
if (code === 41) {
|
|
1793
|
+
depth--;
|
|
1794
|
+
continue;
|
|
1795
|
+
}
|
|
1796
|
+
if (depth || !(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 95) || index > 1 && raw.charCodeAt(index - 1) === 45 && raw.charCodeAt(index - 2) === 45) continue;
|
|
1797
|
+
let end = index + 1;
|
|
1798
|
+
while (end < raw.length) {
|
|
1799
|
+
const next = raw.charCodeAt(end);
|
|
1800
|
+
if (next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 45 || next === 95) end++;
|
|
1801
|
+
else break;
|
|
1802
|
+
}
|
|
1803
|
+
if (raw.charCodeAt(end) !== 40) {
|
|
1804
|
+
const authored = raw.slice(index, end);
|
|
1805
|
+
let property = state.conf.shorthands[authored] || authored;
|
|
1806
|
+
if (property === "x" || property === "y") property = "translate";
|
|
1807
|
+
else if (property === "scaleX" || property === "scaleY") property = "scale";
|
|
1808
|
+
else if (legacyTransformParts.has(property)) property = "transform";
|
|
1809
|
+
let hasUpper = false;
|
|
1810
|
+
for (let offset = 0; offset < property.length; offset++) {
|
|
1811
|
+
const letter = property.charCodeAt(offset);
|
|
1812
|
+
if (letter >= 65 && letter <= 90) {
|
|
1813
|
+
hasUpper = true;
|
|
1814
|
+
break;
|
|
761
1815
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
1816
|
+
}
|
|
1817
|
+
if (property !== authored || hasUpper) {
|
|
1818
|
+
out += raw.slice(copyFrom, index);
|
|
1819
|
+
for (let offset = 0; offset < property.length; offset++) {
|
|
1820
|
+
const letter = property.charCodeAt(offset);
|
|
1821
|
+
out += letter >= 65 && letter <= 90 ? `-${String.fromCharCode(letter + 32)}` : property[offset];
|
|
1822
|
+
}
|
|
1823
|
+
copyFrom = end;
|
|
1824
|
+
}
|
|
765
1825
|
}
|
|
1826
|
+
index = end - 1;
|
|
1827
|
+
}
|
|
1828
|
+
return copyFrom ? out + raw.slice(copyFrom) : raw;
|
|
1829
|
+
}
|
|
1830
|
+
function getDirectDynamicThemeAccess(state) {
|
|
1831
|
+
return state.flatDynamicThemeAccess;
|
|
1832
|
+
}
|
|
1833
|
+
function emitProperty(state, property, value, cursor, merge, originalValue, contextOnly) {
|
|
1834
|
+
const direct = state;
|
|
1835
|
+
const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1836
|
+
if (condition & 4) (state.flatEnterKeys ||= /* @__PURE__ */ new Set()).add(property);
|
|
1837
|
+
if (condition & 8) (state.flatExitKeys ||= /* @__PURE__ */ new Set()).add(property);
|
|
1838
|
+
cursor && conditionTexts[cursor + conditionThemeOffset];
|
|
1839
|
+
if (contextOnly) {
|
|
1840
|
+
if (!condition || condition & 1) (state.overriddenContextProps ||= {})[property] = originalValue;
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && !condition && property === "transform") {
|
|
1844
|
+
if (process.env.NODE_ENV === "development" && state.transformAccumulator) for (const part of (0, import_runtime.getTransformPartKeys)(state.transformAccumulator)) (0, import_warnOnce.warnOnce)(`legacy transform part "${part}" is dropped because "transform" owns the property`);
|
|
1845
|
+
state.transformAccumulator ||= (0, import_runtime.createTransformAccumulator)();
|
|
1846
|
+
(0, import_runtime.addTransformValue)(state.transformAccumulator, property, value);
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
const shouldPromoteAnimatedStyle = import_directStyleCSS.canGenerateCSS && !condition && !state.flatShouldDoClasses && !state.styleProps.noMergeStyle && state.styleProps.isAnimated && state.animationDriver?.inputStyle === "css" && property in import_helpers.nonAnimatableStyleProps;
|
|
1850
|
+
if (import_directStyleCSS.canGenerateCSS && (state.flatShouldDoClasses || shouldPromoteAnimatedStyle)) {
|
|
1851
|
+
if (!condition && state.style && direct.flatWeakContribution !== true && !(direct.flatUsed && direct.flatUsed[property])) delete state.style[property];
|
|
1852
|
+
streamWriteCSS(state, property, value, cursor, originalValue);
|
|
1853
|
+
return;
|
|
1854
|
+
}
|
|
1855
|
+
if (condition && !(condition & 1)) return;
|
|
1856
|
+
streamWriteInline(state, property, value, cursor, merge, originalValue);
|
|
1857
|
+
}
|
|
1858
|
+
function splitComponents(value) {
|
|
1859
|
+
const parts = [];
|
|
1860
|
+
let start = 0;
|
|
1861
|
+
let quote = 0;
|
|
1862
|
+
let depth = 0;
|
|
1863
|
+
for (let index = 0; index <= value.length; index++) {
|
|
1864
|
+
const code = index === value.length ? 32 : value.charCodeAt(index);
|
|
1865
|
+
if (quote) {
|
|
1866
|
+
if (code === 92) index++;
|
|
1867
|
+
else if (code === quote) quote = 0;
|
|
1868
|
+
continue;
|
|
1869
|
+
}
|
|
1870
|
+
if (code === 34 || code === 39) quote = code;
|
|
1871
|
+
else if (code === 40) depth++;
|
|
1872
|
+
else if (code === 41) depth--;
|
|
1873
|
+
else if (!depth && code <= 32) {
|
|
1874
|
+
if (index > start) parts.push(value.slice(start, index));
|
|
1875
|
+
start = index + 1;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
return parts;
|
|
1879
|
+
}
|
|
1880
|
+
function numericUnitValue(value, first, second) {
|
|
1881
|
+
const unitLength = value.endsWith(first) || second !== void 0 && value.endsWith(second) ? first.length : 0;
|
|
1882
|
+
if (!unitLength || value.length === unitLength) return NaN;
|
|
1883
|
+
const numeric = Number(value.slice(0, value.length - unitLength));
|
|
1884
|
+
return Number.isFinite(numeric) ? numeric : NaN;
|
|
1885
|
+
}
|
|
1886
|
+
function isNumericCSSComponent(value) {
|
|
1887
|
+
let index = 0;
|
|
1888
|
+
if (value.charCodeAt(index) === 43 || value.charCodeAt(index) === 45) index++;
|
|
1889
|
+
let digits = 0;
|
|
1890
|
+
let dot = false;
|
|
1891
|
+
for (; index < value.length; index++) {
|
|
1892
|
+
const code = value.charCodeAt(index);
|
|
1893
|
+
if (code >= 48 && code <= 57) {
|
|
1894
|
+
digits++;
|
|
1895
|
+
continue;
|
|
1896
|
+
}
|
|
1897
|
+
if (code === 46 && !dot) {
|
|
1898
|
+
dot = true;
|
|
1899
|
+
continue;
|
|
1900
|
+
}
|
|
1901
|
+
break;
|
|
1902
|
+
}
|
|
1903
|
+
if (!digits) return false;
|
|
1904
|
+
for (; index < value.length; index++) {
|
|
1905
|
+
const code = value.charCodeAt(index);
|
|
1906
|
+
if (code !== 37 && (code < 97 || code > 122)) return false;
|
|
1907
|
+
}
|
|
1908
|
+
return true;
|
|
1909
|
+
}
|
|
1910
|
+
function startsValueFunction(value) {
|
|
1911
|
+
let index = 0;
|
|
1912
|
+
while (index < value.length) {
|
|
1913
|
+
const code = value.charCodeAt(index);
|
|
1914
|
+
if (code === 45 || code >= 97 && code <= 122) {
|
|
1915
|
+
index++;
|
|
1916
|
+
continue;
|
|
1917
|
+
}
|
|
1918
|
+
break;
|
|
1919
|
+
}
|
|
1920
|
+
return index > 0 && value.charCodeAt(index) === 40;
|
|
1921
|
+
}
|
|
1922
|
+
function emitBorder(state, property, raw, cursor, merge, originalValue, contextOnly) {
|
|
1923
|
+
let width;
|
|
1924
|
+
let style;
|
|
1925
|
+
let color;
|
|
1926
|
+
for (const part of splitComponents(raw)) if (lineStyles.has(part) || property === "outline" && part === "auto") style = part;
|
|
1927
|
+
else if (part === "thin" || part === "medium" || part === "thick" || isNumericCSSComponent(part) || startsValueFunction(part)) width = part;
|
|
1928
|
+
else color = part;
|
|
1929
|
+
if (style === "none" && width === void 0) width = "0";
|
|
1930
|
+
const targets = borderTargets[property];
|
|
1931
|
+
if (width !== void 0) for (const target of targets.width) emitResolved(state, target, width, cursor, merge, originalValue, contextOnly);
|
|
1932
|
+
if (style !== void 0) {
|
|
1933
|
+
const styleTargets = targets.style;
|
|
1934
|
+
for (const target of styleTargets) emitProperty(state, target, style, cursor, merge, originalValue, contextOnly);
|
|
1935
|
+
}
|
|
1936
|
+
if (color !== void 0) for (const target of targets.color) emitResolved(state, target, color, cursor, merge, originalValue, contextOnly);
|
|
1937
|
+
}
|
|
1938
|
+
function emitTextDecoration(state, raw, cursor, merge, originalValue, contextOnly) {
|
|
1939
|
+
for (const part of splitComponents(raw)) emitResolved(state, part === "solid" || part === "double" || part === "dotted" || part === "dashed" || part === "wavy" ? "textDecorationStyle" : part === "underline" || part === "overline" || part === "line-through" || part === "none" ? "textDecorationLine" : "textDecorationColor", part, cursor, merge, originalValue, contextOnly);
|
|
1940
|
+
}
|
|
1941
|
+
function emitTransform(state, property, value, cursor, merge, originalValue, contextOnly) {
|
|
1942
|
+
if (!import_directStyleCSS.canGenerateCSS || !state.flatShouldDoClasses) {
|
|
1943
|
+
emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
const targets = property === "scale" ? ["--t-scale-x", "--t-scale-y"] : [property === "x" ? "--t-x" : property === "y" ? "--t-y" : property === "scaleX" ? "--t-scale-x" : property === "scaleY" ? "--t-scale-y" : "rotate"];
|
|
1947
|
+
for (const target of targets) {
|
|
1948
|
+
let targetValue = value;
|
|
1949
|
+
if (typeof targetValue === "number") {
|
|
1950
|
+
if (target === "--t-x" || target === "--t-y") targetValue = `${targetValue}px`;
|
|
1951
|
+
else if (target === "rotate") targetValue = `${targetValue}deg`;
|
|
1952
|
+
}
|
|
1953
|
+
emitProperty(state, target, targetValue, cursor, merge, originalValue, contextOnly);
|
|
1954
|
+
if (target === "--t-x" || target === "--t-y") (0, import_directStyleCSS.addComposition)(state, "translate");
|
|
1955
|
+
else if (target.startsWith("--t-scale")) (0, import_directStyleCSS.addComposition)(state, "scale");
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
function emitResolved(state, property, raw, cursor, merge, originalValue, contextOnly) {
|
|
1959
|
+
let value = configuredValue(state, property, raw);
|
|
1960
|
+
if (value === raw) value = resolveEmbeddedTokens(state, property, raw);
|
|
1961
|
+
if (!state.flatShouldDoClasses && typeof value === "string") {
|
|
1962
|
+
const unitValue = numericUnitValue(value, "px", "dp");
|
|
1963
|
+
if (Number.isFinite(unitValue)) value = unitValue;
|
|
1964
|
+
else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
|
|
1965
|
+
}
|
|
1966
|
+
emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
|
|
1967
|
+
}
|
|
1968
|
+
const emitKindTransition = 1;
|
|
1969
|
+
const emitKindTransformPart = 2;
|
|
1970
|
+
const emitKindWebShadow = 3;
|
|
1971
|
+
const emitKindWebTextShadow = 4;
|
|
1972
|
+
const emitKindTransform = 5;
|
|
1973
|
+
const emitKindBorder = 6;
|
|
1974
|
+
const emitKindTextDecoration = 7;
|
|
1975
|
+
const emitKindBackground = 8;
|
|
1976
|
+
const emitKindAxis = 9;
|
|
1977
|
+
const emitKindBorderRadius = 10;
|
|
1978
|
+
const emitKindBorderWidth = 11;
|
|
1979
|
+
const emitValueKinds = {
|
|
1980
|
+
transition: emitKindTransition,
|
|
1981
|
+
transitionProperty: emitKindTransition,
|
|
1982
|
+
transform: emitKindTransform,
|
|
1983
|
+
textDecoration: emitKindTextDecoration,
|
|
1984
|
+
background: emitKindBackground,
|
|
1985
|
+
x: emitKindAxis,
|
|
1986
|
+
y: emitKindAxis,
|
|
1987
|
+
scale: emitKindAxis,
|
|
1988
|
+
scaleX: emitKindAxis,
|
|
1989
|
+
scaleY: emitKindAxis,
|
|
1990
|
+
rotate: emitKindAxis,
|
|
1991
|
+
borderRadius: emitKindBorderRadius,
|
|
1992
|
+
borderWidth: emitKindBorderWidth,
|
|
1993
|
+
borderTopWidth: emitKindBorderWidth,
|
|
1994
|
+
borderRightWidth: emitKindBorderWidth,
|
|
1995
|
+
borderBottomWidth: emitKindBorderWidth,
|
|
1996
|
+
borderLeftWidth: emitKindBorderWidth
|
|
1997
|
+
};
|
|
1998
|
+
for (const part of legacyTransformParts) emitValueKinds[part] = emitKindTransformPart;
|
|
1999
|
+
for (const part in webShadowParts) emitValueKinds[part] = emitKindWebShadow;
|
|
2000
|
+
for (const part of webTextShadowParts) emitValueKinds[part] = emitKindWebTextShadow;
|
|
2001
|
+
for (const target in borderTargets) emitValueKinds[target] = emitKindBorder;
|
|
2002
|
+
function shadowUnit(part) {
|
|
2003
|
+
return typeof part === "number" ? `${part}px` : part || "0px";
|
|
2004
|
+
}
|
|
2005
|
+
function emitWebTextShadow(state, property, value, merge, originalValue, contextOnly) {
|
|
2006
|
+
const shadow = state.flatTextShadow ||= {};
|
|
2007
|
+
shadow[property] = value;
|
|
2008
|
+
const offset = shadow.textShadowOffset || {
|
|
2009
|
+
width: 0,
|
|
2010
|
+
height: 0
|
|
2011
|
+
};
|
|
2012
|
+
if (!shadow.textShadowColor) return;
|
|
2013
|
+
emitProperty(state, "textShadow", `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow.textShadowRadius)} ${shadow.textShadowColor}`, null, merge, originalValue, contextOnly);
|
|
2014
|
+
}
|
|
2015
|
+
function emitValue(state, property, raw, cursor, merge, originalValue, contextOnly) {
|
|
2016
|
+
const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
2017
|
+
if ((0, import_createVariable.isVariable)(raw)) raw = (0, import_resolveVariableValue.resolveVariableValue)(property, raw, !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues);
|
|
2018
|
+
const emitKind = emitValueKinds[property];
|
|
2019
|
+
if (emitKind !== void 0) switch (emitKind) {
|
|
2020
|
+
case emitKindTransition:
|
|
2021
|
+
if (typeof raw === "string") raw = normalizeTransitionNames(state, raw);
|
|
2022
|
+
break;
|
|
2023
|
+
case emitKindBorderWidth:
|
|
2024
|
+
(0, import_directStyleCSS.requestBorderStyleDefault)(state, property, condition, cursor ? conditionTexts[cursor + conditionKeyOffset] || "" : "", cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "", cursor ? conditionWrappers : void 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0);
|
|
2025
|
+
break;
|
|
2026
|
+
case emitKindTransformPart: {
|
|
2027
|
+
const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
2028
|
+
if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && !condition) {
|
|
2029
|
+
state.transformAccumulator ||= (0, import_runtime.createTransformAccumulator)();
|
|
2030
|
+
(0, import_runtime.addTransformValue)(state.transformAccumulator, property, value2);
|
|
2031
|
+
} else if (condition && import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses) emitProperty(state, "transform", `${property}(${value2})`, cursor, merge, originalValue, contextOnly);
|
|
2032
|
+
else streamWriteInline(state, property, value2, cursor, merge, originalValue, true);
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
case emitKindWebShadow: {
|
|
2036
|
+
const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
2037
|
+
if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses) {
|
|
2038
|
+
const shadow = state.flatWebShadow ||= [];
|
|
2039
|
+
shadow[webShadowParts[property] - 1] = value2;
|
|
2040
|
+
shadow[4] = ++frameSequence;
|
|
2041
|
+
shadow[5] = originalValue;
|
|
2042
|
+
shadow[6] = contextOnly;
|
|
2043
|
+
} else streamWriteInline(state, property, value2, cursor, merge, originalValue, true);
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
case emitKindWebTextShadow: {
|
|
2047
|
+
const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
2048
|
+
if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses) emitWebTextShadow(state, property, value2, merge, originalValue, contextOnly);
|
|
2049
|
+
else streamWriteInline(state, property, value2, cursor, merge, originalValue, true);
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
2052
|
+
case emitKindTransform:
|
|
2053
|
+
if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && Array.isArray(raw)) raw = (0, import_transformsToString.transformsToString)(raw);
|
|
2054
|
+
break;
|
|
2055
|
+
case emitKindBorder:
|
|
2056
|
+
if (typeof raw === "string") {
|
|
2057
|
+
emitBorder(state, property, raw, cursor, merge, originalValue, contextOnly);
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
break;
|
|
2061
|
+
case emitKindTextDecoration:
|
|
2062
|
+
if (typeof raw === "string") {
|
|
2063
|
+
emitTextDecoration(state, raw, cursor, merge, originalValue, contextOnly);
|
|
2064
|
+
return;
|
|
2065
|
+
}
|
|
2066
|
+
break;
|
|
2067
|
+
case emitKindBackground:
|
|
2068
|
+
if (typeof raw === "string") {
|
|
2069
|
+
const parts = splitComponents(raw);
|
|
2070
|
+
if (parts.length === 1 && !startsValueFunction(parts[0])) {
|
|
2071
|
+
emitResolved(state, "backgroundColor", parts[0], cursor, merge, originalValue, contextOnly);
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
break;
|
|
2076
|
+
case emitKindAxis: {
|
|
2077
|
+
let value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
2078
|
+
if (!state.flatShouldDoClasses && typeof value2 === "string" && !value2.startsWith(import_themeRef.THEME_REF_PREFIX)) {
|
|
2079
|
+
if (property === "rotate" && !Number.isFinite(numericUnitValue(value2, "deg", "rad"))) {
|
|
2080
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`native transform "${property}" cannot represent "${value2}"; dropping it`);
|
|
2081
|
+
if (condition & 1) {
|
|
2082
|
+
(0, import_runtime.removeTransformValue)(state.transformAccumulator, property);
|
|
2083
|
+
streamRetractInline(state, property, cursor);
|
|
2084
|
+
}
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
const unitValue = numericUnitValue(value2, "px", "dp");
|
|
2088
|
+
if (Number.isFinite(unitValue)) value2 = unitValue;
|
|
2089
|
+
else if (Number.isFinite(Number(value2))) value2 = Number(value2);
|
|
2090
|
+
}
|
|
2091
|
+
emitTransform(state, property, value2, cursor, merge, originalValue, contextOnly);
|
|
2092
|
+
return;
|
|
2093
|
+
}
|
|
2094
|
+
case emitKindBorderRadius:
|
|
2095
|
+
if (!state.flatShouldDoClasses && !condition) {
|
|
2096
|
+
if (typeof raw === "string") emitResolved(state, property, raw, cursor, merge, originalValue, contextOnly);
|
|
2097
|
+
else emitProperty(state, property, raw, cursor, merge, originalValue, contextOnly);
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
let value = raw;
|
|
2103
|
+
if (typeof raw === "string") {
|
|
2104
|
+
value = configuredValue(state, property, raw);
|
|
2105
|
+
if (value === raw) value = resolveEmbeddedTokens(state, property, raw);
|
|
2106
|
+
}
|
|
2107
|
+
if (!state.flatShouldDoClasses && typeof value === "string") {
|
|
2108
|
+
const unitValue = numericUnitValue(value, "px", "dp");
|
|
2109
|
+
if (Number.isFinite(unitValue)) value = unitValue;
|
|
2110
|
+
else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
|
|
2111
|
+
}
|
|
2112
|
+
if (import_directStyleCSS.canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
|
|
2113
|
+
state.flatBoxShadow = value;
|
|
2114
|
+
state.flatBoxShadowSequence = frameSequence + 1;
|
|
2115
|
+
}
|
|
2116
|
+
const expanded = state.styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(property, value, state.conf.settings.styleCompat || "web");
|
|
2117
|
+
if (!expanded) {
|
|
2118
|
+
emitProperty(state, property, value, cursor, merge, originalValue, contextOnly);
|
|
2119
|
+
return;
|
|
2120
|
+
}
|
|
2121
|
+
if (typeof raw === "string" && expanded.length > 1) {
|
|
2122
|
+
const parts = splitComponents(raw);
|
|
2123
|
+
if (parts.length > 0 && parts.length <= (expanded.length === 4 ? 4 : 2)) {
|
|
2124
|
+
for (let index = 0; index < expanded.length; index++) {
|
|
2125
|
+
const partIndex = index === 0 || parts.length === 1 ? 0 : index === 1 || index === 3 && parts.length < 4 ? 1 : index === 2 && parts.length < 3 ? 0 : index;
|
|
2126
|
+
emitResolved(state, expanded[index][0], parts[partIndex], cursor, merge, originalValue, contextOnly);
|
|
2127
|
+
}
|
|
2128
|
+
return;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
for (let index = 0; index < expanded.length; index++) emitProperty(state, expanded[index][0], expanded[index][1], cursor, merge, originalValue, contextOnly);
|
|
2132
|
+
}
|
|
2133
|
+
function contributeStyleString(state, property, source, merge, originalValue, contextOnly = false) {
|
|
2134
|
+
const directState = state;
|
|
2135
|
+
const watermark = conditionCursorTop;
|
|
2136
|
+
const previousCursor = directState.flatScanCursor;
|
|
2137
|
+
const previousExpectMulti = directState.flatExpectMulti;
|
|
2138
|
+
directState.flatScanCursor = null;
|
|
2139
|
+
directState.flatExpectMulti = source.indexOf(":") !== -1;
|
|
2140
|
+
try {
|
|
2141
|
+
(0, import_runtime.scanFlatValue)(source, directStyleHandler, state, property, merge, originalValue, contextOnly);
|
|
766
2142
|
} finally {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
2143
|
+
directState.flatScanCursor = previousCursor;
|
|
2144
|
+
directState.flatExpectMulti = previousExpectMulti;
|
|
2145
|
+
releaseConditionCursors(watermark);
|
|
2146
|
+
}
|
|
2147
|
+
return true;
|
|
2148
|
+
}
|
|
2149
|
+
function contributeStyleObject(state, property, value, merge, contextOnly) {
|
|
2150
|
+
const outerState = state;
|
|
2151
|
+
const previousExpectMulti = outerState.flatExpectMulti;
|
|
2152
|
+
outerState.flatExpectMulti = true;
|
|
2153
|
+
try {
|
|
2154
|
+
return contributeStyleObjectInner(state, property, value, merge, contextOnly);
|
|
2155
|
+
} finally {
|
|
2156
|
+
outerState.flatExpectMulti = previousExpectMulti;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
function contributeStyleObjectInner(state, property, value, merge, contextOnly) {
|
|
2160
|
+
const directState = state;
|
|
2161
|
+
const parent = directState.flatPass?.[passParentCursor] || null;
|
|
2162
|
+
const hasDefault = Object.prototype.hasOwnProperty.call(value, "default");
|
|
2163
|
+
let hasBase = false;
|
|
2164
|
+
const base = hasDefault ? value.default : void 0;
|
|
2165
|
+
if (base != null) {
|
|
2166
|
+
const baseString = String(base);
|
|
2167
|
+
feedCompoundSegment(directState, baseString, 0, baseString.length, true, true, "");
|
|
2168
|
+
emitAtParentCondition(state, property, base, merge, base, contextOnly);
|
|
2169
|
+
hasBase = true;
|
|
2170
|
+
}
|
|
2171
|
+
let conditions = 0;
|
|
2172
|
+
let firstCondition = !hasDefault;
|
|
2173
|
+
for (const key in value) {
|
|
2174
|
+
if (key === "default") continue;
|
|
2175
|
+
const payload = value[key];
|
|
2176
|
+
const watermark = conditionCursorTop;
|
|
2177
|
+
const cursor = acquireConditionCursor(parent);
|
|
2178
|
+
resolveConditionText(state, cursor, key);
|
|
2179
|
+
const condition = commitConditionCursor(state, cursor);
|
|
2180
|
+
if (firstCondition) {
|
|
2181
|
+
firstCondition = false;
|
|
2182
|
+
if (!condition) {
|
|
2183
|
+
releaseConditionCursors(watermark);
|
|
2184
|
+
return false;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
if (payload != null) {
|
|
2188
|
+
conditions |= emitUnderCondition(state, property, payload, cursor, merge, payload, contextOnly, 1, payload);
|
|
2189
|
+
const payloadString = String(payload);
|
|
2190
|
+
feedCompoundSegment(directState, payloadString, 0, payloadString.length, false, Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
2191
|
+
}
|
|
2192
|
+
releaseConditionCursors(watermark);
|
|
2193
|
+
}
|
|
2194
|
+
if (!hasDefault && firstCondition) return false;
|
|
2195
|
+
if ((!import_directStyleCSS.canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
|
|
2196
|
+
const resting = implicitLifecycleBase(property);
|
|
2197
|
+
if (resting !== null) emitAtParentCondition(state, property, resting, merge, resting, contextOnly);
|
|
2198
|
+
}
|
|
2199
|
+
return true;
|
|
2200
|
+
}
|
|
2201
|
+
function contributeValue(state, property, value, merge, originalValue, contextOnly = false, condition) {
|
|
2202
|
+
if (isConditionTransport(value)) {
|
|
2203
|
+
if (value.hasBase) contributeValue(state, property, value.base, merge, value.base, contextOnly);
|
|
2204
|
+
for (let offset = 0; offset < value.entries.length;) {
|
|
2205
|
+
const entryValue = value.entries[offset];
|
|
2206
|
+
const watermark = conditionCursorTop;
|
|
2207
|
+
try {
|
|
2208
|
+
emitUnderCondition(state, property, entryValue, acquireTransportCursor(state, value.entries, offset, state.flatPass?.[passParentCursor] || null), merge, entryValue, contextOnly, 2, entryValue);
|
|
2209
|
+
} finally {
|
|
2210
|
+
releaseConditionCursors(watermark);
|
|
2211
|
+
}
|
|
2212
|
+
offset += transportEntryWidth;
|
|
2213
|
+
}
|
|
2214
|
+
return true;
|
|
2215
|
+
}
|
|
2216
|
+
if (condition !== void 0) {
|
|
2217
|
+
const parent = state.flatPass?.[passParentCursor] || null;
|
|
2218
|
+
const watermark = conditionCursorTop;
|
|
2219
|
+
try {
|
|
2220
|
+
let effective;
|
|
2221
|
+
if (typeof condition === "string") {
|
|
2222
|
+
effective = acquireConditionCursor(parent);
|
|
2223
|
+
resolveConditionText(state, effective, condition);
|
|
2224
|
+
commitConditionCursor(state, effective);
|
|
2225
|
+
} else if (parent) {
|
|
2226
|
+
effective = acquireConditionCursor(parent);
|
|
2227
|
+
const conditionKey = conditionTexts[condition + conditionKeyOffset] || "";
|
|
2228
|
+
if (conditionKey) resolveConditionText(state, effective, conditionKey);
|
|
2229
|
+
if (!(conditionNumbers[condition + conditionFlagsOffset] & conditionResolvedFlag)) setConditionUnresolved(effective);
|
|
2230
|
+
commitConditionCursor(state, effective);
|
|
2231
|
+
} else effective = condition;
|
|
2232
|
+
const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value);
|
|
2233
|
+
const objectHasDefault = isObjectValue && Object.prototype.hasOwnProperty.call(value, "default");
|
|
2234
|
+
const firstChild = isObjectValue && !objectHasDefault ? acquireConditionCursor(effective) : null;
|
|
2235
|
+
if (isObjectValue && classifyConditionalObject(value, state, void 0, firstChild || void 0)) {
|
|
2236
|
+
let useFirstChild = firstChild !== null;
|
|
2237
|
+
for (const key in value) {
|
|
2238
|
+
const payload = value[key];
|
|
2239
|
+
if (payload == null) continue;
|
|
2240
|
+
if (key === "default") emitUnderCondition(state, property, payload, effective, merge, payload, contextOnly, 2, payload);
|
|
2241
|
+
else {
|
|
2242
|
+
const keyWatermark = conditionCursorTop;
|
|
2243
|
+
const child = useFirstChild ? firstChild : acquireConditionCursor(effective);
|
|
2244
|
+
if (useFirstChild) useFirstChild = false;
|
|
2245
|
+
else {
|
|
2246
|
+
resolveConditionText(state, child, key);
|
|
2247
|
+
commitConditionCursor(state, child);
|
|
783
2248
|
}
|
|
784
|
-
|
|
785
|
-
|
|
2249
|
+
emitUnderCondition(state, property, payload, child, merge, payload, contextOnly, 2, payload);
|
|
2250
|
+
if (child !== firstChild) releaseConditionCursors(keyWatermark);
|
|
786
2251
|
}
|
|
787
2252
|
}
|
|
788
|
-
|
|
789
|
-
styleOut.transform = merged;
|
|
2253
|
+
return true;
|
|
790
2254
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
2255
|
+
emitUnderCondition(state, property, value, effective, merge, originalValue, contextOnly, 2, value);
|
|
2256
|
+
return true;
|
|
2257
|
+
} finally {
|
|
2258
|
+
releaseConditionCursors(watermark);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
if ((webShadowParts[property] || legacyTransformParts.has(property)) && (typeof value === "string" && value.indexOf(":") !== -1 || value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value) && classifyConditionalObject(value, state))) {
|
|
2262
|
+
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`conditional "${property}" needs its composite property; dropping it`);
|
|
2263
|
+
return true;
|
|
2264
|
+
}
|
|
2265
|
+
if (value === "safe" && (0, import_resolveSafeArea.isSafeAreaKey)(property)) {
|
|
2266
|
+
const expanded = (0, import_resolveSafeArea.expandSafeAreaValue)(property);
|
|
2267
|
+
if (expanded) {
|
|
2268
|
+
state.flatUsesSafeArea = true;
|
|
2269
|
+
for (const [key, resolved] of expanded) emitAtParentCondition(state, key, resolved, merge, originalValue ?? value, contextOnly);
|
|
2270
|
+
return true;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
if (typeof value === "string") return contributeStyleString(state, property, value, merge, originalValue, contextOnly);
|
|
2274
|
+
if (value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value) && contributeStyleObject(state, property, value, merge, contextOnly)) return true;
|
|
2275
|
+
if (value != null) {
|
|
2276
|
+
emitAtParentCondition(state, property, value, merge, originalValue ?? value, contextOnly);
|
|
2277
|
+
return true;
|
|
2278
|
+
}
|
|
2279
|
+
return false;
|
|
2280
|
+
}
|
|
2281
|
+
function clearDirectStyle(state, property) {
|
|
2282
|
+
const direct = state;
|
|
2283
|
+
const atomicKey = property.startsWith("transition") ? "transition" : webShadowParts[property] ? "boxShadow" : webTextShadowParts.has(property) ? "textShadow" : legacyTransformParts.has(property) ? "transform" : property;
|
|
2284
|
+
(0, import_directStyleCSS.clearFrameAtomic)(state, atomicKey);
|
|
2285
|
+
const used = direct.flatUsed;
|
|
2286
|
+
if (used) delete used[atomicKey];
|
|
2287
|
+
if (atomicKey === "transform") state.transformAccumulator = void 0;
|
|
2288
|
+
if (state.style) delete state.style[atomicKey];
|
|
2289
|
+
delete state.classNames[atomicKey];
|
|
2290
|
+
}
|
|
2291
|
+
const conditionTransports = /* @__PURE__ */ new WeakSet();
|
|
2292
|
+
function isConditionTransport(value) {
|
|
2293
|
+
return typeof value === "object" && value !== null && conditionTransports.has(value);
|
|
2294
|
+
}
|
|
2295
|
+
const transportEntryWidth = 2;
|
|
2296
|
+
function appendConditionEntry(entries, cursor, value) {
|
|
2297
|
+
entries.push(value, conditionTexts[cursor + conditionKeyOffset] || "");
|
|
2298
|
+
}
|
|
2299
|
+
function acquireTransportCursor(state, entries, offset, parent) {
|
|
2300
|
+
const cursor = acquireConditionCursor(parent);
|
|
2301
|
+
const key = entries[offset + 1];
|
|
2302
|
+
if (key) resolveConditionText(state, cursor, key);
|
|
2303
|
+
commitConditionCursor(state, cursor);
|
|
2304
|
+
return cursor;
|
|
2305
|
+
}
|
|
2306
|
+
function mergeConditionTransport(state, prev, cursor, value) {
|
|
2307
|
+
let transport;
|
|
2308
|
+
if (isConditionTransport(prev)) transport = prev;
|
|
2309
|
+
else {
|
|
2310
|
+
transport = {
|
|
2311
|
+
hasBase: false,
|
|
2312
|
+
base: void 0,
|
|
2313
|
+
entries: []
|
|
2314
|
+
};
|
|
2315
|
+
conditionTransports.add(transport);
|
|
2316
|
+
if (prev != null) {
|
|
2317
|
+
const isObjectValue = typeof prev === "object" && !Array.isArray(prev) && !(0, import_createVariable.isVariable)(prev);
|
|
2318
|
+
const objectHasDefault = isObjectValue && Object.prototype.hasOwnProperty.call(prev, "default");
|
|
2319
|
+
const authoredWatermark = conditionCursorTop;
|
|
2320
|
+
try {
|
|
2321
|
+
const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
|
|
2322
|
+
if (isObjectValue && classifyConditionalObject(prev, state, void 0, firstCursor || void 0)) {
|
|
2323
|
+
let useFirstCursor = firstCursor !== null;
|
|
2324
|
+
for (const key in prev) {
|
|
2325
|
+
const payload = prev[key];
|
|
2326
|
+
if (payload == null) continue;
|
|
2327
|
+
if (key === "default") {
|
|
2328
|
+
transport.hasBase = true;
|
|
2329
|
+
transport.base = payload;
|
|
2330
|
+
continue;
|
|
2331
|
+
}
|
|
2332
|
+
const watermark = conditionCursorTop;
|
|
2333
|
+
const keyCursor = useFirstCursor ? firstCursor : acquireConditionCursor();
|
|
2334
|
+
if (useFirstCursor) useFirstCursor = false;
|
|
2335
|
+
else {
|
|
2336
|
+
resolveConditionText(state, keyCursor, key);
|
|
2337
|
+
commitConditionCursor(state, keyCursor);
|
|
2338
|
+
}
|
|
2339
|
+
appendConditionEntry(transport.entries, keyCursor, payload);
|
|
2340
|
+
if (keyCursor !== firstCursor) releaseConditionCursors(watermark);
|
|
2341
|
+
}
|
|
2342
|
+
} else {
|
|
2343
|
+
transport.hasBase = true;
|
|
2344
|
+
transport.base = prev;
|
|
796
2345
|
}
|
|
797
|
-
|
|
2346
|
+
} finally {
|
|
2347
|
+
releaseConditionCursors(authoredWatermark);
|
|
798
2348
|
}
|
|
799
|
-
}
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
const cursorKey = conditionTexts[cursor + conditionKeyOffset] || "";
|
|
2352
|
+
for (let offset = 0; offset < transport.entries.length; offset += transportEntryWidth) if (transport.entries[offset + 1] === cursorKey) {
|
|
2353
|
+
transport.entries.splice(offset, transportEntryWidth);
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
appendConditionEntry(transport.entries, cursor, value);
|
|
2357
|
+
return transport;
|
|
2358
|
+
}
|
|
2359
|
+
const variantValueHandler = {
|
|
2360
|
+
segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
|
|
2361
|
+
const state = ctx[0];
|
|
2362
|
+
const directState = state;
|
|
2363
|
+
if (start === end) return;
|
|
2364
|
+
if (isBase) {
|
|
2365
|
+
feedCompoundSegment(directState, source, start, end, true, valid, "");
|
|
2366
|
+
if (!valid) return;
|
|
2367
|
+
emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], null);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
if (!valid || !chainValid) return;
|
|
2371
|
+
const cursor = directState.flatScanCursor;
|
|
2372
|
+
const condition = cursor && conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
2373
|
+
feedCompoundSegment(directState, source, start, end, false, Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
2374
|
+
if (!condition) return;
|
|
2375
|
+
emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], cursor);
|
|
2376
|
+
},
|
|
2377
|
+
modifier(ctx, start, end, valid, first, source) {
|
|
2378
|
+
const directState = ctx[0];
|
|
2379
|
+
let cursor = directState.flatScanCursor;
|
|
2380
|
+
if (!cursor) cursor = directState.flatScanCursor = acquireConditionCursor();
|
|
2381
|
+
else if (first) resetConditionCursor(cursor, 0);
|
|
2382
|
+
if (!valid) {
|
|
2383
|
+
setConditionUnresolved(cursor);
|
|
2384
|
+
return;
|
|
2385
|
+
}
|
|
2386
|
+
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(ctx[0], cursor, source.slice(start, end));
|
|
2387
|
+
},
|
|
2388
|
+
chain(ctx, _start, _end, valid) {
|
|
2389
|
+
const cursor = ctx[0].flatScanCursor;
|
|
2390
|
+
if (cursor) {
|
|
2391
|
+
if (!valid) setConditionUnresolved(cursor);
|
|
2392
|
+
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(ctx[0], cursor);
|
|
2393
|
+
}
|
|
2394
|
+
return true;
|
|
800
2395
|
}
|
|
801
|
-
if (!styleProps.noNormalize) (0, import_expandStyles.fixStyles)(styleOut);
|
|
802
|
-
if (originalValues) import_styleOriginalValues.styleOriginalValues.set(styleOut, originalValues);
|
|
803
|
-
return styleOut;
|
|
804
2396
|
};
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
2397
|
+
const contextPropSets = /* @__PURE__ */ new WeakMap();
|
|
2398
|
+
function getContextPropSet(staticConfig) {
|
|
2399
|
+
const cached = contextPropSets.get(staticConfig);
|
|
2400
|
+
if (cached !== void 0) return cached;
|
|
2401
|
+
const contextConfig = staticConfig.context || staticConfig.parentStaticConfig?.context;
|
|
2402
|
+
const inheritedContextPropKeys = !staticConfig.context || staticConfig.context === staticConfig.parentStaticConfig?.context ? staticConfig.parentStaticConfig?.contextProps : void 0;
|
|
2403
|
+
const contextPropKeys = staticConfig.contextProps || inheritedContextPropKeys;
|
|
2404
|
+
let set = null;
|
|
2405
|
+
if (contextConfig?.props) {
|
|
2406
|
+
set ||= /* @__PURE__ */ new Set();
|
|
2407
|
+
for (const key in contextConfig.props) set.add(key);
|
|
2408
|
+
}
|
|
2409
|
+
if (contextPropKeys) {
|
|
2410
|
+
set ||= /* @__PURE__ */ new Set();
|
|
2411
|
+
for (const key of contextPropKeys) set.add(key);
|
|
2412
|
+
}
|
|
2413
|
+
if (contextConfig?.propKeys) {
|
|
2414
|
+
set ||= /* @__PURE__ */ new Set();
|
|
2415
|
+
for (const key of contextConfig.propKeys) set.add(key);
|
|
2416
|
+
}
|
|
2417
|
+
const parentPropKeys = staticConfig.parentStaticConfig?.context?.propKeys;
|
|
2418
|
+
if (parentPropKeys) {
|
|
2419
|
+
set ||= /* @__PURE__ */ new Set();
|
|
2420
|
+
for (const key of parentPropKeys) set.add(key);
|
|
2421
|
+
}
|
|
2422
|
+
contextPropSets.set(staticConfig, set);
|
|
2423
|
+
return set;
|
|
2424
|
+
}
|
|
2425
|
+
function emitMappedValue(styleState, key, value, originalValue, nestedCondition, parentCondition, fallbackOriginal) {
|
|
2426
|
+
const nested = nestedCondition;
|
|
2427
|
+
const parent = parentCondition;
|
|
2428
|
+
let resolvedCondition = nested ?? parent;
|
|
2429
|
+
const watermark = conditionCursorTop;
|
|
2430
|
+
if (nested && parent) {
|
|
2431
|
+
const composed = acquireConditionCursor(parent);
|
|
2432
|
+
const nestedKey = conditionTexts[nested + conditionKeyOffset] || "";
|
|
2433
|
+
if (nestedKey) resolveConditionText(styleState, composed, nestedKey);
|
|
2434
|
+
if (!(conditionNumbers[nested + conditionFlagsOffset] & conditionResolvedFlag)) setConditionUnresolved(composed);
|
|
2435
|
+
commitConditionCursor(styleState, composed);
|
|
2436
|
+
resolvedCondition = composed;
|
|
2437
|
+
}
|
|
2438
|
+
const conf = styleState.conf;
|
|
2439
|
+
if (key === "fontFamily" || key === conf.inverseShorthands.fontFamily) styleState.fontFamily = getFontFamilyFromNameOrVariable(value, conf);
|
|
2440
|
+
mapContributedProp(styleState, key, value, originalValue ?? fallbackOriginal, resolvedCondition);
|
|
2441
|
+
releaseConditionCursors(watermark);
|
|
2442
|
+
}
|
|
2443
|
+
const contributeMappedValue = (key, value, styleState, disabled, parentCondition, fallbackOriginal) => {
|
|
2444
|
+
if (disabled) return emitMappedValue(styleState, key, value, void 0, void 0, parentCondition, fallbackOriginal);
|
|
2445
|
+
const { conf, styleProps, staticConfig } = styleState;
|
|
2446
|
+
const { variants } = staticConfig;
|
|
2447
|
+
const { disableExpandShorthands, noExpand, resolveValues } = styleProps;
|
|
2448
|
+
const shorthands = conf.shorthands;
|
|
2449
|
+
if (!noExpand) {
|
|
2450
|
+
if (variants && key in variants) {
|
|
2451
|
+
resolveVariants(key, value, styleProps, styleState, key);
|
|
2452
|
+
return;
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
if (!disableExpandShorthands) {
|
|
2456
|
+
if (key in shorthands) key = shorthands[key];
|
|
2457
|
+
}
|
|
2458
|
+
const originalValue = value;
|
|
2459
|
+
if (value === "safe" && (0, import_resolveSafeArea.isSafeAreaKey)(key)) {
|
|
2460
|
+
const expanded = (0, import_resolveSafeArea.expandSafeAreaValue)(key);
|
|
2461
|
+
if (expanded) {
|
|
2462
|
+
for (let i = 0; i < expanded.length; i++) {
|
|
2463
|
+
const [nkey, nvalue] = expanded[i];
|
|
2464
|
+
emitMappedValue(styleState, nkey, nvalue, originalValue, void 0, parentCondition, fallbackOriginal);
|
|
2465
|
+
}
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
if (value != null) {
|
|
2470
|
+
if (typeof value === "string") value = (0, import_resolveRem.isRemValue)(value) ? (0, import_resolveRem.resolveRem)(value) : value;
|
|
2471
|
+
else if ((0, import_createVariable.isVariable)(value)) value = (0, import_resolveVariableValue.resolveVariableValue)(key, value, resolveValues);
|
|
2472
|
+
else if ((0, import_resolveRem.isRemValue)(value)) value = (0, import_resolveRem.resolveRem)(value);
|
|
2473
|
+
}
|
|
2474
|
+
if (value != null) {
|
|
2475
|
+
if (key === "fontFamily" && typeof originalValue === "string") {
|
|
2476
|
+
if (originalValue in conf.fontsParsed) styleState.fontFamily = originalValue;
|
|
2477
|
+
}
|
|
2478
|
+
const expanded = noExpand || typeof value === "string" ? null : (0, import_expandStyle.expandStyle)(key, value, conf.settings.styleCompat || "web");
|
|
2479
|
+
if (expanded) {
|
|
2480
|
+
const max = expanded.length;
|
|
2481
|
+
for (let i = 0; i < max; i++) {
|
|
2482
|
+
const [nkey, nvalue, noriginalValue] = expanded[i];
|
|
2483
|
+
emitMappedValue(styleState, nkey, nvalue, noriginalValue ?? originalValue, void 0, parentCondition, fallbackOriginal);
|
|
2484
|
+
}
|
|
2485
|
+
} else emitMappedValue(styleState, key, value, originalValue, void 0, parentCondition, fallbackOriginal);
|
|
2486
|
+
}
|
|
813
2487
|
};
|
|
814
|
-
function
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
if ((
|
|
818
|
-
|
|
819
|
-
|
|
2488
|
+
function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
|
|
2489
|
+
const variantDefinition = styleState.staticConfig.variants?.[key];
|
|
2490
|
+
if (isConditionTransport(value)) {
|
|
2491
|
+
if (value.hasBase) emitResolvedVariant(key, value.base, styleState, parentVariantKey, null);
|
|
2492
|
+
for (let offset = 0; offset < value.entries.length;) {
|
|
2493
|
+
const entryValue = value.entries[offset];
|
|
2494
|
+
const watermark = conditionCursorTop;
|
|
2495
|
+
try {
|
|
2496
|
+
emitResolvedVariant(key, entryValue, styleState, parentVariantKey, acquireTransportCursor(styleState, value.entries, offset, null));
|
|
2497
|
+
} finally {
|
|
2498
|
+
releaseConditionCursors(watermark);
|
|
2499
|
+
}
|
|
2500
|
+
offset += transportEntryWidth;
|
|
2501
|
+
}
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
if (typeof value === "string" && !(variantDefinition && typeof variantDefinition === "object" && value in variantDefinition)) {
|
|
2505
|
+
const directState = styleState;
|
|
2506
|
+
const watermark = conditionCursorTop;
|
|
2507
|
+
const previousCursor = directState.flatScanCursor;
|
|
2508
|
+
directState.flatScanCursor = null;
|
|
2509
|
+
try {
|
|
2510
|
+
(0, import_runtime.scanFlatValue)(value, variantValueHandler, [
|
|
2511
|
+
styleState,
|
|
2512
|
+
key,
|
|
2513
|
+
parentVariantKey
|
|
2514
|
+
]);
|
|
2515
|
+
} finally {
|
|
2516
|
+
directState.flatScanCursor = previousCursor;
|
|
2517
|
+
releaseConditionCursors(watermark);
|
|
2518
|
+
}
|
|
2519
|
+
return;
|
|
2520
|
+
}
|
|
2521
|
+
const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value);
|
|
2522
|
+
const objectHasDefault = isObjectValue && Object.prototype.hasOwnProperty.call(value, "default");
|
|
2523
|
+
const objectWatermark = conditionCursorTop;
|
|
2524
|
+
try {
|
|
2525
|
+
const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
|
|
2526
|
+
if (isObjectValue && classifyConditionalObject(value, styleState, void 0, firstCursor || void 0)) {
|
|
2527
|
+
let useFirstCursor = firstCursor !== null;
|
|
2528
|
+
for (const objKey in value) {
|
|
2529
|
+
const payload = value[objKey];
|
|
2530
|
+
if (payload == null) continue;
|
|
2531
|
+
const directState = styleState;
|
|
2532
|
+
const payloadString = String(payload);
|
|
2533
|
+
if (objKey === "default") {
|
|
2534
|
+
feedCompoundSegment(directState, payloadString, 0, payloadString.length, true, true, "");
|
|
2535
|
+
emitResolvedVariant(key, payload, styleState, parentVariantKey, null);
|
|
2536
|
+
continue;
|
|
2537
|
+
}
|
|
2538
|
+
const watermark = conditionCursorTop;
|
|
2539
|
+
const cursor = useFirstCursor ? firstCursor : acquireConditionCursor();
|
|
2540
|
+
let condition = conditionNumbers[cursor + conditionValueOffset];
|
|
2541
|
+
if (useFirstCursor) useFirstCursor = false;
|
|
2542
|
+
else {
|
|
2543
|
+
resolveConditionText(styleState, cursor, objKey);
|
|
2544
|
+
condition = commitConditionCursor(styleState, cursor);
|
|
2545
|
+
}
|
|
2546
|
+
if (directState.flatPass?.[passCompoundIndexes]) feedCompoundSegment(directState, payloadString, 0, payloadString.length, false, Boolean(condition), condition ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
2547
|
+
emitResolvedVariant(key, payload, styleState, parentVariantKey, cursor);
|
|
2548
|
+
if (cursor !== firstCursor) releaseConditionCursors(watermark);
|
|
2549
|
+
}
|
|
2550
|
+
return;
|
|
820
2551
|
}
|
|
2552
|
+
} finally {
|
|
2553
|
+
releaseConditionCursors(objectWatermark);
|
|
821
2554
|
}
|
|
2555
|
+
emitResolvedVariant(key, value, styleState, parentVariantKey, null);
|
|
822
2556
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
};
|
|
832
|
-
|
|
833
|
-
|
|
2557
|
+
function emitResolvedVariant(key, value, styleState, parentVariantKey, conditionCursor) {
|
|
2558
|
+
const { staticConfig, conf, debug } = styleState;
|
|
2559
|
+
const styleProps = styleState.styleProps;
|
|
2560
|
+
const { variants } = staticConfig;
|
|
2561
|
+
if (!variants) return;
|
|
2562
|
+
const variant = variants[key];
|
|
2563
|
+
let variantValue = getVariantDefinition(variant, value, conf, styleState);
|
|
2564
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
2565
|
+
console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`);
|
|
2566
|
+
console.info({
|
|
2567
|
+
key,
|
|
2568
|
+
value,
|
|
2569
|
+
variantValue,
|
|
2570
|
+
variants
|
|
2571
|
+
});
|
|
2572
|
+
console.groupEnd();
|
|
2573
|
+
}
|
|
2574
|
+
if (!variantValue) {
|
|
2575
|
+
if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1") {
|
|
2576
|
+
if (typeof value !== "boolean") {
|
|
2577
|
+
const name = styleState.styleProps.displayName || "[UnnamedComponent]";
|
|
2578
|
+
console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2583
|
+
if (typeof variantValue === "function") {
|
|
2584
|
+
const fn = variantValue;
|
|
2585
|
+
const extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
|
|
2586
|
+
variantValue = fn(value, extras);
|
|
2587
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && true) {
|
|
2588
|
+
console.groupCollapsed(" expanded functional variant", key);
|
|
2589
|
+
console.info({
|
|
2590
|
+
fn,
|
|
2591
|
+
variantValue,
|
|
2592
|
+
extras
|
|
2593
|
+
});
|
|
2594
|
+
console.groupEnd();
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
if (!(0, import_isObj2.isObj)(variantValue)) return;
|
|
2598
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") console.info(` expanding styles from `, variantValue);
|
|
2599
|
+
const { noSkip } = styleProps;
|
|
2600
|
+
const originals = import_styleOriginalValues.styleOriginalValues.get(variantValue);
|
|
2601
|
+
const directState = styleState;
|
|
2602
|
+
directState.flatCompoundOutputDepth = (directState.flatCompoundOutputDepth || 0) + 1;
|
|
2603
|
+
try {
|
|
2604
|
+
for (const outputKey in variantValue) {
|
|
2605
|
+
if (!noSkip && outputKey in import_skipProps.skipProps) continue;
|
|
2606
|
+
const rawOutputValue = variantValue[outputKey];
|
|
2607
|
+
const outputValue = styleProps.noNormalize ? rawOutputValue : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(rawOutputValue, conf.shorthands[outputKey] || outputKey);
|
|
2608
|
+
const originalValue = originals?.[outputKey] ?? rawOutputValue;
|
|
2609
|
+
if (getContextPropSet(staticConfig)?.has(outputKey)) {
|
|
2610
|
+
styleState.overriddenContextProps ||= {};
|
|
2611
|
+
styleState.overriddenContextProps[outputKey] = originalValue;
|
|
2612
|
+
styleState.originalContextPropValues ||= {};
|
|
2613
|
+
styleState.originalContextPropValues[outputKey] = originalValue;
|
|
2614
|
+
}
|
|
2615
|
+
contributeMappedValue(outputKey, outputValue, styleState, parentVariantKey === key && outputKey === key, conditionCursor || void 0, originalValue);
|
|
2616
|
+
}
|
|
2617
|
+
} finally {
|
|
2618
|
+
directState.flatCompoundOutputDepth--;
|
|
2619
|
+
}
|
|
834
2620
|
}
|
|
835
|
-
function
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
2621
|
+
function getFontFamilyFromNameOrVariable(input, conf) {
|
|
2622
|
+
if ((0, import_createVariable.isVariable)(input)) {
|
|
2623
|
+
const val = variableToFontNameCache.get(input);
|
|
2624
|
+
if (val) return val;
|
|
2625
|
+
for (const key in conf.fontsParsed) {
|
|
2626
|
+
const familyVariable = conf.fontsParsed[key].family;
|
|
2627
|
+
if ((0, import_createVariable.isVariable)(familyVariable)) {
|
|
2628
|
+
variableToFontNameCache.set(familyVariable, key);
|
|
2629
|
+
if (familyVariable === input) return key;
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
} else if (typeof input === "string" && input in conf.fontsParsed) return input;
|
|
2633
|
+
}
|
|
2634
|
+
const variableToFontNameCache = /* @__PURE__ */ new WeakMap();
|
|
2635
|
+
function getVariantDefinition(variant, value, conf, { theme }) {
|
|
2636
|
+
if (!variant) return;
|
|
2637
|
+
if (value === void 0) return;
|
|
2638
|
+
if (typeof variant === "function") return variant;
|
|
2639
|
+
if (Object.prototype.hasOwnProperty.call(variant, value)) return variant[value];
|
|
2640
|
+
for (const { key, parts } of getCompiledVariantResolvers(variant)) for (const part of parts) if (matchesVariantResolver(part, value, conf, theme)) return variant[key];
|
|
2641
|
+
}
|
|
2642
|
+
const variantResolverNameSet = new Set(import_types.variantResolverNames);
|
|
2643
|
+
const variantResolverCache = /* @__PURE__ */ new WeakMap();
|
|
2644
|
+
const preparedStyleStaticConfigs = /* @__PURE__ */ new WeakSet();
|
|
2645
|
+
function prepareStyleStaticConfig(staticConfig) {
|
|
2646
|
+
if (preparedStyleStaticConfigs.has(staticConfig)) return staticConfig;
|
|
2647
|
+
preparedStyleStaticConfigs.add(staticConfig);
|
|
2648
|
+
getContextPropSet(staticConfig);
|
|
2649
|
+
prepareStaticConfigCompounds(staticConfig);
|
|
2650
|
+
const variants = staticConfig.variants;
|
|
2651
|
+
if (variants) for (const key in variants) {
|
|
2652
|
+
const variant = variants[key];
|
|
2653
|
+
if (variant && typeof variant === "object") getCompiledVariantResolvers(variant);
|
|
2654
|
+
}
|
|
2655
|
+
return staticConfig;
|
|
2656
|
+
}
|
|
2657
|
+
function getCompiledVariantResolvers(variant) {
|
|
2658
|
+
let cached = variantResolverCache.get(variant);
|
|
2659
|
+
if (cached) return cached;
|
|
2660
|
+
const compiled = [];
|
|
2661
|
+
for (const key in variant) {
|
|
2662
|
+
const parts = parseVariantResolverKey(key);
|
|
2663
|
+
if (parts) compiled.push({
|
|
2664
|
+
key,
|
|
2665
|
+
parts
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
variantResolverCache.set(variant, compiled);
|
|
2669
|
+
return compiled;
|
|
2670
|
+
}
|
|
2671
|
+
function parseVariantResolverKey(key) {
|
|
2672
|
+
if (!key) return null;
|
|
2673
|
+
const parts = [];
|
|
2674
|
+
let start = 0;
|
|
2675
|
+
for (let index = 0; index <= key.length; index++) {
|
|
2676
|
+
if (index !== key.length && key.charCodeAt(index) !== 124) continue;
|
|
2677
|
+
let partStart = start;
|
|
2678
|
+
let partEnd = index;
|
|
2679
|
+
while (partStart < partEnd && key.charCodeAt(partStart) <= 32) partStart++;
|
|
2680
|
+
while (partEnd > partStart && key.charCodeAt(partEnd - 1) <= 32) partEnd--;
|
|
2681
|
+
if (partStart === partEnd) return null;
|
|
2682
|
+
const part = key.slice(partStart, partEnd);
|
|
2683
|
+
if (!variantResolverNameSet.has(part)) return null;
|
|
2684
|
+
parts.push(part);
|
|
2685
|
+
start = index + 1;
|
|
2686
|
+
}
|
|
2687
|
+
return parts;
|
|
2688
|
+
}
|
|
2689
|
+
function hasNumericPrefix(value, suffixLength) {
|
|
2690
|
+
if (value.length <= suffixLength) return false;
|
|
2691
|
+
return Number.isFinite(Number(value.slice(0, value.length - suffixLength)));
|
|
2692
|
+
}
|
|
2693
|
+
function matchesVariantResolver(resolverName, value, conf, theme) {
|
|
2694
|
+
const string = typeof value === "string";
|
|
2695
|
+
const number = typeof value === "number";
|
|
2696
|
+
const rem = string && value.endsWith("rem") && hasNumericPrefix(value, 3);
|
|
2697
|
+
switch (resolverName) {
|
|
2698
|
+
case "Size":
|
|
2699
|
+
case "Space":
|
|
2700
|
+
case "Radius":
|
|
2701
|
+
case "ZIndex": return value === true || number || string || resolverName !== "Size" && (0, import_createVariable.isVariable)(value);
|
|
2702
|
+
case "Color": return value != null && value in conf.tokensParsed.color || string;
|
|
2703
|
+
case "Theme": return string && !!theme && value in theme;
|
|
2704
|
+
case "FontSize": return value === true || !!conf.fontsParsed.body?.size?.[value] || number || rem;
|
|
2705
|
+
case "FontStyle": return !!conf.fontsParsed.body?.style?.[value] || value === "normal" || value === "italic";
|
|
2706
|
+
case "FontTransform": return !!conf.fontsParsed.body?.transform?.[value] || value === "none" || value === "capitalize" || value === "uppercase" || value === "lowercase";
|
|
2707
|
+
case "FontLineHeight": return !!conf.fontsParsed.body?.lineHeight?.[value] || number || rem;
|
|
2708
|
+
case "FontLetterSpacing": return !!conf.fontsParsed.body?.letterSpacing?.[value] || number || rem;
|
|
2709
|
+
case "number":
|
|
2710
|
+
case "string":
|
|
2711
|
+
case "boolean": return typeof value === resolverName;
|
|
2712
|
+
case "any": return true;
|
|
841
2713
|
}
|
|
842
|
-
if (import_constants.isWeb && Array.isArray(out.transform)) out.transform = (0, import_transformsToString.transformsToString)(out.transform);
|
|
843
|
-
(0, import_expandStyles.fixStyles)(out);
|
|
844
|
-
return out;
|
|
845
2714
|
}
|