@tamagui/portal 2.7.7 → 3.0.0-beta.643.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/GorhomPortal.cjs +132 -164
- package/dist/cjs/GorhomPortal.native.cjs +202 -0
- package/dist/cjs/GorhomPortal.native.js +166 -211
- package/dist/cjs/GorhomPortal.native.js.map +1 -1
- package/dist/cjs/GorhomPortalItem.cjs +58 -58
- package/dist/cjs/GorhomPortalItem.native.cjs +105 -0
- package/dist/cjs/GorhomPortalItem.native.js +85 -106
- package/dist/cjs/GorhomPortalItem.native.js.map +1 -1
- package/dist/cjs/Portal.cjs +52 -60
- package/dist/cjs/Portal.native.cjs +57 -0
- package/dist/cjs/Portal.native.js +39 -44
- package/dist/cjs/Portal.native.js.map +1 -1
- package/dist/cjs/PortalProps.cjs +10 -11
- package/dist/cjs/PortalProps.native.cjs +19 -0
- package/dist/cjs/PortalProps.native.js +10 -10
- package/dist/cjs/PortalProps.native.js.map +1 -1
- package/dist/cjs/constants.cjs +24 -25
- package/dist/cjs/constants.native.cjs +44 -0
- package/dist/cjs/constants.native.js +26 -26
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/helpers.cjs +23 -24
- package/dist/cjs/helpers.native.cjs +39 -0
- package/dist/cjs/helpers.native.js +23 -23
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/index.cjs +16 -17
- package/dist/cjs/index.native.cjs +36 -0
- package/dist/cjs/index.native.js +16 -16
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/native-portal.cjs +32 -35
- package/dist/cjs/native-portal.native.cjs +51 -0
- package/dist/cjs/native-portal.native.js +37 -39
- package/dist/cjs/native-portal.native.js.map +1 -1
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/GorhomPortal.mjs +112 -136
- package/dist/esm/GorhomPortal.mjs.map +1 -1
- package/dist/esm/GorhomPortal.native.js +146 -184
- package/dist/esm/GorhomPortal.native.js.map +1 -1
- package/dist/esm/GorhomPortalItem.mjs +46 -41
- package/dist/esm/GorhomPortalItem.mjs.map +1 -1
- package/dist/esm/GorhomPortalItem.native.js +74 -91
- package/dist/esm/GorhomPortalItem.native.js.map +1 -1
- package/dist/esm/Portal.mjs +38 -36
- package/dist/esm/Portal.mjs.map +1 -1
- package/dist/esm/Portal.native.js +28 -29
- package/dist/esm/Portal.native.js.map +1 -1
- package/dist/esm/PortalProps.mjs +0 -2
- package/dist/esm/PortalProps.native.js +0 -2
- package/dist/esm/constants.mjs +8 -6
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +10 -8
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/helpers.mjs +9 -7
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/helpers.native.js +9 -7
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.js +10 -6
- package/dist/esm/index.mjs +10 -6
- package/dist/esm/index.native.js +10 -6
- package/dist/esm/native-portal.mjs +23 -17
- package/dist/esm/native-portal.mjs.map +1 -1
- package/dist/esm/native-portal.native.js +28 -22
- package/dist/esm/native-portal.native.js.map +1 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/package.json +11 -10
- package/src/GorhomPortalItem.tsx +11 -2
- package/src/Portal.tsx +31 -7
- package/src/PortalProps.tsx +7 -0
- package/types/GorhomPortal.d.ts +3 -2
- package/types/GorhomPortal.d.ts.map +1 -1
- package/types/GorhomPortalItem.d.ts.map +1 -1
- package/types/GorhomPortalItem.native.d.ts +1 -1
- package/types/GorhomPortalItem.native.d.ts.map +1 -1
- package/types/Portal.d.ts.map +1 -1
- package/types/Portal.native.d.ts +1 -1
- package/types/Portal.native.d.ts.map +1 -1
- package/types/PortalProps.d.ts +7 -1
- package/types/PortalProps.d.ts.map +1 -1
- package/types/helpers.d.ts +1 -1
- package/types/helpers.d.ts.map +1 -1
- package/dist/esm/PortalProps.mjs.map +0 -1
- package/dist/esm/PortalProps.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
|
@@ -1,100 +1,83 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
3
3
|
import { useEvent } from "@tamagui/core";
|
|
4
|
-
import {
|
|
4
|
+
import { NativePortal, getPortal } from "@tamagui/native";
|
|
5
5
|
import { Theme, useThemeName } from "@tamagui/web";
|
|
6
6
|
import { useEffect, useId } from "react";
|
|
7
7
|
import { usePortal } from "./GorhomPortal.native.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
hostName,
|
|
31
|
-
handleOnMount: _providedHandleOnMount,
|
|
32
|
-
handleOnUnmount: _providedHandleOnUnmount,
|
|
33
|
-
handleOnUpdate: _providedHandleOnUpdate,
|
|
34
|
-
passThrough,
|
|
35
|
-
children
|
|
36
|
-
});
|
|
8
|
+
|
|
9
|
+
var GorhomPortalItem = function(props) {
|
|
10
|
+
var { name: _providedName, hostName = "root", handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passThrough } = props;
|
|
11
|
+
var portalState = getPortal().state;
|
|
12
|
+
if (portalState.type === "teleport") {
|
|
13
|
+
if (passThrough) {
|
|
14
|
+
return children;
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ jsx(NativePortal, {
|
|
17
|
+
hostName,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ jsx(GorhomPortalItemFallback, {
|
|
22
|
+
name: _providedName,
|
|
23
|
+
hostName,
|
|
24
|
+
handleOnMount: _providedHandleOnMount,
|
|
25
|
+
handleOnUnmount: _providedHandleOnUnmount,
|
|
26
|
+
handleOnUpdate: _providedHandleOnUpdate,
|
|
27
|
+
passThrough,
|
|
28
|
+
children
|
|
29
|
+
});
|
|
37
30
|
};
|
|
38
|
-
var GorhomPortalItemFallback = function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (passThrough) return;
|
|
88
|
-
handleOnMount();
|
|
89
|
-
return function () {
|
|
90
|
-
handleOnUnmount();
|
|
91
|
-
};
|
|
92
|
-
}, []);
|
|
93
|
-
useEffect(function () {
|
|
94
|
-
if (passThrough) return;
|
|
95
|
-
handleOnUpdate();
|
|
96
|
-
}, [children, themeName]);
|
|
97
|
-
return passThrough ? children : null;
|
|
31
|
+
var GorhomPortalItemFallback = function(props) {
|
|
32
|
+
var { name: _providedName, hostName, handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passThrough } = props;
|
|
33
|
+
var { addPortal: addUpdatePortal, removePortal } = usePortal(hostName);
|
|
34
|
+
var id = useId();
|
|
35
|
+
var name = _providedName || id;
|
|
36
|
+
var themeName = useThemeName();
|
|
37
|
+
var themedChildren = passThrough ? children : /* @__PURE__ */ jsx(Theme, {
|
|
38
|
+
name: themeName,
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
var handleOnMount = useEvent(function() {
|
|
42
|
+
if (_providedHandleOnMount) {
|
|
43
|
+
_providedHandleOnMount(function() {
|
|
44
|
+
return addUpdatePortal(name, themedChildren);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
addUpdatePortal(name, themedChildren);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var handleOnUnmount = useEvent(function() {
|
|
51
|
+
if (_providedHandleOnUnmount) {
|
|
52
|
+
_providedHandleOnUnmount(function() {
|
|
53
|
+
return removePortal(name);
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
removePortal(name);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
var handleOnUpdate = useEvent(function() {
|
|
60
|
+
if (_providedHandleOnUpdate) {
|
|
61
|
+
_providedHandleOnUpdate(function() {
|
|
62
|
+
return addUpdatePortal(name, themedChildren);
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
addUpdatePortal(name, themedChildren);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
useIsomorphicLayoutEffect(function() {
|
|
69
|
+
if (passThrough) return;
|
|
70
|
+
handleOnMount();
|
|
71
|
+
return function() {
|
|
72
|
+
handleOnUnmount();
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
useEffect(function() {
|
|
76
|
+
if (passThrough) return;
|
|
77
|
+
handleOnUpdate();
|
|
78
|
+
}, [children, themeName]);
|
|
79
|
+
return passThrough ? children : null;
|
|
98
80
|
};
|
|
81
|
+
|
|
99
82
|
export { GorhomPortalItem };
|
|
100
83
|
//# sourceMappingURL=GorhomPortalItem.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"GorhomPortalItem.native.js","names":[],"sources":["esm/GorhomPortalItem.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { useEvent } from \"@tamagui/core\";\nimport { getPortal, NativePortal } from \"@tamagui/native\";\nimport { Theme, useThemeName } from \"@tamagui/web\";\nimport { useEffect, useId } from \"react\";\nimport { usePortal } from \"./GorhomPortal\";\nvar GorhomPortalItem = function(props) {\n var { name: _providedName, hostName = \"root\", handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passThrough } = props;\n var portalState = getPortal().state;\n if (portalState.type === \"teleport\") {\n if (passThrough) {\n return children;\n }\n return /* @__PURE__ */ _jsx(NativePortal, {\n hostName,\n children\n });\n }\n return /* @__PURE__ */ _jsx(GorhomPortalItemFallback, {\n name: _providedName,\n hostName,\n handleOnMount: _providedHandleOnMount,\n handleOnUnmount: _providedHandleOnUnmount,\n handleOnUpdate: _providedHandleOnUpdate,\n passThrough,\n children\n });\n};\nvar GorhomPortalItemFallback = function(props) {\n var { name: _providedName, hostName, handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passThrough } = props;\n var { addPortal: addUpdatePortal, removePortal } = usePortal(hostName);\n var id = useId();\n var name = _providedName || id;\n var themeName = useThemeName();\n var themedChildren = passThrough ? children : /* @__PURE__ */ _jsx(Theme, {\n name: themeName,\n children\n });\n var handleOnMount = useEvent(function() {\n if (_providedHandleOnMount) {\n _providedHandleOnMount(function() {\n return addUpdatePortal(name, themedChildren);\n });\n } else {\n addUpdatePortal(name, themedChildren);\n }\n });\n var handleOnUnmount = useEvent(function() {\n if (_providedHandleOnUnmount) {\n _providedHandleOnUnmount(function() {\n return removePortal(name);\n });\n } else {\n removePortal(name);\n }\n });\n var handleOnUpdate = useEvent(function() {\n if (_providedHandleOnUpdate) {\n _providedHandleOnUpdate(function() {\n return addUpdatePortal(name, themedChildren);\n });\n } else {\n addUpdatePortal(name, themedChildren);\n }\n });\n useIsomorphicLayoutEffect(function() {\n if (passThrough) return;\n handleOnMount();\n return function() {\n handleOnUnmount();\n };\n }, []);\n useEffect(function() {\n if (passThrough) return;\n handleOnUpdate();\n }, [\n children,\n themeName\n ]);\n return passThrough ? children : null;\n};\nexport {\n GorhomPortalItem\n};\n//# sourceMappingURL=GorhomPortalItem.native.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,mBAAmB,SAAS,OAAO;CACrC,IAAI,EAAE,MAAM,eAAe,WAAW,QAAQ,eAAe,wBAAwB,iBAAiB,0BAA0B,gBAAgB,yBAAyB,UAAU,gBAAgB;CACnM,IAAI,cAAc,UAAU,EAAE;CAC9B,IAAI,YAAY,SAAS,YAAY;EACnC,IAAI,aAAa;GACf,OAAO;EACT;EACA,OAAuB,oBAAK,cAAc;GACxC;GACA;EACF,CAAC;CACH;CACA,OAAuB,oBAAK,0BAA0B;EACpD,MAAM;EACN;EACA,eAAe;EACf,iBAAiB;EACjB,gBAAgB;EAChB;EACA;CACF,CAAC;AACH;AACA,IAAI,2BAA2B,SAAS,OAAO;CAC7C,IAAI,EAAE,MAAM,eAAe,UAAU,eAAe,wBAAwB,iBAAiB,0BAA0B,gBAAgB,yBAAyB,UAAU,gBAAgB;CAC1L,IAAI,EAAE,WAAW,iBAAiB,iBAAiB,UAAU,QAAQ;CACrE,IAAI,KAAK,MAAM;CACf,IAAI,OAAO,iBAAiB;CAC5B,IAAI,YAAY,aAAa;CAC7B,IAAI,iBAAiB,cAAc,WAA2B,oBAAK,OAAO;EACxE,MAAM;EACN;CACF,CAAC;CACD,IAAI,gBAAgB,SAAS,WAAW;EACtC,IAAI,wBAAwB;GAC1B,uBAAuB,WAAW;IAChC,OAAO,gBAAgB,MAAM,cAAc;GAC7C,CAAC;EACH,OAAO;GACL,gBAAgB,MAAM,cAAc;EACtC;CACF,CAAC;CACD,IAAI,kBAAkB,SAAS,WAAW;EACxC,IAAI,0BAA0B;GAC5B,yBAAyB,WAAW;IAClC,OAAO,aAAa,IAAI;GAC1B,CAAC;EACH,OAAO;GACL,aAAa,IAAI;EACnB;CACF,CAAC;CACD,IAAI,iBAAiB,SAAS,WAAW;EACvC,IAAI,yBAAyB;GAC3B,wBAAwB,WAAW;IACjC,OAAO,gBAAgB,MAAM,cAAc;GAC7C,CAAC;EACH,OAAO;GACL,gBAAgB,MAAM,cAAc;EACtC;CACF,CAAC;CACD,0BAA0B,WAAW;EACnC,IAAI,aAAa;EACjB,cAAc;EACd,OAAO,WAAW;GAChB,gBAAgB;EAClB;CACF,GAAG,CAAC,CAAC;CACL,UAAU,WAAW;EACnB,IAAI,aAAa;EACjB,eAAe;CACjB,GAAG,CACD,UACA,SACF,CAAC;CACD,OAAO,cAAc,WAAW;AAClC"}
|
package/dist/esm/Portal.mjs
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { TamaguiRoot, useDidFinishSSR,
|
|
2
|
-
import {
|
|
1
|
+
import { TamaguiRoot, Theme, useDidFinishSSR, usePortalThemeState } from "@tamagui/web";
|
|
2
|
+
import { ZIndexHardcodedContext, useStackedZIndex } from "@tamagui/z-index-stack";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { getStackedZIndexProps } from "./helpers.mjs";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
7
|
+
|
|
8
|
+
const Portal = React.memo((propsIn) => {
|
|
9
|
+
const { children, passThrough, style, open, hidden } = propsIn;
|
|
10
|
+
const { name: themeName, layers: themeLayers } = usePortalThemeState();
|
|
11
|
+
const didHydrate = useDidFinishSSR();
|
|
12
|
+
const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
13
|
+
if (passThrough) {
|
|
14
|
+
return children;
|
|
15
|
+
}
|
|
16
|
+
if (!didHydrate) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return createPortal(/* @__PURE__ */ jsx(TamaguiRoot, {
|
|
20
|
+
theme: themeName,
|
|
21
|
+
style: {
|
|
22
|
+
zIndex,
|
|
23
|
+
position: "fixed",
|
|
24
|
+
inset: 0,
|
|
25
|
+
contain: "strict",
|
|
26
|
+
pointerEvents: open ? "auto" : "none",
|
|
27
|
+
visibility: hidden ? "hidden" : void 0,
|
|
28
|
+
touchAction: "none",
|
|
29
|
+
display: "flex",
|
|
30
|
+
...style
|
|
31
|
+
},
|
|
32
|
+
children: themeLayers.reduceRight((node, layer, index) => /* @__PURE__ */ jsx(Theme, {
|
|
33
|
+
forceClassName: true,
|
|
34
|
+
inlineValues: layer.inlineValues,
|
|
35
|
+
inlineClassName: layer.inlineClassName,
|
|
36
|
+
children: node
|
|
37
|
+
}, index), /* @__PURE__ */ jsx(ZIndexHardcodedContext.Provider, {
|
|
38
|
+
value: zIndex,
|
|
39
|
+
children
|
|
40
|
+
}))
|
|
41
|
+
}), globalThis.document?.body);
|
|
41
42
|
});
|
|
43
|
+
|
|
42
44
|
export { Portal };
|
|
43
45
|
//# sourceMappingURL=Portal.mjs.map
|
package/dist/esm/Portal.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Portal.js","names":[],"sources":["esm/Portal.js"],"sourcesContent":["\nimport { TamaguiRoot, Theme, useDidFinishSSR, usePortalThemeState } from \"@tamagui/web\";\nimport { useStackedZIndex, ZIndexHardcodedContext } from \"@tamagui/z-index-stack\";\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getStackedZIndexProps } from \"./helpers\";\nimport { jsx } from \"react/jsx-runtime\";\nconst Portal = React.memo((propsIn) => {\n const { children, passThrough, style, open, hidden } = propsIn;\n const { name: themeName, layers: themeLayers } = usePortalThemeState();\n const didHydrate = useDidFinishSSR();\n const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));\n if (passThrough) {\n return children;\n }\n if (!didHydrate) {\n return null;\n }\n return createPortal(\n /* @__PURE__ */ jsx(\n TamaguiRoot,\n {\n theme: themeName,\n style: {\n zIndex,\n position: \"fixed\",\n inset: 0,\n contain: \"strict\",\n pointerEvents: open ? \"auto\" : \"none\",\n // ios 26 safari colors the status-bar strip by hit-testing the top edge\n // of the viewport: a full-viewport fixed host whose children are all\n // invisible (opacity 0) samples as a solid white bar. visibility:hidden\n // boxes are never hit-tested, and unlike display:none they keep layout,\n // so closed-but-mounted content can still be measured. consumers pass\n // hidden while closed AND not animating out (a childless host is\n // already exempt from sampling, so default undefined is fine).\n visibility: hidden ? \"hidden\" : void 0,\n // prevent mobile browser from scrolling/moving this fixed element\n touchAction: \"none\",\n display: \"flex\",\n ...style\n },\n children: themeLayers.reduceRight(\n (node, layer, index) => /* @__PURE__ */ jsx(\n Theme,\n {\n forceClassName: true,\n inlineValues: layer.inlineValues,\n inlineClassName: layer.inlineClassName,\n children: node\n },\n index\n ),\n // provide computed z-index to children so nested portals can stack above\n /* @__PURE__ */ jsx(ZIndexHardcodedContext.Provider, { value: zIndex, children })\n )\n }\n ),\n globalThis.document?.body\n );\n});\nexport {\n Portal\n};\n//# sourceMappingURL=Portal.js.map\n"],"mappings":";;;;;;;;AAOA,MAAM,SAAS,MAAM,MAAM,YAAY;CACrC,MAAM,EAAE,UAAU,aAAa,OAAO,MAAM,WAAW;CACvD,MAAM,EAAE,MAAM,WAAW,QAAQ,gBAAgB,oBAAoB;CACrE,MAAM,aAAa,gBAAgB;CACnC,MAAM,SAAS,iBAAiB,sBAAsB,OAAO,CAAC;CAC9D,IAAI,aAAa;EACf,OAAO;CACT;CACA,IAAI,CAAC,YAAY;EACf,OAAO;CACT;CACA,OAAO,aACW,oBACd,aACA;EACE,OAAO;EACP,OAAO;GACL;GACA,UAAU;GACV,OAAO;GACP,SAAS;GACT,eAAe,OAAO,SAAS;GAQ/B,YAAY,SAAS,WAAW,KAAK;GAErC,aAAa;GACb,SAAS;GACT,GAAG;EACL;EACA,UAAU,YAAY,aACnB,MAAM,OAAO,UAA0B,oBACtC,OACA;GACE,gBAAgB;GAChB,cAAc,MAAM;GACpB,iBAAiB,MAAM;GACvB,UAAU;EACZ,GACA,KACF,GAEgB,oBAAI,uBAAuB,UAAU;GAAE,OAAO;GAAQ;EAAS,CAAC,CAClF;CACF,CACF,GACA,WAAW,UAAU,IACvB;AACF,CAAC"}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { View } from "@tamagui/core";
|
|
3
|
-
import {
|
|
3
|
+
import { NativePortal, getPortal } from "@tamagui/native";
|
|
4
4
|
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
5
5
|
import { GorhomPortalItem } from "./GorhomPortalItem.native.js";
|
|
6
6
|
import { getStackedZIndexProps } from "./helpers.native.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
children: contents
|
|
33
|
-
});
|
|
7
|
+
|
|
8
|
+
var Portal = function(propsIn) {
|
|
9
|
+
var zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
10
|
+
var { children, passThrough } = propsIn;
|
|
11
|
+
var contents = /* @__PURE__ */ jsx(View, {
|
|
12
|
+
pointerEvents: "box-none",
|
|
13
|
+
position: "absolute",
|
|
14
|
+
inset: 0,
|
|
15
|
+
maxWidth: "100%",
|
|
16
|
+
zIndex,
|
|
17
|
+
passThrough,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
var portalState = getPortal().state;
|
|
21
|
+
if (portalState.type === "teleport") {
|
|
22
|
+
return /* @__PURE__ */ jsx(NativePortal, {
|
|
23
|
+
hostName: "root",
|
|
24
|
+
children: contents
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx(GorhomPortalItem, {
|
|
28
|
+
passThrough,
|
|
29
|
+
hostName: "root",
|
|
30
|
+
children: contents
|
|
31
|
+
});
|
|
34
32
|
};
|
|
33
|
+
|
|
35
34
|
export { Portal };
|
|
36
35
|
//# sourceMappingURL=Portal.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"Portal.native.js","names":[],"sources":["esm/Portal.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { View } from \"@tamagui/core\";\nimport { getPortal, NativePortal } from \"@tamagui/native\";\nimport { useStackedZIndex } from \"@tamagui/z-index-stack\";\nimport { GorhomPortalItem } from \"./GorhomPortalItem\";\nimport { getStackedZIndexProps } from \"./helpers\";\nvar Portal = function(propsIn) {\n var zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));\n var { children, passThrough } = propsIn;\n var contents = /* @__PURE__ */ _jsx(View, {\n pointerEvents: \"box-none\",\n position: \"absolute\",\n inset: 0,\n maxWidth: \"100%\",\n zIndex,\n passThrough,\n children\n });\n var portalState = getPortal().state;\n if (portalState.type === \"teleport\") {\n return /* @__PURE__ */ _jsx(NativePortal, {\n hostName: \"root\",\n children: contents\n });\n }\n return /* @__PURE__ */ _jsx(GorhomPortalItem, {\n passThrough,\n hostName: \"root\",\n children: contents\n });\n};\nexport {\n Portal\n};\n//# sourceMappingURL=Portal.native.js.map\n"],"mappings":";;;;;;;;AAMA,IAAI,SAAS,SAAS,SAAS;CAC7B,IAAI,SAAS,iBAAiB,sBAAsB,OAAO,CAAC;CAC5D,IAAI,EAAE,UAAU,gBAAgB;CAChC,IAAI,WAA2B,oBAAK,MAAM;EACxC,eAAe;EACf,UAAU;EACV,OAAO;EACP,UAAU;EACV;EACA;EACA;CACF,CAAC;CACD,IAAI,cAAc,UAAU,EAAE;CAC9B,IAAI,YAAY,SAAS,YAAY;EACnC,OAAuB,oBAAK,cAAc;GACxC,UAAU;GACV,UAAU;EACZ,CAAC;CACH;CACA,OAAuB,oBAAK,kBAAkB;EAC5C;EACA,UAAU;EACV,UAAU;CACZ,CAAC;AACH"}
|
package/dist/esm/PortalProps.mjs
CHANGED
package/dist/esm/constants.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { isAndroid, isIos, isWeb } from "@tamagui/constants";
|
|
2
2
|
import { getPortal } from "@tamagui/native";
|
|
3
|
+
|
|
3
4
|
const isTeleportEnabled = () => {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const state = getPortal().state;
|
|
6
|
+
return state.enabled && state.type === "teleport";
|
|
6
7
|
};
|
|
7
8
|
const needsPortalRepropagation = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (isWeb) return false;
|
|
10
|
+
if (isTeleportEnabled()) return false;
|
|
11
|
+
return isAndroid || isIos;
|
|
11
12
|
};
|
|
12
|
-
const allPortalHosts = /* @__PURE__ */new Map();
|
|
13
|
+
const allPortalHosts = /* @__PURE__ */ new Map();
|
|
13
14
|
const portalListeners = {};
|
|
15
|
+
|
|
14
16
|
export { allPortalHosts, isTeleportEnabled, needsPortalRepropagation, portalListeners };
|
|
15
17
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["esm/constants.js"],"sourcesContent":["import { isAndroid, isIos, isWeb } from \"@tamagui/constants\";\nimport { getPortal } from \"@tamagui/native\";\nconst isTeleportEnabled = () => {\n const state = getPortal().state;\n return state.enabled && state.type === \"teleport\";\n};\nconst needsPortalRepropagation = () => {\n if (isWeb) return false;\n if (isTeleportEnabled()) return false;\n return isAndroid || isIos;\n};\nconst allPortalHosts = /* @__PURE__ */ new Map();\nconst portalListeners = {};\nexport {\n allPortalHosts,\n isTeleportEnabled,\n needsPortalRepropagation,\n portalListeners\n};\n//# sourceMappingURL=constants.js.map\n"],"mappings":";;;;AAEA,MAAM,0BAA0B;CAC9B,MAAM,QAAQ,UAAU,EAAE;CAC1B,OAAO,MAAM,WAAW,MAAM,SAAS;AACzC;AACA,MAAM,iCAAiC;CACrC,IAAI,OAAO,OAAO;CAClB,IAAI,kBAAkB,GAAG,OAAO;CAChC,OAAO,aAAa;AACtB;AACA,MAAM,iCAAiC,IAAI,IAAI;AAC/C,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { isAndroid, isIos, isWeb } from "@tamagui/constants";
|
|
2
2
|
import { getPortal } from "@tamagui/native";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
var isTeleportEnabled = function() {
|
|
5
|
+
var state = getPortal().state;
|
|
6
|
+
return state.enabled && state.type === "teleport";
|
|
6
7
|
};
|
|
7
|
-
var needsPortalRepropagation = function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var needsPortalRepropagation = function() {
|
|
9
|
+
if (isWeb) return false;
|
|
10
|
+
if (isTeleportEnabled()) return false;
|
|
11
|
+
return isAndroid || isIos;
|
|
11
12
|
};
|
|
12
|
-
var allPortalHosts = /* @__PURE__ */new Map();
|
|
13
|
+
var allPortalHosts = /* @__PURE__ */ new Map();
|
|
13
14
|
var portalListeners = {};
|
|
15
|
+
|
|
14
16
|
export { allPortalHosts, isTeleportEnabled, needsPortalRepropagation, portalListeners };
|
|
15
17
|
//# sourceMappingURL=constants.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"constants.native.js","names":[],"sources":["esm/constants.native.js"],"sourcesContent":["import { isAndroid, isIos, isWeb } from \"@tamagui/constants\";\nimport { getPortal } from \"@tamagui/native\";\nvar isTeleportEnabled = function() {\n var state = getPortal().state;\n return state.enabled && state.type === \"teleport\";\n};\nvar needsPortalRepropagation = function() {\n if (isWeb) return false;\n if (isTeleportEnabled()) return false;\n return isAndroid || isIos;\n};\nvar allPortalHosts = /* @__PURE__ */ new Map();\nvar portalListeners = {};\nexport {\n allPortalHosts,\n isTeleportEnabled,\n needsPortalRepropagation,\n portalListeners\n};\n//# sourceMappingURL=constants.js.map\n"],"mappings":";;;;AAEA,IAAI,oBAAoB,WAAW;CACjC,IAAI,QAAQ,UAAU,EAAE;CACxB,OAAO,MAAM,WAAW,MAAM,SAAS;AACzC;AACA,IAAI,2BAA2B,WAAW;CACxC,IAAI,OAAO,OAAO;CAClB,IAAI,kBAAkB,GAAG,OAAO;CAChC,OAAO,aAAa;AACtB;AACA,IAAI,iCAAiC,IAAI,IAAI;AAC7C,IAAI,kBAAkB,CAAC"}
|
package/dist/esm/helpers.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { getTokenValue } from "@tamagui/web";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
const getStackedZIndexProps = (propsIn) => {
|
|
4
|
+
return {
|
|
5
|
+
stackZIndex: propsIn.stackZIndex,
|
|
6
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
7
|
+
};
|
|
7
8
|
};
|
|
8
|
-
const resolveViewZIndex = zIndex => {
|
|
9
|
-
|
|
9
|
+
const resolveViewZIndex = (zIndex) => {
|
|
10
|
+
return typeof zIndex === "undefined" ? void 0 : typeof zIndex === "number" ? zIndex : getTokenValue(zIndex, "zIndex");
|
|
10
11
|
};
|
|
12
|
+
|
|
11
13
|
export { getStackedZIndexProps, resolveViewZIndex };
|
|
12
14
|
//# sourceMappingURL=helpers.mjs.map
|
package/dist/esm/helpers.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"helpers.js","names":[],"sources":["esm/helpers.js"],"sourcesContent":["import { getTokenValue } from \"@tamagui/web\";\nconst getStackedZIndexProps = (propsIn) => {\n return {\n stackZIndex: propsIn.stackZIndex,\n zIndex: resolveViewZIndex(propsIn.zIndex)\n };\n};\nconst resolveViewZIndex = (zIndex) => {\n return typeof zIndex === \"undefined\" ? void 0 : typeof zIndex === \"number\" ? zIndex : getTokenValue(zIndex, \"zIndex\");\n};\nexport {\n getStackedZIndexProps,\n resolveViewZIndex\n};\n//# sourceMappingURL=helpers.js.map\n"],"mappings":";;;AACA,MAAM,yBAAyB,YAAY;CACzC,OAAO;EACL,aAAa,QAAQ;EACrB,QAAQ,kBAAkB,QAAQ,MAAM;CAC1C;AACF;AACA,MAAM,qBAAqB,WAAW;CACpC,OAAO,OAAO,WAAW,cAAc,KAAK,IAAI,OAAO,WAAW,WAAW,SAAS,cAAc,QAAQ,QAAQ;AACtH"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { getTokenValue } from "@tamagui/web";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
var getStackedZIndexProps = function(propsIn) {
|
|
4
|
+
return {
|
|
5
|
+
stackZIndex: propsIn.stackZIndex,
|
|
6
|
+
zIndex: resolveViewZIndex(propsIn.zIndex)
|
|
7
|
+
};
|
|
7
8
|
};
|
|
8
|
-
var resolveViewZIndex = function
|
|
9
|
-
|
|
9
|
+
var resolveViewZIndex = function(zIndex) {
|
|
10
|
+
return typeof zIndex === "undefined" ? void 0 : typeof zIndex === "number" ? zIndex : getTokenValue(zIndex, "zIndex");
|
|
10
11
|
};
|
|
12
|
+
|
|
11
13
|
export { getStackedZIndexProps, resolveViewZIndex };
|
|
12
14
|
//# sourceMappingURL=helpers.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"helpers.native.js","names":[],"sources":["esm/helpers.native.js"],"sourcesContent":["import { getTokenValue } from \"@tamagui/web\";\nvar getStackedZIndexProps = function(propsIn) {\n return {\n stackZIndex: propsIn.stackZIndex,\n zIndex: resolveViewZIndex(propsIn.zIndex)\n };\n};\nvar resolveViewZIndex = function(zIndex) {\n return typeof zIndex === \"undefined\" ? void 0 : typeof zIndex === \"number\" ? zIndex : getTokenValue(zIndex, \"zIndex\");\n};\nexport {\n getStackedZIndexProps,\n resolveViewZIndex\n};\n//# sourceMappingURL=helpers.js.map\n"],"mappings":";;;AACA,IAAI,wBAAwB,SAAS,SAAS;CAC5C,OAAO;EACL,aAAa,QAAQ;EACrB,QAAQ,kBAAkB,QAAQ,MAAM;CAC1C;AACF;AACA,IAAI,oBAAoB,SAAS,QAAQ;CACvC,OAAO,OAAO,WAAW,cAAc,KAAK,IAAI,OAAO,WAAW,WAAW,SAAS,cAAc,QAAQ,QAAQ;AACtH"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export * from "./Portal.mjs";
|
|
2
|
-
export * from "./PortalProps.mjs";
|
|
3
|
-
export * from "./GorhomPortal.mjs";
|
|
4
1
|
import { GorhomPortalItem } from "./GorhomPortalItem.mjs";
|
|
5
|
-
export * from "./constants.mjs";
|
|
6
2
|
import { resolveViewZIndex } from "./helpers.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
|
|
4
|
+
export * from "./Portal.mjs"
|
|
5
|
+
|
|
6
|
+
export * from "./PortalProps.mjs"
|
|
7
|
+
|
|
8
|
+
export * from "./GorhomPortal.mjs"
|
|
9
|
+
|
|
10
|
+
export * from "./constants.mjs"
|
|
11
|
+
|
|
12
|
+
export { GorhomPortalItem as PortalItem, resolveViewZIndex };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export * from "./Portal.mjs";
|
|
2
|
-
export * from "./PortalProps.mjs";
|
|
3
|
-
export * from "./GorhomPortal.mjs";
|
|
4
1
|
import { GorhomPortalItem } from "./GorhomPortalItem.mjs";
|
|
5
|
-
export * from "./constants.mjs";
|
|
6
2
|
import { resolveViewZIndex } from "./helpers.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
|
|
4
|
+
export * from "./Portal.mjs"
|
|
5
|
+
|
|
6
|
+
export * from "./PortalProps.mjs"
|
|
7
|
+
|
|
8
|
+
export * from "./GorhomPortal.mjs"
|
|
9
|
+
|
|
10
|
+
export * from "./constants.mjs"
|
|
11
|
+
|
|
12
|
+
export { GorhomPortalItem as PortalItem, resolveViewZIndex };
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export * from "./Portal.native.js";
|
|
2
|
-
export * from "./PortalProps.native.js";
|
|
3
|
-
export * from "./GorhomPortal.native.js";
|
|
4
1
|
import { GorhomPortalItem } from "./GorhomPortalItem.native.js";
|
|
5
|
-
export * from "./constants.native.js";
|
|
6
2
|
import { resolveViewZIndex } from "./helpers.native.js";
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
|
|
4
|
+
export * from "./Portal.native.js"
|
|
5
|
+
|
|
6
|
+
export * from "./PortalProps.native.js"
|
|
7
|
+
|
|
8
|
+
export * from "./GorhomPortal.native.js"
|
|
9
|
+
|
|
10
|
+
export * from "./constants.native.js"
|
|
11
|
+
|
|
12
|
+
export { GorhomPortalItem as PortalItem, resolveViewZIndex };
|