@tamagui/core 1.131.0 → 1.131.1
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 +22 -14
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +22 -14
- package/dist/test.native.js.map +2 -2
- package/package.json +10 -10
package/dist/native.js
CHANGED
|
@@ -2119,22 +2119,22 @@ var require_useMedia_native = __commonJS({
|
|
|
2119
2119
|
listeners.delete(subscriber);
|
|
2120
2120
|
};
|
|
2121
2121
|
}
|
|
2122
|
-
function useMedia2(
|
|
2123
|
-
var componentState =
|
|
2122
|
+
function useMedia2(componentContext, debug) {
|
|
2123
|
+
var componentState = componentContext ? States.get(componentContext) : null, internalRef = (0, import_react3.useRef)(null);
|
|
2124
2124
|
internalRef.current || (internalRef.current = {
|
|
2125
|
-
keys: /* @__PURE__ */ new Set()
|
|
2126
|
-
|
|
2127
|
-
|
|
2125
|
+
keys: /* @__PURE__ */ new Set(),
|
|
2126
|
+
lastState: mediaState2
|
|
2127
|
+
}), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
|
|
2128
|
+
var { keys } = internalRef.current;
|
|
2128
2129
|
keys.size && keys.clear();
|
|
2129
2130
|
var state = (0, import_react3.useSyncExternalStore)(subscribe, function() {
|
|
2130
|
-
|
|
2131
|
-
var curKeys = (componentState == null ? void 0 : componentState.keys) || keys;
|
|
2131
|
+
var curKeys = (componentState == null ? void 0 : componentState.keys) || keys, { lastState, pendingState } = internalRef.current;
|
|
2132
2132
|
if (!curKeys.size) return lastState;
|
|
2133
2133
|
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
2134
2134
|
try {
|
|
2135
2135
|
for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
2136
2136
|
var key = _step.value;
|
|
2137
|
-
if (mediaState2[key] !== lastState[key]) return process.env.NODE_ENV === "development" && debug && console.warn("useMedia() \u270D\uFE0F", key, lastState[key], "=>", mediaState2[key]), internalRef.current.lastState = mediaState2, mediaState2;
|
|
2137
|
+
if (mediaState2[key] !== (pendingState || lastState)[key]) return process.env.NODE_ENV === "development" && debug && console.warn("useMedia() \u270D\uFE0F", key, lastState[key], "=>", mediaState2[key]), componentContext != null && componentContext.mediaEmit ? (componentContext.mediaEmit(mediaState2), internalRef.current.pendingState = mediaState2, lastState) : (internalRef.current.lastState = mediaState2, mediaState2);
|
|
2138
2138
|
}
|
|
2139
2139
|
} catch (err) {
|
|
2140
2140
|
_didIteratorError = !0, _iteratorError = err;
|
|
@@ -7539,7 +7539,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7539
7539
|
}
|
|
7540
7540
|
});
|
|
7541
7541
|
module2.exports = __toCommonJS2(createComponent_exports);
|
|
7542
|
-
var import_jsx_runtime2 = require("react/jsx-runtime"), import_compose_refs = require_index_native4(), import_constants = require_index_native2(), import_helpers2 = require_index_native3(), import_is_equal_shallow = require_index_native5(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_ComponentContext = require_ComponentContext_native(), import_GroupContext = require_GroupContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getShorthandValue = require_getShorthandValue_native(), import_getSplitStyles = require_getSplitStyles_native(), import_log = require_log_native(), import_mergeProps = require_mergeProps_native(), import_setElementProps = require_setElementProps_native(), import_subscribeToContextGroup = require_subscribeToContextGroup_native(), import_themeable = require_themeable_native(), import_wrapStyleTags = require_wrapStyleTags_native(), import_useComponentState = require_useComponentState_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), time2, NextState = /* @__PURE__ */ new WeakMap(), debugKeyListeners, startVisualizer, componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
7542
|
+
var import_jsx_runtime2 = require("react/jsx-runtime"), import_compose_refs = require_index_native4(), import_constants = require_index_native2(), import_helpers2 = require_index_native3(), import_is_equal_shallow = require_index_native5(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_ComponentContext = require_ComponentContext_native(), import_GroupContext = require_GroupContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getShorthandValue = require_getShorthandValue_native(), import_getSplitStyles = require_getSplitStyles_native(), import_log = require_log_native(), import_mergeProps = require_mergeProps_native(), import_setElementProps = require_setElementProps_native(), import_subscribeToContextGroup = require_subscribeToContextGroup_native(), import_themeable = require_themeable_native(), import_wrapStyleTags = require_wrapStyleTags_native(), import_useComponentState = require_useComponentState_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), time2, NextState = /* @__PURE__ */ new WeakMap(), NextMedia = /* @__PURE__ */ new WeakMap(), debugKeyListeners, startVisualizer, componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
7543
7543
|
"hover",
|
|
7544
7544
|
"press",
|
|
7545
7545
|
"pressIn",
|
|
@@ -7755,6 +7755,18 @@ var require_createComponent_native = __commonJS({
|
|
|
7755
7755
|
}
|
|
7756
7756
|
if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
|
|
7757
7757
|
var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
|
|
7758
|
+
componentContext.mediaEmit = function(next) {
|
|
7759
|
+
NextMedia.set(stateRef, next), updateStyleListener();
|
|
7760
|
+
};
|
|
7761
|
+
var updateStyleListener = function() {
|
|
7762
|
+
var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7763
|
+
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7764
|
+
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
|
|
7765
|
+
...styleProps,
|
|
7766
|
+
mediaState: mediaState22
|
|
7767
|
+
} : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7768
|
+
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7769
|
+
};
|
|
7758
7770
|
stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
7759
7771
|
var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
7760
7772
|
if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
|
|
@@ -7769,11 +7781,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7769
7781
|
NextState.set(stateRef, updatedState), process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && (console.groupCollapsed("[\u26A1\uFE0F] avoid setState", next, {
|
|
7770
7782
|
updatedState,
|
|
7771
7783
|
props
|
|
7772
|
-
}), console.info(stateRef.current.host), console.groupEnd());
|
|
7773
|
-
var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7774
|
-
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7775
|
-
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7776
|
-
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7784
|
+
}), console.info(stateRef.current.host), console.groupEnd()), updateStyleListener();
|
|
7777
7785
|
} else process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && console.info("[\u{1F40C}] re-render", {
|
|
7778
7786
|
canAvoidReRender,
|
|
7779
7787
|
next
|