@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
|
@@ -25,11 +25,11 @@ __export(getThemeProxied_exports, {
|
|
|
25
25
|
getThemeProxied: () => getThemeProxied
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(getThemeProxied_exports);
|
|
28
|
-
|
|
28
|
+
require("@hanzogui/constants");
|
|
29
29
|
var import_config = require("../config.cjs");
|
|
30
30
|
var import_createVariable = require("../createVariable.cjs");
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
require("../helpers/getDynamicVal.cjs");
|
|
32
|
+
require("./doesRootSchemeMatchSystem.cjs");
|
|
33
33
|
const cache = /* @__PURE__ */new Map();
|
|
34
34
|
let curKeys;
|
|
35
35
|
let curSchemeKeys;
|
|
@@ -37,41 +37,28 @@ let curProps;
|
|
|
37
37
|
let curState;
|
|
38
38
|
const emptyObject = {};
|
|
39
39
|
function getThemeProxied(_props, _state, _keys, _schemeKeys) {
|
|
40
|
-
if (!_state?.theme)
|
|
41
|
-
return emptyObject;
|
|
42
|
-
}
|
|
40
|
+
if (!_state?.theme) return emptyObject;
|
|
43
41
|
curKeys = _keys;
|
|
44
42
|
curSchemeKeys = _schemeKeys;
|
|
45
43
|
curProps = _props;
|
|
46
44
|
curState = _state;
|
|
47
|
-
if (cache.has(curState.theme))
|
|
48
|
-
|
|
49
|
-
return proxied2;
|
|
50
|
-
}
|
|
51
|
-
const config = (0, import_config.getConfig)();
|
|
45
|
+
if (cache.has(curState.theme)) return cache.get(curState.theme);
|
|
46
|
+
(0, import_config.getConfig)();
|
|
52
47
|
function track(key, schemeOptimized = false) {
|
|
53
48
|
if (!curKeys) return;
|
|
54
|
-
if (!curKeys.current)
|
|
55
|
-
curKeys.current = /* @__PURE__ */new Set();
|
|
56
|
-
}
|
|
49
|
+
if (!curKeys.current) curKeys.current = /* @__PURE__ */new Set();
|
|
57
50
|
curKeys.current.add(key);
|
|
58
51
|
if (schemeOptimized && curSchemeKeys) {
|
|
59
|
-
if (!curSchemeKeys.current)
|
|
60
|
-
curSchemeKeys.current = /* @__PURE__ */new Set();
|
|
61
|
-
}
|
|
52
|
+
if (!curSchemeKeys.current) curSchemeKeys.current = /* @__PURE__ */new Set();
|
|
62
53
|
curSchemeKeys.current.add(key);
|
|
63
54
|
}
|
|
64
|
-
if (process.env.NODE_ENV === "development" && curProps.debug) {
|
|
65
|
-
console.info(` \u{1F3A8} useTheme() tracking key: ${key} schemeOptimized=${schemeOptimized}`);
|
|
66
|
-
}
|
|
55
|
+
if (process.env.NODE_ENV === "development" && curProps.debug) console.info(` \u{1F3A8} useTheme() tracking key: ${key} schemeOptimized=${schemeOptimized}`);
|
|
67
56
|
}
|
|
68
57
|
const proxied = Object.fromEntries(Object.entries(_state.theme).flatMap(([key, value]) => {
|
|
69
58
|
const proxied2 = {
|
|
70
59
|
...value,
|
|
71
60
|
get val() {
|
|
72
|
-
if (!globalThis.guiAvoidTracking)
|
|
73
|
-
track(key, false);
|
|
74
|
-
}
|
|
61
|
+
if (!globalThis.guiAvoidTracking) track(key, false);
|
|
75
62
|
return value.val;
|
|
76
63
|
},
|
|
77
64
|
get(platform) {
|
|
@@ -81,37 +68,6 @@ function getThemeProxied(_props, _state, _keys, _schemeKeys) {
|
|
|
81
68
|
name,
|
|
82
69
|
scheme
|
|
83
70
|
} = curState;
|
|
84
|
-
if (false) {
|
|
85
|
-
const fastSchemeChange = getSetting("fastSchemeChange");
|
|
86
|
-
const rootMatchesSystem = doesRootSchemeMatchSystem();
|
|
87
|
-
const shouldOptimize = scheme && platform !== "web" && isIos && !curProps.deopt && !curState.isInverse && fastSchemeChange && rootMatchesSystem;
|
|
88
|
-
if (process.env.NODE_ENV === "development" && curProps.debug === "verbose") {
|
|
89
|
-
console.info(` \u{1F3A8} useTheme().get(${key}) theme=${name} scheme=${scheme}`, `
|
|
90
|
-
shouldOptimize=${shouldOptimize} (iOS=${isIos} deopt=${curProps.deopt} isInverse=${curState.isInverse} fastScheme=${fastSchemeChange} rootMatch=${rootMatchesSystem})`);
|
|
91
|
-
}
|
|
92
|
-
if (shouldOptimize) {
|
|
93
|
-
const oppositeScheme = scheme === "dark" ? "light" : "dark";
|
|
94
|
-
const oppositeName = name.replace(scheme, oppositeScheme);
|
|
95
|
-
const color = (0, import_createVariable.getVariable)(config.themes[name]?.[key]);
|
|
96
|
-
const oppositeColor = (0, import_createVariable.getVariable)(config.themes[oppositeName]?.[key]);
|
|
97
|
-
if (process.env.NODE_ENV === "development" && curProps.debug === "verbose") {
|
|
98
|
-
console.info(` \u{1F3A8} useTheme().get(${key}) using DynamicColorIOS`, `
|
|
99
|
-
color=${color} oppositeColor=${oppositeColor}`);
|
|
100
|
-
}
|
|
101
|
-
const dynamicVal = getDynamicVal({
|
|
102
|
-
scheme,
|
|
103
|
-
val: color,
|
|
104
|
-
oppositeVal: oppositeColor
|
|
105
|
-
});
|
|
106
|
-
track(key, true);
|
|
107
|
-
return dynamicVal;
|
|
108
|
-
}
|
|
109
|
-
if (process.env.NODE_ENV === "development" && curProps.debug) {
|
|
110
|
-
console.info(` \u{1F3A8} useTheme().get(${key}) tracking key (not optimizing)`, `
|
|
111
|
-
platform=${platform} isIOS=${isIos} deopt=${curProps.deopt} fastScheme=${fastSchemeChange}`);
|
|
112
|
-
}
|
|
113
|
-
track(key, false);
|
|
114
|
-
}
|
|
115
71
|
return outVal;
|
|
116
72
|
}
|
|
117
73
|
};
|
|
@@ -39,43 +39,30 @@ var curProps;
|
|
|
39
39
|
var curState;
|
|
40
40
|
var emptyObject = {};
|
|
41
41
|
function getThemeProxied(_props, _state, _keys, _schemeKeys) {
|
|
42
|
-
if (!(_state === null || _state === void 0 ? void 0 : _state.theme))
|
|
43
|
-
return emptyObject;
|
|
44
|
-
}
|
|
42
|
+
if (!(_state === null || _state === void 0 ? void 0 : _state.theme)) return emptyObject;
|
|
45
43
|
curKeys = _keys;
|
|
46
44
|
curSchemeKeys = _schemeKeys;
|
|
47
45
|
curProps = _props;
|
|
48
46
|
curState = _state;
|
|
49
|
-
if (cache.has(curState.theme))
|
|
50
|
-
var proxied = cache.get(curState.theme);
|
|
51
|
-
return proxied;
|
|
52
|
-
}
|
|
47
|
+
if (cache.has(curState.theme)) return cache.get(curState.theme);
|
|
53
48
|
var config = (0, import_config.getConfig)();
|
|
54
49
|
function track(key) {
|
|
55
50
|
var schemeOptimized = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
56
51
|
if (!curKeys) return;
|
|
57
|
-
if (!curKeys.current)
|
|
58
|
-
curKeys.current = /* @__PURE__ */new Set();
|
|
59
|
-
}
|
|
52
|
+
if (!curKeys.current) curKeys.current = /* @__PURE__ */new Set();
|
|
60
53
|
curKeys.current.add(key);
|
|
61
54
|
if (schemeOptimized && curSchemeKeys) {
|
|
62
|
-
if (!curSchemeKeys.current)
|
|
63
|
-
curSchemeKeys.current = /* @__PURE__ */new Set();
|
|
64
|
-
}
|
|
55
|
+
if (!curSchemeKeys.current) curSchemeKeys.current = /* @__PURE__ */new Set();
|
|
65
56
|
curSchemeKeys.current.add(key);
|
|
66
57
|
}
|
|
67
|
-
if (process.env.NODE_ENV === "development" && curProps.debug) {
|
|
68
|
-
console.info(` \u{1F3A8} useTheme() tracking key: ${key} schemeOptimized=${schemeOptimized}`);
|
|
69
|
-
}
|
|
58
|
+
if (process.env.NODE_ENV === "development" && curProps.debug) console.info(` \u{1F3A8} useTheme() tracking key: ${key} schemeOptimized=${schemeOptimized}`);
|
|
70
59
|
}
|
|
71
60
|
var proxied1 = Object.fromEntries(Object.entries(_state.theme).flatMap(function (param) {
|
|
72
61
|
var [key, value] = param;
|
|
73
62
|
var proxied2 = {
|
|
74
63
|
...value,
|
|
75
64
|
get val() {
|
|
76
|
-
if (!globalThis.guiAvoidTracking)
|
|
77
|
-
track(key, false);
|
|
78
|
-
}
|
|
65
|
+
if (!globalThis.guiAvoidTracking) track(key, false);
|
|
79
66
|
return value.val;
|
|
80
67
|
},
|
|
81
68
|
get(platform) {
|
|
@@ -85,38 +72,30 @@ function getThemeProxied(_props, _state, _keys, _schemeKeys) {
|
|
|
85
72
|
name,
|
|
86
73
|
scheme
|
|
87
74
|
} = curState;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (process.env.NODE_ENV === "development" && curProps.debug === "verbose") {
|
|
93
|
-
console.info(` \u{1F3A8} useTheme().get(${key}) theme=${name} scheme=${scheme}`, `
|
|
75
|
+
var fastSchemeChange = (0, import_config.getSetting)("fastSchemeChange");
|
|
76
|
+
var rootMatchesSystem = (0, import_doesRootSchemeMatchSystem.doesRootSchemeMatchSystem)();
|
|
77
|
+
var shouldOptimize = scheme && platform !== "web" && import_constants.isIos && !curProps.deopt && !curState.isInverse && fastSchemeChange && rootMatchesSystem;
|
|
78
|
+
if (process.env.NODE_ENV === "development" && curProps.debug === "verbose") console.info(` \u{1F3A8} useTheme().get(${key}) theme=${name} scheme=${scheme}`, `
|
|
94
79
|
shouldOptimize=${shouldOptimize} (iOS=${import_constants.isIos} deopt=${curProps.deopt} isInverse=${curState.isInverse} fastScheme=${fastSchemeChange} rootMatch=${rootMatchesSystem})`);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (process.env.NODE_ENV === "development" && curProps.debug === "verbose") {
|
|
103
|
-
console.info(` \u{1F3A8} useTheme().get(${key}) using DynamicColorIOS`, `
|
|
80
|
+
if (shouldOptimize) {
|
|
81
|
+
var _config_themes_name, _config_themes_oppositeName;
|
|
82
|
+
var oppositeScheme = scheme === "dark" ? "light" : "dark";
|
|
83
|
+
var oppositeName = name.replace(scheme, oppositeScheme);
|
|
84
|
+
var color = (0, import_createVariable.getVariable)((_config_themes_name = config.themes[name]) === null || _config_themes_name === void 0 ? void 0 : _config_themes_name[key]);
|
|
85
|
+
var oppositeColor = (0, import_createVariable.getVariable)((_config_themes_oppositeName = config.themes[oppositeName]) === null || _config_themes_oppositeName === void 0 ? void 0 : _config_themes_oppositeName[key]);
|
|
86
|
+
if (process.env.NODE_ENV === "development" && curProps.debug === "verbose") console.info(` \u{1F3A8} useTheme().get(${key}) using DynamicColorIOS`, `
|
|
104
87
|
color=${color} oppositeColor=${oppositeColor}`);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return dynamicVal;
|
|
113
|
-
}
|
|
114
|
-
if (process.env.NODE_ENV === "development" && curProps.debug) {
|
|
115
|
-
console.info(` \u{1F3A8} useTheme().get(${key}) tracking key (not optimizing)`, `
|
|
116
|
-
platform=${platform} isIOS=${import_constants.isIos} deopt=${curProps.deopt} fastScheme=${fastSchemeChange}`);
|
|
117
|
-
}
|
|
118
|
-
track(key, false);
|
|
88
|
+
var dynamicVal = (0, import_getDynamicVal.getDynamicVal)({
|
|
89
|
+
scheme,
|
|
90
|
+
val: color,
|
|
91
|
+
oppositeVal: oppositeColor
|
|
92
|
+
});
|
|
93
|
+
track(key, true);
|
|
94
|
+
return dynamicVal;
|
|
119
95
|
}
|
|
96
|
+
if (process.env.NODE_ENV === "development" && curProps.debug) console.info(` \u{1F3A8} useTheme().get(${key}) tracking key (not optimizing)`, `
|
|
97
|
+
platform=${platform} isIOS=${import_constants.isIos} deopt=${curProps.deopt} fastScheme=${fastSchemeChange}`);
|
|
98
|
+
track(key, false);
|
|
120
99
|
return outVal;
|
|
121
100
|
}
|
|
122
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getThemeProxied_exports","__export","getThemeProxied","module","exports","import_constants","require","import_config","import_createVariable","import_getDynamicVal","import_doesRootSchemeMatchSystem","cache","Map","curKeys","curSchemeKeys","curProps","curState","emptyObject","_props","_state","_keys","_schemeKeys","theme","has","
|
|
1
|
+
{"version":3,"names":["to","__toCommonJS","mod","__copyProps","__defProp","value","getThemeProxied_exports","__export","getThemeProxied","module","exports","import_constants","require","import_config","import_createVariable","import_getDynamicVal","import_doesRootSchemeMatchSystem","cache","Map","curKeys","curSchemeKeys","curProps","curState","emptyObject","_props","_state","_keys","_schemeKeys","theme","has","get","config","getConfig","track","proxied","key","schemeOptimized","arguments","length","current","Set","add","process","env","NODE_ENV","debug","console","info","proxied1","Object","fromEntries","entries","flatMap","param","proxied2","val","globalThis","guiAvoidTracking","platform","outVal","getVariable","name","scheme","fastSchemeChange","getSetting","rootMatchesSystem","doesRootSchemeMatchSystem","shouldOptimize","isIos","deopt","isInverse","_config_themes_name","_config_themes_oppositeName","oppositeScheme","oppositeName","replace","color","themes","oppositeColor","dynamicVal","getDynamicVal","oppositeVal","set"],"sources":["../../../src/hooks/getThemeProxied.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -46,9 +46,9 @@ const useThemeWithState = (props, isRoot = false) => {
|
|
|
46
46
|
if (process.env.NODE_ENV === "development") {
|
|
47
47
|
if (!props.passThrough && !themeState?.theme) {
|
|
48
48
|
if (process.env.GUI_DISABLE_NO_THEME_WARNING !== "1") {
|
|
49
|
-
console.error(`[
|
|
49
|
+
console.error(`[gui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(props)}).
|
|
50
50
|
|
|
51
|
-
If this is intended and you are using
|
|
51
|
+
If this is intended and you are using Gui without any themes, you can disable this warning by setting the environment variable GUI_DISABLE_NO_THEME_WARNING=1`);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -49,9 +49,9 @@ var useThemeWithState = function (props) {
|
|
|
49
49
|
if (process.env.NODE_ENV === "development") {
|
|
50
50
|
if (!props.passThrough && !(themeState === null || themeState === void 0 ? void 0 : themeState.theme)) {
|
|
51
51
|
if (process.env.GUI_DISABLE_NO_THEME_WARNING !== "1") {
|
|
52
|
-
console.error(`[
|
|
52
|
+
console.error(`[gui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(props)}).
|
|
53
53
|
|
|
54
|
-
If this is intended and you are using
|
|
54
|
+
If this is intended and you are using Gui without any themes, you can disable this warning by setting the environment variable GUI_DISABLE_NO_THEME_WARNING=1`);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useTheme_exports","__export","useTheme","useThemeWithState","module","exports","import_react","require","import_getThemeProxied","import_useThemeState","EMPTY","theme","res","props","isRoot","arguments","length","keys","useRef","schemeKeys","themeState","useThemeState","process","env","NODE_ENV","passThrough","GUI_DISABLE_NO_THEME_WARNING","console","error","JSON","stringify","themeProxied","getThemeProxied"],"sources":["../../../src/hooks/useTheme.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,gBAAA;AAAAC,QAAA,CAAAD,gBAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAAuB,CAAAK,gBAAA;AAEvB,IAAAM,YAAA,GAAAC,OAAA,QAAmD;AACnD,IAAAC,sBAAA,GAA8BD,OAAA;AAE9B,IAAAE,oBAAe,GAAAF,OAAA;AAER,IAAAG,KAAM;AACX,IAAAR,QAAA,YAAAA,CAAA;EAEA,aAAY;;EACZ,KAAAS,KAAM,IAAMR,iBAAA,CAAAO,KAAA;EACZ,IAAAE,GAAO,GAAAD,KAAA;EACT,OAAAC,GAAA;AAOO;AAIL,IAAAT,iBAAA,YAAAA,CAAAU,KAAA;EAEA,aAAM;;EACN,IAAAC,MAAM,GAAAC,SAAA,CAAaC,MAAA,QAAAD,SAA2B,EAAI,eAAAA,SAAA;EAClD,IAAAE,IAAM,OAAAX,YAAa,CAAAY,MAAA;EAEnB,IAAIC,UAAQ,GAAI,IAAAb,YAAa,CAAAY,MAAA,MAAe;EAC1C,IAAAE,UAAW,OAAAX,oBAA4B,CAAAY,aAAO,EAAAR,KAAA,EAAAC,MAAA,EAAAG,IAAA,EAAAE,UAAA;EAC5C,IAAAG,OAAI,CAAAC,GAAA,CAAQC,QAAI;IACd,KAAAX,KAAA,CAAAY,WAAQ,MAAAL,UAAA,aAAAA,UAAA,uBAAAA,UAAA,CAAAT,KAAA;MAAA,IACNW,OAAA,CAAAC,GAAA,CAAAG,4BAAA;
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useTheme_exports","__export","useTheme","useThemeWithState","module","exports","import_react","require","import_getThemeProxied","import_useThemeState","EMPTY","theme","res","props","isRoot","arguments","length","keys","useRef","schemeKeys","themeState","useThemeState","process","env","NODE_ENV","passThrough","GUI_DISABLE_NO_THEME_WARNING","console","error","JSON","stringify","themeProxied","getThemeProxied"],"sources":["../../../src/hooks/useTheme.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,gBAAA;AAAAC,QAAA,CAAAD,gBAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAAuB,CAAAK,gBAAA;AAEvB,IAAAM,YAAA,GAAAC,OAAA,QAAmD;AACnD,IAAAC,sBAAA,GAA8BD,OAAA;AAE9B,IAAAE,oBAAe,GAAAF,OAAA;AAER,IAAAG,KAAM;AACX,IAAAR,QAAA,YAAAA,CAAA;EAEA,aAAY;;EACZ,KAAAS,KAAM,IAAMR,iBAAA,CAAAO,KAAA;EACZ,IAAAE,GAAO,GAAAD,KAAA;EACT,OAAAC,GAAA;AAOO;AAIL,IAAAT,iBAAA,YAAAA,CAAAU,KAAA;EAEA,aAAM;;EACN,IAAAC,MAAM,GAAAC,SAAA,CAAaC,MAAA,QAAAD,SAA2B,EAAI,eAAAA,SAAA;EAClD,IAAAE,IAAM,OAAAX,YAAa,CAAAY,MAAA;EAEnB,IAAIC,UAAQ,GAAI,IAAAb,YAAa,CAAAY,MAAA,MAAe;EAC1C,IAAAE,UAAW,OAAAX,oBAA4B,CAAAY,aAAO,EAAAR,KAAA,EAAAC,MAAA,EAAAG,IAAA,EAAAE,UAAA;EAC5C,IAAAG,OAAI,CAAAC,GAAA,CAAQC,QAAI;IACd,KAAAX,KAAA,CAAAY,WAAQ,MAAAL,UAAA,aAAAA,UAAA,uBAAAA,UAAA,CAAAT,KAAA;MAAA,IACNW,OAAA,CAAAC,GAAA,CAAAG,4BAAA;QAA4FC,OAC1F,CAAAC,KAAA,wFAAAC,IAAA,CAAAC,SAAA,CAAAjB,KAAA;AAAA;AACD;MAAA;IAAA;EACH;EACF,IACFkB,YAAA,GAAAlB,KAAA,CAAAY,WAAA,YAAAjB,sBAAA,CAAAwB,eAAA,EAAAnB,KAAA,EAAAO,UAAA,EAAAH,IAAA,EAAAE,UAAA;EACF,QAEAY,YAAM,EAINX,UAAQ,CACV","ignoreList":[]}
|
|
@@ -30,7 +30,7 @@ __export(useThemeState_exports, {
|
|
|
30
30
|
useThemeState: () => useThemeState
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(useThemeState_exports);
|
|
33
|
-
|
|
33
|
+
require("@hanzogui/constants");
|
|
34
34
|
var import_constants2 = require("@hanzogui/constants");
|
|
35
35
|
var import_react = require("react");
|
|
36
36
|
var import_config = require("../config.cjs");
|
|
@@ -64,19 +64,14 @@ const useThemeState = (props, isRoot = false, keys, schemeKeys) => {
|
|
|
64
64
|
disable
|
|
65
65
|
} = props;
|
|
66
66
|
const parentId = (0, import_react.useContext)(ThemeStateContext);
|
|
67
|
-
if (!parentId && !isRoot) {
|
|
68
|
-
throw new Error(process.env.NODE_ENV === "development" ? `${import_constants3.MISSING_THEME_MESSAGE}
|
|
67
|
+
if (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === "development" ? `${import_constants3.MISSING_THEME_MESSAGE}
|
|
69
68
|
|
|
70
69
|
Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? ` (component: ${props.componentName})` : ""}, but no parent theme context was found (parentId: ${parentId}).` : import_constants3.MISSING_THEME_MESSAGE);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
theme: (0, import_config.getConfig)().themes.light
|
|
77
|
-
// inverses: 0,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
70
|
+
if (disable) return states.get(parentId) || {
|
|
71
|
+
id: "",
|
|
72
|
+
name: "light",
|
|
73
|
+
theme: (0, import_config.getConfig)().themes.light
|
|
74
|
+
};
|
|
80
75
|
const id = (0, import_react.useId)();
|
|
81
76
|
const subscribe = (0, import_react.useCallback)(cb => {
|
|
82
77
|
listenersByParent[parentId] = listenersByParent[parentId] || /* @__PURE__ */new Set();
|
|
@@ -98,16 +93,13 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? `
|
|
|
98
93
|
let local = localStates.get(id);
|
|
99
94
|
const parentState = states.get(parentId);
|
|
100
95
|
if (local && !PendingUpdate.has(id)) {
|
|
101
|
-
if (parentState && local._parentName === parentState.name && local._propsKey === propsKey)
|
|
102
|
-
return local;
|
|
103
|
-
}
|
|
96
|
+
if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
|
|
104
97
|
}
|
|
105
98
|
const isSchemeOnlyChange = false;
|
|
106
99
|
const keysSize = keys?.current?.size ?? 0;
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const needsUpdate = props.passThrough ? false : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();
|
|
100
|
+
const allKeysSchemeOptimized = (schemeKeys?.current?.size ?? 0) === keysSize && keysSize > 0;
|
|
101
|
+
const canSkipForSchemeChange = isSchemeOnlyChange;
|
|
102
|
+
const needsUpdate = props.passThrough ? false : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : keys?.current?.size ? true : props.needsUpdate?.();
|
|
111
103
|
const [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
112
104
|
PendingUpdate.delete(id);
|
|
113
105
|
if (!local || rerender) {
|
|
@@ -136,7 +128,6 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? `
|
|
|
136
128
|
Object.assign(local, next);
|
|
137
129
|
local.id = id;
|
|
138
130
|
}
|
|
139
|
-
;
|
|
140
131
|
local._parentName = parentState?.name;
|
|
141
132
|
local._propsKey = propsKey;
|
|
142
133
|
states.set(id, next);
|
|
@@ -150,15 +141,11 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? `
|
|
|
150
141
|
return;
|
|
151
142
|
}
|
|
152
143
|
if (!propsKey) {
|
|
153
|
-
if (HadTheme.get(keys))
|
|
154
|
-
scheduleUpdate(id);
|
|
155
|
-
}
|
|
144
|
+
if (HadTheme.get(keys)) scheduleUpdate(id);
|
|
156
145
|
HadTheme.set(keys, false);
|
|
157
146
|
return;
|
|
158
147
|
}
|
|
159
|
-
if (process.env.NODE_ENV === "development" && props.debug === "verbose") {
|
|
160
|
-
console.warn(` \xB7 useTheme(${id}) scheduleUpdate`, propsKey, states.get(id)?.name);
|
|
161
|
-
}
|
|
148
|
+
if (process.env.NODE_ENV === "development" && props.debug === "verbose") console.warn(` \xB7 useTheme(${id}) scheduleUpdate`, propsKey, states.get(id)?.name);
|
|
162
149
|
scheduleUpdate(id);
|
|
163
150
|
HadTheme.set(keys, true);
|
|
164
151
|
}, [keys, propsKey]);
|
|
@@ -169,39 +156,29 @@ const getNextState = (lastState, props, propsKey, isRoot = false, id, parentId,
|
|
|
169
156
|
debug
|
|
170
157
|
} = props;
|
|
171
158
|
const parentState = states.get(parentId);
|
|
172
|
-
if (props.passThrough) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
if (!themes) {
|
|
178
|
-
themes = (0, import_config.getConfig)().themes;
|
|
179
|
-
}
|
|
159
|
+
if (props.passThrough) return [false, lastState || parentState || {
|
|
160
|
+
name: ""
|
|
161
|
+
}];
|
|
162
|
+
if (!themes) themes = (0, import_config.getConfig)().themes;
|
|
180
163
|
const name = !propsKey && (!lastState || !lastState?.isNew) ? null : getNewThemeName(parentState?.name, props, pendingUpdate === "force" ? true : !!needsUpdate);
|
|
181
164
|
const isSameAsParent = parentState && (!name || name === parentState.name);
|
|
182
165
|
const shouldRerender = Boolean(pendingUpdate === "force" || needsUpdate && (pendingUpdate || lastState?.name !== parentState?.name));
|
|
183
166
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
184
167
|
const message = ` \xB7 useTheme(${id}) getNextState => ${name} needsUpdate ${needsUpdate} shouldRerender ${shouldRerender}`;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
isSameAsParent
|
|
197
|
-
});
|
|
198
|
-
console.groupEnd();
|
|
199
|
-
}
|
|
168
|
+
console.groupCollapsed(message);
|
|
169
|
+
console.trace({
|
|
170
|
+
name,
|
|
171
|
+
lastState,
|
|
172
|
+
parentState,
|
|
173
|
+
props,
|
|
174
|
+
propsKey,
|
|
175
|
+
id,
|
|
176
|
+
isSameAsParent
|
|
177
|
+
});
|
|
178
|
+
console.groupEnd();
|
|
200
179
|
}
|
|
201
180
|
if (isSameAsParent) {
|
|
202
|
-
if (!shouldRerender && lastState && lastState.name === parentState.name)
|
|
203
|
-
return [false, lastState];
|
|
204
|
-
}
|
|
181
|
+
if (!shouldRerender && lastState && lastState.name === parentState.name) return [false, lastState];
|
|
205
182
|
return [shouldRerender, {
|
|
206
183
|
...parentState,
|
|
207
184
|
isNew: false
|
|
@@ -209,17 +186,12 @@ const getNextState = (lastState, props, propsKey, isRoot = false, id, parentId,
|
|
|
209
186
|
}
|
|
210
187
|
if (!name) {
|
|
211
188
|
const next = lastState ?? parentState;
|
|
212
|
-
if (!next) {
|
|
213
|
-
throw new Error(process.env.NODE_ENV === "development" ? `${import_constants3.MISSING_THEME_MESSAGE}
|
|
189
|
+
if (!next) throw new Error(process.env.NODE_ENV === "development" ? `${import_constants3.MISSING_THEME_MESSAGE}
|
|
214
190
|
|
|
215
191
|
Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? ` (component: ${props.componentName})` : ""}, but no theme state was resolved (parentId: ${parentId}, id: ${id}).` : import_constants3.MISSING_THEME_MESSAGE);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
...(parentState || lastState)
|
|
220
|
-
};
|
|
221
|
-
return [true, updated];
|
|
222
|
-
}
|
|
192
|
+
if (shouldRerender) return [true, {
|
|
193
|
+
...(parentState || lastState)
|
|
194
|
+
}];
|
|
223
195
|
return [false, next];
|
|
224
196
|
}
|
|
225
197
|
const scheme = getScheme(name);
|
|
@@ -231,16 +203,11 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? `
|
|
|
231
203
|
scheme,
|
|
232
204
|
parentId,
|
|
233
205
|
parentName: parentState?.name,
|
|
234
|
-
// inverses,
|
|
235
206
|
isInverse,
|
|
236
207
|
isNew: true
|
|
237
208
|
};
|
|
238
|
-
if (isRoot)
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
if (pendingUpdate !== "force" && lastState && lastState.name === name) {
|
|
242
|
-
return [false, nextState];
|
|
243
|
-
}
|
|
209
|
+
if (isRoot) rootThemeState = nextState;
|
|
210
|
+
if (pendingUpdate !== "force" && lastState && lastState.name === name) return [false, nextState];
|
|
244
211
|
const shouldAvoidRerender = pendingUpdate !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
|
|
245
212
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
246
213
|
console.groupCollapsed(` \xB7 useTheme(${id}) \u23ED\uFE0F ${name} shouldAvoidRerender: ${shouldAvoidRerender}`);
|
|
@@ -252,29 +219,23 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}${props.componentName ? `
|
|
|
252
219
|
});
|
|
253
220
|
console.groupEnd();
|
|
254
221
|
}
|
|
255
|
-
if (shouldAvoidRerender)
|
|
256
|
-
return [false, nextState];
|
|
257
|
-
}
|
|
222
|
+
if (shouldAvoidRerender) return [false, nextState];
|
|
258
223
|
return [true, nextState];
|
|
259
224
|
};
|
|
260
225
|
function scheduleUpdate(id) {
|
|
261
226
|
const queue = [id];
|
|
262
227
|
const visited = /* @__PURE__ */new Set();
|
|
263
228
|
while (queue.length) {
|
|
264
|
-
const
|
|
265
|
-
const children = listenersByParent[parent];
|
|
229
|
+
const children = listenersByParent[queue.shift()];
|
|
266
230
|
if (children) {
|
|
267
|
-
for (const childId of children) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
queue.push(childId);
|
|
271
|
-
}
|
|
231
|
+
for (const childId of children) if (!visited.has(childId)) {
|
|
232
|
+
visited.add(childId);
|
|
233
|
+
queue.push(childId);
|
|
272
234
|
}
|
|
273
235
|
}
|
|
274
236
|
}
|
|
275
237
|
visited.forEach(childId => {
|
|
276
|
-
|
|
277
|
-
cb?.();
|
|
238
|
+
allListeners.get(childId)?.();
|
|
278
239
|
});
|
|
279
240
|
}
|
|
280
241
|
const validSchemes = {
|
|
@@ -290,9 +251,7 @@ function getNewThemeName(parentName = "", props, forceUpdate = false) {
|
|
|
290
251
|
reset
|
|
291
252
|
} = props;
|
|
292
253
|
const componentName = props.unstyled ? void 0 : props.componentName;
|
|
293
|
-
if (name && reset)
|
|
294
|
-
throw new Error(process.env.NODE_ENV === "production" ? `\u274C004` : "Cannot reset and set a new name at the same time.");
|
|
295
|
-
}
|
|
254
|
+
if (name && reset) throw new Error(process.env.NODE_ENV === "production" ? `\u274C004` : "Cannot reset and set a new name at the same time.");
|
|
296
255
|
const cacheKey = `${parentName}|${name || ""}|${componentName || ""}|${reset ? 1 : 0}|${forceUpdate ? 1 : 0}`;
|
|
297
256
|
if (themeNameCacheVer !== cacheVersion) {
|
|
298
257
|
themeNameCache.clear();
|
|
@@ -305,8 +264,7 @@ function getNewThemeName(parentName = "", props, forceUpdate = false) {
|
|
|
305
264
|
themes: themes2
|
|
306
265
|
} = (0, import_config.getConfig)();
|
|
307
266
|
if (reset) {
|
|
308
|
-
|
|
309
|
-
if (isSchemeOnly) {
|
|
267
|
+
if (parentName === "light" || parentName === "dark") {
|
|
310
268
|
const result2 = parentName === "light" ? "dark" : "light";
|
|
311
269
|
themeNameCache.set(cacheKey, result2);
|
|
312
270
|
return result2;
|
|
@@ -320,65 +278,49 @@ function getNewThemeName(parentName = "", props, forceUpdate = false) {
|
|
|
320
278
|
}
|
|
321
279
|
const parentParts = parentName.split("_");
|
|
322
280
|
const lastName = parentParts[parentParts.length - 1];
|
|
323
|
-
if (lastName && lastName[0].toLowerCase() !== lastName[0])
|
|
324
|
-
parentParts.pop();
|
|
325
|
-
}
|
|
281
|
+
if (lastName && lastName[0].toLowerCase() !== lastName[0]) parentParts.pop();
|
|
326
282
|
const subNames = [name && componentName ? `${name}_${componentName}` : void 0, name, componentName].filter(Boolean);
|
|
327
283
|
let found = null;
|
|
328
284
|
if (name) {
|
|
329
285
|
const nameHasScheme = getScheme(name);
|
|
330
286
|
if (nameHasScheme) {
|
|
331
|
-
for (const subName of subNames) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
287
|
+
for (const subName of subNames) if (subName in themes2) {
|
|
288
|
+
found = subName;
|
|
289
|
+
break;
|
|
336
290
|
}
|
|
337
291
|
}
|
|
338
292
|
if (!found && !nameHasScheme) {
|
|
339
|
-
|
|
340
|
-
if (parentScheme) {
|
|
293
|
+
if (getScheme(parentName)) {
|
|
341
294
|
const potentialBases = [];
|
|
342
|
-
for (let i = parentParts.length; i >= 1; i--)
|
|
343
|
-
potentialBases.push(parentParts.slice(0, i).join("_"));
|
|
344
|
-
}
|
|
295
|
+
for (let i = parentParts.length; i >= 1; i--) potentialBases.push(parentParts.slice(0, i).join("_"));
|
|
345
296
|
outer: for (const base of potentialBases) {
|
|
346
297
|
const candidates = [componentName ? `${base}_${name}_${componentName}` : void 0, `${base}_${name}`].filter(Boolean);
|
|
347
|
-
for (const potential of candidates) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
break outer;
|
|
351
|
-
}
|
|
298
|
+
for (const potential of candidates) if (potential in themes2) {
|
|
299
|
+
found = potential;
|
|
300
|
+
break outer;
|
|
352
301
|
}
|
|
353
302
|
}
|
|
354
303
|
}
|
|
355
304
|
}
|
|
356
305
|
}
|
|
357
|
-
if (!found) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (potential in themes2) {
|
|
370
|
-
found = potential;
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
306
|
+
if (!found) if (!name && componentName) {
|
|
307
|
+
const potential = `${parentParts.join("_")}_${componentName}`;
|
|
308
|
+
if (potential in themes2) found = potential;
|
|
309
|
+
} else {
|
|
310
|
+
const max = parentParts.length;
|
|
311
|
+
for (let i = 0; i <= max; i++) {
|
|
312
|
+
const base = (i === 0 ? parentParts : parentParts.slice(0, -i)).join("_");
|
|
313
|
+
for (const subName of subNames) {
|
|
314
|
+
const potential = base ? `${base}_${subName}` : subName;
|
|
315
|
+
if (potential in themes2) {
|
|
316
|
+
found = potential;
|
|
317
|
+
break;
|
|
373
318
|
}
|
|
374
|
-
if (found) break;
|
|
375
319
|
}
|
|
320
|
+
if (found) break;
|
|
376
321
|
}
|
|
377
322
|
}
|
|
378
|
-
if (!forceUpdate && found === parentName &&
|
|
379
|
-
// if its a scheme only sub-theme, we always consider it "new" because it likely inverses
|
|
380
|
-
// and we want to avoid reparenting
|
|
381
|
-
!validSchemes[found]) {
|
|
323
|
+
if (!forceUpdate && found === parentName && !validSchemes[found]) {
|
|
382
324
|
themeNameCache.set(cacheKey, null);
|
|
383
325
|
return null;
|
|
384
326
|
}
|