tamagui 1.116.4 → 1.116.6
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/native.js +57 -36
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +57 -36
- package/dist/test.native.js.map +2 -2
- package/package.json +54 -54
package/dist/native.js
CHANGED
|
@@ -3132,21 +3132,18 @@ var require_useMedia_native = __commonJS({
|
|
|
3132
3132
|
listeners.delete(subscriber);
|
|
3133
3133
|
};
|
|
3134
3134
|
}
|
|
3135
|
+
var CurrentKeysMap = /* @__PURE__ */ new WeakMap();
|
|
3135
3136
|
function useMedia3(cc, debug) {
|
|
3136
|
-
var disableSSR = (0, import_config.getSetting)("disableSSR") || (0, import_useDisableSSR.getDisableSSR)(cc), initialState = disableSSR || !import_constants4.isWeb ? mediaState3 : initState, [state, setState] = import_react3.default.useState(initialState)
|
|
3137
|
-
|
|
3138
|
-
|
|
3137
|
+
var disableSSR = (0, import_config.getSetting)("disableSSR") || (0, import_useDisableSSR.getDisableSSR)(cc), initialState = disableSSR || !import_constants4.isWeb ? mediaState3 : initState, [state, setState] = import_react3.default.useState(initialState);
|
|
3138
|
+
CurrentKeysMap.get(setState) || CurrentKeysMap.set(setState, /* @__PURE__ */ new Set());
|
|
3139
|
+
var currentKeys = CurrentKeysMap.get(setState);
|
|
3139
3140
|
function getSnapshot(cur) {
|
|
3140
|
-
|
|
3141
|
-
if (!keys) return cur;
|
|
3141
|
+
if (!currentKeys) return cur;
|
|
3142
3142
|
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
3143
3143
|
try {
|
|
3144
|
-
for (var _iterator =
|
|
3144
|
+
for (var _iterator = currentKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
3145
3145
|
var key = _step.value;
|
|
3146
|
-
if (mediaState3[key] !== cur[key]) return process.env.NODE_ENV === "development" && debug && console.warn("useMedia()\u270D\uFE0F", key, cur[key], ">", mediaState3[key]),
|
|
3147
|
-
...mediaState3,
|
|
3148
|
-
lastKeys: new Set(keys)
|
|
3149
|
-
};
|
|
3146
|
+
if (mediaState3[key] !== cur[key]) return process.env.NODE_ENV === "development" && debug && console.warn("useMedia()\u270D\uFE0F", key, cur[key], ">", mediaState3[key]), mediaState3;
|
|
3150
3147
|
}
|
|
3151
3148
|
} catch (err) {
|
|
3152
3149
|
_didIteratorError = !0, _iteratorError = err;
|
|
@@ -3165,22 +3162,26 @@ var require_useMedia_native = __commonJS({
|
|
|
3165
3162
|
}), (0, import_constants4.useIsomorphicLayoutEffect)(function() {
|
|
3166
3163
|
var update = function() {
|
|
3167
3164
|
return setState(function(prev) {
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
// because the !didHydrateOnce logic we can't update as we render
|
|
3171
|
-
// we need to get the current keys in case we added
|
|
3172
|
-
// these only ever add keys so likely ok?
|
|
3173
|
-
getCurrentKeys()
|
|
3174
|
-
);
|
|
3165
|
+
var next = getSnapshot(prev);
|
|
3166
|
+
return next;
|
|
3175
3167
|
});
|
|
3176
3168
|
};
|
|
3177
|
-
|
|
3178
|
-
|
|
3169
|
+
update();
|
|
3170
|
+
var tm = setTimeout(function() {
|
|
3171
|
+
currentKeys.size && update();
|
|
3172
|
+
}), dispose2 = subscribe(update);
|
|
3173
|
+
return function() {
|
|
3174
|
+
dispose2(), clearTimeout(tm);
|
|
3175
|
+
};
|
|
3176
|
+
}, [
|
|
3177
|
+
setState
|
|
3178
|
+
]), new Proxy(state, {
|
|
3179
3179
|
get(_, key) {
|
|
3180
3180
|
if (isRendering && !disableMediaTouch && typeof key == "string") {
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3181
|
+
currentKeys.add(key);
|
|
3182
|
+
var shouldUpdate = state[key] !== mediaState3[key];
|
|
3183
|
+
if (shouldUpdate && (process.env.NODE_ENV === "development" && debug && console.info("useMedia() TOUCH", key), !isInitialState)) {
|
|
3184
|
+
var next = getSnapshot(state);
|
|
3184
3185
|
next !== state && setState(next);
|
|
3185
3186
|
}
|
|
3186
3187
|
}
|
|
@@ -15715,14 +15716,19 @@ var require_GorhomPortal_native = __commonJS({
|
|
|
15715
15716
|
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalHostNonNative, {
|
|
15716
15717
|
...props
|
|
15717
15718
|
});
|
|
15718
|
-
}), allPortalHosts = /* @__PURE__ */ new Map();
|
|
15719
|
+
}), allPortalHosts = /* @__PURE__ */ new Map(), listeners = {};
|
|
15719
15720
|
function PortalHostWeb(props) {
|
|
15720
15721
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
15721
15722
|
style: {
|
|
15722
15723
|
display: "contents"
|
|
15723
15724
|
},
|
|
15724
15725
|
ref: function(node) {
|
|
15725
|
-
|
|
15726
|
+
if (node) {
|
|
15727
|
+
var _listeners_props_name;
|
|
15728
|
+
allPortalHosts.set(props.name, node), (_listeners_props_name = listeners[props.name]) === null || _listeners_props_name === void 0 || _listeners_props_name.forEach(function(x) {
|
|
15729
|
+
return x(node);
|
|
15730
|
+
});
|
|
15731
|
+
} else allPortalHosts.delete(props.name);
|
|
15726
15732
|
}
|
|
15727
15733
|
});
|
|
15728
15734
|
}
|
|
@@ -15752,8 +15758,21 @@ var require_GorhomPortal_native = __commonJS({
|
|
|
15752
15758
|
});
|
|
15753
15759
|
}), PortalItemWeb = function(props) {
|
|
15754
15760
|
if (!props.hostName) throw new Error("No name");
|
|
15755
|
-
var
|
|
15756
|
-
return
|
|
15761
|
+
var cur = allPortalHosts.get(props.hostName), [node, setNode] = (0, import_react3.useState)(cur);
|
|
15762
|
+
return cur && !node && setNode(cur), (0, import_react3.useEffect)(function() {
|
|
15763
|
+
var _listeners, _props_hostName;
|
|
15764
|
+
if (props.hostName && !node) {
|
|
15765
|
+
var listener = function(node2) {
|
|
15766
|
+
setNode(node2);
|
|
15767
|
+
};
|
|
15768
|
+
return (_listeners = listeners)[_props_hostName = props.hostName] || (_listeners[_props_hostName] = /* @__PURE__ */ new Set()), listeners[props.hostName].add(listener), function() {
|
|
15769
|
+
var _listeners_props_hostName;
|
|
15770
|
+
(_listeners_props_hostName = listeners[props.hostName]) === null || _listeners_props_hostName === void 0 || _listeners_props_hostName.delete(listener);
|
|
15771
|
+
};
|
|
15772
|
+
}
|
|
15773
|
+
}, [
|
|
15774
|
+
node
|
|
15775
|
+
]), node ? /* @__PURE__ */ (0, import_react_dom.createPortal)(props.children, node) : null;
|
|
15757
15776
|
}, NonNativePortalComponent = function(props) {
|
|
15758
15777
|
var { name: _providedName, hostName, handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passthrough } = props, { addPortal: addUpdatePortal2, removePortal: removePortal2 } = usePortal(hostName), id = (0, import_react3.useId)(), name = _providedName || id, handleOnMount = (0, import_core12.useEvent)(function() {
|
|
15759
15778
|
_providedHandleOnMount ? _providedHandleOnMount(function() {
|
|
@@ -16161,8 +16180,10 @@ var require_Adapt_native = __commonJS({
|
|
|
16161
16180
|
children: props.children
|
|
16162
16181
|
});
|
|
16163
16182
|
}, useAdaptIsActiveGiven = function(param) {
|
|
16164
|
-
var { when, platform: platform2 } = param, media = (0, import_core12.useMedia)()
|
|
16165
|
-
|
|
16183
|
+
var { when, platform: platform2 } = param, media = (0, import_core12.useMedia)();
|
|
16184
|
+
if (when == null && platform2 == null) return !1;
|
|
16185
|
+
var enabled = !1;
|
|
16186
|
+
return platform2 === "touch" ? enabled = import_constants4.isTouchable : platform2 === "native" ? enabled = !import_constants4.isWeb : platform2 === "web" ? enabled = import_constants4.isWeb : platform2 === "ios" ? enabled = import_constants4.isIos : platform2 === "android" && (enabled = import_constants4.isAndroid), platform2 && enabled == !1 ? !1 : (when && typeof when == "string" && (enabled = media[when]), enabled);
|
|
16166
16187
|
}, useAdaptIsActive = function(scope) {
|
|
16167
16188
|
var props = useAdaptContext(scope);
|
|
16168
16189
|
return useAdaptIsActiveGiven(props);
|
|
@@ -18734,17 +18755,17 @@ var require_Dialog_native = __commonJS({
|
|
|
18734
18755
|
})
|
|
18735
18756
|
});
|
|
18736
18757
|
}, DialogPortal = function(props) {
|
|
18737
|
-
var { __scopeDialog, forceMount, children, ...frameProps } = props, context = useDialogContext(PORTAL_NAME, __scopeDialog), isShowing = forceMount || context.open, [isFullyHidden, setIsFullyHidden] = React4.useState(!isShowing);
|
|
18758
|
+
var { __scopeDialog, forceMount, children, ...frameProps } = props, context = useDialogContext(PORTAL_NAME, __scopeDialog), isShowing = forceMount || context.open, [isFullyHidden, setIsFullyHidden] = React4.useState(!isShowing), isAdapted = (0, import_adapt.useAdaptIsActive)();
|
|
18738
18759
|
isShowing && isFullyHidden && setIsFullyHidden(!1);
|
|
18739
18760
|
var handleExitComplete = React4.useCallback(function() {
|
|
18740
18761
|
setIsFullyHidden(!0);
|
|
18741
|
-
}, [])
|
|
18742
|
-
onExitComplete: handleExitComplete,
|
|
18743
|
-
children: isShowing ? children : null
|
|
18744
|
-
}), isAdapted = (0, import_adapt.useAdaptIsActive)();
|
|
18745
|
-
if (isAdapted) return children;
|
|
18762
|
+
}, []);
|
|
18746
18763
|
if (context.modal) {
|
|
18747
|
-
|
|
18764
|
+
var contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.AnimatePresence, {
|
|
18765
|
+
onExitComplete: handleExitComplete,
|
|
18766
|
+
children: isShowing || isAdapted ? children : null
|
|
18767
|
+
});
|
|
18768
|
+
if (isFullyHidden && !isAdapted) return null;
|
|
18748
18769
|
var framedContents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalProvider2, {
|
|
18749
18770
|
scope: __scopeDialog,
|
|
18750
18771
|
forceMount,
|
|
@@ -18765,7 +18786,7 @@ var require_Dialog_native = __commonJS({
|
|
|
18765
18786
|
}
|
|
18766
18787
|
return framedContents;
|
|
18767
18788
|
}
|
|
18768
|
-
return
|
|
18789
|
+
return children;
|
|
18769
18790
|
}, PassthroughTheme = function(param) {
|
|
18770
18791
|
var { children } = param, themeName = (0, import_core12.useThemeName)();
|
|
18771
18792
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.Theme, {
|