@tamagui/core 3.0.9 → 3.0.11
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.cjs +101 -20
- package/dist/test.native.cjs +95 -14
- package/package.json +13 -13
package/dist/native.cjs
CHANGED
|
@@ -7694,7 +7694,7 @@ function resolveStyles(...inputs) {
|
|
|
7694
7694
|
function joinClassNames(...parts) {
|
|
7695
7695
|
return parts.filter(Boolean).join(" ").trim() || void 0;
|
|
7696
7696
|
}
|
|
7697
|
-
var _excluded$22, _excluded2$
|
|
7697
|
+
var _excluded$22, _excluded2$5, View$1$1, commonStyle, styles$10, WebScrollView;
|
|
7698
7698
|
var init_WebScrollView = __esmMin((() => {
|
|
7699
7699
|
init_View();
|
|
7700
7700
|
init_objectSpread2();
|
|
@@ -7745,7 +7745,7 @@ var init_WebScrollView = __esmMin((() => {
|
|
|
7745
7745
|
"snapToStart",
|
|
7746
7746
|
"bounces"
|
|
7747
7747
|
];
|
|
7748
|
-
_excluded2$
|
|
7748
|
+
_excluded2$5 = ["dataSet"];
|
|
7749
7749
|
View$1$1 = View$2;
|
|
7750
7750
|
commonStyle = {
|
|
7751
7751
|
flexGrow: 1,
|
|
@@ -7783,7 +7783,7 @@ var init_WebScrollView = __esmMin((() => {
|
|
|
7783
7783
|
};
|
|
7784
7784
|
WebScrollView = react.forwardRef((props, forwardedRef) => {
|
|
7785
7785
|
const { children, contentContainerStyle, horizontal, onContentSizeChange, onScroll, refreshControl, stickyHeaderIndices, pagingEnabled, centerContent, scrollEnabled = true, scrollEventThrottle = 0, showsHorizontalScrollIndicator, showsVerticalScrollIndicator, style, keyboardShouldPersistTaps, keyboardDismissMode, contentOffset, contentInset, contentInsetAdjustmentBehavior, decelerationRate, directionalLockEnabled, disableIntervalMomentum, disableScrollViewPanResponder, endFillColor, fadingEdgeLength, indicatorStyle, invertStickyHeaders, maintainVisibleContentPosition, maximumZoomScale, minimumZoomScale, nestedScrollEnabled, onScrollToTop, overScrollMode, pinchGestureEnabled, removeClippedSubviews, scrollIndicatorInsets, scrollPerfTag, scrollToOverflowEnabled, snapToAlignment, snapToEnd, snapToInterval, snapToOffsets, snapToStart, bounces } = props, rest = _objectWithoutProperties(props, _excluded$22);
|
|
7786
|
-
const { dataSet } = rest, domRest = _objectWithoutProperties(rest, _excluded2$
|
|
7786
|
+
const { dataSet } = rest, domRest = _objectWithoutProperties(rest, _excluded2$5);
|
|
7787
7787
|
const dataAttrs = {};
|
|
7788
7788
|
if (dataSet) for (const key in dataSet) dataAttrs[`data-${key}`] = dataSet[key];
|
|
7789
7789
|
const scrollNodeRef = react.useRef(null);
|
|
@@ -14692,7 +14692,7 @@ var init_useTheme_native = __esmMin((() => {
|
|
|
14692
14692
|
}));
|
|
14693
14693
|
//#endregion
|
|
14694
14694
|
//#region ../web/dist/esm/_withStableStyle.native.js
|
|
14695
|
-
var _excluded$8, _excluded2$
|
|
14695
|
+
var _excluded$8, _excluded2$4, EMPTY_EXPRESSIONS, EMPTY_THEME, FALLBACK_THEME_CACHE, _withStableStyle;
|
|
14696
14696
|
var init__withStableStyle_native = __esmMin((() => {
|
|
14697
14697
|
init_config_native();
|
|
14698
14698
|
init_createVariable_native();
|
|
@@ -14702,14 +14702,14 @@ var init__withStableStyle_native = __esmMin((() => {
|
|
|
14702
14702
|
init_objectWithoutProperties();
|
|
14703
14703
|
init_objectSpread2();
|
|
14704
14704
|
_excluded$8 = ["ref"];
|
|
14705
|
-
_excluded2$
|
|
14705
|
+
_excluded2$4 = ["_expressions"];
|
|
14706
14706
|
EMPTY_EXPRESSIONS = [];
|
|
14707
14707
|
EMPTY_THEME = {};
|
|
14708
14708
|
FALLBACK_THEME_CACHE = /* @__PURE__ */ new WeakMap();
|
|
14709
14709
|
_withStableStyle = function _withStableStyle2(Component, createStyle, hasThemeKeys, hasMediaKeys) {
|
|
14710
14710
|
return /* @__PURE__ */ react.default.memo(function WithStableStyle(props) {
|
|
14711
14711
|
var { ref } = props, propsWithoutRef = _objectWithoutProperties(props, _excluded$8);
|
|
14712
|
-
var { _expressions = EMPTY_EXPRESSIONS } = propsWithoutRef, rest = _objectWithoutProperties(propsWithoutRef, _excluded2$
|
|
14712
|
+
var { _expressions = EMPTY_EXPRESSIONS } = propsWithoutRef, rest = _objectWithoutProperties(propsWithoutRef, _excluded2$4);
|
|
14713
14713
|
var parentId = (0, react.useContext)(ThemeStateContext);
|
|
14714
14714
|
var theme = hasThemeKeys && parentId ? useTheme() : null;
|
|
14715
14715
|
var media = hasMediaKeys ? useMedia() : null;
|
|
@@ -14846,6 +14846,7 @@ function setNativeStyleEngine(next) {
|
|
|
14846
14846
|
scopeMappings.clear();
|
|
14847
14847
|
pendingHosts = [];
|
|
14848
14848
|
pendingStates = [];
|
|
14849
|
+
resetNativeStyleDiscovery();
|
|
14849
14850
|
}
|
|
14850
14851
|
engine = next;
|
|
14851
14852
|
if (next) {
|
|
@@ -14919,16 +14920,80 @@ function createNativeStyleLinkState(mapping, scopeId, stateName, theme) {
|
|
|
14919
14920
|
theme
|
|
14920
14921
|
};
|
|
14921
14922
|
}
|
|
14923
|
+
function hostKey(host) {
|
|
14924
|
+
var _ref, _ref1;
|
|
14925
|
+
var _record___internalInstanceHandle;
|
|
14926
|
+
var record = host;
|
|
14927
|
+
var instance = (_ref = (_record___internalInstanceHandle = record.__internalInstanceHandle) === null || _record___internalInstanceHandle === void 0 ? void 0 : _record___internalInstanceHandle.stateNode) !== null && _ref !== void 0 ? _ref : record.stateNode;
|
|
14928
|
+
return (_ref1 = instance === null || instance === void 0 ? void 0 : instance.canonical) !== null && _ref1 !== void 0 ? _ref1 : host;
|
|
14929
|
+
}
|
|
14930
|
+
function resetNativeStyleDiscovery() {
|
|
14931
|
+
fiberRoot = null;
|
|
14932
|
+
needsDiscover = false;
|
|
14933
|
+
linkedHostState = /* @__PURE__ */ new WeakMap();
|
|
14934
|
+
}
|
|
14935
|
+
function registerNativeStyle(style, state) {
|
|
14936
|
+
stylesToState.set(style, state);
|
|
14937
|
+
}
|
|
14938
|
+
function nativeStyleMountMode() {
|
|
14939
|
+
var current = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
|
|
14940
|
+
if (current && current.stateNode === fiberRoot) {
|
|
14941
|
+
if (!needsDiscover) {
|
|
14942
|
+
needsDiscover = true;
|
|
14943
|
+
queueIdleFlush();
|
|
14944
|
+
}
|
|
14945
|
+
return "discover";
|
|
14946
|
+
}
|
|
14947
|
+
return "ref";
|
|
14948
|
+
}
|
|
14949
|
+
function captureNativeStyleRoot(node) {
|
|
14950
|
+
var fiber = node === null || node === void 0 ? void 0 : node.__internalInstanceHandle;
|
|
14951
|
+
if (!fiber) return;
|
|
14952
|
+
var top = fiber;
|
|
14953
|
+
for (var guard = 0; top.return && guard < 1e5; guard++) top = top.return;
|
|
14954
|
+
var root = top.stateNode;
|
|
14955
|
+
if (root && root.current === top) fiberRoot = root;
|
|
14956
|
+
}
|
|
14957
|
+
function discoverMountedHosts() {
|
|
14958
|
+
var root = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
|
|
14959
|
+
if (!root || root.stateNode !== fiberRoot) return 0;
|
|
14960
|
+
var stack = [root];
|
|
14961
|
+
var found = 0;
|
|
14962
|
+
for (var guard = 0; stack.length && guard < 1e5; guard++) {
|
|
14963
|
+
var _fiber_memoizedProps, _fiber_stateNode;
|
|
14964
|
+
var fiber = stack.pop();
|
|
14965
|
+
if (fiber.sibling) stack.push(fiber.sibling);
|
|
14966
|
+
if (fiber.child) stack.push(fiber.child);
|
|
14967
|
+
var style = (_fiber_memoizedProps = fiber.memoizedProps) === null || _fiber_memoizedProps === void 0 ? void 0 : _fiber_memoizedProps.style;
|
|
14968
|
+
if (!style) continue;
|
|
14969
|
+
var state = stylesToState.get(style);
|
|
14970
|
+
if (!state || !((_fiber_stateNode = fiber.stateNode) === null || _fiber_stateNode === void 0 ? void 0 : _fiber_stateNode.node)) continue;
|
|
14971
|
+
found++;
|
|
14972
|
+
linkNativeStyleHost(fiber, state);
|
|
14973
|
+
}
|
|
14974
|
+
return found;
|
|
14975
|
+
}
|
|
14922
14976
|
function idleFlush() {
|
|
14923
14977
|
idleFlushQueued = false;
|
|
14924
14978
|
flushNativeStyleLinks();
|
|
14925
14979
|
}
|
|
14980
|
+
function queueIdleFlush() {
|
|
14981
|
+
if (idleFlushQueued) return;
|
|
14982
|
+
idleFlushQueued = true;
|
|
14983
|
+
requestIdleCallback(idleFlush);
|
|
14984
|
+
}
|
|
14926
14985
|
function addScopeMapping(scopeId, compiled) {
|
|
14927
14986
|
var linked = scopeMappings.get(scopeId);
|
|
14928
14987
|
if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());
|
|
14929
14988
|
linked.add(compiled);
|
|
14930
14989
|
}
|
|
14931
14990
|
function flushNativeStyleLinks() {
|
|
14991
|
+
if (needsDiscover) {
|
|
14992
|
+
needsDiscover = false;
|
|
14993
|
+
var current = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
|
|
14994
|
+
if (!current || current.stateNode !== fiberRoot) fiberRoot = null;
|
|
14995
|
+
else discoverMountedHosts();
|
|
14996
|
+
}
|
|
14932
14997
|
if (!pendingHosts.length) return;
|
|
14933
14998
|
var hosts = pendingHosts;
|
|
14934
14999
|
var states = pendingStates;
|
|
@@ -14958,7 +15023,11 @@ function flushNativeStyleLinks() {
|
|
|
14958
15023
|
engine.linkTables(hosts, tableIds, scopeIndexes, scopes);
|
|
14959
15024
|
}
|
|
14960
15025
|
function linkNativeStyleHost(host, state) {
|
|
14961
|
-
if (!engine) return;
|
|
15026
|
+
if (!engine || host == null) return;
|
|
15027
|
+
var key = hostKey(host);
|
|
15028
|
+
var linked = linkedHostState.get(key);
|
|
15029
|
+
if (linked && linked.mapping === state.mapping && linked.scopeId === state.scopeId) return;
|
|
15030
|
+
linkedHostState.set(key, state);
|
|
14962
15031
|
var live = scopeStates.get(state.scopeId);
|
|
14963
15032
|
if (live && (live.name !== state.stateName || live.theme !== state.theme)) {
|
|
14964
15033
|
var compiled = getCompiledMapping(state.mapping);
|
|
@@ -14969,10 +15038,7 @@ function linkNativeStyleHost(host, state) {
|
|
|
14969
15038
|
}
|
|
14970
15039
|
pendingHosts.push(host);
|
|
14971
15040
|
pendingStates.push(state);
|
|
14972
|
-
if (pendingHosts.length >= maxPendingHosts
|
|
14973
|
-
idleFlushQueued = true;
|
|
14974
|
-
requestIdleCallback(idleFlush);
|
|
14975
|
-
}
|
|
15041
|
+
if (pendingHosts.length >= maxPendingHosts) queueIdleFlush();
|
|
14976
15042
|
}
|
|
14977
15043
|
function setNativeStyleEngineFlushListener(cb) {
|
|
14978
15044
|
flushListener = cb;
|
|
@@ -15009,7 +15075,7 @@ function supersedeNativeViewStates(id) {
|
|
|
15009
15075
|
if (!pending) return;
|
|
15010
15076
|
(superseded || (superseded = /* @__PURE__ */ new Map())).set(id, pending.length);
|
|
15011
15077
|
}
|
|
15012
|
-
var nativeTextInputColorProps, nativeOutlineProps, nativeIntrinsicSizeProps, engine, scopeStates, mappingKeys, compiledMappings, scopeMappings, nextTableId, pendingHosts, pendingStates, maxPendingHosts, idleFlushQueued, pending, flushListener, superseded;
|
|
15078
|
+
var nativeTextInputColorProps, nativeOutlineProps, nativeIntrinsicSizeProps, engine, scopeStates, mappingKeys, compiledMappings, scopeMappings, nextTableId, pendingHosts, pendingStates, maxPendingHosts, idleFlushQueued, stylesToState, linkedHostState, fiberRoot, needsDiscover, pending, flushListener, superseded;
|
|
15013
15079
|
var init_nativeStyleEngine_native = __esmMin((() => {
|
|
15014
15080
|
init_createVariable_native();
|
|
15015
15081
|
init_objectSpread2();
|
|
@@ -15043,6 +15109,10 @@ var init_nativeStyleEngine_native = __esmMin((() => {
|
|
|
15043
15109
|
pendingStates = [];
|
|
15044
15110
|
maxPendingHosts = 4096;
|
|
15045
15111
|
idleFlushQueued = false;
|
|
15112
|
+
stylesToState = /* @__PURE__ */ new WeakMap();
|
|
15113
|
+
linkedHostState = /* @__PURE__ */ new WeakMap();
|
|
15114
|
+
fiberRoot = null;
|
|
15115
|
+
needsDiscover = false;
|
|
15046
15116
|
pending = null;
|
|
15047
15117
|
flushListener = null;
|
|
15048
15118
|
superseded = null;
|
|
@@ -15058,6 +15128,11 @@ var init_setupHooks_native = __esmMin((() => {
|
|
|
15058
15128
|
}));
|
|
15059
15129
|
//#endregion
|
|
15060
15130
|
//#region ../web/dist/esm/_withNativeStyle.native.js
|
|
15131
|
+
function omitRef(props) {
|
|
15132
|
+
if (!Object.prototype.hasOwnProperty.call(props, "ref")) return props;
|
|
15133
|
+
var { ref: _ref } = props;
|
|
15134
|
+
return _objectWithoutProperties(props, _excluded2$3);
|
|
15135
|
+
}
|
|
15061
15136
|
function mayRenderText(children) {
|
|
15062
15137
|
if (children == null) return false;
|
|
15063
15138
|
if (Array.isArray(children) && children.length <= 3) return children.some(function(child) {
|
|
@@ -15065,7 +15140,7 @@ function mayRenderText(children) {
|
|
|
15065
15140
|
});
|
|
15066
15141
|
return typeof children === "object";
|
|
15067
15142
|
}
|
|
15068
|
-
var _excluded$7, hostTextProps, _withNativeStyle;
|
|
15143
|
+
var _excluded$7, _excluded2$3, hostTextProps, _withNativeStyle;
|
|
15069
15144
|
var init__withNativeStyle_native = __esmMin((() => {
|
|
15070
15145
|
init_index_native$12();
|
|
15071
15146
|
init_index_native$6();
|
|
@@ -15076,6 +15151,7 @@ var init__withNativeStyle_native = __esmMin((() => {
|
|
|
15076
15151
|
init_objectSpread2();
|
|
15077
15152
|
init_objectWithoutProperties();
|
|
15078
15153
|
_excluded$7 = ["_expressions"];
|
|
15154
|
+
_excluded2$3 = ["ref"];
|
|
15079
15155
|
hostTextProps = {
|
|
15080
15156
|
accessible: isAndroid ? false : isIos ? true : void 0,
|
|
15081
15157
|
allowFontScaling: true,
|
|
@@ -15105,7 +15181,9 @@ var init__withNativeStyle_native = __esmMin((() => {
|
|
|
15105
15181
|
theme: null,
|
|
15106
15182
|
state: null,
|
|
15107
15183
|
ref: function ref(node) {
|
|
15108
|
-
if (node)
|
|
15184
|
+
if (!node) return;
|
|
15185
|
+
captureRoot(node);
|
|
15186
|
+
linkHost(node, entry.state);
|
|
15109
15187
|
}
|
|
15110
15188
|
};
|
|
15111
15189
|
return entry;
|
|
@@ -15116,6 +15194,9 @@ var init__withNativeStyle_native = __esmMin((() => {
|
|
|
15116
15194
|
var resolve = resolveNativeStyleMapping;
|
|
15117
15195
|
var linkState = createNativeStyleLinkState;
|
|
15118
15196
|
var linkHost = linkNativeStyleHost;
|
|
15197
|
+
var registerStyle = registerNativeStyle;
|
|
15198
|
+
var mountMode = nativeStyleMountMode;
|
|
15199
|
+
var captureRoot = captureNativeStyleRoot;
|
|
15119
15200
|
var assignRef = setRef;
|
|
15120
15201
|
var render = function render2(props, key) {
|
|
15121
15202
|
var scopeId = (0, react.use)(ScopeContext);
|
|
@@ -15147,20 +15228,20 @@ var init__withNativeStyle_native = __esmMin((() => {
|
|
|
15147
15228
|
entry.stateName = name;
|
|
15148
15229
|
entry.theme = theme;
|
|
15149
15230
|
entry.state = linkState(themeStyleKeys, scopeId, name, theme);
|
|
15231
|
+
registerStyle(entry.style, entry.state);
|
|
15232
|
+
registerStyle(entry.hostTextStyle, entry.state);
|
|
15150
15233
|
}
|
|
15151
15234
|
var style = asHostText ? entry.hostTextStyle : entry.style;
|
|
15152
15235
|
var wrapped = resetsText || asHostText && mayRenderText(rest.children);
|
|
15153
15236
|
var state = entry.state;
|
|
15154
|
-
var
|
|
15237
|
+
var passedRef = mountMode() === "discover" ? ref !== null && ref !== void 0 ? ref : null : ref == null ? entry.ref : function(node) {
|
|
15155
15238
|
if (!node) return assignRef(ref, null);
|
|
15239
|
+
captureRoot(node);
|
|
15156
15240
|
linkHost(node, state);
|
|
15157
15241
|
if (typeof ref === "function") return ref(node);
|
|
15158
15242
|
assignRef(ref, node);
|
|
15159
15243
|
};
|
|
15160
|
-
var element = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rendered, _objectSpread2(_objectSpread2(_objectSpread2({}, asHostText && hostTextProps), rest), {}, {
|
|
15161
|
-
ref: hostRef,
|
|
15162
|
-
style
|
|
15163
|
-
}), wrapped ? void 0 : key);
|
|
15244
|
+
var element = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rendered, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, asHostText && hostTextProps), passedRef == null ? omitRef(rest) : rest), passedRef != null ? { ref: passedRef } : null), {}, { style }), wrapped ? void 0 : key);
|
|
15164
15245
|
if (!wrapped) return element;
|
|
15165
15246
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAncestorProvider, {
|
|
15166
15247
|
value: !resetsText,
|
|
@@ -19681,8 +19762,8 @@ function createComponent(staticConfig) {
|
|
|
19681
19762
|
var childrenFromHooks = hooks.useChildren ? hooks.useChildren(elementType, children, viewProps, isPassthrough) : void 0;
|
|
19682
19763
|
if (isPassthrough) content = /* @__PURE__ */ react.default.createElement(BaseComponent, { style: { display: "contents" } }, propsIn.children);
|
|
19683
19764
|
else {
|
|
19684
|
-
if (childrenFromHooks) content = childrenFromHooks;
|
|
19685
19765
|
var isRenderPropString = typeof renderProp === "string";
|
|
19766
|
+
if (childrenFromHooks && (!renderProp || isRenderPropString)) content = childrenFromHooks;
|
|
19686
19767
|
if (renderProp && !isRenderPropString) {
|
|
19687
19768
|
var out = getCustomRender(renderProp, content || children, viewProps, componentState);
|
|
19688
19769
|
if (out) {
|
package/dist/test.native.cjs
CHANGED
|
@@ -3727,14 +3727,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3727
3727
|
//#endregion
|
|
3728
3728
|
//#region ../web/dist/esm/_withStableStyle.native.js
|
|
3729
3729
|
var _excluded$8 = ["ref"];
|
|
3730
|
-
var _excluded2$
|
|
3730
|
+
var _excluded2$4 = ["_expressions"];
|
|
3731
3731
|
var EMPTY_EXPRESSIONS = [];
|
|
3732
3732
|
var EMPTY_THEME = {};
|
|
3733
3733
|
var FALLBACK_THEME_CACHE = /* @__PURE__ */ new WeakMap();
|
|
3734
3734
|
var _withStableStyle = function _withStableStyle2(Component, createStyle, hasThemeKeys, hasMediaKeys) {
|
|
3735
3735
|
return /* @__PURE__ */ react.default.memo(function WithStableStyle(props) {
|
|
3736
3736
|
var { ref } = props, propsWithoutRef = _objectWithoutProperties(props, _excluded$8);
|
|
3737
|
-
var { _expressions = EMPTY_EXPRESSIONS } = propsWithoutRef, rest = _objectWithoutProperties(propsWithoutRef, _excluded2$
|
|
3737
|
+
var { _expressions = EMPTY_EXPRESSIONS } = propsWithoutRef, rest = _objectWithoutProperties(propsWithoutRef, _excluded2$4);
|
|
3738
3738
|
var parentId = (0, react.useContext)(ThemeStateContext);
|
|
3739
3739
|
var theme = hasThemeKeys && parentId ? useTheme() : null;
|
|
3740
3740
|
var media = hasMediaKeys ? useMedia() : null;
|
|
@@ -3897,6 +3897,7 @@ function setNativeStyleEngine(next) {
|
|
|
3897
3897
|
scopeMappings.clear();
|
|
3898
3898
|
pendingHosts = [];
|
|
3899
3899
|
pendingStates = [];
|
|
3900
|
+
resetNativeStyleDiscovery();
|
|
3900
3901
|
}
|
|
3901
3902
|
engine = next;
|
|
3902
3903
|
if (next) {
|
|
@@ -3974,16 +3975,84 @@ var pendingHosts = [];
|
|
|
3974
3975
|
var pendingStates = [];
|
|
3975
3976
|
var maxPendingHosts = 4096;
|
|
3976
3977
|
var idleFlushQueued = false;
|
|
3978
|
+
var stylesToState = /* @__PURE__ */ new WeakMap();
|
|
3979
|
+
var linkedHostState = /* @__PURE__ */ new WeakMap();
|
|
3980
|
+
function hostKey(host) {
|
|
3981
|
+
var _ref, _ref1;
|
|
3982
|
+
var _record___internalInstanceHandle;
|
|
3983
|
+
var record = host;
|
|
3984
|
+
var instance = (_ref = (_record___internalInstanceHandle = record.__internalInstanceHandle) === null || _record___internalInstanceHandle === void 0 ? void 0 : _record___internalInstanceHandle.stateNode) !== null && _ref !== void 0 ? _ref : record.stateNode;
|
|
3985
|
+
return (_ref1 = instance === null || instance === void 0 ? void 0 : instance.canonical) !== null && _ref1 !== void 0 ? _ref1 : host;
|
|
3986
|
+
}
|
|
3987
|
+
var fiberRoot = null;
|
|
3988
|
+
var needsDiscover = false;
|
|
3989
|
+
function resetNativeStyleDiscovery() {
|
|
3990
|
+
fiberRoot = null;
|
|
3991
|
+
needsDiscover = false;
|
|
3992
|
+
linkedHostState = /* @__PURE__ */ new WeakMap();
|
|
3993
|
+
}
|
|
3994
|
+
function registerNativeStyle(style, state) {
|
|
3995
|
+
stylesToState.set(style, state);
|
|
3996
|
+
}
|
|
3997
|
+
function nativeStyleMountMode() {
|
|
3998
|
+
var current = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
|
|
3999
|
+
if (current && current.stateNode === fiberRoot) {
|
|
4000
|
+
if (!needsDiscover) {
|
|
4001
|
+
needsDiscover = true;
|
|
4002
|
+
queueIdleFlush();
|
|
4003
|
+
}
|
|
4004
|
+
return "discover";
|
|
4005
|
+
}
|
|
4006
|
+
return "ref";
|
|
4007
|
+
}
|
|
4008
|
+
function captureNativeStyleRoot(node) {
|
|
4009
|
+
var fiber = node === null || node === void 0 ? void 0 : node.__internalInstanceHandle;
|
|
4010
|
+
if (!fiber) return;
|
|
4011
|
+
var top = fiber;
|
|
4012
|
+
for (var guard = 0; top.return && guard < 1e5; guard++) top = top.return;
|
|
4013
|
+
var root = top.stateNode;
|
|
4014
|
+
if (root && root.current === top) fiberRoot = root;
|
|
4015
|
+
}
|
|
4016
|
+
function discoverMountedHosts() {
|
|
4017
|
+
var root = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
|
|
4018
|
+
if (!root || root.stateNode !== fiberRoot) return 0;
|
|
4019
|
+
var stack = [root];
|
|
4020
|
+
var found = 0;
|
|
4021
|
+
for (var guard = 0; stack.length && guard < 1e5; guard++) {
|
|
4022
|
+
var _fiber_memoizedProps, _fiber_stateNode;
|
|
4023
|
+
var fiber = stack.pop();
|
|
4024
|
+
if (fiber.sibling) stack.push(fiber.sibling);
|
|
4025
|
+
if (fiber.child) stack.push(fiber.child);
|
|
4026
|
+
var style = (_fiber_memoizedProps = fiber.memoizedProps) === null || _fiber_memoizedProps === void 0 ? void 0 : _fiber_memoizedProps.style;
|
|
4027
|
+
if (!style) continue;
|
|
4028
|
+
var state = stylesToState.get(style);
|
|
4029
|
+
if (!state || !((_fiber_stateNode = fiber.stateNode) === null || _fiber_stateNode === void 0 ? void 0 : _fiber_stateNode.node)) continue;
|
|
4030
|
+
found++;
|
|
4031
|
+
linkNativeStyleHost(fiber, state);
|
|
4032
|
+
}
|
|
4033
|
+
return found;
|
|
4034
|
+
}
|
|
3977
4035
|
function idleFlush() {
|
|
3978
4036
|
idleFlushQueued = false;
|
|
3979
4037
|
flushNativeStyleLinks();
|
|
3980
4038
|
}
|
|
4039
|
+
function queueIdleFlush() {
|
|
4040
|
+
if (idleFlushQueued) return;
|
|
4041
|
+
idleFlushQueued = true;
|
|
4042
|
+
requestIdleCallback(idleFlush);
|
|
4043
|
+
}
|
|
3981
4044
|
function addScopeMapping(scopeId, compiled) {
|
|
3982
4045
|
var linked = scopeMappings.get(scopeId);
|
|
3983
4046
|
if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());
|
|
3984
4047
|
linked.add(compiled);
|
|
3985
4048
|
}
|
|
3986
4049
|
function flushNativeStyleLinks() {
|
|
4050
|
+
if (needsDiscover) {
|
|
4051
|
+
needsDiscover = false;
|
|
4052
|
+
var current = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
|
|
4053
|
+
if (!current || current.stateNode !== fiberRoot) fiberRoot = null;
|
|
4054
|
+
else discoverMountedHosts();
|
|
4055
|
+
}
|
|
3987
4056
|
if (!pendingHosts.length) return;
|
|
3988
4057
|
var hosts = pendingHosts;
|
|
3989
4058
|
var states = pendingStates;
|
|
@@ -4013,7 +4082,11 @@ function flushNativeStyleLinks() {
|
|
|
4013
4082
|
engine.linkTables(hosts, tableIds, scopeIndexes, scopes);
|
|
4014
4083
|
}
|
|
4015
4084
|
function linkNativeStyleHost(host, state) {
|
|
4016
|
-
if (!engine) return;
|
|
4085
|
+
if (!engine || host == null) return;
|
|
4086
|
+
var key = hostKey(host);
|
|
4087
|
+
var linked = linkedHostState.get(key);
|
|
4088
|
+
if (linked && linked.mapping === state.mapping && linked.scopeId === state.scopeId) return;
|
|
4089
|
+
linkedHostState.set(key, state);
|
|
4017
4090
|
var live = scopeStates.get(state.scopeId);
|
|
4018
4091
|
if (live && (live.name !== state.stateName || live.theme !== state.theme)) {
|
|
4019
4092
|
var compiled = getCompiledMapping(state.mapping);
|
|
@@ -4024,10 +4097,7 @@ function linkNativeStyleHost(host, state) {
|
|
|
4024
4097
|
}
|
|
4025
4098
|
pendingHosts.push(host);
|
|
4026
4099
|
pendingStates.push(state);
|
|
4027
|
-
if (pendingHosts.length >= maxPendingHosts
|
|
4028
|
-
idleFlushQueued = true;
|
|
4029
|
-
requestIdleCallback(idleFlush);
|
|
4030
|
-
}
|
|
4100
|
+
if (pendingHosts.length >= maxPendingHosts) queueIdleFlush();
|
|
4031
4101
|
}
|
|
4032
4102
|
var pending = null;
|
|
4033
4103
|
var flushListener = null;
|
|
@@ -4076,6 +4146,7 @@ function setupHooks(next) {
|
|
|
4076
4146
|
//#endregion
|
|
4077
4147
|
//#region ../web/dist/esm/_withNativeStyle.native.js
|
|
4078
4148
|
var _excluded$7 = ["_expressions"];
|
|
4149
|
+
var _excluded2$3 = ["ref"];
|
|
4079
4150
|
var hostTextProps = {
|
|
4080
4151
|
accessible: isAndroid ? false : isIos ? true : void 0,
|
|
4081
4152
|
allowFontScaling: true,
|
|
@@ -4105,7 +4176,9 @@ var _withNativeStyle = function _withNativeStyle2(Component, baseStyle, themeSty
|
|
|
4105
4176
|
theme: null,
|
|
4106
4177
|
state: null,
|
|
4107
4178
|
ref: function ref(node) {
|
|
4108
|
-
if (node)
|
|
4179
|
+
if (!node) return;
|
|
4180
|
+
captureRoot(node);
|
|
4181
|
+
linkHost(node, entry.state);
|
|
4109
4182
|
}
|
|
4110
4183
|
};
|
|
4111
4184
|
return entry;
|
|
@@ -4116,6 +4189,9 @@ var _withNativeStyle = function _withNativeStyle2(Component, baseStyle, themeSty
|
|
|
4116
4189
|
var resolve = resolveNativeStyleMapping;
|
|
4117
4190
|
var linkState = createNativeStyleLinkState;
|
|
4118
4191
|
var linkHost = linkNativeStyleHost;
|
|
4192
|
+
var registerStyle = registerNativeStyle;
|
|
4193
|
+
var mountMode = nativeStyleMountMode;
|
|
4194
|
+
var captureRoot = captureNativeStyleRoot;
|
|
4119
4195
|
var assignRef = setRef;
|
|
4120
4196
|
var render = function render2(props, key) {
|
|
4121
4197
|
var scopeId = (0, react.use)(ScopeContext);
|
|
@@ -4147,20 +4223,20 @@ var _withNativeStyle = function _withNativeStyle2(Component, baseStyle, themeSty
|
|
|
4147
4223
|
entry.stateName = name;
|
|
4148
4224
|
entry.theme = theme;
|
|
4149
4225
|
entry.state = linkState(themeStyleKeys, scopeId, name, theme);
|
|
4226
|
+
registerStyle(entry.style, entry.state);
|
|
4227
|
+
registerStyle(entry.hostTextStyle, entry.state);
|
|
4150
4228
|
}
|
|
4151
4229
|
var style = asHostText ? entry.hostTextStyle : entry.style;
|
|
4152
4230
|
var wrapped = resetsText || asHostText && mayRenderText(rest.children);
|
|
4153
4231
|
var state = entry.state;
|
|
4154
|
-
var
|
|
4232
|
+
var passedRef = mountMode() === "discover" ? ref !== null && ref !== void 0 ? ref : null : ref == null ? entry.ref : function(node) {
|
|
4155
4233
|
if (!node) return assignRef(ref, null);
|
|
4234
|
+
captureRoot(node);
|
|
4156
4235
|
linkHost(node, state);
|
|
4157
4236
|
if (typeof ref === "function") return ref(node);
|
|
4158
4237
|
assignRef(ref, node);
|
|
4159
4238
|
};
|
|
4160
|
-
var element = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rendered, _objectSpread2(_objectSpread2(_objectSpread2({}, asHostText && hostTextProps), rest), {}, {
|
|
4161
|
-
ref: hostRef,
|
|
4162
|
-
style
|
|
4163
|
-
}), wrapped ? void 0 : key);
|
|
4239
|
+
var element = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rendered, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, asHostText && hostTextProps), passedRef == null ? omitRef(rest) : rest), passedRef != null ? { ref: passedRef } : null), {}, { style }), wrapped ? void 0 : key);
|
|
4164
4240
|
if (!wrapped) return element;
|
|
4165
4241
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAncestorProvider, {
|
|
4166
4242
|
value: !resetsText,
|
|
@@ -4175,6 +4251,11 @@ var _withNativeStyle = function _withNativeStyle2(Component, baseStyle, themeSty
|
|
|
4175
4251
|
};
|
|
4176
4252
|
return NativeStyleView;
|
|
4177
4253
|
};
|
|
4254
|
+
function omitRef(props) {
|
|
4255
|
+
if (!Object.prototype.hasOwnProperty.call(props, "ref")) return props;
|
|
4256
|
+
var { ref: _ref } = props;
|
|
4257
|
+
return _objectWithoutProperties(props, _excluded2$3);
|
|
4258
|
+
}
|
|
4178
4259
|
function mayRenderText(children) {
|
|
4179
4260
|
if (children == null) return false;
|
|
4180
4261
|
if (Array.isArray(children) && children.length <= 3) return children.some(function(child) {
|
|
@@ -9336,8 +9417,8 @@ ${banner}
|
|
|
9336
9417
|
var childrenFromHooks = hooks.useChildren ? hooks.useChildren(elementType, children, viewProps, isPassthrough) : void 0;
|
|
9337
9418
|
if (isPassthrough) content = /* @__PURE__ */ react.default.createElement(BaseComponent, { style: { display: "contents" } }, propsIn.children);
|
|
9338
9419
|
else {
|
|
9339
|
-
if (childrenFromHooks) content = childrenFromHooks;
|
|
9340
9420
|
var isRenderPropString = typeof renderProp === "string";
|
|
9421
|
+
if (childrenFromHooks && (!renderProp || isRenderPropString)) content = childrenFromHooks;
|
|
9341
9422
|
if (renderProp && !isRenderPropString) {
|
|
9342
9423
|
var out = getCustomRender(renderProp, content || children, viewProps, componentState);
|
|
9343
9424
|
if (out) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -137,19 +137,19 @@
|
|
|
137
137
|
"clean:build": "tamagui-build clean:build"
|
|
138
138
|
},
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@tamagui/compose-refs": "3.0.
|
|
141
|
-
"@tamagui/constants": "3.0.
|
|
142
|
-
"@tamagui/helpers": "3.0.
|
|
143
|
-
"@tamagui/react-native-media-driver": "3.0.
|
|
144
|
-
"@tamagui/react-native-use-pressable": "3.0.
|
|
145
|
-
"@tamagui/use-element-layout": "3.0.
|
|
146
|
-
"@tamagui/use-event": "3.0.
|
|
147
|
-
"@tamagui/web": "3.0.
|
|
140
|
+
"@tamagui/compose-refs": "3.0.11",
|
|
141
|
+
"@tamagui/constants": "3.0.11",
|
|
142
|
+
"@tamagui/helpers": "3.0.11",
|
|
143
|
+
"@tamagui/react-native-media-driver": "3.0.11",
|
|
144
|
+
"@tamagui/react-native-use-pressable": "3.0.11",
|
|
145
|
+
"@tamagui/use-element-layout": "3.0.11",
|
|
146
|
+
"@tamagui/use-event": "3.0.11",
|
|
147
|
+
"@tamagui/web": "3.0.11"
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
|
-
"@tamagui/build": "3.0.
|
|
151
|
-
"@tamagui/native-bundle": "3.0.
|
|
152
|
-
"@tamagui/react-native-web-lite": "3.0.
|
|
150
|
+
"@tamagui/build": "3.0.11",
|
|
151
|
+
"@tamagui/native-bundle": "3.0.11",
|
|
152
|
+
"@tamagui/react-native-web-lite": "3.0.11",
|
|
153
153
|
"@testing-library/react": "^16.1.0",
|
|
154
154
|
"csstype": "^3.0.10",
|
|
155
155
|
"react": "19.2.3",
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"./dist/cjs": "./dist/esm/index.native.js",
|
|
165
165
|
"./theme-update": "./dist/esm/theme-update.native.js"
|
|
166
166
|
},
|
|
167
|
-
"releaseSourceCommit": "
|
|
167
|
+
"releaseSourceCommit": "2126db6e1f5389c724e21f06ce7d7e7d9f49f4aa"
|
|
168
168
|
}
|