@hanzogui/web 4.4.0 → 7.3.0
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/LICENSE +40 -19
- package/dist/cjs/_withStableStyle.cjs +1 -1
- package/dist/cjs/_withStableStyle.native.js +1 -1
- package/dist/cjs/config.cjs +2 -2
- package/dist/cjs/config.native.js +2 -2
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/constants/constants.cjs +3 -3
- package/dist/cjs/constants/constants.native.js +3 -3
- package/dist/cjs/createComponent.cjs +307 -530
- package/dist/cjs/createComponent.native.js +265 -588
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createGui.cjs +19 -48
- package/dist/cjs/createGui.native.js +22 -65
- package/dist/cjs/createGui.native.js.map +1 -1
- package/dist/cjs/eventHandling.native.js +19 -9
- package/dist/cjs/eventHandling.native.js.map +1 -1
- package/dist/cjs/helpers/createDesignSystem.cjs +22 -36
- package/dist/cjs/helpers/createDesignSystem.native.js +19 -91
- package/dist/cjs/helpers/createDesignSystem.native.js.map +1 -1
- package/dist/cjs/helpers/defaultAnimationDriver.cjs +1 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.js +1 -1
- package/dist/cjs/helpers/expandStyle.cjs +11 -74
- package/dist/cjs/helpers/expandStyle.native.js +29 -81
- package/dist/cjs/helpers/expandStyle.native.js.map +1 -1
- package/dist/cjs/helpers/expandStyles.cjs +2 -15
- package/dist/cjs/helpers/expandStyles.native.js +7 -13
- package/dist/cjs/helpers/expandStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +233 -557
- package/dist/cjs/helpers/getSplitStyles.native.js +204 -659
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.cjs +8 -16
- package/dist/cjs/helpers/getTokenForKey.cjs +32 -54
- package/dist/cjs/helpers/getTokenForKey.native.js +40 -59
- package/dist/cjs/helpers/getTokenForKey.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +27 -79
- package/dist/cjs/helpers/insertStyleRule.native.js +16 -335
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/isActivePlatform.cjs +2 -17
- package/dist/cjs/helpers/isActivePlatform.native.js +2 -17
- package/dist/cjs/helpers/isActivePlatform.native.js.map +1 -1
- package/dist/cjs/helpers/log.cjs +1 -4
- package/dist/cjs/helpers/log.native.js +1 -6
- package/dist/cjs/helpers/log.native.js.map +1 -1
- package/dist/cjs/helpers/propMapper.cjs +37 -110
- package/dist/cjs/helpers/propMapper.native.js +54 -131
- package/dist/cjs/helpers/propMapper.native.js.map +1 -1
- package/dist/cjs/helpers/skipProps.cjs +3 -11
- package/dist/cjs/helpers/skipProps.native.js +3 -11
- package/dist/cjs/helpers/skipProps.native.js.map +1 -1
- package/dist/cjs/helpers/useRenderElement.cjs +7 -18
- package/dist/cjs/helpers/useRenderElement.native.js +7 -15
- package/dist/cjs/helpers/useRenderElement.native.js.map +1 -1
- package/dist/cjs/helpers/wrapStyleTags.cjs +11 -15
- package/dist/cjs/helpers/wrapStyleTags.native.js +3 -22
- package/dist/cjs/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/cjs/hooks/getThemeProxied.cjs +10 -54
- package/dist/cjs/hooks/getThemeProxied.native.js +27 -48
- package/dist/cjs/hooks/getThemeProxied.native.js.map +1 -1
- package/dist/cjs/hooks/useTheme.cjs +2 -2
- package/dist/cjs/hooks/useTheme.native.js +2 -2
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/hooks/useThemeState.cjs +66 -124
- package/dist/cjs/hooks/useThemeState.native.js +64 -142
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/insertFont.cjs +6 -15
- package/dist/cjs/insertFont.native.js +7 -23
- package/dist/cjs/insertFont.native.js.map +1 -1
- package/dist/cjs/setupReactNative.cjs +4 -24
- package/dist/cjs/setupReactNative.native.js +5 -26
- package/dist/cjs/setupReactNative.native.js.map +1 -1
- package/dist/cjs/views/GuiProvider.cjs +4 -6
- package/dist/cjs/views/GuiProvider.native.js +5 -7
- package/dist/cjs/views/GuiProvider.native.js.map +1 -1
- package/dist/cjs/views/Text.cjs +11 -18
- package/dist/cjs/views/Text.native.js +6 -14
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/ThemeProvider.cjs +9 -11
- package/dist/cjs/views/ThemeProvider.native.js +3 -16
- package/dist/cjs/views/ThemeProvider.native.js.map +1 -1
- package/dist/cjs/views/View.native.js.map +1 -1
- package/dist/esm/_withStableStyle.mjs +1 -1
- package/dist/esm/_withStableStyle.mjs.map +1 -1
- package/dist/esm/_withStableStyle.native.js +1 -1
- package/dist/esm/config.mjs +2 -2
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +2 -2
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/constants/constants.mjs +3 -3
- package/dist/esm/constants/constants.native.js +3 -3
- package/dist/esm/createComponent.mjs +311 -536
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +265 -591
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createGui.mjs +20 -51
- package/dist/esm/createGui.mjs.map +1 -1
- package/dist/esm/createGui.native.js +24 -70
- package/dist/esm/createGui.native.js.map +1 -1
- package/dist/esm/createVariables.mjs.map +1 -1
- package/dist/esm/createVariables.native.js.map +1 -1
- package/dist/esm/eventHandling.native.js +19 -9
- package/dist/esm/eventHandling.native.js.map +1 -1
- package/dist/esm/helpers/createDesignSystem.mjs +22 -36
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
- package/dist/esm/helpers/createDesignSystem.native.js +18 -90
- package/dist/esm/helpers/createDesignSystem.native.js.map +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.mjs +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.mjs.map +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.native.js +1 -1
- package/dist/esm/helpers/expandStyle.mjs +12 -73
- package/dist/esm/helpers/expandStyle.mjs.map +1 -1
- package/dist/esm/helpers/expandStyle.native.js +28 -80
- package/dist/esm/helpers/expandStyle.native.js.map +1 -1
- package/dist/esm/helpers/expandStyles.mjs +2 -15
- package/dist/esm/helpers/expandStyles.mjs.map +1 -1
- package/dist/esm/helpers/expandStyles.native.js +7 -13
- package/dist/esm/helpers/expandStyles.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +236 -560
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +205 -662
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs +8 -16
- package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -1
- package/dist/esm/helpers/getTokenForKey.mjs +32 -54
- package/dist/esm/helpers/getTokenForKey.mjs.map +1 -1
- package/dist/esm/helpers/getTokenForKey.native.js +40 -59
- package/dist/esm/helpers/getTokenForKey.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +27 -79
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +14 -333
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/isActivePlatform.mjs +2 -17
- package/dist/esm/helpers/isActivePlatform.mjs.map +1 -1
- package/dist/esm/helpers/isActivePlatform.native.js +2 -17
- package/dist/esm/helpers/isActivePlatform.native.js.map +1 -1
- package/dist/esm/helpers/log.mjs +1 -4
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js +1 -6
- package/dist/esm/helpers/log.native.js.map +1 -1
- package/dist/esm/helpers/propMapper.mjs +37 -108
- package/dist/esm/helpers/propMapper.mjs.map +1 -1
- package/dist/esm/helpers/propMapper.native.js +54 -131
- package/dist/esm/helpers/propMapper.native.js.map +1 -1
- package/dist/esm/helpers/skipProps.mjs +3 -10
- package/dist/esm/helpers/skipProps.mjs.map +1 -1
- package/dist/esm/helpers/skipProps.native.js +2 -10
- package/dist/esm/helpers/skipProps.native.js.map +1 -1
- package/dist/esm/helpers/useRenderElement.mjs +9 -22
- package/dist/esm/helpers/useRenderElement.mjs.map +1 -1
- package/dist/esm/helpers/useRenderElement.native.js +8 -17
- package/dist/esm/helpers/useRenderElement.native.js.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.mjs +11 -15
- package/dist/esm/helpers/wrapStyleTags.mjs.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.native.js +1 -20
- package/dist/esm/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/esm/hooks/getThemeProxied.mjs +11 -52
- package/dist/esm/hooks/getThemeProxied.mjs.map +1 -1
- package/dist/esm/hooks/getThemeProxied.native.js +27 -48
- package/dist/esm/hooks/getThemeProxied.native.js.map +1 -1
- package/dist/esm/hooks/useTheme.mjs +2 -2
- package/dist/esm/hooks/useTheme.mjs.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +2 -2
- package/dist/esm/hooks/useTheme.native.js.map +1 -1
- package/dist/esm/hooks/useThemeState.mjs +67 -124
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +64 -142
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/insertFont.mjs +7 -17
- package/dist/esm/insertFont.mjs.map +1 -1
- package/dist/esm/insertFont.native.js +7 -24
- package/dist/esm/insertFont.native.js.map +1 -1
- package/dist/esm/setupReactNative.mjs +4 -24
- package/dist/esm/setupReactNative.mjs.map +1 -1
- package/dist/esm/setupReactNative.native.js +5 -26
- package/dist/esm/setupReactNative.native.js.map +1 -1
- package/dist/esm/views/GuiProvider.mjs +4 -6
- package/dist/esm/views/GuiProvider.mjs.map +1 -1
- package/dist/esm/views/GuiProvider.native.js +5 -7
- package/dist/esm/views/GuiProvider.native.js.map +1 -1
- package/dist/esm/views/Slot.mjs.map +1 -1
- package/dist/esm/views/Text.mjs +11 -18
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Text.native.js +5 -12
- package/dist/esm/views/Text.native.js.map +1 -1
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/ThemeProvider.mjs +9 -11
- package/dist/esm/views/ThemeProvider.mjs.map +1 -1
- package/dist/esm/views/ThemeProvider.native.js +1 -14
- package/dist/esm/views/ThemeProvider.native.js.map +1 -1
- package/dist/esm/views/View.mjs.map +1 -1
- package/dist/esm/views/View.native.js.map +1 -1
- package/package.json +29 -22
- package/src/_withStableStyle.tsx +2 -2
- package/src/config.ts +7 -4
- package/src/constants/accessibilityDirectMap.tsx +1 -1
- package/src/constants/constants.ts +3 -3
- package/src/createComponent.tsx +2 -2
- package/src/createGui.ts +2 -2
- package/src/eventHandling.native.ts +31 -10
- package/src/helpers/createMediaStyle.ts +1 -1
- package/src/helpers/defaultAnimationDriver.tsx +1 -1
- package/src/helpers/getSplitStyles.tsx +1 -1
- package/src/helpers/getTokenForKey.ts +42 -29
- package/src/helpers/insertStyleRule.tsx +2 -2
- package/src/helpers/isActivePlatform.ts +5 -5
- package/src/helpers/mergeProps.ts +1 -1
- package/src/helpers/skipProps.ts +1 -1
- package/src/helpers/useRenderElement.tsx +4 -1
- package/src/hooks/useTheme.tsx +2 -2
- package/src/interfaces/GuiComponentPropsBaseBase.tsx +10 -4
- package/src/styled.tsx +2 -2
- package/src/types.tsx +33 -24
- package/src/views/View.tsx +6 -1
- package/types/Gui.d.ts.map +1 -0
- package/types/_withStableStyle.d.ts.map +1 -0
- package/types/config.d.ts.map +1 -0
- package/types/constants/accessibilityDirectMap.d.ts.map +1 -0
- package/types/constants/accessibilityDirectMap.native.d.ts.map +1 -0
- package/types/constants/constants.d.ts.map +1 -0
- package/types/constants/isDevTools.d.ts.map +1 -0
- package/types/contexts/ComponentContext.d.ts.map +1 -0
- package/types/contexts/GroupContext.d.ts.map +1 -0
- package/types/createComponent.d.ts.map +1 -0
- package/types/createFont.d.ts.map +1 -0
- package/types/createGui.d.ts.map +1 -0
- package/types/createShorthands.d.ts.map +1 -0
- package/types/createTokens.d.ts.map +1 -0
- package/types/createVariable.d.ts.map +1 -0
- package/types/createVariables.d.ts.map +1 -0
- package/types/defaultComponentState.d.ts.map +1 -0
- package/types/eventHandling.d.ts.map +1 -0
- package/types/eventHandling.native.d.ts.map +1 -0
- package/types/helpers/consoleLog.native.d.ts.map +1 -0
- package/types/helpers/createDesignSystem.d.ts.map +1 -0
- package/types/helpers/createMediaStyle.d.ts.map +1 -0
- package/types/helpers/createStyledContext.d.ts.map +1 -0
- package/types/helpers/defaultAnimationDriver.d.ts.map +1 -0
- package/types/helpers/defaultOffset.d.ts.map +1 -0
- package/types/helpers/expandStyle.d.ts.map +1 -0
- package/types/helpers/expandStyles.d.ts.map +1 -0
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -0
- package/types/helpers/getCSSStylesAtomic.native.d.ts.map +1 -0
- package/types/helpers/getDefaultProps.d.ts.map +1 -0
- package/types/helpers/getDynamicVal.d.ts.map +1 -0
- package/types/helpers/getExpandedShorthands.d.ts.map +1 -0
- package/types/helpers/getFontLanguage.d.ts.map +1 -0
- package/types/helpers/getGroupPropParts.d.ts.map +1 -0
- package/types/helpers/getShorthandValue.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -0
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -0
- package/types/helpers/getThemeCSSRules.native.d.ts.map +1 -0
- package/types/helpers/getTokenForKey.d.ts.map +1 -0
- package/types/helpers/getVariantExtras.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -0
- package/types/helpers/isActivePlatform.d.ts +5 -5
- package/types/helpers/isActivePlatform.d.ts.map +1 -0
- package/types/helpers/isActiveTheme.d.ts.map +1 -0
- package/types/helpers/isGuiComponent.d.ts.map +1 -0
- package/types/helpers/isGuiElement.d.ts.map +1 -0
- package/types/helpers/isObj.d.ts.map +1 -0
- package/types/helpers/log.d.ts.map +1 -0
- package/types/helpers/mainThreadPressEvents.d.ts.map +1 -0
- package/types/helpers/mainThreadPressEvents.native.d.ts.map +1 -0
- package/types/helpers/matchMedia.d.ts.map +1 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -0
- package/types/helpers/mediaObjectToString.d.ts.map +1 -0
- package/types/helpers/mediaState.d.ts.map +1 -0
- package/types/helpers/mergeProps.d.ts.map +1 -0
- package/types/helpers/mergeRenderElementProps.d.ts.map +1 -0
- package/types/helpers/mergeSlotStyleProps.d.ts.map +1 -0
- package/types/helpers/mergeVariants.d.ts.map +1 -0
- package/types/helpers/nativeOnlyProps.d.ts.map +1 -0
- package/types/helpers/normalizeColor.d.ts.map +1 -0
- package/types/helpers/normalizeColor.native.d.ts.map +1 -0
- package/types/helpers/normalizeShadow.d.ts.map +1 -0
- package/types/helpers/normalizeShadow.native.d.ts.map +1 -0
- package/types/helpers/normalizeStyle.d.ts.map +1 -0
- package/types/helpers/normalizeStylePropKeys.d.ts.map +1 -0
- package/types/helpers/normalizeStylePropKeys.native.d.ts.map +1 -0
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
- package/types/helpers/objectIdentityKey.d.ts.map +1 -0
- package/types/helpers/parseBorderShorthand.d.ts.map +1 -0
- package/types/helpers/parseBorderShorthand.native.d.ts.map +1 -0
- package/types/helpers/parseNativeStyle.d.ts.map +1 -0
- package/types/helpers/parseOutlineShorthand.d.ts.map +1 -0
- package/types/helpers/parseOutlineShorthand.native.d.ts.map +1 -0
- package/types/helpers/platformResolveValue.d.ts.map +1 -0
- package/types/helpers/platformResolveValue.native.d.ts.map +1 -0
- package/types/helpers/pointerEvents.d.ts.map +1 -0
- package/types/helpers/pointerEvents.native.d.ts.map +1 -0
- package/types/helpers/propMapper.d.ts.map +1 -0
- package/types/helpers/proxyThemeToParents.d.ts.map +1 -0
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
- package/types/helpers/pseudoDescriptors.d.ts.map +1 -0
- package/types/helpers/pseudoTransitions.d.ts.map +1 -0
- package/types/helpers/registerCSSVariable.d.ts.map +1 -0
- package/types/helpers/resolveAnimationDriver.d.ts.map +1 -0
- package/types/helpers/resolveCompoundTokens.d.ts.map +1 -0
- package/types/helpers/resolveRem.d.ts.map +1 -0
- package/types/helpers/resolveRem.native.d.ts.map +1 -0
- package/types/helpers/resolveSafeArea.d.ts.map +1 -0
- package/types/helpers/resolveSafeArea.native.d.ts.map +1 -0
- package/types/helpers/setElementProps.d.ts.map +1 -0
- package/types/helpers/setElementProps.native.d.ts.map +1 -0
- package/types/helpers/skipProps.d.ts +1 -1
- package/types/helpers/skipProps.d.ts.map +1 -0
- package/types/helpers/sortString.d.ts.map +1 -0
- package/types/helpers/subscribeToContextGroup.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts.map +1 -0
- package/types/helpers/themes.d.ts.map +1 -0
- package/types/helpers/timer.d.ts.map +1 -0
- package/types/helpers/transformsToString.d.ts.map +1 -0
- package/types/helpers/useRenderElement.d.ts.map +1 -0
- package/types/helpers/webPropsToSkip.d.ts.map +1 -0
- package/types/helpers/webPropsToSkip.native.d.ts.map +1 -0
- package/types/helpers/wrapStyleTags.d.ts +1 -1
- package/types/helpers/wrapStyleTags.d.ts.map +1 -0
- package/types/hooks/doesRootSchemeMatchSystem.d.ts.map +1 -0
- package/types/hooks/doesRootSchemeMatchSystem.native.d.ts.map +1 -0
- package/types/hooks/getThemeProxied.d.ts.map +1 -0
- package/types/hooks/useComponentState.d.ts.map +1 -0
- package/types/hooks/useDisableSSR.d.ts.map +1 -0
- package/types/hooks/useIsTouchDevice.d.ts.map +1 -0
- package/types/hooks/useMedia.d.ts.map +1 -0
- package/types/hooks/useProps.d.ts.map +1 -0
- package/types/hooks/useTheme.d.ts.map +1 -0
- package/types/hooks/useThemeName.d.ts.map +1 -0
- package/types/hooks/useThemeState.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
- package/types/inject-styles.d.ts.map +1 -0
- package/types/insertFont.d.ts.map +1 -0
- package/types/interfaces/CSSColorNames.d.ts.map +1 -0
- package/types/interfaces/GetRef.d.ts.map +1 -0
- package/types/interfaces/GuiComponentEvents.d.ts.map +1 -0
- package/types/interfaces/GuiComponentPropsBaseBase.d.ts +3 -3
- package/types/interfaces/GuiComponentPropsBaseBase.d.ts.map +1 -0
- package/types/interfaces/RNExclusiveTypes.d.ts.map +1 -0
- package/types/setupHooks.d.ts.map +1 -0
- package/types/setupReactNative.d.ts.map +1 -0
- package/types/styled.d.ts +1 -1
- package/types/styled.d.ts.map +1 -0
- package/types/type-utils.d.ts.map +1 -0
- package/types/types.d.ts +17 -17
- package/types/types.d.ts.map +1 -0
- package/types/views/Configuration.d.ts +1 -1
- package/types/views/Configuration.d.ts.map +1 -0
- package/types/views/FontLanguage.d.ts +1 -1
- package/types/views/FontLanguage.d.ts.map +1 -0
- package/types/views/FontLanguage.native.d.ts +2 -1
- package/types/views/FontLanguage.native.d.ts.map +1 -0
- package/types/views/GuiProvider.d.ts +2 -1
- package/types/views/GuiProvider.d.ts.map +1 -0
- package/types/views/GuiRoot.d.ts +1 -1
- package/types/views/GuiRoot.d.ts.map +1 -0
- package/types/views/GuiRoot.native.d.ts.map +1 -0
- package/types/views/Slot.d.ts +1 -1
- package/types/views/Slot.d.ts.map +1 -0
- package/types/views/Text.d.ts.map +1 -0
- package/types/views/Theme.d.ts.map +1 -0
- package/types/views/ThemeDebug.d.ts.map +1 -0
- package/types/views/ThemeDebug.native.d.ts.map +1 -0
- package/types/views/ThemeProvider.d.ts +1 -1
- package/types/views/ThemeProvider.d.ts.map +1 -0
- package/types/views/View.d.ts.map +1 -0
- package/inject-styles/index.cjs +0 -2
- package/inject-styles/index.js +0 -2
- package/tsconfig.json +0 -44
- package/tsconfig.test.json +0 -9
- package/vitest.config.d.ts +0 -3
- package/vitest.config.d.ts.map +0 -1
- package/vitest.config.ts +0 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isClient, isWeb, useIsomorphicLayoutEffect } from "@hanzogui/constants";
|
|
1
|
+
import { isAndroid, isClient, isIos, isWeb, useIsomorphicLayoutEffect } from "@hanzogui/constants";
|
|
2
2
|
import { StyleObjectIdentifier, StyleObjectProperty, StyleObjectPseudo, StyleObjectRules, nonAnimatableStyleProps, stylePropsText, stylePropsTransform, tokenCategories, validPseudoKeys, validStyles as validStylesView } from "@hanzogui/helpers";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { getConfig } from "../config.mjs";
|
|
4
|
+
import { getConfig, getFont, getSetting } from "../config.mjs";
|
|
5
5
|
import { isDevTools } from "../constants/isDevTools.mjs";
|
|
6
6
|
import { getMediaImportanceIfMoreImportant, getMediaKey, getMediaKeyImportance, mediaKeyMatch } from "../hooks/useMedia.mjs";
|
|
7
7
|
import { mediaState as globalMediaState, mediaQueryConfig } from "./mediaState.mjs";
|
|
@@ -9,6 +9,7 @@ import { createMediaStyle } from "./createMediaStyle.mjs";
|
|
|
9
9
|
import { fixStyles } from "./expandStyles.mjs";
|
|
10
10
|
import { getCSSStylesAtomic, getStyleAtomic, styleToCSS } from "./getCSSStylesAtomic.mjs";
|
|
11
11
|
import { getDefaultProps } from "./getDefaultProps.mjs";
|
|
12
|
+
import { extractValueFromDynamic, getDynamicVal, getOppositeScheme, isColorStyleKey } from "./getDynamicVal.mjs";
|
|
12
13
|
import { getGroupPropParts } from "./getGroupPropParts.mjs";
|
|
13
14
|
import { insertStyleRules, shouldInsertStyleRules, updateRules } from "./insertStyleRule.mjs";
|
|
14
15
|
import { isActivePlatform, getPlatformSpecificityBump } from "./isActivePlatform.mjs";
|
|
@@ -26,13 +27,9 @@ const PROP_SPLIT = "-";
|
|
|
26
27
|
function normalizeGroupKey(key, groupContext) {
|
|
27
28
|
const parts = key.split("-");
|
|
28
29
|
const plen = parts.length;
|
|
29
|
-
if (
|
|
30
|
-
// check if its actually a simple group selector to avoid breaking selectors
|
|
31
|
-
plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]) {
|
|
30
|
+
if (plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]) {
|
|
32
31
|
const name = parts[1];
|
|
33
|
-
if (name !== "true" && groupContext && !groupContext[name])
|
|
34
|
-
return key.replace("$group-", "$group-true-");
|
|
35
|
-
}
|
|
32
|
+
if (name !== "true" && groupContext && !groupContext[name]) return key.replace("$group-", "$group-true-");
|
|
36
33
|
}
|
|
37
34
|
return key;
|
|
38
35
|
}
|
|
@@ -42,12 +39,8 @@ function isValidStyleKey(key, validStyles, accept) {
|
|
|
42
39
|
const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) => {
|
|
43
40
|
conf = conf || getConfig();
|
|
44
41
|
const driver = animationDriver || componentContext?.animationDriver || conf.animations;
|
|
45
|
-
if (props.passThrough)
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
if (isWeb && styleProps.isAnimated && driver?.isReactNative && !styleProps.noNormalize) {
|
|
49
|
-
styleProps.noNormalize = "values";
|
|
50
|
-
}
|
|
42
|
+
if (props.passThrough) return null;
|
|
43
|
+
if (isWeb && styleProps.isAnimated && driver?.isReactNative && !styleProps.noNormalize) styleProps.noNormalize = "values";
|
|
51
44
|
const {
|
|
52
45
|
shorthands
|
|
53
46
|
} = conf;
|
|
@@ -65,9 +58,9 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
65
58
|
const viewProps = {};
|
|
66
59
|
const mediaState = styleProps.mediaState || globalMediaState;
|
|
67
60
|
const shouldDoClasses = acceptsClassName && isWeb && !styleProps.noClass;
|
|
68
|
-
const rulesToInsert =
|
|
61
|
+
const rulesToInsert = {};
|
|
69
62
|
const classNames = {};
|
|
70
|
-
|
|
63
|
+
props.space;
|
|
71
64
|
let pseudos = null;
|
|
72
65
|
let hasMedia = false;
|
|
73
66
|
let dynamicThemeAccess;
|
|
@@ -76,9 +69,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
76
69
|
let className = props.className || "";
|
|
77
70
|
let mediaStylesSeen = 0;
|
|
78
71
|
const validStyles = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStylesView);
|
|
79
|
-
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time))
|
|
80
|
-
time`split-styles-setup`;
|
|
81
|
-
}
|
|
72
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-setup`;
|
|
82
73
|
const styleState = {
|
|
83
74
|
classNames,
|
|
84
75
|
conf,
|
|
@@ -92,30 +83,23 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
92
83
|
viewProps,
|
|
93
84
|
context: componentContext,
|
|
94
85
|
debug,
|
|
95
|
-
// resolved animation driver (respects animatedBy prop)
|
|
96
86
|
animationDriver: driver
|
|
97
87
|
};
|
|
98
88
|
if (process.env.IS_STATIC === "is_static") {
|
|
99
89
|
const {
|
|
100
90
|
fallbackProps
|
|
101
91
|
} = styleProps;
|
|
102
|
-
if (fallbackProps) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return Reflect.get(props, key);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) {
|
|
114
|
-
time`style-state`;
|
|
92
|
+
if (fallbackProps) styleState.props = new Proxy(props, {
|
|
93
|
+
get(_, key, val) {
|
|
94
|
+
if (!Reflect.has(props, key)) return Reflect.get(fallbackProps, key);
|
|
95
|
+
return Reflect.get(props, key);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
115
98
|
}
|
|
99
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`style-state`;
|
|
116
100
|
if (process.env.NODE_ENV === "development" && debug === "verbose" && isClient) {
|
|
117
101
|
if (isDevTools) {
|
|
118
|
-
console.groupCollapsed("
|
|
102
|
+
console.groupCollapsed("🔹 getSplitStyles 👇");
|
|
119
103
|
log({
|
|
120
104
|
props,
|
|
121
105
|
staticConfig,
|
|
@@ -153,12 +137,8 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
153
137
|
viewProps[keyInit] = valInit;
|
|
154
138
|
continue;
|
|
155
139
|
}
|
|
156
|
-
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) {
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
if (process.env.NODE_ENV === "test" && keyInit === "jestAnimatedStyle") {
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
140
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`before-prop-${keyInit}`;
|
|
141
|
+
if (process.env.NODE_ENV === "test" && keyInit === "jestAnimatedStyle") continue;
|
|
162
142
|
if (accept) {
|
|
163
143
|
const accepted = accept[keyInit];
|
|
164
144
|
if ((accepted === "style" || accepted === "textStyle") && valInit && typeof valInit === "object") {
|
|
@@ -167,81 +147,46 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
167
147
|
}
|
|
168
148
|
}
|
|
169
149
|
if (!disableExpandShorthands) {
|
|
170
|
-
if (keyInit in shorthands)
|
|
171
|
-
keyInit = shorthands[keyInit];
|
|
172
|
-
}
|
|
150
|
+
if (keyInit in shorthands) keyInit = shorthands[keyInit];
|
|
173
151
|
}
|
|
174
152
|
if (keyInit === "className") continue;
|
|
175
153
|
if (asChild) {
|
|
176
154
|
const defaults = getDefaultProps(staticConfig);
|
|
177
155
|
if (defaults) {
|
|
178
156
|
const defaultVal = defaults[keyOg] ?? defaults[keyInit];
|
|
179
|
-
if (defaultVal !== void 0 && valInit === defaultVal)
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
157
|
+
if (defaultVal !== void 0 && valInit === defaultVal) continue;
|
|
182
158
|
}
|
|
183
159
|
}
|
|
184
160
|
if (keyInit in skipProps && !noSkip && !isHOC) {
|
|
185
161
|
if (keyInit === "group") {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const containerType = webContainerType || "inline-size";
|
|
189
|
-
const containerCSS = ["container", void 0, identifier, void 0, [`.${identifier} { container-name: ${valInit}; container-type: ${containerType}; }`]];
|
|
190
|
-
addStyleToInsertRules(rulesToInsert, containerCSS);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (keyInit === "transition" && typeof valInit === "string" && !driver?.animations?.[valInit]) {} else {
|
|
194
|
-
continue;
|
|
162
|
+
const identifier = `t_group_${valInit}`;
|
|
163
|
+
addStyleToInsertRules(rulesToInsert, ["container", void 0, identifier, void 0, [`.${identifier} { container-name: ${valInit}; container-type: ${webContainerType || "inline-size"}; }`]]);
|
|
195
164
|
}
|
|
165
|
+
if (keyInit === "transition" && typeof valInit === "string" && !driver?.animations?.[valInit]) {} else continue;
|
|
196
166
|
}
|
|
197
167
|
let isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles, accept);
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
168
|
+
if (staticConfig.isReactNative && keyInit.startsWith("data-")) {
|
|
169
|
+
keyInit = keyInit.replace("data-", "");
|
|
170
|
+
viewProps["dataSet"] ||= {};
|
|
171
|
+
viewProps["dataSet"][keyInit] = valInit;
|
|
172
|
+
continue;
|
|
205
173
|
}
|
|
206
|
-
if (
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (keyInit === "userSelect") {
|
|
212
|
-
keyInit = "selectable";
|
|
213
|
-
valInit = valInit !== "none";
|
|
214
|
-
} else if (keyInit.startsWith("data-")) {
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
174
|
+
if (!noExpand) {
|
|
175
|
+
if (keyInit === "disabled" && valInit === true) {
|
|
176
|
+
viewProps["aria-disabled"] = true;
|
|
177
|
+
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") viewProps.disabled = true;
|
|
178
|
+
if (!variants?.disabled) continue;
|
|
217
179
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
viewProps["aria-disabled"] = true;
|
|
223
|
-
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
224
|
-
viewProps.disabled = true;
|
|
225
|
-
}
|
|
226
|
-
if (!variants?.disabled) {
|
|
227
|
-
continue;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (keyInit === "testID") {
|
|
231
|
-
if (isReactNative) {
|
|
232
|
-
viewProps.testID = valInit;
|
|
233
|
-
} else {
|
|
234
|
-
viewProps["data-testid"] = valInit;
|
|
235
|
-
if (styleProps.isAnimated && driver?.isReactNative) {
|
|
236
|
-
viewProps.testID = valInit;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
if (keyInit === "id") {
|
|
242
|
-
viewProps.id = valInit;
|
|
243
|
-
continue;
|
|
180
|
+
if (keyInit === "testID") {
|
|
181
|
+
if (isReactNative) viewProps.testID = valInit;else {
|
|
182
|
+
viewProps["data-testid"] = valInit;
|
|
183
|
+
if (styleProps.isAnimated && driver?.isReactNative) viewProps.testID = valInit;
|
|
244
184
|
}
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (keyInit === "id") {
|
|
188
|
+
viewProps.id = valInit;
|
|
189
|
+
continue;
|
|
245
190
|
}
|
|
246
191
|
}
|
|
247
192
|
let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
|
|
@@ -249,16 +194,10 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
249
194
|
let isPseudo = keyInit in validPseudoKeys;
|
|
250
195
|
let isMedia = !isStyleLikeKey && !isPseudo ? getMediaKey(keyInit) : false;
|
|
251
196
|
let isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
252
|
-
if (isMediaOrPseudo && isMedia === "group")
|
|
253
|
-
keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
254
|
-
}
|
|
197
|
+
if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
255
198
|
const isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
256
|
-
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web"))
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
const shouldPassProp = !isStyleProp && isHOC ||
|
|
260
|
-
// is in parent variants
|
|
261
|
-
isHOC && parentVariants && keyInit in parentVariants || inlineProps?.has(keyInit);
|
|
199
|
+
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) continue;
|
|
200
|
+
const shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || inlineProps?.has(keyInit);
|
|
262
201
|
const parentVariant = parentVariants?.[keyInit];
|
|
263
202
|
const isHOCShouldPassThrough = Boolean(isHOC && (isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps));
|
|
264
203
|
const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
@@ -269,40 +208,30 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
269
208
|
valInit,
|
|
270
209
|
shouldPassProp
|
|
271
210
|
});
|
|
272
|
-
if (isClient) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
usedKeys
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
});
|
|
283
|
-
}
|
|
211
|
+
if (isClient) log({
|
|
212
|
+
variants,
|
|
213
|
+
variant: variants?.[keyInit],
|
|
214
|
+
isVariant,
|
|
215
|
+
isHOCShouldPassThrough,
|
|
216
|
+
usedKeys: {
|
|
217
|
+
...styleState.usedKeys
|
|
218
|
+
},
|
|
219
|
+
parentStaticConfig
|
|
220
|
+
});
|
|
284
221
|
}
|
|
285
222
|
if (shouldPassThrough) {
|
|
286
223
|
passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo);
|
|
287
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose")
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
if (!isVariant) {
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
224
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
|
|
225
|
+
if (!isVariant) continue;
|
|
293
226
|
}
|
|
294
227
|
if (!noSkip) {
|
|
295
228
|
if (keyInit in skipProps && !(keyInit === "transition" && typeof valInit === "string" && !driver?.animations?.[valInit])) {
|
|
296
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose")
|
|
297
|
-
console.groupEnd();
|
|
298
|
-
}
|
|
229
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") console.groupEnd();
|
|
299
230
|
continue;
|
|
300
231
|
}
|
|
301
232
|
}
|
|
302
233
|
if (isText || isInput) {
|
|
303
|
-
if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed)
|
|
304
|
-
styleState.fontFamily = valInit;
|
|
305
|
-
}
|
|
234
|
+
if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
|
|
306
235
|
}
|
|
307
236
|
const disablePropMap = isMediaOrPseudo || !isStyleLikeKey;
|
|
308
237
|
propMapper(keyInit, valInit, styleState, disablePropMap, (key, val, originalVal) => {
|
|
@@ -312,17 +241,11 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
312
241
|
return;
|
|
313
242
|
}
|
|
314
243
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
315
|
-
console.groupCollapsed("
|
|
244
|
+
console.groupCollapsed(" 💠 expanded", keyInit, "=>", key);
|
|
316
245
|
log(val);
|
|
317
246
|
console.groupEnd();
|
|
318
247
|
}
|
|
319
248
|
if (val == null) return;
|
|
320
|
-
if (false) {
|
|
321
|
-
if (key === "pointerEvents") {
|
|
322
|
-
viewProps[key] = val;
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
249
|
if (!isHOC && isValidStyleKey(key, validStyles, accept) || false) {
|
|
327
250
|
mergeStyle(styleState, key, val, 1, false, originalVal);
|
|
328
251
|
return;
|
|
@@ -331,14 +254,9 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
331
254
|
isMedia = isPseudo ? false : getMediaKey(key);
|
|
332
255
|
isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
333
256
|
isVariant = variants && key in variants;
|
|
334
|
-
if (isMedia === "group")
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (inlineProps?.has(key) || process.env.IS_STATIC === "is_static" && inlineWhenUnflattened?.has(key)) {
|
|
338
|
-
viewProps[key] = props[key] ?? val;
|
|
339
|
-
}
|
|
340
|
-
const shouldPassThrough2 = styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || parentStaticConfig?.variants?.[keyInit]);
|
|
341
|
-
if (shouldPassThrough2) {
|
|
257
|
+
if (isMedia === "group") key = normalizeGroupKey(key, groupContext);
|
|
258
|
+
if (inlineProps?.has(key) || process.env.IS_STATIC === "is_static" && inlineWhenUnflattened?.has(key)) viewProps[key] = props[key] ?? val;
|
|
259
|
+
if (styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || parentStaticConfig?.variants?.[keyInit])) {
|
|
342
260
|
passDownProp(viewProps, key, val, isMediaOrPseudo);
|
|
343
261
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
344
262
|
console.groupCollapsed(` - passing down prop ${key}`);
|
|
@@ -366,14 +284,10 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
366
284
|
const descriptor = pseudoDescriptors[key];
|
|
367
285
|
const isEnter = key === "enterStyle";
|
|
368
286
|
const isExit = key === "exitStyle";
|
|
369
|
-
if (!descriptor)
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
287
|
+
if (!descriptor) return;
|
|
372
288
|
if (shouldDoClasses && !isExit) {
|
|
373
289
|
const pseudoStyles = getStyleAtomic(pseudoStyleObject, descriptor);
|
|
374
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose")
|
|
375
|
-
console.info("pseudo:", key, pseudoStyleObject, pseudoStyles);
|
|
376
|
-
}
|
|
290
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") console.info("pseudo:", key, pseudoStyleObject, pseudoStyles);
|
|
377
291
|
for (const psuedoStyle of pseudoStyles) {
|
|
378
292
|
const fullKey = `${psuedoStyle[StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
|
|
379
293
|
addStyleToInsertRules(rulesToInsert, psuedoStyle);
|
|
@@ -381,14 +295,9 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
381
295
|
}
|
|
382
296
|
}
|
|
383
297
|
if (!shouldDoClasses || isExit || isEnter) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (
|
|
387
|
-
isDisabled = !styleProps.isExiting;
|
|
388
|
-
}
|
|
389
|
-
if (isEnter && componentState.unmounted === false) {
|
|
390
|
-
isDisabled = true;
|
|
391
|
-
}
|
|
298
|
+
let isDisabled = componentState[descriptor.stateKey || descriptor.name] === false;
|
|
299
|
+
if (isExit) isDisabled = !styleProps.isExiting;
|
|
300
|
+
if (isEnter && componentState.unmounted === false) isDisabled = true;
|
|
392
301
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
393
302
|
console.groupCollapsed("pseudo", key, {
|
|
394
303
|
isDisabled
|
|
@@ -405,9 +314,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
405
314
|
const pseudoOriginalValues = styleOriginalValues.get(pseudoStyleObject);
|
|
406
315
|
for (const pkey in pseudoStyleObject) {
|
|
407
316
|
const val2 = pseudoStyleObject[pkey];
|
|
408
|
-
if (isDisabled) {
|
|
409
|
-
applyDefaultStyle(pkey, styleState);
|
|
410
|
-
} else {
|
|
317
|
+
if (isDisabled) applyDefaultStyle(pkey, styleState);else {
|
|
411
318
|
const curImportance = styleState.usedKeys[pkey] || 0;
|
|
412
319
|
const shouldMerge = importance >= curImportance;
|
|
413
320
|
if (shouldMerge) {
|
|
@@ -418,21 +325,17 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
418
325
|
}
|
|
419
326
|
mergeStyle(styleState, pkey, val2, importance, false, pseudoOriginalValues?.[pkey]);
|
|
420
327
|
}
|
|
421
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
});
|
|
428
|
-
}
|
|
328
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(" subKey", pkey, shouldMerge, {
|
|
329
|
+
importance,
|
|
330
|
+
curImportance,
|
|
331
|
+
pkey,
|
|
332
|
+
val: val2
|
|
333
|
+
});
|
|
429
334
|
}
|
|
430
335
|
}
|
|
431
|
-
if (!isDisabled) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
styleState.usedKeys[k] = Math.max(importance, styleState.usedKeys[k] || 0);
|
|
435
|
-
}
|
|
336
|
+
if (!isDisabled) for (const key2 in val) {
|
|
337
|
+
const k = shorthands[key2] || key2;
|
|
338
|
+
styleState.usedKeys[k] = Math.max(importance, styleState.usedKeys[k] || 0);
|
|
436
339
|
}
|
|
437
340
|
}
|
|
438
341
|
return;
|
|
@@ -441,44 +344,32 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
441
344
|
if (!val) return;
|
|
442
345
|
const mediaKeyShort = key.slice(isMedia == "theme" ? 7 : 1);
|
|
443
346
|
hasMedia ||= true;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
if (!hasMedia || typeof hasMedia === "boolean") {
|
|
447
|
-
hasMedia = /* @__PURE__ */new Set();
|
|
448
|
-
}
|
|
347
|
+
if (val["space"] || !shouldDoClasses || styleProps.willBeAnimated) {
|
|
348
|
+
if (!hasMedia || typeof hasMedia === "boolean") hasMedia = /* @__PURE__ */new Set();
|
|
449
349
|
hasMedia.add(mediaKeyShort);
|
|
450
350
|
}
|
|
451
351
|
if (isMedia === "platform") {
|
|
452
|
-
if (!isActivePlatform(key))
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
componentState,
|
|
464
|
-
mediaState
|
|
465
|
-
});
|
|
466
|
-
}
|
|
352
|
+
if (!isActivePlatform(key)) return;
|
|
353
|
+
}
|
|
354
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(` \u{1F4FA} ${key}`, {
|
|
355
|
+
key,
|
|
356
|
+
val,
|
|
357
|
+
props,
|
|
358
|
+
shouldDoClasses,
|
|
359
|
+
acceptsClassName,
|
|
360
|
+
componentState,
|
|
361
|
+
mediaState
|
|
362
|
+
});
|
|
467
363
|
const priority = mediaStylesSeen;
|
|
468
364
|
mediaStylesSeen += 1;
|
|
469
365
|
if (shouldDoClasses) {
|
|
470
|
-
const
|
|
471
|
-
const mediaStyles = getCSSStylesAtomic(mediaStyle);
|
|
366
|
+
const mediaStyles = getCSSStylesAtomic(getSubStyle(styleState, key, val, false));
|
|
472
367
|
for (const style of mediaStyles) {
|
|
473
368
|
const property = style[StyleObjectProperty];
|
|
474
369
|
const isSubStyle = property[0] === "$";
|
|
475
|
-
if (isSubStyle && !isActivePlatform(property))
|
|
476
|
-
continue;
|
|
477
|
-
}
|
|
370
|
+
if (isSubStyle && !isActivePlatform(property)) continue;
|
|
478
371
|
const out = createMediaStyle(style, mediaKeyShort, mediaQueryConfig, isMedia, false, priority);
|
|
479
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
480
|
-
log(`\u{1F4FA} media style:`, out);
|
|
481
|
-
}
|
|
372
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(`\u{1F4FA} media style:`, out);
|
|
482
373
|
const subKey = isSubStyle ? style[2] : "";
|
|
483
374
|
const fullKey = `${style[StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style[StyleObjectPseudo] || ""}`;
|
|
484
375
|
addStyleToInsertRules(rulesToInsert, out);
|
|
@@ -486,72 +377,24 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
486
377
|
}
|
|
487
378
|
} else {
|
|
488
379
|
let mergeMediaStyle = function (key2, val2, originalVal2) {
|
|
489
|
-
if (process.env.TAMAGUI_TARGET === "native") {
|
|
490
|
-
if (!isValidStyleKey(key2, validStyles, accept)) {
|
|
491
|
-
viewProps[key2] = val2;
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
380
|
styleState.style ||= {};
|
|
496
|
-
|
|
497
|
-
if (didMerge && key2 === "fontFamily") {
|
|
498
|
-
styleState.fontFamily = mediaStyle.fontFamily;
|
|
499
|
-
}
|
|
381
|
+
if (mergeMediaByImportance(styleState, mediaKeyShort, key2, val2, mediaState[mediaKeyShort], importanceBump, debug, originalVal2) && key2 === "fontFamily") styleState.fontFamily = mediaStyle.fontFamily;
|
|
500
382
|
};
|
|
501
383
|
const isThemeMedia = isMedia === "theme";
|
|
502
384
|
const isGroupMedia = isMedia === "group";
|
|
503
385
|
const isPlatformMedia = isMedia === "platform";
|
|
504
386
|
if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
|
|
505
387
|
if (!mediaState[mediaKeyShort]) {
|
|
506
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
507
|
-
log(` \u{1F4FA} \u274C DISABLED ${mediaKeyShort}`);
|
|
508
|
-
}
|
|
388
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(` \u{1F4FA} \u274C DISABLED ${mediaKeyShort}`);
|
|
509
389
|
return;
|
|
510
390
|
}
|
|
511
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
512
|
-
log(` \u{1F4FA} \u2705 ENABLED ${mediaKeyShort}`);
|
|
513
|
-
}
|
|
391
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(` \u{1F4FA} \u2705 ENABLED ${mediaKeyShort}`);
|
|
514
392
|
}
|
|
515
393
|
const mediaStyle = getSubStyle(styleState, key, val, true);
|
|
516
394
|
let importanceBump = 0;
|
|
517
395
|
if (isThemeMedia) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const scheme = mediaKeyShort;
|
|
521
|
-
const oppositeScheme = getOppositeScheme(mediaKeyShort);
|
|
522
|
-
const themeOriginalValues = styleOriginalValues.get(mediaStyle);
|
|
523
|
-
const isCurrentScheme = themeName === scheme || themeName.startsWith(scheme);
|
|
524
|
-
for (const subKey in mediaStyle) {
|
|
525
|
-
const val2 = extractValueFromDynamic(mediaStyle[subKey], scheme);
|
|
526
|
-
const existing = styleState.style[subKey];
|
|
527
|
-
if (!isColorStyleKey(subKey)) {
|
|
528
|
-
dynamicThemeAccess = true;
|
|
529
|
-
if (isCurrentScheme) {
|
|
530
|
-
mediaStyle[subKey] = val2;
|
|
531
|
-
} else {
|
|
532
|
-
delete mediaStyle[subKey];
|
|
533
|
-
}
|
|
534
|
-
continue;
|
|
535
|
-
}
|
|
536
|
-
if (existing?.dynamic) {
|
|
537
|
-
existing.dynamic[scheme] = val2;
|
|
538
|
-
mediaStyle[subKey] = existing;
|
|
539
|
-
} else {
|
|
540
|
-
const oppositeVal = extractValueFromDynamic(existing, oppositeScheme);
|
|
541
|
-
mediaStyle[subKey] = getDynamicVal({
|
|
542
|
-
scheme,
|
|
543
|
-
val: val2,
|
|
544
|
-
oppositeVal
|
|
545
|
-
});
|
|
546
|
-
mergeStyle(styleState, subKey, mediaStyle[subKey], priority, false, themeOriginalValues?.[subKey]);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
} else {
|
|
550
|
-
dynamicThemeAccess = true;
|
|
551
|
-
if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) {
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
396
|
+
dynamicThemeAccess = true;
|
|
397
|
+
if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
|
|
555
398
|
} else if (isGroupMedia) {
|
|
556
399
|
const groupInfo = getGroupPropParts(mediaKeyShort);
|
|
557
400
|
const groupName = groupInfo.name;
|
|
@@ -559,9 +402,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
559
402
|
const groupPseudoKey = groupInfo.pseudo;
|
|
560
403
|
const groupMediaKey = groupInfo.media;
|
|
561
404
|
if (!groupState) {
|
|
562
|
-
if (process.env.NODE_ENV === "development" && debug) {
|
|
563
|
-
log(`No parent with group prop, skipping styles: ${groupName}`);
|
|
564
|
-
}
|
|
405
|
+
if (process.env.NODE_ENV === "development" && debug) log(`No parent with group prop, skipping styles: ${groupName}`);
|
|
565
406
|
pseudoGroups ||= /* @__PURE__ */new Set();
|
|
566
407
|
return;
|
|
567
408
|
}
|
|
@@ -571,21 +412,15 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
571
412
|
mediaGroups.add(groupMediaKey);
|
|
572
413
|
const mediaState2 = componentGroupState?.media;
|
|
573
414
|
let isActive = mediaState2?.[groupMediaKey];
|
|
574
|
-
if (!mediaState2 && groupState.layout)
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
...mediaState2,
|
|
580
|
-
usedKeys: {
|
|
581
|
-
...styleState.usedKeys
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
if (!isActive) {
|
|
586
|
-
for (const pkey in mediaStyle) {
|
|
587
|
-
applyDefaultStyle(pkey, styleState);
|
|
415
|
+
if (!mediaState2 && groupState.layout) isActive = mediaKeyMatch(groupMediaKey, groupState.layout);
|
|
416
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(` \u{1F3D8}\uFE0F GROUP media ${groupMediaKey} active? ${isActive}`, {
|
|
417
|
+
...mediaState2,
|
|
418
|
+
usedKeys: {
|
|
419
|
+
...styleState.usedKeys
|
|
588
420
|
}
|
|
421
|
+
});
|
|
422
|
+
if (!isActive) {
|
|
423
|
+
for (const pkey in mediaStyle) applyDefaultStyle(pkey, styleState);
|
|
589
424
|
return;
|
|
590
425
|
}
|
|
591
426
|
importanceBump = 2;
|
|
@@ -593,41 +428,31 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
593
428
|
if (groupPseudoKey) {
|
|
594
429
|
pseudoGroups ||= /* @__PURE__ */new Set();
|
|
595
430
|
pseudoGroups.add(groupName);
|
|
596
|
-
const componentGroupPseudoState = (componentGroupState ||
|
|
597
|
-
// fallback to context initially
|
|
598
|
-
groupContext?.[groupName].state)?.pseudo;
|
|
431
|
+
const componentGroupPseudoState = (componentGroupState || groupContext?.[groupName].state)?.pseudo;
|
|
599
432
|
const isActive = componentGroupPseudoState?.[groupPseudoKey];
|
|
600
433
|
const priority2 = pseudoPriorities[groupPseudoKey];
|
|
601
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
602
|
-
|
|
603
|
-
componentGroupPseudoState
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
usedKeys
|
|
607
|
-
...styleState.usedKeys
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
if (!isActive) {
|
|
612
|
-
for (const pkey in mediaStyle) {
|
|
613
|
-
applyDefaultStyle(pkey, styleState);
|
|
434
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") log(` \u{1F3D8}\uFE0F GROUP pseudo ${groupMediaKey} active? ${isActive}, priority ${priority2}`, {
|
|
435
|
+
componentGroupPseudoState: {
|
|
436
|
+
...componentGroupPseudoState
|
|
437
|
+
},
|
|
438
|
+
usedKeys: {
|
|
439
|
+
...styleState.usedKeys
|
|
614
440
|
}
|
|
441
|
+
});
|
|
442
|
+
if (!isActive) {
|
|
443
|
+
for (const pkey in mediaStyle) applyDefaultStyle(pkey, styleState);
|
|
615
444
|
return;
|
|
616
445
|
}
|
|
617
446
|
importanceBump = priority2;
|
|
618
447
|
}
|
|
619
|
-
} else if (isPlatformMedia)
|
|
620
|
-
importanceBump = getPlatformSpecificityBump(mediaKeyShort);
|
|
621
|
-
}
|
|
448
|
+
} else if (isPlatformMedia) importanceBump = getPlatformSpecificityBump(mediaKeyShort);
|
|
622
449
|
const mediaOriginalValues = styleOriginalValues.get(mediaStyle);
|
|
623
450
|
if (isGroupMedia && mediaStyle.transition) {
|
|
624
451
|
styleState.pseudoTransitions ||= {};
|
|
625
452
|
styleState.pseudoTransitions[`$${mediaKeyShort}`] = mediaStyle.transition;
|
|
626
453
|
}
|
|
627
454
|
for (const subKey in mediaStyle) {
|
|
628
|
-
if (subKey === "space")
|
|
629
|
-
continue;
|
|
630
|
-
}
|
|
455
|
+
if (subKey === "space") continue;
|
|
631
456
|
if (subKey[0] === "$") {
|
|
632
457
|
const subMediaType = getMediaKey(subKey);
|
|
633
458
|
if (subMediaType === "platform") {
|
|
@@ -635,47 +460,31 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
635
460
|
} else if (subMediaType === "theme") {
|
|
636
461
|
if (!isActiveTheme(subKey, themeName)) continue;
|
|
637
462
|
} else if (subMediaType === true) {
|
|
638
|
-
|
|
639
|
-
if (!mediaState[subKeyShort]) continue;
|
|
463
|
+
if (!mediaState[subKey.slice(1)]) continue;
|
|
640
464
|
}
|
|
641
465
|
const nestedVal = mediaStyle[subKey];
|
|
642
466
|
const subOriginalValues = styleOriginalValues.get(nestedVal);
|
|
643
|
-
const
|
|
644
|
-
const outerBase = isSizeMediaKey ? getMediaKeyImportance(mediaKeyShort) : defaultMediaImportance;
|
|
467
|
+
const outerBase = !!mediaState[mediaKeyShort] ? getMediaKeyImportance(mediaKeyShort) : defaultMediaImportance;
|
|
645
468
|
let innerBase;
|
|
646
|
-
if (subMediaType === "platform")
|
|
647
|
-
innerBase = defaultMediaImportance + getPlatformSpecificityBump(subKey.slice(1));
|
|
648
|
-
} else if (subMediaType === true) {
|
|
649
|
-
innerBase = getMediaKeyImportance(subKey.slice(1));
|
|
650
|
-
} else {
|
|
651
|
-
innerBase = defaultMediaImportance;
|
|
652
|
-
}
|
|
469
|
+
if (subMediaType === "platform") innerBase = defaultMediaImportance + getPlatformSpecificityBump(subKey.slice(1));else if (subMediaType === true) innerBase = getMediaKeyImportance(subKey.slice(1));else innerBase = defaultMediaImportance;
|
|
653
470
|
const nestedImportance = outerBase + importanceBump + innerBase + 1;
|
|
654
471
|
for (const subSubKey in nestedVal) {
|
|
655
472
|
const expandedKey = shorthands[subSubKey] || subSubKey;
|
|
656
473
|
const {
|
|
657
474
|
usedKeys
|
|
658
475
|
} = styleState;
|
|
659
|
-
if (usedKeys[expandedKey] && usedKeys[expandedKey] > nestedImportance)
|
|
660
|
-
continue;
|
|
661
|
-
}
|
|
476
|
+
if (usedKeys[expandedKey] && usedKeys[expandedKey] > nestedImportance) continue;
|
|
662
477
|
styleState.style ||= {};
|
|
663
478
|
mergeStyle(styleState, expandedKey, nestedVal[subSubKey], nestedImportance, false, subOriginalValues?.[subSubKey]);
|
|
664
|
-
if (expandedKey === "fontFamily")
|
|
665
|
-
styleState.fontFamily = nestedVal[subSubKey];
|
|
666
|
-
}
|
|
479
|
+
if (expandedKey === "fontFamily") styleState.fontFamily = nestedVal[subSubKey];
|
|
667
480
|
}
|
|
668
|
-
} else
|
|
669
|
-
mergeMediaStyle(subKey, mediaStyle[subKey], mediaOriginalValues?.[subKey]);
|
|
670
|
-
}
|
|
481
|
+
} else mergeMediaStyle(subKey, mediaStyle[subKey], mediaOriginalValues?.[subKey]);
|
|
671
482
|
}
|
|
672
483
|
}
|
|
673
484
|
return;
|
|
674
485
|
}
|
|
675
486
|
if (!isVariant) {
|
|
676
|
-
if (isStyledContextProp)
|
|
677
|
-
return;
|
|
678
|
-
}
|
|
487
|
+
if (isStyledContextProp) return;
|
|
679
488
|
viewProps[key] = val;
|
|
680
489
|
}
|
|
681
490
|
});
|
|
@@ -695,17 +504,12 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
695
504
|
console.groupEnd();
|
|
696
505
|
}
|
|
697
506
|
}
|
|
698
|
-
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time))
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
const avoidNormalize = styleProps.noNormalize === false;
|
|
702
|
-
if (!avoidNormalize) {
|
|
507
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-propsend`;
|
|
508
|
+
if (!(styleProps.noNormalize === false)) {
|
|
703
509
|
if (styleState.style) {
|
|
704
510
|
fixStyles(styleState.style);
|
|
705
511
|
if (!styleProps.noExpand && !styleProps.noMergeStyle) {
|
|
706
|
-
if (isWeb && (isReactNative ? driver?.inputStyle !== "css" : true))
|
|
707
|
-
styleToCSS(styleState.style);
|
|
708
|
-
}
|
|
512
|
+
if (isWeb && (isReactNative ? driver?.inputStyle !== "css" : true)) styleToCSS(styleState.style);
|
|
709
513
|
}
|
|
710
514
|
}
|
|
711
515
|
if (styleState.flatTransforms) {
|
|
@@ -713,129 +517,81 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
713
517
|
mergeFlatTransforms(styleState.style, styleState.flatTransforms);
|
|
714
518
|
}
|
|
715
519
|
if (parentSplitStyles) {
|
|
716
|
-
if (
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
520
|
+
if (shouldDoClasses) for (const key in parentSplitStyles.classNames) {
|
|
521
|
+
const val = parentSplitStyles.classNames[key];
|
|
522
|
+
if (styleState.style && key in styleState.style || key in classNames) continue;
|
|
523
|
+
classNames[key] = val;
|
|
524
|
+
}
|
|
525
|
+
if (!shouldDoClasses) for (const key in parentSplitStyles.style) {
|
|
526
|
+
if (key in classNames || styleState.style && key in styleState.style) continue;
|
|
527
|
+
styleState.style ||= {};
|
|
528
|
+
styleState.style[key] = parentSplitStyles.style[key];
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (!styleProps.noNormalize && !staticConfig.isReactNative && !staticConfig.isHOC && (!styleProps.isAnimated || driver?.inputStyle === "css") && Array.isArray(styleState.style?.transform)) styleState.style.transform = transformsToString(styleState.style.transform);
|
|
533
|
+
if (!styleProps.noMergeStyle && styleState.style && shouldDoClasses) {
|
|
534
|
+
let retainedStyles;
|
|
535
|
+
let shouldRetain = false;
|
|
536
|
+
if (styleState.style["$$css"]) {} else {
|
|
537
|
+
const atomic = getCSSStylesAtomic(styleState.style);
|
|
538
|
+
for (const atomicStyle of atomic) {
|
|
539
|
+
const [key, value, identifier] = atomicStyle;
|
|
540
|
+
const isAnimatedAndTransitionOnly = styleProps.isAnimated && styleProps.noClass && props.animateOnly?.includes(key);
|
|
541
|
+
const nonAnimatedTransitionOnly = !isAnimatedAndTransitionOnly && !styleProps.isAnimated && isClient && driver?.outputStyle === "css" && props.animateOnly?.includes(key);
|
|
542
|
+
if (isAnimatedAndTransitionOnly) {
|
|
543
|
+
retainedStyles ||= {};
|
|
544
|
+
retainedStyles[key] = styleState.style[key];
|
|
545
|
+
} else if (nonAnimatedTransitionOnly) {
|
|
546
|
+
retainedStyles ||= {};
|
|
547
|
+
retainedStyles[key] = value;
|
|
548
|
+
shouldRetain = true;
|
|
549
|
+
} else {
|
|
550
|
+
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
551
|
+
classNames[key] = identifier;
|
|
723
552
|
}
|
|
724
553
|
}
|
|
725
|
-
if (
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
554
|
+
if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
|
|
555
|
+
console.groupCollapsed(`\u{1F539} getSplitStyles final style object`);
|
|
556
|
+
console.info(styleState.style);
|
|
557
|
+
console.info(`retainedStyles`, retainedStyles);
|
|
558
|
+
console.groupEnd();
|
|
731
559
|
}
|
|
560
|
+
if (shouldRetain || !(process.env.IS_STATIC === "is_static")) styleState.style = retainedStyles || {};
|
|
732
561
|
}
|
|
733
562
|
}
|
|
734
|
-
if (
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
let shouldRetain = false;
|
|
744
|
-
if (styleState.style["$$css"]) {} else {
|
|
745
|
-
const atomic = getCSSStylesAtomic(styleState.style);
|
|
746
|
-
for (const atomicStyle of atomic) {
|
|
747
|
-
const [key, value, identifier] = atomicStyle;
|
|
748
|
-
const isAnimatedAndTransitionOnly = styleProps.isAnimated && styleProps.noClass && props.animateOnly?.includes(key);
|
|
749
|
-
const nonAnimatedTransitionOnly = !isAnimatedAndTransitionOnly && !styleProps.isAnimated && isClient && driver?.outputStyle === "css" && props.animateOnly?.includes(key);
|
|
750
|
-
if (isAnimatedAndTransitionOnly) {
|
|
751
|
-
retainedStyles ||= {};
|
|
752
|
-
retainedStyles[key] = styleState.style[key];
|
|
753
|
-
} else if (nonAnimatedTransitionOnly) {
|
|
754
|
-
retainedStyles ||= {};
|
|
755
|
-
retainedStyles[key] = value;
|
|
756
|
-
shouldRetain = true;
|
|
757
|
-
} else {
|
|
758
|
-
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
759
|
-
classNames[key] = identifier;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
|
|
763
|
-
console.groupCollapsed(`\u{1F539} getSplitStyles final style object`);
|
|
764
|
-
console.info(styleState.style);
|
|
765
|
-
console.info(`retainedStyles`, retainedStyles);
|
|
766
|
-
console.groupEnd();
|
|
767
|
-
}
|
|
768
|
-
if (shouldRetain || !(process.env.IS_STATIC === "is_static")) {
|
|
769
|
-
styleState.style = retainedStyles || {};
|
|
770
|
-
}
|
|
563
|
+
if (!styleProps.noMergeStyle && styleState.style && !shouldDoClasses && styleProps.isAnimated && !driver?.isReactNative) {
|
|
564
|
+
if (!styleState.style["$$css"]) {
|
|
565
|
+
const toConvert = {};
|
|
566
|
+
let hasProps = false;
|
|
567
|
+
props.animateOnly;
|
|
568
|
+
for (const key in styleState.style) if (key in nonAnimatableStyleProps) {
|
|
569
|
+
toConvert[key] = styleState.style[key];
|
|
570
|
+
delete styleState.style[key];
|
|
571
|
+
hasProps = true;
|
|
771
572
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const animateOnly = props.animateOnly;
|
|
778
|
-
for (const key in styleState.style) {
|
|
779
|
-
if (key in nonAnimatableStyleProps) {
|
|
780
|
-
toConvert[key] = styleState.style[key];
|
|
781
|
-
delete styleState.style[key];
|
|
782
|
-
hasProps = true;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
if (hasProps) {
|
|
786
|
-
const atomic = getCSSStylesAtomic(toConvert);
|
|
787
|
-
for (const atomicStyle of atomic) {
|
|
788
|
-
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
789
|
-
classNames[atomicStyle[StyleObjectProperty]] = atomicStyle[StyleObjectIdentifier];
|
|
790
|
-
}
|
|
573
|
+
if (hasProps) {
|
|
574
|
+
const atomic = getCSSStylesAtomic(toConvert);
|
|
575
|
+
for (const atomicStyle of atomic) {
|
|
576
|
+
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
577
|
+
classNames[atomicStyle[StyleObjectProperty]] = atomicStyle[StyleObjectIdentifier];
|
|
791
578
|
}
|
|
792
579
|
}
|
|
793
580
|
}
|
|
794
581
|
}
|
|
795
582
|
const styleProp = props.style;
|
|
796
|
-
if (!styleProps.noMergeStyle && styleProp) {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
if (style) {
|
|
805
|
-
if (style["$$css"]) {
|
|
806
|
-
Object.assign(styleState.classNames, style);
|
|
807
|
-
} else {
|
|
808
|
-
styleState.style ||= {};
|
|
809
|
-
Object.assign(styleState.style, normalizeStyle(style));
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
if (false) {
|
|
816
|
-
if (viewProps.tabIndex === 0) {
|
|
817
|
-
viewProps.accessible ??= true;
|
|
818
|
-
}
|
|
819
|
-
const style = styleState.style;
|
|
820
|
-
if (style?.fontFamily) {
|
|
821
|
-
const faceInfo = getFont(style.fontFamily)?.face;
|
|
822
|
-
if (faceInfo) {
|
|
823
|
-
const overrideFace = faceInfo[style.fontWeight]?.[style.fontStyle || "normal"]?.val;
|
|
824
|
-
if (overrideFace) {
|
|
825
|
-
style.fontFamily = overrideFace;
|
|
826
|
-
styleState.fontFamily = overrideFace;
|
|
827
|
-
delete style.fontWeight;
|
|
828
|
-
delete style.fontStyle;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
if (process.env.NODE_ENV === "development" && debug && debug !== "profile") {
|
|
832
|
-
log(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
|
|
583
|
+
if (!styleProps.noMergeStyle && styleProp) if (isHOC) viewProps.style = normalizeStyle(styleProp);else {
|
|
584
|
+
const isArray = Array.isArray(styleProp);
|
|
585
|
+
const len = isArray ? styleProp.length : 1;
|
|
586
|
+
for (let i = 0; i < len; i++) {
|
|
587
|
+
const style = isArray ? styleProp[i] : styleProp;
|
|
588
|
+
if (style) if (style["$$css"]) Object.assign(styleState.classNames, style);else {
|
|
589
|
+
styleState.style ||= {};
|
|
590
|
+
Object.assign(styleState.style, normalizeStyle(style));
|
|
833
591
|
}
|
|
834
592
|
}
|
|
835
593
|
}
|
|
836
|
-
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time))
|
|
837
|
-
time`split-styles-pre-result`;
|
|
838
|
-
}
|
|
594
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-pre-result`;
|
|
839
595
|
const result = {
|
|
840
596
|
hasMedia,
|
|
841
597
|
fontFamily: styleState.fontFamily,
|
|
@@ -854,11 +610,9 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
854
610
|
if (!styleProps.noMergeStyle) {
|
|
855
611
|
if (!asChildExceptStyleLike) {
|
|
856
612
|
const style = styleState.style;
|
|
857
|
-
|
|
613
|
+
{
|
|
858
614
|
let fontFamily = isText || isInput ? styleState.fontFamily : null;
|
|
859
|
-
if (fontFamily && fontFamily[0] === "$")
|
|
860
|
-
fontFamily = fontFamily.slice(1);
|
|
861
|
-
}
|
|
615
|
+
if (fontFamily && fontFamily[0] === "$") fontFamily = fontFamily.slice(1);
|
|
862
616
|
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "";
|
|
863
617
|
const groupClassName = props.group ? `t_group_${props.group}` : "";
|
|
864
618
|
const componentNameFinal = props.componentName || staticConfig.componentName;
|
|
@@ -874,9 +628,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
874
628
|
const needsCssStyles = isReactNative || styleProps.isAnimated && driver?.isReactNative;
|
|
875
629
|
if (styleProps.isAnimated && driver?.inputStyle === "css") {
|
|
876
630
|
viewProps.className = finalClassName;
|
|
877
|
-
if (style)
|
|
878
|
-
viewProps.style = style;
|
|
879
|
-
}
|
|
631
|
+
if (style) viewProps.style = style;
|
|
880
632
|
} else if (needsCssStyles) {
|
|
881
633
|
let cnStyles;
|
|
882
634
|
for (const name of finalClassName.split(" ")) {
|
|
@@ -887,16 +639,8 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
887
639
|
}
|
|
888
640
|
viewProps.style = cnStyles ? [...(Array.isArray(style) ? style : [style]), cnStyles] : [style];
|
|
889
641
|
} else {
|
|
890
|
-
if (finalClassName)
|
|
891
|
-
|
|
892
|
-
}
|
|
893
|
-
if (style) {
|
|
894
|
-
viewProps.style = style;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
} else {
|
|
898
|
-
if (style) {
|
|
899
|
-
viewProps.style = style;
|
|
642
|
+
if (finalClassName) viewProps.className = finalClassName;
|
|
643
|
+
if (style) viewProps.style = style;
|
|
900
644
|
}
|
|
901
645
|
}
|
|
902
646
|
}
|
|
@@ -904,7 +648,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
904
648
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
905
649
|
if (isClient && isDevTools) {
|
|
906
650
|
console.groupEnd();
|
|
907
|
-
console.groupCollapsed("
|
|
651
|
+
console.groupCollapsed("🔹 getSplitStyles ===>");
|
|
908
652
|
try {
|
|
909
653
|
const logs = {
|
|
910
654
|
...result,
|
|
@@ -914,16 +658,12 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
914
658
|
rulesToInsert,
|
|
915
659
|
parentSplitStyles
|
|
916
660
|
};
|
|
917
|
-
for (const key in logs)
|
|
918
|
-
log(key, logs[key]);
|
|
919
|
-
}
|
|
661
|
+
for (const key in logs) log(key, logs[key]);
|
|
920
662
|
} catch {}
|
|
921
663
|
console.groupEnd();
|
|
922
664
|
}
|
|
923
665
|
}
|
|
924
|
-
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time))
|
|
925
|
-
time`split-styles-done`;
|
|
926
|
-
}
|
|
666
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-done`;
|
|
927
667
|
return result;
|
|
928
668
|
};
|
|
929
669
|
function mergeFlatTransforms(target, flatTransforms) {
|
|
@@ -938,10 +678,7 @@ function mergeStyle(styleState, key, val, importance, disableNormalize = false,
|
|
|
938
678
|
staticConfig,
|
|
939
679
|
usedKeys
|
|
940
680
|
} = styleState;
|
|
941
|
-
|
|
942
|
-
if (existingImportance > importance) {
|
|
943
|
-
return;
|
|
944
|
-
}
|
|
681
|
+
if ((usedKeys[key] || 0) > importance) return;
|
|
945
682
|
const contextProps = staticConfig.context?.props || staticConfig.parentStaticConfig?.context?.props;
|
|
946
683
|
if (contextProps && key in contextProps) {
|
|
947
684
|
styleState.overriddenContextProps ||= {};
|
|
@@ -953,19 +690,11 @@ function mergeStyle(styleState, key, val, importance, disableNormalize = false,
|
|
|
953
690
|
usedKeys[key] = importance;
|
|
954
691
|
styleState.flatTransforms[key] = val;
|
|
955
692
|
} else {
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
-
if (
|
|
959
|
-
// accept is for props not styles
|
|
960
|
-
staticConfig.accept && key in staticConfig.accept) {
|
|
961
|
-
viewProps[key] = out;
|
|
962
|
-
} else {
|
|
693
|
+
const out = isWeb && !disableNormalize && !styleProps.noNormalize ? normalizeValueWithProperty(val, key) : val;
|
|
694
|
+
if (staticConfig.accept && key in staticConfig.accept) viewProps[key] = out;else {
|
|
963
695
|
styleState.style ||= {};
|
|
964
696
|
usedKeys[key] = importance;
|
|
965
|
-
styleState.style[key] =
|
|
966
|
-
// if you dont do this you'll be passing props.transform arrays directly here and then mutating them
|
|
967
|
-
// if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
|
|
968
|
-
key === "transform" && Array.isArray(out) ? [...out] : out;
|
|
697
|
+
styleState.style[key] = key === "transform" && Array.isArray(out) ? [...out] : out;
|
|
969
698
|
}
|
|
970
699
|
}
|
|
971
700
|
}
|
|
@@ -986,33 +715,19 @@ const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
|
986
715
|
const driver = styleState.animationDriver;
|
|
987
716
|
if (driver?.outputStyle === "css") {
|
|
988
717
|
const animationConfig = driver.animations?.[val];
|
|
989
|
-
if (animationConfig) {
|
|
990
|
-
const important = subKey[0] === "$" ? " !important" : "";
|
|
991
|
-
styleOut["transition"] = `all ${animationConfig}${important}`;
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
if (!styleOut["transition"] && typeof val === "string" && !driver?.animations?.[val]) {
|
|
995
|
-
styleOut["transition"] = val;
|
|
718
|
+
if (animationConfig) styleOut["transition"] = `all ${animationConfig}${subKey[0] === "$" ? " !important" : ""}`;
|
|
996
719
|
}
|
|
720
|
+
if (!styleOut["transition"] && typeof val === "string" && !driver?.animations?.[val]) styleOut["transition"] = val;
|
|
997
721
|
continue;
|
|
998
722
|
}
|
|
999
|
-
|
|
1000
|
-
if (shouldSkip) {
|
|
1001
|
-
continue;
|
|
1002
|
-
}
|
|
723
|
+
if (!staticConfig.isHOC && key in skipProps && !styleProps.noSkip) continue;
|
|
1003
724
|
propMapper(key, val, styleState, false, (skey, sval, originalVal) => {
|
|
1004
725
|
if (originalVal !== void 0) {
|
|
1005
726
|
originalValues ||= {};
|
|
1006
727
|
originalValues[skey] = originalVal;
|
|
1007
728
|
}
|
|
1008
|
-
if (skey in validPseudoKeys)
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
if (!avoidMergeTransform && skey in stylePropsTransform) {
|
|
1012
|
-
mergeTransform(styleOut, skey, sval);
|
|
1013
|
-
} else {
|
|
1014
|
-
styleOut[skey] = styleProps.noNormalize ? sval : normalizeValueWithProperty(sval, key);
|
|
1015
|
-
}
|
|
729
|
+
if (skey in validPseudoKeys) sval = getSubStyle(styleState, skey, sval, avoidMergeTransform);
|
|
730
|
+
if (!avoidMergeTransform && skey in stylePropsTransform) mergeTransform(styleOut, skey, sval);else styleOut[skey] = styleProps.noNormalize ? sval : normalizeValueWithProperty(sval, key);
|
|
1016
731
|
});
|
|
1017
732
|
}
|
|
1018
733
|
if (!avoidMergeTransform) {
|
|
@@ -1026,11 +741,9 @@ const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
|
1026
741
|
outer: for (let i = 0; i < parentTransform.length; i++) {
|
|
1027
742
|
const pt = parentTransform[i];
|
|
1028
743
|
for (const pk in pt) {
|
|
1029
|
-
for (let j = 0; j < len; j++) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
break;
|
|
1033
|
-
}
|
|
744
|
+
for (let j = 0; j < len; j++) for (const sk in styleOutTransform[j]) {
|
|
745
|
+
if (pk === sk) continue outer;
|
|
746
|
+
break;
|
|
1034
747
|
}
|
|
1035
748
|
merged.push(pt);
|
|
1036
749
|
break;
|
|
@@ -1039,28 +752,18 @@ const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
|
1039
752
|
for (let i = 0; i < len; i++) merged.push(styleOutTransform[i]);
|
|
1040
753
|
styleOut.transform = merged;
|
|
1041
754
|
}
|
|
1042
|
-
if (flatTransforms) {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (ck === sk) continue outer;
|
|
1048
|
-
break;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
mergeTransform(styleOut, fk, flatTransforms[fk]);
|
|
755
|
+
if (flatTransforms) outer: for (const fk in flatTransforms) {
|
|
756
|
+
const ck = fk === "x" ? "translateX" : fk === "y" ? "translateY" : fk;
|
|
757
|
+
for (let j = 0; j < len; j++) for (const sk in styleOutTransform[j]) {
|
|
758
|
+
if (ck === sk) continue outer;
|
|
759
|
+
break;
|
|
1052
760
|
}
|
|
761
|
+
mergeTransform(styleOut, fk, flatTransforms[fk]);
|
|
1053
762
|
}
|
|
1054
|
-
} else if (flatTransforms)
|
|
1055
|
-
mergeFlatTransforms(styleOut, flatTransforms);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
if (!styleProps.noNormalize) {
|
|
1059
|
-
fixStyles(styleOut);
|
|
1060
|
-
}
|
|
1061
|
-
if (originalValues) {
|
|
1062
|
-
styleOriginalValues.set(styleOut, originalValues);
|
|
763
|
+
} else if (flatTransforms) mergeFlatTransforms(styleOut, flatTransforms);
|
|
1063
764
|
}
|
|
765
|
+
if (!styleProps.noNormalize) fixStyles(styleOut);
|
|
766
|
+
if (originalValues) styleOriginalValues.set(styleOut, originalValues);
|
|
1064
767
|
return styleOut;
|
|
1065
768
|
};
|
|
1066
769
|
const useInsertEffectCompat = isWeb ? React.useInsertionEffect || useIsomorphicLayoutEffect : () => {};
|
|
@@ -1068,17 +771,13 @@ const useSplitStyles = (a, b, c, d, e, f, g, h, i, j, k, l, m) => {
|
|
|
1068
771
|
"use no memo";
|
|
1069
772
|
|
|
1070
773
|
const res = getSplitStyles(a, b, c, d, e, f, g, h, i, j, k, l, m);
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
insertStyleRules(res.rulesToInsert);
|
|
1075
|
-
}
|
|
1076
|
-
}, [res?.rulesToInsert]);
|
|
1077
|
-
}
|
|
774
|
+
useInsertEffectCompat(() => {
|
|
775
|
+
if (res) insertStyleRules(res.rulesToInsert);
|
|
776
|
+
}, [res?.rulesToInsert]);
|
|
1078
777
|
return res;
|
|
1079
778
|
};
|
|
1080
779
|
function addStyleToInsertRules(rulesToInsert, styleObject) {
|
|
1081
|
-
|
|
780
|
+
{
|
|
1082
781
|
const identifier = styleObject[StyleObjectIdentifier];
|
|
1083
782
|
if (shouldInsertStyleRules(identifier)) {
|
|
1084
783
|
updateRules(identifier, styleObject[StyleObjectRules]);
|
|
@@ -1104,9 +803,7 @@ const animatableDefaults = {
|
|
|
1104
803
|
borderRadius: 0
|
|
1105
804
|
};
|
|
1106
805
|
const mergeTransform = (obj, key, val, backwards = false) => {
|
|
1107
|
-
if (typeof obj.transform === "string")
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
806
|
+
if (typeof obj.transform === "string") return;
|
|
1110
807
|
obj.transform ||= [];
|
|
1111
808
|
obj.transform[backwards ? "unshift" : "push"]({
|
|
1112
809
|
[mapTransformKeys[key] || key]: val
|
|
@@ -1124,9 +821,7 @@ function passDownProp(viewProps, key, val, shouldMergeObject = false) {
|
|
|
1124
821
|
};
|
|
1125
822
|
delete viewProps[key];
|
|
1126
823
|
viewProps[key] = next;
|
|
1127
|
-
} else
|
|
1128
|
-
viewProps[key] = val;
|
|
1129
|
-
}
|
|
824
|
+
} else viewProps[key] = val;
|
|
1130
825
|
}
|
|
1131
826
|
function mergeMediaByImportance(styleState, mediaKey, key, value, isSizeMedia, importanceBump, debugProp, originalVal) {
|
|
1132
827
|
const usedKeys = styleState.usedKeys;
|
|
@@ -1135,49 +830,30 @@ function mergeMediaByImportance(styleState, mediaKey, key, value, isSizeMedia, i
|
|
|
1135
830
|
const bumpedImportance = defaultMediaImportance + importanceBump;
|
|
1136
831
|
importance = !usedKeys[key] || bumpedImportance > usedKeys[key] ? bumpedImportance : null;
|
|
1137
832
|
}
|
|
1138
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
1139
|
-
|
|
1140
|
-
}
|
|
1141
|
-
if (importance === null) {
|
|
1142
|
-
return false;
|
|
1143
|
-
}
|
|
833
|
+
if (process.env.NODE_ENV === "development" && debugProp === "verbose") log(`mergeMediaByImportance ${key} importance usedKey ${usedKeys[key]} next ${importance}`);
|
|
834
|
+
if (importance === null) return false;
|
|
1144
835
|
if (key in pseudoDescriptors) {
|
|
1145
836
|
const descriptor = pseudoDescriptors[key];
|
|
1146
837
|
const descriptorKey = descriptor.stateKey || descriptor.name;
|
|
1147
|
-
|
|
1148
|
-
if (isDisabled) {
|
|
1149
|
-
return false;
|
|
1150
|
-
}
|
|
838
|
+
if (styleState.componentState[descriptorKey] === false) return false;
|
|
1151
839
|
const pseudoOriginalValues = styleOriginalValues.get(value);
|
|
1152
|
-
for (const subKey in value)
|
|
1153
|
-
|
|
1154
|
-
}
|
|
1155
|
-
} else {
|
|
1156
|
-
mergeStyle(styleState, key, value, importance, false, originalVal);
|
|
1157
|
-
}
|
|
840
|
+
for (const subKey in value) mergeStyle(styleState, subKey, value[subKey], importance, false, pseudoOriginalValues?.[subKey]);
|
|
841
|
+
} else mergeStyle(styleState, key, value, importance, false, originalVal);
|
|
1158
842
|
return true;
|
|
1159
843
|
}
|
|
1160
844
|
function normalizeStyle(style) {
|
|
1161
845
|
const out = {};
|
|
1162
846
|
for (const key in style) {
|
|
1163
847
|
const val = style[key];
|
|
1164
|
-
if (key in stylePropsTransform)
|
|
1165
|
-
mergeTransform(out, key, val);
|
|
1166
|
-
} else {
|
|
1167
|
-
out[key] = normalizeValueWithProperty(val, key);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
if (isWeb && Array.isArray(out.transform)) {
|
|
1171
|
-
out.transform = transformsToString(out.transform);
|
|
848
|
+
if (key in stylePropsTransform) mergeTransform(out, key, val);else out[key] = normalizeValueWithProperty(val, key);
|
|
1172
849
|
}
|
|
850
|
+
if (isWeb && Array.isArray(out.transform)) out.transform = transformsToString(out.transform);
|
|
1173
851
|
fixStyles(out);
|
|
1174
852
|
return out;
|
|
1175
853
|
}
|
|
1176
854
|
function applyDefaultStyle(pkey, styleState) {
|
|
1177
855
|
const defaultValues = animatableDefaults[pkey];
|
|
1178
|
-
if (defaultValues != null && !(pkey in styleState.usedKeys) && (!styleState.style || !(pkey in styleState.style)))
|
|
1179
|
-
mergeStyle(styleState, pkey, defaultValues, 1);
|
|
1180
|
-
}
|
|
856
|
+
if (defaultValues != null && !(pkey in styleState.usedKeys) && (!styleState.style || !(pkey in styleState.style))) mergeStyle(styleState, pkey, defaultValues, 1);
|
|
1181
857
|
}
|
|
1182
858
|
export { PROP_SPLIT, getSplitStyles, getSubStyle, styleOriginalValues, useSplitStyles };
|
|
1183
859
|
//# sourceMappingURL=getSplitStyles.mjs.map
|