@tamagui/portal 1.124.18 → 1.125.0
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/Portal.cjs +6 -3
- package/dist/cjs/Portal.js +4 -3
- package/dist/cjs/Portal.js.map +1 -1
- package/dist/cjs/Portal.native.js +2 -2
- package/dist/cjs/Portal.native.js.map +2 -2
- package/dist/cjs/helpers.cjs +32 -0
- package/dist/cjs/helpers.js +26 -0
- package/dist/cjs/helpers.js.map +6 -0
- package/dist/cjs/helpers.native.js +35 -0
- package/dist/cjs/helpers.native.js.map +6 -0
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +4 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Portal.js +5 -3
- package/dist/esm/Portal.js.map +1 -1
- package/dist/esm/Portal.mjs +6 -3
- package/dist/esm/Portal.mjs.map +1 -1
- package/dist/esm/Portal.native.js +3 -2
- package/dist/esm/Portal.native.js.map +2 -2
- package/dist/esm/helpers.js +10 -0
- package/dist/esm/helpers.js.map +6 -0
- package/dist/esm/helpers.mjs +8 -0
- package/dist/esm/helpers.mjs.map +1 -0
- package/dist/esm/helpers.native.js +14 -0
- package/dist/esm/helpers.native.js.map +6 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -1
- package/dist/esm/index.native.js.map +2 -2
- package/package.json +9 -8
- package/src/Portal.native.tsx +4 -3
- package/src/Portal.tsx +7 -4
- package/src/PortalProps.tsx +1 -1
- package/src/helpers.ts +17 -0
- package/src/index.ts +1 -0
- package/types/Portal.d.ts.map +1 -1
- package/types/Portal.native.d.ts.map +1 -1
- package/types/PortalProps.d.ts +1 -1
- package/types/PortalProps.d.ts.map +1 -1
- package/types/helpers.d.ts +8 -0
- package/types/helpers.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/useStackedZIndex.cjs +0 -46
- package/dist/cjs/useStackedZIndex.js +0 -40
- package/dist/cjs/useStackedZIndex.js.map +0 -6
- package/dist/cjs/useStackedZIndex.native.js +0 -47
- package/dist/cjs/useStackedZIndex.native.js.map +0 -6
- package/dist/esm/useStackedZIndex.js +0 -24
- package/dist/esm/useStackedZIndex.js.map +0 -6
- package/dist/esm/useStackedZIndex.mjs +0 -23
- package/dist/esm/useStackedZIndex.mjs.map +0 -1
- package/dist/esm/useStackedZIndex.native.js +0 -27
- package/dist/esm/useStackedZIndex.native.js.map +0 -6
- package/src/useStackedZIndex.tsx +0 -33
- package/types/useStackedZIndex.d.ts +0 -3
- package/types/useStackedZIndex.d.ts.map +0 -1
package/dist/cjs/Portal.cjs
CHANGED
|
@@ -39,16 +39,18 @@ var import_polyfill_dev = require("@tamagui/polyfill-dev"),
|
|
|
39
39
|
import_stacks = require("@tamagui/stacks"),
|
|
40
40
|
React = __toESM(require("react")),
|
|
41
41
|
import_react_dom = require("react-dom"),
|
|
42
|
-
|
|
42
|
+
import_z_index_stack = require("@tamagui/z-index-stack"),
|
|
43
|
+
import_helpers = require("./helpers.cjs"),
|
|
43
44
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
44
45
|
const Portal = React.memo(propsIn => {
|
|
45
46
|
if (import_constants.isServer) return null;
|
|
46
47
|
const {
|
|
47
48
|
host = globalThis.document?.body,
|
|
48
49
|
stackZIndex,
|
|
50
|
+
children,
|
|
49
51
|
...props
|
|
50
52
|
} = propsIn,
|
|
51
|
-
zIndex = (0,
|
|
53
|
+
zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn));
|
|
52
54
|
return (0, import_react_dom.createPortal)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.YStack, {
|
|
53
55
|
contain: "strict",
|
|
54
56
|
fullscreen: !0,
|
|
@@ -57,6 +59,7 @@ const Portal = React.memo(propsIn => {
|
|
|
57
59
|
maxHeight: "100vh",
|
|
58
60
|
pointerEvents: "none",
|
|
59
61
|
...props,
|
|
60
|
-
zIndex
|
|
62
|
+
zIndex,
|
|
63
|
+
children
|
|
61
64
|
}), host);
|
|
62
65
|
});
|
package/dist/cjs/Portal.js
CHANGED
|
@@ -25,11 +25,11 @@ __export(Portal_exports, {
|
|
|
25
25
|
Portal: () => Portal
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(Portal_exports);
|
|
28
|
-
var import_polyfill_dev = require("@tamagui/polyfill-dev"), import_constants = require("@tamagui/constants"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_react_dom = require("react-dom"),
|
|
28
|
+
var import_polyfill_dev = require("@tamagui/polyfill-dev"), import_constants = require("@tamagui/constants"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_react_dom = require("react-dom"), import_z_index_stack = require("@tamagui/z-index-stack"), import_helpers = require("./helpers"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
const Portal = React.memo((propsIn) => {
|
|
30
30
|
if (import_constants.isServer)
|
|
31
31
|
return null;
|
|
32
|
-
const { host = globalThis.document?.body, stackZIndex, ...props } = propsIn, zIndex = (0,
|
|
32
|
+
const { host = globalThis.document?.body, stackZIndex, children, ...props } = propsIn, zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn));
|
|
33
33
|
return (0, import_react_dom.createPortal)(
|
|
34
34
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
35
35
|
import_stacks.YStack,
|
|
@@ -41,7 +41,8 @@ const Portal = React.memo((propsIn) => {
|
|
|
41
41
|
maxHeight: "100vh",
|
|
42
42
|
pointerEvents: "none",
|
|
43
43
|
...props,
|
|
44
|
-
zIndex
|
|
44
|
+
zIndex,
|
|
45
|
+
children
|
|
45
46
|
}
|
|
46
47
|
),
|
|
47
48
|
host
|
package/dist/cjs/Portal.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAO,kCAEP,mBAAyB,+BACzB,gBAAuB,4BACvB,QAAuB,2BACvB,mBAA6B,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAO,kCAEP,mBAAyB,+BACzB,gBAAuB,4BACvB,QAAuB,2BACvB,mBAA6B,sBAE7B,uBAAiC,mCACjC,iBAAsC,sBAclC;AATG,MAAM,SAAS,MAAM,KAAK,CAAC,YAAyB;AACzD,MAAI;AACF,WAAO;AAGT,QAAM,EAAE,OAAO,WAAW,UAAU,MAAM,aAAa,UAAU,GAAG,MAAM,IAAI,SACxE,aAAS,2CAAiB,sCAAsB,OAAO,CAAC;AAE9D,aAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,YAAU;AAAA,QAEV,UAAS;AAAA,QACT,UAAS;AAAA,QACT,WAAU;AAAA,QACV,eAAc;AAAA,QACb,GAAG;AAAA,QACJ;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -26,7 +26,7 @@ __export(Portal_native_exports, {
|
|
|
26
26
|
Portal: () => Portal
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(Portal_native_exports);
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_react_native = require("react-native"), import_constants = require("./constants"),
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_stacks = require("@tamagui/stacks"), import_z_index_stack = require("@tamagui/z-index-stack"), React = __toESM(require("react")), import_react_native = require("react-native"), import_constants = require("./constants"), import_GorhomPortalItem = require("./GorhomPortalItem"), import_helpers = require("./helpers"), createPortal = function() {
|
|
30
30
|
if (import_constants.IS_FABRIC)
|
|
31
31
|
try {
|
|
32
32
|
return require("react-native/Libraries/Renderer/shims/ReactFabric").createPortal;
|
|
@@ -39,7 +39,7 @@ var import_jsx_runtime = require("react/jsx-runtime"), import_stacks = require("
|
|
|
39
39
|
return console.info("Note: error importing portal, defaulting to non-native portals", err), null;
|
|
40
40
|
}
|
|
41
41
|
}(), Portal = function(propsIn) {
|
|
42
|
-
var { stackZIndex, ...props } = propsIn, rootTag = React.useContext(import_react_native.RootTagContext), zIndex = (0,
|
|
42
|
+
var { stackZIndex, ...props } = propsIn, rootTag = React.useContext(import_react_native.RootTagContext), zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn)), contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
|
|
43
43
|
pointerEvents: "box-none",
|
|
44
44
|
fullscreen: !0,
|
|
45
45
|
position: "absolute",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/Portal.native.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,gBAAuB,4BACvB,QAAuB,2BACvB,sBAA+B,yBAC/B,mBAA6C,
|
|
5
|
-
"names": ["createPortal", "IS_FABRIC", "require", "err", "console", "info", "Portal", "propsIn", "stackZIndex", "props", "rootTag", "React", "useContext", "RootTagContext", "zIndex", "useStackedZIndex", "contents", "_jsx", "YStack", "pointerEvents", "fullscreen", "position", "maxWidth", "USE_NATIVE_PORTAL", "GorhomPortalItem", "hostName"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,gBAAuB,4BACvB,uBAAiC,mCACjC,QAAuB,2BACvB,sBAA+B,yBAC/B,mBAA6C,wBAC7C,0BAAiC,+BACjC,iBAAsC,sBAGhCA,eAAgB,WAAA;AACpB,MAAIC;AACF,QAAI;AACF,aAAOC,QAAQ,mDAAA,EAAqDF;IACtE,SAASG,KAAK;AACZC,qBAAQC,KAAK,kEAAkEF,GAAAA,GACxE;IACT;AAEF,MAAI;AACF,WAAOD,QAAQ,mDAAA,EAAqDF;EACtE,SAASG,KAAK;AACZC,mBAAQC,KAAK,kEAAkEF,GAAAA,GACxE;EACT;AACF,EAAA,GAEaG,SAAS,SAACC,SAAAA;AACrB,MAAM,EAAEC,aAAa,GAAGC,MAAAA,IAAUF,SAE5BG,UAAUC,MAAMC,WAAWC,kCAAAA,GAC3BC,aAASC,2CAAiBC,sCAAsBT,OAAAA,CAAAA,GAEhDU,WACJ,uCAAAC,KAACC,sBAAAA;IACCC,eAAc;IACdC,YAAU;IACVC,UAAS;IACTC,UAAS;IACR,GAAGd;IACJK;;AAIJ,SAAI,CAACd,gBAAgB,CAACwB,sCAAqB,CAACd,UACnC,uCAAAQ,KAACO,0CAAAA;IAAiBC,UAAS;cAAQT;OAGrCjB,aAAaiB,UAAUP,OAAAA;AAChC;",
|
|
5
|
+
"names": ["createPortal", "IS_FABRIC", "require", "err", "console", "info", "Portal", "propsIn", "stackZIndex", "props", "rootTag", "React", "useContext", "RootTagContext", "zIndex", "useStackedZIndex", "getStackedZIndexProps", "contents", "_jsx", "YStack", "pointerEvents", "fullscreen", "position", "maxWidth", "USE_NATIVE_PORTAL", "GorhomPortalItem", "hostName"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var helpers_exports = {};
|
|
22
|
+
__export(helpers_exports, {
|
|
23
|
+
getStackedZIndexProps: () => getStackedZIndexProps,
|
|
24
|
+
resolveViewZIndex: () => resolveViewZIndex
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
27
|
+
var import_web = require("@tamagui/web");
|
|
28
|
+
const getStackedZIndexProps = propsIn => ({
|
|
29
|
+
stackZIndex: propsIn.stackZIndex,
|
|
30
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
31
|
+
}),
|
|
32
|
+
resolveViewZIndex = zIndex => typeof zIndex > "u" || zIndex === "unset" ? void 0 : typeof zIndex == "number" ? zIndex : (0, import_web.getTokenValue)(zIndex, "zIndex");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var helpers_exports = {};
|
|
16
|
+
__export(helpers_exports, {
|
|
17
|
+
getStackedZIndexProps: () => getStackedZIndexProps,
|
|
18
|
+
resolveViewZIndex: () => resolveViewZIndex
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
21
|
+
var import_web = require("@tamagui/web");
|
|
22
|
+
const getStackedZIndexProps = (propsIn) => ({
|
|
23
|
+
stackZIndex: propsIn.stackZIndex,
|
|
24
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
25
|
+
}), resolveViewZIndex = (zIndex) => typeof zIndex > "u" || zIndex === "unset" ? void 0 : typeof zIndex == "number" ? zIndex : (0, import_web.getTokenValue)(zIndex, "zIndex");
|
|
26
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/helpers.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA8C;AAGvC,MAAM,wBAAwB,CAAC,aAC7B;AAAA,EACL,aAAa,QAAQ;AAAA,EACrB,QAAQ,kBAAkB,QAAQ,MAAM;AAC1C,IAGW,oBAAoB,CAAC,WACzB,OAAO,SAAW,OAAe,WAAW,UAC/C,SACA,OAAO,UAAW,WAChB,aACA,0BAAc,QAAe,QAAQ;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var helpers_exports = {};
|
|
17
|
+
__export(helpers_exports, {
|
|
18
|
+
getStackedZIndexProps: () => getStackedZIndexProps,
|
|
19
|
+
resolveViewZIndex: () => resolveViewZIndex
|
|
20
|
+
});
|
|
21
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
22
|
+
var import_web = require("@tamagui/web"), getStackedZIndexProps = function(propsIn) {
|
|
23
|
+
return {
|
|
24
|
+
stackZIndex: propsIn.stackZIndex,
|
|
25
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
26
|
+
};
|
|
27
|
+
}, resolveViewZIndex = function(zIndex) {
|
|
28
|
+
return typeof zIndex > "u" || zIndex === "unset" ? void 0 : typeof zIndex == "number" ? zIndex : (0, import_web.getTokenValue)(zIndex, "zIndex");
|
|
29
|
+
};
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getStackedZIndexProps,
|
|
33
|
+
resolveViewZIndex
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/helpers.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;iBAA8C,yBAGjCA,wBAAwB,SAACC,SAAAA;AACpC,SAAO;IACLC,aAAaD,QAAQC;IACrBC,QAAQC,kBAAkBH,QAAQE,MAAM;EAC1C;AACF,GAEaC,oBAAoB,SAACD,QAAAA;AAChC,SAAO,OAAOA,SAAW,OAAeA,WAAW,UAC/CE,SACA,OAAOF,UAAW,WAChBA,aACAG,0BAAcH,QAAe,QAAA;AACrC;",
|
|
5
|
+
"names": ["getStackedZIndexProps", "propsIn", "stackZIndex", "zIndex", "resolveViewZIndex", "undefined", "getTokenValue"]
|
|
6
|
+
}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -21,11 +21,13 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
21
21
|
}), mod);
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
|
-
PortalItem: () => import_GorhomPortalItem.GorhomPortalItem
|
|
24
|
+
PortalItem: () => import_GorhomPortalItem.GorhomPortalItem,
|
|
25
|
+
resolveViewZIndex: () => import_helpers.resolveViewZIndex
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(index_exports);
|
|
27
28
|
__reExport(index_exports, require("./Portal.cjs"), module.exports);
|
|
28
29
|
__reExport(index_exports, require("./PortalProps.cjs"), module.exports);
|
|
29
30
|
__reExport(index_exports, require("./GorhomPortal.cjs"), module.exports);
|
|
30
31
|
var import_GorhomPortalItem = require("./GorhomPortalItem.cjs");
|
|
31
|
-
__reExport(index_exports, require("./constants.cjs"), module.exports);
|
|
32
|
+
__reExport(index_exports, require("./constants.cjs"), module.exports);
|
|
33
|
+
var import_helpers = require("./helpers.cjs");
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __export = (target, all) => {
|
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
15
|
var index_exports = {};
|
|
16
16
|
__export(index_exports, {
|
|
17
|
-
PortalItem: () => import_GorhomPortalItem.GorhomPortalItem
|
|
17
|
+
PortalItem: () => import_GorhomPortalItem.GorhomPortalItem,
|
|
18
|
+
resolveViewZIndex: () => import_helpers.resolveViewZIndex
|
|
18
19
|
});
|
|
19
20
|
module.exports = __toCommonJS(index_exports);
|
|
20
21
|
__reExport(index_exports, require("./Portal"), module.exports);
|
|
@@ -22,4 +23,5 @@ __reExport(index_exports, require("./PortalProps"), module.exports);
|
|
|
22
23
|
__reExport(index_exports, require("./GorhomPortal"), module.exports);
|
|
23
24
|
var import_GorhomPortalItem = require("./GorhomPortalItem");
|
|
24
25
|
__reExport(index_exports, require("./constants"), module.exports);
|
|
26
|
+
var import_helpers = require("./helpers");
|
|
25
27
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,qBAAd;AACA,0BAAc,0BADd;AAEA,0BAAc,2BAFd;AAGA,8BAA+C;AAC/C,0BAAc,wBAJd;",
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,qBAAd;AACA,0BAAc,0BADd;AAEA,0BAAc,2BAFd;AAGA,8BAA+C;AAC/C,0BAAc,wBAJd;AAKA,qBAAkC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -15,7 +15,8 @@ var __export = (target, all) => {
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
16
|
var index_exports = {};
|
|
17
17
|
__export(index_exports, {
|
|
18
|
-
PortalItem: () => import_GorhomPortalItem.GorhomPortalItem
|
|
18
|
+
PortalItem: () => import_GorhomPortalItem.GorhomPortalItem,
|
|
19
|
+
resolveViewZIndex: () => import_helpers.resolveViewZIndex
|
|
19
20
|
});
|
|
20
21
|
module.exports = __toCommonJS(index_exports);
|
|
21
22
|
__reExport(index_exports, require("./Portal"), module.exports);
|
|
@@ -23,9 +24,11 @@ __reExport(index_exports, require("./PortalProps"), module.exports);
|
|
|
23
24
|
__reExport(index_exports, require("./GorhomPortal"), module.exports);
|
|
24
25
|
var import_GorhomPortalItem = require("./GorhomPortalItem");
|
|
25
26
|
__reExport(index_exports, require("./constants"), module.exports);
|
|
27
|
+
var import_helpers = require("./helpers");
|
|
26
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
29
|
0 && (module.exports = {
|
|
28
30
|
PortalItem,
|
|
31
|
+
resolveViewZIndex,
|
|
29
32
|
...require("./Portal"),
|
|
30
33
|
...require("./PortalProps"),
|
|
31
34
|
...require("./GorhomPortal"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;0BAAc,qBAAd;AACA,0BAAc,0BADd;AAEA,0BAAc,2BAFd;AAGA,8BAA+C;AAC/C,0BAAc,wBAJd;AAKA,qBAAkC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/Portal.js
CHANGED
|
@@ -3,12 +3,13 @@ import { isServer } from "@tamagui/constants";
|
|
|
3
3
|
import { YStack } from "@tamagui/stacks";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
|
-
import { useStackedZIndex } from "
|
|
6
|
+
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
7
|
+
import { getStackedZIndexProps } from "./helpers";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
const Portal = React.memo((propsIn) => {
|
|
9
10
|
if (isServer)
|
|
10
11
|
return null;
|
|
11
|
-
const { host = globalThis.document?.body, stackZIndex, ...props } = propsIn, zIndex = useStackedZIndex(propsIn);
|
|
12
|
+
const { host = globalThis.document?.body, stackZIndex, children, ...props } = propsIn, zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
12
13
|
return createPortal(
|
|
13
14
|
/* @__PURE__ */ jsx(
|
|
14
15
|
YStack,
|
|
@@ -20,7 +21,8 @@ const Portal = React.memo((propsIn) => {
|
|
|
20
21
|
maxHeight: "100vh",
|
|
21
22
|
pointerEvents: "none",
|
|
22
23
|
...props,
|
|
23
|
-
zIndex
|
|
24
|
+
zIndex,
|
|
25
|
+
children
|
|
24
26
|
}
|
|
25
27
|
),
|
|
26
28
|
host
|
package/dist/esm/Portal.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,YAAY,WAAW;AACvB,SAAS,oBAAoB;
|
|
4
|
+
"mappings": "AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAE7B,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AAclC;AATG,MAAM,SAAS,MAAM,KAAK,CAAC,YAAyB;AACzD,MAAI;AACF,WAAO;AAGT,QAAM,EAAE,OAAO,WAAW,UAAU,MAAM,aAAa,UAAU,GAAG,MAAM,IAAI,SACxE,SAAS,iBAAiB,sBAAsB,OAAO,CAAC;AAE9D,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,YAAU;AAAA,QAEV,UAAS;AAAA,QACT,UAAS;AAAA,QACT,WAAU;AAAA,QACV,eAAc;AAAA,QACb,GAAG;AAAA,QACJ;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/Portal.mjs
CHANGED
|
@@ -3,16 +3,18 @@ import { isServer } from "@tamagui/constants";
|
|
|
3
3
|
import { YStack } from "@tamagui/stacks";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
|
-
import { useStackedZIndex } from "
|
|
6
|
+
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
7
|
+
import { getStackedZIndexProps } from "./helpers.mjs";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
const Portal = React.memo(propsIn => {
|
|
9
10
|
if (isServer) return null;
|
|
10
11
|
const {
|
|
11
12
|
host = globalThis.document?.body,
|
|
12
13
|
stackZIndex,
|
|
14
|
+
children,
|
|
13
15
|
...props
|
|
14
16
|
} = propsIn,
|
|
15
|
-
zIndex = useStackedZIndex(propsIn);
|
|
17
|
+
zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
16
18
|
return createPortal(/* @__PURE__ */jsx(YStack, {
|
|
17
19
|
contain: "strict",
|
|
18
20
|
fullscreen: !0,
|
|
@@ -21,7 +23,8 @@ const Portal = React.memo(propsIn => {
|
|
|
21
23
|
maxHeight: "100vh",
|
|
22
24
|
pointerEvents: "none",
|
|
23
25
|
...props,
|
|
24
|
-
zIndex
|
|
26
|
+
zIndex,
|
|
27
|
+
children
|
|
25
28
|
}), host);
|
|
26
29
|
});
|
|
27
30
|
export { Portal };
|
package/dist/esm/Portal.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isServer","YStack","React","createPortal","useStackedZIndex","jsx","Portal","memo","propsIn","host","globalThis","document","body","stackZIndex","props","zIndex","contain","fullscreen","position","maxWidth","maxHeight","pointerEvents"],"sources":["../../src/Portal.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAO;AAEP,SAASA,QAAA,QAAgB;AACzB,SAASC,MAAA,QAAc;AACvB,YAAYC,KAAA,MAAW;AACvB,SAASC,YAAA,QAAoB;
|
|
1
|
+
{"version":3,"names":["isServer","YStack","React","createPortal","useStackedZIndex","getStackedZIndexProps","jsx","Portal","memo","propsIn","host","globalThis","document","body","stackZIndex","children","props","zIndex","contain","fullscreen","position","maxWidth","maxHeight","pointerEvents"],"sources":["../../src/Portal.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAO;AAEP,SAASA,QAAA,QAAgB;AACzB,SAASC,MAAA,QAAc;AACvB,YAAYC,KAAA,MAAW;AACvB,SAASC,YAAA,QAAoB;AAE7B,SAASC,gBAAA,QAAwB;AACjC,SAASC,qBAAA,QAA6B;AAclC,SAAAC,GAAA;AATG,MAAMC,MAAA,GAASL,KAAA,CAAMM,IAAA,CAAMC,OAAA,IAAyB;EACzD,IAAIT,QAAA,EACF,OAAO;EAGT,MAAM;MAAEU,IAAA,GAAOC,UAAA,CAAWC,QAAA,EAAUC,IAAA;MAAMC,WAAA;MAAaC,QAAA;MAAU,GAAGC;IAAM,IAAIP,OAAA;IACxEQ,MAAA,GAASb,gBAAA,CAAiBC,qBAAA,CAAsBI,OAAO,CAAC;EAE9D,OAAON,YAAA,CACL,eAAAG,GAAA,CAACL,MAAA;IACCiB,OAAA,EAAQ;IACRC,UAAA,EAAU;IAEVC,QAAA,EAAS;IACTC,QAAA,EAAS;IACTC,SAAA,EAAU;IACVC,aAAA,EAAc;IACb,GAAGP,KAAA;IACJC,MAAA;IAECF;EAAA,CACH,GACAL,IACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { YStack } from "@tamagui/stacks";
|
|
3
|
+
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
3
4
|
import * as React from "react";
|
|
4
5
|
import { RootTagContext } from "react-native";
|
|
5
6
|
import { IS_FABRIC, USE_NATIVE_PORTAL } from "./constants";
|
|
6
|
-
import { useStackedZIndex } from "./useStackedZIndex";
|
|
7
7
|
import { GorhomPortalItem } from "./GorhomPortalItem";
|
|
8
|
+
import { getStackedZIndexProps } from "./helpers";
|
|
8
9
|
var createPortal = function() {
|
|
9
10
|
if (IS_FABRIC)
|
|
10
11
|
try {
|
|
@@ -18,7 +19,7 @@ var createPortal = function() {
|
|
|
18
19
|
return console.info("Note: error importing portal, defaulting to non-native portals", err), null;
|
|
19
20
|
}
|
|
20
21
|
}(), Portal = function(propsIn) {
|
|
21
|
-
var { stackZIndex, ...props } = propsIn, rootTag = React.useContext(RootTagContext), zIndex = useStackedZIndex(propsIn), contents = /* @__PURE__ */ _jsx(YStack, {
|
|
22
|
+
var { stackZIndex, ...props } = propsIn, rootTag = React.useContext(RootTagContext), zIndex = useStackedZIndex(getStackedZIndexProps(propsIn)), contents = /* @__PURE__ */ _jsx(YStack, {
|
|
22
23
|
pointerEvents: "box-none",
|
|
23
24
|
fullscreen: !0,
|
|
24
25
|
position: "absolute",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/Portal.native.tsx"],
|
|
4
|
-
"mappings": ";AAAA,SAASA,cAAc;AACvB,YAAYC,WAAW;AACvB,SAASC,sBAAsB;AAC/B,SAASC,WAAWC,yBAAyB;
|
|
5
|
-
"names": ["YStack", "React", "RootTagContext", "IS_FABRIC", "USE_NATIVE_PORTAL", "
|
|
4
|
+
"mappings": ";AAAA,SAASA,cAAc;AACvB,SAASC,wBAAwB;AACjC,YAAYC,WAAW;AACvB,SAASC,sBAAsB;AAC/B,SAASC,WAAWC,yBAAyB;AAC7C,SAASC,wBAAwB;AACjC,SAASC,6BAA6B;AAGtC,IAAMC,eAAgB,WAAA;AACpB,MAAIJ;AACF,QAAI;AACF,aAAOK,QAAQ,mDAAA,EAAqDD;IACtE,SAASE,KAAK;AACZC,qBAAQC,KAAK,kEAAkEF,GAAAA,GACxE;IACT;AAEF,MAAI;AACF,WAAOD,QAAQ,mDAAA,EAAqDD;EACtE,SAASE,KAAK;AACZC,mBAAQC,KAAK,kEAAkEF,GAAAA,GACxE;EACT;AACF,EAAA,GAEaG,SAAS,SAACC,SAAAA;AACrB,MAAM,EAAEC,aAAa,GAAGC,MAAAA,IAAUF,SAE5BG,UAAUf,MAAMgB,WAAWf,cAAAA,GAC3BgB,SAASlB,iBAAiBM,sBAAsBO,OAAAA,CAAAA,GAEhDM,WACJ,qBAACpB,QAAAA;IACCqB,eAAc;IACdC,YAAU;IACVC,UAAS;IACTC,UAAS;IACR,GAAGR;IACJG;;AAIJ,SAAI,CAACX,gBAAgB,CAACH,qBAAqB,CAACY,UACnC,qBAACX,kBAAAA;IAAiBmB,UAAS;cAAQL;OAGrCZ,aAAaY,UAAUH,OAAAA;AAChC;",
|
|
5
|
+
"names": ["YStack", "useStackedZIndex", "React", "RootTagContext", "IS_FABRIC", "USE_NATIVE_PORTAL", "GorhomPortalItem", "getStackedZIndexProps", "createPortal", "require", "err", "console", "info", "Portal", "propsIn", "stackZIndex", "props", "rootTag", "useContext", "zIndex", "contents", "pointerEvents", "fullscreen", "position", "maxWidth", "hostName"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getTokenValue } from "@tamagui/web";
|
|
2
|
+
const getStackedZIndexProps = (propsIn) => ({
|
|
3
|
+
stackZIndex: propsIn.stackZIndex,
|
|
4
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
5
|
+
}), resolveViewZIndex = (zIndex) => typeof zIndex > "u" || zIndex === "unset" ? void 0 : typeof zIndex == "number" ? zIndex : getTokenValue(zIndex, "zIndex");
|
|
6
|
+
export {
|
|
7
|
+
getStackedZIndexProps,
|
|
8
|
+
resolveViewZIndex
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/helpers.ts"],
|
|
4
|
+
"mappings": "AAAA,SAAS,qBAAqC;AAGvC,MAAM,wBAAwB,CAAC,aAC7B;AAAA,EACL,aAAa,QAAQ;AAAA,EACrB,QAAQ,kBAAkB,QAAQ,MAAM;AAC1C,IAGW,oBAAoB,CAAC,WACzB,OAAO,SAAW,OAAe,WAAW,UAC/C,SACA,OAAO,UAAW,WAChB,SACA,cAAc,QAAe,QAAQ;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getTokenValue } from "@tamagui/web";
|
|
2
|
+
const getStackedZIndexProps = propsIn => ({
|
|
3
|
+
stackZIndex: propsIn.stackZIndex,
|
|
4
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
5
|
+
}),
|
|
6
|
+
resolveViewZIndex = zIndex => typeof zIndex > "u" || zIndex === "unset" ? void 0 : typeof zIndex == "number" ? zIndex : getTokenValue(zIndex, "zIndex");
|
|
7
|
+
export { getStackedZIndexProps, resolveViewZIndex };
|
|
8
|
+
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getTokenValue","getStackedZIndexProps","propsIn","stackZIndex","zIndex","resolveViewZIndex"],"sources":["../../src/helpers.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,QAAqC;AAGvC,MAAMC,qBAAA,GAAyBC,OAAA,KAC7B;IACLC,WAAA,EAAaD,OAAA,CAAQC,WAAA;IACrBC,MAAA,EAAQC,iBAAA,CAAkBH,OAAA,CAAQE,MAAM;EAC1C;EAGWC,iBAAA,GAAqBD,MAAA,IACzB,OAAOA,MAAA,GAAW,OAAeA,MAAA,KAAW,UAC/C,SACA,OAAOA,MAAA,IAAW,WAChBA,MAAA,GACAJ,aAAA,CAAcI,MAAA,EAAe,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getTokenValue } from "@tamagui/web";
|
|
2
|
+
var getStackedZIndexProps = function(propsIn) {
|
|
3
|
+
return {
|
|
4
|
+
stackZIndex: propsIn.stackZIndex,
|
|
5
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
6
|
+
};
|
|
7
|
+
}, resolveViewZIndex = function(zIndex) {
|
|
8
|
+
return typeof zIndex > "u" || zIndex === "unset" ? void 0 : typeof zIndex == "number" ? zIndex : getTokenValue(zIndex, "zIndex");
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
getStackedZIndexProps,
|
|
12
|
+
resolveViewZIndex
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/helpers.ts"],
|
|
4
|
+
"mappings": "AAAA,SAASA,qBAAqC;AAGvC,IAAMC,wBAAwB,SAACC,SAAAA;AACpC,SAAO;IACLC,aAAaD,QAAQC;IACrBC,QAAQC,kBAAkBH,QAAQE,MAAM;EAC1C;AACF,GAEaC,oBAAoB,SAACD,QAAAA;AAChC,SAAO,OAAOA,SAAW,OAAeA,WAAW,UAC/CE,SACA,OAAOF,UAAW,WAChBA,SACAJ,cAAcI,QAAe,QAAA;AACrC;",
|
|
5
|
+
"names": ["getTokenValue", "getStackedZIndexProps", "propsIn", "stackZIndex", "zIndex", "resolveViewZIndex", "undefined"]
|
|
6
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,9 @@ export * from "./PortalProps";
|
|
|
3
3
|
export * from "./GorhomPortal";
|
|
4
4
|
import { GorhomPortalItem } from "./GorhomPortalItem";
|
|
5
5
|
export * from "./constants";
|
|
6
|
+
import { resolveViewZIndex } from "./helpers";
|
|
6
7
|
export {
|
|
7
|
-
GorhomPortalItem as PortalItem
|
|
8
|
+
GorhomPortalItem as PortalItem,
|
|
9
|
+
resolveViewZIndex
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -3,5 +3,6 @@ export * from "./PortalProps.mjs";
|
|
|
3
3
|
export * from "./GorhomPortal.mjs";
|
|
4
4
|
import { GorhomPortalItem } from "./GorhomPortalItem.mjs";
|
|
5
5
|
export * from "./constants.mjs";
|
|
6
|
-
|
|
6
|
+
import { resolveViewZIndex } from "./helpers.mjs";
|
|
7
|
+
export { GorhomPortalItem as PortalItem, resolveViewZIndex };
|
|
7
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GorhomPortalItem"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAA6BA,gBAAA,QAAkB;AAC/C,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GorhomPortalItem","resolveViewZIndex"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAA6BA,gBAAA,QAAkB;AAC/C,cAAc;AACd,SAASC,iBAAA,QAAyB","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -3,7 +3,9 @@ export * from "./PortalProps";
|
|
|
3
3
|
export * from "./GorhomPortal";
|
|
4
4
|
import { GorhomPortalItem } from "./GorhomPortalItem";
|
|
5
5
|
export * from "./constants";
|
|
6
|
+
import { resolveViewZIndex } from "./helpers";
|
|
6
7
|
export {
|
|
7
|
-
GorhomPortalItem as PortalItem
|
|
8
|
+
GorhomPortalItem as PortalItem,
|
|
9
|
+
resolveViewZIndex
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAA6BA,wBAAkB;AAC/C,cAAc;",
|
|
5
|
-
"names": ["PortalItem"]
|
|
4
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAA6BA,wBAAkB;AAC/C,cAAc;AACd,SAASC,yBAAyB;",
|
|
5
|
+
"names": ["PortalItem", "resolveViewZIndex"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/portal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.125.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tamagui/constants": "1.
|
|
36
|
-
"@tamagui/core": "1.
|
|
37
|
-
"@tamagui/stacks": "1.
|
|
38
|
-
"@tamagui/start-transition": "1.
|
|
39
|
-
"@tamagui/use-did-finish-ssr": "1.
|
|
40
|
-
"@tamagui/use-event": "1.
|
|
35
|
+
"@tamagui/constants": "1.125.0",
|
|
36
|
+
"@tamagui/core": "1.125.0",
|
|
37
|
+
"@tamagui/stacks": "1.125.0",
|
|
38
|
+
"@tamagui/start-transition": "1.125.0",
|
|
39
|
+
"@tamagui/use-did-finish-ssr": "1.125.0",
|
|
40
|
+
"@tamagui/use-event": "1.125.0",
|
|
41
|
+
"@tamagui/z-index-stack": "1.125.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@tamagui/build": "1.
|
|
44
|
+
"@tamagui/build": "1.125.0",
|
|
44
45
|
"@types/react-dom": "^19.0.3",
|
|
45
46
|
"react-native": "^0.76.5"
|
|
46
47
|
},
|
package/src/Portal.native.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { YStack } from '@tamagui/stacks'
|
|
2
|
+
import { useStackedZIndex } from '@tamagui/z-index-stack'
|
|
2
3
|
import * as React from 'react'
|
|
3
4
|
import { RootTagContext } from 'react-native'
|
|
4
5
|
import { IS_FABRIC, USE_NATIVE_PORTAL } from './constants'
|
|
5
|
-
import type { PortalProps } from './PortalProps'
|
|
6
|
-
import { useStackedZIndex } from './useStackedZIndex'
|
|
7
6
|
import { GorhomPortalItem } from './GorhomPortalItem'
|
|
7
|
+
import { getStackedZIndexProps } from './helpers'
|
|
8
|
+
import type { PortalProps } from './PortalProps'
|
|
8
9
|
|
|
9
10
|
const createPortal = (() => {
|
|
10
11
|
if (IS_FABRIC) {
|
|
@@ -27,7 +28,7 @@ export const Portal = (propsIn: PortalProps) => {
|
|
|
27
28
|
const { stackZIndex, ...props } = propsIn
|
|
28
29
|
|
|
29
30
|
const rootTag = React.useContext(RootTagContext)
|
|
30
|
-
const zIndex = useStackedZIndex(propsIn)
|
|
31
|
+
const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn))
|
|
31
32
|
|
|
32
33
|
const contents = (
|
|
33
34
|
<YStack
|
package/src/Portal.tsx
CHANGED
|
@@ -5,8 +5,9 @@ import { YStack } from '@tamagui/stacks'
|
|
|
5
5
|
import * as React from 'react'
|
|
6
6
|
import { createPortal } from 'react-dom'
|
|
7
7
|
|
|
8
|
+
import { useStackedZIndex } from '@tamagui/z-index-stack'
|
|
9
|
+
import { getStackedZIndexProps } from './helpers'
|
|
8
10
|
import type { PortalProps } from './PortalProps'
|
|
9
|
-
import { useStackedZIndex } from './useStackedZIndex'
|
|
10
11
|
|
|
11
12
|
// web only version
|
|
12
13
|
|
|
@@ -15,8 +16,8 @@ export const Portal = React.memo((propsIn: PortalProps) => {
|
|
|
15
16
|
return null
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
const { host = globalThis.document?.body, stackZIndex, ...props } = propsIn
|
|
19
|
-
const zIndex = useStackedZIndex(propsIn)
|
|
19
|
+
const { host = globalThis.document?.body, stackZIndex, children, ...props } = propsIn
|
|
20
|
+
const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn))
|
|
20
21
|
|
|
21
22
|
return createPortal(
|
|
22
23
|
<YStack
|
|
@@ -29,7 +30,9 @@ export const Portal = React.memo((propsIn: PortalProps) => {
|
|
|
29
30
|
pointerEvents="none"
|
|
30
31
|
{...props}
|
|
31
32
|
zIndex={zIndex}
|
|
32
|
-
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</YStack>,
|
|
33
36
|
host
|
|
34
37
|
) as any
|
|
35
38
|
})
|
package/src/PortalProps.tsx
CHANGED
package/src/helpers.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getTokenValue, type ViewProps } from '@tamagui/web'
|
|
2
|
+
import type { PortalProps } from './PortalProps'
|
|
3
|
+
|
|
4
|
+
export const getStackedZIndexProps = (propsIn: PortalProps) => {
|
|
5
|
+
return {
|
|
6
|
+
stackZIndex: propsIn.stackZIndex,
|
|
7
|
+
zIndex: resolveViewZIndex(propsIn.zIndex),
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const resolveViewZIndex = (zIndex: ViewProps['zIndex']) => {
|
|
12
|
+
return typeof zIndex === 'undefined' || zIndex === 'unset'
|
|
13
|
+
? undefined
|
|
14
|
+
: typeof zIndex === 'number'
|
|
15
|
+
? zIndex
|
|
16
|
+
: getTokenValue(zIndex as any, 'zIndex')
|
|
17
|
+
}
|
package/src/index.ts
CHANGED
package/types/Portal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAI9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAI9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAIhD,eAAO,MAAM,MAAM,sCAAwB,WAAW,SAwBpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.native.d.ts","sourceRoot":"","sources":["../src/Portal.native.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Portal.native.d.ts","sourceRoot":"","sources":["../src/Portal.native.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAmBhD,eAAO,MAAM,MAAM,YAAa,WAAW,QAsB1C,CAAA"}
|
package/types/PortalProps.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortalProps.d.ts","sourceRoot":"","sources":["../src/PortalProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"PortalProps.d.ts","sourceRoot":"","sources":["../src/PortalProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC/B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ViewProps } from '@tamagui/web';
|
|
2
|
+
import type { PortalProps } from './PortalProps';
|
|
3
|
+
export declare const getStackedZIndexProps: (propsIn: PortalProps) => {
|
|
4
|
+
stackZIndex: number | boolean | undefined;
|
|
5
|
+
zIndex: any;
|
|
6
|
+
};
|
|
7
|
+
export declare const resolveViewZIndex: (zIndex: ViewProps["zIndex"]) => any;
|
|
8
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,eAAO,MAAM,qBAAqB,YAAa,WAAW;;;CAKzD,CAAA;AAED,eAAO,MAAM,iBAAiB,WAAY,SAAS,CAAC,QAAQ,CAAC,QAM5D,CAAA"}
|
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACnE,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACnE,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: !0
|
|
9
|
-
});
|
|
10
|
-
},
|
|
11
|
-
__copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
-
get: () => from[key],
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value: !0
|
|
20
|
-
}), mod);
|
|
21
|
-
var useStackedZIndex_exports = {};
|
|
22
|
-
__export(useStackedZIndex_exports, {
|
|
23
|
-
useStackedZIndex: () => useStackedZIndex
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(useStackedZIndex_exports);
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
const CurrentPortalZIndices = {},
|
|
28
|
-
useStackedZIndex = props => {
|
|
29
|
-
const {
|
|
30
|
-
stackZIndex,
|
|
31
|
-
zIndex: zIndexProp = 1e3
|
|
32
|
-
} = props,
|
|
33
|
-
id = (0, import_react.useId)(),
|
|
34
|
-
zIndex = (0, import_react.useMemo)(() => {
|
|
35
|
-
if (stackZIndex) {
|
|
36
|
-
const highest = Object.values(CurrentPortalZIndices).reduce((acc, cur) => Math.max(acc, cur), 0);
|
|
37
|
-
return Math.max(stackZIndex, highest + 1);
|
|
38
|
-
}
|
|
39
|
-
if (zIndexProp) return zIndexProp;
|
|
40
|
-
}, [stackZIndex]);
|
|
41
|
-
return (0, import_react.useEffect)(() => {
|
|
42
|
-
if (typeof stackZIndex == "number") return CurrentPortalZIndices[id] = stackZIndex, () => {
|
|
43
|
-
delete CurrentPortalZIndices[id];
|
|
44
|
-
};
|
|
45
|
-
}, [stackZIndex]), zIndex;
|
|
46
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var useStackedZIndex_exports = {};
|
|
16
|
-
__export(useStackedZIndex_exports, {
|
|
17
|
-
useStackedZIndex: () => useStackedZIndex
|
|
18
|
-
});
|
|
19
|
-
module.exports = __toCommonJS(useStackedZIndex_exports);
|
|
20
|
-
var import_react = require("react");
|
|
21
|
-
const CurrentPortalZIndices = {}, useStackedZIndex = (props) => {
|
|
22
|
-
const { stackZIndex, zIndex: zIndexProp = 1e3 } = props, id = (0, import_react.useId)(), zIndex = (0, import_react.useMemo)(() => {
|
|
23
|
-
if (stackZIndex) {
|
|
24
|
-
const highest = Object.values(CurrentPortalZIndices).reduce(
|
|
25
|
-
(acc, cur) => Math.max(acc, cur),
|
|
26
|
-
0
|
|
27
|
-
);
|
|
28
|
-
return Math.max(stackZIndex, highest + 1);
|
|
29
|
-
}
|
|
30
|
-
if (zIndexProp)
|
|
31
|
-
return zIndexProp;
|
|
32
|
-
}, [stackZIndex]);
|
|
33
|
-
return (0, import_react.useEffect)(() => {
|
|
34
|
-
if (typeof stackZIndex == "number")
|
|
35
|
-
return CurrentPortalZIndices[id] = stackZIndex, () => {
|
|
36
|
-
delete CurrentPortalZIndices[id];
|
|
37
|
-
};
|
|
38
|
-
}, [stackZIndex]), zIndex;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=useStackedZIndex.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useStackedZIndex.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAG1C,MAAM,wBAAgD,CAAC,GAE1C,mBAAmB,CAAC,UAAuD;AACtF,QAAM,EAAE,aAAa,QAAQ,aAAa,IAAK,IAAI,OAC7C,SAAK,oBAAM,GAEX,aAAS,sBAAQ,MAAM;AAC3B,QAAI,aAAa;AACf,YAAM,UAAU,OAAO,OAAO,qBAAqB,EAAE;AAAA,QACnD,CAAC,KAAK,QAAQ,KAAK,IAAI,KAAK,GAAG;AAAA,QAC/B;AAAA,MACF;AACA,aAAO,KAAK,IAAI,aAAa,UAAU,CAAC;AAAA,IAC1C;AACA,QAAI;AACF,aAAO;AAAA,EAEX,GAAG,CAAC,WAAW,CAAC;AAEhB,qCAAU,MAAM;AACd,QAAI,OAAO,eAAgB;AACzB,mCAAsB,EAAE,IAAI,aACrB,MAAM;AACX,eAAO,sBAAsB,EAAE;AAAA,MACjC;AAAA,EAEJ,GAAG,CAAC,WAAW,CAAC,GAET;AACT;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var useStackedZIndex_exports = {};
|
|
17
|
-
__export(useStackedZIndex_exports, {
|
|
18
|
-
useStackedZIndex: () => useStackedZIndex
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(useStackedZIndex_exports);
|
|
21
|
-
var import_react = require("react"), CurrentPortalZIndices = {}, useStackedZIndex = function(props) {
|
|
22
|
-
var { stackZIndex, zIndex: zIndexProp = 1e3 } = props, id = (0, import_react.useId)(), zIndex = (0, import_react.useMemo)(function() {
|
|
23
|
-
if (stackZIndex) {
|
|
24
|
-
var highest = Object.values(CurrentPortalZIndices).reduce(function(acc, cur) {
|
|
25
|
-
return Math.max(acc, cur);
|
|
26
|
-
}, 0);
|
|
27
|
-
return Math.max(stackZIndex, highest + 1);
|
|
28
|
-
}
|
|
29
|
-
if (zIndexProp)
|
|
30
|
-
return zIndexProp;
|
|
31
|
-
}, [
|
|
32
|
-
stackZIndex
|
|
33
|
-
]);
|
|
34
|
-
return (0, import_react.useEffect)(function() {
|
|
35
|
-
if (typeof stackZIndex == "number")
|
|
36
|
-
return CurrentPortalZIndices[id] = stackZIndex, function() {
|
|
37
|
-
delete CurrentPortalZIndices[id];
|
|
38
|
-
};
|
|
39
|
-
}, [
|
|
40
|
-
stackZIndex
|
|
41
|
-
]), zIndex;
|
|
42
|
-
};
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
useStackedZIndex
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=useStackedZIndex.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/useStackedZIndex.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;mBAA0C,kBAGpCA,wBAAgD,CAAC,GAE1CC,mBAAmB,SAACC,OAAAA;AAC/B,MAAM,EAAEC,aAAaC,QAAQC,aAAa,IAAI,IAAKH,OAC7CI,SAAKC,oBAAAA,GAELH,aAASI,sBAAQ,WAAA;AACrB,QAAIL,aAAa;AACf,UAAMM,UAAUC,OAAOC,OAAOX,qBAAAA,EAAuBY,OACnD,SAACC,KAAKC,KAAAA;eAAQC,KAAKC,IAAIH,KAAKC,GAAAA;SAC5B,CAAA;AAEF,aAAOC,KAAKC,IAAIb,aAAaM,UAAU,CAAA;IACzC;AACA,QAAIJ;AACF,aAAOA;EAEX,GAAG;IAACF;GAAY;AAEhBc,qCAAU,WAAA;AACR,QAAI,OAAOd,eAAgB;AACzBH,mCAAsBM,EAAAA,IAAMH,aACrB,WAAA;AACL,eAAOH,sBAAsBM,EAAAA;MAC/B;EAEJ,GAAG;IAACH;GAAY,GAETC;AACT;",
|
|
5
|
-
"names": ["CurrentPortalZIndices", "useStackedZIndex", "props", "stackZIndex", "zIndex", "zIndexProp", "id", "useId", "useMemo", "highest", "Object", "values", "reduce", "acc", "cur", "Math", "max", "useEffect"]
|
|
6
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useMemo } from "react";
|
|
2
|
-
const CurrentPortalZIndices = {}, useStackedZIndex = (props) => {
|
|
3
|
-
const { stackZIndex, zIndex: zIndexProp = 1e3 } = props, id = useId(), zIndex = useMemo(() => {
|
|
4
|
-
if (stackZIndex) {
|
|
5
|
-
const highest = Object.values(CurrentPortalZIndices).reduce(
|
|
6
|
-
(acc, cur) => Math.max(acc, cur),
|
|
7
|
-
0
|
|
8
|
-
);
|
|
9
|
-
return Math.max(stackZIndex, highest + 1);
|
|
10
|
-
}
|
|
11
|
-
if (zIndexProp)
|
|
12
|
-
return zIndexProp;
|
|
13
|
-
}, [stackZIndex]);
|
|
14
|
-
return useEffect(() => {
|
|
15
|
-
if (typeof stackZIndex == "number")
|
|
16
|
-
return CurrentPortalZIndices[id] = stackZIndex, () => {
|
|
17
|
-
delete CurrentPortalZIndices[id];
|
|
18
|
-
};
|
|
19
|
-
}, [stackZIndex]), zIndex;
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
useStackedZIndex
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=useStackedZIndex.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useStackedZIndex.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,WAAW,OAAO,eAAe;AAG1C,MAAM,wBAAgD,CAAC,GAE1C,mBAAmB,CAAC,UAAuD;AACtF,QAAM,EAAE,aAAa,QAAQ,aAAa,IAAK,IAAI,OAC7C,KAAK,MAAM,GAEX,SAAS,QAAQ,MAAM;AAC3B,QAAI,aAAa;AACf,YAAM,UAAU,OAAO,OAAO,qBAAqB,EAAE;AAAA,QACnD,CAAC,KAAK,QAAQ,KAAK,IAAI,KAAK,GAAG;AAAA,QAC/B;AAAA,MACF;AACA,aAAO,KAAK,IAAI,aAAa,UAAU,CAAC;AAAA,IAC1C;AACA,QAAI;AACF,aAAO;AAAA,EAEX,GAAG,CAAC,WAAW,CAAC;AAEhB,mBAAU,MAAM;AACd,QAAI,OAAO,eAAgB;AACzB,mCAAsB,EAAE,IAAI,aACrB,MAAM;AACX,eAAO,sBAAsB,EAAE;AAAA,MACjC;AAAA,EAEJ,GAAG,CAAC,WAAW,CAAC,GAET;AACT;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useMemo } from "react";
|
|
2
|
-
const CurrentPortalZIndices = {},
|
|
3
|
-
useStackedZIndex = props => {
|
|
4
|
-
const {
|
|
5
|
-
stackZIndex,
|
|
6
|
-
zIndex: zIndexProp = 1e3
|
|
7
|
-
} = props,
|
|
8
|
-
id = useId(),
|
|
9
|
-
zIndex = useMemo(() => {
|
|
10
|
-
if (stackZIndex) {
|
|
11
|
-
const highest = Object.values(CurrentPortalZIndices).reduce((acc, cur) => Math.max(acc, cur), 0);
|
|
12
|
-
return Math.max(stackZIndex, highest + 1);
|
|
13
|
-
}
|
|
14
|
-
if (zIndexProp) return zIndexProp;
|
|
15
|
-
}, [stackZIndex]);
|
|
16
|
-
return useEffect(() => {
|
|
17
|
-
if (typeof stackZIndex == "number") return CurrentPortalZIndices[id] = stackZIndex, () => {
|
|
18
|
-
delete CurrentPortalZIndices[id];
|
|
19
|
-
};
|
|
20
|
-
}, [stackZIndex]), zIndex;
|
|
21
|
-
};
|
|
22
|
-
export { useStackedZIndex };
|
|
23
|
-
//# sourceMappingURL=useStackedZIndex.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useId","useMemo","CurrentPortalZIndices","useStackedZIndex","props","stackZIndex","zIndex","zIndexProp","id","highest","Object","values","reduce","acc","cur","Math","max"],"sources":["../../src/useStackedZIndex.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAA,EAAWC,KAAA,EAAOC,OAAA,QAAe;AAG1C,MAAMC,qBAAA,GAAgD,CAAC;EAE1CC,gBAAA,GAAoBC,KAAA,IAAuD;IACtF,MAAM;QAAEC,WAAA;QAAaC,MAAA,EAAQC,UAAA,GAAa;MAAK,IAAIH,KAAA;MAC7CI,EAAA,GAAKR,KAAA,CAAM;MAEXM,MAAA,GAASL,OAAA,CAAQ,MAAM;QAC3B,IAAII,WAAA,EAAa;UACf,MAAMI,OAAA,GAAUC,MAAA,CAAOC,MAAA,CAAOT,qBAAqB,EAAEU,MAAA,CACnD,CAACC,GAAA,EAAKC,GAAA,KAAQC,IAAA,CAAKC,GAAA,CAAIH,GAAA,EAAKC,GAAG,GAC/B,CACF;UACA,OAAOC,IAAA,CAAKC,GAAA,CAAIX,WAAA,EAAaI,OAAA,GAAU,CAAC;QAC1C;QACA,IAAIF,UAAA,EACF,OAAOA,UAAA;MAEX,GAAG,CAACF,WAAW,CAAC;IAEhB,OAAAN,SAAA,CAAU,MAAM;MACd,IAAI,OAAOM,WAAA,IAAgB,UACzB,OAAAH,qBAAA,CAAsBM,EAAE,IAAIH,WAAA,EACrB,MAAM;QACX,OAAOH,qBAAA,CAAsBM,EAAE;MACjC;IAEJ,GAAG,CAACH,WAAW,CAAC,GAETC,MAAA;EACT","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useMemo } from "react";
|
|
2
|
-
var CurrentPortalZIndices = {}, useStackedZIndex = function(props) {
|
|
3
|
-
var { stackZIndex, zIndex: zIndexProp = 1e3 } = props, id = useId(), zIndex = useMemo(function() {
|
|
4
|
-
if (stackZIndex) {
|
|
5
|
-
var highest = Object.values(CurrentPortalZIndices).reduce(function(acc, cur) {
|
|
6
|
-
return Math.max(acc, cur);
|
|
7
|
-
}, 0);
|
|
8
|
-
return Math.max(stackZIndex, highest + 1);
|
|
9
|
-
}
|
|
10
|
-
if (zIndexProp)
|
|
11
|
-
return zIndexProp;
|
|
12
|
-
}, [
|
|
13
|
-
stackZIndex
|
|
14
|
-
]);
|
|
15
|
-
return useEffect(function() {
|
|
16
|
-
if (typeof stackZIndex == "number")
|
|
17
|
-
return CurrentPortalZIndices[id] = stackZIndex, function() {
|
|
18
|
-
delete CurrentPortalZIndices[id];
|
|
19
|
-
};
|
|
20
|
-
}, [
|
|
21
|
-
stackZIndex
|
|
22
|
-
]), zIndex;
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
useStackedZIndex
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=useStackedZIndex.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Users/n8/tamagui/code/ui/portal/src/useStackedZIndex.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAASA,WAAWC,OAAOC,eAAe;AAG1C,IAAMC,wBAAgD,CAAC,GAE1CC,mBAAmB,SAACC,OAAAA;AAC/B,MAAM,EAAEC,aAAaC,QAAQC,aAAa,IAAI,IAAKH,OAC7CI,KAAKR,MAAAA,GAELM,SAASL,QAAQ,WAAA;AACrB,QAAII,aAAa;AACf,UAAMI,UAAUC,OAAOC,OAAOT,qBAAAA,EAAuBU,OACnD,SAACC,KAAKC,KAAAA;eAAQC,KAAKC,IAAIH,KAAKC,GAAAA;SAC5B,CAAA;AAEF,aAAOC,KAAKC,IAAIX,aAAaI,UAAU,CAAA;IACzC;AACA,QAAIF;AACF,aAAOA;EAEX,GAAG;IAACF;GAAY;AAEhBN,mBAAU,WAAA;AACR,QAAI,OAAOM,eAAgB;AACzBH,mCAAsBM,EAAAA,IAAMH,aACrB,WAAA;AACL,eAAOH,sBAAsBM,EAAAA;MAC/B;EAEJ,GAAG;IAACH;GAAY,GAETC;AACT;",
|
|
5
|
-
"names": ["useEffect", "useId", "useMemo", "CurrentPortalZIndices", "useStackedZIndex", "props", "stackZIndex", "zIndex", "zIndexProp", "id", "highest", "Object", "values", "reduce", "acc", "cur", "Math", "max"]
|
|
6
|
-
}
|
package/src/useStackedZIndex.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useMemo } from 'react'
|
|
2
|
-
import type { PortalProps } from './PortalProps'
|
|
3
|
-
|
|
4
|
-
const CurrentPortalZIndices: Record<string, number> = {}
|
|
5
|
-
|
|
6
|
-
export const useStackedZIndex = (props: Pick<PortalProps, 'zIndex' | 'stackZIndex'>) => {
|
|
7
|
-
const { stackZIndex, zIndex: zIndexProp = 1000 } = props
|
|
8
|
-
const id = useId()
|
|
9
|
-
|
|
10
|
-
const zIndex = useMemo(() => {
|
|
11
|
-
if (stackZIndex) {
|
|
12
|
-
const highest = Object.values(CurrentPortalZIndices).reduce(
|
|
13
|
-
(acc, cur) => Math.max(acc, cur),
|
|
14
|
-
0
|
|
15
|
-
)
|
|
16
|
-
return Math.max(stackZIndex, highest + 1)
|
|
17
|
-
}
|
|
18
|
-
if (zIndexProp) {
|
|
19
|
-
return zIndexProp
|
|
20
|
-
}
|
|
21
|
-
}, [stackZIndex])
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (typeof stackZIndex === 'number') {
|
|
25
|
-
CurrentPortalZIndices[id] = stackZIndex
|
|
26
|
-
return () => {
|
|
27
|
-
delete CurrentPortalZIndices[id]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}, [stackZIndex])
|
|
31
|
-
|
|
32
|
-
return zIndex
|
|
33
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { PortalProps } from './PortalProps';
|
|
2
|
-
export declare const useStackedZIndex: (props: Pick<PortalProps, "zIndex" | "stackZIndex">) => number | "unset" | import("@tamagui/web").UnionableString | import("@tamagui/web").Variable<any> | undefined;
|
|
3
|
-
//# sourceMappingURL=useStackedZIndex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStackedZIndex.d.ts","sourceRoot":"","sources":["../src/useStackedZIndex.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAIhD,eAAO,MAAM,gBAAgB,UAAW,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,aAAa,CAAC,iHA2BlF,CAAA"}
|