@tamagui/web 1.114.3 → 1.115.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/dist/cjs/Tamagui.cjs +80 -0
- package/dist/cjs/_withStableStyle.cjs +51 -0
- package/dist/cjs/config.cjs +111 -0
- package/dist/cjs/constants/{accessibilityDirectMap.js → accessibilityDirectMap.cjs} +19 -11
- package/dist/cjs/constants/accessibilityDirectMap.native.cjs +34 -0
- package/dist/cjs/constants/accessibilityDirectMap.native.cjs.map +6 -0
- package/dist/cjs/constants/constants.cjs +45 -0
- package/dist/cjs/constants/isDevTools.cjs +31 -0
- package/dist/cjs/constants/webToNativeProps.cjs +28 -0
- package/dist/cjs/constants/webToNativeProps.native.cjs +102 -0
- package/dist/cjs/constants/webToNativeProps.native.cjs.map +6 -0
- package/dist/cjs/contexts/{ComponentContext.js → ComponentContext.cjs} +17 -12
- package/dist/cjs/{createComponent.js → createComponent.cjs} +407 -317
- package/dist/cjs/createFont.cjs +42 -0
- package/dist/cjs/createShorthands.cjs +28 -0
- package/dist/cjs/createTamagui.cjs +235 -0
- package/dist/cjs/createTheme.cjs +26 -0
- package/dist/cjs/createTokens.cjs +29 -0
- package/dist/cjs/{createVariable.js → createVariable.cjs} +31 -24
- package/dist/cjs/createVariables.cjs +58 -0
- package/dist/cjs/defaultComponentState.cjs +44 -0
- package/dist/cjs/helpers/ThemeManager.cjs +184 -0
- package/dist/cjs/helpers/{ThemeManagerContext.js → ThemeManagerContext.cjs} +22 -14
- package/dist/cjs/helpers/createMediaStyle.cjs +96 -0
- package/dist/cjs/helpers/{createShallowSetState.js → createShallowSetState.cjs} +29 -22
- package/dist/cjs/helpers/createStyledContext.cjs +70 -0
- package/dist/cjs/helpers/defaultOffset.cjs +29 -0
- package/dist/cjs/helpers/expandStyle.cjs +67 -0
- package/dist/cjs/helpers/expandStyles.cjs +40 -0
- package/dist/cjs/helpers/getExpandedShorthands.cjs +33 -0
- package/dist/cjs/helpers/getFontLanguage.cjs +26 -0
- package/dist/cjs/helpers/getGroupPropParts.cjs +37 -0
- package/dist/cjs/helpers/{getSplitStyles.js → getSplitStyles.cjs} +362 -335
- package/dist/cjs/helpers/getStylesAtomic.cjs +176 -0
- package/dist/cjs/helpers/getStylesAtomic.native.cjs +33 -0
- package/dist/cjs/helpers/getStylesAtomic.native.cjs.map +6 -0
- package/dist/cjs/helpers/getThemeCSSRules.cjs +119 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.cjs +28 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.cjs.map +6 -0
- package/dist/cjs/helpers/getVariantExtras.cjs +65 -0
- package/dist/cjs/helpers/{insertStyleRule.js → insertStyleRule.cjs} +93 -96
- package/dist/cjs/helpers/isActivePlatform.cjs +35 -0
- package/dist/cjs/helpers/isObj.cjs +26 -0
- package/dist/cjs/helpers/isTamaguiComponent.cjs +29 -0
- package/dist/cjs/helpers/{isTamaguiElement.js → isTamaguiElement.cjs} +24 -15
- package/dist/cjs/helpers/log.cjs +36 -0
- package/dist/cjs/helpers/matchMedia.cjs +36 -0
- package/dist/cjs/helpers/matchMedia.native.cjs +39 -0
- package/dist/cjs/helpers/matchMedia.native.cjs.map +6 -0
- package/dist/cjs/helpers/mergeProps.cjs +45 -0
- package/dist/cjs/helpers/{mergeVariants.js → mergeVariants.cjs} +19 -17
- package/dist/cjs/helpers/normalizeColor.cjs +48 -0
- package/dist/cjs/helpers/{normalizeShadow.js → normalizeShadow.cjs} +22 -13
- package/dist/cjs/helpers/normalizeStyle.cjs +47 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.cjs +26 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.native.cjs +37 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.native.cjs.map +6 -0
- package/dist/cjs/helpers/{normalizeValueWithProperty.js → normalizeValueWithProperty.cjs} +22 -19
- package/dist/cjs/helpers/objectIdentityKey.cjs +39 -0
- package/dist/cjs/helpers/propMapper.cjs +254 -0
- package/dist/cjs/helpers/proxyThemeToParents.cjs +61 -0
- package/dist/cjs/helpers/{proxyThemeVariables.js → proxyThemeVariables.cjs} +16 -11
- package/dist/cjs/helpers/pseudoDescriptors.cjs +72 -0
- package/dist/cjs/helpers/registerCSSVariable.cjs +33 -0
- package/dist/cjs/helpers/setElementProps.cjs +29 -0
- package/dist/cjs/helpers/setElementProps.native.cjs +30 -0
- package/dist/cjs/helpers/setElementProps.native.cjs.map +6 -0
- package/dist/cjs/helpers/{skipProps.js → skipProps.cjs} +17 -12
- package/dist/cjs/helpers/sortString.cjs +26 -0
- package/dist/cjs/helpers/{subscribeToContextGroup.js → subscribeToContextGroup.cjs} +25 -17
- package/dist/cjs/helpers/themeable.cjs +83 -0
- package/dist/cjs/helpers/{themes.js → themes.cjs} +17 -12
- package/dist/cjs/helpers/timer.cjs +32 -0
- package/dist/cjs/helpers/transformsToString.cjs +37 -0
- package/dist/cjs/helpers/webPropsToSkip.cjs +26 -0
- package/dist/cjs/helpers/webPropsToSkip.native.cjs +79 -0
- package/dist/cjs/helpers/webPropsToSkip.native.cjs.map +6 -0
- package/dist/cjs/helpers/wrapStyleTags.cjs +40 -0
- package/dist/cjs/hooks/{useComponentState.js → useComponentState.cjs} +75 -30
- package/dist/cjs/hooks/useConfiguration.cjs +55 -0
- package/dist/cjs/hooks/{useDidHydrateOnce.js → useDidHydrateOnce.cjs} +27 -16
- package/dist/cjs/hooks/useDisableSSR.cjs +29 -0
- package/dist/cjs/hooks/useIsTouchDevice.cjs +28 -0
- package/dist/cjs/hooks/useMedia.cjs +227 -0
- package/dist/cjs/hooks/useProps.cjs +108 -0
- package/dist/cjs/hooks/useTheme.cjs +277 -0
- package/dist/cjs/hooks/useThemeName.cjs +50 -0
- package/dist/cjs/index.cjs +106 -0
- package/dist/cjs/inject-styles.cjs +37 -0
- package/dist/cjs/insertFont.cjs +72 -0
- package/dist/cjs/interfaces/CSSColorNames.cjs +16 -0
- package/dist/cjs/interfaces/GetRef.cjs +16 -0
- package/dist/cjs/interfaces/KeyTypes.cjs +16 -0
- package/dist/cjs/interfaces/RNExclusiveTypes.cjs +16 -0
- package/dist/cjs/interfaces/Role.cjs +16 -0
- package/dist/cjs/interfaces/TamaguiComponentEvents.cjs +16 -0
- package/dist/cjs/interfaces/{TamaguiComponentPropsBaseBase.js → TamaguiComponentPropsBaseBase.cjs} +8 -6
- package/dist/cjs/interfaces/TamaguiComponentState.cjs +16 -0
- package/dist/cjs/interfaces/WebOnlyPressEvents.cjs +16 -0
- package/dist/cjs/setupHooks.cjs +30 -0
- package/dist/cjs/setupReactNative.cjs +49 -0
- package/dist/cjs/styled.cjs +87 -0
- package/dist/cjs/type-utils.cjs +16 -0
- package/dist/cjs/types.cjs +19 -0
- package/dist/cjs/views/Configuration.cjs +47 -0
- package/dist/cjs/views/FontLanguage.cjs +37 -0
- package/dist/cjs/views/FontLanguage.native.cjs +50 -0
- package/dist/cjs/views/FontLanguage.native.cjs.map +6 -0
- package/dist/cjs/views/FontLanguage.types.cjs +16 -0
- package/dist/cjs/views/Slot.cjs +78 -0
- package/dist/cjs/views/Stack.cjs +34 -0
- package/dist/cjs/views/TamaguiProvider.cjs +93 -0
- package/dist/cjs/views/Text.cjs +86 -0
- package/dist/cjs/views/Theme.cjs +145 -0
- package/dist/cjs/views/ThemeDebug.cjs +92 -0
- package/dist/cjs/views/ThemeDebug.native.cjs +33 -0
- package/dist/cjs/views/ThemeDebug.native.cjs.map +6 -0
- package/dist/cjs/views/ThemeProvider.cjs +56 -0
- package/dist/cjs/views/View.cjs +33 -0
- package/package.json +15 -14
- package/dist/cjs/Tamagui.js +0 -63
- package/dist/cjs/_withStableStyle.js +0 -33
- package/dist/cjs/config.js +0 -97
- package/dist/cjs/constants/constants.js +0 -36
- package/dist/cjs/constants/isDevTools.js +0 -28
- package/dist/cjs/constants/webToNativeProps.js +0 -22
- package/dist/cjs/createFont.js +0 -53
- package/dist/cjs/createShorthands.js +0 -23
- package/dist/cjs/createTamagui.js +0 -189
- package/dist/cjs/createTheme.js +0 -21
- package/dist/cjs/createTokens.js +0 -24
- package/dist/cjs/createVariables.js +0 -47
- package/dist/cjs/defaultComponentState.js +0 -37
- package/dist/cjs/helpers/ThemeManager.js +0 -166
- package/dist/cjs/helpers/createMediaStyle.js +0 -74
- package/dist/cjs/helpers/createStyledContext.js +0 -53
- package/dist/cjs/helpers/defaultOffset.js +0 -21
- package/dist/cjs/helpers/expandStyle.js +0 -73
- package/dist/cjs/helpers/expandStyles.js +0 -34
- package/dist/cjs/helpers/getExpandedShorthands.js +0 -29
- package/dist/cjs/helpers/getFontLanguage.js +0 -21
- package/dist/cjs/helpers/getGroupPropParts.js +0 -27
- package/dist/cjs/helpers/getStylesAtomic.js +0 -152
- package/dist/cjs/helpers/getThemeCSSRules.js +0 -89
- package/dist/cjs/helpers/getVariantExtras.js +0 -58
- package/dist/cjs/helpers/isActivePlatform.js +0 -29
- package/dist/cjs/helpers/isObj.js +0 -21
- package/dist/cjs/helpers/isTamaguiComponent.js +0 -24
- package/dist/cjs/helpers/log.js +0 -31
- package/dist/cjs/helpers/matchMedia.js +0 -34
- package/dist/cjs/helpers/mergeProps.js +0 -41
- package/dist/cjs/helpers/normalizeColor.js +0 -43
- package/dist/cjs/helpers/normalizeStyle.js +0 -36
- package/dist/cjs/helpers/normalizeStylePropKeys.js +0 -21
- package/dist/cjs/helpers/objectIdentityKey.js +0 -38
- package/dist/cjs/helpers/propMapper.js +0 -238
- package/dist/cjs/helpers/proxyThemeToParents.js +0 -52
- package/dist/cjs/helpers/pseudoDescriptors.js +0 -65
- package/dist/cjs/helpers/registerCSSVariable.js +0 -29
- package/dist/cjs/helpers/setElementProps.js +0 -24
- package/dist/cjs/helpers/sortString.js +0 -21
- package/dist/cjs/helpers/themeable.js +0 -63
- package/dist/cjs/helpers/timer.js +0 -27
- package/dist/cjs/helpers/transformsToString.js +0 -32
- package/dist/cjs/helpers/webPropsToSkip.js +0 -21
- package/dist/cjs/helpers/wrapStyleTags.js +0 -39
- package/dist/cjs/hooks/useConfiguration.js +0 -37
- package/dist/cjs/hooks/useDisableSSR.js +0 -24
- package/dist/cjs/hooks/useIsTouchDevice.js +0 -22
- package/dist/cjs/hooks/useMedia.js +0 -206
- package/dist/cjs/hooks/useProps.js +0 -95
- package/dist/cjs/hooks/useTheme.js +0 -263
- package/dist/cjs/hooks/useThemeName.js +0 -39
- package/dist/cjs/index.js +0 -99
- package/dist/cjs/inject-styles.js +0 -28
- package/dist/cjs/insertFont.js +0 -65
- package/dist/cjs/interfaces/CSSColorNames.js +0 -14
- package/dist/cjs/interfaces/GetRef.js +0 -14
- package/dist/cjs/interfaces/KeyTypes.js +0 -14
- package/dist/cjs/interfaces/RNExclusiveTypes.js +0 -14
- package/dist/cjs/interfaces/Role.js +0 -14
- package/dist/cjs/interfaces/TamaguiComponentEvents.js +0 -14
- package/dist/cjs/interfaces/TamaguiComponentState.js +0 -14
- package/dist/cjs/interfaces/WebOnlyPressEvents.js +0 -14
- package/dist/cjs/setupHooks.js +0 -25
- package/dist/cjs/setupReactNative.js +0 -46
- package/dist/cjs/styled.js +0 -74
- package/dist/cjs/type-utils.js +0 -14
- package/dist/cjs/types.js +0 -16
- package/dist/cjs/views/Configuration.js +0 -34
- package/dist/cjs/views/FontLanguage.js +0 -32
- package/dist/cjs/views/FontLanguage.types.js +0 -14
- package/dist/cjs/views/Slot.js +0 -59
- package/dist/cjs/views/Stack.js +0 -27
- package/dist/cjs/views/TamaguiProvider.js +0 -76
- package/dist/cjs/views/Text.js +0 -77
- package/dist/cjs/views/Theme.js +0 -103
- package/dist/cjs/views/ThemeDebug.js +0 -94
- package/dist/cjs/views/ThemeProvider.js +0 -45
- package/dist/cjs/views/View.js +0 -26
- /package/dist/cjs/{Tamagui.js.map → Tamagui.cjs.map} +0 -0
- /package/dist/cjs/{_withStableStyle.js.map → _withStableStyle.cjs.map} +0 -0
- /package/dist/cjs/{config.js.map → config.cjs.map} +0 -0
- /package/dist/cjs/constants/{accessibilityDirectMap.js.map → accessibilityDirectMap.cjs.map} +0 -0
- /package/dist/cjs/constants/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/constants/{isDevTools.js.map → isDevTools.cjs.map} +0 -0
- /package/dist/cjs/constants/{webToNativeProps.js.map → webToNativeProps.cjs.map} +0 -0
- /package/dist/cjs/contexts/{ComponentContext.js.map → ComponentContext.cjs.map} +0 -0
- /package/dist/cjs/{createComponent.js.map → createComponent.cjs.map} +0 -0
- /package/dist/cjs/{createFont.js.map → createFont.cjs.map} +0 -0
- /package/dist/cjs/{createShorthands.js.map → createShorthands.cjs.map} +0 -0
- /package/dist/cjs/{createTamagui.js.map → createTamagui.cjs.map} +0 -0
- /package/dist/cjs/{createTheme.js.map → createTheme.cjs.map} +0 -0
- /package/dist/cjs/{createTokens.js.map → createTokens.cjs.map} +0 -0
- /package/dist/cjs/{createVariable.js.map → createVariable.cjs.map} +0 -0
- /package/dist/cjs/{createVariables.js.map → createVariables.cjs.map} +0 -0
- /package/dist/cjs/{defaultComponentState.js.map → defaultComponentState.cjs.map} +0 -0
- /package/dist/cjs/helpers/{ThemeManager.js.map → ThemeManager.cjs.map} +0 -0
- /package/dist/cjs/helpers/{ThemeManagerContext.js.map → ThemeManagerContext.cjs.map} +0 -0
- /package/dist/cjs/helpers/{createMediaStyle.js.map → createMediaStyle.cjs.map} +0 -0
- /package/dist/cjs/helpers/{createShallowSetState.js.map → createShallowSetState.cjs.map} +0 -0
- /package/dist/cjs/helpers/{createStyledContext.js.map → createStyledContext.cjs.map} +0 -0
- /package/dist/cjs/helpers/{defaultOffset.js.map → defaultOffset.cjs.map} +0 -0
- /package/dist/cjs/helpers/{expandStyle.js.map → expandStyle.cjs.map} +0 -0
- /package/dist/cjs/helpers/{expandStyles.js.map → expandStyles.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getExpandedShorthands.js.map → getExpandedShorthands.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getFontLanguage.js.map → getFontLanguage.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getGroupPropParts.js.map → getGroupPropParts.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getSplitStyles.js.map → getSplitStyles.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getStylesAtomic.js.map → getStylesAtomic.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getThemeCSSRules.js.map → getThemeCSSRules.cjs.map} +0 -0
- /package/dist/cjs/helpers/{getVariantExtras.js.map → getVariantExtras.cjs.map} +0 -0
- /package/dist/cjs/helpers/{insertStyleRule.js.map → insertStyleRule.cjs.map} +0 -0
- /package/dist/cjs/helpers/{isActivePlatform.js.map → isActivePlatform.cjs.map} +0 -0
- /package/dist/cjs/helpers/{isObj.js.map → isObj.cjs.map} +0 -0
- /package/dist/cjs/helpers/{isTamaguiComponent.js.map → isTamaguiComponent.cjs.map} +0 -0
- /package/dist/cjs/helpers/{isTamaguiElement.js.map → isTamaguiElement.cjs.map} +0 -0
- /package/dist/cjs/helpers/{log.js.map → log.cjs.map} +0 -0
- /package/dist/cjs/helpers/{matchMedia.js.map → matchMedia.cjs.map} +0 -0
- /package/dist/cjs/helpers/{mergeProps.js.map → mergeProps.cjs.map} +0 -0
- /package/dist/cjs/helpers/{mergeVariants.js.map → mergeVariants.cjs.map} +0 -0
- /package/dist/cjs/helpers/{normalizeColor.js.map → normalizeColor.cjs.map} +0 -0
- /package/dist/cjs/helpers/{normalizeShadow.js.map → normalizeShadow.cjs.map} +0 -0
- /package/dist/cjs/helpers/{normalizeStyle.js.map → normalizeStyle.cjs.map} +0 -0
- /package/dist/cjs/helpers/{normalizeStylePropKeys.js.map → normalizeStylePropKeys.cjs.map} +0 -0
- /package/dist/cjs/helpers/{normalizeValueWithProperty.js.map → normalizeValueWithProperty.cjs.map} +0 -0
- /package/dist/cjs/helpers/{objectIdentityKey.js.map → objectIdentityKey.cjs.map} +0 -0
- /package/dist/cjs/helpers/{propMapper.js.map → propMapper.cjs.map} +0 -0
- /package/dist/cjs/helpers/{proxyThemeToParents.js.map → proxyThemeToParents.cjs.map} +0 -0
- /package/dist/cjs/helpers/{proxyThemeVariables.js.map → proxyThemeVariables.cjs.map} +0 -0
- /package/dist/cjs/helpers/{pseudoDescriptors.js.map → pseudoDescriptors.cjs.map} +0 -0
- /package/dist/cjs/helpers/{registerCSSVariable.js.map → registerCSSVariable.cjs.map} +0 -0
- /package/dist/cjs/helpers/{setElementProps.js.map → setElementProps.cjs.map} +0 -0
- /package/dist/cjs/helpers/{skipProps.js.map → skipProps.cjs.map} +0 -0
- /package/dist/cjs/helpers/{sortString.js.map → sortString.cjs.map} +0 -0
- /package/dist/cjs/helpers/{subscribeToContextGroup.js.map → subscribeToContextGroup.cjs.map} +0 -0
- /package/dist/cjs/helpers/{themeable.js.map → themeable.cjs.map} +0 -0
- /package/dist/cjs/helpers/{themes.js.map → themes.cjs.map} +0 -0
- /package/dist/cjs/helpers/{timer.js.map → timer.cjs.map} +0 -0
- /package/dist/cjs/helpers/{transformsToString.js.map → transformsToString.cjs.map} +0 -0
- /package/dist/cjs/helpers/{webPropsToSkip.js.map → webPropsToSkip.cjs.map} +0 -0
- /package/dist/cjs/helpers/{wrapStyleTags.js.map → wrapStyleTags.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useComponentState.js.map → useComponentState.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useConfiguration.js.map → useConfiguration.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useDidHydrateOnce.js.map → useDidHydrateOnce.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useDisableSSR.js.map → useDisableSSR.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useIsTouchDevice.js.map → useIsTouchDevice.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useMedia.js.map → useMedia.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useProps.js.map → useProps.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useTheme.js.map → useTheme.cjs.map} +0 -0
- /package/dist/cjs/hooks/{useThemeName.js.map → useThemeName.cjs.map} +0 -0
- /package/dist/cjs/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/{inject-styles.js.map → inject-styles.cjs.map} +0 -0
- /package/dist/cjs/{insertFont.js.map → insertFont.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{CSSColorNames.js.map → CSSColorNames.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{GetRef.js.map → GetRef.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{KeyTypes.js.map → KeyTypes.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{RNExclusiveTypes.js.map → RNExclusiveTypes.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{Role.js.map → Role.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{TamaguiComponentEvents.js.map → TamaguiComponentEvents.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{TamaguiComponentPropsBaseBase.js.map → TamaguiComponentPropsBaseBase.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{TamaguiComponentState.js.map → TamaguiComponentState.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{WebOnlyPressEvents.js.map → WebOnlyPressEvents.cjs.map} +0 -0
- /package/dist/cjs/{setupHooks.js.map → setupHooks.cjs.map} +0 -0
- /package/dist/cjs/{setupReactNative.js.map → setupReactNative.cjs.map} +0 -0
- /package/dist/cjs/{styled.js.map → styled.cjs.map} +0 -0
- /package/dist/cjs/{type-utils.js.map → type-utils.cjs.map} +0 -0
- /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/views/{Configuration.js.map → Configuration.cjs.map} +0 -0
- /package/dist/cjs/views/{FontLanguage.js.map → FontLanguage.cjs.map} +0 -0
- /package/dist/cjs/views/{FontLanguage.types.js.map → FontLanguage.types.cjs.map} +0 -0
- /package/dist/cjs/views/{Slot.js.map → Slot.cjs.map} +0 -0
- /package/dist/cjs/views/{Stack.js.map → Stack.cjs.map} +0 -0
- /package/dist/cjs/views/{TamaguiProvider.js.map → TamaguiProvider.cjs.map} +0 -0
- /package/dist/cjs/views/{Text.js.map → Text.cjs.map} +0 -0
- /package/dist/cjs/views/{Theme.js.map → Theme.cjs.map} +0 -0
- /package/dist/cjs/views/{ThemeDebug.js.map → ThemeDebug.cjs.map} +0 -0
- /package/dist/cjs/views/{ThemeProvider.js.map → ThemeProvider.cjs.map} +0 -0
- /package/dist/cjs/views/{View.js.map → View.cjs.map} +0 -0
|
@@ -2,24 +2,33 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
15
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
18
23
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
24
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
23
32
|
var createComponent_exports = {};
|
|
24
33
|
__export(createComponent_exports, {
|
|
25
34
|
Spacer: () => Spacer,
|
|
@@ -29,43 +38,74 @@ __export(createComponent_exports, {
|
|
|
29
38
|
spacedChildren: () => spacedChildren
|
|
30
39
|
});
|
|
31
40
|
module.exports = __toCommonJS(createComponent_exports);
|
|
32
|
-
var import_compose_refs = require("@tamagui/compose-refs"),
|
|
41
|
+
var import_compose_refs = require("@tamagui/compose-refs"),
|
|
42
|
+
import_constants = require("@tamagui/constants"),
|
|
43
|
+
import_helpers = require("@tamagui/helpers"),
|
|
44
|
+
import_react = __toESM(require("react")),
|
|
45
|
+
import_config = require("./config.cjs"),
|
|
46
|
+
import_constants2 = require("./constants/constants.cjs"),
|
|
47
|
+
import_isDevTools = require("./constants/isDevTools.cjs"),
|
|
48
|
+
import_ComponentContext = require("./contexts/ComponentContext.cjs"),
|
|
49
|
+
import_createVariable = require("./createVariable.cjs"),
|
|
50
|
+
import_defaultComponentState = require("./defaultComponentState.cjs"),
|
|
51
|
+
import_getSplitStyles = require("./helpers/getSplitStyles.cjs"),
|
|
52
|
+
import_log = require("./helpers/log.cjs"),
|
|
53
|
+
import_mergeProps = require("./helpers/mergeProps.cjs"),
|
|
54
|
+
import_setElementProps = require("./helpers/setElementProps.cjs"),
|
|
55
|
+
import_subscribeToContextGroup = require("./helpers/subscribeToContextGroup.cjs"),
|
|
56
|
+
import_themeable = require("./helpers/themeable.cjs"),
|
|
57
|
+
import_wrapStyleTags = require("./helpers/wrapStyleTags.cjs"),
|
|
58
|
+
import_useComponentState = require("./hooks/useComponentState.cjs"),
|
|
59
|
+
import_useMedia = require("./hooks/useMedia.cjs"),
|
|
60
|
+
import_useTheme = require("./hooks/useTheme.cjs"),
|
|
61
|
+
import_setupHooks = require("./setupHooks.cjs"),
|
|
62
|
+
import_Slot = require("./views/Slot.cjs"),
|
|
63
|
+
import_Theme = require("./views/Theme.cjs"),
|
|
64
|
+
import_ThemeDebug = require("./views/ThemeDebug.cjs"),
|
|
65
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
33
66
|
let tamaguiConfig, time, debugKeyListeners, startVisualizer;
|
|
34
|
-
const componentSetStates = /* @__PURE__ */
|
|
67
|
+
const componentSetStates = /* @__PURE__ */new Set();
|
|
35
68
|
if (typeof document < "u") {
|
|
36
69
|
const cancelTouches = () => {
|
|
37
|
-
componentSetStates.forEach(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} : prev)
|
|
43
|
-
), componentSetStates.clear();
|
|
70
|
+
componentSetStates.forEach(setState => setState(prev => prev.press || prev.pressIn ? {
|
|
71
|
+
...prev,
|
|
72
|
+
press: !1,
|
|
73
|
+
pressIn: !1
|
|
74
|
+
} : prev)), componentSetStates.clear();
|
|
44
75
|
};
|
|
45
76
|
addEventListener("mouseup", cancelTouches), addEventListener("touchend", cancelTouches), addEventListener("touchcancel", cancelTouches), process.env.NODE_ENV === "development" && (startVisualizer = () => {
|
|
46
77
|
const devVisualizerConfig = import_config.devConfig?.visualizer;
|
|
47
78
|
if (devVisualizerConfig) {
|
|
48
|
-
debugKeyListeners = /* @__PURE__ */
|
|
49
|
-
let tm,
|
|
79
|
+
debugKeyListeners = /* @__PURE__ */new Set();
|
|
80
|
+
let tm,
|
|
81
|
+
isShowing = !1;
|
|
50
82
|
const options = {
|
|
51
83
|
key: "Alt",
|
|
52
84
|
delay: 800,
|
|
53
|
-
...typeof devVisualizerConfig == "object" ? devVisualizerConfig : {}
|
|
85
|
+
...(typeof devVisualizerConfig == "object" ? devVisualizerConfig : {})
|
|
54
86
|
};
|
|
55
87
|
document.addEventListener("blur", () => {
|
|
56
88
|
clearTimeout(tm);
|
|
57
|
-
}), document.addEventListener("keydown", ({
|
|
89
|
+
}), document.addEventListener("keydown", ({
|
|
90
|
+
key,
|
|
91
|
+
defaultPrevented
|
|
92
|
+
}) => {
|
|
58
93
|
defaultPrevented || (clearTimeout(tm), key === options.key && (tm = setTimeout(() => {
|
|
59
|
-
isShowing = !0, debugKeyListeners?.forEach(
|
|
94
|
+
isShowing = !0, debugKeyListeners?.forEach(l => l(!0));
|
|
60
95
|
}, options.delay)));
|
|
61
|
-
}), document.addEventListener("keyup", ({
|
|
62
|
-
|
|
96
|
+
}), document.addEventListener("keyup", ({
|
|
97
|
+
key,
|
|
98
|
+
defaultPrevented
|
|
99
|
+
}) => {
|
|
100
|
+
defaultPrevented || key === options.key && (clearTimeout(tm), isShowing && debugKeyListeners?.forEach(l => l(!1)));
|
|
63
101
|
});
|
|
64
102
|
}
|
|
65
103
|
});
|
|
66
104
|
}
|
|
67
105
|
let BaseText, BaseView;
|
|
68
|
-
const lastInteractionWasKeyboard = {
|
|
106
|
+
const lastInteractionWasKeyboard = {
|
|
107
|
+
value: !1
|
|
108
|
+
};
|
|
69
109
|
import_constants.isWeb && globalThis.document && (document.addEventListener("keydown", () => {
|
|
70
110
|
lastInteractionWasKeyboard.value = !0;
|
|
71
111
|
}), document.addEventListener("mousedown", () => {
|
|
@@ -74,15 +114,26 @@ import_constants.isWeb && globalThis.document && (document.addEventListener("key
|
|
|
74
114
|
lastInteractionWasKeyboard.value = !1;
|
|
75
115
|
}));
|
|
76
116
|
function createComponent(staticConfig) {
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
117
|
+
const {
|
|
118
|
+
componentName
|
|
119
|
+
} = staticConfig;
|
|
120
|
+
let config = null,
|
|
121
|
+
defaultProps = staticConfig.defaultProps;
|
|
122
|
+
(0, import_config.onConfiguredOnce)(conf => {
|
|
80
123
|
if (config = conf, componentName) {
|
|
81
124
|
const defaultForComponent = conf.defaultProps?.[componentName];
|
|
82
|
-
defaultForComponent && (defaultProps = {
|
|
125
|
+
defaultForComponent && (defaultProps = {
|
|
126
|
+
...defaultForComponent,
|
|
127
|
+
...defaultProps
|
|
128
|
+
});
|
|
83
129
|
}
|
|
84
130
|
});
|
|
85
|
-
const {
|
|
131
|
+
const {
|
|
132
|
+
Component,
|
|
133
|
+
isText,
|
|
134
|
+
isZStack,
|
|
135
|
+
isHOC
|
|
136
|
+
} = staticConfig;
|
|
86
137
|
process.env.NODE_ENV === "development" && staticConfig.defaultProps?.debug && process.env.IS_STATIC !== "is_static" && (0, import_log.log)(`\u{1F41B} [${componentName || "Component"}]`, {
|
|
87
138
|
staticConfig,
|
|
88
139
|
defaultProps,
|
|
@@ -93,7 +144,10 @@ function createComponent(staticConfig) {
|
|
|
93
144
|
process.env.NODE_ENV === "development" && startVisualizer && (startVisualizer(), startVisualizer = void 0), process.env.NODE_ENV === "test" && propsIn["data-test-renders"] && (propsIn["data-test-renders"].current ??= 0, propsIn["data-test-renders"].current += 1);
|
|
94
145
|
const componentContext = import_react.default.useContext(import_ComponentContext.ComponentContext);
|
|
95
146
|
let styledContextProps, overriddenContextProps, contextValue;
|
|
96
|
-
const {
|
|
147
|
+
const {
|
|
148
|
+
context,
|
|
149
|
+
isReactNative
|
|
150
|
+
} = staticConfig;
|
|
97
151
|
if (context && (contextValue = import_react.default.useContext(context), contextValue)) {
|
|
98
152
|
process.env.NODE_ENV === "development" && (propsIn.debug || defaultProps?.debug) && (0, import_log.log)(" \u{1F447} contextValue", contextValue);
|
|
99
153
|
for (const key in context.props) {
|
|
@@ -106,50 +160,60 @@ function createComponent(staticConfig) {
|
|
|
106
160
|
finalVal !== void 0 && (overriddenContextProps ||= {}, overriddenContextProps[key] = finalVal);
|
|
107
161
|
}
|
|
108
162
|
}
|
|
109
|
-
const curDefaultProps = styledContextProps ? {
|
|
163
|
+
const curDefaultProps = styledContextProps ? {
|
|
164
|
+
...defaultProps,
|
|
165
|
+
...styledContextProps
|
|
166
|
+
} : defaultProps;
|
|
110
167
|
let props = propsIn;
|
|
111
168
|
curDefaultProps && (props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn));
|
|
112
|
-
const debugProp = props.debug,
|
|
169
|
+
const debugProp = props.debug,
|
|
170
|
+
componentName2 = props.componentName || staticConfig.componentName;
|
|
113
171
|
process.env.NODE_ENV === "development" && import_constants.isClient && import_react.default.useEffect(() => {
|
|
114
172
|
let overlay = null;
|
|
115
173
|
const debugVisualizerHandler = (show = !1) => {
|
|
116
174
|
const node = curStateRef.host;
|
|
117
|
-
if (node)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
tooltip
|
|
122
|
-
}
|
|
123
|
-
|
|
175
|
+
if (node) if (show) {
|
|
176
|
+
overlay = document.createElement("span"), overlay.style.inset = "0px", overlay.style.zIndex = "1000000", overlay.style.position = "absolute", overlay.style.borderColor = "red", overlay.style.borderWidth = "1px", overlay.style.borderStyle = "dotted";
|
|
177
|
+
const dataAt = node.getAttribute("data-at") || "",
|
|
178
|
+
dataIn = node.getAttribute("data-in") || "",
|
|
179
|
+
tooltip = document.createElement("span");
|
|
180
|
+
tooltip.style.position = "absolute", tooltip.style.top = "0px", tooltip.style.left = "0px", tooltip.style.padding = "3px", tooltip.style.background = "rgba(0,0,0,0.75)", tooltip.style.color = "rgba(255,255,255,1)", tooltip.style.fontSize = "12px", tooltip.style.lineHeight = "12px", tooltip.style.fontFamily = "monospace", tooltip.style.webkitFontSmoothing = "none", tooltip.innerText = `${componentName2 || ""} ${dataAt} ${dataIn}`.trim(), overlay.appendChild(tooltip), node.appendChild(overlay);
|
|
181
|
+
} else overlay && node.removeChild(overlay);
|
|
124
182
|
};
|
|
125
|
-
return debugKeyListeners ||= /* @__PURE__ */
|
|
183
|
+
return debugKeyListeners ||= /* @__PURE__ */new Set(), debugKeyListeners.add(debugVisualizerHandler), () => {
|
|
126
184
|
debugKeyListeners?.delete(debugVisualizerHandler);
|
|
127
185
|
};
|
|
128
186
|
}, [componentName2]), !process.env.TAMAGUI_IS_CORE_NODE && process.env.NODE_ENV === "development" && debugProp === "profile" && !time && (time = require("@tamagui/timer").timer().start()), process.env.NODE_ENV === "development" && time && time`start (ignore)`, process.env.NODE_ENV === "development" && time && time`did-finish-ssr`, process.env.NODE_ENV === "development" && time && time`stateref`;
|
|
129
|
-
const animationDriver = componentContext.animationDriver,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
187
|
+
const animationDriver = componentContext.animationDriver,
|
|
188
|
+
useAnimations = animationDriver?.useAnimations,
|
|
189
|
+
{
|
|
190
|
+
curStateRef,
|
|
191
|
+
disabled,
|
|
192
|
+
groupName,
|
|
193
|
+
hasAnimationProp,
|
|
194
|
+
hasEnterStyle,
|
|
195
|
+
isAnimated,
|
|
196
|
+
isExiting,
|
|
197
|
+
isHydrated,
|
|
198
|
+
presence,
|
|
199
|
+
presenceState,
|
|
200
|
+
setState,
|
|
201
|
+
setStateShallow,
|
|
202
|
+
shouldAvoidClasses,
|
|
203
|
+
state,
|
|
204
|
+
stateRef,
|
|
205
|
+
supportsCSSVars,
|
|
206
|
+
willBeAnimated,
|
|
207
|
+
willBeAnimatedClient
|
|
208
|
+
} = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, config),
|
|
209
|
+
shouldForcePseudo = !!propsIn.forceStyle,
|
|
210
|
+
noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
149
211
|
process.env.NODE_ENV === "development" && time && time`use-state`;
|
|
150
212
|
const hasTextAncestor = !!(import_constants.isWeb && isText && componentContext.inText);
|
|
151
213
|
process.env.NODE_ENV === "development" && time && time`use-context`;
|
|
152
|
-
const isTaggable = !Component || typeof Component == "string",
|
|
214
|
+
const isTaggable = !Component || typeof Component == "string",
|
|
215
|
+
tagProp = props.tag,
|
|
216
|
+
element = import_constants.isWeb && isTaggable && tagProp || Component;
|
|
153
217
|
let elementType = isText ? BaseText || element || "span" : BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
154
218
|
animationDriver && isAnimated && (elementType = animationDriver[isText ? "Text" : "View"] || elementType);
|
|
155
219
|
const disableTheme = props["data-disable-theme"] || isHOC;
|
|
@@ -161,17 +225,35 @@ function createComponent(staticConfig) {
|
|
|
161
225
|
debug: debugProp
|
|
162
226
|
};
|
|
163
227
|
if ("themeInverse" in props && (themeStateProps.inverse = props.themeInverse), "theme" in props && (themeStateProps.name = props.theme), typeof curStateRef.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = () => stateRef.current.isListeningToTheme), process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
164
|
-
const name = `${componentName2 || Component?.displayName || Component?.name || "[Unnamed Component]"}`,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
), import_constants.isServer)
|
|
169
|
-
|
|
170
|
-
|
|
228
|
+
const name = `${componentName2 || Component?.displayName || Component?.name || "[Unnamed Component]"}`,
|
|
229
|
+
type = (hasEnterStyle ? "(hasEnter)" : " ") + (isAnimated ? "(animated)" : " ") + (isReactNative ? "(rnw)" : " ") + (shouldAvoidClasses ? "(shouldAvoidClasses)" : " ") + (state.press || state.pressIn ? "(PRESSED)" : " ") + (state.hover ? "(HOVERED)" : " ") + (state.focus ? "(FOCUSED)" : " ") + (presenceState?.isPresent === !1 ? "(EXIT)" : ""),
|
|
230
|
+
dataIs = propsIn["data-is"] || "",
|
|
231
|
+
banner = `${internalID} ${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
232
|
+
if (console.info(`%c ${banner} (hydrated: ${isHydrated}) (unmounted: ${state.unmounted})`, "background: green; color: white;"), import_constants.isServer) (0, import_log.log)({
|
|
233
|
+
noClassNames,
|
|
234
|
+
isAnimated,
|
|
235
|
+
shouldAvoidClasses,
|
|
236
|
+
isWeb: import_constants.isWeb,
|
|
237
|
+
supportsCSSVars
|
|
238
|
+
});else {
|
|
171
239
|
console.groupEnd();
|
|
172
240
|
const ch = propsIn.children;
|
|
173
241
|
let childLog = typeof ch == "string" ? ch.length > 4 ? ch.slice(0, 4) + "..." : ch : "";
|
|
174
|
-
childLog.length && (childLog = `(children: ${childLog})`), console.groupCollapsed(`${childLog} Props:`), (0, import_log.log)("props in:", propsIn), (0, import_log.log)("final props:", props), (0, import_log.log)({
|
|
242
|
+
childLog.length && (childLog = `(children: ${childLog})`), console.groupCollapsed(`${childLog} Props:`), (0, import_log.log)("props in:", propsIn), (0, import_log.log)("final props:", props), (0, import_log.log)({
|
|
243
|
+
state,
|
|
244
|
+
staticConfig,
|
|
245
|
+
elementType,
|
|
246
|
+
themeStateProps
|
|
247
|
+
}), (0, import_log.log)({
|
|
248
|
+
contextProps: styledContextProps,
|
|
249
|
+
overriddenContextProps
|
|
250
|
+
}), (0, import_log.log)({
|
|
251
|
+
presence,
|
|
252
|
+
isAnimated,
|
|
253
|
+
isHOC,
|
|
254
|
+
hasAnimationProp,
|
|
255
|
+
useAnimations
|
|
256
|
+
}), console.groupEnd();
|
|
175
257
|
}
|
|
176
258
|
}
|
|
177
259
|
process.env.NODE_ENV === "development" && time && time`pre-theme-media`;
|
|
@@ -181,70 +263,63 @@ function createComponent(staticConfig) {
|
|
|
181
263
|
process.env.NODE_ENV === "development" && time && time`theme`;
|
|
182
264
|
const mediaState = (0, import_useMedia.useMedia)(stateRef, componentContext, debugProp);
|
|
183
265
|
(0, import_createVariable.setDidGetVariableValue)(!1), process.env.NODE_ENV === "development" && time && time`media`;
|
|
184
|
-
const resolveValues =
|
|
266
|
+
const resolveValues =
|
|
185
267
|
// if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
|
|
186
|
-
isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
props,
|
|
197
|
-
staticConfig,
|
|
198
|
-
theme,
|
|
199
|
-
themeState?.state?.name || "",
|
|
200
|
-
state,
|
|
201
|
-
styleProps,
|
|
202
|
-
null,
|
|
203
|
-
componentContext,
|
|
204
|
-
elementType,
|
|
205
|
-
debugProp
|
|
206
|
-
);
|
|
268
|
+
isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto",
|
|
269
|
+
styleProps = {
|
|
270
|
+
mediaState,
|
|
271
|
+
noClassNames,
|
|
272
|
+
resolveValues,
|
|
273
|
+
isExiting,
|
|
274
|
+
isAnimated,
|
|
275
|
+
willBeAnimated,
|
|
276
|
+
styledContextProps
|
|
277
|
+
},
|
|
278
|
+
splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, themeState?.state?.name || "", state, styleProps, null, componentContext, elementType, debugProp);
|
|
207
279
|
props.group && props.untilMeasured === "hide" && !curStateRef.hasMeasured && (splitStyles.style ||= {}, splitStyles.style.opacity = 0), process.env.NODE_ENV === "development" && time && time`split-styles`, curStateRef.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
208
|
-
const hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== !0,
|
|
280
|
+
const hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== !0,
|
|
281
|
+
shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || hasRuntimeMediaKeys || noClassNames && splitStyles.hasMedia === !0,
|
|
282
|
+
mediaListeningKeys = hasRuntimeMediaKeys ? splitStyles.hasMedia : null;
|
|
209
283
|
process.env.NODE_ENV === "development" && debugProp === "verbose" && console.info("useMedia() createComponent", shouldListenForMedia, mediaListeningKeys), (0, import_useMedia.setMediaShouldUpdate)(stateRef, shouldListenForMedia, mediaListeningKeys);
|
|
210
284
|
const {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
285
|
+
viewProps: viewPropsIn,
|
|
286
|
+
pseudos,
|
|
287
|
+
style: splitStylesStyle,
|
|
288
|
+
classNames,
|
|
289
|
+
space
|
|
290
|
+
} = splitStyles,
|
|
291
|
+
propsWithAnimation = props,
|
|
292
|
+
{
|
|
293
|
+
asChild,
|
|
294
|
+
children,
|
|
295
|
+
themeShallow,
|
|
296
|
+
spaceDirection: _spaceDirection,
|
|
297
|
+
onPress,
|
|
298
|
+
onLongPress,
|
|
299
|
+
onPressIn,
|
|
300
|
+
onPressOut,
|
|
301
|
+
onHoverIn,
|
|
302
|
+
onHoverOut,
|
|
303
|
+
onMouseUp,
|
|
304
|
+
onMouseDown,
|
|
305
|
+
onMouseEnter,
|
|
306
|
+
onMouseLeave,
|
|
307
|
+
onFocus,
|
|
308
|
+
onBlur,
|
|
309
|
+
separator,
|
|
310
|
+
// ignore from here on out
|
|
311
|
+
forceStyle: _forceStyle,
|
|
312
|
+
// @ts-ignore for next/link compat etc
|
|
313
|
+
onClick,
|
|
314
|
+
theme: _themeProp,
|
|
315
|
+
...nonTamaguiProps
|
|
316
|
+
} = viewPropsIn;
|
|
241
317
|
let viewProps = nonTamaguiProps;
|
|
242
318
|
!isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), tagProp && elementType.acceptTagProp && (viewProps.tag = tagProp);
|
|
243
319
|
let animationStyles;
|
|
244
320
|
if (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
) {
|
|
321
|
+
// if it supports css vars we run it on server too to get matching initial style
|
|
322
|
+
(supportsCSSVars ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC) {
|
|
248
323
|
const animations = useAnimations({
|
|
249
324
|
props: propsWithAnimation,
|
|
250
325
|
// if hydrating, send empty style
|
|
@@ -259,59 +334,55 @@ function createComponent(staticConfig) {
|
|
|
259
334
|
});
|
|
260
335
|
(isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = `${state.unmounted === "should-enter" ? "t_unmounted " : ""}${viewProps.className || ""} ${animations.className}`)), process.env.NODE_ENV === "development" && time && time`animations`;
|
|
261
336
|
}
|
|
262
|
-
process.env.NODE_ENV === "development" && props.untilMeasured && !props.group && console.warn(
|
|
263
|
-
`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
337
|
+
process.env.NODE_ENV === "development" && props.untilMeasured && !props.group && console.warn(`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
264
338
|
|
|
265
|
-
If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
)), viewProps = import_setupHooks.hooks.usePropsTransform?.(
|
|
274
|
-
elementType,
|
|
275
|
-
nonTamaguiProps,
|
|
276
|
-
stateRef,
|
|
277
|
-
curStateRef.willHydrate
|
|
278
|
-
) || nonTamaguiProps, curStateRef.composedRef || (curStateRef.composedRef = (0, import_compose_refs.composeRefs)(
|
|
279
|
-
(x) => stateRef.current.host = x,
|
|
280
|
-
forwardedRef,
|
|
281
|
-
import_setElementProps.setElementProps
|
|
282
|
-
)), viewProps.ref = curStateRef.composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && import_constants.isWeb && !isHOC && import_react.default.Children.toArray(props.children).forEach((item) => {
|
|
339
|
+
If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`), process.env.NODE_ENV === "development" && time && time`destructure`, groupName && (nonTamaguiProps.onLayout = (0, import_helpers.composeEventHandlers)(nonTamaguiProps.onLayout, e => {
|
|
340
|
+
stateRef.current.group.emit(groupName, {
|
|
341
|
+
layout: e.nativeEvent.layout
|
|
342
|
+
}), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState(prev => ({
|
|
343
|
+
...prev
|
|
344
|
+
})), stateRef.current.hasMeasured = !0;
|
|
345
|
+
})), viewProps = import_setupHooks.hooks.usePropsTransform?.(elementType, nonTamaguiProps, stateRef, curStateRef.willHydrate) || nonTamaguiProps, curStateRef.composedRef || (curStateRef.composedRef = (0, import_compose_refs.composeRefs)(x => stateRef.current.host = x, forwardedRef, import_setElementProps.setElementProps)), viewProps.ref = curStateRef.composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && import_constants.isWeb && !isHOC && import_react.default.Children.toArray(props.children).forEach(item => {
|
|
283
346
|
typeof item == "string" && item !== `
|
|
284
|
-
` && console.error(
|
|
285
|
-
`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`
|
|
286
|
-
);
|
|
347
|
+
` && console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
287
348
|
}), process.env.NODE_ENV === "development" && time && time`events-hooks`;
|
|
288
|
-
const {
|
|
349
|
+
const {
|
|
350
|
+
pseudoGroups,
|
|
351
|
+
mediaGroups
|
|
352
|
+
} = splitStyles,
|
|
353
|
+
unPress = () => setStateShallow({
|
|
354
|
+
press: !1,
|
|
355
|
+
pressIn: !1
|
|
356
|
+
});
|
|
289
357
|
process.env.NODE_ENV === "development" && import_constants.isWeb && (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
290
358
|
if (debugProp === "verbose") {
|
|
291
|
-
const computed = function(style) {
|
|
359
|
+
const computed = function (style) {
|
|
292
360
|
const styleObject = {};
|
|
293
361
|
for (let i = 0; i < style.length; i++) {
|
|
294
362
|
let prop = style[i];
|
|
295
363
|
styleObject[prop] = style.getPropertyValue(prop);
|
|
296
364
|
}
|
|
297
365
|
return styleObject;
|
|
298
|
-
}(
|
|
299
|
-
getComputedStyle(stateRef.current.host)
|
|
300
|
-
);
|
|
366
|
+
}(getComputedStyle(stateRef.current.host));
|
|
301
367
|
console.groupCollapsed(`Rendered > (opacity: ${computed.opacity})`), console.warn(stateRef.current.host), console.warn(computed), console.groupEnd();
|
|
302
368
|
}
|
|
303
369
|
}), import_react.default.useEffect(() => {
|
|
304
|
-
if (disabled)
|
|
305
|
-
return;
|
|
370
|
+
if (disabled) return;
|
|
306
371
|
if (state.unmounted === !0 && hasEnterStyle) {
|
|
307
|
-
setStateShallow({
|
|
372
|
+
setStateShallow({
|
|
373
|
+
unmounted: "should-enter"
|
|
374
|
+
});
|
|
308
375
|
return;
|
|
309
376
|
}
|
|
310
377
|
let tm;
|
|
311
378
|
if (state.unmounted) {
|
|
312
379
|
animationDriver?.supportsCSSVars ? tm = setTimeout(() => {
|
|
313
|
-
setStateShallow({
|
|
314
|
-
|
|
380
|
+
setStateShallow({
|
|
381
|
+
unmounted: !1
|
|
382
|
+
});
|
|
383
|
+
}) : setStateShallow({
|
|
384
|
+
unmounted: !1
|
|
385
|
+
});
|
|
315
386
|
return;
|
|
316
387
|
}
|
|
317
388
|
const dispose = (0, import_subscribeToContextGroup.subscribeToContextGroup)({
|
|
@@ -325,13 +396,17 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
325
396
|
return () => {
|
|
326
397
|
clearTimeout(tm), dispose?.(), componentSetStates.delete(setState);
|
|
327
398
|
};
|
|
328
|
-
}, [
|
|
329
|
-
|
|
330
|
-
disabled,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
399
|
+
}, [state.unmounted, disabled, pseudoGroups ? Object.keys([...pseudoGroups]).join("") : 0, mediaGroups ? Object.keys([...mediaGroups]).join("") : 0]);
|
|
400
|
+
const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle,
|
|
401
|
+
runtimeFocusStyle = !disabled && noClassNames && pseudos?.focusStyle,
|
|
402
|
+
runtimeFocusVisibleStyle = !disabled && noClassNames && pseudos?.focusVisibleStyle,
|
|
403
|
+
attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur),
|
|
404
|
+
attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || pseudos?.focusVisibleStyle),
|
|
405
|
+
runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle,
|
|
406
|
+
needsHoverState = !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut),
|
|
407
|
+
attachHover = import_constants.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave),
|
|
408
|
+
shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle),
|
|
409
|
+
needsPressState = !!(groupName || runtimePressStyle);
|
|
335
410
|
process.env.NODE_ENV === "development" && time && time`events-setup`, process.env.NODE_ENV === "development" && debugProp === "verbose" && (0, import_log.log)("\u{1FAA9} events()", {
|
|
336
411
|
runtimeFocusStyle,
|
|
337
412
|
runtimePressStyle,
|
|
@@ -344,30 +419,30 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
344
419
|
needsHoverState
|
|
345
420
|
});
|
|
346
421
|
const events = shouldAttach ? {
|
|
347
|
-
onPressOut: attachPress ?
|
|
422
|
+
onPressOut: attachPress ? e => {
|
|
348
423
|
unPress(), onPressOut?.(e), onMouseUp?.(e);
|
|
349
424
|
} : void 0,
|
|
350
|
-
...(attachHover || attachPress) && {
|
|
351
|
-
onMouseEnter:
|
|
425
|
+
...((attachHover || attachPress) && {
|
|
426
|
+
onMouseEnter: e => {
|
|
352
427
|
const next = {};
|
|
353
428
|
needsHoverState && (next.hover = !0), needsPressState && state.pressIn && (next.press = !0), setStateShallow(next), onHoverIn?.(e), onMouseEnter?.(e);
|
|
354
429
|
},
|
|
355
|
-
onMouseLeave:
|
|
430
|
+
onMouseLeave: e => {
|
|
356
431
|
const next = {};
|
|
357
432
|
needsHoverState && (next.hover = !1), needsPressState && state.pressIn && (next.press = !1, next.pressIn = !1), setStateShallow(next), onHoverOut?.(e), onMouseLeave?.(e);
|
|
358
433
|
}
|
|
359
|
-
},
|
|
360
|
-
onPressIn: attachPress ?
|
|
434
|
+
}),
|
|
435
|
+
onPressIn: attachPress ? e => {
|
|
361
436
|
(runtimePressStyle || groupName) && setStateShallow({
|
|
362
437
|
press: !0,
|
|
363
438
|
pressIn: !0
|
|
364
439
|
}), onPressIn?.(e), onMouseDown?.(e), import_constants.isWeb && componentSetStates.add(setState);
|
|
365
440
|
} : void 0,
|
|
366
|
-
onPress: attachPress ?
|
|
441
|
+
onPress: attachPress ? e => {
|
|
367
442
|
unPress(), import_constants.isWeb && onClick?.(e), onPress?.(e), onLongPress?.(e);
|
|
368
443
|
} : void 0,
|
|
369
|
-
...attachFocus && {
|
|
370
|
-
onFocus:
|
|
444
|
+
...(attachFocus && {
|
|
445
|
+
onFocus: e => {
|
|
371
446
|
pseudos?.focusVisibleStyle ? setTimeout(() => {
|
|
372
447
|
setStateShallow({
|
|
373
448
|
focus: !0,
|
|
@@ -378,15 +453,19 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
378
453
|
focusVisible: !1
|
|
379
454
|
}), onFocus?.(e);
|
|
380
455
|
},
|
|
381
|
-
onBlur:
|
|
456
|
+
onBlur: e => {
|
|
382
457
|
setStateShallow({
|
|
383
458
|
focus: !1,
|
|
384
459
|
focusVisible: !1
|
|
385
460
|
}), onBlur?.(e);
|
|
386
461
|
}
|
|
387
|
-
}
|
|
462
|
+
})
|
|
388
463
|
} : null;
|
|
389
|
-
events && !isReactNative && Object.assign(viewProps, getWebEvents(events)), process.env.NODE_ENV === "development" && time && time`events`, process.env.NODE_ENV === "development" && debugProp === "verbose" && (0, import_log.log)("events", {
|
|
464
|
+
events && !isReactNative && Object.assign(viewProps, getWebEvents(events)), process.env.NODE_ENV === "development" && time && time`events`, process.env.NODE_ENV === "development" && debugProp === "verbose" && (0, import_log.log)("events", {
|
|
465
|
+
events,
|
|
466
|
+
attachHover,
|
|
467
|
+
attachPress
|
|
468
|
+
}), import_setupHooks.hooks.useEvents?.(viewProps, events, splitStyles, setStateShallow, staticConfig);
|
|
390
469
|
const direction = props.spaceDirection || "both";
|
|
391
470
|
process.env.NODE_ENV === "development" && time && time`hooks`;
|
|
392
471
|
let content = !children || asChild ? children : spacedChildren({
|
|
@@ -400,36 +479,29 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
400
479
|
if (asChild) {
|
|
401
480
|
elementType = import_Slot.Slot;
|
|
402
481
|
{
|
|
403
|
-
const passEvents = getWebEvents(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
},
|
|
414
|
-
asChild === "web" || asChild === "except-style-web"
|
|
415
|
-
);
|
|
482
|
+
const passEvents = getWebEvents({
|
|
483
|
+
onPress,
|
|
484
|
+
onLongPress,
|
|
485
|
+
onPressIn,
|
|
486
|
+
onPressOut,
|
|
487
|
+
onMouseUp,
|
|
488
|
+
onMouseDown,
|
|
489
|
+
onMouseEnter,
|
|
490
|
+
onMouseLeave
|
|
491
|
+
}, asChild === "web" || asChild === "except-style-web");
|
|
416
492
|
Object.assign(viewProps, passEvents);
|
|
417
493
|
}
|
|
418
494
|
}
|
|
419
495
|
process.env.NODE_ENV === "development" && time && time`spaced-as-child`;
|
|
420
496
|
let useChildrenResult;
|
|
421
|
-
import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(
|
|
422
|
-
elementType,
|
|
423
|
-
content,
|
|
424
|
-
viewProps,
|
|
425
|
-
events,
|
|
426
|
-
staticConfig
|
|
427
|
-
)), useChildrenResult ? content = useChildrenResult : content = import_react.default.createElement(elementType, viewProps, content);
|
|
497
|
+
import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(elementType, content, viewProps, events, staticConfig)), useChildrenResult ? content = useChildrenResult : content = import_react.default.createElement(elementType, viewProps, content);
|
|
428
498
|
const ResetPresence = config?.animations?.ResetPresence;
|
|
429
|
-
ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
499
|
+
ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ResetPresence, {
|
|
500
|
+
children: content
|
|
501
|
+
})), process.env.NODE_ENV === "development" && time && time`create-element`;
|
|
502
|
+
const groupState = curStateRef.group,
|
|
503
|
+
subGroupContext = import_react.default.useMemo(() => {
|
|
504
|
+
if (!(!groupState || !groupName)) return groupState.listeners.clear(), {
|
|
433
505
|
...componentContext.groups,
|
|
434
506
|
// change reference so as we mutate it doesn't affect siblings etc
|
|
435
507
|
state: {
|
|
@@ -447,24 +519,34 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
447
519
|
emit: groupState.emit,
|
|
448
520
|
subscribe: groupState.subscribe
|
|
449
521
|
};
|
|
450
|
-
|
|
451
|
-
if (groupName && subGroupContext && (content = /* @__PURE__ */
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
522
|
+
}, [groupName]);
|
|
523
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
|
|
524
|
+
...componentContext,
|
|
525
|
+
groups: subGroupContext,
|
|
526
|
+
children: content
|
|
527
|
+
})), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : (0, import_Theme.getThemedChildren)(themeState, content, themeStateProps, !1, stateRef), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, {
|
|
528
|
+
themeState,
|
|
529
|
+
themeProps: props,
|
|
530
|
+
children: content
|
|
531
|
+
})), isReactNative && !asChild && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)("span", {
|
|
532
|
+
className: "_dsp_contents",
|
|
533
|
+
...(isHydrated && events && getWebEvents(events)),
|
|
534
|
+
children: content
|
|
535
|
+
})), staticConfig.context) {
|
|
459
536
|
const contextProps = staticConfig.context.props;
|
|
460
|
-
for (const key in contextProps)
|
|
461
|
-
(viewProps.style && key in viewProps.style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = viewProps.style?.[key] ?? viewProps[key]);
|
|
537
|
+
for (const key in contextProps) (viewProps.style && key in viewProps.style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = viewProps.style?.[key] ?? viewProps[key]);
|
|
462
538
|
}
|
|
463
539
|
if (overriddenContextProps) {
|
|
464
540
|
const Provider = staticConfig.context.Provider;
|
|
465
|
-
content = /* @__PURE__ */
|
|
541
|
+
content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(Provider, {
|
|
542
|
+
...contextValue,
|
|
543
|
+
...overriddenContextProps,
|
|
544
|
+
children: content
|
|
545
|
+
});
|
|
466
546
|
}
|
|
467
|
-
const {
|
|
547
|
+
const {
|
|
548
|
+
rulesToInsert
|
|
549
|
+
} = splitStyles;
|
|
468
550
|
if (process.env.TAMAGUI_REACT_19 && (content = (0, import_wrapStyleTags.wrapStyleTags)(Object.values(rulesToInsert), content)), process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
469
551
|
const title = `render <${typeof elementType == "string" ? elementType : "Component"} /> (${internalID}) with props`;
|
|
470
552
|
if (import_constants.isWeb) {
|
|
@@ -499,17 +581,14 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
499
581
|
viewProps,
|
|
500
582
|
willBeAnimated
|
|
501
583
|
});
|
|
502
|
-
} catch {
|
|
503
|
-
} finally {
|
|
584
|
+
} catch {} finally {
|
|
504
585
|
console.groupEnd();
|
|
505
586
|
}
|
|
506
587
|
} else {
|
|
507
588
|
(0, import_log.log)(title), (0, import_log.log)("state: ", state), import_isDevTools.isDevTools && (0, import_log.log)("viewProps", viewProps), (0, import_log.log)("final styles:");
|
|
508
|
-
for (const key in splitStylesStyle)
|
|
509
|
-
(0, import_log.log)(key, splitStylesStyle[key]);
|
|
589
|
+
for (const key in splitStylesStyle) (0, import_log.log)(key, splitStylesStyle[key]);
|
|
510
590
|
}
|
|
511
|
-
if (debugProp === "break")
|
|
512
|
-
debugger;
|
|
591
|
+
if (debugProp === "break") debugger;
|
|
513
592
|
}
|
|
514
593
|
return process.env.NODE_ENV === "development" && time && (time`rest`, globalThis.willPrint || (globalThis.willPrint = !0, setTimeout(() => {
|
|
515
594
|
delete globalThis.willPrint, time.print(), time = null;
|
|
@@ -554,56 +633,68 @@ function Unspaced(props) {
|
|
|
554
633
|
return props.children;
|
|
555
634
|
}
|
|
556
635
|
Unspaced.isUnspaced = !0;
|
|
557
|
-
const getSpacerSize = (size, {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
memo: !0,
|
|
569
|
-
componentName: "Spacer",
|
|
570
|
-
validStyles: import_helpers.validStyles,
|
|
571
|
-
defaultProps: {
|
|
572
|
-
...import_constants2.stackDefaultStyles,
|
|
573
|
-
// avoid nesting issues
|
|
574
|
-
tag: "span",
|
|
575
|
-
size: !0,
|
|
576
|
-
pointerEvents: "none"
|
|
636
|
+
const getSpacerSize = (size, {
|
|
637
|
+
tokens
|
|
638
|
+
}) => {
|
|
639
|
+
size = size === !0 ? "$true" : size;
|
|
640
|
+
const sizePx = tokens.space[size] ?? size;
|
|
641
|
+
return {
|
|
642
|
+
width: sizePx,
|
|
643
|
+
height: sizePx,
|
|
644
|
+
minWidth: sizePx,
|
|
645
|
+
minHeight: sizePx
|
|
646
|
+
};
|
|
577
647
|
},
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
648
|
+
Spacer = createComponent({
|
|
649
|
+
acceptsClassName: !0,
|
|
650
|
+
memo: !0,
|
|
651
|
+
componentName: "Spacer",
|
|
652
|
+
validStyles: import_helpers.validStyles,
|
|
653
|
+
defaultProps: {
|
|
654
|
+
...import_constants2.stackDefaultStyles,
|
|
655
|
+
// avoid nesting issues
|
|
656
|
+
tag: "span",
|
|
657
|
+
size: !0,
|
|
658
|
+
pointerEvents: "none"
|
|
586
659
|
},
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
minHeight: 0
|
|
660
|
+
variants: {
|
|
661
|
+
size: {
|
|
662
|
+
"...": getSpacerSize
|
|
591
663
|
},
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
664
|
+
flex: {
|
|
665
|
+
true: {
|
|
666
|
+
flexGrow: 1
|
|
667
|
+
}
|
|
595
668
|
},
|
|
596
|
-
|
|
669
|
+
direction: {
|
|
670
|
+
horizontal: {
|
|
671
|
+
height: 0,
|
|
672
|
+
minHeight: 0
|
|
673
|
+
},
|
|
674
|
+
vertical: {
|
|
675
|
+
width: 0,
|
|
676
|
+
minWidth: 0
|
|
677
|
+
},
|
|
678
|
+
both: {}
|
|
679
|
+
}
|
|
597
680
|
}
|
|
598
|
-
}
|
|
599
|
-
});
|
|
681
|
+
});
|
|
600
682
|
function spacedChildren(props) {
|
|
601
|
-
const {
|
|
602
|
-
|
|
603
|
-
|
|
683
|
+
const {
|
|
684
|
+
isZStack,
|
|
685
|
+
children,
|
|
686
|
+
space,
|
|
687
|
+
direction,
|
|
688
|
+
spaceFlex,
|
|
689
|
+
separator,
|
|
690
|
+
ensureKeys
|
|
691
|
+
} = props,
|
|
692
|
+
hasSpace = !!(space || spaceFlex),
|
|
693
|
+
hasSeparator = separator != null,
|
|
694
|
+
areChildrenArray = Array.isArray(children);
|
|
695
|
+
if (!ensureKeys && !(hasSpace || hasSeparator || isZStack)) return children;
|
|
604
696
|
const childrenList = areChildrenArray ? children : import_react.default.Children.toArray(children);
|
|
605
|
-
if (childrenList.length <= 1 && !isZStack && !childrenList[0]?.type?.shouldForwardSpace)
|
|
606
|
-
return children;
|
|
697
|
+
if (childrenList.length <= 1 && !isZStack && !childrenList[0]?.type?.shouldForwardSpace) return children;
|
|
607
698
|
const final = [];
|
|
608
699
|
for (let [index, child] of childrenList.entries()) {
|
|
609
700
|
const isEmpty = child == null || Array.isArray(child) && child.length === 0;
|
|
@@ -612,62 +703,61 @@ function spacedChildren(props) {
|
|
|
612
703
|
spaceFlex,
|
|
613
704
|
separator,
|
|
614
705
|
key: child.key
|
|
615
|
-
})), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(
|
|
616
|
-
|
|
617
|
-
|
|
706
|
+
})), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.default.Fragment, {
|
|
707
|
+
children: isZStack ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(AbsoluteFill, {
|
|
708
|
+
children: child
|
|
709
|
+
}) : child
|
|
710
|
+
}, `${index}0t`)), isUnspaced(child) && index === 0 || isZStack) continue;
|
|
618
711
|
const next = childrenList[index + 1];
|
|
619
|
-
next && !isEmpty && !isUnspaced(next) && (separator ? (hasSpace && final.push(
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
space,
|
|
638
|
-
spaceFlex
|
|
639
|
-
})
|
|
640
|
-
));
|
|
712
|
+
next && !isEmpty && !isUnspaced(next) && (separator ? (hasSpace && final.push(createSpacer({
|
|
713
|
+
key: `_${index}_00t`,
|
|
714
|
+
direction,
|
|
715
|
+
space,
|
|
716
|
+
spaceFlex
|
|
717
|
+
})), final.push(/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.default.Fragment, {
|
|
718
|
+
children: separator
|
|
719
|
+
}, `${index}03t`)), hasSpace && final.push(createSpacer({
|
|
720
|
+
key: `_${index}01t`,
|
|
721
|
+
direction,
|
|
722
|
+
space,
|
|
723
|
+
spaceFlex
|
|
724
|
+
}))) : final.push(createSpacer({
|
|
725
|
+
key: `_${index}02t`,
|
|
726
|
+
direction,
|
|
727
|
+
space,
|
|
728
|
+
spaceFlex
|
|
729
|
+
})));
|
|
641
730
|
}
|
|
642
731
|
return process.env.NODE_ENV === "development" && props.debug && (0, import_log.log)(" Spaced children", final, props), final;
|
|
643
732
|
}
|
|
644
|
-
function createSpacer({
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
733
|
+
function createSpacer({
|
|
734
|
+
key,
|
|
735
|
+
direction,
|
|
736
|
+
space,
|
|
737
|
+
spaceFlex
|
|
738
|
+
}) {
|
|
739
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Spacer, {
|
|
740
|
+
size: space,
|
|
741
|
+
direction,
|
|
742
|
+
...(typeof spaceFlex < "u" && {
|
|
743
|
+
flex: spaceFlex === !0 ? 1 : spaceFlex === !1 ? 0 : spaceFlex
|
|
744
|
+
})
|
|
745
|
+
}, key);
|
|
656
746
|
}
|
|
657
747
|
function isUnspaced(child) {
|
|
658
748
|
const t = child?.type;
|
|
659
749
|
return t?.isVisuallyHidden || t?.isUnspaced;
|
|
660
750
|
}
|
|
661
751
|
const AbsoluteFill = createComponent({
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}),
|
|
673
|
-
|
|
752
|
+
defaultProps: {
|
|
753
|
+
...import_constants2.stackDefaultStyles,
|
|
754
|
+
flexDirection: "column",
|
|
755
|
+
position: "absolute",
|
|
756
|
+
top: 0,
|
|
757
|
+
right: 0,
|
|
758
|
+
bottom: 0,
|
|
759
|
+
left: 0,
|
|
760
|
+
pointerEvents: "box-none"
|
|
761
|
+
}
|
|
762
|
+
}),
|
|
763
|
+
fromPx = val => typeof val != "string" ? val : +val.replace("px", "");
|