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