@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,5 +1,6 @@
|
|
|
1
1
|
import { composeRefs } from "@hanzogui/compose-refs";
|
|
2
2
|
import { isClient, isServer, isWeb, useIsomorphicLayoutEffect } from "@hanzogui/constants";
|
|
3
|
+
import { NativeMenuContext } from "@hanzogui/native";
|
|
3
4
|
import { composeEventHandlers } from "@hanzogui/helpers";
|
|
4
5
|
import { isEqualShallow } from "@hanzogui/is-equal-shallow";
|
|
5
6
|
import React, { useMemo } from "react";
|
|
@@ -9,7 +10,7 @@ import { ComponentContext } from "./contexts/ComponentContext.mjs";
|
|
|
9
10
|
import { GroupContext } from "./contexts/GroupContext.mjs";
|
|
10
11
|
import { didGetVariableValue, setDidGetVariableValue } from "./createVariable.mjs";
|
|
11
12
|
import { defaultComponentStateMounted } from "./defaultComponentState.mjs";
|
|
12
|
-
import { getWebEvents } from "./eventHandling.mjs";
|
|
13
|
+
import { getWebEvents, useEvents, wrapWithGestureDetector } from "./eventHandling.mjs";
|
|
13
14
|
import { getDefaultProps } from "./helpers/getDefaultProps.mjs";
|
|
14
15
|
import { resolveAnimationDriver } from "./helpers/resolveAnimationDriver.mjs";
|
|
15
16
|
import { getSplitStyles, useSplitStyles } from "./helpers/getSplitStyles.mjs";
|
|
@@ -38,27 +39,23 @@ const avoidReRenderKeys = /* @__PURE__ */new Set(["hover", "press", "pressIn", "
|
|
|
38
39
|
if (typeof window !== "undefined") {
|
|
39
40
|
const cancelPresses = () => {
|
|
40
41
|
componentSetStates.forEach(setState => setState(prev => {
|
|
41
|
-
if (prev.press || prev.pressIn) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
}
|
|
42
|
+
if (prev.press || prev.pressIn) return {
|
|
43
|
+
...prev,
|
|
44
|
+
press: false,
|
|
45
|
+
pressIn: false
|
|
46
|
+
};
|
|
48
47
|
return prev;
|
|
49
48
|
}));
|
|
50
49
|
componentSetStates.clear();
|
|
51
50
|
};
|
|
52
51
|
const cancelTouches = () => {
|
|
53
52
|
componentSetStates.forEach(setState => setState(prev => {
|
|
54
|
-
if (prev.press || prev.pressIn || prev.hover) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
}
|
|
53
|
+
if (prev.press || prev.pressIn || prev.hover) return {
|
|
54
|
+
...prev,
|
|
55
|
+
press: false,
|
|
56
|
+
pressIn: false,
|
|
57
|
+
hover: false
|
|
58
|
+
};
|
|
62
59
|
return prev;
|
|
63
60
|
}));
|
|
64
61
|
componentSetStates.clear();
|
|
@@ -66,72 +63,66 @@ if (typeof window !== "undefined") {
|
|
|
66
63
|
addEventListener("mouseup", cancelPresses);
|
|
67
64
|
addEventListener("touchend", cancelTouches);
|
|
68
65
|
addEventListener("touchcancel", cancelTouches);
|
|
69
|
-
if (process.env.NODE_ENV === "development") {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
let show = function (val) {
|
|
74
|
-
clearTimeout(tm);
|
|
75
|
-
isShowing = val;
|
|
76
|
-
debugKeyListeners?.forEach(l => l(val));
|
|
77
|
-
if (!val && resizeListener) {
|
|
78
|
-
window.removeEventListener("resize", resizeListener);
|
|
79
|
-
resizeListener = null;
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
cancelShow = function () {
|
|
83
|
-
clearTimeout(tm);
|
|
84
|
-
if (resizeListener) {
|
|
85
|
-
window.removeEventListener("resize", resizeListener);
|
|
86
|
-
resizeListener = null;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
globalThis.__guiDevVisualizer = true;
|
|
90
|
-
debugKeyListeners = /* @__PURE__ */new Set();
|
|
91
|
-
let tm;
|
|
92
|
-
let isShowing = false;
|
|
93
|
-
let resizeListener = null;
|
|
94
|
-
const options = {
|
|
95
|
-
key: "Alt",
|
|
96
|
-
delay: 800,
|
|
97
|
-
...(typeof devVisualizerConfig === "object" ? devVisualizerConfig : {})
|
|
98
|
-
};
|
|
99
|
-
window.addEventListener("blur", () => {
|
|
100
|
-
show(false);
|
|
101
|
-
});
|
|
102
|
-
window.addEventListener("keydown", ({
|
|
103
|
-
key,
|
|
104
|
-
metaKey,
|
|
105
|
-
defaultPrevented
|
|
106
|
-
}) => {
|
|
66
|
+
if (process.env.NODE_ENV === "development") startVisualizer = () => {
|
|
67
|
+
const devVisualizerConfig = devConfig?.visualizer;
|
|
68
|
+
if (devVisualizerConfig && !globalThis.__guiDevVisualizer) {
|
|
69
|
+
let show = function (val) {
|
|
107
70
|
clearTimeout(tm);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
window.addEventListener("resize", resizeListener);
|
|
114
|
-
}
|
|
115
|
-
tm = setTimeout(() => {
|
|
116
|
-
show(true);
|
|
117
|
-
}, options.delay);
|
|
71
|
+
isShowing = val;
|
|
72
|
+
debugKeyListeners?.forEach(l => l(val));
|
|
73
|
+
if (!val && resizeListener) {
|
|
74
|
+
window.removeEventListener("resize", resizeListener);
|
|
75
|
+
resizeListener = null;
|
|
118
76
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (isShowing) {
|
|
126
|
-
show(false);
|
|
77
|
+
},
|
|
78
|
+
cancelShow = function () {
|
|
79
|
+
clearTimeout(tm);
|
|
80
|
+
if (resizeListener) {
|
|
81
|
+
window.removeEventListener("resize", resizeListener);
|
|
82
|
+
resizeListener = null;
|
|
127
83
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
84
|
+
};
|
|
85
|
+
globalThis.__guiDevVisualizer = true;
|
|
86
|
+
debugKeyListeners = /* @__PURE__ */new Set();
|
|
87
|
+
let tm;
|
|
88
|
+
let isShowing = false;
|
|
89
|
+
let resizeListener = null;
|
|
90
|
+
const options = {
|
|
91
|
+
key: "Alt",
|
|
92
|
+
delay: 800,
|
|
93
|
+
...(typeof devVisualizerConfig === "object" ? devVisualizerConfig : {})
|
|
94
|
+
};
|
|
95
|
+
window.addEventListener("blur", () => {
|
|
96
|
+
show(false);
|
|
97
|
+
});
|
|
98
|
+
window.addEventListener("keydown", ({
|
|
99
|
+
key,
|
|
100
|
+
metaKey,
|
|
101
|
+
defaultPrevented
|
|
102
|
+
}) => {
|
|
103
|
+
clearTimeout(tm);
|
|
104
|
+
if (defaultPrevented) return;
|
|
105
|
+
if (metaKey) return;
|
|
106
|
+
if (key === options.key) {
|
|
107
|
+
if (!resizeListener) {
|
|
108
|
+
resizeListener = () => cancelShow();
|
|
109
|
+
window.addEventListener("resize", resizeListener);
|
|
110
|
+
}
|
|
111
|
+
tm = setTimeout(() => {
|
|
112
|
+
show(true);
|
|
113
|
+
}, options.delay);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
window.addEventListener("keyup", ({
|
|
117
|
+
defaultPrevented
|
|
118
|
+
}) => {
|
|
119
|
+
if (defaultPrevented) return;
|
|
120
|
+
cancelShow();
|
|
121
|
+
if (isShowing) show(false);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
132
125
|
}
|
|
133
|
-
let BaseText;
|
|
134
|
-
let BaseView;
|
|
135
126
|
const lastInteractionWasKeyboard = {
|
|
136
127
|
value: false
|
|
137
128
|
};
|
|
@@ -140,19 +131,13 @@ const lastInteractionWasTouch = {
|
|
|
140
131
|
};
|
|
141
132
|
if (isWeb && typeof document !== "undefined") {
|
|
142
133
|
document.addEventListener("keydown", () => {
|
|
143
|
-
if (!lastInteractionWasKeyboard.value)
|
|
144
|
-
lastInteractionWasKeyboard.value = true;
|
|
145
|
-
}
|
|
134
|
+
if (!lastInteractionWasKeyboard.value) lastInteractionWasKeyboard.value = true;
|
|
146
135
|
});
|
|
147
136
|
document.addEventListener("mousedown", () => {
|
|
148
|
-
if (lastInteractionWasKeyboard.value)
|
|
149
|
-
lastInteractionWasKeyboard.value = false;
|
|
150
|
-
}
|
|
137
|
+
if (lastInteractionWasKeyboard.value) lastInteractionWasKeyboard.value = false;
|
|
151
138
|
});
|
|
152
139
|
document.addEventListener("mousemove", () => {
|
|
153
|
-
if (lastInteractionWasKeyboard.value)
|
|
154
|
-
lastInteractionWasKeyboard.value = false;
|
|
155
|
-
}
|
|
140
|
+
if (lastInteractionWasKeyboard.value) lastInteractionWasKeyboard.value = false;
|
|
156
141
|
lastInteractionWasTouch.value = false;
|
|
157
142
|
});
|
|
158
143
|
document.addEventListener("touchstart", () => {
|
|
@@ -177,16 +162,6 @@ function createComponent(staticConfig) {
|
|
|
177
162
|
startVisualizer = void 0;
|
|
178
163
|
}
|
|
179
164
|
}
|
|
180
|
-
if (false) {
|
|
181
|
-
if (!hasSetupBaseViews) {
|
|
182
|
-
hasSetupBaseViews = true;
|
|
183
|
-
const baseViews = hooks.getBaseViews?.();
|
|
184
|
-
if (baseViews) {
|
|
185
|
-
BaseText = baseViews.Text;
|
|
186
|
-
BaseView = baseViews.View;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
165
|
if (process.env.NODE_ENV === "test") {
|
|
191
166
|
if (propsIn["data-test-renders"]) {
|
|
192
167
|
propsIn["data-test-renders"]["current"] = propsIn["data-test-renders"]["current"] ?? 0;
|
|
@@ -202,80 +177,67 @@ function createComponent(staticConfig) {
|
|
|
202
177
|
let overriddenContextProps = null;
|
|
203
178
|
const componentContext = React.useContext(ComponentContext);
|
|
204
179
|
const hasTextAncestor = !!(isWeb && isText ? componentContext.inText : false);
|
|
205
|
-
const isInsideNativeMenu = false ? React.useContext(NativeMenuContext) : false;
|
|
206
180
|
if (!process.env.GUI_IS_CORE_NODE && process.env.NODE_ENV === "development" && debugProp === "profile" && !time) {
|
|
207
|
-
|
|
208
|
-
time = timer.start();
|
|
181
|
+
time = require("@hanzogui/timer").timer().start();
|
|
209
182
|
globalThis["time"] = time;
|
|
210
183
|
}
|
|
211
|
-
if (process.env.NODE_ENV === "development" && !time && globalThis.time)
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
if (process.env.NODE_ENV === "development" && time) time`non-tamagui time (ignore)`;
|
|
184
|
+
if (process.env.NODE_ENV === "development" && !time && globalThis.time) time = globalThis.time;
|
|
185
|
+
if (process.env.NODE_ENV === "development" && time) time`non-gui time (ignore)`;
|
|
215
186
|
let props = propsIn;
|
|
216
187
|
const componentName = props.componentName || staticConfig.componentName;
|
|
217
|
-
const
|
|
218
|
-
const [nextProps, overrides] = mergeComponentProps(defaultProps, styledContextValue, propsIn);
|
|
188
|
+
const [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
219
189
|
props = nextProps;
|
|
220
190
|
overriddenContextProps = overrides;
|
|
221
|
-
if (process.env.NODE_ENV === "development" && isClient) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
overlay.style.borderColor = "red";
|
|
243
|
-
overlay.style.borderWidth = "1px";
|
|
244
|
-
overlay.style.borderStyle = "dotted";
|
|
245
|
-
}
|
|
246
|
-
const dataAt = node.getAttribute("data-at") || "";
|
|
247
|
-
const dataIn = node.getAttribute("data-in") || "";
|
|
248
|
-
const tooltip = document.createElement("span");
|
|
249
|
-
tooltip.style.position = "absolute";
|
|
250
|
-
tooltip.style.top = "0px";
|
|
251
|
-
tooltip.style.left = "0px";
|
|
252
|
-
tooltip.style.padding = "3px";
|
|
253
|
-
tooltip.style.background = "rgba(0,0,0,0.75)";
|
|
254
|
-
tooltip.style.color = "rgba(255,255,255,1)";
|
|
255
|
-
tooltip.style.fontSize = "12px";
|
|
256
|
-
tooltip.style.lineHeight = "12px";
|
|
257
|
-
tooltip.style.fontFamily = "monospace";
|
|
258
|
-
tooltip.innerText = `${componentName || ""} ${dataAt} ${dataIn}`.trim();
|
|
259
|
-
overlay.appendChild(tooltip);
|
|
260
|
-
node.appendChild(overlay);
|
|
261
|
-
} else {
|
|
262
|
-
remove();
|
|
191
|
+
if (process.env.NODE_ENV === "development" && isClient) React.useEffect(() => {
|
|
192
|
+
let node;
|
|
193
|
+
let overlay = null;
|
|
194
|
+
const remove = () => {
|
|
195
|
+
if (overlay) try {
|
|
196
|
+
overlay.parentNode?.removeChild(overlay);
|
|
197
|
+
overlay = null;
|
|
198
|
+
} catch {}
|
|
199
|
+
};
|
|
200
|
+
const debugVisualizerHandler = (show = false) => {
|
|
201
|
+
node = stateRef.current.host;
|
|
202
|
+
if (!node) return;
|
|
203
|
+
if (show) {
|
|
204
|
+
if (!overlay) {
|
|
205
|
+
overlay = document.createElement("span");
|
|
206
|
+
overlay.style.inset = "0px";
|
|
207
|
+
overlay.style.zIndex = "1000000";
|
|
208
|
+
overlay.style.position = "absolute";
|
|
209
|
+
overlay.style.borderColor = "red";
|
|
210
|
+
overlay.style.borderWidth = "1px";
|
|
211
|
+
overlay.style.borderStyle = "dotted";
|
|
263
212
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
213
|
+
const dataAt = node.getAttribute("data-at") || "";
|
|
214
|
+
const dataIn = node.getAttribute("data-in") || "";
|
|
215
|
+
const tooltip = document.createElement("span");
|
|
216
|
+
tooltip.style.position = "absolute";
|
|
217
|
+
tooltip.style.top = "0px";
|
|
218
|
+
tooltip.style.left = "0px";
|
|
219
|
+
tooltip.style.padding = "3px";
|
|
220
|
+
tooltip.style.background = "rgba(0,0,0,0.75)";
|
|
221
|
+
tooltip.style.color = "rgba(255,255,255,1)";
|
|
222
|
+
tooltip.style.fontSize = "12px";
|
|
223
|
+
tooltip.style.lineHeight = "12px";
|
|
224
|
+
tooltip.style.fontFamily = "monospace";
|
|
225
|
+
tooltip.innerText = `${componentName || ""} ${dataAt} ${dataIn}`.trim();
|
|
226
|
+
overlay.appendChild(tooltip);
|
|
227
|
+
node.appendChild(overlay);
|
|
228
|
+
} else remove();
|
|
229
|
+
};
|
|
230
|
+
debugKeyListeners = debugKeyListeners || /* @__PURE__ */new Set();
|
|
231
|
+
debugKeyListeners.add(debugVisualizerHandler);
|
|
232
|
+
return () => {
|
|
233
|
+
remove();
|
|
234
|
+
debugKeyListeners?.delete(debugVisualizerHandler);
|
|
235
|
+
};
|
|
236
|
+
}, [componentName]);
|
|
273
237
|
const groupContextParent = React.useContext(GroupContext);
|
|
274
238
|
const animationDriver = (() => {
|
|
275
239
|
if (props.animatedBy && config) {
|
|
276
|
-
if (config.animationDrivers)
|
|
277
|
-
return config.animationDrivers[props.animatedBy] ?? config.animations;
|
|
278
|
-
}
|
|
240
|
+
if (config.animationDrivers) return config.animationDrivers[props.animatedBy] ?? config.animations;
|
|
279
241
|
return props.animatedBy === "default" ? config.animations : null;
|
|
280
242
|
}
|
|
281
243
|
return resolveAnimationDriver(componentContext.animationDriver) ?? resolveAnimationDriver(config?.animations) ?? null;
|
|
@@ -302,19 +264,15 @@ function createComponent(staticConfig) {
|
|
|
302
264
|
willBeAnimatedClient,
|
|
303
265
|
startedUnhydrated
|
|
304
266
|
} = componentState;
|
|
305
|
-
if (hasAnimationProp && animationDriver?.avoidReRenders) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
componentState.setStateShallow(pendingState);
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
const allGroupContexts = useMemo(() => {
|
|
315
|
-
if (!groupName || props.passThrough) {
|
|
316
|
-
return groupContextParent;
|
|
267
|
+
if (hasAnimationProp && animationDriver?.avoidReRenders) useIsomorphicLayoutEffect(() => {
|
|
268
|
+
const pendingState = stateRef.current.nextState;
|
|
269
|
+
if (pendingState) {
|
|
270
|
+
stateRef.current.nextState = void 0;
|
|
271
|
+
componentState.setStateShallow(pendingState);
|
|
317
272
|
}
|
|
273
|
+
});
|
|
274
|
+
const allGroupContexts = useMemo(() => {
|
|
275
|
+
if (!groupName || props.passThrough) return groupContextParent;
|
|
318
276
|
const listeners = /* @__PURE__ */new Set();
|
|
319
277
|
stateRef.current.group?.listeners?.clear();
|
|
320
278
|
stateRef.current.group = {
|
|
@@ -324,18 +282,14 @@ function createComponent(staticConfig) {
|
|
|
324
282
|
},
|
|
325
283
|
subscribe(cb) {
|
|
326
284
|
listeners.add(cb);
|
|
327
|
-
if (listeners.size === 1) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
});
|
|
331
|
-
}
|
|
285
|
+
if (listeners.size === 1) setStateShallow({
|
|
286
|
+
hasDynGroupChildren: true
|
|
287
|
+
});
|
|
332
288
|
return () => {
|
|
333
289
|
listeners.delete(cb);
|
|
334
|
-
if (listeners.size === 0) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
});
|
|
338
|
-
}
|
|
290
|
+
if (listeners.size === 0) setStateShallow({
|
|
291
|
+
hasDynGroupChildren: false
|
|
292
|
+
});
|
|
339
293
|
};
|
|
340
294
|
}
|
|
341
295
|
};
|
|
@@ -357,18 +311,11 @@ function createComponent(staticConfig) {
|
|
|
357
311
|
let setStateShallow = componentState.setStateShallow;
|
|
358
312
|
if (process.env.NODE_ENV === "development" && time) time`use-state`;
|
|
359
313
|
const renderProp = props.render;
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
const BaseTextComponent = BaseText || element || "span";
|
|
363
|
-
const BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
364
|
-
const BaseComponent = isText ? BaseTextComponent : BaseViewComponent;
|
|
314
|
+
const element = isWeb ? !Component || typeof Component === "string" ? renderProp || Component : Component : Component;
|
|
315
|
+
const BaseComponent = isText ? element || "span" : element || (hasTextAncestor ? "span" : "div");
|
|
365
316
|
let elementType = BaseComponent;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
elementType = animationDriver[isText ? "Text" : "View"] || elementType;
|
|
369
|
-
}
|
|
370
|
-
const disableThemeProp = false ? false : props["data-disable-theme"];
|
|
371
|
-
const disableTheme = disableThemeProp || isHOC;
|
|
317
|
+
if (animationDriver && isAnimated && animationDriver.needsCustomComponent) elementType = animationDriver[isText ? "Text" : "View"] || elementType;
|
|
318
|
+
const disableTheme = props["data-disable-theme"] || isHOC;
|
|
372
319
|
if (process.env.NODE_ENV === "development" && time) time`theme-props`;
|
|
373
320
|
const themeStateProps = {
|
|
374
321
|
componentName,
|
|
@@ -377,13 +324,8 @@ function createComponent(staticConfig) {
|
|
|
377
324
|
debug: debugProp,
|
|
378
325
|
unstyled: props.unstyled
|
|
379
326
|
};
|
|
380
|
-
if ("theme" in props)
|
|
381
|
-
themeStateProps.name = props.theme;
|
|
382
|
-
}
|
|
327
|
+
if ("theme" in props) themeStateProps.name = props.theme;
|
|
383
328
|
themeStateProps.needsUpdate = () => !!stateRef.current.isListeningToTheme;
|
|
384
|
-
if (false) {
|
|
385
|
-
themeStateProps.deopt = willBeAnimated;
|
|
386
|
-
}
|
|
387
329
|
if (process.env.NODE_ENV === "development") {
|
|
388
330
|
if (debugProp && debugProp !== "profile") {
|
|
389
331
|
const name = `${componentName || Component?.displayName || Component?.name || "[Unnamed Component]"}`;
|
|
@@ -392,19 +334,15 @@ function createComponent(staticConfig) {
|
|
|
392
334
|
const banner = `<${name} /> ${internalID} ${dataIs ? ` ${dataIs}` : ""} ${type.trim()} (hydrated: ${isHydrated}) (unmounted: ${state.unmounted})`;
|
|
393
335
|
const ch = propsIn.children;
|
|
394
336
|
let childLog = typeof ch === "string" ? ch.length > 4 ? ch.slice(0, 4) + "..." : ch : "";
|
|
395
|
-
if (childLog.length) {
|
|
396
|
-
childLog = `(children: ${childLog})`;
|
|
397
|
-
}
|
|
337
|
+
if (childLog.length) childLog = `(children: ${childLog})`;
|
|
398
338
|
if (isWeb) {
|
|
399
339
|
console.info(`%c ${banner}`, "background: green; color: white;");
|
|
400
|
-
if (isServer) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
});
|
|
407
|
-
} else {
|
|
340
|
+
if (isServer) log({
|
|
341
|
+
noClass,
|
|
342
|
+
isAnimated,
|
|
343
|
+
isWeb,
|
|
344
|
+
inputStyle
|
|
345
|
+
});else {
|
|
408
346
|
console.groupEnd();
|
|
409
347
|
console.groupCollapsed(`${childLog} [inspect props, state, context \u{1F447}]`);
|
|
410
348
|
log("props in:", propsIn);
|
|
@@ -458,13 +396,10 @@ ${banner}
|
|
|
458
396
|
const mediaState = useMedia(componentContext, debugProp);
|
|
459
397
|
setDidGetVariableValue(false);
|
|
460
398
|
if (process.env.NODE_ENV === "development" && time) time`media`;
|
|
461
|
-
const resolveValues =
|
|
462
|
-
// if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
|
|
463
|
-
isAnimated && inputStyle !== "css" || isHOC && state.unmounted == false && hasAnimationProp ? "value" : "auto";
|
|
464
399
|
const styleProps = {
|
|
465
400
|
mediaState,
|
|
466
401
|
noClass,
|
|
467
|
-
resolveValues,
|
|
402
|
+
resolveValues: isAnimated && inputStyle !== "css" || isHOC && state.unmounted == false && hasAnimationProp ? "value" : "auto",
|
|
468
403
|
isExiting,
|
|
469
404
|
isAnimated,
|
|
470
405
|
willBeAnimated,
|
|
@@ -482,23 +417,17 @@ ${banner}
|
|
|
482
417
|
overriddenContextProps = overriddenContextProps || {};
|
|
483
418
|
overriddenContextProps[key] = splitStyles.overriddenContextProps[key];
|
|
484
419
|
}
|
|
485
|
-
if (!staticConfig.context)
|
|
486
|
-
contextForOverride = contextForProps;
|
|
487
|
-
}
|
|
420
|
+
if (!staticConfig.context) contextForOverride = contextForProps;
|
|
488
421
|
}
|
|
489
422
|
}
|
|
490
423
|
const groupContext = groupName ? allGroupContexts?.[groupName] || null : null;
|
|
491
|
-
if (!isPassthrough && groupContext &&
|
|
492
|
-
// avoids onLayout if we don't need it
|
|
493
|
-
props.containerType !== "normal") {
|
|
424
|
+
if (!isPassthrough && groupContext && props.containerType !== "normal") {
|
|
494
425
|
const groupState = groupContext?.state;
|
|
495
426
|
if (groupState && groupState.layout === void 0) {
|
|
496
|
-
if (splitStyles.style?.width || splitStyles.style?.height) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
};
|
|
501
|
-
}
|
|
427
|
+
if (splitStyles.style?.width || splitStyles.style?.height) groupState.layout = {
|
|
428
|
+
width: fromPx(splitStyles.style.width),
|
|
429
|
+
height: fromPx(splitStyles.style.height)
|
|
430
|
+
};
|
|
502
431
|
}
|
|
503
432
|
}
|
|
504
433
|
const hasEnterExitTransition = props.transition && typeof props.transition === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
|
|
@@ -549,16 +478,12 @@ ${banner}
|
|
|
549
478
|
};
|
|
550
479
|
}
|
|
551
480
|
componentContext.mediaEmit = componentContext.mediaEmit || (next => {
|
|
552
|
-
for (const listener of componentContext.mediaEmitListeners)
|
|
553
|
-
listener(next);
|
|
554
|
-
}
|
|
481
|
+
for (const listener of componentContext.mediaEmitListeners) listener(next);
|
|
555
482
|
});
|
|
556
483
|
stateRef.current.setStateShallow = nextOrGetNext => {
|
|
557
484
|
const prev = stateRef.current.nextState || state;
|
|
558
485
|
const next = typeof nextOrGetNext === "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
559
|
-
if (next === prev || isEqualShallow(prev, next))
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
486
|
+
if (next === prev || isEqualShallow(prev, next)) return;
|
|
562
487
|
const canAvoidReRender = Object.keys(next).every(key => avoidReRenderKeys.has(key));
|
|
563
488
|
const updatedState = {
|
|
564
489
|
...prev,
|
|
@@ -577,12 +502,10 @@ ${banner}
|
|
|
577
502
|
updateGroupListeners();
|
|
578
503
|
stateRef.current.updateStyleListener?.();
|
|
579
504
|
} else {
|
|
580
|
-
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
});
|
|
585
|
-
}
|
|
505
|
+
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") console.info(`[\u{1F40C}] re-render`, {
|
|
506
|
+
canAvoidReRender,
|
|
507
|
+
next
|
|
508
|
+
});
|
|
586
509
|
ogSetStateShallow(next);
|
|
587
510
|
}
|
|
588
511
|
};
|
|
@@ -596,16 +519,12 @@ ${banner}
|
|
|
596
519
|
splitStyles.style = splitStyles.style || {};
|
|
597
520
|
splitStyles.style.opacity = 0;
|
|
598
521
|
}
|
|
599
|
-
if (splitStyles.dynamicThemeAccess != null)
|
|
600
|
-
stateRef.current.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
601
|
-
}
|
|
522
|
+
if (splitStyles.dynamicThemeAccess != null) stateRef.current.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
602
523
|
}
|
|
603
524
|
const hasRuntimeMediaKeys = splitStyles?.hasMedia && splitStyles.hasMedia !== true;
|
|
604
525
|
const shouldListenForMedia = didGetVariableValue() || hasRuntimeMediaKeys || noClass && splitStyles?.hasMedia === true;
|
|
605
526
|
const mediaListeningKeys = hasRuntimeMediaKeys ? splitStyles.hasMedia : null;
|
|
606
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose")
|
|
607
|
-
console.info(`useMedia() createComponent`, shouldListenForMedia, mediaListeningKeys);
|
|
608
|
-
}
|
|
527
|
+
if (process.env.NODE_ENV === "development" && debugProp === "verbose") console.info(`useMedia() createComponent`, shouldListenForMedia, mediaListeningKeys);
|
|
609
528
|
setMediaShouldUpdate(componentContext, shouldListenForMedia, mediaListeningKeys);
|
|
610
529
|
const {
|
|
611
530
|
viewProps: viewPropsIn,
|
|
@@ -634,48 +553,33 @@ ${banner}
|
|
|
634
553
|
onFocus,
|
|
635
554
|
onBlur,
|
|
636
555
|
separator,
|
|
637
|
-
// ignore from here on out
|
|
638
556
|
passThrough,
|
|
639
557
|
forceStyle: _forceStyle,
|
|
640
|
-
// @ts-ignore for next/link compat etc
|
|
641
558
|
onClick,
|
|
642
559
|
theme: _themeProp,
|
|
643
560
|
...nonGuiProps
|
|
644
561
|
} = viewPropsIn || {};
|
|
645
562
|
let viewProps = nonGuiProps;
|
|
646
|
-
if (props.forceStyle)
|
|
647
|
-
viewProps.forceStyle = props.forceStyle;
|
|
648
|
-
}
|
|
563
|
+
if (props.forceStyle) viewProps.forceStyle = props.forceStyle;
|
|
649
564
|
if (isHOC) {
|
|
650
|
-
if (typeof _themeProp !== "undefined")
|
|
651
|
-
|
|
652
|
-
}
|
|
653
|
-
if (typeof passThrough !== "undefined") {
|
|
654
|
-
viewProps.passThrough = passThrough;
|
|
655
|
-
}
|
|
565
|
+
if (typeof _themeProp !== "undefined") viewProps.theme = _themeProp;
|
|
566
|
+
if (typeof passThrough !== "undefined") viewProps.passThrough = passThrough;
|
|
656
567
|
}
|
|
657
568
|
let animationStyles;
|
|
658
|
-
const shouldUseAnimation =
|
|
659
|
-
// if it supports css vars we run it on server too to get matching initial style
|
|
660
|
-
(inputStyle === "css" ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC;
|
|
569
|
+
const shouldUseAnimation = (inputStyle === "css" ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC;
|
|
661
570
|
let animatedRef;
|
|
662
571
|
if (shouldUseAnimation) {
|
|
663
572
|
const useStyleEmitter = animationDriver?.avoidReRenders ? listener => {
|
|
664
573
|
stateRef.current.useStyleListener = listener;
|
|
665
574
|
} : void 0;
|
|
666
575
|
const effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles?.pseudoTransitions, props.transition);
|
|
667
|
-
if (splitStyles)
|
|
668
|
-
splitStyles.effectiveTransition = effectiveTransition;
|
|
669
|
-
}
|
|
576
|
+
if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
|
|
670
577
|
stateRef.current.prevPseudoState = extractPseudoState(state);
|
|
671
578
|
const animations = useAnimations({
|
|
672
579
|
props: propsWithAnimation,
|
|
673
|
-
// clone style to prevent animation driver mutations from leaking to viewProps
|
|
674
|
-
// during SSR/pre-hydration (CSS driver mutates style.transition in place)
|
|
675
580
|
style: isHydrated ? splitStylesStyle || {} : {
|
|
676
581
|
...splitStylesStyle
|
|
677
582
|
},
|
|
678
|
-
// @ts-ignore
|
|
679
583
|
styleState: splitStyles,
|
|
680
584
|
useStyleEmitter,
|
|
681
585
|
presence,
|
|
@@ -688,56 +592,38 @@ ${banner}
|
|
|
688
592
|
stateRef
|
|
689
593
|
});
|
|
690
594
|
if (animations) {
|
|
691
|
-
if (animations.ref)
|
|
692
|
-
animatedRef = animations.ref;
|
|
693
|
-
}
|
|
595
|
+
if (animations.ref) animatedRef = animations.ref;
|
|
694
596
|
if (isHydrated && animations) {
|
|
695
597
|
animationStyles = animations.style;
|
|
696
598
|
viewProps.style = animationStyles;
|
|
697
|
-
if (animations.className) {
|
|
698
|
-
viewProps.className = `${state.unmounted === "should-enter" ? "t_unmounted " : ""}${viewProps.className || ""} ${animations.className}`;
|
|
699
|
-
}
|
|
599
|
+
if (animations.className) viewProps.className = `${state.unmounted === "should-enter" ? "t_unmounted " : ""}${viewProps.className || ""} ${animations.className}`;
|
|
700
600
|
}
|
|
701
601
|
}
|
|
702
602
|
if (process.env.NODE_ENV === "development" && time) time`animations`;
|
|
703
603
|
}
|
|
704
|
-
if (process.env.NODE_ENV === "development" && props.untilMeasured && !props.group)
|
|
705
|
-
console.warn(`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
604
|
+
if (process.env.NODE_ENV === "development" && props.untilMeasured && !props.group) console.warn(`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
706
605
|
|
|
707
606
|
If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`);
|
|
708
|
-
}
|
|
709
607
|
if (process.env.NODE_ENV === "development" && time) time`destructure`;
|
|
710
|
-
if (!isPassthrough && groupContext &&
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
groupContext.state.layout = layout;
|
|
716
|
-
stateRef.current.group?.emit({
|
|
717
|
-
layout
|
|
718
|
-
});
|
|
719
|
-
if (!stateRef.current.hasMeasured && props.untilMeasured === "hide") {
|
|
720
|
-
setState(prev => ({
|
|
721
|
-
...prev
|
|
722
|
-
}));
|
|
723
|
-
}
|
|
724
|
-
stateRef.current.hasMeasured = true;
|
|
608
|
+
if (!isPassthrough && groupContext && props.containerType !== "normal") nonGuiProps.onLayout = composeEventHandlers(nonGuiProps.onLayout, e => {
|
|
609
|
+
const layout = e.nativeEvent.layout;
|
|
610
|
+
groupContext.state.layout = layout;
|
|
611
|
+
stateRef.current.group?.emit({
|
|
612
|
+
layout
|
|
725
613
|
});
|
|
726
|
-
|
|
614
|
+
if (!stateRef.current.hasMeasured && props.untilMeasured === "hide") setState(prev => ({
|
|
615
|
+
...prev
|
|
616
|
+
}));
|
|
617
|
+
stateRef.current.hasMeasured = true;
|
|
618
|
+
});
|
|
727
619
|
viewProps = hooks.usePropsTransform?.(elementType, nonGuiProps, stateRef, stateRef.current.willHydrate) || nonGuiProps;
|
|
728
|
-
if (!stateRef.current.composedRef)
|
|
729
|
-
stateRef.current.composedRef = composeRefs(x => stateRef.current.host = x, forwardedRef, setElementProps, animatedRef);
|
|
730
|
-
}
|
|
620
|
+
if (!stateRef.current.composedRef) stateRef.current.composedRef = composeRefs(x => stateRef.current.host = x, forwardedRef, setElementProps, animatedRef);
|
|
731
621
|
viewProps.ref = stateRef.current.composedRef;
|
|
732
622
|
usePointerEvents(props, viewProps);
|
|
733
623
|
if (process.env.NODE_ENV === "development") {
|
|
734
|
-
if (!isReactNative && !isText && isWeb && !isHOC) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <${staticConfig.componentName || propsIn.tag || "View"}>.`, props);
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
}
|
|
624
|
+
if (!isReactNative && !isText && isWeb && !isHOC) React.Children.toArray(props.children).forEach(item => {
|
|
625
|
+
if (typeof item === "string" && item !== "\n") console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <${staticConfig.componentName || propsIn.tag || "View"}>.`, props);
|
|
626
|
+
});
|
|
741
627
|
}
|
|
742
628
|
if (process.env.NODE_ENV === "development" && time) time`events-hooks`;
|
|
743
629
|
const unPress = () => {
|
|
@@ -746,25 +632,23 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
746
632
|
pressIn: false
|
|
747
633
|
});
|
|
748
634
|
};
|
|
749
|
-
if (process.env.NODE_ENV === "development" && isWeb) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
});
|
|
767
|
-
}
|
|
635
|
+
if (process.env.NODE_ENV === "development" && isWeb) useIsomorphicLayoutEffect(() => {
|
|
636
|
+
if (debugProp === "verbose") {
|
|
637
|
+
let cssStyleDeclarationToObject = function (style) {
|
|
638
|
+
const styleObject = {};
|
|
639
|
+
for (let i = 0; i < style.length; i++) {
|
|
640
|
+
let prop = style[i];
|
|
641
|
+
styleObject[prop] = style.getPropertyValue(prop);
|
|
642
|
+
}
|
|
643
|
+
return styleObject;
|
|
644
|
+
};
|
|
645
|
+
const computed = stateRef.current.host ? cssStyleDeclarationToObject(getComputedStyle(stateRef.current.host)) : {};
|
|
646
|
+
console.groupCollapsed(`Rendered > (opacity: ${computed.opacity})`);
|
|
647
|
+
console.warn(stateRef.current.host);
|
|
648
|
+
console.warn(computed);
|
|
649
|
+
console.groupEnd();
|
|
650
|
+
}
|
|
651
|
+
});
|
|
768
652
|
useIsomorphicLayoutEffect(() => {
|
|
769
653
|
if (state.unmounted === true && hasEnterStyle) {
|
|
770
654
|
setStateShallow({
|
|
@@ -825,20 +709,18 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
825
709
|
const shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
826
710
|
const needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
|
|
827
711
|
if (process.env.NODE_ENV === "development" && time) time`events-setup`;
|
|
828
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
});
|
|
841
|
-
}
|
|
712
|
+
if (process.env.NODE_ENV === "development" && debugProp === "verbose") log(`\u{1FAA9} events()`, {
|
|
713
|
+
runtimeFocusStyle,
|
|
714
|
+
runtimePressStyle,
|
|
715
|
+
runtimeHoverStyle,
|
|
716
|
+
runtimeFocusVisibleStyle,
|
|
717
|
+
attachPress,
|
|
718
|
+
attachFocus,
|
|
719
|
+
attachHover,
|
|
720
|
+
shouldAttach,
|
|
721
|
+
needsHoverState,
|
|
722
|
+
pseudos
|
|
723
|
+
});
|
|
842
724
|
const events = shouldAttach ? {
|
|
843
725
|
onPressOut: attachPress ? e => {
|
|
844
726
|
unPress();
|
|
@@ -848,13 +730,9 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
848
730
|
...((attachHover || attachPress) && {
|
|
849
731
|
onMouseEnter: e => {
|
|
850
732
|
const next = {};
|
|
851
|
-
if (needsHoverState && !lastInteractionWasTouch.value)
|
|
852
|
-
next.hover = true;
|
|
853
|
-
}
|
|
733
|
+
if (needsHoverState && !lastInteractionWasTouch.value) next.hover = true;
|
|
854
734
|
if (needsPressState) {
|
|
855
|
-
if (state.pressIn)
|
|
856
|
-
next.press = true;
|
|
857
|
-
}
|
|
735
|
+
if (state.pressIn) next.press = true;
|
|
858
736
|
}
|
|
859
737
|
setStateShallow(next);
|
|
860
738
|
onHoverIn?.(e);
|
|
@@ -862,9 +740,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
862
740
|
},
|
|
863
741
|
onMouseLeave: e => {
|
|
864
742
|
const next = {};
|
|
865
|
-
if (needsHoverState)
|
|
866
|
-
next.hover = false;
|
|
867
|
-
}
|
|
743
|
+
if (needsHoverState) next.hover = false;
|
|
868
744
|
if (needsPressState) {
|
|
869
745
|
next.press = false;
|
|
870
746
|
next.pressIn = false;
|
|
@@ -875,32 +751,21 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
875
751
|
}
|
|
876
752
|
}),
|
|
877
753
|
onPressIn: attachPress ? e => {
|
|
878
|
-
if (needsPressState) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
});
|
|
883
|
-
}
|
|
754
|
+
if (needsPressState) setStateShallow({
|
|
755
|
+
press: true,
|
|
756
|
+
pressIn: true
|
|
757
|
+
});
|
|
884
758
|
onPressIn?.(e);
|
|
885
759
|
onMouseDown?.(e);
|
|
886
|
-
if (isWeb)
|
|
887
|
-
componentSetStates.add(setState);
|
|
888
|
-
}
|
|
760
|
+
if (isWeb) componentSetStates.add(setState);
|
|
889
761
|
} : void 0,
|
|
890
762
|
onPress: attachPress ? e => {
|
|
891
763
|
unPress();
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
if (onPress || onClick) {
|
|
895
|
-
e.stopPropagation();
|
|
896
|
-
}
|
|
897
|
-
}
|
|
764
|
+
onClick?.(e);
|
|
765
|
+
if (onPress || onClick) e.stopPropagation();
|
|
898
766
|
onPress?.(e);
|
|
899
|
-
|
|
900
|
-
onLongPress?.(e);
|
|
901
|
-
}
|
|
767
|
+
onLongPress?.(e);
|
|
902
768
|
} : void 0,
|
|
903
|
-
...false,
|
|
904
769
|
...(attachFocus && {
|
|
905
770
|
onFocus: e => {
|
|
906
771
|
const next = {};
|
|
@@ -911,23 +776,15 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
911
776
|
next.focusWithin = true;
|
|
912
777
|
}
|
|
913
778
|
if (pseudos?.focusVisibleStyle) {
|
|
914
|
-
if (lastInteractionWasKeyboard.value)
|
|
915
|
-
|
|
916
|
-
} else {
|
|
917
|
-
next.focus = true;
|
|
918
|
-
}
|
|
919
|
-
} else {
|
|
920
|
-
next.focus = true;
|
|
921
|
-
}
|
|
779
|
+
if (lastInteractionWasKeyboard.value) next.focusVisible = true;else next.focus = true;
|
|
780
|
+
} else next.focus = true;
|
|
922
781
|
setStateShallow(next);
|
|
923
782
|
onFocus?.(e);
|
|
924
783
|
},
|
|
925
784
|
onBlur: e => {
|
|
926
|
-
if (componentContext.setParentFocusState) {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
});
|
|
930
|
-
}
|
|
785
|
+
if (componentContext.setParentFocusState) componentContext.setParentFocusState({
|
|
786
|
+
focusWithin: false
|
|
787
|
+
});
|
|
931
788
|
setStateShallow({
|
|
932
789
|
focus: false,
|
|
933
790
|
focusVisible: false,
|
|
@@ -937,39 +794,20 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
937
794
|
}
|
|
938
795
|
})
|
|
939
796
|
} : null;
|
|
940
|
-
if (
|
|
941
|
-
Object.assign(events, {
|
|
942
|
-
cancelable: !viewProps.rejectResponderTermination,
|
|
943
|
-
disabled,
|
|
944
|
-
hitSlop: viewProps.hitSlop,
|
|
945
|
-
delayLongPress: viewProps.delayLongPress,
|
|
946
|
-
delayPressIn: viewProps.delayPressIn,
|
|
947
|
-
delayPressOut: viewProps.delayPressOut,
|
|
948
|
-
focusable: viewProps.focusable ?? true,
|
|
949
|
-
minPressDuration: 0
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
if (events && !isReactNative) {
|
|
953
|
-
Object.assign(viewProps, getWebEvents(events));
|
|
954
|
-
}
|
|
797
|
+
if (events && !isReactNative) Object.assign(viewProps, getWebEvents(events));
|
|
955
798
|
if (process.env.NODE_ENV === "development" && time) time`events`;
|
|
956
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
});
|
|
962
|
-
}
|
|
799
|
+
if (process.env.NODE_ENV === "development" && debugProp === "verbose") log(`events`, {
|
|
800
|
+
events,
|
|
801
|
+
attachHover,
|
|
802
|
+
attachPress
|
|
803
|
+
});
|
|
963
804
|
const propsWithHref = props;
|
|
964
805
|
const propsInWithHref = propsIn;
|
|
965
|
-
|
|
966
|
-
const pressDebugName = [componentName, pressDebugDetail].filter(Boolean).join(":") || null;
|
|
967
|
-
const pressGesture = false ? useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName) : null;
|
|
806
|
+
[componentName, props.testID ?? propsIn.testID ?? props.accessibilityLabel ?? propsIn.accessibilityLabel ?? (typeof propsWithHref.href === "string" ? propsWithHref.href : null) ?? (typeof propsInWithHref.href === "string" ? propsInWithHref.href : null)].filter(Boolean).join(":");
|
|
968
807
|
if (process.env.NODE_ENV === "development" && time) time`hooks`;
|
|
969
808
|
if (asChild) {
|
|
970
809
|
elementType = Slot;
|
|
971
|
-
|
|
972
|
-
const webStyleEvents = asChild === "web" || asChild === "except-style-web";
|
|
810
|
+
{
|
|
973
811
|
const passEvents = getWebEvents({
|
|
974
812
|
onPress,
|
|
975
813
|
onLongPress,
|
|
@@ -979,27 +817,18 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
979
817
|
onMouseDown,
|
|
980
818
|
onMouseEnter,
|
|
981
819
|
onMouseLeave
|
|
982
|
-
},
|
|
820
|
+
}, asChild === "web" || asChild === "except-style-web");
|
|
983
821
|
Object.assign(viewProps, passEvents);
|
|
984
|
-
} else {
|
|
985
|
-
Object.assign(viewProps, {
|
|
986
|
-
onPress,
|
|
987
|
-
onLongPress
|
|
988
|
-
});
|
|
989
822
|
}
|
|
990
823
|
}
|
|
991
824
|
if (process.env.NODE_ENV === "development" && time) time`spaced-as-child`;
|
|
992
825
|
let content;
|
|
993
|
-
if (isPassthrough) {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
display: "contents"
|
|
997
|
-
}
|
|
998
|
-
}, propsIn.children);
|
|
999
|
-
} else {
|
|
1000
|
-
if (hooks.useChildren) {
|
|
1001
|
-
content = hooks.useChildren(elementType, content || children, viewProps);
|
|
826
|
+
if (isPassthrough) content = React.createElement(BaseComponent, {
|
|
827
|
+
style: {
|
|
828
|
+
display: "contents"
|
|
1002
829
|
}
|
|
830
|
+
}, propsIn.children);else {
|
|
831
|
+
if (hooks.useChildren) content = hooks.useChildren(elementType, content || children, viewProps);
|
|
1003
832
|
const isRenderPropString = typeof renderProp === "string";
|
|
1004
833
|
if (renderProp && !isRenderPropString) {
|
|
1005
834
|
const out = getCustomRender(renderProp, content || children, viewProps, componentState);
|
|
@@ -1009,76 +838,47 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
1009
838
|
}
|
|
1010
839
|
}
|
|
1011
840
|
if (!content) {
|
|
1012
|
-
if (isRenderPropString)
|
|
1013
|
-
viewProps.render === renderProp;
|
|
1014
|
-
}
|
|
841
|
+
if (isRenderPropString) viewProps.render;
|
|
1015
842
|
content = React.createElement(elementType, viewProps, content || children);
|
|
1016
843
|
}
|
|
1017
844
|
if (process.env.NODE_ENV === "development" && time) time`use-children`;
|
|
1018
845
|
}
|
|
1019
|
-
if (false) {
|
|
1020
|
-
const isCompositeComponent = !isHOC && Component && typeof Component !== "string";
|
|
1021
|
-
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, isCompositeComponent);
|
|
1022
|
-
}
|
|
1023
846
|
const ResetPresence = animationDriver?.ResetPresence;
|
|
1024
847
|
const needsReset = Boolean(
|
|
1025
848
|
// not when passing down to child
|
|
1026
|
-
!asChild &&
|
|
1027
|
-
// not when passThrough
|
|
1028
|
-
splitStyles &&
|
|
1029
|
-
// not when HOC
|
|
1030
|
-
!isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
849
|
+
!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
1031
850
|
const hasEverReset = stateRef.current.hasEverResetPresence;
|
|
1032
|
-
if (needsReset && !hasEverReset)
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
content = /* @__PURE__ */jsx(ResetPresence, {
|
|
1038
|
-
disabled: !needsReset,
|
|
1039
|
-
children: content
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
851
|
+
if (needsReset && !hasEverReset) stateRef.current.hasEverResetPresence = true;
|
|
852
|
+
if ((needsReset || hasEverReset) && ResetPresence) content = /* @__PURE__ */jsx(ResetPresence, {
|
|
853
|
+
disabled: !needsReset,
|
|
854
|
+
children: content
|
|
855
|
+
});
|
|
1042
856
|
if (process.env.NODE_ENV === "development" && time) time`create-element`;
|
|
1043
|
-
if ("focusWithinStyle" in propsIn || pseudos?.focusWithinStyle) {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
content = /* @__PURE__ */jsx(ComponentContext.Provider, {
|
|
1058
|
-
...componentContext,
|
|
1059
|
-
inText: true,
|
|
1060
|
-
children: content
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
857
|
+
if ("focusWithinStyle" in propsIn || pseudos?.focusWithinStyle) content = /* @__PURE__ */jsx(ComponentContext.Provider, {
|
|
858
|
+
...componentContext,
|
|
859
|
+
setParentFocusState: setStateShallow,
|
|
860
|
+
children: content
|
|
861
|
+
});
|
|
862
|
+
if ("group" in props) content = /* @__PURE__ */jsx(GroupContext.Provider, {
|
|
863
|
+
value: allGroupContexts,
|
|
864
|
+
children: content
|
|
865
|
+
});
|
|
866
|
+
if (!asChild && isText && !hasTextAncestor) content = /* @__PURE__ */jsx(ComponentContext.Provider, {
|
|
867
|
+
...componentContext,
|
|
868
|
+
inText: true,
|
|
869
|
+
children: content
|
|
870
|
+
});
|
|
1063
871
|
if (process.env.NODE_ENV === "development" && time) time`group-context`;
|
|
1064
872
|
content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef);
|
|
1065
873
|
if (process.env.NODE_ENV === "development" && time) time`themed-children`;
|
|
1066
|
-
if (
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
children: content
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
874
|
+
if (isReactNative && !asChild) content = /* @__PURE__ */jsx("span", {
|
|
875
|
+
className: "_dsp_contents",
|
|
876
|
+
...(!isPassthrough && isHydrated && events && getWebEvents(events)),
|
|
877
|
+
children: content
|
|
878
|
+
});
|
|
1075
879
|
if (overriddenContextProps && contextForOverride) {
|
|
1076
880
|
const Provider = contextForOverride.Provider;
|
|
1077
|
-
for (const key in styledContextValue)
|
|
1078
|
-
if (!(key in overriddenContextProps)) {
|
|
1079
|
-
overriddenContextProps[key] = styledContextValue[key];
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
881
|
+
for (const key in styledContextValue) if (!(key in overriddenContextProps)) overriddenContextProps[key] = styledContextValue[key];
|
|
1082
882
|
content = /* @__PURE__ */jsx(Provider, {
|
|
1083
883
|
__disableMergeDefaultValues: true,
|
|
1084
884
|
...overriddenContextProps,
|
|
@@ -1086,61 +886,52 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
1086
886
|
});
|
|
1087
887
|
}
|
|
1088
888
|
if (process.env.NODE_ENV === "development" && time) time`context-override`;
|
|
1089
|
-
if (startedUnhydrated && splitStyles) {
|
|
1090
|
-
content
|
|
1091
|
-
|
|
1092
|
-
});
|
|
1093
|
-
}
|
|
889
|
+
if (startedUnhydrated && splitStyles) content = /* @__PURE__ */jsxs(Fragment, {
|
|
890
|
+
children: [content, !isHydrated ? getStyleTags(Object.values(splitStyles.rulesToInsert)) : null]
|
|
891
|
+
});
|
|
1094
892
|
if (process.env.NODE_ENV === "development" && time) time`style-tags`;
|
|
1095
893
|
if (process.env.NODE_ENV === "development") {
|
|
1096
894
|
if (debugProp && debugProp !== "profile") {
|
|
1097
|
-
const
|
|
1098
|
-
const title = `render <${element2} /> (${internalID}) with props`;
|
|
895
|
+
const title = `render <${typeof elementType === "string" ? elementType : "Component"} /> (${internalID}) with props`;
|
|
1099
896
|
if (!isWeb || !isClient) {
|
|
1100
897
|
log(title);
|
|
1101
898
|
log(`state: `, state);
|
|
1102
|
-
if (isDevTools)
|
|
1103
|
-
log("viewProps", viewProps);
|
|
1104
|
-
}
|
|
899
|
+
if (isDevTools) log("viewProps", viewProps);
|
|
1105
900
|
log(`final styles:`);
|
|
1106
|
-
for (const key in splitStylesStyle)
|
|
1107
|
-
log(key, splitStylesStyle[key]);
|
|
1108
|
-
}
|
|
901
|
+
for (const key in splitStylesStyle) log(key, splitStylesStyle[key]);
|
|
1109
902
|
} else {
|
|
1110
903
|
console.groupCollapsed(title);
|
|
1111
904
|
try {
|
|
1112
905
|
log("viewProps", viewProps);
|
|
1113
906
|
log("children", content);
|
|
1114
|
-
if (typeof window !== "undefined") {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
907
|
+
if (typeof window !== "undefined") log({
|
|
908
|
+
propsIn,
|
|
909
|
+
props,
|
|
910
|
+
attachPress,
|
|
911
|
+
animationStyles,
|
|
912
|
+
classNames,
|
|
913
|
+
content,
|
|
914
|
+
elementType,
|
|
915
|
+
events,
|
|
916
|
+
isAnimated,
|
|
917
|
+
hasRuntimeMediaKeys,
|
|
918
|
+
isStringElement,
|
|
919
|
+
mediaListeningKeys,
|
|
920
|
+
pseudos,
|
|
921
|
+
shouldAttach,
|
|
922
|
+
noClass,
|
|
923
|
+
shouldListenForMedia,
|
|
924
|
+
splitStyles,
|
|
925
|
+
splitStylesStyle,
|
|
926
|
+
state,
|
|
927
|
+
stateRef,
|
|
928
|
+
staticConfig,
|
|
929
|
+
styleProps,
|
|
930
|
+
themeState,
|
|
931
|
+
viewProps,
|
|
932
|
+
willBeAnimated,
|
|
933
|
+
startedUnhydrated
|
|
934
|
+
});
|
|
1144
935
|
} catch {} finally {
|
|
1145
936
|
console.groupEnd();
|
|
1146
937
|
}
|
|
@@ -1162,9 +953,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
1162
953
|
return content;
|
|
1163
954
|
});
|
|
1164
955
|
function notifyGroupSubscribers(groupContext, groupEmitter, pseudo) {
|
|
1165
|
-
if (!groupContext || !groupEmitter)
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
956
|
+
if (!groupContext || !groupEmitter) return;
|
|
1168
957
|
const nextState = {
|
|
1169
958
|
...groupContext.state,
|
|
1170
959
|
pseudo
|
|
@@ -1172,9 +961,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
1172
961
|
groupEmitter.emit(nextState);
|
|
1173
962
|
groupContext.state = nextState;
|
|
1174
963
|
}
|
|
1175
|
-
if (staticConfig.componentName)
|
|
1176
|
-
component.displayName = staticConfig.componentName;
|
|
1177
|
-
}
|
|
964
|
+
if (staticConfig.componentName) component.displayName = staticConfig.componentName;
|
|
1178
965
|
let res = component;
|
|
1179
966
|
res = React.memo(res);
|
|
1180
967
|
res.staticConfig = staticConfig;
|
|
@@ -1188,13 +975,10 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
1188
975
|
};
|
|
1189
976
|
}
|
|
1190
977
|
function styleable(Component2, options) {
|
|
1191
|
-
|
|
1192
|
-
let out = skipForwardRef ? Component2 : React.forwardRef(Component2);
|
|
978
|
+
let out = typeof Component2 === "function" && Component2.length === 1 ? Component2 : React.forwardRef(Component2);
|
|
1193
979
|
const extendedConfig = extendStyledConfig(options?.staticConfig);
|
|
1194
980
|
out = options?.disableTheme ? out : themeable(out, extendedConfig, true);
|
|
1195
|
-
if (extendedConfig.memo || process.env.
|
|
1196
|
-
out = React.memo(out);
|
|
1197
|
-
}
|
|
981
|
+
if (extendedConfig.memo || process.env.GUI_MEMOIZE_STYLEABLE) out = React.memo(out);
|
|
1198
982
|
out.staticConfig = extendedConfig;
|
|
1199
983
|
out.styleable = styleable;
|
|
1200
984
|
return out;
|
|
@@ -1208,14 +992,10 @@ const fromPx = val => {
|
|
|
1208
992
|
return 0;
|
|
1209
993
|
};
|
|
1210
994
|
const getCustomRender = (renderProp, content, viewProps, state) => {
|
|
1211
|
-
if (typeof renderProp === "function")
|
|
1212
|
-
const out = renderProp(viewProps, state);
|
|
1213
|
-
renderProp = getRenderElementForPlatform(out);
|
|
1214
|
-
}
|
|
995
|
+
if (typeof renderProp === "function") renderProp = getRenderElementForPlatform(renderProp(viewProps, state));
|
|
1215
996
|
if (renderProp) {
|
|
1216
997
|
if (typeof renderProp === "object" && React.isValidElement(renderProp)) {
|
|
1217
|
-
|
|
1218
|
-
if (renderElement) {
|
|
998
|
+
if (getRenderElementForPlatform(renderProp)) {
|
|
1219
999
|
const elementProps = renderProp.props;
|
|
1220
1000
|
const mergedProps = elementProps ? mergeRenderElementProps(elementProps, viewProps, content) : viewProps;
|
|
1221
1001
|
return {
|
|
@@ -1227,11 +1007,6 @@ const getCustomRender = (renderProp, content, viewProps, state) => {
|
|
|
1227
1007
|
}
|
|
1228
1008
|
};
|
|
1229
1009
|
function getRenderElementForPlatform(potential) {
|
|
1230
|
-
if (false) {
|
|
1231
|
-
if (isHTMLElement(potential)) {
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
1010
|
return potential;
|
|
1236
1011
|
}
|
|
1237
1012
|
export { componentSetStates, createComponent };
|