@tamagui/portal 1.0.0-beta.8 → 1.0.1-beta.101
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 +7 -5
- package/dist/cjs/Portal.js.map +2 -2
- package/dist/esm/Portal.js +23 -7
- package/dist/esm/Portal.js.map +2 -2
- package/dist/jsx/Portal.js +5 -6
- package/dist/jsx/Portal.js.map +7 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +6 -6
- package/src/Portal.tsx +44 -0
- package/src/index.tsx +1 -0
- package/types/Portal.d.ts +2 -2
- package/types/Portal.d.ts.map +1 -1
- package/types/index.d.ts +0 -0
- package/types/index.d.ts.map +0 -0
package/dist/cjs/Portal.js
CHANGED
|
@@ -18,7 +18,6 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
22
21
|
var __export = (target, all) => {
|
|
23
22
|
for (var name in all)
|
|
24
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -44,14 +43,17 @@ var import_stacks = require("@tamagui/stacks");
|
|
|
44
43
|
var React = __toESM(require("react"));
|
|
45
44
|
var import_react_dom = require("react-dom");
|
|
46
45
|
var import_react_native = require("react-native");
|
|
47
|
-
const Portal =
|
|
46
|
+
const Portal = (props) => {
|
|
48
47
|
const contents = /* @__PURE__ */ React.createElement(import_stacks.YStack, __spreadValues({
|
|
49
48
|
pointerEvents: "none",
|
|
50
|
-
fullscreen: true
|
|
49
|
+
fullscreen: true,
|
|
50
|
+
position: import_core.isWeb ? "fixed" : "absolute"
|
|
51
51
|
}, props));
|
|
52
52
|
if (!import_core.isWeb) {
|
|
53
53
|
return /* @__PURE__ */ React.createElement(import_react_native.Modal, {
|
|
54
|
-
visible: true
|
|
54
|
+
visible: true,
|
|
55
|
+
transparent: true,
|
|
56
|
+
pointerEvents: "none"
|
|
55
57
|
}, contents);
|
|
56
58
|
}
|
|
57
59
|
const [hostElement, setHostElement] = React.useState(null);
|
|
@@ -63,7 +65,7 @@ const Portal = /* @__PURE__ */ __name((props) => {
|
|
|
63
65
|
return (0, import_react_dom.createPortal)(contents, hostElement);
|
|
64
66
|
}
|
|
65
67
|
return null;
|
|
66
|
-
}
|
|
68
|
+
};
|
|
67
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
70
|
0 && (module.exports = {
|
|
69
71
|
Portal
|
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": ["
|
|
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\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 visible transparent pointerEvents=\"none\">\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;AAIf,MAAM,SAAS,CAAC,UAAuB;AAC5C,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,MAAM,SAAO;AAAA,MAAC,aAAW;AAAA,MAAC,eAAc;AAAA,OACtC,QACH;AAAA,EAEJ;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,6CAA0B,MAAM;AAjClC;AAkCI,mBAAe,iBAAW,aAAX,mBAAqB,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
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
3
17
|
import "@tamagui/polyfill-dev";
|
|
4
18
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/core";
|
|
5
19
|
import { YStack } from "@tamagui/stacks";
|
|
6
20
|
import * as React from "react";
|
|
7
21
|
import { createPortal } from "react-dom";
|
|
8
22
|
import { Modal } from "react-native";
|
|
9
|
-
const Portal =
|
|
10
|
-
const contents = /* @__PURE__ */ React.createElement(YStack, {
|
|
23
|
+
const Portal = (props) => {
|
|
24
|
+
const contents = /* @__PURE__ */ React.createElement(YStack, __spreadValues({
|
|
11
25
|
pointerEvents: "none",
|
|
12
26
|
fullscreen: true,
|
|
13
|
-
|
|
14
|
-
});
|
|
27
|
+
position: isWeb ? "fixed" : "absolute"
|
|
28
|
+
}, props));
|
|
15
29
|
if (!isWeb) {
|
|
16
30
|
return /* @__PURE__ */ React.createElement(Modal, {
|
|
17
|
-
visible: true
|
|
31
|
+
visible: true,
|
|
32
|
+
transparent: true,
|
|
33
|
+
pointerEvents: "none"
|
|
18
34
|
}, contents);
|
|
19
35
|
}
|
|
20
36
|
const [hostElement, setHostElement] = React.useState(null);
|
|
@@ -26,7 +42,7 @@ const Portal = /* @__PURE__ */ __name((props) => {
|
|
|
26
42
|
return createPortal(contents, hostElement);
|
|
27
43
|
}
|
|
28
44
|
return null;
|
|
29
|
-
}
|
|
45
|
+
};
|
|
30
46
|
export {
|
|
31
47
|
Portal
|
|
32
48
|
};
|
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": ["
|
|
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\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 visible transparent pointerEvents=\"none\">\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;AAIO,MAAM,SAAS,CAAC,UAAuB;AAC5C,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,MAAM,SAAO;AAAA,MAAC,aAAW;AAAA,MAAC,eAAc;AAAA,OACtC,QACH;AAAA,EAEJ;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAjClC;AAkCI,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/dist/jsx/Portal.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import "@tamagui/polyfill-dev";
|
|
4
2
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/core";
|
|
5
3
|
import { YStack } from "@tamagui/stacks";
|
|
6
4
|
import * as React from "react";
|
|
7
5
|
import { createPortal } from "react-dom";
|
|
8
6
|
import { Modal } from "react-native";
|
|
9
|
-
const Portal =
|
|
10
|
-
const contents = <YStack pointerEvents="none" fullscreen {...props} />;
|
|
7
|
+
const Portal = (props) => {
|
|
8
|
+
const contents = <YStack pointerEvents="none" fullscreen position={isWeb ? "fixed" : "absolute"} {...props} />;
|
|
11
9
|
if (!isWeb) {
|
|
12
|
-
return <Modal visible>{contents}</Modal>;
|
|
10
|
+
return <Modal visible transparent pointerEvents="none">{contents}</Modal>;
|
|
13
11
|
}
|
|
14
12
|
const [hostElement, setHostElement] = React.useState(null);
|
|
15
13
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -20,7 +18,8 @@ const Portal = /* @__PURE__ */ __name((props) => {
|
|
|
20
18
|
return createPortal(contents, hostElement);
|
|
21
19
|
}
|
|
22
20
|
return null;
|
|
23
|
-
}
|
|
21
|
+
};
|
|
24
22
|
export {
|
|
25
23
|
Portal
|
|
26
24
|
};
|
|
25
|
+
//# sourceMappingURL=Portal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 visible transparent pointerEvents=\"none\">\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;AAIO,MAAM,SAAS,CAAC,UAAuB;AAC5C,QAAM,WACJ,CAAC,OACC,cAAc,OACd,WAEA,UAAU,QAAQ,UAAU,gBACxB,OACN;AAGF,MAAI,CAAC,OAAO;AAEV,WACE,CAAC,MAAM,QAAQ,YAAY,cAAc,QACtC,SACH,EAFC;AAAA,EAIL;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAjClC;AAkCI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,aAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/jsx/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/portal",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"sideEffects": true,
|
|
3
|
+
"version": "1.0.1-beta.101",
|
|
5
4
|
"source": "src/index.ts",
|
|
6
|
-
"
|
|
5
|
+
"types": "./types/index.d.ts",
|
|
7
6
|
"main": "dist/cjs",
|
|
8
7
|
"module": "dist/esm",
|
|
9
8
|
"module:jsx": "dist/jsx",
|
|
10
9
|
"files": [
|
|
10
|
+
"src",
|
|
11
11
|
"types",
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tamagui/stacks": "^1.0.
|
|
21
|
+
"@tamagui/stacks": "^1.0.1-beta.101"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "*",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"react-native": "*"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@tamagui/build": "^1.0.
|
|
30
|
-
"@types/react-native": "^0.
|
|
29
|
+
"@tamagui/build": "^1.0.1-beta.101",
|
|
30
|
+
"@types/react-native": "^0.69.2",
|
|
31
31
|
"react": "*",
|
|
32
32
|
"react-dom": "*",
|
|
33
33
|
"react-native": "*"
|
package/src/Portal.tsx
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import '@tamagui/polyfill-dev'
|
|
3
|
+
|
|
4
|
+
import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'
|
|
5
|
+
import { YStack, YStackProps } from '@tamagui/stacks'
|
|
6
|
+
import * as React from 'react'
|
|
7
|
+
import { createPortal } from 'react-dom'
|
|
8
|
+
import { Modal } from 'react-native'
|
|
9
|
+
|
|
10
|
+
export type PortalProps = YStackProps
|
|
11
|
+
|
|
12
|
+
export const Portal = (props: PortalProps) => {
|
|
13
|
+
const contents = (
|
|
14
|
+
<YStack
|
|
15
|
+
pointerEvents="none"
|
|
16
|
+
fullscreen
|
|
17
|
+
// @ts-expect-error ok on web
|
|
18
|
+
position={isWeb ? 'fixed' : 'absolute'}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
if (!isWeb) {
|
|
24
|
+
// check if theme stays in context here
|
|
25
|
+
return (
|
|
26
|
+
<Modal visible transparent pointerEvents="none">
|
|
27
|
+
{contents}
|
|
28
|
+
</Modal>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const [hostElement, setHostElement] = React.useState<any>(null)
|
|
33
|
+
|
|
34
|
+
useIsomorphicLayoutEffect(() => {
|
|
35
|
+
setHostElement(globalThis.document?.body)
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
38
|
+
if (hostElement) {
|
|
39
|
+
return createPortal(contents, hostElement)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ssr return null
|
|
43
|
+
return null
|
|
44
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Portal'
|
package/types/Portal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import '@tamagui/polyfill-dev';
|
|
3
2
|
import { YStackProps } from '@tamagui/stacks';
|
|
4
|
-
export declare
|
|
3
|
+
export declare type PortalProps = YStackProps;
|
|
4
|
+
export declare const Portal: (props: PortalProps) => JSX.Element | null;
|
|
5
5
|
//# 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,CAAA;AAErC,eAAO,MAAM,MAAM,UAAW,WAAW,uBAgCxC,CAAA"}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/types/index.d.ts.map
CHANGED
|
File without changes
|