@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,929 +0,0 @@
|
|
|
1
|
-
import { isAndroid, isIos, isTV, isWeb, supportsDynamicColorIOS } from "@tamagui/constants";
|
|
2
|
-
import { StyleObjectIdentifier, StyleObjectRules, nonAnimatableStyleProps, tokenCategories } from "@tamagui/helpers";
|
|
3
|
-
import { canonicalStateModifierNames, isContainerSizeQueryText, isModifierName, modifierKindMedia, modifierKindPlatform, modifierKindState, modifierKindTheme, scanFlatValue, stateModifierSelectors } from "@tamagui/style-grammar/runtime";
|
|
4
|
-
import { isVariable } from "../createVariable.mjs";
|
|
5
|
-
import { mediaKeyMatch } from "../hooks/useMedia.mjs";
|
|
6
|
-
import { warnOnce, warnRefusedValue } from "./warnOnce.mjs";
|
|
7
|
-
import { expandStyle } from "./expandStyle.mjs";
|
|
8
|
-
import { getCSSStyleAtomic } from "./getCSSStylesAtomic.mjs";
|
|
9
|
-
import { getConfigRevisionState } from "./grammarConfig.mjs";
|
|
10
|
-
import { isColorStyleKey } from "./getDynamicVal.mjs";
|
|
11
|
-
import { shouldInsertStyleRules, updateRules } from "./insertStyleRule.mjs";
|
|
12
|
-
import { normalizeColor } from "./normalizeColor.mjs";
|
|
13
|
-
import { getTokenCategoryForProperty, tokenCategoryByProperty } from "./tokenCategories.mjs";
|
|
14
|
-
import { resolveSafeAreaVariable } from "./resolveSafeAreaVariable.mjs";
|
|
15
|
-
import { expandSafeAreaValue, isSafeAreaKey } from "./resolveSafeArea.mjs";
|
|
16
|
-
import { resolveVariableValue } from "./resolveVariableValue.mjs";
|
|
17
|
-
import { THEME_REF_PREFIX } from "./themeRef.mjs";
|
|
18
|
-
import { transformsToString } from "./transformsToString.mjs";
|
|
19
|
-
|
|
20
|
-
const directStyleHandler = {
|
|
21
|
-
segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid, chainCount, _result, failure, failureIndex, property, merge, originalValue, contextOnly) {
|
|
22
|
-
if (isBase) {
|
|
23
|
-
if (start === end) return;
|
|
24
|
-
if (!valid) {
|
|
25
|
-
if (process.env.NODE_ENV === "development") 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 \"(\"");
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const value = source.slice(start, end);
|
|
29
|
-
emitValue(state, property, value, 0, "", void 0, "", "", merge, value, contextOnly);
|
|
30
|
-
return 5;
|
|
31
|
-
}
|
|
32
|
-
if (!chainValid) {
|
|
33
|
-
if (process.env.NODE_ENV === "development") 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 \"(\"");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (start === end) {
|
|
37
|
-
if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, "a conditional clause has no value");
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (property === "aspectRatio" && chainCount === 1) {
|
|
41
|
-
const left = Number(source.slice(chainStart, chainEnd));
|
|
42
|
-
const right = Number(source.slice(start, end));
|
|
43
|
-
if (chainStart < chainEnd && Number.isFinite(left) && left > 0 && Number.isFinite(right) && right > 0) return 12;
|
|
44
|
-
}
|
|
45
|
-
const condition = resolveClauseChain(state, source, chainStart, chainEnd, property, void 0, valid ? merge : void 0, void 0, contextOnly, start, end, 1);
|
|
46
|
-
if (!condition) return;
|
|
47
|
-
if (!valid) {
|
|
48
|
-
if (process.env.NODE_ENV === "development") 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 \"(\"");
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
return 4 | (condition & 12 ? 2 : 0);
|
|
52
|
-
},
|
|
53
|
-
chain() {
|
|
54
|
-
return true;
|
|
55
|
-
},
|
|
56
|
-
end(state, source, result, lastPayloadStart, chainCount, property, merge, originalValue, contextOnly) {
|
|
57
|
-
let hasBase = !!(result & 1);
|
|
58
|
-
if (result & 8 && chainCount === 1) {
|
|
59
|
-
emitValue(state, property, source, 0, "", void 0, "", "", merge, originalValue ?? source, contextOnly);
|
|
60
|
-
hasBase = true;
|
|
61
|
-
}
|
|
62
|
-
if (process.env.NODE_ENV === "development" && !hasBase && result & 4 && (property in tokenCategories.color || property in tokenCategoryByProperty) && splitComponents(source.slice(lastPayloadStart)).length > 1) warnOnce(`${property}="${source}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
63
|
-
if ((!isWeb || !state.flatShouldDoClasses) && result & 2 && !hasBase) {
|
|
64
|
-
const value = implicitLifecycleBase(property);
|
|
65
|
-
if (value !== null) emitValue(state, property, value, 0, "", void 0, "", "", merge, value, contextOnly);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
function implicitLifecycleBase(property) {
|
|
70
|
-
return property === "opacity" || property === "scale" || property === "scaleX" || property === "scaleY" ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
|
|
71
|
-
}
|
|
72
|
-
const legacyTransformParts = /* @__PURE__ */ new Set([
|
|
73
|
-
"matrix",
|
|
74
|
-
"perspective",
|
|
75
|
-
"rotateX",
|
|
76
|
-
"rotateY",
|
|
77
|
-
"rotateZ",
|
|
78
|
-
"scaleZ",
|
|
79
|
-
"skewX",
|
|
80
|
-
"skewY"
|
|
81
|
-
]);
|
|
82
|
-
const webShadowParts = /* @__PURE__ */ new Set([
|
|
83
|
-
"shadowColor",
|
|
84
|
-
"shadowOffset",
|
|
85
|
-
"shadowOpacity",
|
|
86
|
-
"shadowRadius"
|
|
87
|
-
]);
|
|
88
|
-
const webTextShadowParts = /* @__PURE__ */ new Set([
|
|
89
|
-
"textShadowColor",
|
|
90
|
-
"textShadowOffset",
|
|
91
|
-
"textShadowRadius"
|
|
92
|
-
]);
|
|
93
|
-
const lineStyles = /* @__PURE__ */ new Set([
|
|
94
|
-
"none",
|
|
95
|
-
"hidden",
|
|
96
|
-
"dotted",
|
|
97
|
-
"dashed",
|
|
98
|
-
"solid",
|
|
99
|
-
"double",
|
|
100
|
-
"groove",
|
|
101
|
-
"ridge",
|
|
102
|
-
"inset",
|
|
103
|
-
"outset"
|
|
104
|
-
]);
|
|
105
|
-
const borderTargets = {
|
|
106
|
-
border: {
|
|
107
|
-
width: [
|
|
108
|
-
"borderTopWidth",
|
|
109
|
-
"borderRightWidth",
|
|
110
|
-
"borderBottomWidth",
|
|
111
|
-
"borderLeftWidth"
|
|
112
|
-
],
|
|
113
|
-
style: [
|
|
114
|
-
"borderTopStyle",
|
|
115
|
-
"borderRightStyle",
|
|
116
|
-
"borderBottomStyle",
|
|
117
|
-
"borderLeftStyle"
|
|
118
|
-
],
|
|
119
|
-
color: [
|
|
120
|
-
"borderTopColor",
|
|
121
|
-
"borderRightColor",
|
|
122
|
-
"borderBottomColor",
|
|
123
|
-
"borderLeftColor"
|
|
124
|
-
]
|
|
125
|
-
},
|
|
126
|
-
borderTop: {
|
|
127
|
-
width: ["borderTopWidth"],
|
|
128
|
-
style: ["borderTopStyle"],
|
|
129
|
-
color: ["borderTopColor"]
|
|
130
|
-
},
|
|
131
|
-
borderRight: {
|
|
132
|
-
width: ["borderRightWidth"],
|
|
133
|
-
style: ["borderRightStyle"],
|
|
134
|
-
color: ["borderRightColor"]
|
|
135
|
-
},
|
|
136
|
-
borderBottom: {
|
|
137
|
-
width: ["borderBottomWidth"],
|
|
138
|
-
style: ["borderBottomStyle"],
|
|
139
|
-
color: ["borderBottomColor"]
|
|
140
|
-
},
|
|
141
|
-
borderLeft: {
|
|
142
|
-
width: ["borderLeftWidth"],
|
|
143
|
-
style: ["borderLeftStyle"],
|
|
144
|
-
color: ["borderLeftColor"]
|
|
145
|
-
},
|
|
146
|
-
outline: {
|
|
147
|
-
width: ["outlineWidth"],
|
|
148
|
-
style: ["outlineStyle"],
|
|
149
|
-
color: ["outlineColor"]
|
|
150
|
-
},
|
|
151
|
-
borderBlock: {
|
|
152
|
-
width: ["borderBlockStartWidth", "borderBlockEndWidth"],
|
|
153
|
-
style: ["borderBlockStartStyle", "borderBlockEndStyle"],
|
|
154
|
-
color: ["borderBlockStartColor", "borderBlockEndColor"]
|
|
155
|
-
},
|
|
156
|
-
borderInline: {
|
|
157
|
-
width: ["borderInlineStartWidth", "borderInlineEndWidth"],
|
|
158
|
-
style: ["borderInlineStartStyle", "borderInlineEndStyle"],
|
|
159
|
-
color: ["borderInlineStartColor", "borderInlineEndColor"]
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
const borderStyleDefaults = {
|
|
163
|
-
borderWidth: "borderStyle",
|
|
164
|
-
borderTopWidth: "borderTopStyle",
|
|
165
|
-
borderRightWidth: "borderRightStyle",
|
|
166
|
-
borderBottomWidth: "borderBottomStyle",
|
|
167
|
-
borderLeftWidth: "borderLeftStyle"
|
|
168
|
-
};
|
|
169
|
-
function platformMatches(name) {
|
|
170
|
-
if (name === "web") return isWeb;
|
|
171
|
-
if (name === "native") return !isWeb;
|
|
172
|
-
if (name === "ios") return isIos;
|
|
173
|
-
if (name === "android") return isAndroid;
|
|
174
|
-
if (name === "tvos") return isIos && isTV;
|
|
175
|
-
if (name === "androidtv") return isAndroid && isTV;
|
|
176
|
-
return name === "tv" && isTV;
|
|
177
|
-
}
|
|
178
|
-
function resolveClauseChain(state, source, start, end, property, raw, merge, originalValue, contextOnly = false, payloadStart = -1, payloadEnd = -1, warning = 0) {
|
|
179
|
-
const compiled = getConfigRevisionState(state.conf);
|
|
180
|
-
const sourceStart = start;
|
|
181
|
-
let key = "";
|
|
182
|
-
let active = true;
|
|
183
|
-
let emit = true;
|
|
184
|
-
let selector = "";
|
|
185
|
-
let wrappers;
|
|
186
|
-
let theme = "";
|
|
187
|
-
let enter = false;
|
|
188
|
-
let exit = false;
|
|
189
|
-
let unsupportedState = "";
|
|
190
|
-
let platformRank = 0;
|
|
191
|
-
let depth = 0;
|
|
192
|
-
let categoryRank = 0;
|
|
193
|
-
let withinRank = 0;
|
|
194
|
-
let selfStateSpecificity = 0;
|
|
195
|
-
for (let index = start; index <= end; index++) {
|
|
196
|
-
if (index !== end && source.charCodeAt(index) !== 58) continue;
|
|
197
|
-
let modifier = source.slice(start, index);
|
|
198
|
-
start = index + 1;
|
|
199
|
-
let code = compiled.modifiers[modifier];
|
|
200
|
-
let kind = code & 7;
|
|
201
|
-
let rank = code >> 3;
|
|
202
|
-
let stateSelector = "";
|
|
203
|
-
let conditionStateName = "";
|
|
204
|
-
let groupName = "";
|
|
205
|
-
let containerSize = "";
|
|
206
|
-
let containerName = "";
|
|
207
|
-
let containerQuery = "";
|
|
208
|
-
if (kind === modifierKindState) {
|
|
209
|
-
modifier = canonicalStateModifierNames[rank];
|
|
210
|
-
stateSelector = stateModifierSelectors[rank];
|
|
211
|
-
} else if (!kind && modifier.startsWith("group-")) {
|
|
212
|
-
const slash = modifier.indexOf("/");
|
|
213
|
-
const authoredState = modifier.slice(6, slash === -1 ? void 0 : slash);
|
|
214
|
-
code = compiled.modifiers[authoredState];
|
|
215
|
-
if ((code & 7) !== modifierKindState) kind = 0;
|
|
216
|
-
else {
|
|
217
|
-
rank = code >> 3;
|
|
218
|
-
groupName = slash === -1 ? "true" : modifier.slice(slash + 1);
|
|
219
|
-
if (rank === 6 || rank === 7 || slash !== -1 && !isModifierName(groupName, 0, groupName.length)) kind = 0;
|
|
220
|
-
else {
|
|
221
|
-
kind = 5;
|
|
222
|
-
const stateName = canonicalStateModifierNames[rank];
|
|
223
|
-
conditionStateName = stateName;
|
|
224
|
-
stateSelector = stateModifierSelectors[rank];
|
|
225
|
-
modifier = `group-${stateName}${slash === -1 ? "" : modifier.slice(slash)}`;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
} else if (!kind && modifier.charCodeAt(0) === 64) {
|
|
229
|
-
const slash = modifier.indexOf("/");
|
|
230
|
-
containerSize = modifier.slice(1, slash === -1 ? void 0 : slash);
|
|
231
|
-
containerName = slash === -1 ? "" : modifier.slice(slash + 1);
|
|
232
|
-
if (isModifierName(containerSize, 0, containerSize.length) && (slash === -1 || isModifierName(containerName, 0, containerName.length)) && ((code = compiled.modifiers[containerSize]) & 7) === modifierKindMedia && (containerQuery = compiled.mediaQueries[containerSize]) && isContainerSizeQueryText(containerQuery)) {
|
|
233
|
-
kind = 6;
|
|
234
|
-
rank = code >> 3;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
if (!kind) {
|
|
238
|
-
if (warning && process.env.NODE_ENV === "development") warnRefusedValue(property, warning === 1 ? source : raw, `unknown modifier "${source.slice(sourceStart, end)}"`);
|
|
239
|
-
return 0;
|
|
240
|
-
}
|
|
241
|
-
let slotStart = 0;
|
|
242
|
-
let duplicate = false;
|
|
243
|
-
let inserted = !key;
|
|
244
|
-
if (!key) key = modifier;
|
|
245
|
-
else {
|
|
246
|
-
while (slotStart <= key.length) {
|
|
247
|
-
let slotEnd = key.indexOf(":", slotStart);
|
|
248
|
-
if (slotEnd === -1) slotEnd = key.length;
|
|
249
|
-
let order = 0;
|
|
250
|
-
const compareLength = Math.min(modifier.length, slotEnd - slotStart);
|
|
251
|
-
for (let offset = 0; offset < compareLength; offset++) {
|
|
252
|
-
order = modifier.charCodeAt(offset) - key.charCodeAt(slotStart + offset);
|
|
253
|
-
if (order) break;
|
|
254
|
-
}
|
|
255
|
-
order ||= modifier.length - (slotEnd - slotStart);
|
|
256
|
-
if (!order) {
|
|
257
|
-
duplicate = true;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
if (order < 0) {
|
|
261
|
-
key = `${key.slice(0, slotStart)}${modifier}:${key.slice(slotStart)}`;
|
|
262
|
-
inserted = true;
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
if (slotEnd === key.length) break;
|
|
266
|
-
slotStart = slotEnd + 1;
|
|
267
|
-
}
|
|
268
|
-
if (!duplicate && !inserted) key += `:${modifier}`;
|
|
269
|
-
}
|
|
270
|
-
if (duplicate) continue;
|
|
271
|
-
if (kind === modifierKindPlatform) {
|
|
272
|
-
if (rank > platformRank) platformRank = rank;
|
|
273
|
-
const matches = platformMatches(modifier);
|
|
274
|
-
active &&= matches;
|
|
275
|
-
emit &&= matches;
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
depth++;
|
|
279
|
-
const nextCategory = kind === modifierKindMedia ? 0 : kind === 6 ? 1 : kind === modifierKindTheme ? 2 : kind === 5 ? 3 : 4;
|
|
280
|
-
if (nextCategory > categoryRank) {
|
|
281
|
-
categoryRank = nextCategory;
|
|
282
|
-
withinRank = rank;
|
|
283
|
-
} else if (nextCategory === categoryRank && rank > withinRank) withinRank = rank;
|
|
284
|
-
if (kind === modifierKindMedia) {
|
|
285
|
-
const query = compiled.mediaQueries[modifier];
|
|
286
|
-
if (!query) return 0;
|
|
287
|
-
(wrappers ||= []).push(`@media ${query}`);
|
|
288
|
-
active &&= !!state.flatMediaState?.[modifier];
|
|
289
|
-
(state.flatMediaKeys ||= /* @__PURE__ */ new Set()).add(modifier);
|
|
290
|
-
} else if (kind === modifierKindTheme) {
|
|
291
|
-
theme = modifier;
|
|
292
|
-
selector += `:where(.t_${modifier}, .t_${modifier} *)`;
|
|
293
|
-
active &&= state.flatThemeName === modifier || state.flatThemeName?.startsWith(`${modifier}_`) === true;
|
|
294
|
-
} else if (kind === 5) {
|
|
295
|
-
selector += `:where(.t_group_${groupName}${stateSelector} *)`;
|
|
296
|
-
if (rank === 0) (wrappers ||= []).push("@media (hover: hover)");
|
|
297
|
-
const component = state.componentState.group?.[groupName];
|
|
298
|
-
const context = state.flatGroupContext?.[groupName];
|
|
299
|
-
active &&= !!(component?.pseudo ?? context?.state.pseudo)?.[conditionStateName];
|
|
300
|
-
(state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupName);
|
|
301
|
-
} else if (kind === 6) {
|
|
302
|
-
const groupKey = `@${containerName}`;
|
|
303
|
-
(wrappers ||= []).push(containerName ? `@container ${containerName} ${containerQuery}` : `@container ${containerQuery}`);
|
|
304
|
-
const component = state.componentState.group?.[groupKey];
|
|
305
|
-
const context = state.flatGroupContext?.[groupKey];
|
|
306
|
-
const match = component?.media?.[containerSize];
|
|
307
|
-
active &&= match === void 0 ? !!(context?.state.layout && mediaKeyMatch(containerSize, context.state.layout)) : !!match;
|
|
308
|
-
(state.flatGroupKeys ||= /* @__PURE__ */ new Set()).add(groupKey);
|
|
309
|
-
(state.flatGroupMedia ||= /* @__PURE__ */ new Set()).add(containerSize);
|
|
310
|
-
} else {
|
|
311
|
-
selfStateSpecificity++;
|
|
312
|
-
if (!isWeb && stateSelector[0] === "[" && modifier !== "disabled") unsupportedState = modifier;
|
|
313
|
-
if (stateSelector[0] === ".") {
|
|
314
|
-
selector += `:is(${stateSelector}, ${stateSelector} *)`;
|
|
315
|
-
if (rank === 6) enter = true;
|
|
316
|
-
else exit = true;
|
|
317
|
-
} else selector += stateSelector;
|
|
318
|
-
if (rank === 0) (wrappers ||= []).push("@media (hover: hover)");
|
|
319
|
-
const component = state.componentState;
|
|
320
|
-
active &&= 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;
|
|
321
|
-
if (stateSelector[0] === ":") (state.flatStateKeys ||= /* @__PURE__ */ new Set()).add(modifier);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
if (depth > 5) throw new Error(`a flat value clause supports at most 5 non-platform conditions; received ${depth} in "${source.slice(sourceStart, end)}:"`);
|
|
325
|
-
const condition = (platformRank << 26 | depth << 23 | categoryRank << 20 | withinRank) * 256 + selfStateSpecificity * 32 + 16 + (active ? 1 : 0) + (emit ? 2 : 0) + (enter ? 4 : 0) + (exit ? 8 : 0);
|
|
326
|
-
if (warning && unsupportedState && process.env.NODE_ENV === "development") warnOnce(`${property}: "${unsupportedState}:" has no native component-state source; dropping the clause`);
|
|
327
|
-
if (merge && property && condition & 2 && (condition & 1 || isWeb && state.flatShouldDoClasses || warning === 1 && !isWeb && theme && supportsDynamicColorIOS && isColorStyleKey(property))) {
|
|
328
|
-
const value = payloadStart === -1 ? raw : source.slice(payloadStart, payloadEnd);
|
|
329
|
-
emitValue(state, property, value, condition, key, wrappers, selector, theme, merge, warning === 2 ? originalValue : originalValue ?? value, contextOnly);
|
|
330
|
-
}
|
|
331
|
-
return condition;
|
|
332
|
-
}
|
|
333
|
-
const tokenLookup = {
|
|
334
|
-
value: void 0,
|
|
335
|
-
fromTheme: false,
|
|
336
|
-
themeKey: ""
|
|
337
|
-
};
|
|
338
|
-
function fillTokenLookup(value, fromTheme, themeKey) {
|
|
339
|
-
tokenLookup.value = value;
|
|
340
|
-
tokenLookup.fromTheme = fromTheme;
|
|
341
|
-
tokenLookup.themeKey = themeKey;
|
|
342
|
-
return tokenLookup;
|
|
343
|
-
}
|
|
344
|
-
function tokenVariable(state, property, name) {
|
|
345
|
-
let lookupName = name.charCodeAt(0) === 36 ? name.slice(1) : name;
|
|
346
|
-
if (property === "fontFamily") {
|
|
347
|
-
const family = state.conf.fontsParsed[lookupName]?.family;
|
|
348
|
-
return family ? fillTokenLookup(family, false, lookupName) : void 0;
|
|
349
|
-
}
|
|
350
|
-
const fontKey = property === "fontSize" ? "size" : property === "fontWeight" ? "weight" : property === "lineHeight" || property === "letterSpacing" ? property : void 0;
|
|
351
|
-
if (fontKey) {
|
|
352
|
-
const value = (state.conf.fontsParsed[state.fontFamily || state.conf.defaultFontToken] || state.conf.fontsParsed[state.conf.defaultFontToken])?.[fontKey]?.[lookupName];
|
|
353
|
-
return value ? fillTokenLookup(value, false, lookupName) : void 0;
|
|
354
|
-
}
|
|
355
|
-
const category = getTokenCategoryForProperty(property);
|
|
356
|
-
const dot = lookupName.indexOf(".");
|
|
357
|
-
if (dot !== -1) {
|
|
358
|
-
const prefix = lookupName.slice(0, dot);
|
|
359
|
-
if (!category || prefix === category || prefix === "color") lookupName = lookupName.slice(dot + 1);
|
|
360
|
-
}
|
|
361
|
-
if (category) {
|
|
362
|
-
const own = state.conf.tokensParsed[category]?.[lookupName];
|
|
363
|
-
if (own) return fillTokenLookup(own, false, lookupName);
|
|
364
|
-
for (const sibling of [
|
|
365
|
-
"color",
|
|
366
|
-
"space",
|
|
367
|
-
"size",
|
|
368
|
-
"radius",
|
|
369
|
-
"zIndex"
|
|
370
|
-
]) if (sibling !== category && state.conf.tokensParsed[sibling]?.[lookupName]) return;
|
|
371
|
-
} else {
|
|
372
|
-
const first = lookupName.charCodeAt(0);
|
|
373
|
-
if (first >= 48 && first <= 57 || first === 43 || first === 45 || first === 46) return;
|
|
374
|
-
}
|
|
375
|
-
const theme = state.theme?.[lookupName] || state.conf.themes?.[state.flatThemeName || ""]?.[lookupName];
|
|
376
|
-
if (theme) return fillTokenLookup(theme, true, lookupName);
|
|
377
|
-
if (category) return;
|
|
378
|
-
const token = state.conf.tokensParsed.space?.[lookupName] || state.conf.tokensParsed.color?.[lookupName];
|
|
379
|
-
return token ? fillTokenLookup(token, false, lookupName) : void 0;
|
|
380
|
-
}
|
|
381
|
-
function configuredValue(state, property, raw) {
|
|
382
|
-
let name = raw;
|
|
383
|
-
let opacity;
|
|
384
|
-
const slash = raw.lastIndexOf("/");
|
|
385
|
-
if (slash > 0) {
|
|
386
|
-
const amount = Number(raw.slice(slash + 1));
|
|
387
|
-
if (Number.isInteger(amount) && amount >= 0 && amount <= 100) {
|
|
388
|
-
name = raw.slice(0, slash);
|
|
389
|
-
opacity = amount;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
const safeArea = resolveSafeAreaVariable(name);
|
|
393
|
-
if (safeArea !== void 0) {
|
|
394
|
-
state.flatUsesSafeArea = true;
|
|
395
|
-
return safeArea;
|
|
396
|
-
}
|
|
397
|
-
const lookup = tokenVariable(state, property, name);
|
|
398
|
-
if (!lookup || !isVariable(lookup.value)) {
|
|
399
|
-
if (process.env.NODE_ENV === "development" && tokenCategoryByProperty[property] && state.conf.tokensParsed.color?.[name]) warnOnce(`"${name}" contributes to "color", not "${property}"; keeping it literal`);
|
|
400
|
-
return raw;
|
|
401
|
-
}
|
|
402
|
-
const resolveValues = isWeb && !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues;
|
|
403
|
-
if (resolveValues === "except-theme" && lookup.fromTheme) return `${THEME_REF_PREFIX}${lookup.themeKey}${opacity !== void 0 ? `/${opacity}` : ""}`;
|
|
404
|
-
let value = resolveVariableValue(property, lookup.value, resolveValues);
|
|
405
|
-
if (opacity !== void 0) value = isWeb ? `color-mix(in srgb, ${value} ${opacity}%, transparent)` : normalizeColor(value, opacity / 100);
|
|
406
|
-
return value;
|
|
407
|
-
}
|
|
408
|
-
const letterFreeCallPattern = /^[A-Za-z-]+\([^A-Za-z]*\)$/;
|
|
409
|
-
function resolveEmbeddedTokens(state, property, raw) {
|
|
410
|
-
if (letterFreeCallPattern.test(raw)) return raw;
|
|
411
|
-
return raw.replace(/[$A-Za-z_][\w.$-]*(?:\/\d+)?/g, (word, index) => {
|
|
412
|
-
if (word.charCodeAt(0) !== 36) {
|
|
413
|
-
const before = raw.charCodeAt(index - 1);
|
|
414
|
-
if (before >= 48 && before <= 57 || before === 35 || before === 45 && raw.charCodeAt(index - 2) === 45 || raw.charCodeAt(index + word.length) === 40) return word;
|
|
415
|
-
}
|
|
416
|
-
const value = configuredValue(state, property, word);
|
|
417
|
-
return value === word ? word : String(value);
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
function normalizeTransitionNames(state, raw) {
|
|
421
|
-
let quote = 0;
|
|
422
|
-
let depth = 0;
|
|
423
|
-
let copyFrom = 0;
|
|
424
|
-
let out = "";
|
|
425
|
-
for (let index = 0; index < raw.length; index++) {
|
|
426
|
-
const code = raw.charCodeAt(index);
|
|
427
|
-
if (quote) {
|
|
428
|
-
if (code === 92) index++;
|
|
429
|
-
else if (code === quote) quote = 0;
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
if (code === 34 || code === 39) {
|
|
433
|
-
quote = code;
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
if (code === 40) {
|
|
437
|
-
depth++;
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
if (code === 41) {
|
|
441
|
-
depth--;
|
|
442
|
-
continue;
|
|
443
|
-
}
|
|
444
|
-
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;
|
|
445
|
-
let end = index + 1;
|
|
446
|
-
while (end < raw.length) {
|
|
447
|
-
const next = raw.charCodeAt(end);
|
|
448
|
-
if (next >= 48 && next <= 57 || next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 45 || next === 95) end++;
|
|
449
|
-
else break;
|
|
450
|
-
}
|
|
451
|
-
if (raw.charCodeAt(end) !== 40) {
|
|
452
|
-
const authored = raw.slice(index, end);
|
|
453
|
-
let property = state.conf.shorthands[authored] || authored;
|
|
454
|
-
if (property === "x" || property === "y") property = "translate";
|
|
455
|
-
else if (property === "scaleX" || property === "scaleY") property = "scale";
|
|
456
|
-
else if (legacyTransformParts.has(property)) property = "transform";
|
|
457
|
-
if (property !== authored || /[A-Z]/.test(property)) {
|
|
458
|
-
out += raw.slice(copyFrom, index);
|
|
459
|
-
out += property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
460
|
-
copyFrom = end;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
index = end - 1;
|
|
464
|
-
}
|
|
465
|
-
return copyFrom ? out + raw.slice(copyFrom) : raw;
|
|
466
|
-
}
|
|
467
|
-
function directStyleSignature(property, value, conditionKey = "") {
|
|
468
|
-
return `${property}${conditionKey}${String(value)}`;
|
|
469
|
-
}
|
|
470
|
-
function directAtomic(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector, isDefault = false) {
|
|
471
|
-
const atomics = state.flatAtomics ||= {};
|
|
472
|
-
const atomicKey = property.startsWith("transition") ? "transition" : property;
|
|
473
|
-
const existing = atomics[atomicKey];
|
|
474
|
-
const contribution = directStyleSignature(property, value, conditionKey);
|
|
475
|
-
const signature = existing ? existing.signature + contribution : contribution;
|
|
476
|
-
const next = getCSSStyleAtomic(property, value, conditionSelector, conditionWrappers, signature, 2, atomicKey, condition ? 1 + (Math.floor(condition / 256) >>> 23 & 7) + (Math.floor(condition / 256) >>> 26) * 6 - (condition >>> 5 & 7) : void 0);
|
|
477
|
-
if (!next) return;
|
|
478
|
-
const identifier = next[StyleObjectIdentifier];
|
|
479
|
-
const nextRules = next[StyleObjectRules];
|
|
480
|
-
const slotted = condition || atomicKey === "transition";
|
|
481
|
-
if (!existing) {
|
|
482
|
-
const atomic = {
|
|
483
|
-
baseRules: slotted ? 0 : nextRules.length,
|
|
484
|
-
conditions: void 0,
|
|
485
|
-
signature,
|
|
486
|
-
styleObject: next
|
|
487
|
-
};
|
|
488
|
-
if (slotted) atomic.conditions = { [atomicKey === "transition" ? `${conditionKey}\0${property}` : conditionKey]: {
|
|
489
|
-
count: nextRules.length,
|
|
490
|
-
index: 0,
|
|
491
|
-
precedence: condition ? Math.floor(condition / 256) : 0,
|
|
492
|
-
default: isDefault
|
|
493
|
-
} };
|
|
494
|
-
atomics[atomicKey] = atomic;
|
|
495
|
-
} else {
|
|
496
|
-
const previousIdentifier = existing.styleObject[StyleObjectIdentifier];
|
|
497
|
-
const rules = existing.styleObject[StyleObjectRules].slice();
|
|
498
|
-
existing.styleObject[StyleObjectRules] = rules;
|
|
499
|
-
if (!condition && !isDefault && existing.conditions) for (const key in existing.conditions) {
|
|
500
|
-
const entry = existing.conditions[key];
|
|
501
|
-
if (!entry.default) continue;
|
|
502
|
-
rules.splice(entry.index, entry.count);
|
|
503
|
-
delete existing.conditions[key];
|
|
504
|
-
for (const otherKey in existing.conditions) {
|
|
505
|
-
const other = existing.conditions[otherKey];
|
|
506
|
-
if (other.index > entry.index) other.index -= entry.count;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
if (previousIdentifier !== identifier) {
|
|
510
|
-
const oldSelector = `.${previousIdentifier}`;
|
|
511
|
-
const newSelector = `.${identifier}`;
|
|
512
|
-
for (let index = 0; index < rules.length; index++) rules[index] = rules[index].replaceAll(oldSelector, newSelector);
|
|
513
|
-
}
|
|
514
|
-
if (slotted) {
|
|
515
|
-
const slot = atomicKey === "transition" ? `${conditionKey}\0${property}` : conditionKey;
|
|
516
|
-
const previous = existing.conditions?.[slot];
|
|
517
|
-
if (previous) {
|
|
518
|
-
rules.splice(previous.index, previous.count);
|
|
519
|
-
if (existing.conditions) for (const key in existing.conditions) {
|
|
520
|
-
const entry = existing.conditions[key];
|
|
521
|
-
if (entry !== previous && entry.index > previous.index) entry.index -= previous.count;
|
|
522
|
-
}
|
|
523
|
-
delete existing.conditions[slot];
|
|
524
|
-
}
|
|
525
|
-
const precedence = condition ? Math.floor(condition / 256) : 0;
|
|
526
|
-
let insertionIndex = rules.length;
|
|
527
|
-
if (existing.conditions) {
|
|
528
|
-
for (const key in existing.conditions) {
|
|
529
|
-
const entry = existing.conditions[key];
|
|
530
|
-
if (entry.precedence > precedence && entry.index < insertionIndex) insertionIndex = entry.index;
|
|
531
|
-
}
|
|
532
|
-
for (const key in existing.conditions) {
|
|
533
|
-
const entry = existing.conditions[key];
|
|
534
|
-
if (entry.index >= insertionIndex) entry.index += nextRules.length;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
(existing.conditions ||= {})[slot] = {
|
|
538
|
-
count: nextRules.length,
|
|
539
|
-
index: insertionIndex,
|
|
540
|
-
precedence,
|
|
541
|
-
default: isDefault
|
|
542
|
-
};
|
|
543
|
-
rules.splice(insertionIndex, 0, ...nextRules);
|
|
544
|
-
} else {
|
|
545
|
-
const difference = nextRules.length - existing.baseRules;
|
|
546
|
-
rules.splice(0, existing.baseRules, ...nextRules);
|
|
547
|
-
if (difference && existing.conditions) for (const key in existing.conditions) existing.conditions[key].index += difference;
|
|
548
|
-
existing.baseRules = nextRules.length;
|
|
549
|
-
}
|
|
550
|
-
existing.signature = signature;
|
|
551
|
-
existing.styleObject[StyleObjectIdentifier] = identifier;
|
|
552
|
-
existing.styleObject[1] = next[1];
|
|
553
|
-
}
|
|
554
|
-
state.classNames[atomicKey] = identifier;
|
|
555
|
-
}
|
|
556
|
-
function emitBorderStyleDefault(state, property, condition, conditionKey, conditionWrappers, conditionSelector) {
|
|
557
|
-
if (!isWeb || !state.flatShouldDoClasses || state.styleProps.noNormalize === false) return;
|
|
558
|
-
const target = borderStyleDefaults[property];
|
|
559
|
-
if (!target) return;
|
|
560
|
-
const atomic = state.flatAtomics?.[target];
|
|
561
|
-
if (atomic?.baseRules || state.classNames[target] && !atomic || condition && atomic?.conditions?.[conditionKey]) return;
|
|
562
|
-
directAtomic(state, target, "solid", condition, conditionKey, conditionWrappers, conditionSelector, true);
|
|
563
|
-
}
|
|
564
|
-
function flushDirectStyles(state, clear = false) {
|
|
565
|
-
const direct = state;
|
|
566
|
-
const atomics = direct.flatAtomics;
|
|
567
|
-
if (!atomics) return;
|
|
568
|
-
for (const property in atomics) {
|
|
569
|
-
const styleObject = atomics[property].styleObject;
|
|
570
|
-
const identifier = styleObject[StyleObjectIdentifier];
|
|
571
|
-
if (shouldInsertStyleRules(identifier)) {
|
|
572
|
-
const rules = styleObject[StyleObjectRules].slice();
|
|
573
|
-
styleObject[StyleObjectRules] = rules;
|
|
574
|
-
updateRules(identifier, rules);
|
|
575
|
-
state.flatRulesToInsert[identifier] = styleObject;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
if (clear) direct.flatAtomics = void 0;
|
|
579
|
-
}
|
|
580
|
-
function getDirectDynamicThemeAccess(state) {
|
|
581
|
-
return state.flatDynamicThemeAccess;
|
|
582
|
-
}
|
|
583
|
-
function emitProperty(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly) {
|
|
584
|
-
const direct = state;
|
|
585
|
-
if (condition & 4) (state.flatEnterKeys ||= /* @__PURE__ */ new Set()).add(property);
|
|
586
|
-
if (condition & 8) (state.flatExitKeys ||= /* @__PURE__ */ new Set()).add(property);
|
|
587
|
-
if (!isWeb && conditionTheme) {
|
|
588
|
-
if (supportsDynamicColorIOS && isColorStyleKey(property)) {
|
|
589
|
-
const schemes = (direct.flatDynamicColors ||= {})[property] ||= {};
|
|
590
|
-
schemes[conditionTheme] = typeof originalValue === "string" && /^[a-z]+$/i.test(originalValue) ? originalValue : value;
|
|
591
|
-
merge(state, property, { dynamic: { ...schemes } }, 1, false, originalValue);
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
direct.flatDynamicThemeAccess = true;
|
|
595
|
-
}
|
|
596
|
-
if (contextOnly) {
|
|
597
|
-
if (!condition || condition & 1) (state.overriddenContextProps ||= {})[property] = originalValue;
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
const shouldPromoteAnimatedStyle = isWeb && !condition && !state.flatShouldDoClasses && !state.styleProps.noMergeStyle && state.styleProps.isAnimated && !state.animationDriver?.isReactNative && property in nonAnimatableStyleProps;
|
|
601
|
-
if (isWeb && (state.flatShouldDoClasses || shouldPromoteAnimatedStyle)) {
|
|
602
|
-
if (!condition) {
|
|
603
|
-
if (state.style) delete state.style[property];
|
|
604
|
-
}
|
|
605
|
-
directAtomic(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector);
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
if (condition) {
|
|
609
|
-
if (!(condition & 1)) return;
|
|
610
|
-
const precedence = Math.floor(condition / 256);
|
|
611
|
-
const previous = direct.flatPrecedence?.[property];
|
|
612
|
-
if (previous !== void 0 && precedence < previous) return;
|
|
613
|
-
(direct.flatPrecedence ||= {})[property] = precedence;
|
|
614
|
-
(state.flatActiveConditions ||= {})[property] = true;
|
|
615
|
-
} else if (state.flatActiveConditions?.[property]) return;
|
|
616
|
-
merge(state, property, value, 1, true, originalValue);
|
|
617
|
-
}
|
|
618
|
-
function splitComponents(value) {
|
|
619
|
-
const parts = [];
|
|
620
|
-
let start = 0;
|
|
621
|
-
let quote = 0;
|
|
622
|
-
let depth = 0;
|
|
623
|
-
for (let index = 0; index <= value.length; index++) {
|
|
624
|
-
const code = index === value.length ? 32 : value.charCodeAt(index);
|
|
625
|
-
if (quote) {
|
|
626
|
-
if (code === 92) index++;
|
|
627
|
-
else if (code === quote) quote = 0;
|
|
628
|
-
continue;
|
|
629
|
-
}
|
|
630
|
-
if (code === 34 || code === 39) quote = code;
|
|
631
|
-
else if (code === 40) depth++;
|
|
632
|
-
else if (code === 41) depth--;
|
|
633
|
-
else if (!depth && code <= 32) {
|
|
634
|
-
if (index > start) parts.push(value.slice(start, index));
|
|
635
|
-
start = index + 1;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
return parts;
|
|
639
|
-
}
|
|
640
|
-
function emitBorder(state, property, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly) {
|
|
641
|
-
if (!isWeb && (property === "borderBlock" || property === "borderInline")) {
|
|
642
|
-
if (process.env.NODE_ENV === "development") warnOnce(`RN has no logical border shorthand "${property}"; dropping it`);
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
const targets = borderTargets[property];
|
|
646
|
-
let width;
|
|
647
|
-
let style;
|
|
648
|
-
let color;
|
|
649
|
-
for (const part of splitComponents(raw)) {
|
|
650
|
-
const lower = part.toLowerCase();
|
|
651
|
-
if (lineStyles.has(lower) || property === "outline" && lower === "auto") style = part;
|
|
652
|
-
else if (lower === "thin" || lower === "medium" || lower === "thick" || /^-?(?:\d+\.?\d*|\.\d+)(?:[a-z%]+)?$/i.test(part) || /^(?:calc|var|min|max|clamp)\(/i.test(part)) width = part;
|
|
653
|
-
else color = part;
|
|
654
|
-
}
|
|
655
|
-
if (style === "none" && width === void 0) width = "0";
|
|
656
|
-
if (width !== void 0) for (const target of targets.width) emitResolved(state, target, width, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
657
|
-
if (style !== void 0) {
|
|
658
|
-
const styleTargets = !isWeb && property === "border" ? ["borderStyle"] : targets.style;
|
|
659
|
-
for (const target of styleTargets) emitProperty(state, target, style, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
660
|
-
}
|
|
661
|
-
if (color !== void 0) for (const target of targets.color) emitResolved(state, target, color, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
662
|
-
}
|
|
663
|
-
function emitTextDecoration(state, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly) {
|
|
664
|
-
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, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
665
|
-
}
|
|
666
|
-
function addComposition(state, property) {
|
|
667
|
-
if (state.classNames[property]) return;
|
|
668
|
-
const value = property === "translate" ? "var(--t-x, 0px) var(--t-y, 0px)" : "var(--t-scale-x, 1) var(--t-scale-y, 1)";
|
|
669
|
-
const defaults = property === "translate" ? "--t-x:0px;--t-y:0px" : "--t-scale-x:1;--t-scale-y:1";
|
|
670
|
-
const styleObject = getCSSStyleAtomic(property, value, "", void 0, void 0, true);
|
|
671
|
-
const identifier = styleObject[StyleObjectIdentifier];
|
|
672
|
-
styleObject[StyleObjectRules].unshift(`:where(.${identifier}){${defaults}}`);
|
|
673
|
-
if (shouldInsertStyleRules(identifier)) {
|
|
674
|
-
updateRules(identifier, styleObject[StyleObjectRules]);
|
|
675
|
-
state.flatRulesToInsert[identifier] = styleObject;
|
|
676
|
-
}
|
|
677
|
-
state.classNames[property] = identifier;
|
|
678
|
-
}
|
|
679
|
-
function emitTransform(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly) {
|
|
680
|
-
if (!isWeb || !state.flatShouldDoClasses) {
|
|
681
|
-
if (!isWeb && property === "scale") {
|
|
682
|
-
emitProperty(state, "scaleX", value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
683
|
-
emitProperty(state, "scaleY", value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
684
|
-
} else emitProperty(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
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"];
|
|
688
|
-
for (const target of targets) {
|
|
689
|
-
let targetValue = value;
|
|
690
|
-
if (typeof targetValue === "number") {
|
|
691
|
-
if (target === "--t-x" || target === "--t-y") targetValue = `${targetValue}px`;
|
|
692
|
-
else if (target === "rotate") targetValue = `${targetValue}deg`;
|
|
693
|
-
}
|
|
694
|
-
emitProperty(state, target, targetValue, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
695
|
-
if (target === "--t-x" || target === "--t-y") addComposition(state, "translate");
|
|
696
|
-
else if (target.startsWith("--t-scale")) addComposition(state, "scale");
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
function emitResolved(state, property, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly) {
|
|
700
|
-
let value = configuredValue(state, property, raw);
|
|
701
|
-
if (value === raw && /[\s,(]/.test(raw)) value = resolveEmbeddedTokens(state, property, raw);
|
|
702
|
-
if ((!isWeb || !state.flatShouldDoClasses) && typeof value === "string") {
|
|
703
|
-
if (/^-?(?:\d+\.?\d*|\.\d+)(?:px|dp)$/i.test(value)) value = Number.parseFloat(value);
|
|
704
|
-
else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
|
|
705
|
-
}
|
|
706
|
-
emitProperty(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
707
|
-
}
|
|
708
|
-
function shadowUnit(part) {
|
|
709
|
-
return typeof part === "number" ? `${part}px` : part || "0px";
|
|
710
|
-
}
|
|
711
|
-
function emitWebShadow(state, property, value, merge, originalValue, contextOnly) {
|
|
712
|
-
const shadow = state.flatWebShadow ||= {};
|
|
713
|
-
shadow[property] = value;
|
|
714
|
-
const offset = shadow.shadowOffset || {
|
|
715
|
-
width: 0,
|
|
716
|
-
height: 0
|
|
717
|
-
};
|
|
718
|
-
const color = normalizeColor(shadow.shadowColor, shadow.shadowOpacity ?? 1);
|
|
719
|
-
if (!color) return;
|
|
720
|
-
const next = `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow.shadowRadius)} ${color}`;
|
|
721
|
-
emitProperty(state, "boxShadow", state.flatBoxShadow ? `${state.flatBoxShadow}, ${next}` : next, 0, "", void 0, "", "", merge, originalValue, contextOnly);
|
|
722
|
-
}
|
|
723
|
-
function emitWebTextShadow(state, property, value, merge, originalValue, contextOnly) {
|
|
724
|
-
const shadow = state.flatTextShadow ||= {};
|
|
725
|
-
shadow[property] = value;
|
|
726
|
-
const offset = shadow.textShadowOffset || {
|
|
727
|
-
width: 0,
|
|
728
|
-
height: 0
|
|
729
|
-
};
|
|
730
|
-
if (!shadow.textShadowColor) return;
|
|
731
|
-
emitProperty(state, "textShadow", `${shadowUnit(offset.width)} ${shadowUnit(offset.height)} ${shadowUnit(shadow.textShadowRadius)} ${shadow.textShadowColor}`, 0, "", void 0, "", "", merge, originalValue, contextOnly);
|
|
732
|
-
}
|
|
733
|
-
function emitValue(state, property, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly) {
|
|
734
|
-
if (typeof raw === "string") raw = raw.trim();
|
|
735
|
-
if (isVariable(raw)) raw = resolveVariableValue(property, raw, isWeb && !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues);
|
|
736
|
-
emitBorderStyleDefault(state, property, condition, conditionKey, conditionWrappers, conditionSelector);
|
|
737
|
-
if (typeof raw === "string" && (property === "transition" || property === "transitionProperty")) raw = normalizeTransitionNames(state, raw);
|
|
738
|
-
if (legacyTransformParts.has(property)) {
|
|
739
|
-
if (isWeb && state.flatShouldDoClasses && state.classNames.transform) {
|
|
740
|
-
if (process.env.NODE_ENV === "development") warnOnce(`legacy transform part "${property}" is dropped because "transform" owns the property`);
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
744
|
-
if (isWeb && state.flatShouldDoClasses && !condition) {
|
|
745
|
-
const direct = state;
|
|
746
|
-
(direct.flatLegacyTransforms ||= {})[property] = value2;
|
|
747
|
-
emitProperty(state, "transform", transformsToString(Object.keys(direct.flatLegacyTransforms).sort().map((key) => ({ [key]: direct.flatLegacyTransforms[key] }))), 0, "", void 0, "", "", merge, originalValue, contextOnly);
|
|
748
|
-
} else if (condition && isWeb && state.flatShouldDoClasses) emitProperty(state, "transform", `${property}(${value2})`, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
749
|
-
else merge(state, property, value2, 1, false, originalValue);
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
if (isWeb && webShadowParts.has(property)) {
|
|
753
|
-
const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
754
|
-
if (state.flatShouldDoClasses) emitWebShadow(state, property, value2, merge, originalValue, contextOnly);
|
|
755
|
-
else merge(state, property, value2, 1, false, originalValue);
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
if (isWeb && webTextShadowParts.has(property)) {
|
|
759
|
-
const value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
760
|
-
if (state.flatShouldDoClasses) emitWebTextShadow(state, property, value2, merge, originalValue, contextOnly);
|
|
761
|
-
else merge(state, property, value2, 1, false, originalValue);
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
if (isWeb && state.flatShouldDoClasses) {
|
|
765
|
-
if (property === "transform") {
|
|
766
|
-
const direct = state;
|
|
767
|
-
if (process.env.NODE_ENV === "development" && direct.flatLegacyTransforms) for (const part in direct.flatLegacyTransforms) warnOnce(`legacy transform part "${part}" is dropped because "transform" owns the property`);
|
|
768
|
-
direct.flatLegacyTransforms = void 0;
|
|
769
|
-
if (state.flatTransforms) {
|
|
770
|
-
if (process.env.NODE_ENV === "development") for (const part in state.flatTransforms) warnOnce(`legacy transform part "${part}" is dropped because "transform" owns the property`);
|
|
771
|
-
state.flatTransforms = void 0;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
if (isWeb && state.flatShouldDoClasses && property === "transform" && Array.isArray(raw)) raw = transformsToString(raw);
|
|
776
|
-
if (typeof raw === "string" && property in borderTargets) {
|
|
777
|
-
emitBorder(state, property, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
if (typeof raw === "string" && property === "textDecoration") {
|
|
781
|
-
emitTextDecoration(state, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
782
|
-
return;
|
|
783
|
-
}
|
|
784
|
-
if (typeof raw === "string" && property === "background") {
|
|
785
|
-
const parts = splitComponents(raw);
|
|
786
|
-
if (parts.length === 1 && !/^(?:url|image-set|.*gradient)\(/i.test(parts[0])) {
|
|
787
|
-
emitResolved(state, "backgroundColor", parts[0], condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
if (!isWeb) {
|
|
791
|
-
if (process.env.NODE_ENV === "development") warnOnce(`native background cannot represent "${raw}"; dropping it`);
|
|
792
|
-
return;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
if (property === "x" || property === "y" || property === "scale" || property === "scaleX" || property === "scaleY" || property === "rotate") {
|
|
796
|
-
let value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
797
|
-
if ((!isWeb || !state.flatShouldDoClasses) && typeof value2 === "string" && !value2.startsWith(THEME_REF_PREFIX)) {
|
|
798
|
-
if (property === "rotate" && !/^-?(?:\d+\.?\d*|\.\d+)(?:deg|rad)$/i.test(value2)) {
|
|
799
|
-
if (process.env.NODE_ENV === "development") warnOnce(`native transform "${property}" cannot represent "${value2}"; dropping it`);
|
|
800
|
-
if (condition & 1 && state.flatTransforms) delete state.flatTransforms[property];
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
if (/^-?(?:\d+\.?\d*|\.\d+)(?:px|dp)$/i.test(value2)) value2 = Number.parseFloat(value2);
|
|
804
|
-
else if (Number.isFinite(Number(value2))) value2 = Number(value2);
|
|
805
|
-
}
|
|
806
|
-
emitTransform(state, property, value2, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
if (isWeb && !state.flatShouldDoClasses && !condition && property === "borderRadius") {
|
|
810
|
-
if (typeof raw === "string") emitResolved(state, property, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
811
|
-
else emitProperty(state, property, raw, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
let value = raw;
|
|
815
|
-
if (typeof raw === "string") {
|
|
816
|
-
value = configuredValue(state, property, raw);
|
|
817
|
-
if (value === raw && /[\s,(]/.test(raw)) value = resolveEmbeddedTokens(state, property, raw);
|
|
818
|
-
}
|
|
819
|
-
if ((!isWeb || !state.flatShouldDoClasses) && typeof value === "string") {
|
|
820
|
-
if (/^-?(?:\d+\.?\d*|\.\d+)(?:px|dp)$/i.test(value)) value = Number.parseFloat(value);
|
|
821
|
-
else if (value !== "" && Number.isFinite(Number(value))) value = Number(value);
|
|
822
|
-
}
|
|
823
|
-
if (isWeb && state.flatShouldDoClasses && property === "boxShadow" && !condition) state.flatBoxShadow = value;
|
|
824
|
-
if (!isWeb && property === "fontVariant" && typeof value === "string") value = value.split(/[,\s]+/).filter(Boolean);
|
|
825
|
-
const expanded = state.styleProps.noExpand ? null : expandStyle(property, value, state.conf.settings.styleCompat || "web");
|
|
826
|
-
if (!expanded) {
|
|
827
|
-
emitProperty(state, property, value, condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
828
|
-
return;
|
|
829
|
-
}
|
|
830
|
-
if (typeof raw === "string" && expanded.length > 1) {
|
|
831
|
-
const parts = splitComponents(raw);
|
|
832
|
-
if (parts.length > 0 && parts.length <= (expanded.length === 4 ? 4 : 2)) {
|
|
833
|
-
for (let index = 0; index < expanded.length; index++) {
|
|
834
|
-
const partIndex = index === 0 || parts.length === 1 ? 0 : index === 1 || index === 3 && parts.length < 4 ? 1 : index === 2 && parts.length < 3 ? 0 : index;
|
|
835
|
-
emitResolved(state, expanded[index][0], parts[partIndex], condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
836
|
-
}
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
for (let index = 0; index < expanded.length; index++) emitProperty(state, expanded[index][0], expanded[index][1], condition, conditionKey, conditionWrappers, conditionSelector, conditionTheme, merge, originalValue, contextOnly);
|
|
841
|
-
}
|
|
842
|
-
function contributeStyleString(state, property, source, merge, originalValue, contextOnly = false) {
|
|
843
|
-
if (isWeb && source.indexOf(":") !== -1 && (webShadowParts.has(property) || legacyTransformParts.has(property))) {
|
|
844
|
-
if (process.env.NODE_ENV === "development") warnOnce(`conditional "${property}" needs its composite property; dropping it`);
|
|
845
|
-
return true;
|
|
846
|
-
}
|
|
847
|
-
if (source.indexOf(":") === -1) {
|
|
848
|
-
emitValue(state, property, source, 0, "", void 0, "", "", merge, originalValue ?? source, contextOnly);
|
|
849
|
-
return true;
|
|
850
|
-
}
|
|
851
|
-
scanFlatValue(source, directStyleHandler, state, property, merge, originalValue, contextOnly);
|
|
852
|
-
return true;
|
|
853
|
-
}
|
|
854
|
-
function contributeFrontendValue(state, property, value, merge, contextOnly = false) {
|
|
855
|
-
if (value.base !== null) emitValue(state, property, value.base, 0, "", void 0, "", "", merge, value.base, contextOnly);
|
|
856
|
-
for (const clause of value.clauses) {
|
|
857
|
-
const source = clause.modifiers.join(":");
|
|
858
|
-
resolveClauseChain(state, source, 0, source.length, property, clause.payload, merge, clause.payload, contextOnly);
|
|
859
|
-
}
|
|
860
|
-
return true;
|
|
861
|
-
}
|
|
862
|
-
function isConditionalStyleObject(state, value) {
|
|
863
|
-
if (Object.prototype.hasOwnProperty.call(value, "default")) return true;
|
|
864
|
-
for (const key in value) return key.length > 0 && !!resolveClauseChain(state, key, 0, key.length);
|
|
865
|
-
return false;
|
|
866
|
-
}
|
|
867
|
-
function contributeVariantClauseValue(state, property, value, conditionSource, merge, originalValue, contextOnly = false) {
|
|
868
|
-
if (value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && isConditionalStyleObject(state, value)) {
|
|
869
|
-
for (const key in value) {
|
|
870
|
-
const payload = value[key];
|
|
871
|
-
if (payload == null) continue;
|
|
872
|
-
const source = key === "default" ? conditionSource : `${conditionSource}:${key}`;
|
|
873
|
-
resolveClauseChain(state, source, 0, source.length, property, payload, merge, payload, contextOnly, -1, -1, 2);
|
|
874
|
-
}
|
|
875
|
-
return;
|
|
876
|
-
}
|
|
877
|
-
resolveClauseChain(state, conditionSource, 0, conditionSource.length, property, value, merge, originalValue, contextOnly, -1, -1, 2);
|
|
878
|
-
}
|
|
879
|
-
function contributeStyleObject(state, property, value, merge, contextOnly) {
|
|
880
|
-
if (!isConditionalStyleObject(state, value)) return false;
|
|
881
|
-
if (isWeb && (webShadowParts.has(property) || legacyTransformParts.has(property))) {
|
|
882
|
-
if (process.env.NODE_ENV === "development") warnOnce(`conditional "${property}" needs its composite property; dropping it`);
|
|
883
|
-
return true;
|
|
884
|
-
}
|
|
885
|
-
let hasBase = false;
|
|
886
|
-
const base = value.default;
|
|
887
|
-
if (base != null) {
|
|
888
|
-
emitValue(state, property, base, 0, "", void 0, "", "", merge, base, contextOnly);
|
|
889
|
-
hasBase = true;
|
|
890
|
-
}
|
|
891
|
-
let conditions = 0;
|
|
892
|
-
for (const key in value) {
|
|
893
|
-
if (key === "default") continue;
|
|
894
|
-
const payload = value[key];
|
|
895
|
-
if (payload == null) continue;
|
|
896
|
-
conditions |= resolveClauseChain(state, key, 0, key.length, property, payload, merge, payload, contextOnly, -1, -1, 1);
|
|
897
|
-
}
|
|
898
|
-
if ((!isWeb || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
|
|
899
|
-
const resting = implicitLifecycleBase(property);
|
|
900
|
-
if (resting !== null) emitValue(state, property, resting, 0, "", void 0, "", "", merge, resting, contextOnly);
|
|
901
|
-
}
|
|
902
|
-
return true;
|
|
903
|
-
}
|
|
904
|
-
function contributeStyleValue(state, property, value, merge, originalValue, contextOnly = false) {
|
|
905
|
-
if (value === "safe" && isSafeAreaKey(property)) {
|
|
906
|
-
const expanded = expandSafeAreaValue(property);
|
|
907
|
-
if (expanded) {
|
|
908
|
-
state.flatUsesSafeArea = true;
|
|
909
|
-
for (const [key, resolved] of expanded) emitValue(state, key, resolved, 0, "", void 0, "", "", merge, originalValue ?? value, contextOnly);
|
|
910
|
-
return true;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
if (typeof value === "string") return contributeStyleString(state, property, value, merge, originalValue, contextOnly);
|
|
914
|
-
if (value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && contributeStyleObject(state, property, value, merge, contextOnly)) return true;
|
|
915
|
-
if (value != null) {
|
|
916
|
-
emitValue(state, property, value, 0, "", void 0, "", "", merge, originalValue ?? value, contextOnly);
|
|
917
|
-
return true;
|
|
918
|
-
}
|
|
919
|
-
return false;
|
|
920
|
-
}
|
|
921
|
-
function clearDirectStyle(state, property) {
|
|
922
|
-
const direct = state;
|
|
923
|
-
const atomicKey = property.startsWith("transition") ? "transition" : webShadowParts.has(property) ? "boxShadow" : webTextShadowParts.has(property) ? "textShadow" : legacyTransformParts.has(property) ? "transform" : property;
|
|
924
|
-
if (direct.flatAtomics) delete direct.flatAtomics[atomicKey];
|
|
925
|
-
delete state.classNames[atomicKey];
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
export { clearDirectStyle, contributeFrontendValue, contributeStyleString, contributeStyleValue, contributeVariantClauseValue, directStyleSignature, flushDirectStyles, getDirectDynamicThemeAccess, isConditionalStyleObject, platformMatches, resolveClauseChain };
|
|
929
|
-
//# sourceMappingURL=directStyle.mjs.map
|