@tamagui/core 1.131.0 → 1.131.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/native.js +24 -14
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +24 -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;
|
|
@@ -6460,6 +6460,8 @@ var require_useThemeState_native = __commonJS({
|
|
|
6460
6460
|
if (name && reset) throw new Error(process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time.");
|
|
6461
6461
|
var { themes: themes2 } = (0, import_config.getConfig)();
|
|
6462
6462
|
if (reset) {
|
|
6463
|
+
var isSchemeOnly = parentName === "light" || parentName === "dark";
|
|
6464
|
+
if (isSchemeOnly) return parentName === "light" ? "dark" : "light";
|
|
6463
6465
|
var lastPartIndex = parentName.lastIndexOf("_"), name1 = lastPartIndex <= 0 ? parentName : parentName.slice(lastPartIndex), scheme = parentName.slice(0, lastPartIndex), result = themes2[name1] ? name1 : scheme;
|
|
6464
6466
|
return result;
|
|
6465
6467
|
}
|
|
@@ -7539,7 +7541,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7539
7541
|
}
|
|
7540
7542
|
});
|
|
7541
7543
|
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([
|
|
7544
|
+
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
7545
|
"hover",
|
|
7544
7546
|
"press",
|
|
7545
7547
|
"pressIn",
|
|
@@ -7755,6 +7757,18 @@ var require_createComponent_native = __commonJS({
|
|
|
7755
7757
|
}
|
|
7756
7758
|
if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
|
|
7757
7759
|
var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
|
|
7760
|
+
componentContext.mediaEmit = function(next) {
|
|
7761
|
+
NextMedia.set(stateRef, next), updateStyleListener();
|
|
7762
|
+
};
|
|
7763
|
+
var updateStyleListener = function() {
|
|
7764
|
+
var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7765
|
+
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7766
|
+
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
|
|
7767
|
+
...styleProps,
|
|
7768
|
+
mediaState: mediaState22
|
|
7769
|
+
} : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7770
|
+
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7771
|
+
};
|
|
7758
7772
|
stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
7759
7773
|
var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
7760
7774
|
if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
|
|
@@ -7769,11 +7783,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7769
7783
|
NextState.set(stateRef, updatedState), process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && (console.groupCollapsed("[\u26A1\uFE0F] avoid setState", next, {
|
|
7770
7784
|
updatedState,
|
|
7771
7785
|
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) || {});
|
|
7786
|
+
}), console.info(stateRef.current.host), console.groupEnd()), updateStyleListener();
|
|
7777
7787
|
} else process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && console.info("[\u{1F40C}] re-render", {
|
|
7778
7788
|
canAvoidReRender,
|
|
7779
7789
|
next
|