@tamagui/web 1.113.1 → 1.113.2
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/esm/Tamagui.native.js +50 -41
- package/dist/esm/Tamagui.native.js.map +6 -1
- package/dist/esm/_withStableStyle.native.js +9 -11
- package/dist/esm/_withStableStyle.native.js.map +6 -1
- package/dist/esm/config.native.js +74 -75
- package/dist/esm/config.native.js.map +6 -1
- package/dist/esm/constants/accessibilityDirectMap.native.js +8 -6
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +6 -1
- package/dist/esm/constants/constants.native.js +19 -17
- package/dist/esm/constants/constants.native.js.map +6 -1
- package/dist/esm/constants/isDevTools.native.js +10 -6
- package/dist/esm/constants/isDevTools.native.js.map +6 -1
- package/dist/esm/constants/webToNativeProps.native.js +162 -84
- package/dist/esm/constants/webToNativeProps.native.js.map +6 -1
- package/dist/esm/contexts/ComponentContext.native.js +5 -3
- package/dist/esm/contexts/ComponentContext.native.js.map +6 -1
- package/dist/esm/createComponent.native.js +300 -405
- package/dist/esm/createComponent.native.js.map +6 -1
- package/dist/esm/createFont.native.js +41 -24
- package/dist/esm/createFont.native.js.map +6 -1
- package/dist/esm/createShorthands.native.js +4 -2
- package/dist/esm/createShorthands.native.js.map +6 -1
- package/dist/esm/createTamagui.native.js +158 -177
- package/dist/esm/createTamagui.native.js.map +6 -1
- package/dist/esm/createTheme.native.js +5 -3
- package/dist/esm/createTheme.native.js.map +6 -1
- package/dist/esm/createTokens.native.js +5 -3
- package/dist/esm/createTokens.native.js.map +6 -1
- package/dist/esm/createVariable.native.js +35 -29
- package/dist/esm/createVariable.native.js.map +6 -1
- package/dist/esm/createVariables.native.js +29 -34
- package/dist/esm/createVariables.native.js.map +6 -1
- package/dist/esm/defaultComponentState.native.js +20 -18
- package/dist/esm/defaultComponentState.native.js.map +6 -1
- package/dist/esm/helpers/ThemeManager.native.js +101 -95
- package/dist/esm/helpers/ThemeManager.native.js.map +6 -1
- package/dist/esm/helpers/ThemeManagerContext.native.js +5 -3
- package/dist/esm/helpers/ThemeManagerContext.native.js.map +6 -1
- package/dist/esm/helpers/createMediaStyle.native.js +49 -64
- package/dist/esm/helpers/createMediaStyle.native.js.map +6 -1
- package/dist/esm/helpers/createShallowSetState.native.js +17 -9
- package/dist/esm/helpers/createShallowSetState.native.js.map +6 -1
- package/dist/esm/helpers/createStyledContext.native.js +25 -31
- package/dist/esm/helpers/createStyledContext.native.js.map +6 -1
- package/dist/esm/helpers/defaultOffset.native.js +4 -2
- package/dist/esm/helpers/defaultOffset.native.js.map +6 -1
- package/dist/esm/helpers/expandStyle.native.js +84 -39
- package/dist/esm/helpers/expandStyle.native.js.map +6 -1
- package/dist/esm/helpers/expandStyles.native.js +17 -15
- package/dist/esm/helpers/expandStyles.native.js.map +6 -1
- package/dist/esm/helpers/getExpandedShorthands.native.js +7 -4
- package/dist/esm/helpers/getExpandedShorthands.native.js.map +6 -1
- package/dist/esm/helpers/getFontLanguage.native.js +5 -3
- package/dist/esm/helpers/getFontLanguage.native.js.map +6 -1
- package/dist/esm/helpers/getGroupPropParts.native.js +6 -7
- package/dist/esm/helpers/getGroupPropParts.native.js.map +6 -1
- package/dist/esm/helpers/getSplitStyles.native.js +398 -436
- package/dist/esm/helpers/getSplitStyles.native.js.map +6 -1
- package/dist/esm/helpers/getStylesAtomic.native.js +8 -7
- package/dist/esm/helpers/getStylesAtomic.native.js.map +6 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js +3 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +6 -1
- package/dist/esm/helpers/getVariantExtras.native.js +34 -33
- package/dist/esm/helpers/getVariantExtras.native.js.map +6 -1
- package/dist/esm/helpers/insertStyleRule.native.js +111 -123
- package/dist/esm/helpers/insertStyleRule.native.js.map +6 -1
- package/dist/esm/helpers/isActivePlatform.native.js +5 -4
- package/dist/esm/helpers/isActivePlatform.native.js.map +6 -1
- package/dist/esm/helpers/isObj.native.js +5 -3
- package/dist/esm/helpers/isObj.native.js.map +6 -1
- package/dist/esm/helpers/isTamaguiComponent.native.js +4 -2
- package/dist/esm/helpers/isTamaguiComponent.native.js.map +6 -1
- package/dist/esm/helpers/isTamaguiElement.native.js +7 -5
- package/dist/esm/helpers/isTamaguiElement.native.js.map +6 -1
- package/dist/esm/helpers/log.native.js +7 -4
- package/dist/esm/helpers/log.native.js.map +6 -1
- package/dist/esm/helpers/matchMedia.native.js +14 -9
- package/dist/esm/helpers/matchMedia.native.js.map +6 -1
- package/dist/esm/helpers/mergeProps.native.js +13 -9
- package/dist/esm/helpers/mergeProps.native.js.map +6 -1
- package/dist/esm/helpers/mergeVariants.native.js +7 -7
- package/dist/esm/helpers/mergeVariants.native.js.map +6 -1
- package/dist/esm/helpers/normalizeColor.native.js +24 -20
- package/dist/esm/helpers/normalizeColor.native.js.map +6 -1
- package/dist/esm/helpers/normalizeShadow.native.js +7 -15
- package/dist/esm/helpers/normalizeShadow.native.js.map +6 -1
- package/dist/esm/helpers/normalizeStyle.native.js +12 -13
- package/dist/esm/helpers/normalizeStyle.native.js.map +6 -1
- package/dist/esm/helpers/normalizeStylePropKeys.native.js +3 -1
- package/dist/esm/helpers/normalizeStylePropKeys.native.js.map +6 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +12 -9
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +6 -1
- package/dist/esm/helpers/objectIdentityKey.native.js +11 -6
- package/dist/esm/helpers/objectIdentityKey.native.js.map +6 -1
- package/dist/esm/helpers/propMapper.native.js +206 -227
- package/dist/esm/helpers/propMapper.native.js.map +6 -1
- package/dist/esm/helpers/proxyThemeToParents.native.js +27 -39
- package/dist/esm/helpers/proxyThemeToParents.native.js.map +6 -1
- package/dist/esm/helpers/proxyThemeVariables.native.js +5 -3
- package/dist/esm/helpers/proxyThemeVariables.native.js.map +6 -1
- package/dist/esm/helpers/pseudoDescriptors.native.js +46 -44
- package/dist/esm/helpers/pseudoDescriptors.native.js.map +6 -1
- package/dist/esm/helpers/registerCSSVariable.native.js +13 -11
- package/dist/esm/helpers/registerCSSVariable.native.js.map +6 -1
- package/dist/esm/helpers/setElementProps.native.js +6 -3
- package/dist/esm/helpers/setElementProps.native.js.map +6 -1
- package/dist/esm/helpers/skipProps.native.js +5 -3
- package/dist/esm/helpers/skipProps.native.js.map +6 -1
- package/dist/esm/helpers/sortString.native.js +5 -3
- package/dist/esm/helpers/sortString.native.js.map +6 -1
- package/dist/esm/helpers/subscribeToContextGroup.native.js +18 -27
- package/dist/esm/helpers/subscribeToContextGroup.native.js.map +6 -1
- package/dist/esm/helpers/themeable.native.js +24 -31
- package/dist/esm/helpers/themeable.native.js.map +6 -1
- package/dist/esm/helpers/themes.native.js +5 -3
- package/dist/esm/helpers/themes.native.js.map +6 -1
- package/dist/esm/helpers/timer.native.js +5 -3
- package/dist/esm/helpers/timer.native.js.map +6 -1
- package/dist/esm/helpers/transformsToString.native.js +13 -11
- package/dist/esm/helpers/transformsToString.native.js.map +6 -1
- package/dist/esm/helpers/webPropsToSkip.native.js +3 -1
- package/dist/esm/helpers/webPropsToSkip.native.js.map +6 -1
- package/dist/esm/hooks/useComponentState.native.js +32 -66
- package/dist/esm/hooks/useComponentState.native.js.map +6 -1
- package/dist/esm/hooks/useConfiguration.native.js +8 -14
- package/dist/esm/hooks/useConfiguration.native.js.map +6 -1
- package/dist/esm/hooks/useDidHydrateOnce.native.js +15 -14
- package/dist/esm/hooks/useDidHydrateOnce.native.js.map +6 -1
- package/dist/esm/hooks/useDisableSSR.native.js +5 -3
- package/dist/esm/hooks/useDisableSSR.native.js.map +6 -1
- package/dist/esm/hooks/useIsTouchDevice.native.js +5 -3
- package/dist/esm/hooks/useIsTouchDevice.native.js.map +6 -1
- package/dist/esm/hooks/useMedia.native.js +104 -106
- package/dist/esm/hooks/useMedia.native.js.map +6 -1
- package/dist/esm/hooks/useProps.native.js +42 -41
- package/dist/esm/hooks/useProps.native.js.map +6 -1
- package/dist/esm/hooks/useTheme.native.js +231 -253
- package/dist/esm/hooks/useTheme.native.js.map +6 -1
- package/dist/esm/hooks/useThemeName.native.js +16 -12
- package/dist/esm/hooks/useThemeName.native.js.map +6 -1
- package/dist/esm/index.native.js +78 -61
- package/dist/esm/index.native.js.map +6 -1
- package/dist/esm/inject-styles.native.js +12 -15
- package/dist/esm/inject-styles.native.js.map +6 -1
- package/dist/esm/insertFont.native.js +32 -24
- package/dist/esm/insertFont.native.js.map +6 -1
- package/dist/esm/interfaces/CSSColorNames.native.js +1 -2
- package/dist/esm/interfaces/CSSColorNames.native.js.map +6 -1
- package/dist/esm/interfaces/GetRef.native.js +1 -2
- package/dist/esm/interfaces/GetRef.native.js.map +6 -1
- package/dist/esm/interfaces/KeyTypes.native.js +1 -2
- package/dist/esm/interfaces/KeyTypes.native.js.map +6 -1
- package/dist/esm/interfaces/RNExclusiveTypes.native.js +1 -2
- package/dist/esm/interfaces/RNExclusiveTypes.native.js.map +6 -1
- package/dist/esm/interfaces/Role.native.js +1 -2
- package/dist/esm/interfaces/Role.native.js.map +6 -1
- package/dist/esm/interfaces/TamaguiComponentEvents.native.js +1 -2
- package/dist/esm/interfaces/TamaguiComponentEvents.native.js.map +6 -1
- package/dist/esm/interfaces/TamaguiComponentPropsBaseBase.native.js +1 -2
- package/dist/esm/interfaces/TamaguiComponentPropsBaseBase.native.js.map +6 -1
- package/dist/esm/interfaces/TamaguiComponentState.native.js +1 -2
- package/dist/esm/interfaces/TamaguiComponentState.native.js.map +6 -1
- package/dist/esm/interfaces/WebOnlyPressEvents.native.js +1 -2
- package/dist/esm/interfaces/WebOnlyPressEvents.native.js.map +6 -1
- package/dist/esm/setupHooks.native.js +5 -2
- package/dist/esm/setupHooks.native.js.map +6 -1
- package/dist/esm/setupReactNative.native.js +13 -5
- package/dist/esm/setupReactNative.native.js.map +6 -1
- package/dist/esm/styled.native.js +50 -66
- package/dist/esm/styled.native.js.map +6 -1
- package/dist/esm/type-utils.native.js +1 -2
- package/dist/esm/type-utils.native.js.map +6 -1
- package/dist/esm/types.native.js +3 -3
- package/dist/esm/types.native.js.map +6 -1
- package/dist/esm/views/Configuration.native.js +7 -5
- package/dist/esm/views/Configuration.native.js.map +6 -1
- package/dist/esm/views/FontLanguage.native.js +11 -11
- package/dist/esm/views/FontLanguage.native.js.map +6 -1
- package/dist/esm/views/FontLanguage.types.native.js +1 -2
- package/dist/esm/views/FontLanguage.types.native.js.map +6 -1
- package/dist/esm/views/Slot.native.js +31 -33
- package/dist/esm/views/Slot.native.js.map +6 -1
- package/dist/esm/views/Stack.native.js +6 -4
- package/dist/esm/views/Stack.native.js.map +6 -1
- package/dist/esm/views/TamaguiProvider.native.js +39 -40
- package/dist/esm/views/TamaguiProvider.native.js.map +6 -1
- package/dist/esm/views/Text.native.js +30 -27
- package/dist/esm/views/Text.native.js.map +6 -1
- package/dist/esm/views/Theme.native.js +54 -76
- package/dist/esm/views/Theme.native.js.map +6 -1
- package/dist/esm/views/ThemeDebug.native.js +4 -6
- package/dist/esm/views/ThemeDebug.native.js.map +6 -1
- package/dist/esm/views/ThemeProvider.native.js +16 -12
- package/dist/esm/views/ThemeProvider.native.js.map +6 -1
- package/dist/esm/views/View.native.js +6 -4
- package/dist/esm/views/View.native.js.map +6 -1
- package/package.json +11 -11
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/Users/n8/tamagui/code/core/web/src/helpers/webPropsToSkip.native.ts"],
|
|
4
|
+
"mappings": "AAAO,IAAMA,iBAAiB;EAC5BC,YAAY;EACZC,UAAU;EACVC,cAAc;EACdC,wBAAwB;EACxBC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,aAAa;EACbC,WAAW;EACXC,cAAc;EACdC,eAAe;EACfC,cAAc;EACdC,cAAc;EACdC,QAAQ;EACRC,gBAAgB;EAChBC,iBAAiB;EACjBC,cAAc;EACdC,gBAAgB;EAChBC,kBAAkB;EAClBC,oBAAoB;EACpBC,kBAAkB;EAClBC,gBAAgB;EAChBC,gBAAgB;EAChBC,qBAAqB;EACrBC,sBAAsB;EACtBC,YAAY;EACZC,UAAU;EACVC,YAAY;EACZC,gBAAgB;EAChBC,MAAM;EACNC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC,OAAO;EACPC,SAAS;EACTC,eAAe;EACfC,gBAAgB;EAChBC,YAAY;EACZC,gBAAgB;EAChBC,kBAAkB;EAClBC,kBAAkB;EAClBC,iBAAiB;EACjBC,kBAAkB;EAClBC,iBAAiB;EACjBC,UAAU;EACVC,eAAe;EACfC,UAAU;EACVC,YAAY;EACZC,cAAc;EACdC,YAAY;EACZC,UAAU;EACVC,UAAU;AACZ;",
|
|
5
|
+
"names": ["webPropsToSkip", "whiteSpace", "wordWrap", "textOverflow", "textDecorationDistance", "cursor", "contain", "boxSizing", "touchAction", "boxShadow", "outlineStyle", "outlineOffset", "outlineWidth", "outlineColor", "filter", "backdropFilter", "backgroundImage", "mixBlendMode", "scrollbarWidth", "backgroundOrigin", "backgroundPosition", "backgroundRepeat", "backgroundSize", "backgroundClip", "backgroundBlendMode", "backgroundAttachment", "background", "clipPath", "caretColor", "transformStyle", "mask", "maskImage", "textEmphasis", "borderImage", "float", "content", "overflowBlock", "overflowInline", "maskBorder", "maskBorderMode", "maskBorderOutset", "maskBorderRepeat", "maskBorderSlice", "maskBorderSource", "maskBorderWidth", "maskClip", "maskComposite", "maskMode", "maskOrigin", "maskPosition", "maskRepeat", "maskSize", "maskType"]
|
|
6
|
+
}
|
|
@@ -1,80 +1,45 @@
|
|
|
1
|
-
import { defaultComponentState, defaultComponentStateMounted, defaultComponentStateShouldEnter } from "../defaultComponentState
|
|
2
|
-
import { useDidHydrateOnce } from "../hooks/useDidHydrateOnce
|
|
1
|
+
import { defaultComponentState, defaultComponentStateMounted, defaultComponentStateShouldEnter } from "../defaultComponentState";
|
|
2
|
+
import { useDidHydrateOnce } from "../hooks/useDidHydrateOnce";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { isServer, isWeb } from "@tamagui/constants";
|
|
5
|
-
import { createShallowSetState } from "../helpers/createShallowSetState
|
|
6
|
-
import { isObj } from "../helpers/isObj
|
|
7
|
-
import { log } from "../helpers/log
|
|
8
|
-
var useComponentState = function
|
|
9
|
-
var {
|
|
10
|
-
animationDriver,
|
|
11
|
-
groups
|
|
12
|
-
} = param,
|
|
13
|
-
_animationDriver_usePresence,
|
|
14
|
-
useAnimations = animationDriver?.useAnimations,
|
|
15
|
-
stateRef = useRef(void 0);
|
|
5
|
+
import { createShallowSetState } from "../helpers/createShallowSetState";
|
|
6
|
+
import { isObj } from "../helpers/isObj";
|
|
7
|
+
import { log } from "../helpers/log";
|
|
8
|
+
var useComponentState = function(props, param, staticConfig, config) {
|
|
9
|
+
var { animationDriver, groups } = param, _animationDriver_usePresence, useAnimations = animationDriver?.useAnimations, stateRef = useRef(void 0);
|
|
16
10
|
stateRef.current || (stateRef.current = {});
|
|
17
|
-
var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
|
|
22
|
-
return !!(next || curStateRef.hasAnimated);
|
|
23
|
-
}(),
|
|
24
|
-
willBeAnimated = !isServer && willBeAnimatedClient;
|
|
11
|
+
var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver?.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = function() {
|
|
12
|
+
var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
|
|
13
|
+
return !!(next || curStateRef.hasAnimated);
|
|
14
|
+
}(), willBeAnimated = !isServer && willBeAnimatedClient;
|
|
25
15
|
willBeAnimated && !curStateRef.hasAnimated && (curStateRef.hasAnimated = !0);
|
|
26
|
-
var presence = willBeAnimated && props.animatePresence !== !1 && (animationDriver == null || (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null,
|
|
27
|
-
presenceState = presence?.[2],
|
|
28
|
-
isExiting = presenceState?.isPresent === !1,
|
|
29
|
-
isEntering = presenceState?.isPresent === !0 && presenceState.initial !== !1,
|
|
30
|
-
hasEnterStyle = !!props.enterStyle,
|
|
31
|
-
hasRNAnimation = hasAnimationProp && animationDriver?.isReactNative,
|
|
32
|
-
hasEnterState = hasEnterStyle || isEntering,
|
|
33
|
-
didHydrateOnce = willBeAnimated ? useDidHydrateOnce() : !0,
|
|
34
|
-
shouldEnter = hasEnterState || !didHydrateOnce && hasRNAnimation,
|
|
35
|
-
shouldEnterFromUnhydrated = isWeb && !didHydrateOnce,
|
|
36
|
-
initialState = shouldEnter ?
|
|
16
|
+
var presence = willBeAnimated && props.animatePresence !== !1 && (animationDriver == null || (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null, presenceState = presence?.[2], isExiting = presenceState?.isPresent === !1, isEntering = presenceState?.isPresent === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasRNAnimation = hasAnimationProp && animationDriver?.isReactNative, hasEnterState = hasEnterStyle || isEntering, didHydrateOnce = willBeAnimated ? useDidHydrateOnce() : !0, shouldEnter = hasEnterState || !didHydrateOnce && hasRNAnimation, shouldEnterFromUnhydrated = isWeb && !didHydrateOnce, initialState = shouldEnter ? (
|
|
37
17
|
// on the very first render we switch all spring animation drivers to css rendering
|
|
38
18
|
// this is because we need to use css variables, which they don't support to do proper SSR
|
|
39
19
|
// without flickers of the wrong colors.
|
|
40
20
|
// but once we do that initial hydration and we are in client side rendering mode,
|
|
41
21
|
// we can avoid the extra re-render on mount
|
|
42
|
-
shouldEnterFromUnhydrated ? defaultComponentState : defaultComponentStateShouldEnter
|
|
43
|
-
|
|
22
|
+
shouldEnterFromUnhydrated ? defaultComponentState : defaultComponentStateShouldEnter
|
|
23
|
+
) : defaultComponentStateMounted, disabled = isDisabled(props);
|
|
44
24
|
disabled != null && (initialState.disabled = disabled);
|
|
45
|
-
var states = useState(initialState),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} : states[0],
|
|
50
|
-
setState = states[1],
|
|
51
|
-
isHydrated = state.unmounted === !1 || state.unmounted === "should-enter",
|
|
52
|
-
isAnimated = willBeAnimated;
|
|
25
|
+
var states = useState(initialState), state = props.forceStyle ? {
|
|
26
|
+
...states[0],
|
|
27
|
+
[props.forceStyle]: !0
|
|
28
|
+
} : states[0], setState = states[1], isHydrated = state.unmounted === !1 || state.unmounted === "should-enter", isAnimated = willBeAnimated;
|
|
53
29
|
isWeb && hasRNAnimation && !staticConfig.isHOC && state.unmounted === !0 && (isAnimated = !1, curStateRef.willHydrate = !0), disabled !== state.disabled && (state.disabled = disabled, disabled && Object.assign(state, defaultComponentStateMounted), setState({
|
|
54
30
|
...state
|
|
55
31
|
}));
|
|
56
32
|
var setStateShallow = createShallowSetState(setState, disabled, !1, props.debug);
|
|
57
33
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
58
34
|
process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`has presenceState ${JSON.stringify(presenceState)}`);
|
|
59
|
-
var {
|
|
60
|
-
enterVariant,
|
|
61
|
-
exitVariant,
|
|
62
|
-
enterExitVariant,
|
|
63
|
-
custom
|
|
64
|
-
} = presenceState;
|
|
35
|
+
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
65
36
|
isObj(custom) && Object.assign(props, custom);
|
|
66
|
-
var exv = exitVariant ?? enterExitVariant,
|
|
67
|
-
env = enterVariant ?? enterExitVariant;
|
|
37
|
+
var exv = exitVariant ?? enterExitVariant, env = enterVariant ?? enterExitVariant;
|
|
68
38
|
state.unmounted && env && staticConfig.variants[env] ? (process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`Animating presence ENTER "${env}"`), props[env] = !0) : isExiting && exv && (process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`Animating presence EXIT "${exv}"`), props[exv] = exitVariant !== enterExitVariant);
|
|
69
39
|
}
|
|
70
40
|
var shouldAvoidClasses = !isWeb;
|
|
71
41
|
if (isWeb) {
|
|
72
|
-
var {
|
|
73
|
-
disableClassName
|
|
74
|
-
} = props,
|
|
75
|
-
isAnimatedAndHydrated = isAnimated && !supportsCSSVars && didHydrateOnce && !isServer,
|
|
76
|
-
isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || didHydrateOnce),
|
|
77
|
-
isDisabledManually = disableClassName && !isServer && didHydrateOnce && state.unmounted === !0;
|
|
42
|
+
var { disableClassName } = props, isAnimatedAndHydrated = isAnimated && !supportsCSSVars && didHydrateOnce && !isServer, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || didHydrateOnce), isDisabledManually = disableClassName && !isServer && didHydrateOnce && state.unmounted === !0;
|
|
78
43
|
(isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0, process.env.NODE_ENV === "development" && props.debug && log("avoiding className", {
|
|
79
44
|
isAnimatedAndHydrated,
|
|
80
45
|
isDisabledManually,
|
|
@@ -83,25 +48,24 @@ var useComponentState = function (props, param, staticConfig, config) {
|
|
|
83
48
|
}
|
|
84
49
|
var groupName = props.group;
|
|
85
50
|
if (groupName && !curStateRef.group) {
|
|
86
|
-
var listeners = /* @__PURE__ */new Set();
|
|
51
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
87
52
|
curStateRef.group = {
|
|
88
53
|
listeners,
|
|
89
54
|
emit(name, state2) {
|
|
90
|
-
listeners.forEach(function
|
|
55
|
+
listeners.forEach(function(l) {
|
|
91
56
|
return l(name, state2);
|
|
92
57
|
});
|
|
93
58
|
},
|
|
94
59
|
subscribe(cb) {
|
|
95
|
-
return listeners.add(cb), function
|
|
60
|
+
return listeners.add(cb), function() {
|
|
96
61
|
listeners.delete(cb);
|
|
97
62
|
};
|
|
98
63
|
}
|
|
99
64
|
};
|
|
100
65
|
}
|
|
101
66
|
if (groupName) {
|
|
102
|
-
var groupContextState = groups.state,
|
|
103
|
-
|
|
104
|
-
setStateShallow = function (state2) {
|
|
67
|
+
var groupContextState = groups.state, og = setStateShallow;
|
|
68
|
+
setStateShallow = function(state2) {
|
|
105
69
|
og(state2), curStateRef.group.emit(groupName, {
|
|
106
70
|
pseudo: state2
|
|
107
71
|
});
|
|
@@ -134,14 +98,16 @@ var useComponentState = function (props, param, staticConfig, config) {
|
|
|
134
98
|
};
|
|
135
99
|
};
|
|
136
100
|
function hasAnimatedStyleValue(style) {
|
|
137
|
-
return Object.keys(style).some(function
|
|
101
|
+
return Object.keys(style).some(function(k) {
|
|
138
102
|
var val = style[k];
|
|
139
103
|
return val && typeof val == "object" && "_animation" in val;
|
|
140
104
|
});
|
|
141
105
|
}
|
|
142
|
-
var isDisabled = function
|
|
106
|
+
var isDisabled = function(props) {
|
|
143
107
|
var _props_accessibilityState;
|
|
144
108
|
return props.disabled || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props["aria-disabled"] || props.accessibilityDisabled || !1;
|
|
145
109
|
};
|
|
146
|
-
export {
|
|
147
|
-
|
|
110
|
+
export {
|
|
111
|
+
useComponentState
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=useComponentState.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/Users/n8/tamagui/code/core/web/src/hooks/useComponentState.ts"],
|
|
4
|
+
"mappings": "AAAA,SACEA,uBACAC,8BACAC,wCACK;AACP,SAASC,yBAAyB;AAClC,SAASC,QAAQC,gBAAgB;AAYjC,SAASC,UAAUC,aAAa;AAChC,SAASC,6BAA6B;AACtC,SAASC,aAAa;AACtB,SAASC,WAAW;AAE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AOuC,KAAK1E,KAAAA,EAAO2E,KAAK,SAACC,GAAAA;AAC9B,QAAMC,MAAM7E,MAAM4E,CAAAA;AAClB,WAAOC,OAAO,OAAOA,OAAQ,YAAY,gBAAgBA;EAC3D,CAAA;AACF;AAEA,IAAMnD,aAAa,SAACrC,OAAAA;MAGhBA;AAFF,SACEA,MAAMoC,cACNpC,4BAAAA,MAAMyF,wBAAkB,QAAxBzF,8BAAAA,SAAAA,SAAAA,0BAA0BoC,aAC1BpC,MAAM,eAAA,KACNA,MAAM0F,yBACN;AAEJ;",
|
|
5
|
+
"names": ["defaultComponentState", "defaultComponentStateMounted", "defaultComponentStateShouldEnter", "useDidHydrateOnce", "useRef", "useState", "isServer", "isWeb", "createShallowSetState", "isObj", "log", "useComponentState", "props", "staticConfig", "config", "animationDriver", "groups", "useAnimations", "stateRef", "undefined", "current", "hasAnimationProp", "Boolean", "style", "hasAnimatedStyleValue", "supportsCSSVars", "curStateRef", "willBeAnimatedClient", "next", "isHOC", "hasAnimated", "willBeAnimated", "presence", "usePresence", "presenceState", "isExiting", "isPresent", "isEntering", "initial", "hasEnterStyle", "enterStyle", "hasRNAnimation", "isReactNative", "hasEnterState", "didHydrateOnce", "shouldEnter", "shouldEnterFromUnhydrated", "initialState", "disabled", "isDisabled", "states", "state", "forceStyle", "setState", "isHydrated", "unmounted", "isAnimated", "willHydrate", "Object", "assign", "setStateShallow", "debug", "variants", "process", "env", "NODE_ENV", "console", "warn", "JSON", "stringify", "enterVariant", "exitVariant", "enterExitVariant", "custom", "exv", "shouldAvoidClasses", "disableClassName", "isAnimatedAndHydrated", "isClassNameDisabled", "acceptsClassName", "disableSSR", "isDisabledManually", "groupName", "group", "listeners", "Set", "emit", "name", "forEach", "l", "subscribe", "cb", "add", "delete", "groupContextState", "og", "pseudo", "keys", "some", "k", "val", "accessibilityState", "accessibilityDisabled"]
|
|
6
|
+
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { getConfig } from "../config
|
|
3
|
-
import { ComponentContext } from "../contexts/ComponentContext
|
|
4
|
-
var useConfiguration = function
|
|
5
|
-
var {
|
|
6
|
-
groups,
|
|
7
|
-
animationDriver,
|
|
8
|
-
...restComponentConfig
|
|
9
|
-
} = React.useContext(ComponentContext),
|
|
10
|
-
{
|
|
11
|
-
animations,
|
|
12
|
-
...restConfig
|
|
13
|
-
} = getConfig();
|
|
2
|
+
import { getConfig } from "../config";
|
|
3
|
+
import { ComponentContext } from "../contexts/ComponentContext";
|
|
4
|
+
var useConfiguration = function() {
|
|
5
|
+
var { groups, animationDriver, ...restComponentConfig } = React.useContext(ComponentContext), { animations, ...restConfig } = getConfig();
|
|
14
6
|
return {
|
|
15
7
|
...restConfig,
|
|
16
8
|
...restComponentConfig,
|
|
17
9
|
animationDriver: animationDriver ?? getConfig().animations
|
|
18
10
|
};
|
|
19
11
|
};
|
|
20
|
-
export {
|
|
21
|
-
|
|
12
|
+
export {
|
|
13
|
+
useConfiguration
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useConfiguration.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/Users/n8/tamagui/code/core/web/src/hooks/useConfiguration.tsx"],
|
|
4
|
+
"mappings": "AAAA,OAAOA,WAAW;AAElB,SAASC,iBAAiB;AAC1B,SAASC,wBAAwB;AAE1B,IAAMC,mBAAmB,WAAA;AAC9B,MAAM,EAAEC,QAAQC,iBAAiB,GAAGC,oBAAAA,IAClCN,MAAMO,WAAWL,gBAAAA,GACb,EAAEM,YAAY,GAAGC,WAAAA,IAAeR,UAAAA;AACtC,SAAO;IACL,GAAGQ;IACH,GAAGH;IACHD,iBAAiBA,mBAAmBJ,UAAAA,EAAYO;EAClD;AACF;",
|
|
5
|
+
"names": ["React", "getConfig", "ComponentContext", "useConfiguration", "groups", "animationDriver", "restComponentConfig", "useContext", "animations", "restConfig"]
|
|
6
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { getSetting } from "../config
|
|
2
|
+
import { getSetting } from "../config";
|
|
3
3
|
function useDidHydrateOnceRoot() {
|
|
4
4
|
return !0;
|
|
5
5
|
}
|
|
@@ -7,17 +7,18 @@ var last = Date.now();
|
|
|
7
7
|
function useDidHydrateOnce() {
|
|
8
8
|
return !0;
|
|
9
9
|
}
|
|
10
|
-
var emptySubscribe = function
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
getClientSnapshot = function () {
|
|
14
|
-
return !0;
|
|
15
|
-
},
|
|
16
|
-
getServerSnapshot = function () {
|
|
17
|
-
return !1;
|
|
18
|
-
},
|
|
19
|
-
useDidHydrateSync = function () {
|
|
20
|
-
return React.useSyncExternalStore(emptySubscribe, getClientSnapshot, getServerSnapshot);
|
|
10
|
+
var emptySubscribe = function() {
|
|
11
|
+
return function() {
|
|
21
12
|
};
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
}, getClientSnapshot = function() {
|
|
14
|
+
return !0;
|
|
15
|
+
}, getServerSnapshot = function() {
|
|
16
|
+
return !1;
|
|
17
|
+
}, useDidHydrateSync = function() {
|
|
18
|
+
return React.useSyncExternalStore(emptySubscribe, getClientSnapshot, getServerSnapshot);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
useDidHydrateOnce,
|
|
22
|
+
useDidHydrateOnceRoot
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useDidHydrateOnce.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/Users/n8/tamagui/code/core/web/src/hooks/useDidHydrateOnce.tsx"],
|
|
4
|
+
"mappings": "AAAA,OAAOA,WAAW;AAClB,SAASC,kBAAkB;AAIpB,SAASC,wBAAAA;AAYd,SAAO;AACT;AAEA,IAAIC,OAAOC,KAAKC,IAAG;AAEZ,SAASC,oBAAAA;AAEZ,SAAO;AAWX;AAEA,IAAMC,iBAAiB,WAAA;SAAM,WAAA;EAAO;GAC9BC,oBAAoB,WAAA;SAAM;GAC1BC,oBAAoB,WAAA;SAAM;GAC1BC,oBAAoB,WAAA;SACxBC,MAAMC,qBAAqBL,gBAAgBC,mBAAmBC,iBAAAA;;",
|
|
5
|
+
"names": ["React", "getSetting", "useDidHydrateOnceRoot", "last", "Date", "now", "useDidHydrateOnce", "emptySubscribe", "getClientSnapshot", "getServerSnapshot", "useDidHydrateSync", "React", "useSyncExternalStore"]
|
|
6
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { getSetting } from "../config
|
|
1
|
+
import { getSetting } from "../config";
|
|
2
2
|
function getDisableSSR(componentContext) {
|
|
3
3
|
var _componentContext_disableSSR;
|
|
4
4
|
return (_componentContext_disableSSR = componentContext?.disableSSR) !== null && _componentContext_disableSSR !== void 0 ? _componentContext_disableSSR : getSetting("disableSSR");
|
|
5
5
|
}
|
|
6
|
-
export {
|
|
7
|
-
|
|
6
|
+
export {
|
|
7
|
+
getDisableSSR
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useDisableSSR.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/Users/n8/tamagui/code/core/web/src/hooks/useDisableSSR.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,kBAAkB;AAGpB,SAASC,cAAcC,kBAAoC;MACzDA;AAAP,UAAOA,+BAAAA,kBAAkBC,gBAAU,QAA5BD,iCAAAA,SAAAA,+BAAgCF,WAAW,YAAA;AACpD;",
|
|
5
|
+
"names": ["getSetting", "getDisableSSR", "componentContext", "disableSSR"]
|
|
6
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isTouchable, isWeb } from "@tamagui/constants";
|
|
2
2
|
import { useDidFinishSSR } from "@tamagui/use-did-finish-ssr";
|
|
3
|
-
var useIsTouchDevice = function
|
|
3
|
+
var useIsTouchDevice = function() {
|
|
4
4
|
return isWeb ? useDidFinishSSR() ? isTouchable : !1 : !0;
|
|
5
5
|
};
|
|
6
|
-
export {
|
|
7
|
-
|
|
6
|
+
export {
|
|
7
|
+
useIsTouchDevice
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useIsTouchDevice.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/Users/n8/tamagui/code/core/web/src/hooks/useIsTouchDevice.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,aAAaC,aAAa;AACnC,SAASC,uBAAuB;AAEzB,IAAMC,mBAAmB,WAAA;AAC9B,SAAQF,QAAeC,gBAAAA,IAAoBF,cAAc,KAAzC;AAClB;",
|
|
5
|
+
"names": ["isTouchable", "isWeb", "useDidFinishSSR", "useIsTouchDevice"]
|
|
6
|
+
}
|
|
@@ -1,71 +1,58 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { isServer, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
3
|
-
import { getConfig, getSetting } from "../config
|
|
4
|
-
import { matchMedia } from "../helpers/matchMedia
|
|
5
|
-
import { pseudoDescriptors } from "../helpers/pseudoDescriptors
|
|
6
|
-
import { getDisableSSR } from "./useDisableSSR
|
|
7
|
-
var mediaState =
|
|
3
|
+
import { getConfig, getSetting } from "../config";
|
|
4
|
+
import { matchMedia } from "../helpers/matchMedia";
|
|
5
|
+
import { pseudoDescriptors } from "../helpers/pseudoDescriptors";
|
|
6
|
+
import { getDisableSSR } from "./useDisableSSR";
|
|
7
|
+
var mediaState = (
|
|
8
8
|
// development only safeguard
|
|
9
9
|
process.env.NODE_ENV === "development" ? new Proxy({}, {
|
|
10
10
|
get(target, key) {
|
|
11
|
-
if (typeof key == "string" && key[0] === "$" &&
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (typeof key == "string" && key[0] === "$" && // dont error on $$typeof
|
|
12
|
+
key[1] !== "$")
|
|
13
|
+
throw new Error(`Access mediaState should not use "$": ${key}`);
|
|
14
14
|
return Reflect.get(target, key);
|
|
15
15
|
}
|
|
16
|
-
}) : {}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var {
|
|
43
|
-
media
|
|
44
|
-
} = config,
|
|
45
|
-
mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
|
|
46
|
-
if (media) {
|
|
47
|
-
mediaVersion++;
|
|
48
|
-
for (var key in media) mediaState[key] = mediaQueryDefaultActive?.[key] || !1, mediaKeys.add(`$${key}`);
|
|
49
|
-
Object.assign(mediaQueryConfig, media), initState = {
|
|
50
|
-
...mediaState
|
|
51
|
-
}, mediaKeysOrdered = Object.keys(media), config.disableSSR ? setupMediaListeners() : updateCurrentState();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
16
|
+
}) : {}
|
|
17
|
+
), mediaQueryConfig = {}, getMedia = function() {
|
|
18
|
+
return mediaState;
|
|
19
|
+
}, mediaKeys = /* @__PURE__ */ new Set(), mediaKeyRegex = /\$(platform|theme|group)-/, isMediaKey = function(key) {
|
|
20
|
+
if (mediaKeys.has(key)) return !0;
|
|
21
|
+
if (key[0] === "$") {
|
|
22
|
+
var match = key.match(mediaKeyRegex);
|
|
23
|
+
if (match) return match[1];
|
|
24
|
+
}
|
|
25
|
+
return !1;
|
|
26
|
+
}, initState, defaultMediaImportance = Object.keys(pseudoDescriptors).length, mediaKeysOrdered, getMediaKeyImportance = function(key) {
|
|
27
|
+
if (process.env.NODE_ENV === "development" && key[0] === "$")
|
|
28
|
+
throw new Error("use short key");
|
|
29
|
+
var conf = getConfig();
|
|
30
|
+
return conf.settings.mediaPropOrder ? defaultMediaImportance : mediaKeysOrdered.indexOf(key) + 100;
|
|
31
|
+
}, dispose = /* @__PURE__ */ new Set(), mediaVersion = 0, configureMedia = function(config) {
|
|
32
|
+
var { media } = config, mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
|
|
33
|
+
if (media) {
|
|
34
|
+
mediaVersion++;
|
|
35
|
+
for (var key in media)
|
|
36
|
+
mediaState[key] = mediaQueryDefaultActive?.[key] || !1, mediaKeys.add(`$${key}`);
|
|
37
|
+
Object.assign(mediaQueryConfig, media), initState = {
|
|
38
|
+
...mediaState
|
|
39
|
+
}, mediaKeysOrdered = Object.keys(media), config.disableSSR ? setupMediaListeners() : updateCurrentState();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
54
42
|
function unlisten() {
|
|
55
|
-
dispose.forEach(function
|
|
43
|
+
dispose.forEach(function(cb) {
|
|
56
44
|
return cb();
|
|
57
45
|
}), dispose.clear();
|
|
58
46
|
}
|
|
59
47
|
var setupVersion = -1;
|
|
60
48
|
function setupMediaListeners() {
|
|
61
|
-
var _loop = function
|
|
62
|
-
var str = mediaObjectToString(mediaQueryConfig[key2], key2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
match.addListener(update), dispose.add(function () {
|
|
49
|
+
var _loop = function(key2) {
|
|
50
|
+
var str = mediaObjectToString(mediaQueryConfig[key2], key2), getMatch = function() {
|
|
51
|
+
return matchMedia(str);
|
|
52
|
+
}, match = getMatch();
|
|
53
|
+
if (!match)
|
|
54
|
+
throw new Error("\u26A0\uFE0F No match");
|
|
55
|
+
match.addListener(update), dispose.add(function() {
|
|
69
56
|
match.removeListener(update);
|
|
70
57
|
}), update();
|
|
71
58
|
function update() {
|
|
@@ -81,17 +68,15 @@ function setupMediaListeners() {
|
|
|
81
68
|
for (var key in mediaQueryConfig) _loop(key);
|
|
82
69
|
}
|
|
83
70
|
}
|
|
84
|
-
var listeners = /* @__PURE__ */new Set(),
|
|
85
|
-
flushing = !1,
|
|
86
|
-
flushVersion = -1;
|
|
71
|
+
var listeners = /* @__PURE__ */ new Set(), flushing = !1, flushVersion = -1;
|
|
87
72
|
function updateCurrentState() {
|
|
88
|
-
flushing && flushVersion === mediaVersion || (flushVersion = mediaVersion, flushing = !0, Promise.resolve().then(function
|
|
89
|
-
flushing = !1, listeners.forEach(function
|
|
73
|
+
flushing && flushVersion === mediaVersion || (flushVersion = mediaVersion, flushing = !0, Promise.resolve().then(function() {
|
|
74
|
+
flushing = !1, listeners.forEach(function(cb) {
|
|
90
75
|
return cb(mediaState);
|
|
91
76
|
});
|
|
92
77
|
}));
|
|
93
78
|
}
|
|
94
|
-
var States = /* @__PURE__ */new WeakMap();
|
|
79
|
+
var States = /* @__PURE__ */ new WeakMap();
|
|
95
80
|
function setMediaShouldUpdate(ref, props) {
|
|
96
81
|
return States.set(ref, {
|
|
97
82
|
...States.get(ref),
|
|
@@ -99,43 +84,37 @@ function setMediaShouldUpdate(ref, props) {
|
|
|
99
84
|
});
|
|
100
85
|
}
|
|
101
86
|
function subscribe(subscriber) {
|
|
102
|
-
return listeners.add(subscriber), function
|
|
87
|
+
return listeners.add(subscriber), function() {
|
|
103
88
|
listeners.delete(subscriber);
|
|
104
89
|
};
|
|
105
90
|
}
|
|
106
91
|
function useMedia(uidIn, componentContext, debug) {
|
|
107
|
-
var uid = uidIn ?? React.useRef(),
|
|
108
|
-
disableSSR = getDisableSSR(componentContext),
|
|
109
|
-
initialState = (disableSSR || !isWeb ? mediaState : initState) || {},
|
|
110
|
-
componentState = States.get(uid);
|
|
92
|
+
var uid = uidIn ?? React.useRef(), disableSSR = getDisableSSR(componentContext), initialState = (disableSSR || !isWeb ? mediaState : initState) || {}, componentState = States.get(uid);
|
|
111
93
|
componentState || (componentState = {
|
|
112
94
|
prev: initialState
|
|
113
95
|
}, States.set(uid, componentState));
|
|
114
|
-
var getSnapshot = function
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (process.env.TAMAGUI_SYNC_MEDIA_QUERY) state = React.useSyncExternalStore(subscribe, getSnapshot, function () {
|
|
131
|
-
return initialState;
|
|
132
|
-
});else {
|
|
96
|
+
var getSnapshot = function() {
|
|
97
|
+
if (!componentState)
|
|
98
|
+
return initialState;
|
|
99
|
+
var { enabled, keys, prev = initialState } = componentState;
|
|
100
|
+
if (enabled === !1)
|
|
101
|
+
return prev;
|
|
102
|
+
var _ref, testKeys = (_ref = (keys != null || enabled) && keys) !== null && _ref !== void 0 ? _ref : null, hasntUpdated = !testKeys || Object.keys(testKeys).every(function(key) {
|
|
103
|
+
return mediaState[key] === prev[key];
|
|
104
|
+
});
|
|
105
|
+
return hasntUpdated ? prev : (componentState.prev = mediaState, mediaState);
|
|
106
|
+
}, state;
|
|
107
|
+
if (process.env.TAMAGUI_SYNC_MEDIA_QUERY)
|
|
108
|
+
state = React.useSyncExternalStore(subscribe, getSnapshot, function() {
|
|
109
|
+
return initialState;
|
|
110
|
+
});
|
|
111
|
+
else {
|
|
133
112
|
var [_state, setState] = React.useState(initialState);
|
|
134
|
-
state = _state, useIsomorphicLayoutEffect(function
|
|
113
|
+
state = _state, useIsomorphicLayoutEffect(function() {
|
|
135
114
|
function update() {
|
|
136
115
|
setState(getSnapshot);
|
|
137
116
|
}
|
|
138
|
-
return update(), disableSSR || Promise.resolve().then(function
|
|
117
|
+
return update(), disableSSR || Promise.resolve().then(function() {
|
|
139
118
|
update();
|
|
140
119
|
}), subscribe(update);
|
|
141
120
|
}, []);
|
|
@@ -160,29 +139,35 @@ function getMediaState(mediaGroups, layout) {
|
|
|
160
139
|
disableMediaTouch = !0;
|
|
161
140
|
var res;
|
|
162
141
|
try {
|
|
163
|
-
res = Object.fromEntries([
|
|
164
|
-
|
|
142
|
+
res = Object.fromEntries([
|
|
143
|
+
...mediaGroups
|
|
144
|
+
].map(function(mediaKey) {
|
|
145
|
+
return [
|
|
146
|
+
mediaKey,
|
|
147
|
+
mediaKeyMatch(mediaKey, layout)
|
|
148
|
+
];
|
|
165
149
|
}));
|
|
166
150
|
} finally {
|
|
167
151
|
disableMediaTouch = !1;
|
|
168
152
|
}
|
|
169
153
|
return res;
|
|
170
154
|
}
|
|
171
|
-
var getMediaImportanceIfMoreImportant = function
|
|
155
|
+
var getMediaImportanceIfMoreImportant = function(mediaKey, key, importancesUsed, isSizeMedia) {
|
|
172
156
|
var importance = isSizeMedia && !getSetting("mediaPropOrder") ? getMediaKeyImportance(mediaKey) : defaultMediaImportance;
|
|
173
157
|
return !importancesUsed[key] || importance > importancesUsed[key] ? importance : null;
|
|
174
158
|
};
|
|
175
159
|
function camelToHyphen(str) {
|
|
176
|
-
return str.replace(/[A-Z]/g, function
|
|
160
|
+
return str.replace(/[A-Z]/g, function(m) {
|
|
177
161
|
return `-${m.toLowerCase()}`;
|
|
178
162
|
}).toLowerCase();
|
|
179
163
|
}
|
|
180
|
-
var cache = /* @__PURE__ */new WeakMap(),
|
|
181
|
-
cachedMediaKeyToQuery = {};
|
|
164
|
+
var cache = /* @__PURE__ */ new WeakMap(), cachedMediaKeyToQuery = {};
|
|
182
165
|
function mediaObjectToString(query, key) {
|
|
183
|
-
if (typeof query == "string")
|
|
184
|
-
|
|
185
|
-
|
|
166
|
+
if (typeof query == "string")
|
|
167
|
+
return query;
|
|
168
|
+
if (cache.has(query))
|
|
169
|
+
return cache.get(query);
|
|
170
|
+
var res = Object.entries(query).map(function(param) {
|
|
186
171
|
var [feature, value] = param;
|
|
187
172
|
return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
|
|
188
173
|
}).join(" and ");
|
|
@@ -192,15 +177,28 @@ function mediaKeyToQuery(key) {
|
|
|
192
177
|
return cachedMediaKeyToQuery[key] || mediaObjectToString(mediaQueryConfig[key], key);
|
|
193
178
|
}
|
|
194
179
|
function mediaKeyMatch(key, dimensions) {
|
|
195
|
-
var mediaQueries = mediaQueryConfig[key],
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
isWidth = query.endsWith("Width"),
|
|
200
|
-
givenVal = dimensions[isWidth ? "width" : "height"];
|
|
201
|
-
return isMax ? givenVal < expectedVal : givenVal > expectedVal;
|
|
202
|
-
});
|
|
180
|
+
var mediaQueries = mediaQueryConfig[key], result = Object.keys(mediaQueries).every(function(query) {
|
|
181
|
+
var expectedVal = +mediaQueries[query], isMax = query.startsWith("max"), isWidth = query.endsWith("Width"), givenVal = dimensions[isWidth ? "width" : "height"];
|
|
182
|
+
return isMax ? givenVal < expectedVal : givenVal > expectedVal;
|
|
183
|
+
});
|
|
203
184
|
return result;
|
|
204
185
|
}
|
|
205
|
-
export {
|
|
206
|
-
|
|
186
|
+
export {
|
|
187
|
+
_dmt,
|
|
188
|
+
configureMedia,
|
|
189
|
+
getMedia,
|
|
190
|
+
getMediaImportanceIfMoreImportant,
|
|
191
|
+
getMediaKeyImportance,
|
|
192
|
+
getMediaState,
|
|
193
|
+
isMediaKey,
|
|
194
|
+
mediaKeyMatch,
|
|
195
|
+
mediaKeyToQuery,
|
|
196
|
+
mediaKeys,
|
|
197
|
+
mediaObjectToString,
|
|
198
|
+
mediaQueryConfig,
|
|
199
|
+
mediaState,
|
|
200
|
+
setMediaShouldUpdate,
|
|
201
|
+
setupMediaListeners,
|
|
202
|
+
useMedia
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=useMedia.js.map
|