tamagui 1.118.4 → 1.119.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/native.js CHANGED
@@ -15596,10 +15596,80 @@ var require_constants_native3 = __commonJS({
15596
15596
  },
15597
15597
  USE_NATIVE_PORTAL: function() {
15598
15598
  return USE_NATIVE_PORTAL;
15599
+ },
15600
+ allPortalHosts: function() {
15601
+ return allPortalHosts;
15602
+ },
15603
+ portalListeners: function() {
15604
+ return portalListeners;
15599
15605
  }
15600
15606
  });
15601
15607
  module2.exports = __toCommonJS2(constants_exports);
15602
- var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = !import_constants4.isAndroid && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" && !IS_FABRIC;
15608
+ var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = !import_constants4.isAndroid && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" && !IS_FABRIC, allPortalHosts = /* @__PURE__ */ new Map(), portalListeners = {};
15609
+ }
15610
+ });
15611
+
15612
+ // ../portal/dist/cjs/useStackedZIndex.native.js
15613
+ var require_useStackedZIndex_native = __commonJS({
15614
+ "../portal/dist/cjs/useStackedZIndex.native.js"(exports2, module2) {
15615
+ "use strict";
15616
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
15617
+ for (var name in all) __defProp2(target, name, {
15618
+ get: all[name],
15619
+ enumerable: !0
15620
+ });
15621
+ }, __copyProps2 = function(to, from, except, desc) {
15622
+ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
15623
+ if (from && typeof from == "object" || typeof from == "function") try {
15624
+ for (var _loop = function() {
15625
+ var key = _step.value;
15626
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, {
15627
+ get: function() {
15628
+ return from[key];
15629
+ },
15630
+ enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
15631
+ });
15632
+ }, _iterator = __getOwnPropNames2(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) _loop();
15633
+ } catch (err) {
15634
+ _didIteratorError = !0, _iteratorError = err;
15635
+ } finally {
15636
+ try {
15637
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
15638
+ } finally {
15639
+ if (_didIteratorError)
15640
+ throw _iteratorError;
15641
+ }
15642
+ }
15643
+ return to;
15644
+ }, __toCommonJS2 = function(mod) {
15645
+ return __copyProps2(__defProp2({}, "__esModule", {
15646
+ value: !0
15647
+ }), mod);
15648
+ }, useStackedZIndex_exports = {};
15649
+ __export2(useStackedZIndex_exports, {
15650
+ useStackedZIndex: function() {
15651
+ return useStackedZIndex;
15652
+ }
15653
+ });
15654
+ module2.exports = __toCommonJS2(useStackedZIndex_exports);
15655
+ var import_react3 = require("react"), CurrentPortalZIndices = {}, useStackedZIndex = function(props) {
15656
+ var { stackZIndex, zIndex: zIndexProp = 1e3 } = props, zIndex = function() {
15657
+ if (stackZIndex) {
15658
+ var highest = Object.values(CurrentPortalZIndices).reduce(function(acc, cur) {
15659
+ return Math.max(acc, cur);
15660
+ }, 0);
15661
+ return Math.max(stackZIndex, highest + 1);
15662
+ }
15663
+ if (zIndexProp) return zIndexProp;
15664
+ }(), id = (0, import_react3.useId)();
15665
+ return (0, import_react3.useEffect)(function() {
15666
+ if (typeof zIndex == "number") return CurrentPortalZIndices[id] = zIndex, function() {
15667
+ delete CurrentPortalZIndices[id];
15668
+ };
15669
+ }, [
15670
+ zIndex
15671
+ ]), zIndex;
15672
+ };
15603
15673
  }
15604
15674
  });
15605
15675
 
