@hanzogui/web 7.3.2 → 8.0.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/.turbo/turbo-build.log +2 -0
- package/dist/cjs/_withStableStyle.cjs +2 -2
- package/dist/cjs/_withStableStyle.native.js +2 -2
- package/dist/cjs/_withStableStyle.native.js.map +1 -1
- package/dist/cjs/config.cjs +18 -10
- package/dist/cjs/config.native.js +19 -10
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/constants/constants.cjs +1 -1
- package/dist/cjs/constants/constants.native.js +1 -1
- package/dist/cjs/constants/constants.native.js.map +1 -1
- package/dist/cjs/createComponent.cjs +68 -28
- package/dist/cjs/createComponent.native.js +75 -30
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createGui.cjs +1 -1
- package/dist/cjs/createGui.native.js +1 -1
- package/dist/cjs/createGui.native.js.map +1 -1
- package/dist/cjs/eventHandling.cjs +2 -2
- package/dist/cjs/eventHandling.native.js +73 -54
- package/dist/cjs/eventHandling.native.js.map +1 -1
- package/dist/cjs/helpers/createDesignSystem.cjs +2 -2
- package/dist/cjs/helpers/defaultAnimationDriver.cjs +1 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.js +1 -1
- package/dist/cjs/helpers/expandStyle.cjs +46 -5
- package/dist/cjs/helpers/expandStyle.native.js +36 -30
- package/dist/cjs/helpers/expandStyle.native.js.map +1 -1
- package/dist/cjs/helpers/getGroupPropParts.cjs +1 -1
- package/dist/cjs/helpers/getGroupPropParts.native.js +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +76 -31
- package/dist/cjs/helpers/getSplitStyles.native.js +140 -85
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getTokenForKey.cjs +5 -5
- package/dist/cjs/helpers/getTokenForKey.native.js +5 -5
- package/dist/cjs/helpers/getTokenForKey.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.cjs +7 -3
- package/dist/cjs/helpers/getVariantExtras.native.js +7 -3
- package/dist/cjs/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +4 -4
- package/dist/cjs/helpers/insertStyleRule.native.js +3 -3
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/mainThreadPressEvents.native.js +32 -4
- package/dist/cjs/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeStyle.cjs +22 -1
- package/dist/cjs/helpers/normalizeStyle.native.js +41 -1
- package/dist/cjs/helpers/normalizeStyle.native.js.map +1 -1
- package/dist/cjs/helpers/platformResolveValue.cjs +1 -1
- package/dist/cjs/helpers/platformResolveValue.native.js +1 -1
- package/dist/cjs/helpers/platformResolveValue.native.js.map +1 -1
- package/dist/cjs/helpers/pointerEvents.native.js +26 -20
- package/dist/cjs/helpers/pointerEvents.native.js.map +1 -1
- package/dist/cjs/helpers/propMapper.cjs +31 -7
- package/dist/cjs/helpers/propMapper.native.js +70 -20
- package/dist/cjs/helpers/propMapper.native.js.map +1 -1
- package/dist/cjs/helpers/resolveSafeArea.native.js +1 -1
- package/dist/cjs/helpers/resolveSafeArea.native.js.map +1 -1
- package/dist/cjs/helpers/styleOriginalValues.cjs +28 -0
- package/dist/cjs/helpers/styleOriginalValues.native.js +31 -0
- package/dist/cjs/helpers/styleOriginalValues.native.js.map +1 -0
- package/dist/cjs/helpers/styleProvenance.cjs +43 -0
- package/dist/cjs/helpers/styleProvenance.native.js +46 -0
- package/dist/cjs/helpers/styleProvenance.native.js.map +1 -0
- package/dist/cjs/helpers/wrapStyleTags.cjs +35 -11
- package/dist/cjs/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/cjs/hooks/getThemeProxied.cjs +1 -1
- package/dist/cjs/hooks/getThemeProxied.native.js +4 -4
- package/dist/cjs/hooks/getThemeProxied.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +29 -3
- package/dist/cjs/hooks/useComponentState.native.js +30 -4
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +107 -42
- package/dist/cjs/hooks/useMedia.native.js +149 -60
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/hooks/useTheme.cjs +18 -5
- package/dist/cjs/hooks/useTheme.native.js +19 -5
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/hooks/useThemeState.cjs +143 -72
- package/dist/cjs/hooks/useThemeState.native.js +155 -74
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.native.js +3 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/opacityModifier.test-d.cjs +36 -0
- package/dist/cjs/opacityModifier.test-d.native.js +39 -0
- package/dist/cjs/opacityModifier.test-d.native.js.map +1 -0
- package/dist/cjs/styledNonStyleProps.test-d.cjs +63 -0
- package/dist/cjs/styledNonStyleProps.test-d.native.js +66 -0
- package/dist/cjs/styledNonStyleProps.test-d.native.js.map +1 -0
- package/dist/cjs/views/GuiProvider.cjs +2 -2
- package/dist/cjs/views/Text.cjs +1 -0
- package/dist/cjs/views/Text.native.js +1 -0
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/Theme.cjs +1 -1
- package/dist/cjs/views/Theme.native.js +1 -1
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/esm/_withStableStyle.mjs +2 -2
- package/dist/esm/_withStableStyle.mjs.map +1 -1
- package/dist/esm/_withStableStyle.native.js +2 -2
- package/dist/esm/_withStableStyle.native.js.map +1 -1
- package/dist/esm/config.mjs +18 -11
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +19 -11
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/constants/constants.mjs +1 -1
- package/dist/esm/constants/constants.native.js +1 -1
- package/dist/esm/constants/constants.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +74 -35
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +90 -42
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createGui.mjs +6 -6
- package/dist/esm/createGui.mjs.map +1 -1
- package/dist/esm/createGui.native.js +6 -6
- package/dist/esm/createGui.native.js.map +1 -1
- package/dist/esm/eventHandling.mjs +2 -2
- package/dist/esm/eventHandling.mjs.map +1 -1
- package/dist/esm/eventHandling.native.js +74 -55
- package/dist/esm/eventHandling.native.js.map +1 -1
- package/dist/esm/helpers/createDesignSystem.mjs +2 -2
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
- package/dist/esm/helpers/createDesignSystem.native.js +1 -2
- 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 +47 -8
- package/dist/esm/helpers/expandStyle.mjs.map +1 -1
- package/dist/esm/helpers/expandStyle.native.js +36 -30
- package/dist/esm/helpers/expandStyle.native.js.map +1 -1
- package/dist/esm/helpers/expandStyles.mjs.map +1 -1
- package/dist/esm/helpers/expandStyles.native.js.map +1 -1
- package/dist/esm/helpers/getGroupPropParts.mjs +1 -1
- package/dist/esm/helpers/getGroupPropParts.mjs.map +1 -1
- package/dist/esm/helpers/getGroupPropParts.native.js +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +86 -45
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +146 -98
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -1
- package/dist/esm/helpers/getTokenForKey.mjs +5 -5
- package/dist/esm/helpers/getTokenForKey.mjs.map +1 -1
- package/dist/esm/helpers/getTokenForKey.native.js +5 -5
- package/dist/esm/helpers/getTokenForKey.native.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.mjs +7 -3
- package/dist/esm/helpers/getVariantExtras.mjs.map +1 -1
- package/dist/esm/helpers/getVariantExtras.native.js +7 -3
- package/dist/esm/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +4 -6
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +0 -26
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/isActivePlatform.mjs.map +1 -1
- package/dist/esm/helpers/isActivePlatform.native.js.map +1 -1
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js.map +1 -1
- package/dist/esm/helpers/mainThreadPressEvents.native.js +32 -4
- package/dist/esm/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/esm/helpers/normalizeStyle.mjs +22 -1
- package/dist/esm/helpers/normalizeStyle.mjs.map +1 -1
- package/dist/esm/helpers/normalizeStyle.native.js +41 -1
- package/dist/esm/helpers/normalizeStyle.native.js.map +1 -1
- package/dist/esm/helpers/platformResolveValue.mjs +1 -1
- package/dist/esm/helpers/platformResolveValue.mjs.map +1 -1
- package/dist/esm/helpers/platformResolveValue.native.js +1 -1
- package/dist/esm/helpers/platformResolveValue.native.js.map +1 -1
- package/dist/esm/helpers/pointerEvents.native.js +26 -20
- package/dist/esm/helpers/pointerEvents.native.js.map +1 -1
- package/dist/esm/helpers/propMapper.mjs +32 -11
- package/dist/esm/helpers/propMapper.mjs.map +1 -1
- package/dist/esm/helpers/propMapper.native.js +71 -22
- package/dist/esm/helpers/propMapper.native.js.map +1 -1
- package/dist/esm/helpers/resolveSafeArea.native.js +1 -1
- package/dist/esm/helpers/resolveSafeArea.native.js.map +1 -1
- package/dist/esm/helpers/skipProps.mjs +0 -1
- package/dist/esm/helpers/skipProps.mjs.map +1 -1
- package/dist/esm/helpers/skipProps.native.js +0 -1
- package/dist/esm/helpers/skipProps.native.js.map +1 -1
- package/dist/esm/helpers/styleOriginalValues.mjs +3 -0
- package/dist/esm/helpers/styleOriginalValues.mjs.map +1 -0
- package/dist/esm/helpers/styleOriginalValues.native.js +3 -0
- package/dist/esm/helpers/styleOriginalValues.native.js.map +1 -0
- package/dist/esm/helpers/styleProvenance.mjs +16 -0
- package/dist/esm/helpers/styleProvenance.mjs.map +1 -0
- package/dist/esm/helpers/styleProvenance.native.js +16 -0
- package/dist/esm/helpers/styleProvenance.native.js.map +1 -0
- package/dist/esm/helpers/useRenderElement.mjs.map +1 -1
- package/dist/esm/helpers/useRenderElement.native.js.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.mjs +35 -11
- package/dist/esm/helpers/wrapStyleTags.mjs.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.native.js +0 -2
- package/dist/esm/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/esm/hooks/getThemeProxied.mjs +2 -5
- package/dist/esm/hooks/getThemeProxied.mjs.map +1 -1
- package/dist/esm/hooks/getThemeProxied.native.js +5 -5
- package/dist/esm/hooks/getThemeProxied.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +31 -5
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +32 -6
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +108 -43
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +150 -61
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useTheme.mjs +18 -5
- package/dist/esm/hooks/useTheme.mjs.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +19 -5
- package/dist/esm/hooks/useTheme.native.js.map +1 -1
- package/dist/esm/hooks/useThemeState.mjs +141 -70
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +154 -73
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +4 -4
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/insertFont.mjs.map +1 -1
- package/dist/esm/insertFont.native.js +0 -1
- package/dist/esm/insertFont.native.js.map +1 -1
- package/dist/esm/opacityModifier.test-d.mjs +37 -0
- package/dist/esm/opacityModifier.test-d.mjs.map +1 -0
- package/dist/esm/opacityModifier.test-d.native.js +37 -0
- package/dist/esm/opacityModifier.test-d.native.js.map +1 -0
- package/dist/esm/styledNonStyleProps.test-d.mjs +64 -0
- package/dist/esm/styledNonStyleProps.test-d.mjs.map +1 -0
- package/dist/esm/styledNonStyleProps.test-d.native.js +64 -0
- package/dist/esm/styledNonStyleProps.test-d.native.js.map +1 -0
- package/dist/esm/views/GuiProvider.mjs +2 -2
- package/dist/esm/views/GuiProvider.mjs.map +1 -1
- package/dist/esm/views/GuiProvider.native.js +6 -6
- package/dist/esm/views/GuiProvider.native.js.map +1 -1
- package/dist/esm/views/Text.mjs +1 -0
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Text.native.js +1 -0
- package/dist/esm/views/Text.native.js.map +1 -1
- package/dist/esm/views/Theme.mjs +1 -1
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +1 -1
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/dist/esm/views/ThemeProvider.mjs.map +1 -1
- package/dist/esm/views/ThemeProvider.native.js +2 -4
- package/dist/esm/views/ThemeProvider.native.js.map +1 -1
- package/inject-styles/index.cjs +2 -0
- package/inject-styles/index.js +2 -0
- package/package.json +27 -40
- package/src/_withStableStyle.tsx +9 -3
- package/src/config.ts +24 -14
- package/src/constants/accessibilityDirectMap.tsx +1 -1
- package/src/constants/constants.ts +1 -1
- package/src/createComponent.tsx +161 -26
- package/src/createGui.ts +2 -2
- package/src/eventHandling.native.ts +143 -52
- package/src/eventHandling.ts +4 -2
- package/src/helpers/createDesignSystem.ts +2 -2
- package/src/helpers/createMediaStyle.ts +1 -1
- package/src/helpers/defaultAnimationDriver.tsx +1 -1
- package/src/helpers/expandStyle.ts +108 -40
- package/src/helpers/getGroupPropParts.ts +1 -1
- package/src/helpers/getSplitStyles.tsx +178 -72
- package/src/helpers/getTokenForKey.ts +5 -5
- package/src/helpers/getVariantExtras.tsx +5 -4
- package/src/helpers/insertStyleRule.tsx +7 -7
- package/src/helpers/mainThreadPressEvents.native.ts +42 -2
- package/src/helpers/mergeProps.ts +1 -1
- package/src/helpers/normalizeStyle.ts +23 -1
- package/src/helpers/platformResolveValue.native.ts +4 -1
- package/src/helpers/platformResolveValue.ts +5 -1
- package/src/helpers/pointerEvents.native.ts +26 -19
- package/src/helpers/propMapper.ts +61 -6
- package/src/helpers/resolveSafeArea.native.ts +1 -1
- package/src/helpers/styleOriginalValues.ts +2 -0
- package/src/helpers/styleProvenance.ts +49 -0
- package/src/helpers/wrapStyleTags.tsx +63 -20
- package/src/hooks/getThemeProxied.ts +14 -8
- package/src/hooks/useComponentState.ts +56 -4
- package/src/hooks/useMedia.tsx +156 -43
- package/src/hooks/useTheme.tsx +28 -6
- package/src/hooks/useThemeState.ts +284 -142
- package/src/index.ts +9 -1
- package/src/interfaces/GuiComponentPropsBaseBase.tsx +2 -2
- package/src/opacityModifier.test-d.ts +65 -0
- package/src/styled.tsx +1 -1
- package/src/styledNonStyleProps.test-d.ts +106 -0
- package/src/types.tsx +120 -22
- package/src/views/GuiProvider.tsx +2 -2
- package/src/views/Text.tsx +1 -0
- package/src/views/Theme.tsx +4 -1
- package/tsconfig.json +44 -0
- package/tsconfig.test.json +9 -0
- package/types/_withStableStyle.d.ts.map +1 -1
- package/types/config.d.ts +3 -1
- package/types/config.d.ts.map +1 -1
- package/types/constants/constants.d.ts +1 -1
- package/types/constants/constants.d.ts.map +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/eventHandling.d.ts +2 -2
- package/types/eventHandling.d.ts.map +1 -1
- package/types/eventHandling.native.d.ts +3 -3
- package/types/eventHandling.native.d.ts.map +1 -1
- package/types/helpers/expandStyle.d.ts +2 -1
- package/types/helpers/expandStyle.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +4 -2
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getVariantExtras.d.ts.map +1 -1
- package/types/helpers/mainThreadPressEvents.native.d.ts.map +1 -1
- package/types/helpers/normalizeStyle.d.ts.map +1 -1
- package/types/helpers/platformResolveValue.d.ts.map +1 -1
- package/types/helpers/platformResolveValue.native.d.ts.map +1 -1
- package/types/helpers/pointerEvents.native.d.ts.map +1 -1
- package/types/helpers/propMapper.d.ts.map +1 -1
- package/types/helpers/styleOriginalValues.d.ts +2 -0
- package/types/helpers/styleOriginalValues.d.ts.map +1 -0
- package/types/helpers/styleProvenance.d.ts +11 -0
- package/types/helpers/styleProvenance.d.ts.map +1 -0
- package/types/helpers/wrapStyleTags.d.ts +1 -1
- package/types/helpers/wrapStyleTags.d.ts.map +1 -1
- package/types/hooks/getThemeProxied.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts +2 -1
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/hooks/useThemeState.d.ts +1 -1
- package/types/hooks/useThemeState.d.ts.map +1 -1
- package/types/index.d.ts +3 -3
- package/types/index.d.ts.map +1 -1
- package/types/interfaces/GuiComponentPropsBaseBase.d.ts +2 -2
- package/types/types.d.ts +33 -16
- package/types/types.d.ts.map +1 -1
- package/types/views/Configuration.d.ts +1 -1
- package/types/views/Configuration.d.ts.map +1 -1
- package/types/views/FontLanguage.d.ts +1 -1
- package/types/views/FontLanguage.native.d.ts +1 -2
- package/types/views/FontLanguage.native.d.ts.map +1 -1
- package/types/views/GuiProvider.d.ts +1 -2
- package/types/views/GuiProvider.d.ts.map +1 -1
- package/types/views/GuiRoot.d.ts +1 -1
- package/types/views/GuiRoot.d.ts.map +1 -1
- package/types/views/Slot.d.ts +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeProvider.d.ts +1 -1
- package/types/views/ThemeProvider.d.ts.map +1 -1
- package/vitest.config.d.ts +3 -0
- package/vitest.config.d.ts.map +1 -0
- package/vitest.config.ts +14 -0
- package/LICENSE +0 -42
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/web",
|
|
3
|
-
"version": "
|
|
4
|
-
"license": "
|
|
5
|
-
"author":
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Nate Wienert"
|
|
7
|
+
},
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/hanzoai/gui.git",
|
|
10
|
+
"url": "git+https://github.com/hanzoai/gui.git",
|
|
9
11
|
"directory": "packages/web"
|
|
10
12
|
},
|
|
11
13
|
"source": "src/index.ts",
|
|
@@ -41,21 +43,28 @@
|
|
|
41
43
|
"publishConfig": {
|
|
42
44
|
"access": "public"
|
|
43
45
|
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "hanzogui-build",
|
|
48
|
+
"watch": "hanzogui-build --watch",
|
|
49
|
+
"clean": "hanzogui-build clean",
|
|
50
|
+
"clean:build": "hanzogui-build clean:build",
|
|
51
|
+
"test:web": "vitest --typecheck --run"
|
|
52
|
+
},
|
|
44
53
|
"dependencies": {
|
|
45
|
-
"@hanzogui/compose-refs": "
|
|
46
|
-
"@hanzogui/constants": "
|
|
47
|
-
"@hanzogui/helpers": "
|
|
48
|
-
"@hanzogui/is-equal-shallow": "
|
|
49
|
-
"@hanzogui/native": "
|
|
50
|
-
"@hanzogui/normalize-css-color": "
|
|
51
|
-
"@hanzogui/timer": "
|
|
52
|
-
"@hanzogui/types": "
|
|
53
|
-
"@hanzogui/use-did-finish-ssr": "
|
|
54
|
-
"@hanzogui/use-event": "
|
|
55
|
-
"@hanzogui/use-force-update": "
|
|
54
|
+
"@hanzogui/compose-refs": "8.0.0",
|
|
55
|
+
"@hanzogui/constants": "8.0.0",
|
|
56
|
+
"@hanzogui/helpers": "8.0.0",
|
|
57
|
+
"@hanzogui/is-equal-shallow": "8.0.0",
|
|
58
|
+
"@hanzogui/native": "8.0.0",
|
|
59
|
+
"@hanzogui/normalize-css-color": "8.0.0",
|
|
60
|
+
"@hanzogui/timer": "8.0.0",
|
|
61
|
+
"@hanzogui/types": "8.0.0",
|
|
62
|
+
"@hanzogui/use-did-finish-ssr": "8.0.0",
|
|
63
|
+
"@hanzogui/use-event": "8.0.0",
|
|
64
|
+
"@hanzogui/use-force-update": "8.0.0"
|
|
56
65
|
},
|
|
57
66
|
"devDependencies": {
|
|
58
|
-
"@hanzogui/build": "
|
|
67
|
+
"@hanzogui/build": "8.0.0",
|
|
59
68
|
"@testing-library/react": "^16.1.0",
|
|
60
69
|
"csstype": "^3.0.10",
|
|
61
70
|
"react": ">=19",
|
|
@@ -66,28 +75,6 @@
|
|
|
66
75
|
},
|
|
67
76
|
"peerDependencies": {
|
|
68
77
|
"react": ">=19",
|
|
69
|
-
"react-dom": "*"
|
|
70
|
-
"react-native": "*"
|
|
71
|
-
},
|
|
72
|
-
"files": [
|
|
73
|
-
"dist",
|
|
74
|
-
"src",
|
|
75
|
-
"types",
|
|
76
|
-
"*.cjs",
|
|
77
|
-
"*.mjs",
|
|
78
|
-
"*.css",
|
|
79
|
-
"README.md"
|
|
80
|
-
],
|
|
81
|
-
"peerDependenciesMeta": {
|
|
82
|
-
"react-native": {
|
|
83
|
-
"optional": true
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"scripts": {
|
|
87
|
-
"build": "gui-build",
|
|
88
|
-
"watch": "gui-build --watch",
|
|
89
|
-
"clean": "gui-build clean",
|
|
90
|
-
"clean:build": "gui-build clean:build",
|
|
91
|
-
"test:web": "vitest --typecheck --run"
|
|
78
|
+
"react-dom": "*"
|
|
92
79
|
}
|
|
93
|
-
}
|
|
80
|
+
}
|
package/src/_withStableStyle.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useMedia } from './hooks/useMedia'
|
|
|
4
4
|
import { useTheme } from './hooks/useTheme'
|
|
5
5
|
import { ThemeStateContext } from './hooks/useThemeState'
|
|
6
6
|
|
|
7
|
-
/** internal: this is for
|
|
7
|
+
/** internal: this is for hanzogui babel plugin usage only */
|
|
8
8
|
|
|
9
9
|
const EMPTY_EXPRESSIONS: any[] = []
|
|
10
10
|
const EMPTY_THEME = {}
|
|
@@ -28,7 +28,13 @@ export const _withStableStyle = (
|
|
|
28
28
|
const media = hasMediaKeys ? useMedia() : null
|
|
29
29
|
|
|
30
30
|
const resolvedExpressions = media
|
|
31
|
-
? _expressions.map((expr: any) =>
|
|
31
|
+
? _expressions.map((expr: any) =>
|
|
32
|
+
Array.isArray(expr)
|
|
33
|
+
? !!(media[expr[0]] && expr[1])
|
|
34
|
+
: typeof expr === 'string'
|
|
35
|
+
? media[expr]
|
|
36
|
+
: expr
|
|
37
|
+
)
|
|
32
38
|
: _expressions
|
|
33
39
|
|
|
34
40
|
let resolvedTheme: any = theme || EMPTY_THEME
|
|
@@ -45,7 +51,7 @@ export const _withStableStyle = (
|
|
|
45
51
|
if (process.env.NODE_ENV === 'development') {
|
|
46
52
|
console.warn(
|
|
47
53
|
'[@hanzogui] _withStableStyle: no ThemeStateContext found. ' +
|
|
48
|
-
'This usually means duplicate
|
|
54
|
+
'This usually means duplicate hanzogui instances in a monorepo. ' +
|
|
49
55
|
'Falling back to default theme from config.'
|
|
50
56
|
)
|
|
51
57
|
}
|
package/src/config.ts
CHANGED
|
@@ -10,6 +10,8 @@ import type {
|
|
|
10
10
|
TokensMerged,
|
|
11
11
|
} from './types'
|
|
12
12
|
|
|
13
|
+
export type StyleCompat = 'legacy' | 'react-native' | 'web'
|
|
14
|
+
|
|
13
15
|
let conf: GuiInternalConfig | null
|
|
14
16
|
let setConfigCalledByThisInstance = false
|
|
15
17
|
|
|
@@ -21,40 +23,40 @@ Haven't called createGui yet. ${MISSING_THEME_MESSAGE}
|
|
|
21
23
|
: `❌ Error 001`
|
|
22
24
|
|
|
23
25
|
// helper to get config from module-scoped variable or globalthis fallback
|
|
24
|
-
// this handles vite ssr bundling where multiple copies of
|
|
26
|
+
// this handles vite ssr bundling where multiple copies of hanzogui may exist
|
|
25
27
|
const getConfigFromGlobalOrLocal = (): GuiInternalConfig | null => {
|
|
26
28
|
if (conf) {
|
|
27
29
|
return conf
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
// fall back to globalthis (for vite ssr bundling scenarios)
|
|
31
|
-
if (globalThis.
|
|
33
|
+
if (globalThis.__hanzoguiConfig) {
|
|
32
34
|
// defer warning - if createGui runs in THIS instance, it's HMR (safe)
|
|
33
35
|
// if it never runs, it's a true duplicate (warn)
|
|
34
36
|
if (
|
|
35
37
|
process.env.NODE_ENV === 'development' &&
|
|
36
|
-
!globalThis.
|
|
37
|
-
!globalThis.
|
|
38
|
+
!globalThis.__hanzoguiHasWarnedGlobalFallback &&
|
|
39
|
+
!globalThis.__hanzoguiPendingCheck
|
|
38
40
|
) {
|
|
39
|
-
globalThis.
|
|
41
|
+
globalThis.__hanzoguiPendingCheck = true
|
|
40
42
|
setTimeout(() => {
|
|
41
43
|
if (
|
|
42
44
|
!setConfigCalledByThisInstance &&
|
|
43
|
-
!globalThis.
|
|
45
|
+
!globalThis.__hanzoguiHasWarnedGlobalFallback
|
|
44
46
|
) {
|
|
45
|
-
globalThis.
|
|
47
|
+
globalThis.__hanzoguiHasWarnedGlobalFallback = true
|
|
46
48
|
console.warn(
|
|
47
49
|
`⚠️⚠️⚠️⚠️⚠️
|
|
48
50
|
|
|
49
|
-
Gui: Using global config fallback. This may indicate duplicate
|
|
51
|
+
Gui: Using global config fallback. This may indicate duplicate hanzogui instances (e.g., from Vite SSR bundling). This is handled automatically, but likely causes issues!
|
|
50
52
|
|
|
51
53
|
⚠️⚠️⚠️⚠️⚠️`
|
|
52
54
|
)
|
|
53
55
|
}
|
|
54
|
-
globalThis.
|
|
56
|
+
globalThis.__hanzoguiPendingCheck = false
|
|
55
57
|
}, 500)
|
|
56
58
|
}
|
|
57
|
-
return globalThis.
|
|
59
|
+
return globalThis.__hanzoguiConfig
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
return null
|
|
@@ -74,10 +76,15 @@ export const getSetting = <Key extends keyof GenericGuiSettings>(
|
|
|
74
76
|
)
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
export function getStyleCompat(): StyleCompat {
|
|
80
|
+
const config = getConfigFromGlobalOrLocal()
|
|
81
|
+
return (config?.settings.styleCompat ?? (config as any)?.styleCompat) || 'web'
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
export const setConfig = (next: GuiInternalConfig) => {
|
|
78
85
|
setConfigCalledByThisInstance = true
|
|
79
86
|
conf = next
|
|
80
|
-
globalThis.
|
|
87
|
+
globalThis.__hanzoguiConfig = next
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
export const setConfigFont = (name: string, font: any, fontParsed: any) => {
|
|
@@ -94,7 +101,7 @@ export const getConfig = () => {
|
|
|
94
101
|
if (!config) {
|
|
95
102
|
throw new Error(
|
|
96
103
|
process.env.NODE_ENV !== 'production'
|
|
97
|
-
? `Missing
|
|
104
|
+
? `Missing hanzogui config, you either have a duplicate config, or haven't set it up. Be sure createGui is called before rendering. Also, make sure all of your hanzogui dependencies are on the same version (\`hanzogui\`, \`@hanzogui/package-name\`, etc.) not just in your package.json, but in your lockfile.`
|
|
98
105
|
: 'Err0'
|
|
99
106
|
)
|
|
100
107
|
}
|
|
@@ -160,7 +167,10 @@ export const getThemes = () => getConfigFromGlobalOrLocal()!.themes
|
|
|
160
167
|
export const updateConfig = (key: string, value: any) => {
|
|
161
168
|
// for usage internally only
|
|
162
169
|
const config = getConfigFromGlobalOrLocal()
|
|
163
|
-
Object.
|
|
170
|
+
if (!config || !Object.prototype.hasOwnProperty.call(config, key)) {
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
Object.assign(config[key], value)
|
|
164
174
|
}
|
|
165
175
|
|
|
166
176
|
// searches by value name or token name
|
|
@@ -197,7 +207,7 @@ export function setupDev(conf: DevConfig) {
|
|
|
197
207
|
*
|
|
198
208
|
* @example
|
|
199
209
|
* ```tsx
|
|
200
|
-
* // import loadAnimationDriver from
|
|
210
|
+
* // import loadAnimationDriver from hanzogui
|
|
201
211
|
* // import createAnimations from your preferred driver (e.g. animations-reanimated)
|
|
202
212
|
*
|
|
203
213
|
* const driver = createAnimations({ bouncy: { type: 'spring', damping: 10 } })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// v2: RN accessibility props are no longer converted
|
|
2
2
|
// Users should use web-standard aria-* props directly (aria-label, role, etc.)
|
|
3
|
-
// See https://
|
|
3
|
+
// See https://hanzogui.dev/docs/intro/version-two for migration guide
|
|
4
4
|
|
|
5
5
|
export const accessibilityDirectMap: Record<string, string> = {}
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@ import type { StackStyle } from '../types'
|
|
|
2
2
|
|
|
3
3
|
export const THEME_NAME_SEPARATOR = '_'
|
|
4
4
|
export const THEME_CLASSNAME_PREFIX = 't_'
|
|
5
|
-
export const FONT_DATA_ATTRIBUTE_NAME = 'data-
|
|
5
|
+
export const FONT_DATA_ATTRIBUTE_NAME = 'data-hanzogui-font'
|
|
6
6
|
|
|
7
7
|
export const MISSING_THEME_MESSAGE =
|
|
8
8
|
process.env.NODE_ENV === 'development'
|
package/src/createComponent.tsx
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { composeRefs } from '@hanzogui/compose-refs'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getPlatformDriver,
|
|
4
|
+
isAndroid,
|
|
5
|
+
isClient,
|
|
6
|
+
isNativeDesktop,
|
|
7
|
+
isServer,
|
|
8
|
+
isWeb,
|
|
9
|
+
useIsomorphicLayoutEffect,
|
|
10
|
+
} from '@hanzogui/constants'
|
|
3
11
|
import { NativeMenuContext } from '@hanzogui/native'
|
|
4
12
|
import { composeEventHandlers } from '@hanzogui/helpers'
|
|
5
13
|
import { isEqualShallow } from '@hanzogui/is-equal-shallow'
|
|
@@ -63,6 +71,7 @@ import type { ViewProps } from './views/View'
|
|
|
63
71
|
// matching shadcn's "named primitives only" rule.
|
|
64
72
|
// Memoized: names come from the fixed set of styled() definitions, so each is
|
|
65
73
|
// kebab-cased once — the render path is then an O(1) hit with no per-render regex.
|
|
74
|
+
// PATCH (ours, carried across the transplant): upstream has no equivalent.
|
|
66
75
|
const dataSlotCache = new Map<string, string>()
|
|
67
76
|
const dataSlotFor = (name: string): string => {
|
|
68
77
|
let slot = dataSlotCache.get(name)
|
|
@@ -98,6 +107,16 @@ const avoidReRenderKeys = new Set([
|
|
|
98
107
|
'group',
|
|
99
108
|
])
|
|
100
109
|
|
|
110
|
+
const groupPseudoKeys = [
|
|
111
|
+
'disabled',
|
|
112
|
+
'hover',
|
|
113
|
+
'press',
|
|
114
|
+
'pressIn',
|
|
115
|
+
'focus',
|
|
116
|
+
'focusVisible',
|
|
117
|
+
'focusWithin',
|
|
118
|
+
] as const satisfies readonly (keyof PseudoGroupState)[]
|
|
119
|
+
|
|
101
120
|
if (process.env.GUI_TARGET !== 'native' && typeof window !== 'undefined') {
|
|
102
121
|
const cancelPresses = () => {
|
|
103
122
|
// clear all press downs
|
|
@@ -142,8 +161,8 @@ if (process.env.GUI_TARGET !== 'native' && typeof window !== 'undefined') {
|
|
|
142
161
|
startVisualizer = () => {
|
|
143
162
|
const devVisualizerConfig = devConfig?.visualizer
|
|
144
163
|
|
|
145
|
-
if (devVisualizerConfig && !globalThis.
|
|
146
|
-
globalThis.
|
|
164
|
+
if (devVisualizerConfig && !globalThis.__hanzoguiDevVisualizer) {
|
|
165
|
+
globalThis.__hanzoguiDevVisualizer = true
|
|
147
166
|
|
|
148
167
|
debugKeyListeners = new Set()
|
|
149
168
|
let tm
|
|
@@ -282,10 +301,14 @@ export function createComponent<
|
|
|
282
301
|
|
|
283
302
|
// test only
|
|
284
303
|
if (process.env.NODE_ENV === 'test') {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
304
|
+
const testRenderCount = propsIn['data-test-renders']
|
|
305
|
+
if (
|
|
306
|
+
testRenderCount &&
|
|
307
|
+
typeof testRenderCount === 'object' &&
|
|
308
|
+
!Object.isFrozen(testRenderCount)
|
|
309
|
+
) {
|
|
310
|
+
testRenderCount.current = testRenderCount.current ?? 0
|
|
311
|
+
testRenderCount.current += 1
|
|
289
312
|
}
|
|
290
313
|
}
|
|
291
314
|
|
|
@@ -305,9 +328,14 @@ export function createComponent<
|
|
|
305
328
|
// On Android, skip RNGH GestureDetector inside native menus (zeego) and use
|
|
306
329
|
// direct press events instead — GestureDetector consumes touches before they
|
|
307
330
|
// reach MenuView's native handler, preventing the menu from opening
|
|
331
|
+
// NativeMenuContext only affects Android RNGH press arbitration inside zeego
|
|
332
|
+
// menus (see eventHandling.native.ts:182). isAndroid is constant for the whole
|
|
333
|
+
// app run, so on iOS we skip this context read for every component — the branch
|
|
334
|
+
// never flips at runtime, so hook order stays stable (rules-of-hooks safe).
|
|
308
335
|
const isInsideNativeMenu =
|
|
309
|
-
process.env.GUI_TARGET === 'native'
|
|
310
|
-
?
|
|
336
|
+
process.env.GUI_TARGET === 'native' && isAndroid
|
|
337
|
+
? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
338
|
+
React.useContext(NativeMenuContext)
|
|
311
339
|
: false
|
|
312
340
|
|
|
313
341
|
if (
|
|
@@ -324,7 +352,7 @@ export function createComponent<
|
|
|
324
352
|
if (process.env.NODE_ENV === 'development' && !time && (globalThis as any).time) {
|
|
325
353
|
time = (globalThis as any).time
|
|
326
354
|
}
|
|
327
|
-
if (process.env.NODE_ENV === 'development' && time) time`non-
|
|
355
|
+
if (process.env.NODE_ENV === 'development' && time) time`non-hanzogui time (ignore)`
|
|
328
356
|
|
|
329
357
|
// React inserts default props after your props for some reason...
|
|
330
358
|
// order important so we do loops, you can't just spread because JS does weird things
|
|
@@ -459,19 +487,65 @@ export function createComponent<
|
|
|
459
487
|
outputStyle,
|
|
460
488
|
willBeAnimated,
|
|
461
489
|
willBeAnimatedClient,
|
|
490
|
+
platformPseudo,
|
|
462
491
|
startedUnhydrated,
|
|
463
492
|
} = componentState
|
|
464
493
|
|
|
465
|
-
if (
|
|
494
|
+
if (animationDriver?.avoidReRenders) {
|
|
495
|
+
// post-commit reconciliation of `nextState` with the committed React state.
|
|
496
|
+
// `nextState` is the source of truth for the fast `setStateShallow` path; it
|
|
497
|
+
// must stay populated until React actually commits the corresponding update,
|
|
498
|
+
// otherwise a follow-up update in the same JS task would read a stale closure
|
|
499
|
+
// `state` and bail on a false shallow-equal. once committed state matches
|
|
500
|
+
// `nextState`, clear it. if they diverge (animated components' fast path never
|
|
501
|
+
// calls into React), flush via componentState.setStateShallow here.
|
|
466
502
|
useIsomorphicLayoutEffect(() => {
|
|
503
|
+
// first: refresh the emitter latch while a self pseudo is active. the driver
|
|
504
|
+
// keeps the last-emitted snapshot latched across re-renders (so an unrelated
|
|
505
|
+
// render doesn't snap a hovered style back to base), but a render can change
|
|
506
|
+
// the styles that FEED the pseudo merge — e.g. a row becoming active removes
|
|
507
|
+
// its hoverStyle while still hovered — and the stale snapshot would keep
|
|
508
|
+
// painting over the new base (hover-beats-active-during-scrub).
|
|
509
|
+
// `updateStyleListener` is rebuilt each render over fresh props/state and
|
|
510
|
+
// reads `nextState || state`, so re-invoking it re-emits the correct merged
|
|
511
|
+
// style: identical values when the render was truly unrelated (no visual
|
|
512
|
+
// change), fresh values when it wasn't. gate on the last-EMITTED pseudo state
|
|
513
|
+
// (prevPseudoState), not React state — React state can lag the emitter by a
|
|
514
|
+
// commit, and a stale-true `state.hover` here would resurrect a hover the
|
|
515
|
+
// emitter already cleared. this must run BEFORE the nextState flush below so
|
|
516
|
+
// the re-emit still sees the freshest pseudo state.
|
|
517
|
+
const emitted = stateRef.current.prevPseudoState
|
|
518
|
+
if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
|
|
519
|
+
stateRef.current.updateStyleListener?.()
|
|
520
|
+
}
|
|
521
|
+
|
|
467
522
|
const pendingState = stateRef.current.nextState
|
|
468
|
-
if (pendingState)
|
|
469
|
-
|
|
523
|
+
if (!pendingState) return
|
|
524
|
+
stateRef.current.nextState = undefined
|
|
525
|
+
if (!isEqualShallow(state, pendingState)) {
|
|
470
526
|
componentState.setStateShallow(pendingState)
|
|
471
527
|
}
|
|
472
528
|
})
|
|
473
529
|
}
|
|
474
530
|
|
|
531
|
+
// renderer-driven pseudo states (setupPlatformDriver): the platform resolves
|
|
532
|
+
// hover natively per hitbox and pushes flips here, replacing the
|
|
533
|
+
// mouseEnter/mouseLeave lane on such renderers. the flip applies through the
|
|
534
|
+
// same setStateShallow the event handlers use — under the (driver-opened)
|
|
535
|
+
// avoidReRenders gate that's the emitter path: zero React commits, animated
|
|
536
|
+
// per the declared transition or instant by default. press stays on the
|
|
537
|
+
// responder event path (it must fire onPress anyway); the driver only owns
|
|
538
|
+
// the hover trigger for now.
|
|
539
|
+
useIsomorphicLayoutEffect(() => {
|
|
540
|
+
if (!platformPseudo || props.disabled) return
|
|
541
|
+
const pseudoDriver = getPlatformDriver()?.pseudo
|
|
542
|
+
const host = stateRef.current.host
|
|
543
|
+
if (!pseudoDriver || !host) return
|
|
544
|
+
return pseudoDriver.subscribe(host, ({ hovered }) => {
|
|
545
|
+
stateRef.current.setStateShallow?.({ hover: hovered })
|
|
546
|
+
})
|
|
547
|
+
}, [platformPseudo, props.disabled])
|
|
548
|
+
|
|
475
549
|
// create new context with groups, or else sublings will grab the same one
|
|
476
550
|
const allGroupContexts = useMemo((): AllGroupContexts | null => {
|
|
477
551
|
if (!groupName || props.passThrough) {
|
|
@@ -748,7 +822,7 @@ export function createComponent<
|
|
|
748
822
|
|
|
749
823
|
if (
|
|
750
824
|
!isPassthrough &&
|
|
751
|
-
(hasAnimationProp || groupName) &&
|
|
825
|
+
(hasAnimationProp || groupName || platformPseudo) &&
|
|
752
826
|
animationDriver?.avoidReRenders &&
|
|
753
827
|
!hasEnterExitTransition
|
|
754
828
|
) {
|
|
@@ -758,11 +832,15 @@ export function createComponent<
|
|
|
758
832
|
const useStyleListener = stateRef.current.useStyleListener
|
|
759
833
|
|
|
760
834
|
// if no animation driver is listening for style updates, fall back to normal re-render
|
|
761
|
-
// this happens when a component has group prop but no transition/animation prop
|
|
835
|
+
// this happens when a component has group prop but no transition/animation prop.
|
|
836
|
+
// keep nextState populated until React actually commits the update — clearing it
|
|
837
|
+
// here lets a subsequent setStateShallow in the same JS task (e.g. press-out
|
|
838
|
+
// right after press-in) compare against a stale closure `state` and bail out,
|
|
839
|
+
// losing the update. the post-commit layoutEffect below clears nextState once
|
|
840
|
+
// React state has caught up.
|
|
762
841
|
if (!useStyleListener) {
|
|
763
842
|
const pendingState = stateRef.current.nextState
|
|
764
843
|
if (pendingState) {
|
|
765
|
-
stateRef.current.nextState = undefined
|
|
766
844
|
ogSetStateShallow(pendingState)
|
|
767
845
|
}
|
|
768
846
|
return
|
|
@@ -792,13 +870,30 @@ export function createComponent<
|
|
|
792
870
|
stateRef.current.prevPseudoState,
|
|
793
871
|
updatedState,
|
|
794
872
|
nextStyles?.pseudoTransitions,
|
|
795
|
-
|
|
873
|
+
// platform-pseudo with no declared transition = instant (CSS :hover semantics)
|
|
874
|
+
props.transition ?? (platformPseudo ? '0ms' : undefined)
|
|
796
875
|
)
|
|
797
876
|
|
|
798
877
|
// update prev state for next comparison (includes group states)
|
|
799
878
|
stateRef.current.prevPseudoState = extractPseudoState(updatedState)
|
|
800
879
|
|
|
801
|
-
|
|
880
|
+
// a self pseudo being active means the emitted style is a transient hover/press/focus
|
|
881
|
+
// override (it's not in React state under avoidReRenders), so the worklet must keep it
|
|
882
|
+
// latched across incidental re-renders; when none is active this is the base and renders
|
|
883
|
+
// own it again.
|
|
884
|
+
const hasActivePseudo = Boolean(
|
|
885
|
+
updatedState.hover ||
|
|
886
|
+
updatedState.press ||
|
|
887
|
+
updatedState.pressIn ||
|
|
888
|
+
updatedState.focus ||
|
|
889
|
+
updatedState.focusWithin
|
|
890
|
+
)
|
|
891
|
+
|
|
892
|
+
useStyleListener(
|
|
893
|
+
(nextStyles?.style || {}) as any,
|
|
894
|
+
effectiveTransition,
|
|
895
|
+
hasActivePseudo
|
|
896
|
+
)
|
|
802
897
|
}
|
|
803
898
|
|
|
804
899
|
function updateGroupListeners() {
|
|
@@ -962,6 +1057,7 @@ export function createComponent<
|
|
|
962
1057
|
onMouseLeave,
|
|
963
1058
|
onFocus,
|
|
964
1059
|
onBlur,
|
|
1060
|
+
onDidAnimate,
|
|
965
1061
|
separator,
|
|
966
1062
|
// ignore from here on out
|
|
967
1063
|
passThrough,
|
|
@@ -1013,7 +1109,8 @@ export function createComponent<
|
|
|
1013
1109
|
stateRef.current.prevPseudoState,
|
|
1014
1110
|
state,
|
|
1015
1111
|
splitStyles?.pseudoTransitions,
|
|
1016
|
-
|
|
1112
|
+
// platform-pseudo with no declared transition = instant (CSS :hover semantics)
|
|
1113
|
+
props.transition ?? (platformPseudo ? '0ms' : undefined)
|
|
1017
1114
|
)
|
|
1018
1115
|
|
|
1019
1116
|
// add effectiveTransition to splitStyles for drivers to consume
|
|
@@ -1041,6 +1138,7 @@ export function createComponent<
|
|
|
1041
1138
|
pseudos: pseudos || null,
|
|
1042
1139
|
staticConfig,
|
|
1043
1140
|
stateRef,
|
|
1141
|
+
onDidAnimate,
|
|
1044
1142
|
})
|
|
1045
1143
|
|
|
1046
1144
|
if (animations) {
|
|
@@ -1256,9 +1354,14 @@ export function createComponent<
|
|
|
1256
1354
|
)
|
|
1257
1355
|
|
|
1258
1356
|
const runtimeHoverStyle = !disabled && noClass && pseudos?.hoverStyle
|
|
1259
|
-
|
|
1357
|
+
// with a platform pseudo driver the hover STATE is driver-sourced; only keep
|
|
1358
|
+
// the JS hover listeners when something else needs them (dynamic group
|
|
1359
|
+
// children, or the user's own onMouseEnter/Leave handlers below).
|
|
1360
|
+
const needsHoverState = Boolean(
|
|
1361
|
+
hasDynamicGroupChildren || (runtimeHoverStyle && !platformPseudo)
|
|
1362
|
+
)
|
|
1260
1363
|
const attachHover =
|
|
1261
|
-
isWeb &&
|
|
1364
|
+
(isWeb || isNativeDesktop) &&
|
|
1262
1365
|
!!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave)
|
|
1263
1366
|
|
|
1264
1367
|
// check presence rather than value to prevent reparenting bugs
|
|
@@ -1450,6 +1553,9 @@ export function createComponent<
|
|
|
1450
1553
|
|
|
1451
1554
|
// EVENTS native - handles focus/blur, input special cases, and RNGH press handling
|
|
1452
1555
|
// Skip gesture setup for HOC components - they may return null which crashes GestureDetector
|
|
1556
|
+
// hasRealPressEvents distinguishes user-provided handlers from events.onPress
|
|
1557
|
+
// synthesized for pressStyle alone — only the former should claim the responder.
|
|
1558
|
+
const hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress)
|
|
1453
1559
|
const pressGesture =
|
|
1454
1560
|
process.env.GUI_TARGET === 'native'
|
|
1455
1561
|
? useEvents(
|
|
@@ -1459,7 +1565,8 @@ export function createComponent<
|
|
|
1459
1565
|
staticConfig,
|
|
1460
1566
|
isHOC,
|
|
1461
1567
|
isInsideNativeMenu,
|
|
1462
|
-
pressDebugName
|
|
1568
|
+
pressDebugName,
|
|
1569
|
+
hasRealPressEvents
|
|
1463
1570
|
)
|
|
1464
1571
|
: null
|
|
1465
1572
|
|
|
@@ -1558,7 +1665,8 @@ export function createComponent<
|
|
|
1558
1665
|
pressGesture,
|
|
1559
1666
|
stateRef,
|
|
1560
1667
|
isHOC,
|
|
1561
|
-
isCompositeComponent
|
|
1668
|
+
isCompositeComponent,
|
|
1669
|
+
hasRealPressEvents
|
|
1562
1670
|
)
|
|
1563
1671
|
}
|
|
1564
1672
|
|
|
@@ -1753,9 +1861,36 @@ export function createComponent<
|
|
|
1753
1861
|
if (!groupContext || !groupEmitter) {
|
|
1754
1862
|
return
|
|
1755
1863
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1864
|
+
|
|
1865
|
+
const prevPseudo = groupContext.state.pseudo
|
|
1866
|
+
const shouldReplacePseudo =
|
|
1867
|
+
!prevPseudo ||
|
|
1868
|
+
// old/default state objects carry non-pseudo fields; replace once instead
|
|
1869
|
+
// of mutating the shared defaultComponentStateMounted object
|
|
1870
|
+
'unmounted' in prevPseudo ||
|
|
1871
|
+
'group' in prevPseudo ||
|
|
1872
|
+
'hasDynGroupChildren' in prevPseudo ||
|
|
1873
|
+
'transition' in prevPseudo
|
|
1874
|
+
const nextPseudo = shouldReplacePseudo ? {} : prevPseudo
|
|
1875
|
+
let didChange = shouldReplacePseudo
|
|
1876
|
+
|
|
1877
|
+
for (let i = 0; i < groupPseudoKeys.length; i++) {
|
|
1878
|
+
const key = groupPseudoKeys[i]
|
|
1879
|
+
const value = pseudo[key]
|
|
1880
|
+
if (nextPseudo[key] !== value) {
|
|
1881
|
+
nextPseudo[key] = value
|
|
1882
|
+
didChange = true
|
|
1883
|
+
} else if (didChange) {
|
|
1884
|
+
nextPseudo[key] = value
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
if (!didChange) {
|
|
1889
|
+
return
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
groupContext.state.pseudo = nextPseudo
|
|
1893
|
+
groupEmitter.emit(groupContext.state)
|
|
1759
1894
|
}
|
|
1760
1895
|
|
|
1761
1896
|
// let hasLogged = false
|
package/src/createGui.ts
CHANGED
|
@@ -56,7 +56,7 @@ function initializeGuiConfig(config: GuiInternalConfig) {
|
|
|
56
56
|
export function createGui<Conf extends CreateGuiProps>(
|
|
57
57
|
configIn: Conf
|
|
58
58
|
): InferGuiConfig<Conf> {
|
|
59
|
-
// if config already exists (e.g., from another copy of
|
|
59
|
+
// if config already exists (e.g., from another copy of hanzogui in vite ssr), reuse it
|
|
60
60
|
const existingConfig = getConfigMaybe()
|
|
61
61
|
|
|
62
62
|
if (existingConfig) {
|
|
@@ -257,7 +257,7 @@ export function createGui<Conf extends CreateGuiProps>(
|
|
|
257
257
|
return config as any
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
if (process.env.DEBUG?.startsWith('
|
|
260
|
+
if (process.env.DEBUG?.startsWith('hanzogui')) {
|
|
261
261
|
console.info('Gui config:', config)
|
|
262
262
|
}
|
|
263
263
|
if (!globalThis['Gui']) {
|