@hanzogui/web 2.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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/cjs/Gui.cjs +72 -0
- package/dist/cjs/Gui.native.js +112 -0
- package/dist/cjs/Gui.native.js.map +1 -0
- package/dist/cjs/_withStableStyle.cjs +65 -0
- package/dist/cjs/_withStableStyle.native.js +77 -0
- package/dist/cjs/_withStableStyle.native.js.map +1 -0
- package/dist/cjs/animationDriverTypes.test-d.cjs +60 -0
- package/dist/cjs/animationDriverTypes.test-d.native.js +63 -0
- package/dist/cjs/animationDriverTypes.test-d.native.js.map +1 -0
- package/dist/cjs/config.cjs +126 -0
- package/dist/cjs/config.native.js +157 -0
- package/dist/cjs/config.native.js.map +1 -0
- package/dist/cjs/constants/accessibilityDirectMap.cjs +34 -0
- package/dist/cjs/constants/accessibilityDirectMap.native.js +37 -0
- package/dist/cjs/constants/accessibilityDirectMap.native.js.map +1 -0
- package/dist/cjs/constants/constants.cjs +38 -0
- package/dist/cjs/constants/constants.native.js +41 -0
- package/dist/cjs/constants/constants.native.js.map +1 -0
- package/dist/cjs/constants/isDevTools.cjs +31 -0
- package/dist/cjs/constants/isDevTools.native.js +34 -0
- package/dist/cjs/constants/isDevTools.native.js.map +1 -0
- package/dist/cjs/contexts/ComponentContext.cjs +37 -0
- package/dist/cjs/contexts/ComponentContext.native.js +42 -0
- package/dist/cjs/contexts/ComponentContext.native.js.map +1 -0
- package/dist/cjs/contexts/GroupContext.cjs +27 -0
- package/dist/cjs/contexts/GroupContext.native.js +30 -0
- package/dist/cjs/contexts/GroupContext.native.js.map +1 -0
- package/dist/cjs/createComponent.cjs +782 -0
- package/dist/cjs/createComponent.native.js +829 -0
- package/dist/cjs/createComponent.native.js.map +1 -0
- package/dist/cjs/createFont.cjs +42 -0
- package/dist/cjs/createFont.native.js +50 -0
- package/dist/cjs/createFont.native.js.map +1 -0
- package/dist/cjs/createGui.cjs +235 -0
- package/dist/cjs/createGui.native.js +297 -0
- package/dist/cjs/createGui.native.js.map +1 -0
- package/dist/cjs/createShorthands.cjs +28 -0
- package/dist/cjs/createShorthands.native.js +31 -0
- package/dist/cjs/createShorthands.native.js.map +1 -0
- package/dist/cjs/createTokens.cjs +29 -0
- package/dist/cjs/createTokens.native.js +33 -0
- package/dist/cjs/createTokens.native.js.map +1 -0
- package/dist/cjs/createVariable.cjs +96 -0
- package/dist/cjs/createVariable.native.js +116 -0
- package/dist/cjs/createVariable.native.js.map +1 -0
- package/dist/cjs/createVariables.cjs +68 -0
- package/dist/cjs/createVariables.native.js +77 -0
- package/dist/cjs/createVariables.native.js.map +1 -0
- package/dist/cjs/defaultComponentState.cjs +45 -0
- package/dist/cjs/defaultComponentState.native.js +48 -0
- package/dist/cjs/defaultComponentState.native.js.map +1 -0
- package/dist/cjs/eventHandling.cjs +46 -0
- package/dist/cjs/eventHandling.native.js +153 -0
- package/dist/cjs/eventHandling.native.js.map +1 -0
- package/dist/cjs/helpers/consoleLog.native.js +31 -0
- package/dist/cjs/helpers/consoleLog.native.js.map +1 -0
- package/dist/cjs/helpers/createDesignSystem.cjs +184 -0
- package/dist/cjs/helpers/createDesignSystem.native.js +235 -0
- package/dist/cjs/helpers/createDesignSystem.native.js.map +1 -0
- package/dist/cjs/helpers/createMediaStyle.cjs +100 -0
- package/dist/cjs/helpers/createMediaStyle.native.js +114 -0
- package/dist/cjs/helpers/createMediaStyle.native.js.map +1 -0
- package/dist/cjs/helpers/createStyledContext.cjs +82 -0
- package/dist/cjs/helpers/createStyledContext.native.js +93 -0
- package/dist/cjs/helpers/createStyledContext.native.js.map +1 -0
- package/dist/cjs/helpers/defaultAnimationDriver.cjs +42 -0
- package/dist/cjs/helpers/defaultAnimationDriver.native.js +59 -0
- package/dist/cjs/helpers/defaultAnimationDriver.native.js.map +1 -0
- package/dist/cjs/helpers/defaultOffset.cjs +29 -0
- package/dist/cjs/helpers/defaultOffset.native.js +32 -0
- package/dist/cjs/helpers/defaultOffset.native.js.map +1 -0
- package/dist/cjs/helpers/expandStyle.cjs +67 -0
- package/dist/cjs/helpers/expandStyle.native.js +162 -0
- package/dist/cjs/helpers/expandStyle.native.js.map +1 -0
- package/dist/cjs/helpers/expandStyles.cjs +40 -0
- package/dist/cjs/helpers/expandStyles.native.js +45 -0
- package/dist/cjs/helpers/expandStyles.native.js.map +1 -0
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +179 -0
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js +36 -0
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js.map +1 -0
- package/dist/cjs/helpers/getDefaultProps.cjs +38 -0
- package/dist/cjs/helpers/getDefaultProps.native.js +42 -0
- package/dist/cjs/helpers/getDefaultProps.native.js.map +1 -0
- package/dist/cjs/helpers/getDynamicVal.cjs +67 -0
- package/dist/cjs/helpers/getDynamicVal.native.js +71 -0
- package/dist/cjs/helpers/getDynamicVal.native.js.map +1 -0
- package/dist/cjs/helpers/getExpandedShorthands.cjs +38 -0
- package/dist/cjs/helpers/getExpandedShorthands.native.js +42 -0
- package/dist/cjs/helpers/getExpandedShorthands.native.js.map +1 -0
- package/dist/cjs/helpers/getFontLanguage.cjs +26 -0
- package/dist/cjs/helpers/getFontLanguage.native.js +31 -0
- package/dist/cjs/helpers/getFontLanguage.native.js.map +1 -0
- package/dist/cjs/helpers/getGroupPropParts.cjs +45 -0
- package/dist/cjs/helpers/getGroupPropParts.native.js +50 -0
- package/dist/cjs/helpers/getGroupPropParts.native.js.map +1 -0
- package/dist/cjs/helpers/getShorthandValue.cjs +28 -0
- package/dist/cjs/helpers/getShorthandValue.native.js +35 -0
- package/dist/cjs/helpers/getShorthandValue.native.js.map +1 -0
- package/dist/cjs/helpers/getSplitStyles.cjs +697 -0
- package/dist/cjs/helpers/getSplitStyles.native.js +810 -0
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -0
- package/dist/cjs/helpers/getThemeCSSRules.cjs +128 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js +31 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +1 -0
- package/dist/cjs/helpers/getTokenForKey.cjs +127 -0
- package/dist/cjs/helpers/getTokenForKey.native.js +145 -0
- package/dist/cjs/helpers/getTokenForKey.native.js.map +1 -0
- package/dist/cjs/helpers/getVariantExtras.cjs +69 -0
- package/dist/cjs/helpers/getVariantExtras.native.js +73 -0
- package/dist/cjs/helpers/getVariantExtras.native.js.map +1 -0
- package/dist/cjs/helpers/insertStyleRule.cjs +199 -0
- package/dist/cjs/helpers/insertStyleRule.native.js +315 -0
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -0
- package/dist/cjs/helpers/isActivePlatform.cjs +36 -0
- package/dist/cjs/helpers/isActivePlatform.native.js +39 -0
- package/dist/cjs/helpers/isActivePlatform.native.js.map +1 -0
- package/dist/cjs/helpers/isActiveTheme.cjs +28 -0
- package/dist/cjs/helpers/isActiveTheme.native.js +31 -0
- package/dist/cjs/helpers/isActiveTheme.native.js.map +1 -0
- package/dist/cjs/helpers/isGuiComponent.cjs +29 -0
- package/dist/cjs/helpers/isGuiComponent.native.js +32 -0
- package/dist/cjs/helpers/isGuiComponent.native.js.map +1 -0
- package/dist/cjs/helpers/isGuiElement.cjs +39 -0
- package/dist/cjs/helpers/isGuiElement.native.js +44 -0
- package/dist/cjs/helpers/isGuiElement.native.js.map +1 -0
- package/dist/cjs/helpers/isObj.cjs +26 -0
- package/dist/cjs/helpers/isObj.native.js +36 -0
- package/dist/cjs/helpers/isObj.native.js.map +1 -0
- package/dist/cjs/helpers/log.cjs +38 -0
- package/dist/cjs/helpers/log.native.js +42 -0
- package/dist/cjs/helpers/log.native.js.map +1 -0
- package/dist/cjs/helpers/mainThreadPressEvents.cjs +26 -0
- package/dist/cjs/helpers/mainThreadPressEvents.native.js +48 -0
- package/dist/cjs/helpers/mainThreadPressEvents.native.js.map +1 -0
- package/dist/cjs/helpers/matchMedia.cjs +36 -0
- package/dist/cjs/helpers/matchMedia.native.js +47 -0
- package/dist/cjs/helpers/matchMedia.native.js.map +1 -0
- package/dist/cjs/helpers/mediaObjectToString.cjs +35 -0
- package/dist/cjs/helpers/mediaObjectToString.native.js +43 -0
- package/dist/cjs/helpers/mediaObjectToString.native.js.map +1 -0
- package/dist/cjs/helpers/mediaState.cjs +45 -0
- package/dist/cjs/helpers/mediaState.native.js +50 -0
- package/dist/cjs/helpers/mediaState.native.js.map +1 -0
- package/dist/cjs/helpers/mergeProps.cjs +55 -0
- package/dist/cjs/helpers/mergeProps.native.js +62 -0
- package/dist/cjs/helpers/mergeProps.native.js.map +1 -0
- package/dist/cjs/helpers/mergeRenderElementProps.cjs +32 -0
- package/dist/cjs/helpers/mergeRenderElementProps.native.js +35 -0
- package/dist/cjs/helpers/mergeRenderElementProps.native.js.map +1 -0
- package/dist/cjs/helpers/mergeSlotStyleProps.cjs +39 -0
- package/dist/cjs/helpers/mergeSlotStyleProps.native.js +42 -0
- package/dist/cjs/helpers/mergeSlotStyleProps.native.js.map +1 -0
- package/dist/cjs/helpers/mergeVariants.cjs +40 -0
- package/dist/cjs/helpers/mergeVariants.native.js +44 -0
- package/dist/cjs/helpers/mergeVariants.native.js.map +1 -0
- package/dist/cjs/helpers/nativeOnlyProps.cjs +60 -0
- package/dist/cjs/helpers/nativeOnlyProps.native.js +63 -0
- package/dist/cjs/helpers/nativeOnlyProps.native.js.map +1 -0
- package/dist/cjs/helpers/normalizeColor.cjs +35 -0
- package/dist/cjs/helpers/normalizeColor.native.js +50 -0
- package/dist/cjs/helpers/normalizeColor.native.js.map +1 -0
- package/dist/cjs/helpers/normalizeShadow.cjs +48 -0
- package/dist/cjs/helpers/normalizeShadow.native.js +52 -0
- package/dist/cjs/helpers/normalizeShadow.native.js.map +1 -0
- package/dist/cjs/helpers/normalizeStyle.cjs +47 -0
- package/dist/cjs/helpers/normalizeStyle.native.js +52 -0
- package/dist/cjs/helpers/normalizeStyle.native.js.map +1 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.cjs +26 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js +40 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js.map +1 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.cjs +38 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +47 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -0
- package/dist/cjs/helpers/objectIdentityKey.cjs +39 -0
- package/dist/cjs/helpers/objectIdentityKey.native.js +47 -0
- package/dist/cjs/helpers/objectIdentityKey.native.js.map +1 -0
- package/dist/cjs/helpers/parseBorderShorthand.cjs +26 -0
- package/dist/cjs/helpers/parseBorderShorthand.native.js +58 -0
- package/dist/cjs/helpers/parseBorderShorthand.native.js.map +1 -0
- package/dist/cjs/helpers/parseNativeStyle.cjs +133 -0
- package/dist/cjs/helpers/parseNativeStyle.native.js +151 -0
- package/dist/cjs/helpers/parseNativeStyle.native.js.map +1 -0
- package/dist/cjs/helpers/parseOutlineShorthand.cjs +26 -0
- package/dist/cjs/helpers/parseOutlineShorthand.native.js +58 -0
- package/dist/cjs/helpers/parseOutlineShorthand.native.js.map +1 -0
- package/dist/cjs/helpers/platformResolveValue.cjs +33 -0
- package/dist/cjs/helpers/platformResolveValue.native.js +62 -0
- package/dist/cjs/helpers/platformResolveValue.native.js.map +1 -0
- package/dist/cjs/helpers/pointerEvents.cjs +26 -0
- package/dist/cjs/helpers/pointerEvents.native.js +120 -0
- package/dist/cjs/helpers/pointerEvents.native.js.map +1 -0
- package/dist/cjs/helpers/propMapper.cjs +203 -0
- package/dist/cjs/helpers/propMapper.native.js +295 -0
- package/dist/cjs/helpers/propMapper.native.js.map +1 -0
- package/dist/cjs/helpers/proxyThemeToParents.cjs +49 -0
- package/dist/cjs/helpers/proxyThemeToParents.native.js +132 -0
- package/dist/cjs/helpers/proxyThemeToParents.native.js.map +1 -0
- package/dist/cjs/helpers/proxyThemeVariables.cjs +36 -0
- package/dist/cjs/helpers/proxyThemeVariables.native.js +41 -0
- package/dist/cjs/helpers/proxyThemeVariables.native.js.map +1 -0
- package/dist/cjs/helpers/pseudoDescriptors.cjs +80 -0
- package/dist/cjs/helpers/pseudoDescriptors.native.js +83 -0
- package/dist/cjs/helpers/pseudoDescriptors.native.js.map +1 -0
- package/dist/cjs/helpers/pseudoTransitions.cjs +65 -0
- package/dist/cjs/helpers/pseudoTransitions.native.js +72 -0
- package/dist/cjs/helpers/pseudoTransitions.native.js.map +1 -0
- package/dist/cjs/helpers/registerCSSVariable.cjs +64 -0
- package/dist/cjs/helpers/registerCSSVariable.native.js +70 -0
- package/dist/cjs/helpers/registerCSSVariable.native.js.map +1 -0
- package/dist/cjs/helpers/resolveAnimationDriver.cjs +28 -0
- package/dist/cjs/helpers/resolveAnimationDriver.native.js +32 -0
- package/dist/cjs/helpers/resolveAnimationDriver.native.js.map +1 -0
- package/dist/cjs/helpers/resolveCompoundTokens.cjs +37 -0
- package/dist/cjs/helpers/resolveCompoundTokens.native.js +40 -0
- package/dist/cjs/helpers/resolveCompoundTokens.native.js.map +1 -0
- package/dist/cjs/helpers/resolveRem.cjs +32 -0
- package/dist/cjs/helpers/resolveRem.native.js +50 -0
- package/dist/cjs/helpers/resolveRem.native.js.map +1 -0
- package/dist/cjs/helpers/resolveSafeArea.cjs +34 -0
- package/dist/cjs/helpers/resolveSafeArea.native.js +42 -0
- package/dist/cjs/helpers/resolveSafeArea.native.js.map +1 -0
- package/dist/cjs/helpers/setElementProps.cjs +29 -0
- package/dist/cjs/helpers/setElementProps.native.js +33 -0
- package/dist/cjs/helpers/setElementProps.native.js.map +1 -0
- package/dist/cjs/helpers/skipProps.cjs +45 -0
- package/dist/cjs/helpers/skipProps.native.js +48 -0
- package/dist/cjs/helpers/skipProps.native.js.map +1 -0
- package/dist/cjs/helpers/sortString.cjs +26 -0
- package/dist/cjs/helpers/sortString.native.js +31 -0
- package/dist/cjs/helpers/sortString.native.js.map +1 -0
- package/dist/cjs/helpers/subscribeToContextGroup.cjs +81 -0
- package/dist/cjs/helpers/subscribeToContextGroup.native.js +131 -0
- package/dist/cjs/helpers/subscribeToContextGroup.native.js.map +1 -0
- package/dist/cjs/helpers/themeable.cjs +87 -0
- package/dist/cjs/helpers/themeable.native.js +93 -0
- package/dist/cjs/helpers/themeable.native.js.map +1 -0
- package/dist/cjs/helpers/themes.cjs +38 -0
- package/dist/cjs/helpers/themes.native.js +41 -0
- package/dist/cjs/helpers/themes.native.js.map +1 -0
- package/dist/cjs/helpers/timer.cjs +32 -0
- package/dist/cjs/helpers/timer.native.js +35 -0
- package/dist/cjs/helpers/timer.native.js.map +1 -0
- package/dist/cjs/helpers/transformsToString.cjs +38 -0
- package/dist/cjs/helpers/transformsToString.native.js +41 -0
- package/dist/cjs/helpers/transformsToString.native.js.map +1 -0
- package/dist/cjs/helpers/useRenderElement.cjs +48 -0
- package/dist/cjs/helpers/useRenderElement.native.js +52 -0
- package/dist/cjs/helpers/useRenderElement.native.js.map +1 -0
- package/dist/cjs/helpers/webPropsToSkip.cjs +26 -0
- package/dist/cjs/helpers/webPropsToSkip.native.js +76 -0
- package/dist/cjs/helpers/webPropsToSkip.native.js.map +1 -0
- package/dist/cjs/helpers/wrapStyleTags.cjs +41 -0
- package/dist/cjs/helpers/wrapStyleTags.native.js +31 -0
- package/dist/cjs/helpers/wrapStyleTags.native.js.map +1 -0
- package/dist/cjs/hooks/doesRootSchemeMatchSystem.cjs +28 -0
- package/dist/cjs/hooks/doesRootSchemeMatchSystem.native.js +34 -0
- package/dist/cjs/hooks/doesRootSchemeMatchSystem.native.js.map +1 -0
- package/dist/cjs/hooks/getThemeProxied.cjs +60 -0
- package/dist/cjs/hooks/getThemeProxied.native.js +93 -0
- package/dist/cjs/hooks/getThemeProxied.native.js.map +1 -0
- package/dist/cjs/hooks/useComponentState.cjs +144 -0
- package/dist/cjs/hooks/useComponentState.native.js +165 -0
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -0
- package/dist/cjs/hooks/useDisableSSR.cjs +29 -0
- package/dist/cjs/hooks/useDisableSSR.native.js +33 -0
- package/dist/cjs/hooks/useDisableSSR.native.js.map +1 -0
- package/dist/cjs/hooks/useIsTouchDevice.cjs +28 -0
- package/dist/cjs/hooks/useIsTouchDevice.native.js +33 -0
- package/dist/cjs/hooks/useIsTouchDevice.native.js.map +1 -0
- package/dist/cjs/hooks/useMedia.cjs +180 -0
- package/dist/cjs/hooks/useMedia.native.js +215 -0
- package/dist/cjs/hooks/useMedia.native.js.map +1 -0
- package/dist/cjs/hooks/useProps.cjs +114 -0
- package/dist/cjs/hooks/useProps.native.js +119 -0
- package/dist/cjs/hooks/useProps.native.js.map +1 -0
- package/dist/cjs/hooks/useTheme.cjs +46 -0
- package/dist/cjs/hooks/useTheme.native.js +53 -0
- package/dist/cjs/hooks/useTheme.native.js.map +1 -0
- package/dist/cjs/hooks/useThemeName.cjs +37 -0
- package/dist/cjs/hooks/useThemeName.native.js +43 -0
- package/dist/cjs/hooks/useThemeName.native.js.map +1 -0
- package/dist/cjs/hooks/useThemeState.cjs +274 -0
- package/dist/cjs/hooks/useThemeState.native.js +387 -0
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -0
- package/dist/cjs/index.cjs +120 -0
- package/dist/cjs/index.native.js +123 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/inject-styles.cjs +37 -0
- package/dist/cjs/inject-styles.native.js +41 -0
- package/dist/cjs/inject-styles.native.js.map +1 -0
- package/dist/cjs/insertFont.cjs +75 -0
- package/dist/cjs/insertFont.native.js +76 -0
- package/dist/cjs/insertFont.native.js.map +1 -0
- package/dist/cjs/interfaces/CSSColorNames.cjs +16 -0
- package/dist/cjs/interfaces/CSSColorNames.native.js +19 -0
- package/dist/cjs/interfaces/CSSColorNames.native.js.map +1 -0
- package/dist/cjs/interfaces/GetRef.cjs +16 -0
- package/dist/cjs/interfaces/GetRef.native.js +19 -0
- package/dist/cjs/interfaces/GetRef.native.js.map +1 -0
- package/dist/cjs/interfaces/GuiComponentEvents.cjs +16 -0
- package/dist/cjs/interfaces/GuiComponentEvents.native.js +19 -0
- package/dist/cjs/interfaces/GuiComponentEvents.native.js.map +1 -0
- package/dist/cjs/interfaces/GuiComponentPropsBaseBase.cjs +16 -0
- package/dist/cjs/interfaces/GuiComponentPropsBaseBase.native.js +19 -0
- package/dist/cjs/interfaces/GuiComponentPropsBaseBase.native.js.map +1 -0
- package/dist/cjs/interfaces/RNExclusiveTypes.cjs +16 -0
- package/dist/cjs/interfaces/RNExclusiveTypes.native.js +19 -0
- package/dist/cjs/interfaces/RNExclusiveTypes.native.js.map +1 -0
- package/dist/cjs/setupHooks.cjs +30 -0
- package/dist/cjs/setupHooks.native.js +33 -0
- package/dist/cjs/setupHooks.native.js.map +1 -0
- package/dist/cjs/setupReactNative.cjs +47 -0
- package/dist/cjs/setupReactNative.native.js +54 -0
- package/dist/cjs/setupReactNative.native.js.map +1 -0
- package/dist/cjs/styled.cjs +115 -0
- package/dist/cjs/styled.native.js +127 -0
- package/dist/cjs/styled.native.js.map +1 -0
- package/dist/cjs/styledHtml.test-d.cjs +156 -0
- package/dist/cjs/styledHtml.test-d.native.js +159 -0
- package/dist/cjs/styledHtml.test-d.native.js.map +1 -0
- package/dist/cjs/type-utils.cjs +16 -0
- package/dist/cjs/type-utils.native.js +19 -0
- package/dist/cjs/type-utils.native.js.map +1 -0
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/types.native.js +19 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/views/Configuration.cjs +50 -0
- package/dist/cjs/views/Configuration.native.js +54 -0
- package/dist/cjs/views/Configuration.native.js.map +1 -0
- package/dist/cjs/views/FontLanguage.cjs +37 -0
- package/dist/cjs/views/FontLanguage.native.js +57 -0
- package/dist/cjs/views/FontLanguage.native.js.map +1 -0
- package/dist/cjs/views/GuiProvider.cjs +94 -0
- package/dist/cjs/views/GuiProvider.native.js +100 -0
- package/dist/cjs/views/GuiProvider.native.js.map +1 -0
- package/dist/cjs/views/GuiRoot.cjs +68 -0
- package/dist/cjs/views/GuiRoot.native.js +31 -0
- package/dist/cjs/views/GuiRoot.native.js.map +1 -0
- package/dist/cjs/views/Slot.cjs +64 -0
- package/dist/cjs/views/Slot.native.js +70 -0
- package/dist/cjs/views/Slot.native.js.map +1 -0
- package/dist/cjs/views/Text.cjs +58 -0
- package/dist/cjs/views/Text.native.js +52 -0
- package/dist/cjs/views/Text.native.js.map +1 -0
- package/dist/cjs/views/Theme.cjs +162 -0
- package/dist/cjs/views/Theme.native.js +174 -0
- package/dist/cjs/views/Theme.native.js.map +1 -0
- package/dist/cjs/views/ThemeDebug.cjs +77 -0
- package/dist/cjs/views/ThemeDebug.native.js +37 -0
- package/dist/cjs/views/ThemeDebug.native.js.map +1 -0
- package/dist/cjs/views/ThemeProvider.cjs +52 -0
- package/dist/cjs/views/ThemeProvider.native.js +48 -0
- package/dist/cjs/views/ThemeProvider.native.js.map +1 -0
- package/dist/cjs/views/View.cjs +31 -0
- package/dist/cjs/views/View.native.js +34 -0
- package/dist/cjs/views/View.native.js.map +1 -0
- package/dist/esm/Gui.mjs +36 -0
- package/dist/esm/Gui.mjs.map +1 -0
- package/dist/esm/Gui.native.js +73 -0
- package/dist/esm/Gui.native.js.map +1 -0
- package/dist/esm/_withStableStyle.mjs +31 -0
- package/dist/esm/_withStableStyle.mjs.map +1 -0
- package/dist/esm/_withStableStyle.native.js +40 -0
- package/dist/esm/_withStableStyle.native.js.map +1 -0
- package/dist/esm/animationDriverTypes.test-d.mjs +61 -0
- package/dist/esm/animationDriverTypes.test-d.mjs.map +1 -0
- package/dist/esm/animationDriverTypes.test-d.native.js +61 -0
- package/dist/esm/animationDriverTypes.test-d.native.js.map +1 -0
- package/dist/esm/config.mjs +87 -0
- package/dist/esm/config.mjs.map +1 -0
- package/dist/esm/config.native.js +115 -0
- package/dist/esm/config.native.js.map +1 -0
- package/dist/esm/constants/accessibilityDirectMap.mjs +7 -0
- package/dist/esm/constants/accessibilityDirectMap.mjs.map +1 -0
- package/dist/esm/constants/accessibilityDirectMap.native.js +7 -0
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +1 -0
- package/dist/esm/constants/constants.mjs +12 -0
- package/dist/esm/constants/constants.mjs.map +1 -0
- package/dist/esm/constants/constants.native.js +12 -0
- package/dist/esm/constants/constants.native.js.map +1 -0
- package/dist/esm/constants/isDevTools.mjs +8 -0
- package/dist/esm/constants/isDevTools.mjs.map +1 -0
- package/dist/esm/constants/isDevTools.native.js +8 -0
- package/dist/esm/constants/isDevTools.native.js.map +1 -0
- package/dist/esm/contexts/ComponentContext.mjs +13 -0
- package/dist/esm/contexts/ComponentContext.mjs.map +1 -0
- package/dist/esm/contexts/ComponentContext.native.js +15 -0
- package/dist/esm/contexts/ComponentContext.native.js.map +1 -0
- package/dist/esm/contexts/GroupContext.mjs +4 -0
- package/dist/esm/contexts/GroupContext.mjs.map +1 -0
- package/dist/esm/contexts/GroupContext.native.js +4 -0
- package/dist/esm/contexts/GroupContext.native.js.map +1 -0
- package/dist/esm/createComponent.mjs +746 -0
- package/dist/esm/createComponent.mjs.map +1 -0
- package/dist/esm/createComponent.native.js +790 -0
- package/dist/esm/createComponent.native.js.map +1 -0
- package/dist/esm/createFont.mjs +19 -0
- package/dist/esm/createFont.mjs.map +1 -0
- package/dist/esm/createFont.native.js +24 -0
- package/dist/esm/createFont.native.js.map +1 -0
- package/dist/esm/createGui.mjs +212 -0
- package/dist/esm/createGui.mjs.map +1 -0
- package/dist/esm/createGui.native.js +271 -0
- package/dist/esm/createGui.native.js.map +1 -0
- package/dist/esm/createShorthands.mjs +5 -0
- package/dist/esm/createShorthands.mjs.map +1 -0
- package/dist/esm/createShorthands.native.js +5 -0
- package/dist/esm/createShorthands.native.js.map +1 -0
- package/dist/esm/createTokens.mjs +6 -0
- package/dist/esm/createTokens.mjs.map +1 -0
- package/dist/esm/createTokens.native.js +7 -0
- package/dist/esm/createTokens.native.js.map +1 -0
- package/dist/esm/createVariable.mjs +63 -0
- package/dist/esm/createVariable.mjs.map +1 -0
- package/dist/esm/createVariable.native.js +80 -0
- package/dist/esm/createVariable.native.js.map +1 -0
- package/dist/esm/createVariables.mjs +45 -0
- package/dist/esm/createVariables.mjs.map +1 -0
- package/dist/esm/createVariables.native.js +51 -0
- package/dist/esm/createVariables.native.js.map +1 -0
- package/dist/esm/defaultComponentState.mjs +20 -0
- package/dist/esm/defaultComponentState.mjs.map +1 -0
- package/dist/esm/defaultComponentState.native.js +20 -0
- package/dist/esm/defaultComponentState.native.js.map +1 -0
- package/dist/esm/eventHandling.mjs +21 -0
- package/dist/esm/eventHandling.mjs.map +1 -0
- package/dist/esm/eventHandling.native.js +114 -0
- package/dist/esm/eventHandling.native.js.map +1 -0
- package/dist/esm/helpers/consoleLog.native.js +4 -0
- package/dist/esm/helpers/consoleLog.native.js.map +1 -0
- package/dist/esm/helpers/createDesignSystem.mjs +156 -0
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -0
- package/dist/esm/helpers/createDesignSystem.native.js +203 -0
- package/dist/esm/helpers/createDesignSystem.native.js.map +1 -0
- package/dist/esm/helpers/createMediaStyle.mjs +75 -0
- package/dist/esm/helpers/createMediaStyle.mjs.map +1 -0
- package/dist/esm/helpers/createMediaStyle.native.js +86 -0
- package/dist/esm/helpers/createMediaStyle.native.js.map +1 -0
- package/dist/esm/helpers/createStyledContext.mjs +48 -0
- package/dist/esm/helpers/createStyledContext.mjs.map +1 -0
- package/dist/esm/helpers/createStyledContext.native.js +56 -0
- package/dist/esm/helpers/createStyledContext.native.js.map +1 -0
- package/dist/esm/helpers/defaultAnimationDriver.mjs +19 -0
- package/dist/esm/helpers/defaultAnimationDriver.mjs.map +1 -0
- package/dist/esm/helpers/defaultAnimationDriver.native.js +33 -0
- package/dist/esm/helpers/defaultAnimationDriver.native.js.map +1 -0
- package/dist/esm/helpers/defaultOffset.mjs +6 -0
- package/dist/esm/helpers/defaultOffset.mjs.map +1 -0
- package/dist/esm/helpers/defaultOffset.native.js +6 -0
- package/dist/esm/helpers/defaultOffset.native.js.map +1 -0
- package/dist/esm/helpers/expandStyle.mjs +42 -0
- package/dist/esm/helpers/expandStyle.mjs.map +1 -0
- package/dist/esm/helpers/expandStyle.native.js +135 -0
- package/dist/esm/helpers/expandStyle.native.js.map +1 -0
- package/dist/esm/helpers/expandStyles.mjs +17 -0
- package/dist/esm/helpers/expandStyles.mjs.map +1 -0
- package/dist/esm/helpers/expandStyles.native.js +19 -0
- package/dist/esm/helpers/expandStyles.native.js.map +1 -0
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +154 -0
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -0
- package/dist/esm/helpers/getCSSStylesAtomic.native.js +8 -0
- package/dist/esm/helpers/getCSSStylesAtomic.native.js.map +1 -0
- package/dist/esm/helpers/getDefaultProps.mjs +15 -0
- package/dist/esm/helpers/getDefaultProps.mjs.map +1 -0
- package/dist/esm/helpers/getDefaultProps.native.js +16 -0
- package/dist/esm/helpers/getDefaultProps.native.js.map +1 -0
- package/dist/esm/helpers/getDynamicVal.mjs +41 -0
- package/dist/esm/helpers/getDynamicVal.mjs.map +1 -0
- package/dist/esm/helpers/getDynamicVal.native.js +42 -0
- package/dist/esm/helpers/getDynamicVal.native.js.map +1 -0
- package/dist/esm/helpers/getExpandedShorthands.mjs +14 -0
- package/dist/esm/helpers/getExpandedShorthands.mjs.map +1 -0
- package/dist/esm/helpers/getExpandedShorthands.native.js +15 -0
- package/dist/esm/helpers/getExpandedShorthands.native.js.map +1 -0
- package/dist/esm/helpers/getFontLanguage.mjs +3 -0
- package/dist/esm/helpers/getFontLanguage.mjs.map +1 -0
- package/dist/esm/helpers/getFontLanguage.native.js +5 -0
- package/dist/esm/helpers/getFontLanguage.native.js.map +1 -0
- package/dist/esm/helpers/getGroupPropParts.mjs +22 -0
- package/dist/esm/helpers/getGroupPropParts.mjs.map +1 -0
- package/dist/esm/helpers/getGroupPropParts.native.js +24 -0
- package/dist/esm/helpers/getGroupPropParts.native.js.map +1 -0
- package/dist/esm/helpers/getShorthandValue.mjs +5 -0
- package/dist/esm/helpers/getShorthandValue.mjs.map +1 -0
- package/dist/esm/helpers/getShorthandValue.native.js +9 -0
- package/dist/esm/helpers/getShorthandValue.native.js.map +1 -0
- package/dist/esm/helpers/getSplitStyles.mjs +658 -0
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -0
- package/dist/esm/helpers/getSplitStyles.native.js +768 -0
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -0
- package/dist/esm/helpers/getThemeCSSRules.mjs +105 -0
- package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js +5 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +1 -0
- package/dist/esm/helpers/getTokenForKey.mjs +101 -0
- package/dist/esm/helpers/getTokenForKey.mjs.map +1 -0
- package/dist/esm/helpers/getTokenForKey.native.js +116 -0
- package/dist/esm/helpers/getTokenForKey.native.js.map +1 -0
- package/dist/esm/helpers/getVariantExtras.mjs +45 -0
- package/dist/esm/helpers/getVariantExtras.mjs.map +1 -0
- package/dist/esm/helpers/getVariantExtras.native.js +46 -0
- package/dist/esm/helpers/getVariantExtras.native.js.map +1 -0
- package/dist/esm/helpers/insertStyleRule.mjs +169 -0
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -0
- package/dist/esm/helpers/insertStyleRule.native.js +282 -0
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -0
- package/dist/esm/helpers/isActivePlatform.mjs +13 -0
- package/dist/esm/helpers/isActivePlatform.mjs.map +1 -0
- package/dist/esm/helpers/isActivePlatform.native.js +13 -0
- package/dist/esm/helpers/isActivePlatform.native.js.map +1 -0
- package/dist/esm/helpers/isActiveTheme.mjs +5 -0
- package/dist/esm/helpers/isActiveTheme.mjs.map +1 -0
- package/dist/esm/helpers/isActiveTheme.native.js +5 -0
- package/dist/esm/helpers/isActiveTheme.native.js.map +1 -0
- package/dist/esm/helpers/isGuiComponent.mjs +6 -0
- package/dist/esm/helpers/isGuiComponent.mjs.map +1 -0
- package/dist/esm/helpers/isGuiComponent.native.js +6 -0
- package/dist/esm/helpers/isGuiComponent.native.js.map +1 -0
- package/dist/esm/helpers/isGuiElement.mjs +5 -0
- package/dist/esm/helpers/isGuiElement.mjs.map +1 -0
- package/dist/esm/helpers/isGuiElement.native.js +7 -0
- package/dist/esm/helpers/isGuiElement.native.js.map +1 -0
- package/dist/esm/helpers/isObj.mjs +3 -0
- package/dist/esm/helpers/isObj.mjs.map +1 -0
- package/dist/esm/helpers/isObj.native.js +10 -0
- package/dist/esm/helpers/isObj.native.js.map +1 -0
- package/dist/esm/helpers/log.mjs +15 -0
- package/dist/esm/helpers/log.mjs.map +1 -0
- package/dist/esm/helpers/log.native.js +16 -0
- package/dist/esm/helpers/log.native.js.map +1 -0
- package/dist/esm/helpers/mainThreadPressEvents.mjs +3 -0
- package/dist/esm/helpers/mainThreadPressEvents.mjs.map +1 -0
- package/dist/esm/helpers/mainThreadPressEvents.native.js +22 -0
- package/dist/esm/helpers/mainThreadPressEvents.native.js.map +1 -0
- package/dist/esm/helpers/matchMedia.mjs +12 -0
- package/dist/esm/helpers/matchMedia.mjs.map +1 -0
- package/dist/esm/helpers/matchMedia.native.js +20 -0
- package/dist/esm/helpers/matchMedia.native.js.map +1 -0
- package/dist/esm/helpers/mediaObjectToString.mjs +12 -0
- package/dist/esm/helpers/mediaObjectToString.mjs.map +1 -0
- package/dist/esm/helpers/mediaObjectToString.native.js +17 -0
- package/dist/esm/helpers/mediaObjectToString.native.js.map +1 -0
- package/dist/esm/helpers/mediaState.mjs +18 -0
- package/dist/esm/helpers/mediaState.mjs.map +1 -0
- package/dist/esm/helpers/mediaState.native.js +20 -0
- package/dist/esm/helpers/mediaState.native.js.map +1 -0
- package/dist/esm/helpers/mergeProps.mjs +31 -0
- package/dist/esm/helpers/mergeProps.mjs.map +1 -0
- package/dist/esm/helpers/mergeProps.native.js +35 -0
- package/dist/esm/helpers/mergeProps.native.js.map +1 -0
- package/dist/esm/helpers/mergeRenderElementProps.mjs +9 -0
- package/dist/esm/helpers/mergeRenderElementProps.mjs.map +1 -0
- package/dist/esm/helpers/mergeRenderElementProps.native.js +9 -0
- package/dist/esm/helpers/mergeRenderElementProps.native.js.map +1 -0
- package/dist/esm/helpers/mergeSlotStyleProps.mjs +16 -0
- package/dist/esm/helpers/mergeSlotStyleProps.mjs.map +1 -0
- package/dist/esm/helpers/mergeSlotStyleProps.native.js +16 -0
- package/dist/esm/helpers/mergeSlotStyleProps.native.js.map +1 -0
- package/dist/esm/helpers/mergeVariants.mjs +17 -0
- package/dist/esm/helpers/mergeVariants.mjs.map +1 -0
- package/dist/esm/helpers/mergeVariants.native.js +18 -0
- package/dist/esm/helpers/mergeVariants.native.js.map +1 -0
- package/dist/esm/helpers/nativeOnlyProps.mjs +37 -0
- package/dist/esm/helpers/nativeOnlyProps.mjs.map +1 -0
- package/dist/esm/helpers/nativeOnlyProps.native.js +37 -0
- package/dist/esm/helpers/nativeOnlyProps.native.js.map +1 -0
- package/dist/esm/helpers/normalizeColor.mjs +11 -0
- package/dist/esm/helpers/normalizeColor.mjs.map +1 -0
- package/dist/esm/helpers/normalizeColor.native.js +22 -0
- package/dist/esm/helpers/normalizeColor.native.js.map +1 -0
- package/dist/esm/helpers/normalizeShadow.mjs +25 -0
- package/dist/esm/helpers/normalizeShadow.mjs.map +1 -0
- package/dist/esm/helpers/normalizeShadow.native.js +26 -0
- package/dist/esm/helpers/normalizeShadow.native.js.map +1 -0
- package/dist/esm/helpers/normalizeStyle.mjs +24 -0
- package/dist/esm/helpers/normalizeStyle.mjs.map +1 -0
- package/dist/esm/helpers/normalizeStyle.native.js +26 -0
- package/dist/esm/helpers/normalizeStyle.native.js.map +1 -0
- package/dist/esm/helpers/normalizeStylePropKeys.mjs +3 -0
- package/dist/esm/helpers/normalizeStylePropKeys.mjs.map +1 -0
- package/dist/esm/helpers/normalizeStylePropKeys.native.js +14 -0
- package/dist/esm/helpers/normalizeStylePropKeys.native.js.map +1 -0
- package/dist/esm/helpers/normalizeValueWithProperty.mjs +15 -0
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -0
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +21 -0
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -0
- package/dist/esm/helpers/objectIdentityKey.mjs +16 -0
- package/dist/esm/helpers/objectIdentityKey.mjs.map +1 -0
- package/dist/esm/helpers/objectIdentityKey.native.js +21 -0
- package/dist/esm/helpers/objectIdentityKey.native.js.map +1 -0
- package/dist/esm/helpers/parseBorderShorthand.mjs +3 -0
- package/dist/esm/helpers/parseBorderShorthand.mjs.map +1 -0
- package/dist/esm/helpers/parseBorderShorthand.native.js +32 -0
- package/dist/esm/helpers/parseBorderShorthand.native.js.map +1 -0
- package/dist/esm/helpers/parseNativeStyle.mjs +110 -0
- package/dist/esm/helpers/parseNativeStyle.mjs.map +1 -0
- package/dist/esm/helpers/parseNativeStyle.native.js +125 -0
- package/dist/esm/helpers/parseNativeStyle.native.js.map +1 -0
- package/dist/esm/helpers/parseOutlineShorthand.mjs +3 -0
- package/dist/esm/helpers/parseOutlineShorthand.mjs.map +1 -0
- package/dist/esm/helpers/parseOutlineShorthand.native.js +32 -0
- package/dist/esm/helpers/parseOutlineShorthand.native.js.map +1 -0
- package/dist/esm/helpers/platformResolveValue.mjs +10 -0
- package/dist/esm/helpers/platformResolveValue.mjs.map +1 -0
- package/dist/esm/helpers/platformResolveValue.native.js +36 -0
- package/dist/esm/helpers/platformResolveValue.native.js.map +1 -0
- package/dist/esm/helpers/pointerEvents.mjs +3 -0
- package/dist/esm/helpers/pointerEvents.mjs.map +1 -0
- package/dist/esm/helpers/pointerEvents.native.js +94 -0
- package/dist/esm/helpers/pointerEvents.native.js.map +1 -0
- package/dist/esm/helpers/propMapper.mjs +176 -0
- package/dist/esm/helpers/propMapper.mjs.map +1 -0
- package/dist/esm/helpers/propMapper.native.js +267 -0
- package/dist/esm/helpers/propMapper.native.js.map +1 -0
- package/dist/esm/helpers/proxyThemeToParents.mjs +25 -0
- package/dist/esm/helpers/proxyThemeToParents.mjs.map +1 -0
- package/dist/esm/helpers/proxyThemeToParents.native.js +105 -0
- package/dist/esm/helpers/proxyThemeToParents.native.js.map +1 -0
- package/dist/esm/helpers/proxyThemeVariables.mjs +13 -0
- package/dist/esm/helpers/proxyThemeVariables.mjs.map +1 -0
- package/dist/esm/helpers/proxyThemeVariables.native.js +15 -0
- package/dist/esm/helpers/proxyThemeVariables.native.js.map +1 -0
- package/dist/esm/helpers/pseudoDescriptors.mjs +54 -0
- package/dist/esm/helpers/pseudoDescriptors.mjs.map +1 -0
- package/dist/esm/helpers/pseudoDescriptors.native.js +54 -0
- package/dist/esm/helpers/pseudoDescriptors.native.js.map +1 -0
- package/dist/esm/helpers/pseudoTransitions.mjs +41 -0
- package/dist/esm/helpers/pseudoTransitions.mjs.map +1 -0
- package/dist/esm/helpers/pseudoTransitions.native.js +45 -0
- package/dist/esm/helpers/pseudoTransitions.native.js.map +1 -0
- package/dist/esm/helpers/registerCSSVariable.mjs +35 -0
- package/dist/esm/helpers/registerCSSVariable.mjs.map +1 -0
- package/dist/esm/helpers/registerCSSVariable.native.js +38 -0
- package/dist/esm/helpers/registerCSSVariable.native.js.map +1 -0
- package/dist/esm/helpers/resolveAnimationDriver.mjs +5 -0
- package/dist/esm/helpers/resolveAnimationDriver.mjs.map +1 -0
- package/dist/esm/helpers/resolveAnimationDriver.native.js +6 -0
- package/dist/esm/helpers/resolveAnimationDriver.native.js.map +1 -0
- package/dist/esm/helpers/resolveCompoundTokens.mjs +14 -0
- package/dist/esm/helpers/resolveCompoundTokens.mjs.map +1 -0
- package/dist/esm/helpers/resolveCompoundTokens.native.js +14 -0
- package/dist/esm/helpers/resolveCompoundTokens.native.js.map +1 -0
- package/dist/esm/helpers/resolveRem.mjs +8 -0
- package/dist/esm/helpers/resolveRem.mjs.map +1 -0
- package/dist/esm/helpers/resolveRem.native.js +23 -0
- package/dist/esm/helpers/resolveRem.native.js.map +1 -0
- package/dist/esm/helpers/resolveSafeArea.mjs +11 -0
- package/dist/esm/helpers/resolveSafeArea.mjs.map +1 -0
- package/dist/esm/helpers/resolveSafeArea.native.js +16 -0
- package/dist/esm/helpers/resolveSafeArea.native.js.map +1 -0
- package/dist/esm/helpers/setElementProps.mjs +6 -0
- package/dist/esm/helpers/setElementProps.mjs.map +1 -0
- package/dist/esm/helpers/setElementProps.native.js +7 -0
- package/dist/esm/helpers/setElementProps.native.js.map +1 -0
- package/dist/esm/helpers/skipProps.mjs +21 -0
- package/dist/esm/helpers/skipProps.mjs.map +1 -0
- package/dist/esm/helpers/skipProps.native.js +21 -0
- package/dist/esm/helpers/skipProps.native.js.map +1 -0
- package/dist/esm/helpers/sortString.mjs +3 -0
- package/dist/esm/helpers/sortString.mjs.map +1 -0
- package/dist/esm/helpers/sortString.native.js +5 -0
- package/dist/esm/helpers/sortString.native.js.map +1 -0
- package/dist/esm/helpers/subscribeToContextGroup.mjs +58 -0
- package/dist/esm/helpers/subscribeToContextGroup.mjs.map +1 -0
- package/dist/esm/helpers/subscribeToContextGroup.native.js +105 -0
- package/dist/esm/helpers/subscribeToContextGroup.native.js.map +1 -0
- package/dist/esm/helpers/themeable.mjs +54 -0
- package/dist/esm/helpers/themeable.mjs.map +1 -0
- package/dist/esm/helpers/themeable.native.js +56 -0
- package/dist/esm/helpers/themeable.native.js.map +1 -0
- package/dist/esm/helpers/themes.mjs +15 -0
- package/dist/esm/helpers/themes.mjs.map +1 -0
- package/dist/esm/helpers/themes.native.js +15 -0
- package/dist/esm/helpers/themes.native.js.map +1 -0
- package/dist/esm/helpers/timer.mjs +9 -0
- package/dist/esm/helpers/timer.mjs.map +1 -0
- package/dist/esm/helpers/timer.native.js +9 -0
- package/dist/esm/helpers/timer.native.js.map +1 -0
- package/dist/esm/helpers/transformsToString.mjs +15 -0
- package/dist/esm/helpers/transformsToString.mjs.map +1 -0
- package/dist/esm/helpers/transformsToString.native.js +15 -0
- package/dist/esm/helpers/transformsToString.native.js.map +1 -0
- package/dist/esm/helpers/useRenderElement.mjs +25 -0
- package/dist/esm/helpers/useRenderElement.mjs.map +1 -0
- package/dist/esm/helpers/useRenderElement.native.js +26 -0
- package/dist/esm/helpers/useRenderElement.native.js.map +1 -0
- package/dist/esm/helpers/webPropsToSkip.mjs +3 -0
- package/dist/esm/helpers/webPropsToSkip.mjs.map +1 -0
- package/dist/esm/helpers/webPropsToSkip.native.js +50 -0
- package/dist/esm/helpers/webPropsToSkip.native.js.map +1 -0
- package/dist/esm/helpers/wrapStyleTags.mjs +18 -0
- package/dist/esm/helpers/wrapStyleTags.mjs.map +1 -0
- package/dist/esm/helpers/wrapStyleTags.native.js +3 -0
- package/dist/esm/helpers/wrapStyleTags.native.js.map +1 -0
- package/dist/esm/hooks/doesRootSchemeMatchSystem.mjs +5 -0
- package/dist/esm/hooks/doesRootSchemeMatchSystem.mjs.map +1 -0
- package/dist/esm/hooks/doesRootSchemeMatchSystem.native.js +8 -0
- package/dist/esm/hooks/doesRootSchemeMatchSystem.native.js.map +1 -0
- package/dist/esm/hooks/getThemeProxied.mjs +34 -0
- package/dist/esm/hooks/getThemeProxied.mjs.map +1 -0
- package/dist/esm/hooks/getThemeProxied.native.js +67 -0
- package/dist/esm/hooks/getThemeProxied.native.js.map +1 -0
- package/dist/esm/hooks/useComponentState.mjs +121 -0
- package/dist/esm/hooks/useComponentState.mjs.map +1 -0
- package/dist/esm/hooks/useComponentState.native.js +139 -0
- package/dist/esm/hooks/useComponentState.native.js.map +1 -0
- package/dist/esm/hooks/useDisableSSR.mjs +6 -0
- package/dist/esm/hooks/useDisableSSR.mjs.map +1 -0
- package/dist/esm/hooks/useDisableSSR.native.js +7 -0
- package/dist/esm/hooks/useDisableSSR.native.js.map +1 -0
- package/dist/esm/hooks/useIsTouchDevice.mjs +5 -0
- package/dist/esm/hooks/useIsTouchDevice.mjs.map +1 -0
- package/dist/esm/hooks/useIsTouchDevice.native.js +7 -0
- package/dist/esm/hooks/useIsTouchDevice.native.js.map +1 -0
- package/dist/esm/hooks/useMedia.mjs +145 -0
- package/dist/esm/hooks/useMedia.mjs.map +1 -0
- package/dist/esm/hooks/useMedia.native.js +177 -0
- package/dist/esm/hooks/useMedia.native.js.map +1 -0
- package/dist/esm/hooks/useProps.mjs +78 -0
- package/dist/esm/hooks/useProps.mjs.map +1 -0
- package/dist/esm/hooks/useProps.native.js +80 -0
- package/dist/esm/hooks/useProps.native.js.map +1 -0
- package/dist/esm/hooks/useTheme.mjs +22 -0
- package/dist/esm/hooks/useTheme.mjs.map +1 -0
- package/dist/esm/hooks/useTheme.native.js +26 -0
- package/dist/esm/hooks/useTheme.native.js.map +1 -0
- package/dist/esm/hooks/useThemeName.mjs +14 -0
- package/dist/esm/hooks/useThemeName.mjs.map +1 -0
- package/dist/esm/hooks/useThemeName.native.js +17 -0
- package/dist/esm/hooks/useThemeName.native.js.map +1 -0
- package/dist/esm/hooks/useThemeState.mjs +245 -0
- package/dist/esm/hooks/useThemeState.mjs.map +1 -0
- package/dist/esm/hooks/useThemeState.native.js +356 -0
- package/dist/esm/hooks/useThemeState.native.js.map +1 -0
- package/dist/esm/index.js +74 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +74 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +74 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/inject-styles.mjs +14 -0
- package/dist/esm/inject-styles.mjs.map +1 -0
- package/dist/esm/inject-styles.native.js +15 -0
- package/dist/esm/inject-styles.native.js.map +1 -0
- package/dist/esm/insertFont.mjs +49 -0
- package/dist/esm/insertFont.mjs.map +1 -0
- package/dist/esm/insertFont.native.js +46 -0
- package/dist/esm/insertFont.native.js.map +1 -0
- package/dist/esm/interfaces/CSSColorNames.mjs +2 -0
- package/dist/esm/interfaces/CSSColorNames.mjs.map +1 -0
- package/dist/esm/interfaces/CSSColorNames.native.js +2 -0
- package/dist/esm/interfaces/CSSColorNames.native.js.map +1 -0
- package/dist/esm/interfaces/GetRef.mjs +2 -0
- package/dist/esm/interfaces/GetRef.mjs.map +1 -0
- package/dist/esm/interfaces/GetRef.native.js +2 -0
- package/dist/esm/interfaces/GetRef.native.js.map +1 -0
- package/dist/esm/interfaces/GuiComponentEvents.mjs +2 -0
- package/dist/esm/interfaces/GuiComponentEvents.mjs.map +1 -0
- package/dist/esm/interfaces/GuiComponentEvents.native.js +2 -0
- package/dist/esm/interfaces/GuiComponentEvents.native.js.map +1 -0
- package/dist/esm/interfaces/GuiComponentPropsBaseBase.mjs +2 -0
- package/dist/esm/interfaces/GuiComponentPropsBaseBase.mjs.map +1 -0
- package/dist/esm/interfaces/GuiComponentPropsBaseBase.native.js +2 -0
- package/dist/esm/interfaces/GuiComponentPropsBaseBase.native.js.map +1 -0
- package/dist/esm/interfaces/RNExclusiveTypes.mjs +2 -0
- package/dist/esm/interfaces/RNExclusiveTypes.mjs.map +1 -0
- package/dist/esm/interfaces/RNExclusiveTypes.native.js +2 -0
- package/dist/esm/interfaces/RNExclusiveTypes.native.js.map +1 -0
- package/dist/esm/setupHooks.mjs +6 -0
- package/dist/esm/setupHooks.mjs.map +1 -0
- package/dist/esm/setupHooks.native.js +6 -0
- package/dist/esm/setupHooks.native.js.map +1 -0
- package/dist/esm/setupReactNative.mjs +24 -0
- package/dist/esm/setupReactNative.mjs.map +1 -0
- package/dist/esm/setupReactNative.native.js +28 -0
- package/dist/esm/setupReactNative.native.js.map +1 -0
- package/dist/esm/styled.mjs +91 -0
- package/dist/esm/styled.mjs.map +1 -0
- package/dist/esm/styled.native.js +100 -0
- package/dist/esm/styled.native.js.map +1 -0
- package/dist/esm/styledHtml.test-d.mjs +157 -0
- package/dist/esm/styledHtml.test-d.mjs.map +1 -0
- package/dist/esm/styledHtml.test-d.native.js +157 -0
- package/dist/esm/styledHtml.test-d.native.js.map +1 -0
- package/dist/esm/type-utils.mjs +2 -0
- package/dist/esm/type-utils.mjs.map +1 -0
- package/dist/esm/type-utils.native.js +2 -0
- package/dist/esm/type-utils.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/esm/views/Configuration.mjs +16 -0
- package/dist/esm/views/Configuration.mjs.map +1 -0
- package/dist/esm/views/Configuration.native.js +17 -0
- package/dist/esm/views/Configuration.native.js.map +1 -0
- package/dist/esm/views/FontLanguage.mjs +14 -0
- package/dist/esm/views/FontLanguage.mjs.map +1 -0
- package/dist/esm/views/FontLanguage.native.js +20 -0
- package/dist/esm/views/FontLanguage.native.js.map +1 -0
- package/dist/esm/views/GuiProvider.mjs +60 -0
- package/dist/esm/views/GuiProvider.mjs.map +1 -0
- package/dist/esm/views/GuiProvider.native.js +62 -0
- package/dist/esm/views/GuiProvider.native.js.map +1 -0
- package/dist/esm/views/GuiRoot.mjs +34 -0
- package/dist/esm/views/GuiRoot.mjs.map +1 -0
- package/dist/esm/views/GuiRoot.native.js +5 -0
- package/dist/esm/views/GuiRoot.native.js.map +1 -0
- package/dist/esm/views/Slot.mjs +40 -0
- package/dist/esm/views/Slot.mjs.map +1 -0
- package/dist/esm/views/Slot.native.js +43 -0
- package/dist/esm/views/Slot.native.js.map +1 -0
- package/dist/esm/views/Text.mjs +35 -0
- package/dist/esm/views/Text.mjs.map +1 -0
- package/dist/esm/views/Text.native.js +26 -0
- package/dist/esm/views/Text.native.js.map +1 -0
- package/dist/esm/views/Theme.mjs +127 -0
- package/dist/esm/views/Theme.mjs.map +1 -0
- package/dist/esm/views/Theme.native.js +136 -0
- package/dist/esm/views/Theme.native.js.map +1 -0
- package/dist/esm/views/ThemeDebug.mjs +54 -0
- package/dist/esm/views/ThemeDebug.mjs.map +1 -0
- package/dist/esm/views/ThemeDebug.native.js +11 -0
- package/dist/esm/views/ThemeDebug.native.js.map +1 -0
- package/dist/esm/views/ThemeProvider.mjs +29 -0
- package/dist/esm/views/ThemeProvider.mjs.map +1 -0
- package/dist/esm/views/ThemeProvider.native.js +20 -0
- package/dist/esm/views/ThemeProvider.native.js.map +1 -0
- package/dist/esm/views/View.mjs +8 -0
- package/dist/esm/views/View.mjs.map +1 -0
- package/dist/esm/views/View.native.js +8 -0
- package/dist/esm/views/View.native.js.map +1 -0
- package/inject-styles/index.cjs +2 -0
- package/inject-styles/index.js +2 -0
- package/inject-styles.cjs +1 -0
- package/package.json +81 -0
- package/reset.css +59 -0
- package/src/Gui.ts +47 -0
- package/src/_withStableStyle.tsx +55 -0
- package/src/animationDriverTypes.test-d.ts +332 -0
- package/src/config.ts +232 -0
- package/src/constants/accessibilityDirectMap.native.tsx +10 -0
- package/src/constants/accessibilityDirectMap.tsx +11 -0
- package/src/constants/constants.ts +16 -0
- package/src/constants/isDevTools.ts +12 -0
- package/src/contexts/ComponentContext.tsx +16 -0
- package/src/contexts/GroupContext.tsx +4 -0
- package/src/createComponent.tsx +1806 -0
- package/src/createFont.ts +50 -0
- package/src/createGui.ts +363 -0
- package/src/createShorthands.ts +7 -0
- package/src/createTokens.ts +31 -0
- package/src/createVariable.ts +121 -0
- package/src/createVariables.ts +78 -0
- package/src/defaultComponentState.tsx +22 -0
- package/src/eventHandling.native.ts +184 -0
- package/src/eventHandling.ts +44 -0
- package/src/helpers/consoleLog.native.ts +2 -0
- package/src/helpers/createDesignSystem.ts +264 -0
- package/src/helpers/createMediaStyle.ts +167 -0
- package/src/helpers/createStyledContext.tsx +98 -0
- package/src/helpers/defaultAnimationDriver.tsx +23 -0
- package/src/helpers/defaultOffset.ts +1 -0
- package/src/helpers/expandStyle.ts +204 -0
- package/src/helpers/expandStyles.ts +42 -0
- package/src/helpers/getCSSStylesAtomic.native.ts +7 -0
- package/src/helpers/getCSSStylesAtomic.ts +263 -0
- package/src/helpers/getDefaultProps.ts +28 -0
- package/src/helpers/getDynamicVal.ts +63 -0
- package/src/helpers/getExpandedShorthands.ts +23 -0
- package/src/helpers/getFontLanguage.ts +2 -0
- package/src/helpers/getGroupPropParts.ts +46 -0
- package/src/helpers/getShorthandValue.ts +9 -0
- package/src/helpers/getSplitStyles.tsx +1768 -0
- package/src/helpers/getThemeCSSRules.native.ts +3 -0
- package/src/helpers/getThemeCSSRules.ts +192 -0
- package/src/helpers/getTokenForKey.ts +223 -0
- package/src/helpers/getVariantExtras.tsx +67 -0
- package/src/helpers/insertStyleRule.tsx +365 -0
- package/src/helpers/isActivePlatform.ts +14 -0
- package/src/helpers/isActiveTheme.ts +4 -0
- package/src/helpers/isGuiComponent.tsx +11 -0
- package/src/helpers/isGuiElement.tsx +11 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/log.ts +17 -0
- package/src/helpers/mainThreadPressEvents.native.ts +41 -0
- package/src/helpers/mainThreadPressEvents.ts +6 -0
- package/src/helpers/matchMedia.native.ts +34 -0
- package/src/helpers/matchMedia.ts +17 -0
- package/src/helpers/mediaObjectToString.ts +30 -0
- package/src/helpers/mediaState.ts +32 -0
- package/src/helpers/mergeProps.ts +121 -0
- package/src/helpers/mergeRenderElementProps.ts +17 -0
- package/src/helpers/mergeSlotStyleProps.ts +46 -0
- package/src/helpers/mergeVariants.ts +40 -0
- package/src/helpers/nativeOnlyProps.ts +38 -0
- package/src/helpers/normalizeColor.native.ts +29 -0
- package/src/helpers/normalizeColor.ts +29 -0
- package/src/helpers/normalizeShadow.native.ts +20 -0
- package/src/helpers/normalizeShadow.ts +21 -0
- package/src/helpers/normalizeStyle.ts +42 -0
- package/src/helpers/normalizeStylePropKeys.native.ts +12 -0
- package/src/helpers/normalizeStylePropKeys.ts +3 -0
- package/src/helpers/normalizeValueWithProperty.ts +41 -0
- package/src/helpers/objectIdentityKey.tsx +20 -0
- package/src/helpers/parseBorderShorthand.native.ts +74 -0
- package/src/helpers/parseBorderShorthand.ts +6 -0
- package/src/helpers/parseNativeStyle.ts +193 -0
- package/src/helpers/parseOutlineShorthand.native.ts +62 -0
- package/src/helpers/parseOutlineShorthand.ts +6 -0
- package/src/helpers/platformResolveValue.native.ts +72 -0
- package/src/helpers/platformResolveValue.ts +22 -0
- package/src/helpers/pointerEvents.native.ts +143 -0
- package/src/helpers/pointerEvents.ts +9 -0
- package/src/helpers/propMapper.ts +404 -0
- package/src/helpers/proxyThemeToParents.ts +52 -0
- package/src/helpers/proxyThemeVariables.tsx +13 -0
- package/src/helpers/pseudoDescriptors.ts +74 -0
- package/src/helpers/pseudoTransitions.ts +97 -0
- package/src/helpers/registerCSSVariable.ts +54 -0
- package/src/helpers/resolveAnimationDriver.ts +23 -0
- package/src/helpers/resolveCompoundTokens.ts +28 -0
- package/src/helpers/resolveRem.native.ts +44 -0
- package/src/helpers/resolveRem.ts +17 -0
- package/src/helpers/resolveSafeArea.native.ts +18 -0
- package/src/helpers/resolveSafeArea.ts +10 -0
- package/src/helpers/setElementProps.native.tsx +9 -0
- package/src/helpers/setElementProps.tsx +5 -0
- package/src/helpers/skipProps.ts +35 -0
- package/src/helpers/sortString.ts +1 -0
- package/src/helpers/subscribeToContextGroup.tsx +99 -0
- package/src/helpers/themeable.tsx +104 -0
- package/src/helpers/themes.ts +23 -0
- package/src/helpers/timer.ts +9 -0
- package/src/helpers/transformsToString.ts +20 -0
- package/src/helpers/useRenderElement.tsx +73 -0
- package/src/helpers/webPropsToSkip.native.ts +56 -0
- package/src/helpers/webPropsToSkip.ts +1 -0
- package/src/helpers/wrapStyleTags.tsx +31 -0
- package/src/hooks/doesRootSchemeMatchSystem.native.ts +7 -0
- package/src/hooks/doesRootSchemeMatchSystem.ts +4 -0
- package/src/hooks/getThemeProxied.ts +202 -0
- package/src/hooks/useComponentState.ts +269 -0
- package/src/hooks/useDisableSSR.tsx +6 -0
- package/src/hooks/useIsTouchDevice.tsx +6 -0
- package/src/hooks/useMedia.tsx +298 -0
- package/src/hooks/useProps.tsx +158 -0
- package/src/hooks/useTheme.tsx +48 -0
- package/src/hooks/useThemeName.tsx +10 -0
- package/src/hooks/useThemeState.ts +558 -0
- package/src/index.ts +103 -0
- package/src/inject-styles.ts +20 -0
- package/src/insertFont.ts +81 -0
- package/src/interfaces/CSSColorNames.tsx +149 -0
- package/src/interfaces/GetRef.tsx +24 -0
- package/src/interfaces/GuiComponentEvents.tsx +18 -0
- package/src/interfaces/GuiComponentPropsBaseBase.tsx +124 -0
- package/src/interfaces/RNExclusiveTypes.ts +59 -0
- package/src/setupHooks.ts +27 -0
- package/src/setupReactNative.ts +60 -0
- package/src/styled.tsx +602 -0
- package/src/styledHtml.test-d.ts +286 -0
- package/src/type-utils.ts +30 -0
- package/src/types.tsx +3364 -0
- package/src/views/Configuration.tsx +20 -0
- package/src/views/FontLanguage.native.tsx +13 -0
- package/src/views/FontLanguage.tsx +18 -0
- package/src/views/GuiProvider.tsx +95 -0
- package/src/views/GuiRoot.native.tsx +9 -0
- package/src/views/GuiRoot.tsx +64 -0
- package/src/views/Slot.tsx +86 -0
- package/src/views/Text.tsx +71 -0
- package/src/views/Theme.tsx +246 -0
- package/src/views/ThemeDebug.native.tsx +17 -0
- package/src/views/ThemeDebug.tsx +95 -0
- package/src/views/ThemeProvider.tsx +45 -0
- package/src/views/View.tsx +25 -0
- package/tsconfig.json +44 -0
- package/tsconfig.test.json +9 -0
- package/types/Gui.d.ts +15 -0
- package/types/_withStableStyle.d.ts +4 -0
- package/types/config.d.ts +72 -0
- package/types/constants/accessibilityDirectMap.d.ts +6 -0
- package/types/constants/accessibilityDirectMap.native.d.ts +6 -0
- package/types/constants/constants.d.ts +5 -0
- package/types/constants/isDevTools.d.ts +2 -0
- package/types/contexts/ComponentContext.d.ts +4 -0
- package/types/contexts/GroupContext.d.ts +3 -0
- package/types/createComponent.d.ts +7 -0
- package/types/createFont.d.ts +3 -0
- package/types/createGui.d.ts +3 -0
- package/types/createShorthands.d.ts +3 -0
- package/types/createTokens.d.ts +22 -0
- package/types/createVariable.d.ts +22 -0
- package/types/createVariables.d.ts +10 -0
- package/types/defaultComponentState.d.ts +5 -0
- package/types/eventHandling.d.ts +27 -0
- package/types/eventHandling.native.d.ts +12 -0
- package/types/helpers/consoleLog.native.d.ts +7 -0
- package/types/helpers/createDesignSystem.d.ts +47 -0
- package/types/helpers/createMediaStyle.d.ts +5 -0
- package/types/helpers/createStyledContext.d.ts +3 -0
- package/types/helpers/defaultAnimationDriver.d.ts +3 -0
- package/types/helpers/defaultOffset.d.ts +5 -0
- package/types/helpers/expandStyle.d.ts +7 -0
- package/types/helpers/expandStyles.d.ts +2 -0
- package/types/helpers/getCSSStylesAtomic.d.ts +11 -0
- package/types/helpers/getCSSStylesAtomic.native.d.ts +4 -0
- package/types/helpers/getDefaultProps.d.ts +3 -0
- package/types/helpers/getDynamicVal.d.ts +16 -0
- package/types/helpers/getExpandedShorthands.d.ts +7 -0
- package/types/helpers/getFontLanguage.d.ts +2 -0
- package/types/helpers/getGroupPropParts.d.ts +7 -0
- package/types/helpers/getShorthandValue.d.ts +2 -0
- package/types/helpers/getSplitStyles.d.ts +13 -0
- package/types/helpers/getThemeCSSRules.d.ts +10 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +2 -0
- package/types/helpers/getTokenForKey.d.ts +6 -0
- package/types/helpers/getVariantExtras.d.ts +4 -0
- package/types/helpers/insertStyleRule.d.ts +10 -0
- package/types/helpers/isActivePlatform.d.ts +2 -0
- package/types/helpers/isActiveTheme.d.ts +2 -0
- package/types/helpers/isGuiComponent.d.ts +5 -0
- package/types/helpers/isGuiElement.d.ts +8 -0
- package/types/helpers/isObj.d.ts +2 -0
- package/types/helpers/log.d.ts +2 -0
- package/types/helpers/mainThreadPressEvents.d.ts +2 -0
- package/types/helpers/mainThreadPressEvents.native.d.ts +10 -0
- package/types/helpers/matchMedia.d.ts +6 -0
- package/types/helpers/matchMedia.native.d.ts +4 -0
- package/types/helpers/mediaObjectToString.d.ts +3 -0
- package/types/helpers/mediaState.d.ts +7 -0
- package/types/helpers/mergeProps.d.ts +20 -0
- package/types/helpers/mergeRenderElementProps.d.ts +7 -0
- package/types/helpers/mergeSlotStyleProps.d.ts +10 -0
- package/types/helpers/mergeVariants.d.ts +3 -0
- package/types/helpers/nativeOnlyProps.d.ts +39 -0
- package/types/helpers/normalizeColor.d.ts +8 -0
- package/types/helpers/normalizeColor.native.d.ts +9 -0
- package/types/helpers/normalizeShadow.d.ts +10 -0
- package/types/helpers/normalizeShadow.native.d.ts +10 -0
- package/types/helpers/normalizeStyle.d.ts +9 -0
- package/types/helpers/normalizeStylePropKeys.d.ts +2 -0
- package/types/helpers/normalizeStylePropKeys.native.d.ts +13 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +6 -0
- package/types/helpers/objectIdentityKey.d.ts +2 -0
- package/types/helpers/parseBorderShorthand.d.ts +3 -0
- package/types/helpers/parseBorderShorthand.native.d.ts +3 -0
- package/types/helpers/parseNativeStyle.d.ts +14 -0
- package/types/helpers/parseOutlineShorthand.d.ts +3 -0
- package/types/helpers/parseOutlineShorthand.native.d.ts +3 -0
- package/types/helpers/platformResolveValue.d.ts +6 -0
- package/types/helpers/platformResolveValue.native.d.ts +7 -0
- package/types/helpers/pointerEvents.d.ts +8 -0
- package/types/helpers/pointerEvents.native.d.ts +2 -0
- package/types/helpers/propMapper.d.ts +5 -0
- package/types/helpers/proxyThemeToParents.d.ts +4 -0
- package/types/helpers/proxyThemeVariables.d.ts +2 -0
- package/types/helpers/pseudoDescriptors.d.ts +51 -0
- package/types/helpers/pseudoTransitions.d.ts +29 -0
- package/types/helpers/registerCSSVariable.d.ts +9 -0
- package/types/helpers/resolveAnimationDriver.d.ts +7 -0
- package/types/helpers/resolveCompoundTokens.d.ts +9 -0
- package/types/helpers/resolveRem.d.ts +13 -0
- package/types/helpers/resolveRem.native.d.ts +13 -0
- package/types/helpers/resolveSafeArea.d.ts +2 -0
- package/types/helpers/resolveSafeArea.native.d.ts +2 -0
- package/types/helpers/setElementProps.d.ts +2 -0
- package/types/helpers/setElementProps.native.d.ts +2 -0
- package/types/helpers/skipProps.d.ts +19 -0
- package/types/helpers/sortString.d.ts +2 -0
- package/types/helpers/subscribeToContextGroup.d.ts +10 -0
- package/types/helpers/themeable.d.ts +3 -0
- package/types/helpers/themes.d.ts +2 -0
- package/types/helpers/timer.d.ts +2 -0
- package/types/helpers/transformsToString.d.ts +2 -0
- package/types/helpers/useRenderElement.d.ts +13 -0
- package/types/helpers/webPropsToSkip.d.ts +2 -0
- package/types/helpers/webPropsToSkip.native.d.ts +104 -0
- package/types/helpers/wrapStyleTags.d.ts +3 -0
- package/types/hooks/doesRootSchemeMatchSystem.d.ts +2 -0
- package/types/hooks/doesRootSchemeMatchSystem.native.d.ts +2 -0
- package/types/hooks/getThemeProxied.d.ts +23 -0
- package/types/hooks/useComponentState.d.ts +25 -0
- package/types/hooks/useDisableSSR.d.ts +3 -0
- package/types/hooks/useIsTouchDevice.d.ts +2 -0
- package/types/hooks/useMedia.d.ts +23 -0
- package/types/hooks/useProps.d.ts +41 -0
- package/types/hooks/useTheme.d.ts +9 -0
- package/types/hooks/useThemeName.d.ts +3 -0
- package/types/hooks/useThemeState.d.ts +11 -0
- package/types/index.d.ts +77 -0
- package/types/inject-styles.d.ts +7 -0
- package/types/insertFont.d.ts +10 -0
- package/types/interfaces/CSSColorNames.d.ts +2 -0
- package/types/interfaces/GetRef.d.ts +6 -0
- package/types/interfaces/GuiComponentEvents.d.ts +19 -0
- package/types/interfaces/GuiComponentPropsBaseBase.d.ts +95 -0
- package/types/interfaces/RNExclusiveTypes.d.ts +22 -0
- package/types/setupHooks.d.ts +17 -0
- package/types/setupReactNative.d.ts +5 -0
- package/types/styled.d.ts +53 -0
- package/types/type-utils.d.ts +13 -0
- package/types/types.d.ts +1929 -0
- package/types/views/Configuration.d.ts +10 -0
- package/types/views/FontLanguage.d.ts +6 -0
- package/types/views/FontLanguage.native.d.ts +3 -0
- package/types/views/GuiProvider.d.ts +3 -0
- package/types/views/GuiRoot.d.ts +15 -0
- package/types/views/GuiRoot.native.d.ts +7 -0
- package/types/views/Slot.d.ts +13 -0
- package/types/views/Text.d.ts +4 -0
- package/types/views/Theme.d.ts +16 -0
- package/types/views/ThemeDebug.d.ts +10 -0
- package/types/views/ThemeDebug.native.d.ts +10 -0
- package/types/views/ThemeProvider.d.ts +3 -0
- package/types/views/View.d.ts +8 -0
- package/vitest.config.d.ts +3 -0
- package/vitest.config.d.ts.map +1 -0
- package/vitest.config.ts +14 -0
package/src/types.tsx
ADDED
|
@@ -0,0 +1,3364 @@
|
|
|
1
|
+
import type { StyleObject } from '@hanzogui/helpers'
|
|
2
|
+
import type { Properties } from 'csstype'
|
|
3
|
+
import type {
|
|
4
|
+
CSSProperties,
|
|
5
|
+
ComponentType,
|
|
6
|
+
Context,
|
|
7
|
+
ForwardRefExoticComponent,
|
|
8
|
+
ForwardRefRenderFunction,
|
|
9
|
+
FunctionComponent,
|
|
10
|
+
HTMLAttributes,
|
|
11
|
+
ProviderExoticComponent,
|
|
12
|
+
ReactNode,
|
|
13
|
+
RefAttributes,
|
|
14
|
+
RefObject,
|
|
15
|
+
} from 'react'
|
|
16
|
+
import type {
|
|
17
|
+
PressableProps,
|
|
18
|
+
Text as RNText,
|
|
19
|
+
TextStyle as RNTextStyle,
|
|
20
|
+
TextProps as ReactTextProps,
|
|
21
|
+
View,
|
|
22
|
+
ViewProps,
|
|
23
|
+
ViewStyle,
|
|
24
|
+
} from 'react-native'
|
|
25
|
+
|
|
26
|
+
import type { CSSColorNames } from './interfaces/CSSColorNames'
|
|
27
|
+
import type { RNOnlyProps } from './interfaces/RNExclusiveTypes'
|
|
28
|
+
|
|
29
|
+
export type SizeKeys =
|
|
30
|
+
| 'width'
|
|
31
|
+
| 'height'
|
|
32
|
+
| 'minWidth'
|
|
33
|
+
| 'minHeight'
|
|
34
|
+
| 'maxWidth'
|
|
35
|
+
| 'maxHeight'
|
|
36
|
+
| 'shadowRadius'
|
|
37
|
+
|
|
38
|
+
export type ColorKeys =
|
|
39
|
+
| 'color'
|
|
40
|
+
| 'backgroundColor'
|
|
41
|
+
| 'borderColor'
|
|
42
|
+
| 'borderBottomColor'
|
|
43
|
+
| 'borderTopColor'
|
|
44
|
+
| 'borderLeftColor'
|
|
45
|
+
| 'borderRightColor'
|
|
46
|
+
| 'shadowColor'
|
|
47
|
+
| 'outlineColor'
|
|
48
|
+
| 'textShadowColor'
|
|
49
|
+
| 'borderBlockColor'
|
|
50
|
+
| 'borderBlockEndColor'
|
|
51
|
+
| 'borderBlockStartColor'
|
|
52
|
+
| 'borderInlineColor'
|
|
53
|
+
| 'borderInlineStartColor'
|
|
54
|
+
| 'borderInlineEndColor'
|
|
55
|
+
|
|
56
|
+
export type SpaceKeys =
|
|
57
|
+
| 'space'
|
|
58
|
+
| 'padding'
|
|
59
|
+
| 'paddingHorizontal'
|
|
60
|
+
| 'paddingVertical'
|
|
61
|
+
| 'paddingLeft'
|
|
62
|
+
| 'paddingTop'
|
|
63
|
+
| 'paddingBottom'
|
|
64
|
+
| 'paddingLeft'
|
|
65
|
+
| 'paddingRight'
|
|
66
|
+
| 'paddingEnd'
|
|
67
|
+
| 'paddingStart'
|
|
68
|
+
| 'margin'
|
|
69
|
+
| 'marginHorizontal'
|
|
70
|
+
| 'marginVertical'
|
|
71
|
+
| 'marginLeft'
|
|
72
|
+
| 'marginTop'
|
|
73
|
+
| 'marginBottom'
|
|
74
|
+
| 'marginLeft'
|
|
75
|
+
| 'marginRight'
|
|
76
|
+
| 'marginEnd'
|
|
77
|
+
| 'marginStart'
|
|
78
|
+
| 'marginBlock'
|
|
79
|
+
| 'marginBlockStart'
|
|
80
|
+
| 'marginBlockEnd'
|
|
81
|
+
| 'marginInline'
|
|
82
|
+
| 'marginInlineStart'
|
|
83
|
+
| 'marginInlineEnd'
|
|
84
|
+
| 'paddingBlock'
|
|
85
|
+
| 'paddingBlockStart'
|
|
86
|
+
| 'paddingBlockEnd'
|
|
87
|
+
| 'paddingInline'
|
|
88
|
+
| 'paddingInlineStart'
|
|
89
|
+
| 'paddingInlineEnd'
|
|
90
|
+
| 'x'
|
|
91
|
+
| 'y'
|
|
92
|
+
| 'gap'
|
|
93
|
+
| 'rowGap'
|
|
94
|
+
| 'columnGap'
|
|
95
|
+
| 'scale'
|
|
96
|
+
| 'scaleX'
|
|
97
|
+
| 'scaleY'
|
|
98
|
+
| 'borderTopEndRadius'
|
|
99
|
+
| 'borderTopLeftRadius'
|
|
100
|
+
| 'borderTopRightRadius'
|
|
101
|
+
| 'borderTopStartRadius'
|
|
102
|
+
| 'borderBottomEndRadius'
|
|
103
|
+
| 'borderBottomLeftRadius'
|
|
104
|
+
| 'borderBottomRightRadius'
|
|
105
|
+
| 'borderBottomStartRadius'
|
|
106
|
+
| 'borderBottomWidth'
|
|
107
|
+
| 'borderLeftWidth'
|
|
108
|
+
| 'borderRadius'
|
|
109
|
+
| 'borderRightWidth'
|
|
110
|
+
| 'borderTopEndRadius'
|
|
111
|
+
| 'borderTopLeftRadius'
|
|
112
|
+
| 'borderTopRightRadius'
|
|
113
|
+
| 'borderEndWidth'
|
|
114
|
+
| 'borderStartWidth'
|
|
115
|
+
| 'borderTopStartRadius'
|
|
116
|
+
| 'borderTopWidth'
|
|
117
|
+
| 'borderWidth'
|
|
118
|
+
| 'left'
|
|
119
|
+
| 'top'
|
|
120
|
+
| 'right'
|
|
121
|
+
| 'bottom'
|
|
122
|
+
| 'shadowOffset'
|
|
123
|
+
| 'borderBlockWidth'
|
|
124
|
+
| 'borderBlockStartWidth'
|
|
125
|
+
| 'borderBlockEndWidth'
|
|
126
|
+
| 'borderInlineWidth'
|
|
127
|
+
| 'borderInlineStartWidth'
|
|
128
|
+
| 'borderInlineEndWidth'
|
|
129
|
+
|
|
130
|
+
export type StyledContext<Props extends Record<string, any> = any> = Context<Props> & {
|
|
131
|
+
context: Context<Props>
|
|
132
|
+
props: Record<string, any> | undefined
|
|
133
|
+
Provider: ProviderExoticComponent<
|
|
134
|
+
Partial<Props | undefined> & {
|
|
135
|
+
children?: ReactNode
|
|
136
|
+
scope?: string
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
|
|
140
|
+
useStyledContext: (scope?: string) => Props
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type GuiComponentState = {
|
|
144
|
+
unmounted: boolean | 'should-enter'
|
|
145
|
+
disabled?: boolean
|
|
146
|
+
hover?: boolean
|
|
147
|
+
press?: boolean
|
|
148
|
+
pressIn?: boolean
|
|
149
|
+
focus?: boolean
|
|
150
|
+
focusVisible?: boolean
|
|
151
|
+
focusWithin?: boolean
|
|
152
|
+
transition?: null | {
|
|
153
|
+
style?: any
|
|
154
|
+
avoidClasses?: boolean
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// this is used by the component itself to figure out group styles:
|
|
158
|
+
group?: Record<string, ChildGroupState>
|
|
159
|
+
hasDynGroupChildren?: boolean
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// from react-native Accessibility.d.ts
|
|
163
|
+
|
|
164
|
+
export type Role =
|
|
165
|
+
| 'alert'
|
|
166
|
+
| 'alertdialog'
|
|
167
|
+
| 'application'
|
|
168
|
+
| 'article'
|
|
169
|
+
| 'banner'
|
|
170
|
+
| 'button'
|
|
171
|
+
| 'cell'
|
|
172
|
+
| 'checkbox'
|
|
173
|
+
| 'columnheader'
|
|
174
|
+
| 'combobox'
|
|
175
|
+
| 'complementary'
|
|
176
|
+
| 'contentinfo'
|
|
177
|
+
| 'definition'
|
|
178
|
+
| 'dialog'
|
|
179
|
+
| 'directory'
|
|
180
|
+
| 'document'
|
|
181
|
+
| 'feed'
|
|
182
|
+
| 'figure'
|
|
183
|
+
| 'form'
|
|
184
|
+
| 'grid'
|
|
185
|
+
| 'group'
|
|
186
|
+
| 'heading'
|
|
187
|
+
| 'img'
|
|
188
|
+
| 'link'
|
|
189
|
+
| 'list'
|
|
190
|
+
| 'listitem'
|
|
191
|
+
| 'log'
|
|
192
|
+
| 'main'
|
|
193
|
+
| 'marquee'
|
|
194
|
+
| 'math'
|
|
195
|
+
| 'menu'
|
|
196
|
+
| 'menubar'
|
|
197
|
+
| 'menuitem'
|
|
198
|
+
| 'meter'
|
|
199
|
+
| 'navigation'
|
|
200
|
+
| 'none'
|
|
201
|
+
| 'note'
|
|
202
|
+
| 'option'
|
|
203
|
+
| 'presentation'
|
|
204
|
+
| 'progressbar'
|
|
205
|
+
| 'radio'
|
|
206
|
+
| 'radiogroup'
|
|
207
|
+
| 'region'
|
|
208
|
+
| 'row'
|
|
209
|
+
| 'rowgroup'
|
|
210
|
+
| 'rowheader'
|
|
211
|
+
| 'scrollbar'
|
|
212
|
+
| 'searchbox'
|
|
213
|
+
| 'separator'
|
|
214
|
+
| 'slider'
|
|
215
|
+
| 'spinbutton'
|
|
216
|
+
| 'status'
|
|
217
|
+
| 'summary'
|
|
218
|
+
| 'switch'
|
|
219
|
+
| 'tab'
|
|
220
|
+
| 'table'
|
|
221
|
+
| 'tablist'
|
|
222
|
+
| 'tabpanel'
|
|
223
|
+
| 'term'
|
|
224
|
+
| 'timer'
|
|
225
|
+
| 'toolbar'
|
|
226
|
+
| 'tooltip'
|
|
227
|
+
| 'tree'
|
|
228
|
+
| 'treegrid'
|
|
229
|
+
| 'treeitem'
|
|
230
|
+
|
|
231
|
+
export type GuiComponentPropsBaseBase = {
|
|
232
|
+
target?: string
|
|
233
|
+
|
|
234
|
+
htmlFor?: string
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* When truthy passes through all props to a single child element, and avoids rendering its own element.
|
|
238
|
+
* Must pass just one child React element that will receive all the props.
|
|
239
|
+
*
|
|
240
|
+
* The option "except-style" will avoid passing any style related props.
|
|
241
|
+
*
|
|
242
|
+
* The option "web" will map all React Native style props to web props (onPress becomes onClick).
|
|
243
|
+
*
|
|
244
|
+
* The option "except-style-web" combines the except-style and web options.
|
|
245
|
+
*
|
|
246
|
+
*/
|
|
247
|
+
asChild?: boolean | 'except-style' | 'except-style-web' | 'web'
|
|
248
|
+
|
|
249
|
+
dangerouslySetInnerHTML?: { __html: string }
|
|
250
|
+
children?: any | any[]
|
|
251
|
+
|
|
252
|
+
debug?: DebugProp
|
|
253
|
+
|
|
254
|
+
disabled?: boolean
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Same as the web className property, useful for applying styles from CSS on web only
|
|
258
|
+
*/
|
|
259
|
+
className?: string
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* If given a theme it will only apply to this element, instead of passing down to children
|
|
263
|
+
*/
|
|
264
|
+
themeShallow?: boolean
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* If true, component themes will not be applied
|
|
268
|
+
*/
|
|
269
|
+
unstyled?: boolean
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Same as the web id property for setting a uid on an element
|
|
273
|
+
*/
|
|
274
|
+
id?: string
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Controls the rendered element on web.
|
|
278
|
+
* - String: renders as that HTML element (e.g., `render="button"`)
|
|
279
|
+
* - JSX Element: clones element with merged props (e.g., `render={<a href="/" />}`)
|
|
280
|
+
* - Function: full control with props and state (e.g., `render={(props) => <Custom {...props} />}`)
|
|
281
|
+
* @example render="button"
|
|
282
|
+
* @example render={<a href="/" />}
|
|
283
|
+
* @example render={(props, state) => <MyComponent {...props} isPressed={state.press} />}
|
|
284
|
+
*/
|
|
285
|
+
render?:
|
|
286
|
+
| keyof HTMLElementTagNameMap
|
|
287
|
+
| (string & {})
|
|
288
|
+
| React.ReactElement
|
|
289
|
+
| ((
|
|
290
|
+
props: Record<string, any> & { ref?: React.Ref<any> },
|
|
291
|
+
state: GuiComponentState
|
|
292
|
+
) => React.ReactElement)
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Applies a theme to this element
|
|
296
|
+
*/
|
|
297
|
+
theme?: ThemeName | null
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Marks this component as a group for use in styling children based on parents named group
|
|
301
|
+
* See: https://gui.hanzo.ai/docs/intro/props
|
|
302
|
+
*/
|
|
303
|
+
group?: GroupNames | boolean
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Works only alongside group, when children of the group are using container based sizing on native you can hide them until parent is measured.
|
|
307
|
+
* See: https://gui.hanzo.ai/docs/intro/props
|
|
308
|
+
*/
|
|
309
|
+
untilMeasured?: 'hide' | 'show'
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Equivalent to "name" property on styled() for automatically applying a theme
|
|
313
|
+
*/
|
|
314
|
+
componentName?: string
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Used for controlling the order of focus with keyboard or assistive device enavigation
|
|
318
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
319
|
+
*/
|
|
320
|
+
tabIndex?: string | number
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Equivalent to role="" attribute on web for accessibility
|
|
324
|
+
*/
|
|
325
|
+
role?: Role
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Disable all compiler optimization
|
|
329
|
+
*/
|
|
330
|
+
disableOptimization?: boolean
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Forces the pseudo style state to be on
|
|
334
|
+
*/
|
|
335
|
+
forceStyle?: 'hover' | 'press' | 'focus' | 'focusVisible' | 'focusWithin'
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Disables className output of styles, instead using only inline styles
|
|
339
|
+
*/
|
|
340
|
+
disableClassName?: boolean
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Adds some area outside the typical bounds of the component for touch actions to register.
|
|
344
|
+
* Hanzo GUI uses Pressable internally so it supports `number | Insets` rather than just `Insets`
|
|
345
|
+
*/
|
|
346
|
+
hitSlop?: number | Insets | null
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Select which animation driver to use for this component.
|
|
350
|
+
* Pass a string key matching a driver registered in the `animations` config.
|
|
351
|
+
* Example: `<View animatedBy="spring">` when config has `animations: { default: css, spring: moti }`
|
|
352
|
+
*/
|
|
353
|
+
animatedBy?: AnimationDriverKeys | null
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface Insets {
|
|
357
|
+
top?: number
|
|
358
|
+
left?: number
|
|
359
|
+
bottom?: number
|
|
360
|
+
right?: number
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface WebOnlyPressEvents {
|
|
364
|
+
onPress?: PressableProps['onPress']
|
|
365
|
+
onLongPress?: PressableProps['onLongPress']
|
|
366
|
+
onPressIn?: PressableProps['onPress']
|
|
367
|
+
onPressOut?: PressableProps['onPress']
|
|
368
|
+
onMouseEnter?: DivAttributes['onMouseEnter']
|
|
369
|
+
onMouseLeave?: DivAttributes['onMouseLeave']
|
|
370
|
+
onMouseDown?: DivAttributes['onMouseDown']
|
|
371
|
+
onMouseUp?: DivAttributes['onMouseUp']
|
|
372
|
+
onMouseMove?: DivAttributes['onMouseMove']
|
|
373
|
+
onMouseOver?: DivAttributes['onMouseOver']
|
|
374
|
+
onMouseOut?: DivAttributes['onMouseOut']
|
|
375
|
+
onFocus?: DivAttributes['onFocus']
|
|
376
|
+
onBlur?: DivAttributes['onBlur']
|
|
377
|
+
onClick?: DivAttributes['onClick']
|
|
378
|
+
onDoubleClick?: DivAttributes['onDoubleClick']
|
|
379
|
+
onContextMenu?: DivAttributes['onContextMenu']
|
|
380
|
+
onWheel?: DivAttributes['onWheel']
|
|
381
|
+
|
|
382
|
+
// Keyboard events
|
|
383
|
+
onKeyDown?: DivAttributes['onKeyDown']
|
|
384
|
+
onKeyUp?: DivAttributes['onKeyUp']
|
|
385
|
+
|
|
386
|
+
// Input/Change events
|
|
387
|
+
onChange?: DivAttributes['onChange']
|
|
388
|
+
onInput?: DivAttributes['onInput']
|
|
389
|
+
onBeforeInput?: DivAttributes['onBeforeInput']
|
|
390
|
+
|
|
391
|
+
// Scroll
|
|
392
|
+
onScroll?: DivAttributes['onScroll']
|
|
393
|
+
|
|
394
|
+
// Clipboard
|
|
395
|
+
onCopy?: DivAttributes['onCopy']
|
|
396
|
+
onCut?: DivAttributes['onCut']
|
|
397
|
+
onPaste?: DivAttributes['onPaste']
|
|
398
|
+
|
|
399
|
+
// Drag and drop
|
|
400
|
+
onDrag?: DivAttributes['onDrag']
|
|
401
|
+
onDragStart?: DivAttributes['onDragStart']
|
|
402
|
+
onDragEnd?: DivAttributes['onDragEnd']
|
|
403
|
+
onDragEnter?: DivAttributes['onDragEnter']
|
|
404
|
+
onDragLeave?: DivAttributes['onDragLeave']
|
|
405
|
+
onDragOver?: DivAttributes['onDragOver']
|
|
406
|
+
onDrop?: DivAttributes['onDrop']
|
|
407
|
+
|
|
408
|
+
// Pointer events
|
|
409
|
+
onPointerDown?: DivAttributes['onPointerDown']
|
|
410
|
+
onPointerMove?: DivAttributes['onPointerMove']
|
|
411
|
+
onPointerUp?: DivAttributes['onPointerUp']
|
|
412
|
+
onPointerCancel?: DivAttributes['onPointerCancel']
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export type { MediaStyleObject, StyleObject } from '@hanzogui/helpers'
|
|
416
|
+
|
|
417
|
+
type FontFamilies = FontTokens extends `$${infer Token}` ? Token : never
|
|
418
|
+
|
|
419
|
+
export type LanguageContextType = Partial<{
|
|
420
|
+
[key in FontFamilies]: FontLanguages | 'default'
|
|
421
|
+
}>
|
|
422
|
+
|
|
423
|
+
export type FontLanguageProps = LanguageContextType & {
|
|
424
|
+
children?: React.ReactNode
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export type ThemeProviderProps = {
|
|
428
|
+
className?: string
|
|
429
|
+
defaultTheme: string | null | undefined
|
|
430
|
+
/** @deprecated moved to createGui({ settings: { disableRootThemeClass } }) */
|
|
431
|
+
disableRootThemeClass?: boolean
|
|
432
|
+
/** @deprecated moved to createGui({ settings: { themeClassNameOnRoot } }) */
|
|
433
|
+
themeClassNameOnRoot?: boolean
|
|
434
|
+
children?: any
|
|
435
|
+
reset?: boolean
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export type ThemeState = {
|
|
439
|
+
id: string
|
|
440
|
+
name: string
|
|
441
|
+
theme: ThemeParsed
|
|
442
|
+
parentName?: string
|
|
443
|
+
isInverse?: boolean
|
|
444
|
+
isNew?: boolean
|
|
445
|
+
parentId?: string
|
|
446
|
+
scheme?: 'light' | 'dark'
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export interface Variable<A = any> {
|
|
450
|
+
isVar: true
|
|
451
|
+
variable?: string
|
|
452
|
+
val: A
|
|
453
|
+
name: string
|
|
454
|
+
key: string
|
|
455
|
+
needsPx?: boolean // Flag to indicate this token should get px units
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export type MakeVariable<A = any> = A extends string | number ? Variable<A> : A
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Type for the px helper object that indicates a token value needs px units
|
|
462
|
+
*/
|
|
463
|
+
export interface PxValue {
|
|
464
|
+
val: number
|
|
465
|
+
needsPx: true
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export type ColorScheme = 'light' | 'dark'
|
|
469
|
+
|
|
470
|
+
export type IsMediaType = boolean | 'platform' | 'theme' | 'group'
|
|
471
|
+
|
|
472
|
+
export type MaybeGuiComponent<A = any> = GuiComponent<A> | React.FC<A>
|
|
473
|
+
|
|
474
|
+
type MeasureOnSuccessCallback = (
|
|
475
|
+
x: number,
|
|
476
|
+
y: number,
|
|
477
|
+
width: number,
|
|
478
|
+
height: number,
|
|
479
|
+
pageX: number,
|
|
480
|
+
pageY: number
|
|
481
|
+
) => void
|
|
482
|
+
|
|
483
|
+
type MeasureInWindowOnSuccessCallback = (
|
|
484
|
+
x: number,
|
|
485
|
+
y: number,
|
|
486
|
+
width: number,
|
|
487
|
+
height: number
|
|
488
|
+
) => void
|
|
489
|
+
|
|
490
|
+
type MeasureLayoutOnSuccessCallback = (
|
|
491
|
+
left: number,
|
|
492
|
+
top: number,
|
|
493
|
+
width: number,
|
|
494
|
+
height: number
|
|
495
|
+
) => void
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Methods added to element refs that work across web and native.
|
|
499
|
+
* On web these are added at runtime to HTMLElements.
|
|
500
|
+
* On native these exist on View already.
|
|
501
|
+
*/
|
|
502
|
+
export interface GuiElementMethods {
|
|
503
|
+
measure(callback: MeasureOnSuccessCallback): void
|
|
504
|
+
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void
|
|
505
|
+
measureLayout(
|
|
506
|
+
relativeToNativeNode: View | HTMLElement,
|
|
507
|
+
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
508
|
+
onFail?: () => void
|
|
509
|
+
): void
|
|
510
|
+
focus(): void
|
|
511
|
+
blur(): void
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Cross-platform element ref type. On web, includes GuiElementMethods
|
|
516
|
+
* (measure, focus, blur) which Hanzo GUI adds at runtime. On native, View
|
|
517
|
+
* already has these via NativeMethods.
|
|
518
|
+
*/
|
|
519
|
+
export type GuiElement = (HTMLElement & GuiElementMethods) | View
|
|
520
|
+
export type GuiTextElement = (HTMLElement & GuiElementMethods) | RNText
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Web-specific element type for platform-specific .tsx files.
|
|
524
|
+
* Use when you need HTMLElement subtype properties (e.g., selectionStart on HTMLInputElement)
|
|
525
|
+
* that aren't on the cross-platform GuiElement type.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* const ref = useRef<GuiWebElement<HTMLInputElement>>(null)
|
|
529
|
+
* // ref.current has both HTMLInputElement props and GuiElementMethods
|
|
530
|
+
*/
|
|
531
|
+
export type GuiWebElement<T extends HTMLElement = HTMLElement> = T &
|
|
532
|
+
GuiElementMethods
|
|
533
|
+
|
|
534
|
+
export type DebugProp = boolean | 'break' | 'verbose' | 'visualize' | 'profile'
|
|
535
|
+
|
|
536
|
+
export interface GuiComponentPropsBase
|
|
537
|
+
extends GuiComponentPropsBaseBase, WebOnlyPressEvents {}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* For static / studio
|
|
541
|
+
*/
|
|
542
|
+
|
|
543
|
+
type NameToPaths = {
|
|
544
|
+
[key: string]: Set<string>
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export type LoadedComponents = {
|
|
548
|
+
moduleName: string
|
|
549
|
+
nameToInfo: Record<
|
|
550
|
+
string,
|
|
551
|
+
{
|
|
552
|
+
staticConfig: StaticConfig
|
|
553
|
+
}
|
|
554
|
+
>
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export type GuiProjectInfo = {
|
|
558
|
+
components: LoadedComponents[]
|
|
559
|
+
guiConfig: GuiInternalConfig
|
|
560
|
+
nameToPaths: NameToPaths
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// base props that are accepted by createComponent (additional to react-native-web)
|
|
564
|
+
|
|
565
|
+
export type DivAttributes = HTMLAttributes<HTMLDivElement>
|
|
566
|
+
|
|
567
|
+
export type ReactComponentWithRef<Props, Ref> = ForwardRefExoticComponent<
|
|
568
|
+
Props & RefAttributes<Ref>
|
|
569
|
+
>
|
|
570
|
+
|
|
571
|
+
// needs to be cb style for subscribeToContextGroup to be able to poke through to last state
|
|
572
|
+
export type ComponentSetStateShallow = React.Dispatch<
|
|
573
|
+
React.SetStateAction<Partial<GuiComponentState>>
|
|
574
|
+
>
|
|
575
|
+
|
|
576
|
+
export type ComponentContextI = {
|
|
577
|
+
disableSSR?: boolean
|
|
578
|
+
inText: boolean
|
|
579
|
+
language: LanguageContextType | null
|
|
580
|
+
animationDriver: AnimationDriver | null
|
|
581
|
+
setParentFocusState: ComponentSetStateShallow | null
|
|
582
|
+
mediaEmit?: (state: UseMediaState) => void
|
|
583
|
+
mediaEmitListeners?: Set<(state: UseMediaState) => void>
|
|
584
|
+
insets?: { top: number; right: number; bottom: number; left: number } | null
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export type GuiComponentStateRef = {
|
|
588
|
+
startedUnhydrated: boolean
|
|
589
|
+
|
|
590
|
+
host?: GuiElement
|
|
591
|
+
composedRef?: (x: GuiElement) => void
|
|
592
|
+
willHydrate?: boolean
|
|
593
|
+
hasMeasured?: boolean
|
|
594
|
+
hasAnimated?: boolean
|
|
595
|
+
themeShallow?: boolean
|
|
596
|
+
hasEverThemed?: boolean | 'wrapped'
|
|
597
|
+
hasEverResetPresence?: boolean
|
|
598
|
+
hasHadEvents?: boolean
|
|
599
|
+
isListeningToTheme?: boolean
|
|
600
|
+
unPress?: Function
|
|
601
|
+
setStateShallow?: ComponentSetStateShallow
|
|
602
|
+
useStyleListener?: UseStyleListener
|
|
603
|
+
updateStyleListener?: () => void
|
|
604
|
+
|
|
605
|
+
// this is only used by group="" components
|
|
606
|
+
// sets up a context object to track current state + emit
|
|
607
|
+
group?: ComponentGroupEmitter
|
|
608
|
+
|
|
609
|
+
// avoid re-render animation support
|
|
610
|
+
nextState?: GuiComponentState
|
|
611
|
+
nextMedia?: UseMediaState
|
|
612
|
+
|
|
613
|
+
// cleanup function for media emit listener
|
|
614
|
+
mediaEmitCleanup?: () => void
|
|
615
|
+
|
|
616
|
+
// previous pseudo state for detecting enter vs exit transitions
|
|
617
|
+
prevPseudoState?: {
|
|
618
|
+
hover?: boolean
|
|
619
|
+
press?: boolean
|
|
620
|
+
focus?: boolean
|
|
621
|
+
groups?: Record<string, { hover?: boolean; press?: boolean; focus?: boolean }>
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export type ComponentGroupEmitter = {
|
|
626
|
+
listeners: Set<GroupStateListener>
|
|
627
|
+
emit: GroupStateListener
|
|
628
|
+
subscribe: (cb: GroupStateListener) => () => void
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export type WidthHeight = {
|
|
632
|
+
width: number
|
|
633
|
+
height: number
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export type ChildGroupState = {
|
|
637
|
+
pseudo?: PseudoGroupState
|
|
638
|
+
media?: Record<MediaQueryKey extends number ? never : MediaQueryKey, boolean>
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
export type ComponentGroupState = {
|
|
642
|
+
pseudo?: PseudoGroupState
|
|
643
|
+
layout?: WidthHeight
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export type GroupStateListener = (state: ComponentGroupState) => void
|
|
647
|
+
|
|
648
|
+
export type SingleGroupContext = {
|
|
649
|
+
subscribe: (cb: GroupStateListener) => DisposeFn
|
|
650
|
+
state: ComponentGroupState
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export type AllGroupContexts = {
|
|
654
|
+
[GroupName: string]: SingleGroupContext
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export type PseudoGroupState = Pick<
|
|
658
|
+
GuiComponentState,
|
|
659
|
+
'disabled' | 'hover' | 'press' | 'pressIn' | 'focus' | 'focusVisible' | 'focusWithin'
|
|
660
|
+
>
|
|
661
|
+
|
|
662
|
+
export type LayoutEvent = {
|
|
663
|
+
nativeEvent: {
|
|
664
|
+
layout: LayoutValue
|
|
665
|
+
target: any
|
|
666
|
+
}
|
|
667
|
+
timeStamp: number
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
type LayoutValue = {
|
|
671
|
+
x: number
|
|
672
|
+
y: number
|
|
673
|
+
width: number
|
|
674
|
+
height: number
|
|
675
|
+
left: number
|
|
676
|
+
top: number
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export type DisposeFn = () => void
|
|
680
|
+
|
|
681
|
+
export type ConfigListener = (conf: GuiInternalConfig) => void
|
|
682
|
+
|
|
683
|
+
// to prevent things from going circular, hoisting some types in this file
|
|
684
|
+
// to generally order them as building up towards GuiConfig
|
|
685
|
+
|
|
686
|
+
export type VariableVal = number | string | Variable | VariableValGeneric | PxValue
|
|
687
|
+
export type VariableColorVal = string | Variable
|
|
688
|
+
|
|
689
|
+
type GenericKey = string
|
|
690
|
+
|
|
691
|
+
export type CreateTokens<Val extends VariableVal = VariableVal> = Record<
|
|
692
|
+
string,
|
|
693
|
+
{ [key: GenericKey]: Val }
|
|
694
|
+
> & {
|
|
695
|
+
color?: { [key: GenericKey]: Val }
|
|
696
|
+
space?: { [key: GenericKey]: Val }
|
|
697
|
+
size?: { [key: GenericKey]: Val }
|
|
698
|
+
radius?: { [key: GenericKey]: Val }
|
|
699
|
+
zIndex?: { [key: GenericKey]: Val }
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export type TokenCategories = 'color' | 'space' | 'size' | 'radius' | 'zIndex'
|
|
703
|
+
|
|
704
|
+
type Tokenify<A extends GenericTokens> = Omit<
|
|
705
|
+
{
|
|
706
|
+
[Key in keyof A]: TokenifyRecord<A[Key]>
|
|
707
|
+
},
|
|
708
|
+
TokenCategories
|
|
709
|
+
> & {
|
|
710
|
+
color: TokenifyRecord<A extends { color: any } ? A['color'] : {}>
|
|
711
|
+
space: TokenifyRecord<A extends { space: any } ? A['space'] : {}>
|
|
712
|
+
size: TokenifyRecord<A extends { size: any } ? A['size'] : {}>
|
|
713
|
+
radius: TokenifyRecord<A extends { radius: any } ? A['radius'] : {}>
|
|
714
|
+
zIndex: TokenifyRecord<A extends { zIndex: any } ? A['zIndex'] : {}>
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
type TokenifyRecord<A extends object> = {
|
|
718
|
+
[Key in keyof A]: CoerceToVariable<A[Key]>
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
type CoerceToVariable<A> = A extends Variable ? A : Variable<A>
|
|
722
|
+
|
|
723
|
+
export type GuiBaseTheme = {
|
|
724
|
+
// defined for our hanzo-gui kit , we could do this inside `gui`
|
|
725
|
+
// but maybe helpful to have some sort of universally shared things +
|
|
726
|
+
// + enforce if they want their own, redefine in their design sys
|
|
727
|
+
background: VariableColorVal
|
|
728
|
+
backgroundHover: VariableColorVal
|
|
729
|
+
backgroundPress: VariableColorVal
|
|
730
|
+
backgroundFocus: VariableColorVal
|
|
731
|
+
color: VariableColorVal
|
|
732
|
+
colorHover: VariableColorVal
|
|
733
|
+
colorPress: VariableColorVal
|
|
734
|
+
colorFocus: VariableColorVal
|
|
735
|
+
borderColor: VariableColorVal
|
|
736
|
+
borderColorHover: VariableColorVal
|
|
737
|
+
borderColorPress: VariableColorVal
|
|
738
|
+
borderColorFocus: VariableColorVal
|
|
739
|
+
shadowColor: VariableColorVal
|
|
740
|
+
shadowColorHover: VariableColorVal
|
|
741
|
+
shadowColorPress: VariableColorVal
|
|
742
|
+
shadowColorFocus: VariableColorVal
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export type VariableValGeneric = { __generic: 1 }
|
|
746
|
+
|
|
747
|
+
type GenericTokens = CreateTokens
|
|
748
|
+
type GenericThemes = {
|
|
749
|
+
[key: string]: Partial<GuiBaseTheme> & {
|
|
750
|
+
[key: string]: VariableVal
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export type CreateShorthands = {
|
|
755
|
+
// for some reason using keyof ViewStyle here will cause type circularity on react native 0.71
|
|
756
|
+
[key: string]: string
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export type GenericShorthands = {}
|
|
760
|
+
|
|
761
|
+
// sm: { minWidth: 100 }
|
|
762
|
+
type GenericMedia = {
|
|
763
|
+
[key: string]: {
|
|
764
|
+
[key: string]: number | string
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
export type GenericFonts = Record<string, GenericFont>
|
|
769
|
+
|
|
770
|
+
type GenericAnimations = {
|
|
771
|
+
[key: string]:
|
|
772
|
+
| string
|
|
773
|
+
| {
|
|
774
|
+
[key: string]: any
|
|
775
|
+
}
|
|
776
|
+
| any[]
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// this is the "main" typed object, which users re-define
|
|
780
|
+
// (internal) keep all types directly on this object and reference them from elsewhere
|
|
781
|
+
//
|
|
782
|
+
// const config = createGui(...)
|
|
783
|
+
// type MyConfig = typeof config
|
|
784
|
+
// declare module '@hanzo/gui' {
|
|
785
|
+
// export interface GuiCustomConfig extends MyConfig {}
|
|
786
|
+
// }
|
|
787
|
+
// now your whole app/kit should be typed correctly
|
|
788
|
+
//
|
|
789
|
+
export interface GuiCustomConfig {}
|
|
790
|
+
|
|
791
|
+
export interface GuiConfig
|
|
792
|
+
extends Omit<GenericGuiConfig, keyof GuiCustomConfig>, GuiCustomConfig {}
|
|
793
|
+
|
|
794
|
+
export type OnlyAllowShorthandsSetting = GuiConfig['settings'] extends {
|
|
795
|
+
onlyAllowShorthands: infer X
|
|
796
|
+
}
|
|
797
|
+
? X
|
|
798
|
+
: false
|
|
799
|
+
|
|
800
|
+
export type OnlyShorthandStylePropsSetting = GuiConfig['settings'] extends {
|
|
801
|
+
onlyShorthandStyleProps: infer X
|
|
802
|
+
}
|
|
803
|
+
? X
|
|
804
|
+
: false
|
|
805
|
+
|
|
806
|
+
export type CreateGuiConfig<
|
|
807
|
+
A extends GenericTokens,
|
|
808
|
+
B extends GenericThemes,
|
|
809
|
+
C extends GenericShorthands = GenericShorthands,
|
|
810
|
+
D extends GenericMedia = GenericMedia,
|
|
811
|
+
E extends GenericAnimations = GenericAnimations,
|
|
812
|
+
F extends GenericFonts = GenericFonts,
|
|
813
|
+
H extends GenericGuiSettings = GenericGuiSettings,
|
|
814
|
+
// preserve the raw animation driver keys ('default' | 'css' | etc)
|
|
815
|
+
// defaults to string so generic GuiInternalConfig accepts any driver keys
|
|
816
|
+
AnimDriverKeys extends string = string,
|
|
817
|
+
> = {
|
|
818
|
+
fonts: RemoveLanguagePostfixes<F>
|
|
819
|
+
fontLanguages: GetLanguagePostfixes<F> extends never
|
|
820
|
+
? string[]
|
|
821
|
+
: GetLanguagePostfixes<F>[]
|
|
822
|
+
tokens: A
|
|
823
|
+
// parsed
|
|
824
|
+
themes: {
|
|
825
|
+
[Name in keyof B]: {
|
|
826
|
+
[Key in keyof B[Name]]: CoerceToVariable<B[Name][Key]>
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
shorthands: C
|
|
830
|
+
media: D
|
|
831
|
+
// Support both single driver and multi-driver config
|
|
832
|
+
// Multi-driver: { default: cssDriver, spring: motiDriver }
|
|
833
|
+
// Single: AnimationDriver<E>
|
|
834
|
+
animations: AnimationDriver<E> | AnimationsConfigObject
|
|
835
|
+
// phantom type for preserving driver keys - never set at runtime, only for type inference
|
|
836
|
+
animationDriverKeys?: AnimDriverKeys
|
|
837
|
+
settings: H
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
type GetLanguagePostfix<Set> = Set extends string
|
|
841
|
+
? Set extends `${string}_${infer Postfix}`
|
|
842
|
+
? Postfix
|
|
843
|
+
: never
|
|
844
|
+
: never
|
|
845
|
+
|
|
846
|
+
type OmitLanguagePostfix<Set> = Set extends string
|
|
847
|
+
? Set extends `${infer Prefix}_${string}`
|
|
848
|
+
? Prefix
|
|
849
|
+
: Set
|
|
850
|
+
: never
|
|
851
|
+
|
|
852
|
+
type RemoveLanguagePostfixes<F extends GenericFonts> = {
|
|
853
|
+
[Key in OmitLanguagePostfix<keyof F>]: F[Key]
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
type GetLanguagePostfixes<F extends GenericFonts> = GetLanguagePostfix<keyof F>
|
|
857
|
+
|
|
858
|
+
// test RemoveLanguagePostfixes
|
|
859
|
+
// type x = CreateGuiConfig<any, any, any, any, any, {
|
|
860
|
+
// body: any,
|
|
861
|
+
// body_en: any
|
|
862
|
+
// }>['fonts']
|
|
863
|
+
|
|
864
|
+
type ConfProps<A, B, C, D, E, F, I> = {
|
|
865
|
+
tokens?: A
|
|
866
|
+
themes?: B
|
|
867
|
+
shorthands?: C
|
|
868
|
+
media?: D
|
|
869
|
+
animations?: E
|
|
870
|
+
fonts?: F
|
|
871
|
+
settings?: I
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
type EmptyTokens = {
|
|
875
|
+
color: {}
|
|
876
|
+
space: {}
|
|
877
|
+
size: {}
|
|
878
|
+
radius: {}
|
|
879
|
+
zIndex: {}
|
|
880
|
+
}
|
|
881
|
+
type EmptyThemes = {}
|
|
882
|
+
type EmptyShorthands = {}
|
|
883
|
+
type EmptyMedia = {}
|
|
884
|
+
type EmptyAnimations = {}
|
|
885
|
+
type EmptyFonts = {}
|
|
886
|
+
|
|
887
|
+
type EmptyGuiSettings = {
|
|
888
|
+
allowedStyleValues: false
|
|
889
|
+
autocompleteSpecificTokens: 'except-special'
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// Helper to extract animation config from AnimationDriver<Config> or multi-driver object
|
|
893
|
+
type ExtractAnimationConfig<E> =
|
|
894
|
+
E extends AnimationDriver<infer Config>
|
|
895
|
+
? Config
|
|
896
|
+
: E extends { default: AnimationDriver<infer Config> }
|
|
897
|
+
? Config
|
|
898
|
+
: E extends GenericAnimations
|
|
899
|
+
? E
|
|
900
|
+
: EmptyAnimations
|
|
901
|
+
|
|
902
|
+
// Helper to extract animation driver keys from raw animations prop
|
|
903
|
+
// Single driver: returns 'default'
|
|
904
|
+
// Multi-driver { default: x, css: y }: returns 'default' | 'css'
|
|
905
|
+
type ExtractAnimationDriverKeys<E> =
|
|
906
|
+
E extends AnimationDriver<any>
|
|
907
|
+
? 'default'
|
|
908
|
+
: E extends { default: AnimationDriver<any> }
|
|
909
|
+
? Extract<keyof E, string>
|
|
910
|
+
: 'default'
|
|
911
|
+
|
|
912
|
+
export type InferGuiConfig<Conf> =
|
|
913
|
+
Conf extends ConfProps<infer A, infer B, infer C, infer D, infer E, infer F, infer H>
|
|
914
|
+
? GuiInternalConfig<
|
|
915
|
+
A extends GenericTokens ? A : EmptyTokens,
|
|
916
|
+
B extends GenericThemes ? B : EmptyThemes,
|
|
917
|
+
C extends GenericShorthands ? C : EmptyShorthands,
|
|
918
|
+
D extends GenericMedia ? D : EmptyMedia,
|
|
919
|
+
ExtractAnimationConfig<E>,
|
|
920
|
+
F extends GenericFonts ? F : EmptyFonts,
|
|
921
|
+
H extends GenericGuiSettings ? H : EmptyGuiSettings,
|
|
922
|
+
ExtractAnimationDriverKeys<E>
|
|
923
|
+
>
|
|
924
|
+
: unknown
|
|
925
|
+
|
|
926
|
+
// for use in creation functions so it doesnt get overwritten
|
|
927
|
+
export type GenericGuiConfig = CreateGuiConfig<
|
|
928
|
+
GenericTokens,
|
|
929
|
+
GenericThemes,
|
|
930
|
+
GenericShorthands,
|
|
931
|
+
GenericMedia,
|
|
932
|
+
GenericAnimations,
|
|
933
|
+
GenericFonts
|
|
934
|
+
>
|
|
935
|
+
|
|
936
|
+
// try and find the top level types as they can be supersets:
|
|
937
|
+
type NonSubThemeNames<A extends string | number> = A extends `${string}_${string}`
|
|
938
|
+
? never
|
|
939
|
+
: A
|
|
940
|
+
type BaseThemeDefinitions = GuiConfig['themes'][NonSubThemeNames<
|
|
941
|
+
keyof GuiConfig['themes']
|
|
942
|
+
>]
|
|
943
|
+
type GenericThemeDefinition = GuiConfig['themes'][keyof GuiConfig['themes']]
|
|
944
|
+
export type ThemeDefinition = BaseThemeDefinitions extends never
|
|
945
|
+
? GenericThemeDefinition
|
|
946
|
+
: BaseThemeDefinitions
|
|
947
|
+
export type ThemeKeys = keyof ThemeDefinition
|
|
948
|
+
export type ThemeParsed = {
|
|
949
|
+
[key in ThemeKeys]: CoerceToVariable<ThemeDefinition[key]>
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
export type Tokens = GuiConfig['tokens']
|
|
953
|
+
|
|
954
|
+
export type TokensParsed = {
|
|
955
|
+
[Key in keyof Required<Tokens>]: TokenPrefixed<Tokens[Key]>
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
type TokenPrefixed<A extends { [key: string]: any }> = {
|
|
959
|
+
[Key in Ensure$Prefix<keyof A> | keyof A]: A[keyof A]
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
type Ensure$Prefix<A extends string | number | symbol> = A extends
|
|
963
|
+
| string
|
|
964
|
+
| number
|
|
965
|
+
| boolean
|
|
966
|
+
? A extends `$${string | number}`
|
|
967
|
+
? A
|
|
968
|
+
: `$${A}`
|
|
969
|
+
: never
|
|
970
|
+
|
|
971
|
+
export type TokensMerged = TokensParsed & Tokens
|
|
972
|
+
|
|
973
|
+
export type Shorthands = GuiConfig['shorthands']
|
|
974
|
+
export type Media = GuiConfig['media']
|
|
975
|
+
export type Themes = GuiConfig['themes']
|
|
976
|
+
export type ThemeName = Exclude<GetAltThemeNames<keyof Themes>, number>
|
|
977
|
+
export type ThemeTokens = `$${ThemeKeys}`
|
|
978
|
+
// Animation names (slow, fast, bouncy) for the `transition` prop
|
|
979
|
+
// Extract animation keys from the driver's `animations` property
|
|
980
|
+
// The AnimationDriver<Config> has an `animations: Config` property
|
|
981
|
+
// Use Extract<keyof A, string> to filter out number/symbol keys from fallback case
|
|
982
|
+
type GetAnimationsFromDriver<T> = T extends { animations: infer A }
|
|
983
|
+
? Extract<keyof A, string>
|
|
984
|
+
: never
|
|
985
|
+
|
|
986
|
+
// For multi-driver configs like { default: AnimationDriver, css: AnimationDriver }
|
|
987
|
+
// Extract from the 'default' driver or first driver found
|
|
988
|
+
type GetAnimationsFromMultiDriver<T> = T extends { default: infer D }
|
|
989
|
+
? GetAnimationsFromDriver<D>
|
|
990
|
+
: T extends { [key: string]: infer D }
|
|
991
|
+
? GetAnimationsFromDriver<D>
|
|
992
|
+
: never
|
|
993
|
+
|
|
994
|
+
// Extract just the AnimationDriver from the union (excluding AnimationsConfigObject)
|
|
995
|
+
type ExtractDriver<T> = Extract<T, AnimationDriver<any>>
|
|
996
|
+
|
|
997
|
+
// Main extraction - use Extract to get AnimationDriver from union, then get keys
|
|
998
|
+
type InferredTransitionKeys =
|
|
999
|
+
ExtractDriver<GuiConfig['animations']> extends AnimationDriver<any>
|
|
1000
|
+
? GetAnimationsFromDriver<ExtractDriver<GuiConfig['animations']>>
|
|
1001
|
+
: GetAnimationsFromMultiDriver<GuiConfig['animations']>
|
|
1002
|
+
|
|
1003
|
+
export type TransitionKeys = InferredTransitionKeys
|
|
1004
|
+
|
|
1005
|
+
// Driver keys (default, css, spring) for the `animatedBy` prop
|
|
1006
|
+
// Gets driver keys directly from GuiConfig.animationDriverKeys
|
|
1007
|
+
// Falls back to 'default' only when GuiCustomConfig is empty (no augmentation)
|
|
1008
|
+
// The Exclude<X, undefined> handles optional property, then we intersect with string
|
|
1009
|
+
// to ensure only string keys (not symbols/numbers)
|
|
1010
|
+
export type AnimationDriverKeys =
|
|
1011
|
+
| 'default'
|
|
1012
|
+
| Extract<Exclude<GuiConfig['animationDriverKeys'], undefined>, string>
|
|
1013
|
+
// add TypeOverride keys for lazy-loaded drivers
|
|
1014
|
+
| (ReturnType<TypeOverride['animationDrivers']> extends 1
|
|
1015
|
+
? never
|
|
1016
|
+
: ReturnType<TypeOverride['animationDrivers']>)
|
|
1017
|
+
|
|
1018
|
+
export type FontLanguages = ArrayIntersection<GuiConfig['fontLanguages']>
|
|
1019
|
+
|
|
1020
|
+
export interface ThemeProps {
|
|
1021
|
+
className?: string
|
|
1022
|
+
name?: Exclude<ThemeName, number> | null
|
|
1023
|
+
componentName?: string
|
|
1024
|
+
children?: any
|
|
1025
|
+
reset?: boolean
|
|
1026
|
+
debug?: DebugProp
|
|
1027
|
+
// on the web, for portals we need to re-insert className
|
|
1028
|
+
forceClassName?: boolean
|
|
1029
|
+
|
|
1030
|
+
// used internally for shallow themes
|
|
1031
|
+
shallow?: boolean
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// more low level
|
|
1035
|
+
export type UseThemeWithStateProps = ThemeProps & {
|
|
1036
|
+
deopt?: boolean
|
|
1037
|
+
passThrough?: boolean
|
|
1038
|
+
disable?: boolean
|
|
1039
|
+
needsUpdate?: () => boolean
|
|
1040
|
+
unstyled?: boolean
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
type ArrayIntersection<A extends any[]> = A[keyof A]
|
|
1044
|
+
|
|
1045
|
+
type GetAltThemeNames<S> =
|
|
1046
|
+
| (S extends `${infer Theme}_${infer Alt}` ? Theme | GetAltThemeNames<Alt> : S)
|
|
1047
|
+
| S
|
|
1048
|
+
|
|
1049
|
+
type AllowedValueSettingBase =
|
|
1050
|
+
| boolean
|
|
1051
|
+
| 'strict'
|
|
1052
|
+
| 'somewhat-strict'
|
|
1053
|
+
| 'strict-web'
|
|
1054
|
+
| 'somewhat-strict-web'
|
|
1055
|
+
|
|
1056
|
+
type AllowedStyleValuesSettingSize = AllowedValueSettingBase | 'number' | 'percent'
|
|
1057
|
+
type AllowedStyleValuesSettingZIndex = AllowedValueSettingBase | 'number'
|
|
1058
|
+
type AllowedStyleValuesSettingRadius = AllowedValueSettingBase | 'number'
|
|
1059
|
+
type AllowedStyleValuesSettingColor = AllowedValueSettingBase | 'named'
|
|
1060
|
+
|
|
1061
|
+
type AllowedStyleValuesSettingPerCategory = {
|
|
1062
|
+
space?: AllowedStyleValuesSettingSize
|
|
1063
|
+
size?: AllowedStyleValuesSettingSize
|
|
1064
|
+
radius?: AllowedStyleValuesSettingRadius
|
|
1065
|
+
zIndex?: AllowedStyleValuesSettingZIndex
|
|
1066
|
+
color?: AllowedStyleValuesSettingColor
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
type AllowedStyleValuesSetting =
|
|
1070
|
+
| AllowedValueSettingBase
|
|
1071
|
+
| AllowedStyleValuesSettingPerCategory
|
|
1072
|
+
|
|
1073
|
+
type AutocompleteSpecificTokensSetting = boolean | 'except-special'
|
|
1074
|
+
|
|
1075
|
+
export interface GenericGuiSettings {
|
|
1076
|
+
/**
|
|
1077
|
+
* When true, flexBasis will be set to 0 when flex is positive. This will be
|
|
1078
|
+
* the default in v2 of Hanzo GUI alongside an alternative mode for web compat.
|
|
1079
|
+
*/
|
|
1080
|
+
styleCompat?: 'react-native' | 'legacy'
|
|
1081
|
+
|
|
1082
|
+
// TODO
|
|
1083
|
+
/**
|
|
1084
|
+
* When true, Hanzo GUI will always prefer a more specific style prop over a
|
|
1085
|
+
* less specific one.
|
|
1086
|
+
*
|
|
1087
|
+
* By default, Hanzo GUI processes all style props in order of definition on the
|
|
1088
|
+
* object. This is a bit strange to most people, but it gets around many
|
|
1089
|
+
* annoying issues with specificity. You can see our docs on this here:
|
|
1090
|
+
* https://gui.hanzo.ai/docs/intro/styles#style-order-is-important
|
|
1091
|
+
*
|
|
1092
|
+
* But this can be confusing in simple cases, like when you do:
|
|
1093
|
+
*
|
|
1094
|
+
* <View paddingTop={0} padding={10} />
|
|
1095
|
+
*
|
|
1096
|
+
* This would set paddingTop ultimately to be 10, because padding comes after
|
|
1097
|
+
* paddingTop. When this setting is set to true, paddingTop will always beat
|
|
1098
|
+
* padding, because it is more specific.
|
|
1099
|
+
*
|
|
1100
|
+
* For variants, it will still take the prop order as definitive.
|
|
1101
|
+
*
|
|
1102
|
+
*
|
|
1103
|
+
* @default false
|
|
1104
|
+
*/
|
|
1105
|
+
// preferSpecificStyleProps?: boolean
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Set up allowed values on style props, this is only a type-level validation.
|
|
1109
|
+
*
|
|
1110
|
+
* "strict" - only allows tokens for any token-enabled properties "strict-web"
|
|
1111
|
+
* - same as strict but allows for web-specific tokens like auto/inherit
|
|
1112
|
+
* "somewhat-strict" - allow tokens or: for space/size: string% or numbers for
|
|
1113
|
+
* radius: number for zIndex: number for color: named colors or rgba/hsla
|
|
1114
|
+
* strings "somewhat-strict-web" - same as somewhat-strict but allows for
|
|
1115
|
+
* web-specific tokens
|
|
1116
|
+
*
|
|
1117
|
+
* @default false - allows any string (or number for styles that accept
|
|
1118
|
+
* numbers)
|
|
1119
|
+
*
|
|
1120
|
+
*/
|
|
1121
|
+
allowedStyleValues?: AllowedStyleValuesSetting
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Set up if "specific tokens" ($color.name) are added to the types where
|
|
1125
|
+
* tokens are allowed. The VSCode autocomplete puts specific tokens above the
|
|
1126
|
+
* regular ones, which leads to worse DX. If true this setting removes the
|
|
1127
|
+
* specific token from types for the defined categories.
|
|
1128
|
+
*
|
|
1129
|
+
* If set to "except-special", specific tokens will autocomplete only if they
|
|
1130
|
+
* don't normally use one of the special token groups: space, size, radius,
|
|
1131
|
+
* zIndex, color.
|
|
1132
|
+
*
|
|
1133
|
+
* @default except-special
|
|
1134
|
+
*/
|
|
1135
|
+
autocompleteSpecificTokens?: AutocompleteSpecificTokensSetting
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* On iOS, this enables a mode where Hanzo GUI returns color values using
|
|
1139
|
+
* `DynamicColorIOS` This is a React Native built in feature, you can read the
|
|
1140
|
+
* docs here: https://reactnative.dev/docs/dynamiccolorios
|
|
1141
|
+
*
|
|
1142
|
+
* We're working to make this enabled by default without any setting, but
|
|
1143
|
+
* Hanzo GUI themes support inversing and/or changing to light/dark at any point
|
|
1144
|
+
* in the tree. We haven't implemented support for either of these cases when
|
|
1145
|
+
* combined with this feature.
|
|
1146
|
+
*
|
|
1147
|
+
* So - as long as you:
|
|
1148
|
+
*
|
|
1149
|
+
* 1. Only use light/dark changes of themes at the root of your app
|
|
1150
|
+
* 2. Always change light/dark alongside the Appearance.colorScheme
|
|
1151
|
+
*
|
|
1152
|
+
* Then this feature is safe to turn on and will significantly speed up
|
|
1153
|
+
* dark/light re-renders.
|
|
1154
|
+
*/
|
|
1155
|
+
fastSchemeChange?: boolean
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* On Web, this allows changing the behavior of container groups which by
|
|
1159
|
+
* default uses `container-type: inline-size`.
|
|
1160
|
+
*/
|
|
1161
|
+
webContainerType?:
|
|
1162
|
+
| 'normal'
|
|
1163
|
+
| 'size'
|
|
1164
|
+
| 'inline-size'
|
|
1165
|
+
| 'inherit'
|
|
1166
|
+
| 'initial'
|
|
1167
|
+
| 'revert'
|
|
1168
|
+
| 'revert-layer'
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Only allow shorthands when enabled. Recommended to be true to avoid having
|
|
1172
|
+
* two ways to style the same property.
|
|
1173
|
+
*/
|
|
1174
|
+
onlyAllowShorthands?: boolean | undefined
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Define a default font, for better types and default font on Text
|
|
1178
|
+
*/
|
|
1179
|
+
defaultFont?: string
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Web-only: define CSS text-selection styles
|
|
1183
|
+
*/
|
|
1184
|
+
selectionStyles?: (theme: Record<string, string>) => null | {
|
|
1185
|
+
backgroundColor?: any
|
|
1186
|
+
color?: any
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* If building a non-server rendered app, set this to true.
|
|
1191
|
+
*
|
|
1192
|
+
* For SSR compatibility on the web, Hanzo GUI will render once with the settings
|
|
1193
|
+
* from `mediaQueryDefaultActive` set for all media queries. Then, it will render
|
|
1194
|
+
* again after the initial render using the proper media query values. This is so that
|
|
1195
|
+
* hydration will match perfectly with the server.
|
|
1196
|
+
*
|
|
1197
|
+
* Setting disableSSR will avoid this second render by setting the media query state
|
|
1198
|
+
* to the actual browser dimensions on initial load. This is only useful for client-only
|
|
1199
|
+
* apps.
|
|
1200
|
+
*
|
|
1201
|
+
* @default false
|
|
1202
|
+
*
|
|
1203
|
+
*/
|
|
1204
|
+
disableSSR?: boolean
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* For the first render, determines which media queries are true, this only
|
|
1208
|
+
* affects things on native or on web if you disableSSR, as otherwise Gui
|
|
1209
|
+
* relies on CSS to avoid the need for re-rendering on first render.
|
|
1210
|
+
*/
|
|
1211
|
+
mediaQueryDefaultActive?: Record<string, boolean>
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Adds @media(prefers-color-scheme) media queries for dark/light, must be set
|
|
1215
|
+
* true if you are supporting system preference for light and dark mode themes
|
|
1216
|
+
*/
|
|
1217
|
+
shouldAddPrefersColorThemes?: boolean
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* If you want to style your <body> tag to use theme CSS variables on web, you
|
|
1221
|
+
* must place the theme className onto the body element or above. This will do so.
|
|
1222
|
+
* If disabled, Hanzo GUI will place the className onto the element rendered by
|
|
1223
|
+
* the GuiProvider
|
|
1224
|
+
*
|
|
1225
|
+
* @default html
|
|
1226
|
+
*/
|
|
1227
|
+
addThemeClassName?: 'body' | 'html' | false
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Sets the default position value for all Hanzo GUI components.
|
|
1231
|
+
* @default 'static'
|
|
1232
|
+
*/
|
|
1233
|
+
defaultPosition?: 'static' | 'relative'
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Sets the base font size for rem calculations on native platforms.
|
|
1237
|
+
* On web, browsers use the root font size (typically 16px).
|
|
1238
|
+
* @default 16
|
|
1239
|
+
*/
|
|
1240
|
+
remBaseFontSize?: number
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* When true, removes the individual longhand style props for border,
|
|
1244
|
+
* outline, and shadow (borderWidth, borderStyle, borderColor,
|
|
1245
|
+
* outlineWidth, outlineStyle, outlineColor, outlineOffset,
|
|
1246
|
+
* shadowColor, shadowOffset, shadowOpacity, shadowRadius) from the
|
|
1247
|
+
* type system, encouraging use of the combined shorthand props instead
|
|
1248
|
+
* (`border`, `outline`, `boxShadow`).
|
|
1249
|
+
*
|
|
1250
|
+
* This avoids specificity issues when mixing shorthand and longhand
|
|
1251
|
+
* props in atomic CSS output.
|
|
1252
|
+
*
|
|
1253
|
+
* Note: this is type-level only - it does not change runtime behavior.
|
|
1254
|
+
*
|
|
1255
|
+
* @default false
|
|
1256
|
+
*/
|
|
1257
|
+
onlyShorthandStyleProps?: boolean
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export type GuiSettings = GuiConfig['settings']
|
|
1261
|
+
|
|
1262
|
+
export type BaseStyleProps = {
|
|
1263
|
+
[Key in keyof TextStylePropsBase]?: TextStyle[Key] | GetThemeValueForKey<Key>
|
|
1264
|
+
} & {
|
|
1265
|
+
[Key in keyof StackStyleBase]?: StackStyle[Key] | GetThemeValueForKey<Key>
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Animation drivers config - can be a single driver or named drivers object.
|
|
1270
|
+
* If object, must include a 'default' key.
|
|
1271
|
+
*/
|
|
1272
|
+
export type AnimationsConfig = AnimationDriver<any> | AnimationsConfigObject
|
|
1273
|
+
|
|
1274
|
+
export type AnimationsConfigObject = {
|
|
1275
|
+
default: AnimationDriver<any>
|
|
1276
|
+
[key: string]: AnimationDriver<any>
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
export type CreateGuiProps = {
|
|
1280
|
+
reactNative?: any
|
|
1281
|
+
shorthands?: CreateShorthands
|
|
1282
|
+
media?: GenericGuiConfig['media']
|
|
1283
|
+
/**
|
|
1284
|
+
* Animation driver(s) configuration.
|
|
1285
|
+
* Can be a single driver or an object of named drivers (must include 'default').
|
|
1286
|
+
* @example
|
|
1287
|
+
* // Single driver
|
|
1288
|
+
* animations: createAnimations({ slow: '...', fast: '...' })
|
|
1289
|
+
* // Multiple named drivers
|
|
1290
|
+
* animations: { default: cssDriver, spring: motiDriver }
|
|
1291
|
+
*/
|
|
1292
|
+
animations?: AnimationsConfig
|
|
1293
|
+
fonts?: GenericGuiConfig['fonts']
|
|
1294
|
+
tokens?: GenericGuiConfig['tokens']
|
|
1295
|
+
themes?: {
|
|
1296
|
+
[key: string]: {
|
|
1297
|
+
[key: string]: string | number | Variable
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
settings?: Partial<GenericGuiSettings>
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Web-only: define text-selection CSS
|
|
1305
|
+
*/
|
|
1306
|
+
selectionStyles?: (theme: Record<string, string>) => null | {
|
|
1307
|
+
backgroundColor?: any
|
|
1308
|
+
color?: any
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
defaultProps?: Record<string, any> & {
|
|
1312
|
+
Text?: TextProps
|
|
1313
|
+
View?: StackNonStyleProps & StackStyle
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
export type GetCSS = (opts?: {
|
|
1318
|
+
separator?: string
|
|
1319
|
+
exclude?: 'themes' | 'design-system' | null
|
|
1320
|
+
sinceLastCall?: boolean
|
|
1321
|
+
}) => string
|
|
1322
|
+
|
|
1323
|
+
// this is the config generated via createGui()
|
|
1324
|
+
export type GuiInternalConfig<
|
|
1325
|
+
A extends GenericTokens = GenericTokens,
|
|
1326
|
+
B extends GenericThemes = GenericThemes,
|
|
1327
|
+
C extends GenericShorthands = GenericShorthands,
|
|
1328
|
+
D extends GenericMedia = GenericMedia,
|
|
1329
|
+
E extends GenericAnimations = GenericAnimations,
|
|
1330
|
+
F extends GenericFonts = GenericFonts,
|
|
1331
|
+
G extends GenericGuiSettings = GenericGuiSettings,
|
|
1332
|
+
// preserve the raw animation driver keys ('default' | 'css' | etc)
|
|
1333
|
+
// defaults to string so generic GuiInternalConfig accepts any driver keys
|
|
1334
|
+
AnimDriverKeys extends string = string,
|
|
1335
|
+
> = Omit<CreateGuiProps, keyof GenericGuiConfig> &
|
|
1336
|
+
Omit<CreateGuiConfig<A, B, C, D, E, F, G, AnimDriverKeys>, 'tokens'> & {
|
|
1337
|
+
// TODO need to make it this but this breaks types, revisit
|
|
1338
|
+
// animations: E //AnimationDriver<E>
|
|
1339
|
+
// with $ prefixes for fast lookups (one time cost at startup vs every render)
|
|
1340
|
+
tokens: Tokenify<A>
|
|
1341
|
+
tokensParsed: Tokenify<A>
|
|
1342
|
+
themeConfig: any
|
|
1343
|
+
fontsParsed: GenericFonts
|
|
1344
|
+
getCSS: GetCSS
|
|
1345
|
+
getNewCSS: GetCSS
|
|
1346
|
+
parsed: boolean
|
|
1347
|
+
inverseShorthands: Record<string, string>
|
|
1348
|
+
userShorthands: C
|
|
1349
|
+
reactNative?: any
|
|
1350
|
+
fontSizeTokens: Set<string>
|
|
1351
|
+
specificTokens: Record<string, Variable>
|
|
1352
|
+
settings: Omit<GenericGuiSettings, keyof G> & G
|
|
1353
|
+
defaultFont?: string
|
|
1354
|
+
defaultFontToken: `${string}`
|
|
1355
|
+
// multi-driver animation config (e.g., { default: motionDriver, css: cssDriver })
|
|
1356
|
+
// used for component-level driver selection via animatedBy prop
|
|
1357
|
+
animationDrivers?: Record<string, AnimationDriver>
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
export type GetAnimationKeys<A extends GenericGuiConfig> = keyof A['animations']
|
|
1361
|
+
|
|
1362
|
+
// prevents const intersections from being clobbered into string, keeping the consts
|
|
1363
|
+
export type UnionableString = string & {}
|
|
1364
|
+
export type UnionableNumber = number & {}
|
|
1365
|
+
|
|
1366
|
+
type GenericFontKey = string | number | symbol
|
|
1367
|
+
|
|
1368
|
+
export type GenericFont<Key extends GenericFontKey = GenericFontKey> = {
|
|
1369
|
+
size: { [key in Key]: number | Variable }
|
|
1370
|
+
family?: string | Variable
|
|
1371
|
+
lineHeight?: Partial<{ [key in Key]: number | Variable }> | undefined
|
|
1372
|
+
letterSpacing?: Partial<{ [key in Key]: number | Variable }> | undefined
|
|
1373
|
+
weight?: Partial<{ [key in Key]: number | string | Variable }> | undefined
|
|
1374
|
+
style?: Partial<{ [key in Key]: RNTextStyle['fontStyle'] | Variable }> | undefined
|
|
1375
|
+
transform?:
|
|
1376
|
+
| Partial<{ [key in Key]: RNTextStyle['textTransform'] | Variable }>
|
|
1377
|
+
| undefined
|
|
1378
|
+
color?: Partial<{ [key in Key]: string | Variable }> | undefined
|
|
1379
|
+
// for native use only, lets you map to alternative fonts
|
|
1380
|
+
face?:
|
|
1381
|
+
| Partial<{
|
|
1382
|
+
[key in FontWeightValues]: { normal?: string; italic?: string }
|
|
1383
|
+
}>
|
|
1384
|
+
| undefined
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// media
|
|
1388
|
+
export type MediaQueryObject = { [key: string]: string | number | string }
|
|
1389
|
+
export type MediaQueryKey = keyof Media
|
|
1390
|
+
export type MediaPropKeys = `$${MediaQueryKey}`
|
|
1391
|
+
export type MediaQueryState = { [key in MediaQueryKey]: boolean }
|
|
1392
|
+
|
|
1393
|
+
export type ThemeMediaKeys<TK extends keyof Themes = keyof Themes> =
|
|
1394
|
+
`$theme-${TK extends `${string}_${string}` ? never : TK}`
|
|
1395
|
+
|
|
1396
|
+
export type PlatformMediaKeys = `$platform-${AllPlatforms}`
|
|
1397
|
+
|
|
1398
|
+
export interface TypeOverride {
|
|
1399
|
+
groupNames(): 1
|
|
1400
|
+
animationDrivers(): 1
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
export type GroupNames =
|
|
1404
|
+
ReturnType<TypeOverride['groupNames']> extends 1
|
|
1405
|
+
? never
|
|
1406
|
+
: ReturnType<TypeOverride['groupNames']>
|
|
1407
|
+
|
|
1408
|
+
type ParentMediaStates = 'hover' | 'press' | 'focus' | 'focusVisible' | 'focusWithin'
|
|
1409
|
+
|
|
1410
|
+
export type GroupMediaKeys =
|
|
1411
|
+
| `$group-${GroupNames}`
|
|
1412
|
+
| `$group-${GroupNames}-${ParentMediaStates}`
|
|
1413
|
+
| `$group-${GroupNames}-${MediaQueryKey}`
|
|
1414
|
+
| `$group-${GroupNames}-${MediaQueryKey}-${ParentMediaStates}`
|
|
1415
|
+
| `$group-${ParentMediaStates}`
|
|
1416
|
+
| `$group-${MediaQueryKey}`
|
|
1417
|
+
| `$group-${MediaQueryKey}-${ParentMediaStates}`
|
|
1418
|
+
|
|
1419
|
+
export type WithMediaProps<A> = {
|
|
1420
|
+
[Key in
|
|
1421
|
+
| MediaPropKeys
|
|
1422
|
+
| GroupMediaKeys
|
|
1423
|
+
| ThemeMediaKeys
|
|
1424
|
+
| PlatformMediaKeys]?: Key extends MediaPropKeys
|
|
1425
|
+
? A & {
|
|
1426
|
+
// TODO we can support $theme- inside media queries here if we change to ThemeMediaKeys | PlatformMediaKeys
|
|
1427
|
+
[Key in PlatformMediaKeys]?: AddWebOnlyStyleProps<A>
|
|
1428
|
+
}
|
|
1429
|
+
: Key extends `$platform-web`
|
|
1430
|
+
? AddWebOnlyStyleProps<A>
|
|
1431
|
+
: A
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
type AddWebOnlyStyleProps<A> = {
|
|
1435
|
+
[SubKey in keyof A | keyof CSSProperties]?: SubKey extends keyof CSSProperties
|
|
1436
|
+
? CSSProperties[SubKey]
|
|
1437
|
+
: SubKey extends keyof A
|
|
1438
|
+
? A[SubKey]
|
|
1439
|
+
: SubKey extends keyof WebOnlyValidStyleValues
|
|
1440
|
+
? WebOnlyValidStyleValues[SubKey]
|
|
1441
|
+
: never
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
export type WebOnlyValidStyleValues = {
|
|
1445
|
+
position: '-webkit-sticky'
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
export type MediaQueries = {
|
|
1449
|
+
[key in MediaQueryKey]: MediaQueryObject
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
export interface MediaQueryList {
|
|
1453
|
+
addListener(listener?: any): void
|
|
1454
|
+
removeListener(listener?: any): void
|
|
1455
|
+
match?: (query: string, dimensions: { width: number; height: number }) => boolean
|
|
1456
|
+
matches: boolean
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
export type MatchMedia = (query: string) => MediaQueryList
|
|
1460
|
+
|
|
1461
|
+
// createComponent props helpers
|
|
1462
|
+
|
|
1463
|
+
// transition="bouncy"
|
|
1464
|
+
// transition={['bouncy', { }]}
|
|
1465
|
+
// { all: 'name' }
|
|
1466
|
+
|
|
1467
|
+
// TODO can override for better types
|
|
1468
|
+
export type AnimationConfigType = any
|
|
1469
|
+
|
|
1470
|
+
/**
|
|
1471
|
+
* Spring configuration parameters that can override preset defaults.
|
|
1472
|
+
* Use with array syntax: transition={['bouncy', { stiffness: 1000, damping: 70 }]}
|
|
1473
|
+
*/
|
|
1474
|
+
export type TransitionSpringConfig = {
|
|
1475
|
+
stiffness?: number
|
|
1476
|
+
damping?: number
|
|
1477
|
+
mass?: number
|
|
1478
|
+
tension?: number
|
|
1479
|
+
friction?: number
|
|
1480
|
+
velocity?: number
|
|
1481
|
+
overshootClamping?: boolean
|
|
1482
|
+
duration?: number
|
|
1483
|
+
bounciness?: number
|
|
1484
|
+
speed?: number
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
export type TransitionProp =
|
|
1488
|
+
| TransitionKeys
|
|
1489
|
+
| ({
|
|
1490
|
+
default?: TransitionKeys
|
|
1491
|
+
enter?: TransitionKeys
|
|
1492
|
+
exit?: TransitionKeys
|
|
1493
|
+
delay?: number
|
|
1494
|
+
} & TransitionSpringConfig & {
|
|
1495
|
+
[key: string]:
|
|
1496
|
+
| TransitionKeys
|
|
1497
|
+
| {
|
|
1498
|
+
type: TransitionKeys
|
|
1499
|
+
[key: string]: any
|
|
1500
|
+
}
|
|
1501
|
+
| number
|
|
1502
|
+
| boolean
|
|
1503
|
+
| undefined
|
|
1504
|
+
})
|
|
1505
|
+
| [
|
|
1506
|
+
TransitionKeys,
|
|
1507
|
+
{
|
|
1508
|
+
delay?: number
|
|
1509
|
+
enter?: TransitionKeys
|
|
1510
|
+
exit?: TransitionKeys
|
|
1511
|
+
} & TransitionSpringConfig & {
|
|
1512
|
+
[key: string]:
|
|
1513
|
+
| TransitionKeys
|
|
1514
|
+
| {
|
|
1515
|
+
type?: TransitionKeys
|
|
1516
|
+
[key: string]: any
|
|
1517
|
+
}
|
|
1518
|
+
| number
|
|
1519
|
+
| boolean
|
|
1520
|
+
| undefined
|
|
1521
|
+
},
|
|
1522
|
+
]
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Tokens
|
|
1526
|
+
*/
|
|
1527
|
+
|
|
1528
|
+
type PercentString = `${string}%` & {}
|
|
1529
|
+
type RemString = `${number}rem`
|
|
1530
|
+
|
|
1531
|
+
type SomewhatSpecificSizeValue = 'auto' | PercentString | RemString | UnionableNumber
|
|
1532
|
+
type SomewhatSpecificSpaceValue = 'auto' | PercentString | RemString | UnionableNumber
|
|
1533
|
+
|
|
1534
|
+
type VariableString = `var(${string})`
|
|
1535
|
+
|
|
1536
|
+
export type SomewhatSpecificColorValue =
|
|
1537
|
+
| CSSColorNames
|
|
1538
|
+
| 'transparent'
|
|
1539
|
+
| (`rgba(${string})` & {})
|
|
1540
|
+
| (`rgb(${string})` & {})
|
|
1541
|
+
| (`hsl(${string})` & {})
|
|
1542
|
+
| (`hsla(${string})` & {})
|
|
1543
|
+
| (`#${string}` & {})
|
|
1544
|
+
|
|
1545
|
+
type WebOnlySizeValue =
|
|
1546
|
+
| `${number}vw`
|
|
1547
|
+
| `${number}dvw`
|
|
1548
|
+
| `${number}lvw`
|
|
1549
|
+
| `${number}svw`
|
|
1550
|
+
| `${number}vh`
|
|
1551
|
+
| `${number}dvh`
|
|
1552
|
+
| `${number}lvh`
|
|
1553
|
+
| `${number}svh`
|
|
1554
|
+
| `calc(${string})`
|
|
1555
|
+
| `min(${string})`
|
|
1556
|
+
| `max(${string})`
|
|
1557
|
+
| 'max-content'
|
|
1558
|
+
| 'min-content'
|
|
1559
|
+
|
|
1560
|
+
type UserAllowedStyleValuesSetting = Exclude<
|
|
1561
|
+
GuiSettings['allowedStyleValues'],
|
|
1562
|
+
undefined
|
|
1563
|
+
>
|
|
1564
|
+
|
|
1565
|
+
export type GetThemeValueSettingForCategory<
|
|
1566
|
+
Cat extends keyof AllowedStyleValuesSettingPerCategory,
|
|
1567
|
+
> = UserAllowedStyleValuesSetting extends AllowedValueSettingBase | undefined
|
|
1568
|
+
? UserAllowedStyleValuesSetting
|
|
1569
|
+
: UserAllowedStyleValuesSetting extends AllowedStyleValuesSettingPerCategory
|
|
1570
|
+
? UserAllowedStyleValuesSetting[Cat]
|
|
1571
|
+
: true
|
|
1572
|
+
|
|
1573
|
+
export type GetThemeValueFallbackFor<
|
|
1574
|
+
Setting,
|
|
1575
|
+
StrictValue,
|
|
1576
|
+
SomewhatStrictValue,
|
|
1577
|
+
LooseValue,
|
|
1578
|
+
WebOnlyValue,
|
|
1579
|
+
> = Setting extends 'strict'
|
|
1580
|
+
? StrictValue
|
|
1581
|
+
: Setting extends 'strict-web'
|
|
1582
|
+
? StrictValue | WebOnlyValue
|
|
1583
|
+
: Setting extends 'somewhat-strict'
|
|
1584
|
+
? SomewhatStrictValue
|
|
1585
|
+
: Setting extends 'somewhat-strict-web'
|
|
1586
|
+
? SomewhatStrictValue | WebOnlyValue
|
|
1587
|
+
: LooseValue
|
|
1588
|
+
|
|
1589
|
+
// the most generic fallback for anything not covered by special values
|
|
1590
|
+
export type ThemeValueFallback =
|
|
1591
|
+
// for backwards compat with overriding the type we make this either UnionableString
|
|
1592
|
+
// or never if they don't define any UserAllowedStyleValuesSetting
|
|
1593
|
+
| (GuiSettings extends { allowedStyleValues: any } ? never : UnionableString)
|
|
1594
|
+
| Variable
|
|
1595
|
+
|
|
1596
|
+
export type AllowedValueSettingSpace = GetThemeValueSettingForCategory<'space'>
|
|
1597
|
+
export type AllowedValueSettingSize = GetThemeValueSettingForCategory<'size'>
|
|
1598
|
+
export type AllowedValueSettingColor = GetThemeValueSettingForCategory<'color'>
|
|
1599
|
+
export type AllowedValueSettingZIndex = GetThemeValueSettingForCategory<'zIndex'>
|
|
1600
|
+
export type AllowedValueSettingRadius = GetThemeValueSettingForCategory<'radius'>
|
|
1601
|
+
|
|
1602
|
+
export type WebStyleValueUniversal = 'unset' | 'inherit' | VariableString
|
|
1603
|
+
|
|
1604
|
+
export type ThemeValueFallbackSpace =
|
|
1605
|
+
| ThemeValueFallback
|
|
1606
|
+
| GetThemeValueFallbackFor<
|
|
1607
|
+
AllowedValueSettingSpace,
|
|
1608
|
+
never,
|
|
1609
|
+
SomewhatSpecificSpaceValue,
|
|
1610
|
+
UnionableString | UnionableNumber,
|
|
1611
|
+
WebStyleValueUniversal | WebOnlySizeValue
|
|
1612
|
+
>
|
|
1613
|
+
|
|
1614
|
+
export type SpaceValue = number | SpaceTokens | ThemeValueFallback
|
|
1615
|
+
|
|
1616
|
+
export type ThemeValueFallbackSize = GetThemeValueFallbackFor<
|
|
1617
|
+
AllowedValueSettingSize,
|
|
1618
|
+
never,
|
|
1619
|
+
SomewhatSpecificSizeValue,
|
|
1620
|
+
UnionableString | UnionableNumber,
|
|
1621
|
+
WebStyleValueUniversal | WebOnlySizeValue
|
|
1622
|
+
>
|
|
1623
|
+
|
|
1624
|
+
export type ThemeValueFallbackColor =
|
|
1625
|
+
| ThemeValueFallback
|
|
1626
|
+
| GetThemeValueFallbackFor<
|
|
1627
|
+
AllowedValueSettingColor,
|
|
1628
|
+
never,
|
|
1629
|
+
SomewhatSpecificColorValue,
|
|
1630
|
+
UnionableString | UnionableNumber,
|
|
1631
|
+
WebStyleValueUniversal
|
|
1632
|
+
>
|
|
1633
|
+
|
|
1634
|
+
export type ThemeValueFallbackRadius =
|
|
1635
|
+
| ThemeValueFallback
|
|
1636
|
+
| GetThemeValueFallbackFor<
|
|
1637
|
+
AllowedValueSettingRadius,
|
|
1638
|
+
never,
|
|
1639
|
+
UnionableNumber,
|
|
1640
|
+
UnionableNumber,
|
|
1641
|
+
WebStyleValueUniversal
|
|
1642
|
+
>
|
|
1643
|
+
|
|
1644
|
+
export type ThemeValueFallbackZIndex =
|
|
1645
|
+
| ThemeValueFallback
|
|
1646
|
+
| GetThemeValueFallbackFor<
|
|
1647
|
+
AllowedValueSettingZIndex,
|
|
1648
|
+
never,
|
|
1649
|
+
UnionableNumber,
|
|
1650
|
+
UnionableNumber,
|
|
1651
|
+
WebStyleValueUniversal
|
|
1652
|
+
>
|
|
1653
|
+
|
|
1654
|
+
export type GetTokenString<A> = A extends `$${string}`
|
|
1655
|
+
? A
|
|
1656
|
+
: A extends string | number
|
|
1657
|
+
? `$${A}`
|
|
1658
|
+
: `$${string}`
|
|
1659
|
+
|
|
1660
|
+
export type SpecificTokens<
|
|
1661
|
+
Record = Tokens,
|
|
1662
|
+
RK extends keyof Record = keyof Record,
|
|
1663
|
+
> = RK extends string
|
|
1664
|
+
? `$${RK}.${keyof Record[RK] extends string | number
|
|
1665
|
+
? // remove any $ prefix so instead of $size.$sm its $size.sm
|
|
1666
|
+
keyof Record[RK] extends `$${infer X}`
|
|
1667
|
+
? X
|
|
1668
|
+
: keyof Record[RK]
|
|
1669
|
+
: never}`
|
|
1670
|
+
: never
|
|
1671
|
+
|
|
1672
|
+
// defaults to except-special
|
|
1673
|
+
export type SpecificTokensSpecial = GuiSettings extends {
|
|
1674
|
+
autocompleteSpecificTokens: infer Val
|
|
1675
|
+
}
|
|
1676
|
+
? Val extends 'except-special' | undefined
|
|
1677
|
+
? never
|
|
1678
|
+
: SpecificTokens
|
|
1679
|
+
: SpecificTokens
|
|
1680
|
+
|
|
1681
|
+
export type SizeTokens =
|
|
1682
|
+
| SpecificTokensSpecial
|
|
1683
|
+
| ThemeValueFallbackSize
|
|
1684
|
+
| GetTokenString<keyof Tokens['size']>
|
|
1685
|
+
|
|
1686
|
+
export type SpaceTokens =
|
|
1687
|
+
| SpecificTokensSpecial
|
|
1688
|
+
| GetTokenString<keyof Tokens['space']>
|
|
1689
|
+
| ThemeValueFallbackSpace
|
|
1690
|
+
|
|
1691
|
+
export type ColorTokens =
|
|
1692
|
+
| SpecificTokensSpecial
|
|
1693
|
+
| GetTokenString<keyof Tokens['color']>
|
|
1694
|
+
| GetTokenString<keyof ThemeParsed>
|
|
1695
|
+
| CSSColorNames
|
|
1696
|
+
|
|
1697
|
+
export type ZIndexTokens =
|
|
1698
|
+
| SpecificTokensSpecial
|
|
1699
|
+
| GetTokenString<keyof Tokens['zIndex']>
|
|
1700
|
+
| ThemeValueFallbackZIndex
|
|
1701
|
+
| number
|
|
1702
|
+
|
|
1703
|
+
export type RadiusTokens =
|
|
1704
|
+
| SpecificTokensSpecial
|
|
1705
|
+
| GetTokenString<keyof Tokens['radius']>
|
|
1706
|
+
| ThemeValueFallbackRadius
|
|
1707
|
+
| number
|
|
1708
|
+
| RemString
|
|
1709
|
+
|
|
1710
|
+
export type NonSpecificTokens =
|
|
1711
|
+
| GetTokenString<keyof Tokens['radius']>
|
|
1712
|
+
| GetTokenString<keyof Tokens['zIndex']>
|
|
1713
|
+
| GetTokenString<keyof Tokens['color']>
|
|
1714
|
+
| GetTokenString<keyof Tokens['space']>
|
|
1715
|
+
| GetTokenString<keyof Tokens['size']>
|
|
1716
|
+
|
|
1717
|
+
export type Token =
|
|
1718
|
+
| NonSpecificTokens
|
|
1719
|
+
| (GuiSettings extends { autocompleteSpecificTokens: false }
|
|
1720
|
+
? never
|
|
1721
|
+
: SpecificTokens)
|
|
1722
|
+
|
|
1723
|
+
export type ColorStyleProp = ThemeValueFallbackColor | ColorTokens
|
|
1724
|
+
|
|
1725
|
+
// fonts
|
|
1726
|
+
type DefaultFont = GuiSettings['defaultFont']
|
|
1727
|
+
|
|
1728
|
+
export type Fonts = DefaultFont extends string
|
|
1729
|
+
? GuiConfig['fonts'][DefaultFont]
|
|
1730
|
+
: never
|
|
1731
|
+
|
|
1732
|
+
export type Font = ParseFont<Fonts>
|
|
1733
|
+
|
|
1734
|
+
export type GetTokenFontKeysFor<
|
|
1735
|
+
A extends
|
|
1736
|
+
| 'size'
|
|
1737
|
+
| 'weight'
|
|
1738
|
+
| 'letterSpacing'
|
|
1739
|
+
| 'family'
|
|
1740
|
+
| 'lineHeight'
|
|
1741
|
+
| 'transform'
|
|
1742
|
+
| 'style'
|
|
1743
|
+
| 'color',
|
|
1744
|
+
> = keyof GuiConfig['fonts']['body'][A]
|
|
1745
|
+
|
|
1746
|
+
export type FontTokens = GetTokenString<keyof GuiConfig['fonts']>
|
|
1747
|
+
export type FontFamilyTokens = GetTokenString<GetTokenFontKeysFor<'family'>>
|
|
1748
|
+
export type FontSizeTokens =
|
|
1749
|
+
| GetTokenString<GetTokenFontKeysFor<'size'>>
|
|
1750
|
+
| number
|
|
1751
|
+
| RemString
|
|
1752
|
+
export type FontLineHeightTokens =
|
|
1753
|
+
| `$${GetTokenFontKeysFor<'lineHeight'>}`
|
|
1754
|
+
| number
|
|
1755
|
+
| RemString
|
|
1756
|
+
export type FontWeightValues =
|
|
1757
|
+
| `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`
|
|
1758
|
+
| 'bold'
|
|
1759
|
+
| 'normal'
|
|
1760
|
+
export type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightValues
|
|
1761
|
+
export type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number
|
|
1762
|
+
export type FontLetterSpacingTokens =
|
|
1763
|
+
| `$${GetTokenFontKeysFor<'letterSpacing'>}`
|
|
1764
|
+
| number
|
|
1765
|
+
| RemString
|
|
1766
|
+
export type FontStyleTokens =
|
|
1767
|
+
| `$${GetTokenFontKeysFor<'style'>}`
|
|
1768
|
+
| RNTextStyle['fontStyle']
|
|
1769
|
+
export type FontTransformTokens =
|
|
1770
|
+
| `$${GetTokenFontKeysFor<'transform'>}`
|
|
1771
|
+
| RNTextStyle['textTransform']
|
|
1772
|
+
|
|
1773
|
+
export type ParseFont<A extends GenericFont> = {
|
|
1774
|
+
size: TokenPrefixed<A['size']>
|
|
1775
|
+
lineHeight: TokenPrefixedIfExists<A['lineHeight']>
|
|
1776
|
+
letterSpacing: TokenPrefixedIfExists<A['letterSpacing']>
|
|
1777
|
+
weight: TokenPrefixedIfExists<A['weight']>
|
|
1778
|
+
family: TokenPrefixedIfExists<A['family']>
|
|
1779
|
+
style: TokenPrefixedIfExists<A['style']>
|
|
1780
|
+
transform: TokenPrefixedIfExists<A['transform']>
|
|
1781
|
+
color: TokenPrefixedIfExists<A['color']>
|
|
1782
|
+
face: TokenPrefixedIfExists<A['face']>
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
export type TokenPrefixedIfExists<A> =
|
|
1786
|
+
A extends Record<string, any> ? TokenPrefixed<A> : {}
|
|
1787
|
+
|
|
1788
|
+
//
|
|
1789
|
+
// adds theme short values to relevant props
|
|
1790
|
+
//
|
|
1791
|
+
|
|
1792
|
+
export type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'
|
|
1793
|
+
? ThemeTokens
|
|
1794
|
+
: K extends 'size'
|
|
1795
|
+
? SizeTokens
|
|
1796
|
+
: K extends 'font'
|
|
1797
|
+
? FontTokens
|
|
1798
|
+
: K extends 'fontSize'
|
|
1799
|
+
? FontSizeTokens
|
|
1800
|
+
: K extends 'space'
|
|
1801
|
+
? SpaceTokens
|
|
1802
|
+
: K extends 'color'
|
|
1803
|
+
? ColorTokens
|
|
1804
|
+
: K extends 'zIndex'
|
|
1805
|
+
? ZIndexTokens
|
|
1806
|
+
: K extends 'radius'
|
|
1807
|
+
? RadiusTokens
|
|
1808
|
+
: K extends 'lineHeight'
|
|
1809
|
+
? FontLineHeightTokens
|
|
1810
|
+
: K extends 'fontWeight'
|
|
1811
|
+
? FontWeightTokens
|
|
1812
|
+
: K extends 'letterSpacing'
|
|
1813
|
+
? FontLetterSpacingTokens
|
|
1814
|
+
: K extends keyof Tokens
|
|
1815
|
+
? // fallback to user-defined tokens
|
|
1816
|
+
GetTokenString<keyof Tokens[K]>
|
|
1817
|
+
: never
|
|
1818
|
+
|
|
1819
|
+
export type FontKeys = 'fontFamily'
|
|
1820
|
+
export type FontSizeKeys = 'fontSize'
|
|
1821
|
+
export type FontWeightKeys = 'fontWeight'
|
|
1822
|
+
export type FontLetterSpacingKeys = 'letterSpacing'
|
|
1823
|
+
export type LineHeightKeys = 'lineHeight'
|
|
1824
|
+
export type ZIndexKeys = 'zIndex'
|
|
1825
|
+
export type OpacityKeys = 'opacity'
|
|
1826
|
+
|
|
1827
|
+
export type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'
|
|
1828
|
+
? ThemeTokens
|
|
1829
|
+
: K extends SizeKeys
|
|
1830
|
+
? SizeTokens
|
|
1831
|
+
: K extends FontKeys
|
|
1832
|
+
? FontTokens
|
|
1833
|
+
: K extends FontSizeKeys
|
|
1834
|
+
? FontSizeTokens
|
|
1835
|
+
: K extends `${`border${string | ''}Radius`}`
|
|
1836
|
+
? RadiusTokens
|
|
1837
|
+
: K extends SpaceKeys
|
|
1838
|
+
? K extends 'shadowOffset'
|
|
1839
|
+
? { width: SpaceTokens; height: SpaceTokens }
|
|
1840
|
+
: SpaceTokens
|
|
1841
|
+
: K extends ColorKeys
|
|
1842
|
+
? ColorTokens | ThemeValueFallbackColor
|
|
1843
|
+
: K extends ZIndexKeys
|
|
1844
|
+
? ZIndexTokens
|
|
1845
|
+
: K extends LineHeightKeys
|
|
1846
|
+
? FontLineHeightTokens
|
|
1847
|
+
: K extends FontWeightKeys
|
|
1848
|
+
? FontWeightTokens
|
|
1849
|
+
: K extends FontLetterSpacingKeys
|
|
1850
|
+
? FontLetterSpacingTokens
|
|
1851
|
+
: K extends OpacityKeys
|
|
1852
|
+
? SpecificTokens | ThemeValueFallback
|
|
1853
|
+
: never
|
|
1854
|
+
|
|
1855
|
+
export type GetThemeValueForKey<K extends string | symbol | number> =
|
|
1856
|
+
| ThemeValueGet<K>
|
|
1857
|
+
| ThemeValueFallback
|
|
1858
|
+
| (GuiSettings extends { autocompleteSpecificTokens: infer Val }
|
|
1859
|
+
? Val extends true | undefined
|
|
1860
|
+
? SpecificTokens
|
|
1861
|
+
: never
|
|
1862
|
+
: never)
|
|
1863
|
+
|
|
1864
|
+
export type WithThemeValues<T extends object> = {
|
|
1865
|
+
[K in keyof T]: ThemeValueGet<K> extends never
|
|
1866
|
+
? K extends keyof ExtraBaseProps
|
|
1867
|
+
? T[K]
|
|
1868
|
+
: T[K] | 'unset'
|
|
1869
|
+
: GetThemeValueForKey<K> | Exclude<T[K], string> | 'unset'
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
export type NarrowShorthands = Narrow<Shorthands>
|
|
1873
|
+
export type Longhands = NarrowShorthands[keyof NarrowShorthands]
|
|
1874
|
+
|
|
1875
|
+
type OnlyAllowShorthands = GuiConfig['settings']['onlyAllowShorthands']
|
|
1876
|
+
type OnlyShorthandStyleProps = GuiConfig['settings']['onlyShorthandStyleProps']
|
|
1877
|
+
|
|
1878
|
+
// longhand style props that overlap with border/outline/shadow shorthands
|
|
1879
|
+
type ShorthandLonghandProps =
|
|
1880
|
+
| 'borderWidth'
|
|
1881
|
+
| 'borderStyle'
|
|
1882
|
+
| 'borderColor'
|
|
1883
|
+
| 'outlineWidth'
|
|
1884
|
+
| 'outlineStyle'
|
|
1885
|
+
| 'outlineColor'
|
|
1886
|
+
| 'outlineOffset'
|
|
1887
|
+
| 'shadowColor'
|
|
1888
|
+
| 'shadowOffset'
|
|
1889
|
+
| 'shadowOpacity'
|
|
1890
|
+
| 'shadowRadius'
|
|
1891
|
+
|
|
1892
|
+
// adds shorthand props
|
|
1893
|
+
export type WithShorthands<StyleProps> = {
|
|
1894
|
+
[Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps
|
|
1895
|
+
? StyleProps[Shorthands[Key]] | null
|
|
1896
|
+
: undefined
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
// adds pseudo props
|
|
1900
|
+
// PseudoStyleWithTransition allows transition inside pseudo-style props for enter/exit timing
|
|
1901
|
+
export type PseudoStyleWithTransition<A> = A & { transition?: TransitionProp | null }
|
|
1902
|
+
|
|
1903
|
+
export type WithPseudoProps<A> = {
|
|
1904
|
+
hoverStyle?: PseudoStyleWithTransition<A> | null
|
|
1905
|
+
pressStyle?: PseudoStyleWithTransition<A> | null
|
|
1906
|
+
focusStyle?: PseudoStyleWithTransition<A> | null
|
|
1907
|
+
focusWithinStyle?: PseudoStyleWithTransition<A> | null
|
|
1908
|
+
focusVisibleStyle?: PseudoStyleWithTransition<A> | null
|
|
1909
|
+
disabledStyle?: PseudoStyleWithTransition<A> | null
|
|
1910
|
+
exitStyle?: PseudoStyleWithTransition<A> | null
|
|
1911
|
+
enterStyle?: PseudoStyleWithTransition<A> | null
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
// type for transitions extracted from pseudo-style props (e.g., hoverStyle.transition)
|
|
1915
|
+
// includes $group-*-hover, $group-*-press, $group-*-focus patterns
|
|
1916
|
+
export type PseudoTransitions = Partial<
|
|
1917
|
+
Record<keyof WithPseudoProps<any>, TransitionProp | null>
|
|
1918
|
+
> & {
|
|
1919
|
+
// allow $group-{name}-{pseudo} keys dynamically
|
|
1920
|
+
[key: `$group-${string}-${'hover' | 'press' | 'focus'}`]:
|
|
1921
|
+
| TransitionProp
|
|
1922
|
+
| null
|
|
1923
|
+
| undefined
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
export type PseudoPropKeys = keyof WithPseudoProps<any>
|
|
1927
|
+
|
|
1928
|
+
export type PseudoStyles = {
|
|
1929
|
+
hoverStyle?: ViewStyle
|
|
1930
|
+
pressStyle?: ViewStyle
|
|
1931
|
+
focusStyle?: ViewStyle
|
|
1932
|
+
focusWithinStyle?: ViewStyle
|
|
1933
|
+
focusVisibleStyle?: ViewStyle
|
|
1934
|
+
disabledStyle?: ViewStyle
|
|
1935
|
+
enterStyle?: ViewStyle
|
|
1936
|
+
exitStyle?: ViewStyle
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
export type AllPlatforms = 'web' | 'native' | 'android' | 'ios'
|
|
1940
|
+
|
|
1941
|
+
// MUST EXPORT ALL IN BETWEEN or else it expands declarations like crazy
|
|
1942
|
+
|
|
1943
|
+
//
|
|
1944
|
+
// add both theme and shorthands
|
|
1945
|
+
//
|
|
1946
|
+
type MaybeOmitLonghands<A> = OnlyShorthandStyleProps extends true
|
|
1947
|
+
? Omit<A, ShorthandLonghandProps>
|
|
1948
|
+
: A
|
|
1949
|
+
|
|
1950
|
+
export type WithThemeAndShorthands<
|
|
1951
|
+
A extends object,
|
|
1952
|
+
Variants = {},
|
|
1953
|
+
> = OnlyAllowShorthands extends true
|
|
1954
|
+
? WithThemeValues<MaybeOmitLonghands<Omit<A, Longhands>>> &
|
|
1955
|
+
Variants &
|
|
1956
|
+
WithShorthands<WithThemeValues<A>>
|
|
1957
|
+
: WithThemeValues<MaybeOmitLonghands<A>> & Variants & WithShorthands<WithThemeValues<A>>
|
|
1958
|
+
|
|
1959
|
+
//
|
|
1960
|
+
// combines all of theme, shorthands, pseudos...
|
|
1961
|
+
//
|
|
1962
|
+
export type WithThemeShorthandsAndPseudos<
|
|
1963
|
+
A extends object,
|
|
1964
|
+
Variants = {},
|
|
1965
|
+
> = WithThemeAndShorthands<A, Variants> &
|
|
1966
|
+
WithPseudoProps<WithThemeAndShorthands<A, Variants>>
|
|
1967
|
+
|
|
1968
|
+
//
|
|
1969
|
+
// ... media queries and animations
|
|
1970
|
+
//
|
|
1971
|
+
export type WithThemeShorthandsPseudosMedia<
|
|
1972
|
+
A extends object,
|
|
1973
|
+
Variants = {},
|
|
1974
|
+
> = WithThemeShorthandsAndPseudos<A, Variants> &
|
|
1975
|
+
WithMediaProps<WithThemeShorthandsAndPseudos<A, Variants>>
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* Base style-only props (no media, pseudo):
|
|
1979
|
+
*/
|
|
1980
|
+
|
|
1981
|
+
type Px = `${string | number}px`
|
|
1982
|
+
type PxOrPct = Px | `${string | number}%`
|
|
1983
|
+
type TwoValueTransformOrigin = `${PxOrPct | 'left' | 'center' | 'right'} ${
|
|
1984
|
+
| PxOrPct
|
|
1985
|
+
| 'top'
|
|
1986
|
+
| 'center'
|
|
1987
|
+
| 'bottom'}`
|
|
1988
|
+
|
|
1989
|
+
export interface TransformStyleProps {
|
|
1990
|
+
/**
|
|
1991
|
+
* Maps to translateX
|
|
1992
|
+
*/
|
|
1993
|
+
x?: number
|
|
1994
|
+
/**
|
|
1995
|
+
* Maps to translateY
|
|
1996
|
+
*/
|
|
1997
|
+
y?: number
|
|
1998
|
+
perspective?: number
|
|
1999
|
+
scale?: number
|
|
2000
|
+
scaleX?: number
|
|
2001
|
+
scaleY?: number
|
|
2002
|
+
skewX?: string
|
|
2003
|
+
skewY?: string
|
|
2004
|
+
matrix?: number[]
|
|
2005
|
+
rotate?: `${number}deg` | UnionableString
|
|
2006
|
+
rotateY?: `${number}deg` | UnionableString
|
|
2007
|
+
rotateX?: `${number}deg` | UnionableString
|
|
2008
|
+
rotateZ?: `${number}deg` | UnionableString
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
// box shadow presets - one example per pattern for autocomplete hints
|
|
2012
|
+
type BoxShadowPreset =
|
|
2013
|
+
| '0 0' // offset only
|
|
2014
|
+
| '0 1px 2px' // offset + blur
|
|
2015
|
+
| '0 1px 2px 0' // offset + blur + spread
|
|
2016
|
+
| '0 1px 2px $shadowColor' // offset + blur + color token
|
|
2017
|
+
| '0 1px 3px 0 $shadowColor' // offset + blur + spread + color token
|
|
2018
|
+
| '0 4px 6px -1px $shadowColor' // negative spread
|
|
2019
|
+
| 'inset 0 2px 4px $shadowColor' // inset
|
|
2020
|
+
| 'none'
|
|
2021
|
+
|
|
2022
|
+
// Box Shadow - CSS string format (e.g. "0 4px 8px $shadowColor")
|
|
2023
|
+
// Supports embedded $tokens that get resolved at runtime
|
|
2024
|
+
export type BoxShadowValue = BoxShadowPreset | (string & {})
|
|
2025
|
+
|
|
2026
|
+
// filter presets - one example per function for autocomplete hints
|
|
2027
|
+
type FilterPreset =
|
|
2028
|
+
| 'blur(4px)'
|
|
2029
|
+
| 'brightness(1.2)'
|
|
2030
|
+
| 'contrast(1.2)'
|
|
2031
|
+
| 'drop-shadow(0 4px 8px $shadowColor)'
|
|
2032
|
+
| 'grayscale(1)'
|
|
2033
|
+
| 'hue-rotate(90deg)'
|
|
2034
|
+
| 'invert(1)'
|
|
2035
|
+
| 'opacity(0.5)'
|
|
2036
|
+
| 'saturate(1.5)'
|
|
2037
|
+
| 'sepia(1)'
|
|
2038
|
+
| 'none'
|
|
2039
|
+
|
|
2040
|
+
// Filter - CSS string format (e.g. "blur(10px) brightness(1.2)")
|
|
2041
|
+
// Supports embedded $tokens that get resolved at runtime
|
|
2042
|
+
export type FilterValue = FilterPreset | (string & {})
|
|
2043
|
+
|
|
2044
|
+
// border shorthand presets - examples for autocomplete hints
|
|
2045
|
+
type BorderPreset =
|
|
2046
|
+
| '1px solid' // width + style
|
|
2047
|
+
| '1px solid $borderColor' // width + style + color token
|
|
2048
|
+
| '2px dashed $borderColor' // width + style + color
|
|
2049
|
+
| '1px dotted red' // width + style + color
|
|
2050
|
+
| 'none'
|
|
2051
|
+
|
|
2052
|
+
// Border - CSS shorthand string format (e.g. "1px solid $borderColor")
|
|
2053
|
+
// Expands to borderWidth, borderStyle, borderColor on web and native
|
|
2054
|
+
// Note: on native, only supports a single border (all sides)
|
|
2055
|
+
export type BorderValue = BorderPreset | (string & {})
|
|
2056
|
+
|
|
2057
|
+
// outline shorthand presets - examples for autocomplete hints
|
|
2058
|
+
type OutlinePreset =
|
|
2059
|
+
| '1px solid' // width + style
|
|
2060
|
+
| '1px solid $outlineColor' // width + style + color token
|
|
2061
|
+
| '2px dashed $outlineColor' // width + style + color
|
|
2062
|
+
| '1px dotted red' // width + style + color
|
|
2063
|
+
| 'none'
|
|
2064
|
+
|
|
2065
|
+
// Outline - CSS shorthand string format (e.g. "2px solid $outlineColor")
|
|
2066
|
+
// Expands to outlineWidth, outlineStyle, outlineColor on native
|
|
2067
|
+
export type OutlineValue = OutlinePreset | (string & {})
|
|
2068
|
+
|
|
2069
|
+
interface ExtraStyleProps {
|
|
2070
|
+
/**
|
|
2071
|
+
* Controls the curve style of rounded corners.
|
|
2072
|
+
* - 'circular': Standard circular arc corners (default)
|
|
2073
|
+
* - 'continuous': Apple's "squircle" style continuous curve
|
|
2074
|
+
* @platform iOS 13+
|
|
2075
|
+
*/
|
|
2076
|
+
borderCurve?: 'circular' | 'continuous'
|
|
2077
|
+
/**
|
|
2078
|
+
* Web-only style property. Will be omitted on native.
|
|
2079
|
+
*/
|
|
2080
|
+
contain?: Properties['contain']
|
|
2081
|
+
/**
|
|
2082
|
+
* Cursor style. On web, supports all CSS cursor values.
|
|
2083
|
+
* On iOS 17+ (trackpad/stylus), only 'auto' and 'pointer' are supported.
|
|
2084
|
+
*/
|
|
2085
|
+
cursor?: Properties['cursor']
|
|
2086
|
+
/**
|
|
2087
|
+
* Outline color. Supported on web and native.
|
|
2088
|
+
*/
|
|
2089
|
+
outlineColor?: ColorStyleProp
|
|
2090
|
+
/**
|
|
2091
|
+
* Outline offset. Supported on web and native.
|
|
2092
|
+
*/
|
|
2093
|
+
outlineOffset?: SpaceValue
|
|
2094
|
+
/**
|
|
2095
|
+
* Outline style. Supported on web and native.
|
|
2096
|
+
*/
|
|
2097
|
+
outlineStyle?: 'solid' | 'dotted' | 'dashed' | (string & {})
|
|
2098
|
+
/**
|
|
2099
|
+
* Outline width. Supported on web and native.
|
|
2100
|
+
*/
|
|
2101
|
+
outlineWidth?: SpaceValue
|
|
2102
|
+
/**
|
|
2103
|
+
* CSS outline shorthand string. Supports tokens: "2px solid $outlineColor"
|
|
2104
|
+
* Expands to outlineWidth, outlineStyle, outlineColor on native.
|
|
2105
|
+
* Works on web and native.
|
|
2106
|
+
*/
|
|
2107
|
+
outline?: OutlineValue
|
|
2108
|
+
/**
|
|
2109
|
+
* On native, maps to the `selectable` prop on Text (userSelect !== 'none')
|
|
2110
|
+
*/
|
|
2111
|
+
userSelect?: Properties['userSelect']
|
|
2112
|
+
/**
|
|
2113
|
+
* Web-only style property. Will be omitted on native.
|
|
2114
|
+
*/
|
|
2115
|
+
backdropFilter?: Properties['backdropFilter']
|
|
2116
|
+
/**
|
|
2117
|
+
* Web-only style property. Will be omitted on native.
|
|
2118
|
+
*/
|
|
2119
|
+
background?: Properties['background']
|
|
2120
|
+
/**
|
|
2121
|
+
* Web-only style property. Will be omitted on native.
|
|
2122
|
+
*/
|
|
2123
|
+
backgroundImage?: Properties['backgroundImage']
|
|
2124
|
+
/**
|
|
2125
|
+
* Web-only style property. Will be omitted on native.
|
|
2126
|
+
*/
|
|
2127
|
+
backgroundOrigin?: Properties['backgroundOrigin']
|
|
2128
|
+
/**
|
|
2129
|
+
* Web-only style property. Will be omitted on native.
|
|
2130
|
+
*/
|
|
2131
|
+
backgroundPosition?: Properties['backgroundPosition']
|
|
2132
|
+
/**
|
|
2133
|
+
* Web-only style property. Will be omitted on native.
|
|
2134
|
+
*/
|
|
2135
|
+
backgroundRepeat?: Properties['backgroundRepeat']
|
|
2136
|
+
/**
|
|
2137
|
+
* Web-only style property. Will be omitted on native.
|
|
2138
|
+
*/
|
|
2139
|
+
backgroundSize?: Properties['backgroundSize']
|
|
2140
|
+
// boxSizing - provided by RN's ViewStyle
|
|
2141
|
+
/**
|
|
2142
|
+
* CSS box-shadow string. Supports tokens: "0 4px 8px $shadowColor"
|
|
2143
|
+
* Works on web and native (RN 0.76+).
|
|
2144
|
+
*/
|
|
2145
|
+
boxShadow?: BoxShadowValue
|
|
2146
|
+
/**
|
|
2147
|
+
* CSS border shorthand string. Supports tokens: "1px solid $borderColor"
|
|
2148
|
+
* Expands to borderWidth, borderStyle, borderColor.
|
|
2149
|
+
* Works on web and native. On native, applies to all sides.
|
|
2150
|
+
*/
|
|
2151
|
+
border?: BorderValue
|
|
2152
|
+
/**
|
|
2153
|
+
* Web-only style property. Will be omitted on native.
|
|
2154
|
+
*/
|
|
2155
|
+
overflowX?: Properties['overflowX']
|
|
2156
|
+
/**
|
|
2157
|
+
* Web-only style property. Will be omitted on native.
|
|
2158
|
+
*/
|
|
2159
|
+
overflowY?: Properties['overflowY']
|
|
2160
|
+
|
|
2161
|
+
pointerEvents?: ViewProps['pointerEvents']
|
|
2162
|
+
|
|
2163
|
+
/**
|
|
2164
|
+
* The point at which transforms originate from.
|
|
2165
|
+
*/
|
|
2166
|
+
transformOrigin?:
|
|
2167
|
+
| PxOrPct
|
|
2168
|
+
| 'left'
|
|
2169
|
+
| 'center'
|
|
2170
|
+
| 'right'
|
|
2171
|
+
| 'top'
|
|
2172
|
+
| 'bottom'
|
|
2173
|
+
| TwoValueTransformOrigin
|
|
2174
|
+
| `${TwoValueTransformOrigin} ${Px}`
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* CSS filter string. Example: "blur(10px) brightness(1.2)"
|
|
2178
|
+
* Works on web and native (RN 0.76+). Supports embedded tokens.
|
|
2179
|
+
*/
|
|
2180
|
+
filter?: FilterValue
|
|
2181
|
+
// mixBlendMode - provided by RN's ViewStyle
|
|
2182
|
+
// isolation - provided by RN's ViewStyle
|
|
2183
|
+
/**
|
|
2184
|
+
* Web-only style property. Will be omitted on native.
|
|
2185
|
+
*/
|
|
2186
|
+
backgroundClip?: Properties['backgroundClip']
|
|
2187
|
+
/**
|
|
2188
|
+
* Web-only style property. Will be omitted on native.
|
|
2189
|
+
*/
|
|
2190
|
+
backgroundBlendMode?: Properties['backgroundBlendMode']
|
|
2191
|
+
/**
|
|
2192
|
+
* Web-only style property. Will be omitted on native.
|
|
2193
|
+
*/
|
|
2194
|
+
backgroundAttachment?: Properties['backgroundAttachment']
|
|
2195
|
+
/**
|
|
2196
|
+
* Web-only style property. Will be omitted on native.
|
|
2197
|
+
*/
|
|
2198
|
+
clipPath?: Properties['clipPath']
|
|
2199
|
+
/**
|
|
2200
|
+
* Web-only style property. Will be omitted on native.
|
|
2201
|
+
*/
|
|
2202
|
+
caretColor?: Properties['caretColor']
|
|
2203
|
+
/**
|
|
2204
|
+
* Web-only style property. Will be omitted on native.
|
|
2205
|
+
*/
|
|
2206
|
+
transformStyle?: Properties['transformStyle']
|
|
2207
|
+
/**
|
|
2208
|
+
* Web-only style property. Will be omitted on native.
|
|
2209
|
+
*/
|
|
2210
|
+
mask?: Properties['mask']
|
|
2211
|
+
/**
|
|
2212
|
+
* Web-only style property. Will be omitted on native.
|
|
2213
|
+
*/
|
|
2214
|
+
maskImage?: Properties['maskImage']
|
|
2215
|
+
/**
|
|
2216
|
+
* Web-only style property. Will be omitted on native.
|
|
2217
|
+
*/
|
|
2218
|
+
textEmphasis?: Properties['textEmphasis']
|
|
2219
|
+
/**
|
|
2220
|
+
* Web-only style property. Will be omitted on native.
|
|
2221
|
+
*/
|
|
2222
|
+
borderImage?: Properties['borderImage']
|
|
2223
|
+
/**
|
|
2224
|
+
* Web-only style property. Will be omitted on native.
|
|
2225
|
+
*/
|
|
2226
|
+
float?: Properties['float']
|
|
2227
|
+
/**
|
|
2228
|
+
* Web-only style property. Will be omitted on native.
|
|
2229
|
+
*/
|
|
2230
|
+
content?: Properties['content']
|
|
2231
|
+
/**
|
|
2232
|
+
* Web-only style property. Will be omitted on native.
|
|
2233
|
+
*/
|
|
2234
|
+
overflowBlock?: Properties['overflowBlock']
|
|
2235
|
+
/**
|
|
2236
|
+
* Web-only style property. Will be omitted on native.
|
|
2237
|
+
*/
|
|
2238
|
+
overflowInline?: Properties['overflowInline']
|
|
2239
|
+
/**
|
|
2240
|
+
* Web-only style property. Will be omitted on native.
|
|
2241
|
+
*/
|
|
2242
|
+
maskBorder?: Properties['maskBorder']
|
|
2243
|
+
/**
|
|
2244
|
+
* Web-only style property. Will be omitted on native.
|
|
2245
|
+
*/
|
|
2246
|
+
maskBorderMode?: Properties['maskBorderMode']
|
|
2247
|
+
/**
|
|
2248
|
+
* Web-only style property. Will be omitted on native.
|
|
2249
|
+
*/
|
|
2250
|
+
maskBorderOutset?: Properties['maskBorderOutset']
|
|
2251
|
+
/**
|
|
2252
|
+
* Web-only style property. Will be omitted on native.
|
|
2253
|
+
*/
|
|
2254
|
+
maskBorderRepeat?: Properties['maskBorderRepeat']
|
|
2255
|
+
/**
|
|
2256
|
+
* Web-only style property. Will be omitted on native.
|
|
2257
|
+
*/
|
|
2258
|
+
maskBorderSlice?: Properties['maskBorderSlice']
|
|
2259
|
+
/**
|
|
2260
|
+
* Web-only style property. Will be omitted on native.
|
|
2261
|
+
*/
|
|
2262
|
+
maskBorderSource?: Properties['maskBorderSource']
|
|
2263
|
+
/**
|
|
2264
|
+
* Web-only style property. Will be omitted on native.
|
|
2265
|
+
*/
|
|
2266
|
+
maskBorderWidth?: Properties['maskBorderWidth']
|
|
2267
|
+
/**
|
|
2268
|
+
* Web-only style property. Will be omitted on native.
|
|
2269
|
+
*/
|
|
2270
|
+
maskClip?: Properties['maskClip']
|
|
2271
|
+
/**
|
|
2272
|
+
* Web-only style property. Will be omitted on native.
|
|
2273
|
+
*/
|
|
2274
|
+
maskComposite?: Properties['maskComposite']
|
|
2275
|
+
/**
|
|
2276
|
+
* Web-only style property. Will be omitted on native.
|
|
2277
|
+
*/
|
|
2278
|
+
maskMode?: Properties['maskMode']
|
|
2279
|
+
/**
|
|
2280
|
+
* Web-only style property. Will be omitted on native.
|
|
2281
|
+
*/
|
|
2282
|
+
maskOrigin?: Properties['maskOrigin']
|
|
2283
|
+
/**
|
|
2284
|
+
* Web-only style property. Will be omitted on native.
|
|
2285
|
+
*/
|
|
2286
|
+
maskPosition?: Properties['maskPosition']
|
|
2287
|
+
/**
|
|
2288
|
+
* Web-only style property. Will be omitted on native.
|
|
2289
|
+
*/
|
|
2290
|
+
maskRepeat?: Properties['maskRepeat']
|
|
2291
|
+
/**
|
|
2292
|
+
* Web-only style property. Will be omitted on native.
|
|
2293
|
+
*/
|
|
2294
|
+
maskSize?: Properties['maskSize']
|
|
2295
|
+
/**
|
|
2296
|
+
* Web-only style property. Will be omitted on native.
|
|
2297
|
+
*/
|
|
2298
|
+
maskType?: Properties['maskType']
|
|
2299
|
+
/**
|
|
2300
|
+
* Web-only style property. Will be omitted on native.
|
|
2301
|
+
*/
|
|
2302
|
+
gridRow?: Properties['gridRow']
|
|
2303
|
+
/**
|
|
2304
|
+
* Web-only style property. Will be omitted on native.
|
|
2305
|
+
*/
|
|
2306
|
+
gridRowEnd?: Properties['gridRowEnd']
|
|
2307
|
+
/**
|
|
2308
|
+
* Web-only style property. Will be omitted on native.
|
|
2309
|
+
*/
|
|
2310
|
+
gridRowGap?: Properties['gridRowGap']
|
|
2311
|
+
/**
|
|
2312
|
+
* Web-only style property. Will be omitted on native.
|
|
2313
|
+
*/
|
|
2314
|
+
gridRowStart?: Properties['gridRowStart']
|
|
2315
|
+
/**
|
|
2316
|
+
* Web-only style property. Will be omitted on native.
|
|
2317
|
+
*/
|
|
2318
|
+
gridColumn?: Properties['gridColumn']
|
|
2319
|
+
/**
|
|
2320
|
+
* Web-only style property. Will be omitted on native.
|
|
2321
|
+
*/
|
|
2322
|
+
gridColumnEnd?: Properties['gridColumnEnd']
|
|
2323
|
+
/**
|
|
2324
|
+
* Web-only style property. Will be omitted on native.
|
|
2325
|
+
*/
|
|
2326
|
+
gridColumnGap?: Properties['gridColumnGap']
|
|
2327
|
+
/**
|
|
2328
|
+
* Web-only style property. Will be omitted on native.
|
|
2329
|
+
*/
|
|
2330
|
+
gridColumnStart?: Properties['gridColumnStart']
|
|
2331
|
+
/**
|
|
2332
|
+
* Web-only style property. Will be omitted on native.
|
|
2333
|
+
*/
|
|
2334
|
+
gridTemplateColumns?: Properties['gridTemplateColumns']
|
|
2335
|
+
/**
|
|
2336
|
+
* Web-only style property. Will be omitted on native.
|
|
2337
|
+
*/
|
|
2338
|
+
gridTemplateAreas?: Properties['gridTemplateAreas']
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Web-only style property. Will be omitted on native.
|
|
2342
|
+
*/
|
|
2343
|
+
containerType?: Properties['containerType']
|
|
2344
|
+
/**
|
|
2345
|
+
* Web-only style property. Will be omitted on native.
|
|
2346
|
+
*/
|
|
2347
|
+
blockSize?: SizeTokens | number
|
|
2348
|
+
/**
|
|
2349
|
+
* Web-only style property. Will be omitted on native.
|
|
2350
|
+
*/
|
|
2351
|
+
inlineSize?: SizeTokens | number
|
|
2352
|
+
/**
|
|
2353
|
+
* Web-only style property. Will be omitted on native.
|
|
2354
|
+
*/
|
|
2355
|
+
minBlockSize?: SizeTokens | number
|
|
2356
|
+
/**
|
|
2357
|
+
* Web-only style property. Will be omitted on native.
|
|
2358
|
+
*/
|
|
2359
|
+
maxBlockSize?: SizeTokens | number
|
|
2360
|
+
/**
|
|
2361
|
+
* Web-only style property. Will be omitted on native.
|
|
2362
|
+
*/
|
|
2363
|
+
objectFit?: Properties['objectFit']
|
|
2364
|
+
/**
|
|
2365
|
+
* Web-only style property. Will be omitted on native.
|
|
2366
|
+
*/
|
|
2367
|
+
verticalAlign?: Properties['verticalAlign']
|
|
2368
|
+
/**
|
|
2369
|
+
* Web-only style property. Will be omitted on native.
|
|
2370
|
+
*/
|
|
2371
|
+
minInlineSize?: SizeTokens | number
|
|
2372
|
+
/**
|
|
2373
|
+
* Web-only style property. Will be omitted on native.
|
|
2374
|
+
*/
|
|
2375
|
+
maxInlineSize?: SizeTokens | number
|
|
2376
|
+
/**
|
|
2377
|
+
* Web-only style property. Will be omitted on native.
|
|
2378
|
+
*/
|
|
2379
|
+
borderInlineColor?: ColorTokens
|
|
2380
|
+
/**
|
|
2381
|
+
* Web-only style property. Will be omitted on native.
|
|
2382
|
+
*/
|
|
2383
|
+
borderInlineStartColor?: ColorTokens
|
|
2384
|
+
/**
|
|
2385
|
+
* Web-only style property. Will be omitted on native.
|
|
2386
|
+
*/
|
|
2387
|
+
borderInlineEndColor?: ColorTokens
|
|
2388
|
+
|
|
2389
|
+
// TODO validate these are supported in react native, if so keep, if not deprecate like the above web-only deprecations
|
|
2390
|
+
borderBlockWidth?: SpaceTokens | number
|
|
2391
|
+
borderBlockStartWidth?: SpaceTokens | number
|
|
2392
|
+
borderBlockEndWidth?: SpaceTokens | number
|
|
2393
|
+
borderInlineWidth?: SpaceTokens | number
|
|
2394
|
+
borderInlineStartWidth?: SpaceTokens | number
|
|
2395
|
+
borderInlineEndWidth?: SpaceTokens | number
|
|
2396
|
+
borderBlockStyle?: ViewStyle['borderStyle']
|
|
2397
|
+
borderBlockStartStyle?: ViewStyle['borderStyle']
|
|
2398
|
+
borderBlockEndStyle?: ViewStyle['borderStyle']
|
|
2399
|
+
borderInlineStyle?: ViewStyle['borderStyle']
|
|
2400
|
+
borderInlineStartStyle?: ViewStyle['borderStyle']
|
|
2401
|
+
borderInlineEndStyle?: ViewStyle['borderStyle']
|
|
2402
|
+
marginBlock?: SpaceTokens | number
|
|
2403
|
+
marginBlockStart?: SpaceTokens | number
|
|
2404
|
+
marginBlockEnd?: SpaceTokens | number
|
|
2405
|
+
marginInline?: SpaceTokens | number
|
|
2406
|
+
marginInlineStart?: SpaceTokens | number
|
|
2407
|
+
marginInlineEnd?: SpaceTokens | number
|
|
2408
|
+
paddingBlock?: SpaceTokens | number
|
|
2409
|
+
paddingBlockStart?: SpaceTokens | number
|
|
2410
|
+
paddingBlockEnd?: SpaceTokens | number
|
|
2411
|
+
paddingInline?: SpaceTokens | number
|
|
2412
|
+
paddingInlineStart?: SpaceTokens | number
|
|
2413
|
+
paddingInlineEnd?: SpaceTokens | number
|
|
2414
|
+
inset?: SpaceTokens | number
|
|
2415
|
+
insetBlock?: SpaceTokens | number
|
|
2416
|
+
insetBlockStart?: SpaceTokens | number
|
|
2417
|
+
insetBlockEnd?: SpaceTokens | number
|
|
2418
|
+
insetInline?: SpaceTokens | number
|
|
2419
|
+
insetInlineStart?: SpaceTokens | number
|
|
2420
|
+
insetInlineEnd?: SpaceTokens | number
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
export interface ExtendBaseStackProps {}
|
|
2424
|
+
export interface ExtendBaseTextProps {}
|
|
2425
|
+
|
|
2426
|
+
interface ExtraBaseProps {
|
|
2427
|
+
/**
|
|
2428
|
+
* Transitions are defined using `createGui` typically in a gui.config.ts file.
|
|
2429
|
+
* Pass a string transition name here and it uses an animation driver to execute it.
|
|
2430
|
+
*
|
|
2431
|
+
* See: https://gui.hanzo.ai/docs/core/animations
|
|
2432
|
+
*/
|
|
2433
|
+
transition?: TransitionProp | null
|
|
2434
|
+
|
|
2435
|
+
/**
|
|
2436
|
+
* Pass an array of strings containing the long style property names
|
|
2437
|
+
* which will be exclusively transitioned.
|
|
2438
|
+
*/
|
|
2439
|
+
animateOnly?: string[]
|
|
2440
|
+
|
|
2441
|
+
/**
|
|
2442
|
+
* If you'd like this component to not attach to the nearest parent AnimatePresence,
|
|
2443
|
+
* set this to `false` and it will pass through to the next animated child.
|
|
2444
|
+
*/
|
|
2445
|
+
animatePresence?: boolean
|
|
2446
|
+
|
|
2447
|
+
/**
|
|
2448
|
+
* Avoids as much work as possible and passes through the children with no changes.
|
|
2449
|
+
* Advanced: Useful for adapting to other element when you want to avoid re-parenting.
|
|
2450
|
+
*/
|
|
2451
|
+
passThrough?: boolean
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
interface ExtendedBaseProps
|
|
2455
|
+
extends
|
|
2456
|
+
TransformStyleProps,
|
|
2457
|
+
ExtendBaseTextProps,
|
|
2458
|
+
ExtendBaseStackProps,
|
|
2459
|
+
ExtraStyleProps,
|
|
2460
|
+
ExtraBaseProps {
|
|
2461
|
+
display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'
|
|
2462
|
+
// extends RN's position to include 'fixed' (converted to 'absolute' on native)
|
|
2463
|
+
position?: 'absolute' | 'relative' | 'fixed' | 'static' | 'sticky'
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
export interface StackStyleBase
|
|
2467
|
+
extends Omit<ViewStyle, keyof ExtendedBaseProps | 'elevation'>, ExtendedBaseProps {}
|
|
2468
|
+
|
|
2469
|
+
export interface TextStylePropsBase
|
|
2470
|
+
extends Omit<RNTextStyle, keyof ExtendedBaseProps>, ExtendedBaseProps {
|
|
2471
|
+
ellipsis?: boolean
|
|
2472
|
+
textDecorationDistance?: number
|
|
2473
|
+
textOverflow?: Properties['textOverflow']
|
|
2474
|
+
whiteSpace?: Properties['whiteSpace']
|
|
2475
|
+
wordWrap?: Properties['wordWrap']
|
|
2476
|
+
/**
|
|
2477
|
+
* CSS text-shadow string. Supports tokens: "2px 2px 4px $shadowColor"
|
|
2478
|
+
* On native, only a single shadow is supported.
|
|
2479
|
+
*/
|
|
2480
|
+
textShadow?: string
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
//
|
|
2484
|
+
// Stack
|
|
2485
|
+
//
|
|
2486
|
+
|
|
2487
|
+
type LooseCombinedObjects<A extends object, B extends object> = A | B | (A & B)
|
|
2488
|
+
|
|
2489
|
+
// v2: Removed A11yDeprecated - use web-standard props instead:
|
|
2490
|
+
// - accessibilityLabel → aria-label
|
|
2491
|
+
// - accessibilityRole → role
|
|
2492
|
+
// - accessibilityHint → aria-describedby
|
|
2493
|
+
// - accessibilityState → aria-disabled, aria-selected, aria-checked, aria-busy, aria-expanded
|
|
2494
|
+
// - accessibilityValue → aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext
|
|
2495
|
+
// - accessibilityElementsHidden → aria-hidden
|
|
2496
|
+
// - accessibilityViewIsModal → aria-modal
|
|
2497
|
+
// - accessibilityLiveRegion → aria-live
|
|
2498
|
+
// - accessible → tabIndex={0}
|
|
2499
|
+
// - focusable → tabIndex
|
|
2500
|
+
// - nativeID → id
|
|
2501
|
+
|
|
2502
|
+
export interface StackNonStyleProps
|
|
2503
|
+
extends
|
|
2504
|
+
Omit<
|
|
2505
|
+
ViewProps,
|
|
2506
|
+
| 'hitSlop' // we bring our own via Pressable in GuiComponentPropsBase
|
|
2507
|
+
| 'pointerEvents'
|
|
2508
|
+
| 'display'
|
|
2509
|
+
| 'children'
|
|
2510
|
+
| keyof GuiComponentPropsBaseBase
|
|
2511
|
+
// these are added back in by core
|
|
2512
|
+
| RNOnlyProps
|
|
2513
|
+
| keyof ExtendBaseStackProps
|
|
2514
|
+
| 'style'
|
|
2515
|
+
// Event handlers that conflict between RN ViewProps and Web DivAttributes
|
|
2516
|
+
| 'onFocus'
|
|
2517
|
+
| 'onBlur'
|
|
2518
|
+
| 'onPointerCancel'
|
|
2519
|
+
| 'onPointerDown'
|
|
2520
|
+
| 'onPointerMove'
|
|
2521
|
+
| 'onPointerUp'
|
|
2522
|
+
>,
|
|
2523
|
+
ExtendBaseStackProps,
|
|
2524
|
+
GuiComponentPropsBase {
|
|
2525
|
+
// we allow either RN or web style props, of course only web css props only works on web
|
|
2526
|
+
style?: StyleProp<LooseCombinedObjects<React.CSSProperties, ViewStyle>>
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
export type StackStyle = WithThemeShorthandsPseudosMedia<StackStyleBase>
|
|
2530
|
+
|
|
2531
|
+
//
|
|
2532
|
+
// Text props
|
|
2533
|
+
//
|
|
2534
|
+
|
|
2535
|
+
export interface TextNonStyleProps
|
|
2536
|
+
extends
|
|
2537
|
+
Omit<
|
|
2538
|
+
ReactTextProps,
|
|
2539
|
+
| 'children'
|
|
2540
|
+
| keyof WebOnlyPressEvents
|
|
2541
|
+
// these are added back in by core
|
|
2542
|
+
| RNOnlyProps
|
|
2543
|
+
| keyof ExtendBaseTextProps
|
|
2544
|
+
| 'style'
|
|
2545
|
+
>,
|
|
2546
|
+
ExtendBaseTextProps,
|
|
2547
|
+
GuiComponentPropsBase {
|
|
2548
|
+
// we allow either RN or web style props, of course only web css props only works on web
|
|
2549
|
+
style?: StyleProp<LooseCombinedObjects<React.CSSProperties, RNTextStyle>>
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
export type TextStyle = WithThemeShorthandsPseudosMedia<TextStylePropsBase>
|
|
2553
|
+
|
|
2554
|
+
export type TextProps = TextNonStyleProps & TextStyle
|
|
2555
|
+
|
|
2556
|
+
export interface ThemeableProps {
|
|
2557
|
+
theme?: ThemeName | null
|
|
2558
|
+
themeReset?: boolean
|
|
2559
|
+
componentName?: string
|
|
2560
|
+
debug?: DebugProp
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
export type StyleableOptions = {
|
|
2564
|
+
disableTheme?: boolean
|
|
2565
|
+
staticConfig?: Partial<StaticConfig>
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
export type Styleable<
|
|
2569
|
+
Props,
|
|
2570
|
+
Ref,
|
|
2571
|
+
NonStyledProps,
|
|
2572
|
+
BaseStyles extends object,
|
|
2573
|
+
VariantProps,
|
|
2574
|
+
ParentStaticProperties,
|
|
2575
|
+
> = <
|
|
2576
|
+
CustomProps extends object | void = void,
|
|
2577
|
+
MergedProps = CustomProps extends void
|
|
2578
|
+
? Props
|
|
2579
|
+
: Omit<Props, keyof CustomProps> & CustomProps,
|
|
2580
|
+
FunctionDef extends ForwardRefRenderFunction<Ref, MergedProps> =
|
|
2581
|
+
ForwardRefRenderFunction<Ref, MergedProps>,
|
|
2582
|
+
>(
|
|
2583
|
+
a: FunctionDef,
|
|
2584
|
+
options?: StyleableOptions
|
|
2585
|
+
) => GuiComponent<
|
|
2586
|
+
MergedProps,
|
|
2587
|
+
Ref,
|
|
2588
|
+
NonStyledProps & CustomProps,
|
|
2589
|
+
BaseStyles,
|
|
2590
|
+
VariantProps,
|
|
2591
|
+
ParentStaticProperties
|
|
2592
|
+
>
|
|
2593
|
+
|
|
2594
|
+
export type GetFinalProps<NonStyleProps, StylePropsBase, Variants> = Omit<
|
|
2595
|
+
NonStyleProps,
|
|
2596
|
+
keyof StylePropsBase | keyof Variants
|
|
2597
|
+
> &
|
|
2598
|
+
(StylePropsBase extends object
|
|
2599
|
+
? WithThemeShorthandsPseudosMedia<StylePropsBase, Variants>
|
|
2600
|
+
: {})
|
|
2601
|
+
|
|
2602
|
+
export type GuiComponent<
|
|
2603
|
+
Props = any,
|
|
2604
|
+
Ref = any,
|
|
2605
|
+
NonStyledProps = {},
|
|
2606
|
+
BaseStyles extends object = {},
|
|
2607
|
+
Variants = {},
|
|
2608
|
+
ParentStaticProperties = {},
|
|
2609
|
+
> = ForwardRefExoticComponent<
|
|
2610
|
+
(Props extends TamaDefer
|
|
2611
|
+
? GetFinalProps<NonStyledProps, BaseStyles, Variants>
|
|
2612
|
+
: Props) &
|
|
2613
|
+
RefAttributes<Ref>
|
|
2614
|
+
> &
|
|
2615
|
+
StaticComponentObject<
|
|
2616
|
+
Props,
|
|
2617
|
+
Ref,
|
|
2618
|
+
NonStyledProps,
|
|
2619
|
+
BaseStyles,
|
|
2620
|
+
Variants,
|
|
2621
|
+
ParentStaticProperties
|
|
2622
|
+
> &
|
|
2623
|
+
Omit<ParentStaticProperties, 'staticConfig' | 'styleable'> & {
|
|
2624
|
+
__tama: [Props, Ref, NonStyledProps, BaseStyles, Variants, ParentStaticProperties]
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
export type InferGenericComponentProps<A> =
|
|
2628
|
+
A extends ComponentType<infer Props>
|
|
2629
|
+
? Props
|
|
2630
|
+
: A extends ForwardRefExoticComponent<infer P>
|
|
2631
|
+
? P
|
|
2632
|
+
: A extends ReactComponentWithRef<infer P, any>
|
|
2633
|
+
? P
|
|
2634
|
+
: A extends new (props: infer Props) => any
|
|
2635
|
+
? Props
|
|
2636
|
+
: {}
|
|
2637
|
+
|
|
2638
|
+
export type InferStyledProps<
|
|
2639
|
+
A extends StylableComponent,
|
|
2640
|
+
B extends StaticConfigPublic,
|
|
2641
|
+
> = A extends {
|
|
2642
|
+
__tama: any
|
|
2643
|
+
}
|
|
2644
|
+
? GetProps<A>
|
|
2645
|
+
: GetFinalProps<InferGenericComponentProps<A>, GetBaseStyles<{}, B>, {}>
|
|
2646
|
+
|
|
2647
|
+
/** Like InferStyledProps but returns only style props (no non-styled props or variants). */
|
|
2648
|
+
export type InferStyleProps<
|
|
2649
|
+
A extends StylableComponent,
|
|
2650
|
+
B extends StaticConfigPublic,
|
|
2651
|
+
> = WithThemeShorthandsPseudosMedia<GetBaseStyles<A, B>, {}>
|
|
2652
|
+
|
|
2653
|
+
export type GetProps<A extends StylableComponent> = A extends {
|
|
2654
|
+
__tama: [
|
|
2655
|
+
infer Props,
|
|
2656
|
+
any,
|
|
2657
|
+
infer NonStyledProps,
|
|
2658
|
+
infer BaseStyles,
|
|
2659
|
+
infer VariantProps,
|
|
2660
|
+
any,
|
|
2661
|
+
]
|
|
2662
|
+
}
|
|
2663
|
+
? Props extends TamaDefer
|
|
2664
|
+
? GetFinalProps<NonStyledProps, BaseStyles, VariantProps>
|
|
2665
|
+
: Props
|
|
2666
|
+
: InferGenericComponentProps<A>
|
|
2667
|
+
|
|
2668
|
+
export type GetNonStyledProps<A extends StylableComponent> = A extends {
|
|
2669
|
+
__tama: [any, any, infer B, any, any, any]
|
|
2670
|
+
}
|
|
2671
|
+
? B
|
|
2672
|
+
: GuiComponentPropsBaseBase & GetProps<A>
|
|
2673
|
+
|
|
2674
|
+
export type GetBaseStyles<A, B> = A extends {
|
|
2675
|
+
__tama: [any, any, any, infer C, any, any]
|
|
2676
|
+
}
|
|
2677
|
+
? C
|
|
2678
|
+
: B extends { isText: true }
|
|
2679
|
+
? TextStylePropsBase
|
|
2680
|
+
: B extends { isInput: true }
|
|
2681
|
+
? TextStylePropsBase
|
|
2682
|
+
: StackStyleBase
|
|
2683
|
+
|
|
2684
|
+
export type GetStyledVariants<A> = A extends {
|
|
2685
|
+
__tama: [any, any, any, any, infer B, any]
|
|
2686
|
+
}
|
|
2687
|
+
? B
|
|
2688
|
+
: {}
|
|
2689
|
+
|
|
2690
|
+
export type GetStaticConfig<A, Extra = {}> = A extends {
|
|
2691
|
+
__tama: [any, any, any, any, any, infer B]
|
|
2692
|
+
}
|
|
2693
|
+
? B & Extra
|
|
2694
|
+
: Extra
|
|
2695
|
+
|
|
2696
|
+
export type StaticComponentObject<
|
|
2697
|
+
Props,
|
|
2698
|
+
Ref,
|
|
2699
|
+
NonStyledProps,
|
|
2700
|
+
BaseStyles extends object,
|
|
2701
|
+
VariantProps,
|
|
2702
|
+
ParentStaticProperties,
|
|
2703
|
+
> = {
|
|
2704
|
+
staticConfig: StaticConfig
|
|
2705
|
+
|
|
2706
|
+
/*
|
|
2707
|
+
* If you want your HOC of a styled() component to also be able to be styled(), you need this to wrap it.
|
|
2708
|
+
*/
|
|
2709
|
+
styleable: Styleable<
|
|
2710
|
+
Props extends TamaDefer
|
|
2711
|
+
? GetFinalProps<NonStyledProps, BaseStyles, VariantProps>
|
|
2712
|
+
: Props,
|
|
2713
|
+
Ref,
|
|
2714
|
+
NonStyledProps,
|
|
2715
|
+
BaseStyles,
|
|
2716
|
+
VariantProps,
|
|
2717
|
+
ParentStaticProperties
|
|
2718
|
+
>
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
export type GuiComponentExpectingVariants<
|
|
2722
|
+
Props = {},
|
|
2723
|
+
Variants extends object = {},
|
|
2724
|
+
> = GuiComponent<Props, any, any, any, Variants>
|
|
2725
|
+
|
|
2726
|
+
export type GuiProviderProps = Omit<ThemeProviderProps, 'children'> & {
|
|
2727
|
+
config?: GuiInternalConfig
|
|
2728
|
+
disableInjectCSS?: boolean
|
|
2729
|
+
children?: ReactNode
|
|
2730
|
+
insets?: { top: number; right: number; bottom: number; left: number }
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
export type PropMappedValue = [string, any][] | undefined
|
|
2734
|
+
|
|
2735
|
+
export type GetStyleState = {
|
|
2736
|
+
style: TextStyle | null
|
|
2737
|
+
usedKeys: Record<string, number>
|
|
2738
|
+
classNames: ClassNamesObject
|
|
2739
|
+
staticConfig: StaticConfig
|
|
2740
|
+
theme: ThemeParsed
|
|
2741
|
+
props: Record<string, any>
|
|
2742
|
+
context?: ComponentContextI
|
|
2743
|
+
viewProps: Record<string, any>
|
|
2744
|
+
styleProps: SplitStyleProps
|
|
2745
|
+
componentState: GuiComponentState
|
|
2746
|
+
conf: GuiInternalConfig
|
|
2747
|
+
avoidMergeTransform?: boolean
|
|
2748
|
+
fontFamily?: string
|
|
2749
|
+
debug?: DebugProp
|
|
2750
|
+
flatTransforms?: Record<string, any>
|
|
2751
|
+
// Track style values that override context props (for issues #3670, #3676)
|
|
2752
|
+
overriddenContextProps?: Record<string, any>
|
|
2753
|
+
// Track original token values (like '$8') before they get resolved to CSS vars
|
|
2754
|
+
// This is used to preserve token strings in overriddenContextProps
|
|
2755
|
+
originalContextPropValues?: Record<string, any>
|
|
2756
|
+
// Transitions extracted from pseudo-style props (e.g., hoverStyle.transition)
|
|
2757
|
+
pseudoTransitions?: PseudoTransitions | null
|
|
2758
|
+
// Resolved animation driver (respects animatedBy prop)
|
|
2759
|
+
animationDriver?: AnimationDriver | null
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
export type StyleResolver<Response = PropMappedValue> = (
|
|
2763
|
+
key: string,
|
|
2764
|
+
value: any,
|
|
2765
|
+
props: SplitStyleProps,
|
|
2766
|
+
state: GetStyleState,
|
|
2767
|
+
parentVariantKey: string
|
|
2768
|
+
) => Response
|
|
2769
|
+
|
|
2770
|
+
export type PropMapper = (
|
|
2771
|
+
key: string,
|
|
2772
|
+
value: any,
|
|
2773
|
+
state: GetStyleState,
|
|
2774
|
+
disabled: boolean,
|
|
2775
|
+
map: (key: string, val: any, originalVal?: any) => void
|
|
2776
|
+
) => void
|
|
2777
|
+
|
|
2778
|
+
export type GenericVariantDefinitions = {
|
|
2779
|
+
[key: string]: {
|
|
2780
|
+
[key: string]:
|
|
2781
|
+
| ((a: any, b: any) => any)
|
|
2782
|
+
| {
|
|
2783
|
+
[key: string]: any
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
export type StaticConfigPublic = {
|
|
2789
|
+
defaultProps?: Record<string, any>
|
|
2790
|
+
|
|
2791
|
+
/**
|
|
2792
|
+
* (compiler) If you need to pass context or something, prevents from ever
|
|
2793
|
+
* flattening. The 'jsx' option means it will never flatten. if you
|
|
2794
|
+
* pass JSX as a children (if its purely string, it will still flatten).
|
|
2795
|
+
*/
|
|
2796
|
+
neverFlatten?: boolean | 'jsx'
|
|
2797
|
+
|
|
2798
|
+
/**
|
|
2799
|
+
* Adds support for text props and handles focus properly
|
|
2800
|
+
*/
|
|
2801
|
+
isInput?: boolean
|
|
2802
|
+
|
|
2803
|
+
/**
|
|
2804
|
+
* Determines ultimate output tag (Text vs View)
|
|
2805
|
+
*/
|
|
2806
|
+
isText?: boolean
|
|
2807
|
+
|
|
2808
|
+
/**
|
|
2809
|
+
* Which style keys are allowed to be extracted.
|
|
2810
|
+
*/
|
|
2811
|
+
validStyles?: { [key: string]: boolean }
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* Accept Hanzo GUI tokens for these props (key for the prop key, val for the token category)
|
|
2815
|
+
*/
|
|
2816
|
+
accept?: {
|
|
2817
|
+
[key: string]: keyof Tokens | 'style' | 'textStyle'
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
/**
|
|
2821
|
+
* (compiler) If these props are encountered, leave them un-extracted.
|
|
2822
|
+
*/
|
|
2823
|
+
inlineProps?: Set<string>
|
|
2824
|
+
|
|
2825
|
+
/**
|
|
2826
|
+
* (compiler) If not flattening, leave this prop as original value.
|
|
2827
|
+
* Only applies to style attributes
|
|
2828
|
+
*/
|
|
2829
|
+
inlineWhenUnflattened?: Set<string>
|
|
2830
|
+
|
|
2831
|
+
/**
|
|
2832
|
+
* Auto-detected, but can override. Wraps children to space them on top
|
|
2833
|
+
*/
|
|
2834
|
+
isZStack?: boolean
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
* Auto-detect, but can override, passes styles properly to react-native-web
|
|
2838
|
+
*/
|
|
2839
|
+
isReactNative?: boolean
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* By default if styled() doesn't recognize a parent Hanzo GUI component or specific react-native views,
|
|
2843
|
+
* it will assume the passed in component only accepts style={} for react-native compatibility.
|
|
2844
|
+
* Setting `acceptsClassName: true` indicates Hanzo GUI can pass in className props.
|
|
2845
|
+
*/
|
|
2846
|
+
acceptsClassName?: boolean
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* memoizes component, rarely useful except mostly style components that don't take children
|
|
2850
|
+
*/
|
|
2851
|
+
memo?: boolean
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
type StaticConfigBase = StaticConfigPublic & {
|
|
2855
|
+
Component?: FunctionComponent<any> & StaticComponentObject<any, any, any, any, any, any>
|
|
2856
|
+
|
|
2857
|
+
variants?: GenericVariantDefinitions
|
|
2858
|
+
|
|
2859
|
+
context?: StyledContext
|
|
2860
|
+
|
|
2861
|
+
/**
|
|
2862
|
+
* Used for applying sub theme style
|
|
2863
|
+
*/
|
|
2864
|
+
componentName?: string
|
|
2865
|
+
|
|
2866
|
+
/**
|
|
2867
|
+
* Merges into defaultProps later on, used internally only
|
|
2868
|
+
*/
|
|
2869
|
+
defaultVariants?: { [key: string]: any }
|
|
2870
|
+
|
|
2871
|
+
/**
|
|
2872
|
+
* Memoize the component
|
|
2873
|
+
*/
|
|
2874
|
+
memo?: boolean
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* Used internally for knowing how to handle when a HOC is in-between styled()
|
|
2878
|
+
*/
|
|
2879
|
+
isHOC?: boolean
|
|
2880
|
+
|
|
2881
|
+
// insanity, for styled(styled(styleable(styled())))
|
|
2882
|
+
isStyledHOC?: boolean
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
export type StaticConfig = StaticConfigBase & {
|
|
2886
|
+
parentStaticConfig?: StaticConfigBase
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
export type ViewStyleWithPseudos =
|
|
2890
|
+
| TextStyle
|
|
2891
|
+
| (TextStyle & {
|
|
2892
|
+
hoverStyle?: TextStyle
|
|
2893
|
+
pressStyle?: TextStyle
|
|
2894
|
+
focusStyle?: TextStyle
|
|
2895
|
+
focusWithinStyle?: TextStyle
|
|
2896
|
+
focusVisibleStyle?: TextStyle
|
|
2897
|
+
disabledStyle?: TextStyle
|
|
2898
|
+
})
|
|
2899
|
+
|
|
2900
|
+
/**
|
|
2901
|
+
* --------------------------------------------
|
|
2902
|
+
* variants
|
|
2903
|
+
* --------------------------------------------
|
|
2904
|
+
*/
|
|
2905
|
+
|
|
2906
|
+
export type StylableComponent =
|
|
2907
|
+
| GuiComponent
|
|
2908
|
+
| ComponentType<any>
|
|
2909
|
+
| ForwardRefExoticComponent<any>
|
|
2910
|
+
| ReactComponentWithRef<any, any>
|
|
2911
|
+
| (new (props: any) => any)
|
|
2912
|
+
|
|
2913
|
+
export type SpreadKeys =
|
|
2914
|
+
| '...fontSize'
|
|
2915
|
+
| '...fontStyle'
|
|
2916
|
+
| '...fontTransform'
|
|
2917
|
+
| '...lineHeight'
|
|
2918
|
+
| '...letterSpacing'
|
|
2919
|
+
| '...size'
|
|
2920
|
+
| '...space'
|
|
2921
|
+
| '...color'
|
|
2922
|
+
| '...zIndex'
|
|
2923
|
+
| '...theme'
|
|
2924
|
+
| '...radius'
|
|
2925
|
+
|
|
2926
|
+
export type VariantDefinitions<
|
|
2927
|
+
Parent extends StylableComponent = GuiComponent,
|
|
2928
|
+
StaticConfig extends StaticConfigPublic = Parent extends {
|
|
2929
|
+
__tama: [any, any, any, any, any, infer S]
|
|
2930
|
+
}
|
|
2931
|
+
? S
|
|
2932
|
+
: {},
|
|
2933
|
+
MyProps extends object = Partial<
|
|
2934
|
+
GetVariantProps<
|
|
2935
|
+
Parent,
|
|
2936
|
+
StaticConfig['isText'] extends true
|
|
2937
|
+
? true
|
|
2938
|
+
: StaticConfig['isInput'] extends true
|
|
2939
|
+
? true
|
|
2940
|
+
: false
|
|
2941
|
+
>
|
|
2942
|
+
>,
|
|
2943
|
+
Val = any,
|
|
2944
|
+
> = VariantDefinitionFromProps<MyProps, Val> & {
|
|
2945
|
+
_isEmpty?: 1
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
export type GetVariantProps<
|
|
2949
|
+
A extends StylableComponent,
|
|
2950
|
+
IsText extends boolean | undefined,
|
|
2951
|
+
> = A extends {
|
|
2952
|
+
__tama: [
|
|
2953
|
+
infer Props,
|
|
2954
|
+
any,
|
|
2955
|
+
infer NonStyledProps,
|
|
2956
|
+
infer BaseStyles,
|
|
2957
|
+
infer VariantProps,
|
|
2958
|
+
any,
|
|
2959
|
+
]
|
|
2960
|
+
}
|
|
2961
|
+
? Props extends TamaDefer
|
|
2962
|
+
? GetFinalProps<NonStyledProps, BaseStyles, VariantProps>
|
|
2963
|
+
: Props
|
|
2964
|
+
: WithThemeShorthandsPseudosMedia<
|
|
2965
|
+
IsText extends true ? TextStylePropsBase : StackStyleBase
|
|
2966
|
+
>
|
|
2967
|
+
|
|
2968
|
+
export type VariantDefinitionFromProps<MyProps, Val> = MyProps extends object
|
|
2969
|
+
? {
|
|
2970
|
+
[propName: string]:
|
|
2971
|
+
| VariantSpreadFunction<MyProps, Val>
|
|
2972
|
+
| ({
|
|
2973
|
+
[Key in SpreadKeys]?: Key extends '...fontSize'
|
|
2974
|
+
? FontSizeVariantSpreadFunction<MyProps>
|
|
2975
|
+
: Key extends '...size'
|
|
2976
|
+
? SizeVariantSpreadFunction<MyProps>
|
|
2977
|
+
: Key extends '...space'
|
|
2978
|
+
? SpaceVariantSpreadFunction<MyProps>
|
|
2979
|
+
: Key extends '...color'
|
|
2980
|
+
? ColorVariantSpreadFunction<MyProps>
|
|
2981
|
+
: Key extends '...lineHeight'
|
|
2982
|
+
? FontLineHeightVariantSpreadFunction<MyProps>
|
|
2983
|
+
: Key extends '...fontTransform'
|
|
2984
|
+
? FontTransformVariantSpreadFunction<MyProps>
|
|
2985
|
+
: Key extends '...fontStyle'
|
|
2986
|
+
? FontStyleVariantSpreadFunction<MyProps>
|
|
2987
|
+
: Key extends '...letterSpacing'
|
|
2988
|
+
? FontLetterSpacingVariantSpreadFunction<MyProps>
|
|
2989
|
+
: Key extends '...zIndex'
|
|
2990
|
+
? ZIndexVariantSpreadFunction<MyProps>
|
|
2991
|
+
: Key extends '...radius'
|
|
2992
|
+
? RadiusVariantSpreadFunction<MyProps>
|
|
2993
|
+
: Key extends '...theme'
|
|
2994
|
+
? ThemeVariantSpreadFunction<MyProps>
|
|
2995
|
+
: never
|
|
2996
|
+
} & {
|
|
2997
|
+
[Key in string | number | 'true' | 'false']?:
|
|
2998
|
+
| MyProps
|
|
2999
|
+
| VariantSpreadFunction<MyProps, Val>
|
|
3000
|
+
} & {
|
|
3001
|
+
[Key in VariantTypeKeys]?: Key extends ':number'
|
|
3002
|
+
? VariantSpreadFunction<MyProps, number>
|
|
3003
|
+
: Key extends ':boolean'
|
|
3004
|
+
? VariantSpreadFunction<MyProps, boolean>
|
|
3005
|
+
: Key extends ':string'
|
|
3006
|
+
? VariantSpreadFunction<MyProps, string>
|
|
3007
|
+
: never
|
|
3008
|
+
})
|
|
3009
|
+
}
|
|
3010
|
+
: {}
|
|
3011
|
+
|
|
3012
|
+
export type GenericStackVariants = VariantDefinitionFromProps<
|
|
3013
|
+
StackNonStyleProps & StackStyle,
|
|
3014
|
+
any
|
|
3015
|
+
>
|
|
3016
|
+
export type GenericTextVariants = VariantDefinitionFromProps<TextProps, any>
|
|
3017
|
+
|
|
3018
|
+
export type VariantSpreadExtras<Props> = {
|
|
3019
|
+
fonts: GuiConfig['fonts']
|
|
3020
|
+
tokens: TokensParsed
|
|
3021
|
+
theme: Themes extends { [key: string]: infer B } ? B : unknown
|
|
3022
|
+
props: Props
|
|
3023
|
+
fontFamily?: FontFamilyTokens
|
|
3024
|
+
font?: Font
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
type PropLike = { [key: string]: any }
|
|
3028
|
+
|
|
3029
|
+
export type VariantSpreadFunction<Props extends PropLike, Val = any> = (
|
|
3030
|
+
val: Val,
|
|
3031
|
+
config: VariantSpreadExtras<Props>
|
|
3032
|
+
) =>
|
|
3033
|
+
| {
|
|
3034
|
+
[Key in keyof Props]: Props[Key] | Variable | VariableVal
|
|
3035
|
+
}
|
|
3036
|
+
| null
|
|
3037
|
+
| undefined
|
|
3038
|
+
|
|
3039
|
+
export type VariantTypeKeys = ':string' | ':boolean' | ':number'
|
|
3040
|
+
|
|
3041
|
+
export type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`
|
|
3042
|
+
? ThemeValueByCategory<VariantSpread>
|
|
3043
|
+
: Key extends 'true' | 'false'
|
|
3044
|
+
? boolean
|
|
3045
|
+
: Key extends ':string'
|
|
3046
|
+
? string
|
|
3047
|
+
: Key extends ':boolean'
|
|
3048
|
+
? boolean
|
|
3049
|
+
: Key extends ':number'
|
|
3050
|
+
? number
|
|
3051
|
+
: Key
|
|
3052
|
+
|
|
3053
|
+
export type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3054
|
+
A,
|
|
3055
|
+
FontSizeTokens
|
|
3056
|
+
>
|
|
3057
|
+
export type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3058
|
+
A,
|
|
3059
|
+
SizeTokens
|
|
3060
|
+
>
|
|
3061
|
+
export type SpaceVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3062
|
+
A,
|
|
3063
|
+
SpaceTokens
|
|
3064
|
+
>
|
|
3065
|
+
export type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3066
|
+
A,
|
|
3067
|
+
ColorTokens
|
|
3068
|
+
>
|
|
3069
|
+
export type FontLineHeightVariantSpreadFunction<A extends PropLike> =
|
|
3070
|
+
VariantSpreadFunction<A, FontLineHeightTokens>
|
|
3071
|
+
export type FontLetterSpacingVariantSpreadFunction<A extends PropLike> =
|
|
3072
|
+
VariantSpreadFunction<A, FontLetterSpacingTokens>
|
|
3073
|
+
export type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3074
|
+
A,
|
|
3075
|
+
FontStyleTokens
|
|
3076
|
+
>
|
|
3077
|
+
export type FontTransformVariantSpreadFunction<A extends PropLike> =
|
|
3078
|
+
VariantSpreadFunction<A, FontTransformTokens>
|
|
3079
|
+
export type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3080
|
+
A,
|
|
3081
|
+
ZIndexTokens
|
|
3082
|
+
>
|
|
3083
|
+
export type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3084
|
+
A,
|
|
3085
|
+
RadiusTokens
|
|
3086
|
+
>
|
|
3087
|
+
export type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
3088
|
+
A,
|
|
3089
|
+
ThemeTokens
|
|
3090
|
+
>
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* --------------------------------------------
|
|
3094
|
+
* end variants
|
|
3095
|
+
* --------------------------------------------
|
|
3096
|
+
*/
|
|
3097
|
+
|
|
3098
|
+
export type ResolveVariableAs =
|
|
3099
|
+
| 'auto'
|
|
3100
|
+
| 'value'
|
|
3101
|
+
| 'variable'
|
|
3102
|
+
| 'none'
|
|
3103
|
+
| 'web'
|
|
3104
|
+
| 'except-theme'
|
|
3105
|
+
|
|
3106
|
+
export type SplitStyleProps = {
|
|
3107
|
+
styledContext?: Record<string, any>
|
|
3108
|
+
mediaState?: Record<string, boolean>
|
|
3109
|
+
noClass?: boolean
|
|
3110
|
+
noExpand?: boolean
|
|
3111
|
+
noNormalize?: boolean | 'values'
|
|
3112
|
+
noSkip?: boolean
|
|
3113
|
+
noMergeStyle?: boolean
|
|
3114
|
+
resolveValues?: ResolveVariableAs
|
|
3115
|
+
disableExpandShorthands?: boolean
|
|
3116
|
+
fallbackProps?: Record<string, any>
|
|
3117
|
+
hasTextAncestor?: boolean
|
|
3118
|
+
// for animations
|
|
3119
|
+
willBeAnimated?: boolean // we need to track media queries even before animation
|
|
3120
|
+
isAnimated: boolean
|
|
3121
|
+
isExiting?: boolean
|
|
3122
|
+
exitVariant?: string
|
|
3123
|
+
enterVariant?: string
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
// Presence
|
|
3127
|
+
|
|
3128
|
+
export interface PresenceContextProps {
|
|
3129
|
+
id: string
|
|
3130
|
+
isPresent: boolean
|
|
3131
|
+
register: (id: string) => () => void
|
|
3132
|
+
onExitComplete?: (id: string) => void
|
|
3133
|
+
initial?: false | string | string[]
|
|
3134
|
+
custom?: any
|
|
3135
|
+
exitVariant?: string | null
|
|
3136
|
+
enterVariant?: string | null
|
|
3137
|
+
enterExitVariant?: string | null
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
type SafeToRemoveCallback = () => void
|
|
3141
|
+
type AlwaysPresent = [true, null, null]
|
|
3142
|
+
type Present = [true, undefined, PresenceContextProps]
|
|
3143
|
+
type NotPresent = [false, SafeToRemoveCallback, PresenceContextProps]
|
|
3144
|
+
|
|
3145
|
+
export type UsePresenceResult = AlwaysPresent | Present | NotPresent
|
|
3146
|
+
|
|
3147
|
+
// Animations:
|
|
3148
|
+
|
|
3149
|
+
type AnimationConfig = {
|
|
3150
|
+
[key: string]: any
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
// includes a very limited adapter between various impls for number => style
|
|
3154
|
+
// this is useful only in limited scenarios like `Sheet`, but necessary in those cases
|
|
3155
|
+
// TODO: make css driver compatible with this?
|
|
3156
|
+
|
|
3157
|
+
export type AnimatedNumberStrategy =
|
|
3158
|
+
// only values shared between reanimated/react-native for now
|
|
3159
|
+
| {
|
|
3160
|
+
type: 'spring'
|
|
3161
|
+
stiffness?: number
|
|
3162
|
+
damping?: number
|
|
3163
|
+
mass?: number
|
|
3164
|
+
overshootClamping?: boolean
|
|
3165
|
+
restSpeedThreshold?: number
|
|
3166
|
+
restDisplacementThreshold?: number
|
|
3167
|
+
}
|
|
3168
|
+
| { type: 'timing'; duration: number }
|
|
3169
|
+
| { type: 'direct' }
|
|
3170
|
+
|
|
3171
|
+
export type UniversalAnimatedNumber<A> = {
|
|
3172
|
+
getInstance(): A
|
|
3173
|
+
getValue(): number
|
|
3174
|
+
setValue(next: number, config?: AnimatedNumberStrategy, onFinished?: () => void): void
|
|
3175
|
+
stop(): void
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
export type UseAnimatedNumberReaction<
|
|
3179
|
+
V extends UniversalAnimatedNumber<any> = UniversalAnimatedNumber<any>,
|
|
3180
|
+
> = (
|
|
3181
|
+
opts: {
|
|
3182
|
+
value: V
|
|
3183
|
+
hostRef: RefObject<GuiElement>
|
|
3184
|
+
},
|
|
3185
|
+
onValue: (current: number) => void
|
|
3186
|
+
) => void
|
|
3187
|
+
|
|
3188
|
+
export type UseAnimatedNumberStyle<
|
|
3189
|
+
V extends UniversalAnimatedNumber<any> = UniversalAnimatedNumber<any>,
|
|
3190
|
+
> = (val: V, getStyle: (current: any) => any) => any
|
|
3191
|
+
|
|
3192
|
+
export type UseAnimatedNumber<
|
|
3193
|
+
N extends UniversalAnimatedNumber<any> = UniversalAnimatedNumber<any>,
|
|
3194
|
+
> = (initial: number) => N
|
|
3195
|
+
|
|
3196
|
+
export type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
|
|
3197
|
+
isReactNative?: boolean
|
|
3198
|
+
/** What style format the driver expects as input: 'css' (CSS variables) or 'value' (resolved values) */
|
|
3199
|
+
inputStyle?: 'css' | 'value'
|
|
3200
|
+
/** How the driver outputs styles: 'css' (className-based) or 'inline' (style object) */
|
|
3201
|
+
outputStyle?: 'css' | 'inline'
|
|
3202
|
+
needsCustomComponent?: boolean
|
|
3203
|
+
avoidReRenders?: boolean
|
|
3204
|
+
onMount?: () => void
|
|
3205
|
+
/** When true, this is a stub driver with no real animation support */
|
|
3206
|
+
isStub?: boolean
|
|
3207
|
+
useAnimations: UseAnimationHook
|
|
3208
|
+
usePresence: () => UsePresenceResult
|
|
3209
|
+
ResetPresence: (props: {
|
|
3210
|
+
children?: React.ReactNode
|
|
3211
|
+
disabled?: boolean
|
|
3212
|
+
}) => React.ReactNode
|
|
3213
|
+
useAnimatedNumber: UseAnimatedNumber
|
|
3214
|
+
useAnimatedNumberStyle: UseAnimatedNumberStyle
|
|
3215
|
+
useAnimatedNumberReaction: UseAnimatedNumberReaction
|
|
3216
|
+
animations: A
|
|
3217
|
+
View?: any
|
|
3218
|
+
Text?: any
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
export type UseAnimationProps = GuiComponentPropsBase & Record<string, any>
|
|
3222
|
+
|
|
3223
|
+
type UseStyleListener = (
|
|
3224
|
+
nextStyle: Record<string, unknown>,
|
|
3225
|
+
effectiveTransition?: TransitionProp | null
|
|
3226
|
+
) => void
|
|
3227
|
+
export type UseStyleEmitter = (cb: UseStyleListener) => void
|
|
3228
|
+
|
|
3229
|
+
export type UseAnimationHook = (props: {
|
|
3230
|
+
style: Record<string, any>
|
|
3231
|
+
props: Record<string, any>
|
|
3232
|
+
presence?: UsePresenceResult | null
|
|
3233
|
+
staticConfig: StaticConfig
|
|
3234
|
+
styleProps: SplitStyleProps
|
|
3235
|
+
componentState: GuiComponentState
|
|
3236
|
+
useStyleEmitter?: UseStyleEmitter
|
|
3237
|
+
theme: ThemeParsed
|
|
3238
|
+
themeName: string
|
|
3239
|
+
pseudos: WithPseudoProps<ViewStyle> | null
|
|
3240
|
+
stateRef: { current: GuiComponentStateRef }
|
|
3241
|
+
onDidAnimate?: any
|
|
3242
|
+
delay?: number
|
|
3243
|
+
}) => null | {
|
|
3244
|
+
style?: StackStyleBase | StackStyleBase[]
|
|
3245
|
+
className?: string
|
|
3246
|
+
ref?: any
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
export type GestureReponderEvent =
|
|
3250
|
+
Exclude<View['props']['onResponderMove'], void> extends (event: infer Event) => void
|
|
3251
|
+
? Event
|
|
3252
|
+
: never
|
|
3253
|
+
|
|
3254
|
+
export type RulesToInsert = Record<string, StyleObject>
|
|
3255
|
+
|
|
3256
|
+
export type GetStyleResult = {
|
|
3257
|
+
pseudos?: PseudoStyles | null
|
|
3258
|
+
style: ViewStyle | null
|
|
3259
|
+
classNames: ClassNamesObject
|
|
3260
|
+
rulesToInsert: RulesToInsert
|
|
3261
|
+
viewProps: (StackNonStyleProps & StackStyle) & Record<string, any>
|
|
3262
|
+
fontFamily: string | undefined
|
|
3263
|
+
space?: any // SpaceTokens?
|
|
3264
|
+
hasMedia: boolean | Set<string>
|
|
3265
|
+
dynamicThemeAccess?: boolean
|
|
3266
|
+
pseudoGroups?: Set<string>
|
|
3267
|
+
mediaGroups?: Set<string>
|
|
3268
|
+
// Style values that override context props (for issues #3670, #3676)
|
|
3269
|
+
overriddenContextProps?: Record<string, any>
|
|
3270
|
+
// Transitions extracted from pseudo-style props (e.g., hoverStyle.transition)
|
|
3271
|
+
pseudoTransitions?: PseudoTransitions | null
|
|
3272
|
+
// Effective transition to use (accounts for entering pseudo states)
|
|
3273
|
+
effectiveTransition?: TransitionProp | null
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
export type ClassNamesObject = Record<string, string>
|
|
3277
|
+
|
|
3278
|
+
export type ModifyGuiComponentStyleProps<
|
|
3279
|
+
Comp extends GuiComponent,
|
|
3280
|
+
ChangedProps extends object,
|
|
3281
|
+
> =
|
|
3282
|
+
Comp extends GuiComponent<infer A, infer B, infer C, infer D, infer E>
|
|
3283
|
+
? A extends object
|
|
3284
|
+
? GuiComponent<Omit<A, keyof ChangedProps> & ChangedProps, B, C, D, E>
|
|
3285
|
+
: never
|
|
3286
|
+
: never
|
|
3287
|
+
|
|
3288
|
+
/**
|
|
3289
|
+
* Narrow copied from ts-toolbelt
|
|
3290
|
+
* https://github.com/millsp/ts-toolbelt/blob/master/sources/Function/Narrow.ts
|
|
3291
|
+
*/
|
|
3292
|
+
export type Try<A1, A2, Catch = never> = A1 extends A2 ? A1 : Catch
|
|
3293
|
+
|
|
3294
|
+
type Narrowable = string | number | bigint | boolean
|
|
3295
|
+
|
|
3296
|
+
type NarrowRaw<A> =
|
|
3297
|
+
| (A extends [] ? [] : never)
|
|
3298
|
+
| (A extends Narrowable ? A : never)
|
|
3299
|
+
| {
|
|
3300
|
+
[K in keyof A]: A[K] extends Function ? A[K] : NarrowRaw<A[K]>
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
export type Narrow<A> = Try<A, [], NarrowRaw<A>>
|
|
3304
|
+
|
|
3305
|
+
/**
|
|
3306
|
+
* `StyleProp` copied from React Native:
|
|
3307
|
+
* Exported to fix https://github.com/hanzoai/gui/issues/1258
|
|
3308
|
+
*/
|
|
3309
|
+
|
|
3310
|
+
export type Falsy = undefined | null | false | ''
|
|
3311
|
+
export interface RecursiveArray<T> extends Array<
|
|
3312
|
+
T | ReadonlyArray<T> | RecursiveArray<T>
|
|
3313
|
+
> {}
|
|
3314
|
+
/** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle<T>` and return `T`. */
|
|
3315
|
+
|
|
3316
|
+
export type RegisteredStyle<T> = number & { __registeredStyleBrand: T }
|
|
3317
|
+
|
|
3318
|
+
export type StyleProp<T> =
|
|
3319
|
+
| T
|
|
3320
|
+
| RegisteredStyle<T>
|
|
3321
|
+
| RecursiveArray<T | RegisteredStyle<T> | Falsy>
|
|
3322
|
+
| Falsy
|
|
3323
|
+
|
|
3324
|
+
export type FillInFont<A extends GenericFont, DefaultKeys extends string | number> = {
|
|
3325
|
+
family: string
|
|
3326
|
+
lineHeight: FillInFontValues<A, 'lineHeight', DefaultKeys>
|
|
3327
|
+
weight: FillInFontValues<A, 'weight', DefaultKeys>
|
|
3328
|
+
letterSpacing: FillInFontValues<A, 'letterSpacing', DefaultKeys>
|
|
3329
|
+
size: FillInFontValues<A, 'size', DefaultKeys>
|
|
3330
|
+
style: FillInFontValues<A, 'style', DefaultKeys>
|
|
3331
|
+
transform: FillInFontValues<A, 'transform', DefaultKeys>
|
|
3332
|
+
color: FillInFontValues<A, 'color', DefaultKeys>
|
|
3333
|
+
face: Partial<A['face']>
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
type FillInFontValues<
|
|
3337
|
+
A extends GenericFont,
|
|
3338
|
+
K extends keyof A,
|
|
3339
|
+
DefaultKeys extends string | number,
|
|
3340
|
+
> = keyof A[K] extends GenericFontKey
|
|
3341
|
+
? {
|
|
3342
|
+
[Key in DefaultKeys]: A[K][any]
|
|
3343
|
+
}
|
|
3344
|
+
: {
|
|
3345
|
+
[Key in keyof A[K] | DefaultKeys]: Key extends keyof A[K]
|
|
3346
|
+
? Exclude<A[K][Key], Variable>
|
|
3347
|
+
: any
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
export type ThemesLikeObject = Record<string, Record<string, string>>
|
|
3351
|
+
|
|
3352
|
+
// dedupe themes to avoid duplicate CSS generation
|
|
3353
|
+
export type DedupedTheme = {
|
|
3354
|
+
names: string[]
|
|
3355
|
+
theme: ThemeParsed
|
|
3356
|
+
}
|
|
3357
|
+
|
|
3358
|
+
export type DedupedThemes = DedupedTheme[]
|
|
3359
|
+
|
|
3360
|
+
export type UseMediaState = {
|
|
3361
|
+
[key in MediaQueryKey]: boolean
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
export type TamaDefer = { __tamaDefer: true }
|