@@ -15662,9 +15732,6 @@ var require_GorhomPortal_native = __commonJS({
15662
15732
  PortalHost: function() {
15663
15733
  return PortalHost;
15664
15734
  },
15665
- PortalItem: function() {
15666
- return PortalItem;
15667
- },
15668
15735
  PortalProvider: function() {
15669
15736
  return PortalProvider2;
15670
15737
  },
@@ -15673,7 +15740,7 @@ var require_GorhomPortal_native = __commonJS({
15673
15740
  }
15674
15741
  });
15675
15742
  module2.exports = __toCommonJS2(GorhomPortal_exports);
15676
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_core12 = require_index_native17(), import_start_transition = require_index_native9(), import_react3 = __toESM2(require("react")), import_react_dom = require("react-dom"), ACTIONS = /* @__PURE__ */ function(ACTIONS2) {
15743
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_start_transition = require_index_native9(), import_react3 = __toESM2(require("react")), import_constants22 = require_constants_native3(), ACTIONS = /* @__PURE__ */ function(ACTIONS2) {
15677
15744
  return ACTIONS2[ACTIONS2.REGISTER_HOST = 0] = "REGISTER_HOST", ACTIONS2[ACTIONS2.DEREGISTER_HOST = 1] = "DEREGISTER_HOST", ACTIONS2[ACTIONS2.ADD_UPDATE_PORTAL = 2] = "ADD_UPDATE_PORTAL", ACTIONS2[ACTIONS2.REMOVE_PORTAL = 3] = "REMOVE_PORTAL", ACTIONS2;
15678
15745
  }(ACTIONS || {}), INITIAL_STATE = {}, registerHost = function(state, hostName) {
15679
15746
  return hostName in state || (state[hostName] = []), state;
@@ -15789,7 +15856,7 @@ var require_GorhomPortal_native = __commonJS({
15789
15856
  }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalHostNonNative, {
15790
15857
  ...props
15791
15858
  });
15792
- }), allPortalHosts = /* @__PURE__ */ new Map(), listeners = {};
15859
+ });
15793
15860
  function PortalHostWeb(props) {
15794
15861
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
15795
15862
  style: {
@@ -15797,11 +15864,11 @@ var require_GorhomPortal_native = __commonJS({
15797
15864
  },
15798
15865
  ref: function(node) {
15799
15866
  if (node) {
15800
- var _listeners_props_name;
15801
- allPortalHosts.set(props.name, node), (_listeners_props_name = listeners[props.name]) === null || _listeners_props_name === void 0 || _listeners_props_name.forEach(function(x) {
15867
+ var _portalListeners_props_name;
15868
+ import_constants22.allPortalHosts.set(props.name, node), (_portalListeners_props_name = import_constants22.portalListeners[props.name]) === null || _portalListeners_props_name === void 0 || _portalListeners_props_name.forEach(function(x) {
15802
15869
  return x(node);
15803
15870
  });
15804
- } else allPortalHosts.delete(props.name);
15871
+ } else import_constants22.allPortalHosts.delete(props.name);
15805
15872
  }
15806
15873
  });
15807
15874
  }
@@ -15823,59 +15890,12 @@ var require_GorhomPortal_native = __commonJS({
15823
15890
  return item.node;
15824
15891
  }));
15825
15892
  }
15826
- var PortalItem = /* @__PURE__ */ (0, import_react3.memo)(function(props) {
15827
- return import_constants4.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalItemWeb, {
15828
- ...props
15829
- }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NonNativePortalComponent, {
15830
- ...props
15831
- });
15832
- }), PortalItemWeb = function(props) {
15833
- if (!props.hostName) throw new Error("No name");
15834
- var cur = allPortalHosts.get(props.hostName), [node, setNode] = (0, import_react3.useState)(cur);
15835
- return cur && !node && setNode(cur), (0, import_react3.useEffect)(function() {
15836
- var _listeners, _props_hostName;
15837
- if (props.hostName && !node) {
15838
- var listener = function(node2) {
15839
- setNode(node2);
15840
- };
15841
- return (_listeners = listeners)[_props_hostName = props.hostName] || (_listeners[_props_hostName] = /* @__PURE__ */ new Set()), listeners[props.hostName].add(listener), function() {
15842
- var _listeners_props_hostName;
15843
- (_listeners_props_hostName = listeners[props.hostName]) === null || _listeners_props_hostName === void 0 || _listeners_props_hostName.delete(listener);
15844
- };
15845
- }
15846
- }, [
15847
- node
15848
- ]), node ? /* @__PURE__ */ (0, import_react_dom.createPortal)(props.children, node) : null;
15849
- }, NonNativePortalComponent = function(props) {
15850
- var { name: _providedName, hostName, handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passthrough } = props, { addPortal: addUpdatePortal2, removePortal: removePortal2 } = usePortal(hostName), id = (0, import_react3.useId)(), name = _providedName || id, handleOnMount = (0, import_core12.useEvent)(function() {
15851
- _providedHandleOnMount ? _providedHandleOnMount(function() {
15852
- return addUpdatePortal2(name, children);
15853
- }) : addUpdatePortal2(name, children);
15854
- }), handleOnUnmount = (0, import_core12.useEvent)(function() {
15855
- _providedHandleOnUnmount ? _providedHandleOnUnmount(function() {
15856
- return removePortal2(name);
15857
- }) : removePortal2(name);
15858
- }), handleOnUpdate = (0, import_core12.useEvent)(function() {
15859
- _providedHandleOnUpdate ? _providedHandleOnUpdate(function() {
15860
- return addUpdatePortal2(name, children);
15861
- }) : addUpdatePortal2(name, children);
15862
- });
15863
- return (0, import_constants4.useIsomorphicLayoutEffect)(function() {
15864
- if (!passthrough) return handleOnMount(), function() {
15865
- handleOnUnmount();
15866
- };
15867
- }, []), (0, import_react3.useEffect)(function() {
15868
- passthrough || handleOnUpdate();
15869
- }, [
15870
- children
15871
- ]), passthrough ? children : null;
15872
- };
15873
15893
  }
