@tamagui/core 1.130.8 → 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/cjs/index.cjs +5 -5
- package/dist/native.js +36 -23
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +36 -23
- 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;
|
|
@@ -2454,13 +2454,15 @@ var require_createStyledContext_native = __commonJS({
|
|
|
2454
2454
|
module2.exports = __toCommonJS2(createStyledContext_exports);
|
|
2455
2455
|
var import_jsx_runtime2 = require("react/jsx-runtime"), import_react3 = __toESM2(require("react")), import_objectIdentityKey = require_objectIdentityKey_native(), createReactContext = import_react3.default[Math.random(), "createContext"];
|
|
2456
2456
|
function createStyledContext(defaultValues) {
|
|
2457
|
-
var OGContext = createReactContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map();
|
|
2457
|
+
var namespace = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", OGContext = createReactContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), LastScopeInNamespace = createReactContext(namespace);
|
|
2458
2458
|
function getOrCreateScopedContext(scope) {
|
|
2459
2459
|
var ScopedContext = scopedContexts.get(scope);
|
|
2460
2460
|
return ScopedContext || (ScopedContext = createReactContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
2461
2461
|
}
|
|
2462
|
-
var
|
|
2463
|
-
|
|
2462
|
+
var getNamespacedScope = function(scope) {
|
|
2463
|
+
return namespace ? `${namespace}--${scope}` : scope;
|
|
2464
|
+
}, Provider = function(param) {
|
|
2465
|
+
var { children, scope: scopeIn, ...values } = param, scope = getNamespacedScope(scopeIn), next = import_react3.default.useMemo(function() {
|
|
2464
2466
|
return {
|
|
2465
2467
|
// this ! is a workaround for ts error
|
|
2466
2468
|
...defaultValues,
|
|
@@ -2469,13 +2471,16 @@ var require_createStyledContext_native = __commonJS({
|
|
|
2469
2471
|
}, [
|
|
2470
2472
|
(0, import_objectIdentityKey.objectIdentityKey)(values)
|
|
2471
2473
|
]), Provider22 = OGProvider;
|
|
2472
|
-
return scope && (Provider22 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2473
|
-
value:
|
|
2474
|
-
children
|
|
2474
|
+
return scope && (Provider22 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LastScopeInNamespace.Provider, {
|
|
2475
|
+
value: scope,
|
|
2476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Provider22, {
|
|
2477
|
+
value: next,
|
|
2478
|
+
children
|
|
2479
|
+
})
|
|
2475
2480
|
});
|
|
2476
|
-
}, useStyledContext = function(
|
|
2477
|
-
var context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
2478
|
-
return
|
|
2481
|
+
}, useStyledContext = function() {
|
|
2482
|
+
var scopeIn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", lastScopeInNamespace = (0, import_react3.useContext)(LastScopeInNamespace), scope = namespace ? scopeIn ? getNamespacedScope(scopeIn) : lastScopeInNamespace : scopeIn, context = scope ? getOrCreateScopedContext(scope) : OGContext, value = import_react3.default.useContext(context);
|
|
2483
|
+
return value;
|
|
2479
2484
|
};
|
|
2480
2485
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
2481
2486
|
}
|
|
@@ -7113,7 +7118,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7113
7118
|
}
|
|
7114
7119
|
});
|
|
7115
7120
|
module2.exports = __toCommonJS2(createComponent_exports);
|
|
7116
|
-
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([
|
|
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(), NextMedia = /* @__PURE__ */ new WeakMap(), componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
7117
7122
|
"hover",
|
|
7118
7123
|
"press",
|
|
7119
7124
|
"pressIn",
|
|
@@ -7268,6 +7273,18 @@ var require_createComponent_native = __commonJS({
|
|
|
7268
7273
|
}
|
|
7269
7274
|
if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
|
|
7270
7275
|
var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
|
|
7276
|
+
componentContext.mediaEmit = function(next) {
|
|
7277
|
+
NextMedia.set(stateRef, next), updateStyleListener();
|
|
7278
|
+
};
|
|
7279
|
+
var updateStyleListener = function() {
|
|
7280
|
+
var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7281
|
+
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7282
|
+
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
|
|
7283
|
+
...styleProps,
|
|
7284
|
+
mediaState: mediaState22
|
|
7285
|
+
} : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7286
|
+
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7287
|
+
};
|
|
7271
7288
|
stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
7272
7289
|
var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
7273
7290
|
if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
|
|
@@ -7279,11 +7296,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7279
7296
|
...prev,
|
|
7280
7297
|
...next
|
|
7281
7298
|
};
|
|
7282
|
-
NextState.set(stateRef, updatedState);
|
|
7283
|
-
var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7284
|
-
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7285
|
-
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7286
|
-
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7299
|
+
NextState.set(stateRef, updatedState), updateStyleListener();
|
|
7287
7300
|
} else ogSetStateShallow(next);
|
|
7288
7301
|
}
|
|
7289
7302
|
}, setStateShallow = function(state2) {
|