@tamagui/core 1.130.1 → 1.130.3
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 +62 -49
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +59 -46
- package/dist/test.native.js.map +2 -2
- package/package.json +9 -9
package/dist/test.native.js
CHANGED
|
@@ -5908,7 +5908,9 @@ var require_useThemeState_native = __commonJS({
|
|
|
5908
5908
|
var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0, { debug } = props, parentState = states.get(parentId);
|
|
5909
5909
|
if (props.passThrough) return [
|
|
5910
5910
|
!1,
|
|
5911
|
-
lastState
|
|
5911
|
+
lastState || parentState || {
|
|
5912
|
+
name: ""
|
|
5913
|
+
}
|
|
5912
5914
|
];
|
|
5913
5915
|
themes || (themes = (0, import_config.getConfig)().themes);
|
|
5914
5916
|
var name = !propsKey && (!lastState || !(lastState != null && lastState.isNew)) ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate === "force" ? !0 : !!needsUpdate), isSameAsParent = parentState && (!name || name === parentState.name), shouldRerender = !!(needsUpdate && (pendingUpdate || (lastState == null ? void 0 : lastState.name) !== (parentState == null ? void 0 : parentState.name)));
|
|
@@ -6242,7 +6244,7 @@ var require_useTheme_native = __commonJS({
|
|
|
6242
6244
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, [theme] = useThemeWithState(props), res = theme;
|
|
6243
6245
|
return res;
|
|
6244
6246
|
}, useThemeWithState = function(props) {
|
|
6245
|
-
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, keys = (0, import_react3.useRef)(null), themeState = (0, import_useThemeState.useThemeState)(props, isRoot, keys), themeProxied = (0, import_getThemeProxied.getThemeProxied)(props, themeState, keys);
|
|
6247
|
+
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, keys = (0, import_react3.useRef)(null), themeState = (0, import_useThemeState.useThemeState)(props, isRoot, keys), themeProxied = props.passThrough ? {} : (0, import_getThemeProxied.getThemeProxied)(props, themeState, keys);
|
|
6246
6248
|
return [
|
|
6247
6249
|
themeProxied,
|
|
6248
6250
|
themeState
|
|
@@ -6404,7 +6406,7 @@ var require_Theme_native = __commonJS({
|
|
|
6404
6406
|
}
|
|
6405
6407
|
if (forceClassName === !1) return children;
|
|
6406
6408
|
if (import_constants.isWeb) {
|
|
6407
|
-
var { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot);
|
|
6409
|
+
var { className = "", style } = passThrough ? {} : getThemeClassNameAndStyle(themeState, props, isRoot);
|
|
6408
6410
|
if (children = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
|
|
6409
6411
|
className: `${className} _dsp_contents is_Theme`,
|
|
6410
6412
|
style: passThrough ? void 0 : style,
|
|
@@ -7202,7 +7204,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7202
7204
|
});
|
|
7203
7205
|
}
|
|
7204
7206
|
}
|
|
7205
|
-
if (splitStyles && (
|
|
7207
|
+
if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
|
|
7206
7208
|
var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
|
|
7207
7209
|
stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
7208
7210
|
var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
@@ -7217,9 +7219,9 @@ var require_createComponent_native = __commonJS({
|
|
|
7217
7219
|
};
|
|
7218
7220
|
NextState.set(stateRef, updatedState);
|
|
7219
7221
|
var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
|
|
7220
|
-
|
|
7222
|
+
groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
|
|
7221
7223
|
var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
7222
|
-
useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7224
|
+
useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
7223
7225
|
} else ogSetStateShallow(next);
|
|
7224
7226
|
}
|
|
7225
7227
|
}, setStateShallow = function(state2) {
|
|
@@ -11711,7 +11713,7 @@ var require_index_native12 = __commonJS({
|
|
|
11711
11713
|
}
|
|
11712
11714
|
});
|
|
11713
11715
|
module2.exports = __toCommonJS2(index_exports2);
|
|
11714
|
-
var import_constants = require_index_native2(), import_is_equal_shallow = require_index_native5(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), strategy = "async";
|
|
11716
|
+
var import_constants = require_index_native2(), import_is_equal_shallow = require_index_native5(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), IntersectionState = /* @__PURE__ */ new WeakMap(), globalIntersectionObserver = null, strategy = "async";
|
|
11715
11717
|
function setOnLayoutStrategy2(state) {
|
|
11716
11718
|
strategy = state;
|
|
11717
11719
|
}
|
|
@@ -11722,52 +11724,64 @@ var require_index_native12 = __commonJS({
|
|
|
11722
11724
|
}), queuedUpdates.clear()));
|
|
11723
11725
|
}
|
|
11724
11726
|
var expectedFrameTime = 16.67, numDroppedFramesUntilPause = 10;
|
|
11727
|
+
function startGlobalIntersectionObserver() {
|
|
11728
|
+
!import_constants.isClient || globalIntersectionObserver || (globalIntersectionObserver = new IntersectionObserver(function(entries) {
|
|
11729
|
+
entries.forEach(function(entry) {
|
|
11730
|
+
var node = entry.target;
|
|
11731
|
+
IntersectionState.get(node) !== entry.isIntersecting && IntersectionState.set(node, entry.isIntersecting);
|
|
11732
|
+
});
|
|
11733
|
+
}, {
|
|
11734
|
+
threshold: 0
|
|
11735
|
+
}));
|
|
11736
|
+
}
|
|
11725
11737
|
if (import_constants.isClient && rAF) {
|
|
11726
11738
|
layoutOnAnimationFrame = function() {
|
|
11727
11739
|
var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
|
|
11728
|
-
if (lastFrameAt = now, frameCount
|
|
11729
|
-
frameCount
|
|
11740
|
+
if (lastFrameAt = now, frameCount++, frameCount % RUN_EVERY_X_FRAMES === 0) {
|
|
11741
|
+
frameCount = 0, rAF(layoutOnAnimationFrame);
|
|
11730
11742
|
return;
|
|
11731
11743
|
}
|
|
11732
|
-
if (
|
|
11744
|
+
if (strategy !== "off") {
|
|
11733
11745
|
var hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
|
|
11734
11746
|
hasRecentSyncWork || Nodes.forEach(function(node) {
|
|
11735
11747
|
updateLayoutIfChanged(node, lastFrameAt);
|
|
11736
11748
|
});
|
|
11737
11749
|
}
|
|
11738
11750
|
rAF(layoutOnAnimationFrame);
|
|
11739
|
-
}, layoutOnAnimationFrame2 = layoutOnAnimationFrame, lastFrameAt = Date.now();
|
|
11751
|
+
}, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
|
|
11740
11752
|
async function updateLayoutIfChanged(node, frameId) {
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11753
|
+
if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
|
|
11754
|
+
var onLayout = LayoutHandlers.get(node);
|
|
11755
|
+
if (typeof onLayout == "function") {
|
|
11756
|
+
var parentNode = node.parentElement;
|
|
11757
|
+
if (parentNode) {
|
|
11758
|
+
var nodeRect, parentRect;
|
|
11759
|
+
if (strategy === "async") {
|
|
11760
|
+
var [nr, pr] = await Promise.all([
|
|
11761
|
+
getBoundingClientRectAsync(node),
|
|
11762
|
+
getBoundingClientRectAsync(parentNode)
|
|
11763
|
+
]);
|
|
11764
|
+
if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
|
|
11765
|
+
nodeRect = nr, parentRect = pr;
|
|
11766
|
+
} else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
|
|
11767
|
+
var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
|
|
11768
|
+
if (!cachedRect || // has changed one rect
|
|
11769
|
+
// @ts-expect-error DOMRectReadOnly can go into object
|
|
11770
|
+
!(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && // @ts-expect-error DOMRectReadOnly can go into object
|
|
11771
|
+
(!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
|
|
11772
|
+
NodeRectCache.set(node, nodeRect), ParentRectCache.set(parentNode, parentRect);
|
|
11773
|
+
var event = getElementLayoutEvent(nodeRect, parentRect);
|
|
11774
|
+
avoidUpdates ? queuedUpdates.set(node, function() {
|
|
11775
|
+
return onLayout(event);
|
|
11776
|
+
}) : onLayout(event);
|
|
11777
|
+
}
|
|
11764
11778
|
}
|
|
11765
11779
|
}
|
|
11766
11780
|
}
|
|
11767
11781
|
}
|
|
11768
|
-
rAF(layoutOnAnimationFrame), frameCount = 0,
|
|
11782
|
+
rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 4;
|
|
11769
11783
|
}
|
|
11770
|
-
var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, frameCount,
|
|
11784
|
+
var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, lastFrameAt, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
|
|
11771
11785
|
return {
|
|
11772
11786
|
nativeEvent: {
|
|
11773
11787
|
layout: getRelativeDimensions(nodeRect, parentRect),
|
|
@@ -11832,10 +11846,10 @@ var require_index_native12 = __commonJS({
|
|
|
11832
11846
|
if (onLayout) {
|
|
11833
11847
|
var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
|
|
11834
11848
|
if (node2) {
|
|
11835
|
-
LayoutHandlers.set(node2, onLayout), Nodes.add(node2);
|
|
11849
|
+
LayoutHandlers.set(node2, onLayout), Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
|
|
11836
11850
|
var parentNode = node2.parentNode;
|
|
11837
11851
|
return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
|
|
11838
|
-
Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2);
|
|
11852
|
+
Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2), IntersectionState.delete(node2), globalIntersectionObserver && globalIntersectionObserver.unobserve(node2);
|
|
11839
11853
|
};
|
|
11840
11854
|
}
|
|
11841
11855
|
}
|
|
@@ -11849,14 +11863,13 @@ var require_index_native12 = __commonJS({
|
|
|
11849
11863
|
}
|
|
11850
11864
|
var getBoundingClientRectAsync = function(node) {
|
|
11851
11865
|
return new Promise(function(res) {
|
|
11852
|
-
if (!
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
}
|
|
11866
|
+
if (!node || node.nodeType !== 1) return res(!1);
|
|
11867
|
+
var io = new IntersectionObserver(function(entries) {
|
|
11868
|
+
return io.disconnect(), res(entries[0].boundingClientRect);
|
|
11869
|
+
}, {
|
|
11870
|
+
threshold: 0
|
|
11871
|
+
});
|
|
11872
|
+
io.observe(node);
|
|
11860
11873
|
});
|
|
11861
11874
|
}, getBoundingClientRect = function(node) {
|
|
11862
11875
|
var _node_getBoundingClientRect;
|