15874
15894
  });
15875
15895
 
15876
- // ../portal/dist/cjs/useStackedZIndex.native.js
15877
- var require_useStackedZIndex_native = __commonJS({
15878
- "../portal/dist/cjs/useStackedZIndex.native.js"(exports2, module2) {
15896
+ // ../portal/dist/cjs/GorhomPortalItem.native.js
15897
+ var require_GorhomPortalItem_native = __commonJS({
15898
+ "../portal/dist/cjs/GorhomPortalItem.native.js"(exports2, module2) {
15879
15899
  "use strict";
15880
15900
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
15881
15901
  for (var name in all) __defProp2(target, name, {
@@ -15909,30 +15929,36 @@ var require_useStackedZIndex_native = __commonJS({
15909
15929
  return __copyProps2(__defProp2({}, "__esModule", {
15910
15930
  value: !0
15911
15931
  }), mod);
15912
- }, useStackedZIndex_exports = {};
15913
- __export2(useStackedZIndex_exports, {
15914
- useStackedZIndex: function() {
15915
- return useStackedZIndex;
15932
+ }, GorhomPortalItem_native_exports = {};
15933
+ __export2(GorhomPortalItem_native_exports, {
15934
+ GorhomPortalItem: function() {
15935
+ return GorhomPortalItem;
15916
15936
  }
15917
15937
  });
15918
- module2.exports = __toCommonJS2(useStackedZIndex_exports);
15919
- var import_react3 = require("react"), CurrentPortalZIndices = {}, useStackedZIndex = function(props) {
15920
- var { stackZIndex, zIndex: zIndexProp = 1e3 } = props, zIndex = function() {
15921
- if (stackZIndex) {
15922
- var highest = Object.values(CurrentPortalZIndices).reduce(function(acc, cur) {
15923
- return Math.max(acc, cur);
15924
- }, 0);
15925
- return Math.max(stackZIndex, highest + 1);
15926
- }
15927
- if (zIndexProp) return zIndexProp;
15928
- }(), id = (0, import_react3.useId)();
15929
- return (0, import_react3.useEffect)(function() {
15930
- if (typeof zIndex == "number") return CurrentPortalZIndices[id] = zIndex, function() {
15931
- delete CurrentPortalZIndices[id];
15938
+ module2.exports = __toCommonJS2(GorhomPortalItem_native_exports);
15939
+ var import_constants4 = require_index_native6(), import_core12 = require_index_native17(), import_react3 = require("react"), import_GorhomPortal = require_GorhomPortal_native(), GorhomPortalItem = function(props) {
15940
+ var { name: _providedName, hostName, handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passthrough } = props, { addPortal: addUpdatePortal, removePortal } = (0, import_GorhomPortal.usePortal)(hostName), id = (0, import_react3.useId)(), name = _providedName || id, handleOnMount = (0, import_core12.useEvent)(function() {
15941
+ _providedHandleOnMount ? _providedHandleOnMount(function() {
15942
+ return addUpdatePortal(name, children);
15943
+ }) : addUpdatePortal(name, children);
15944
+ }), handleOnUnmount = (0, import_core12.useEvent)(function() {
15945
+ _providedHandleOnUnmount ? _providedHandleOnUnmount(function() {
15946
+ return removePortal(name);
15947
+ }) : removePortal(name);
15948
+ }), handleOnUpdate = (0, import_core12.useEvent)(function() {
15949
+ _providedHandleOnUpdate ? _providedHandleOnUpdate(function() {
15950
+ return addUpdatePortal(name, children);
15951
+ }) : addUpdatePortal(name, children);
15952
+ });
15953
+ return (0, import_constants4.useIsomorphicLayoutEffect)(function() {
15954
+ if (!passthrough) return handleOnMount(), function() {
15955
+ handleOnUnmount();
15932
15956
  };
15957
+ }, []), (0, import_react3.useEffect)(function() {
15958
+ passthrough || handleOnUpdate();
15933
15959
  }, [
15934
- zIndex
15935
- ]), zIndex;
15960
+ children
15961
+ ]), passthrough ? children : null;
15936
15962
  };
15937
15963
  }
15938
15964
  });
@@ -15992,7 +16018,7 @@ var require_Portal_native = __commonJS({
15992
16018
  }
15993
16019
  });
15994
16020
  module2.exports = __toCommonJS2(Portal_native_exports);
15995
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_stacks3 = require_index_native21(), React4 = __toESM2(require("react")), import_react_native4 = require("react-native"), import_constants4 = require_constants_native3(), import_GorhomPortal = require_GorhomPortal_native(), import_useStackedZIndex = require_useStackedZIndex_native(), createPortal = function() {
16021
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_stacks3 = require_index_native21(), React4 = __toESM2(require("react")), import_react_native4 = require("react-native"), import_constants4 = require_constants_native3(), import_useStackedZIndex = require_useStackedZIndex_native(), import_GorhomPortalItem = require_GorhomPortalItem_native(), createPortal = function() {
15996
16022
  return import_constants4.IS_FABRIC ? require("react-native/Libraries/Renderer/shims/ReactFabric").createPortal : require("react-native/Libraries/Renderer/shims/ReactNative").createPortal;
15997
16023
  }(), Portal = function(propsIn) {
15998
16024
  var { stackZIndex, ...props } = propsIn, rootTag = React4.useContext(import_react_native4.RootTagContext), zIndex = (0, import_useStackedZIndex.useStackedZIndex)(propsIn), contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, {
@@ -16003,7 +16029,7 @@ var require_Portal_native = __commonJS({
16003
16029
  ...props,
16004
16030
  zIndex
16005
16031
  });
16006
- return !import_constants4.USE_NATIVE_PORTAL || !rootTag ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_GorhomPortal.PortalItem, {
16032
+ return !import_constants4.USE_NATIVE_PORTAL || !rootTag ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_GorhomPortalItem.GorhomPortalItem, {
16007
16033
  hostName: "root",
16008
16034
  children: contents
16009
16035
  }) : createPortal(contents, rootTag);
@@ -16051,7 +16077,12 @@ var require_PortalProps_native = __commonJS({
16051
16077
  var require_index_native26 = __commonJS({
16052
16078
  "../portal/dist/cjs/index.native.js"(exports2, module2) {
16053
16079
  "use strict";
16054
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = function(to, from, except, desc) {
16080
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
16081
+ for (var name in all) __defProp2(target, name, {
16082
+ get: all[name],
16083
+ enumerable: !0
16084
+ });
16085
+ }, __copyProps2 = function(to, from, except, desc) {
16055
16086
  var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
16056
16087
  if (from && typeof from == "object" || typeof from == "function") try {
16057
16088
  for (var _loop = function() {
@@ -16081,10 +16112,16 @@ var require_index_native26 = __commonJS({
16081
16112
  value: !0
16082
16113
  }), mod);
16083
16114
  }, src_exports2 = {};
16115
+ __export2(src_exports2, {
16116
+ PortalItem: function() {
16117
+ return import_GorhomPortalItem.GorhomPortalItem;
16118
+ }
16119
+ });
16084
16120
  module2.exports = __toCommonJS2(src_exports2);
16085
16121
  __reExport2(src_exports2, require_Portal_native(), module2.exports);
16086
16122
  __reExport2(src_exports2, require_PortalProps_native(), module2.exports);
16087
16123
  __reExport2(src_exports2, require_GorhomPortal_native(), module2.exports);
16124
+ var import_GorhomPortalItem = require_GorhomPortalItem_native();
16088
16125
  __reExport2(src_exports2, require_constants_native3(), module2.exports);
16089
16126
  }
16090
16127
  });