@tamagui/portal 1.0.1-beta.103 → 1.0.1-beta.104
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.js +21 -6
- package/dist/cjs/Portal.js.map +2 -2
- package/dist/esm/Portal.js +21 -6
- package/dist/esm/Portal.js.map +2 -2
- package/dist/jsx/Portal.js +3 -3
- package/dist/jsx/Portal.js.map +2 -2
- package/package.json +4 -4
- package/src/Portal.tsx +12 -4
- package/types/Portal.d.ts +4 -3
- package/types/Portal.d.ts.map +1 -1
package/dist/cjs/Portal.js
CHANGED
|
@@ -18,6 +18,18 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
21
33
|
var __export = (target, all) => {
|
|
22
34
|
for (var name in all)
|
|
23
35
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -43,23 +55,26 @@ var import_stacks = require("@tamagui/stacks");
|
|
|
43
55
|
var React = __toESM(require("react"));
|
|
44
56
|
var import_react_dom = require("react-dom");
|
|
45
57
|
var import_react_native = require("react-native");
|
|
46
|
-
const Portal = (
|
|
58
|
+
const Portal = (_a) => {
|
|
59
|
+
var _b = _a, { visible } = _b, props = __objRest(_b, ["visible"]);
|
|
47
60
|
const contents = /* @__PURE__ */ React.createElement(import_stacks.YStack, __spreadValues({
|
|
48
|
-
pointerEvents: "none",
|
|
61
|
+
pointerEvents: "box-none",
|
|
49
62
|
fullscreen: true,
|
|
50
63
|
position: import_core.isWeb ? "fixed" : "absolute"
|
|
51
64
|
}, props));
|
|
52
65
|
if (!import_core.isWeb) {
|
|
53
66
|
return /* @__PURE__ */ React.createElement(import_react_native.Modal, {
|
|
54
|
-
|
|
67
|
+
presentationStyle: "overFullScreen",
|
|
68
|
+
hardwareAccelerated: true,
|
|
69
|
+
visible,
|
|
55
70
|
transparent: true,
|
|
56
|
-
pointerEvents: "none"
|
|
71
|
+
pointerEvents: "box-none"
|
|
57
72
|
}, contents);
|
|
58
73
|
}
|
|
59
74
|
const [hostElement, setHostElement] = React.useState(null);
|
|
60
75
|
(0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
61
|
-
var
|
|
62
|
-
setHostElement((
|
|
76
|
+
var _a2;
|
|
77
|
+
setHostElement((_a2 = globalThis.document) == null ? void 0 : _a2.body);
|
|
63
78
|
}, []);
|
|
64
79
|
if (hostElement) {
|
|
65
80
|
return (0, import_react_dom.createPortal)(contents, hostElement);
|
package/dist/cjs/Portal.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps\n\nexport const Portal = (props: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps & {\n visible?: boolean\n}\n\nexport const Portal = ({ visible, ...props }: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"box-none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal\n presentationStyle=\"overFullScreen\"\n hardwareAccelerated\n visible={visible}\n transparent\n pointerEvents=\"box-none\"\n >\n {contents}\n </Modal>\n )\n }\n\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n\n // ssr return null\n return null\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAO;AAEP,kBAAiD;AACjD,oBAAoC;AACpC,YAAuB;AACvB,uBAA6B;AAC7B,0BAAsB;AAMf,MAAM,SAAS,CAAC,OAAuC;AAAvC,eAAE,cAAF,IAAc,kBAAd,IAAc,CAAZ;AACvB,QAAM,WACJ,oCAAC;AAAA,IACC,eAAc;AAAA,IACd,YAAU;AAAA,IAEV,UAAU,oBAAQ,UAAU;AAAA,KACxB,MACN;AAGF,MAAI,CAAC,mBAAO;AAEV,WACE,oCAAC;AAAA,MACC,mBAAkB;AAAA,MAClB,qBAAmB;AAAA,MACnB;AAAA,MACA,aAAW;AAAA,MACX,eAAc;AAAA,OAEb,QACH;AAAA,EAEJ;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,6CAA0B,MAAM;AAzClC;AA0CI,mBAAe,kBAAW,aAAX,oBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,mCAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/Portal.js
CHANGED
|
@@ -14,29 +14,44 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
17
29
|
import "@tamagui/polyfill-dev";
|
|
18
30
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/core";
|
|
19
31
|
import { YStack } from "@tamagui/stacks";
|
|
20
32
|
import * as React from "react";
|
|
21
33
|
import { createPortal } from "react-dom";
|
|
22
34
|
import { Modal } from "react-native";
|
|
23
|
-
const Portal = (
|
|
35
|
+
const Portal = (_a) => {
|
|
36
|
+
var _b = _a, { visible } = _b, props = __objRest(_b, ["visible"]);
|
|
24
37
|
const contents = /* @__PURE__ */ React.createElement(YStack, __spreadValues({
|
|
25
|
-
pointerEvents: "none",
|
|
38
|
+
pointerEvents: "box-none",
|
|
26
39
|
fullscreen: true,
|
|
27
40
|
position: isWeb ? "fixed" : "absolute"
|
|
28
41
|
}, props));
|
|
29
42
|
if (!isWeb) {
|
|
30
43
|
return /* @__PURE__ */ React.createElement(Modal, {
|
|
31
|
-
|
|
44
|
+
presentationStyle: "overFullScreen",
|
|
45
|
+
hardwareAccelerated: true,
|
|
46
|
+
visible,
|
|
32
47
|
transparent: true,
|
|
33
|
-
pointerEvents: "none"
|
|
48
|
+
pointerEvents: "box-none"
|
|
34
49
|
}, contents);
|
|
35
50
|
}
|
|
36
51
|
const [hostElement, setHostElement] = React.useState(null);
|
|
37
52
|
useIsomorphicLayoutEffect(() => {
|
|
38
|
-
var
|
|
39
|
-
setHostElement((
|
|
53
|
+
var _a2;
|
|
54
|
+
setHostElement((_a2 = globalThis.document) == null ? void 0 : _a2.body);
|
|
40
55
|
}, []);
|
|
41
56
|
if (hostElement) {
|
|
42
57
|
return createPortal(contents, hostElement);
|
package/dist/esm/Portal.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps\n\nexport const Portal = (props: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps & {\n visible?: boolean\n}\n\nexport const Portal = ({ visible, ...props }: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"box-none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal\n presentationStyle=\"overFullScreen\"\n hardwareAccelerated\n visible={visible}\n transparent\n pointerEvents=\"box-none\"\n >\n {contents}\n </Modal>\n )\n }\n\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n\n // ssr return null\n return null\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAEA;AACA;AACA;AACA;AACA;AAMO,MAAM,SAAS,CAAC,OAAuC;AAAvC,eAAE,cAAF,IAAc,kBAAd,IAAc,CAAZ;AACvB,QAAM,WACJ,oCAAC;AAAA,IACC,eAAc;AAAA,IACd,YAAU;AAAA,IAEV,UAAU,QAAQ,UAAU;AAAA,KACxB,MACN;AAGF,MAAI,CAAC,OAAO;AAEV,WACE,oCAAC;AAAA,MACC,mBAAkB;AAAA,MAClB,qBAAmB;AAAA,MACnB;AAAA,MACA,aAAW;AAAA,MACX,eAAc;AAAA,OAEb,QACH;AAAA,EAEJ;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAzClC;AA0CI,mBAAe,kBAAW,aAAX,oBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,aAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/Portal.js
CHANGED
|
@@ -4,10 +4,10 @@ import { YStack } from "@tamagui/stacks";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { Modal } from "react-native";
|
|
7
|
-
const Portal = (props) => {
|
|
8
|
-
const contents = <YStack pointerEvents="none" fullscreen position={isWeb ? "fixed" : "absolute"} {...props} />;
|
|
7
|
+
const Portal = ({ visible, ...props }) => {
|
|
8
|
+
const contents = <YStack pointerEvents="box-none" fullscreen position={isWeb ? "fixed" : "absolute"} {...props} />;
|
|
9
9
|
if (!isWeb) {
|
|
10
|
-
return <Modal visible transparent pointerEvents="none">{contents}</Modal>;
|
|
10
|
+
return <Modal presentationStyle="overFullScreen" hardwareAccelerated visible={visible} transparent pointerEvents="box-none">{contents}</Modal>;
|
|
11
11
|
}
|
|
12
12
|
const [hostElement, setHostElement] = React.useState(null);
|
|
13
13
|
useIsomorphicLayoutEffect(() => {
|
package/dist/jsx/Portal.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps\n\nexport const Portal = (props: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal
|
|
5
|
-
"mappings": "AACA;AAEA;AACA;AACA;AACA;AACA;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps & {\n visible?: boolean\n}\n\nexport const Portal = ({ visible, ...props }: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"box-none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal\n presentationStyle=\"overFullScreen\"\n hardwareAccelerated\n visible={visible}\n transparent\n pointerEvents=\"box-none\"\n >\n {contents}\n </Modal>\n )\n }\n\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n\n // ssr return null\n return null\n}\n"],
|
|
5
|
+
"mappings": "AACA;AAEA;AACA;AACA;AACA;AACA;AAMO,MAAM,SAAS,CAAC,EAAE,YAAY,YAAyB;AAC5D,QAAM,WACJ,CAAC,OACC,cAAc,WACd,WAEA,UAAU,QAAQ,UAAU,gBACxB,OACN;AAGF,MAAI,CAAC,OAAO;AAEV,WACE,CAAC,MACC,kBAAkB,iBAClB,oBACA,SAAS,SACT,YACA,cAAc,YAEb,SACH,EARC;AAAA,EAUL;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAzClC;AA0CI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,aAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/portal",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.104",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
22
|
-
"@tamagui/stacks": "^1.0.1-beta.
|
|
21
|
+
"@tamagui/core": "^1.0.1-beta.104",
|
|
22
|
+
"@tamagui/stacks": "^1.0.1-beta.104"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "*",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-native": "*"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
30
|
+
"@tamagui/build": "^1.0.1-beta.104",
|
|
31
31
|
"@types/react-native": "^0.69.2",
|
|
32
32
|
"react": "*",
|
|
33
33
|
"react-dom": "*",
|
package/src/Portal.tsx
CHANGED
|
@@ -7,12 +7,14 @@ import * as React from 'react'
|
|
|
7
7
|
import { createPortal } from 'react-dom'
|
|
8
8
|
import { Modal } from 'react-native'
|
|
9
9
|
|
|
10
|
-
export type PortalProps = YStackProps
|
|
10
|
+
export type PortalProps = YStackProps & {
|
|
11
|
+
visible?: boolean
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
export const Portal = (props: PortalProps) => {
|
|
14
|
+
export const Portal = ({ visible, ...props }: PortalProps) => {
|
|
13
15
|
const contents = (
|
|
14
16
|
<YStack
|
|
15
|
-
pointerEvents="none"
|
|
17
|
+
pointerEvents="box-none"
|
|
16
18
|
fullscreen
|
|
17
19
|
// @ts-expect-error ok on web
|
|
18
20
|
position={isWeb ? 'fixed' : 'absolute'}
|
|
@@ -23,7 +25,13 @@ export const Portal = (props: PortalProps) => {
|
|
|
23
25
|
if (!isWeb) {
|
|
24
26
|
// check if theme stays in context here
|
|
25
27
|
return (
|
|
26
|
-
<Modal
|
|
28
|
+
<Modal
|
|
29
|
+
presentationStyle="overFullScreen"
|
|
30
|
+
hardwareAccelerated
|
|
31
|
+
visible={visible}
|
|
32
|
+
transparent
|
|
33
|
+
pointerEvents="box-none"
|
|
34
|
+
>
|
|
27
35
|
{contents}
|
|
28
36
|
</Modal>
|
|
29
37
|
)
|
package/types/Portal.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import '@tamagui/polyfill-dev';
|
|
3
2
|
import { YStackProps } from '@tamagui/stacks';
|
|
4
|
-
export declare type PortalProps = YStackProps
|
|
5
|
-
|
|
3
|
+
export declare type PortalProps = YStackProps & {
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const Portal: ({ visible, ...props }: PortalProps) => JSX.Element | null;
|
|
6
7
|
//# sourceMappingURL=Portal.d.ts.map
|
package/types/Portal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"AACA,OAAO,uBAAuB,CAAA;AAG9B,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAKrD,oBAAY,WAAW,GAAG,WAAW,GAAG;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,MAAM,0BAA2B,WAAW,uBAsCxD,CAAA"}
|