@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/test.native.js
CHANGED
|
@@ -1933,22 +1933,22 @@ var require_useMedia_native = __commonJS({
|
|
|
1933
1933
|
listeners.delete(subscriber);
|
|
1934
1934
|
};
|
|
1935
1935
|
}
|
|
1936
|
-
function useMedia2(
|
|
1937
|
-
var componentState =
|
|
1936
|
+
function useMedia2(componentContext, debug) {
|
|
1937
|
+
var componentState = componentContext ? States.get(componentContext) : null, internalRef = (0, import_react3.useRef)(null);
|
|
1938
1938
|
internalRef.current || (internalRef.current = {
|
|
1939
|
-
keys: /* @__PURE__ */ new Set()
|
|
1940
|
-
|
|
1941
|
-
|
|
1939
|
+
keys: /* @__PURE__ */ new Set(),
|
|
1940
|
+
lastState: mediaState2
|
|
1941
|
+
}), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
|
|
1942
|
+
var { keys } = internalRef.current;
|
|
1942
1943
|
keys.size && keys.clear();
|
|
1943
1944
|
var state = (0, import_react3.useSyncExternalStore)(subscribe, function() {
|
|
1944
|
-
|
|
1945
|
-
var curKeys = (componentState == null ? void 0 : componentState.keys) || keys;
|
|
1945
|
+
var curKeys = (componentState == null ? void 0 : componentState.keys) || keys, { lastState, pendingState } = internalRef.current;
|
|
1946
1946
|
if (!curKeys.size) return lastState;
|
|
1947
1947
|
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
1948
1948
|
try {
|
|
1949
1949
|
for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
1950
1950
|
var key = _step.value;
|
|
1951
|
-
if (mediaState2[key] !== lastState[key]) return internalRef.current.lastState = mediaState2, mediaState2;
|
|
1951
|
+
if (mediaState2[key] !== (pendingState || lastState)[key]) return componentContext != null && componentContext.mediaEmit ? (componentContext.mediaEmit(mediaState2), internalRef.current.pendingState = mediaState2, lastState) : (internalRef.current.lastState = mediaState2, mediaState2);
|
|
1952
1952
|
}
|
|
1953
1953
|
} catch (err) {
|
|
1954
1954
|
_didIteratorError = !0, _iteratorError = err;
|
|
@@ -6063,6 +6063,8 @@ var require_useThemeState_native = __commonJS({
|
|
|
6063
6063
|
if (name && reset) throw new Error("Cannot reset and set a new name at the same time.");
|
|
6064
6064
|
var { themes: themes2 } = (0, import_config.getConfig)();
|
|
6065
6065
|
if (reset) {
|
|
6066
|
+
var isSchemeOnly = parentName === "light" || parentName === "dark";
|
|
6067
|
+
if (isSchemeOnly) return parentName === "light" ? "dark" : "light";
|
|
6066
6068
|
var lastPartIndex = parentName.lastIndexOf("_"), name1 = lastPartIndex <= 0 ? parentName : parentName.slice(lastPartIndex), scheme = parentName.slice(0, lastPartIndex), result = themes2[name1] ? name1 : scheme;
|
|
6067
6069
|
return result;
|
|
6068
6070
|
}
|
|
@@ -7118,7 +7120,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7118
7120
|
}
|
|
7119
7121
|
});
|
|
7120
7122
|
module2.exports = __toCommonJS2(createComponent_exports);
|
|
7121
|
-
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(), NextState = /* @__PURE__ */ new WeakMap(), componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
7123
|
+
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(), NextState = /* @__PURE__ */ new WeakMap(), NextMedia = /* @__PURE__ */ new WeakMap(), componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
7122
7124
|
"hover",
|
|
7123
7125
|
"press",
|
|
7124
7126
|
"pressIn",
|
|
@@ -7273,6 +7275,18 @@ var require_createComponent_native = __commonJS({
|
|
|
7273
7275
|
}
|
|
7274
7276
|
if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
|
|
7275
7277
|
var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
|
|
7278
|
+
componentContext.mediaEmit = function(next) {
|
|
7279
|
+
NextMedia.set(stateRef, next), updateStyleListener();
|
|
7280
|
+
};
|
|
7281
|
+
var updateStyleListener = function() {
|
|
7282
|
+
var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7283
|
+
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7284
|
+
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
|
|
7285
|
+
...styleProps,
|
|
7286
|
+
mediaState: mediaState22
|
|
7287
|
+
} : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7288
|
+
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7289
|
+
};
|
|
7276
7290
|
stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
7277
7291
|
var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
7278
7292
|
if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
|
|
@@ -7284,11 +7298,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7284
7298
|
...prev,
|
|
7285
7299
|
...next
|
|
7286
7300
|
};
|
|
7287
|
-
NextState.set(stateRef, updatedState);
|
|
7288
|
-
var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7289
|
-
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7290
|
-
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7291
|
-
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7301
|
+
NextState.set(stateRef, updatedState), updateStyleListener();
|
|
7292
7302
|
} else ogSetStateShallow(next);
|
|
7293
7303
|
}
|
|
7294
7304
|
}, setStateShallow = function(state2) {
|