@tamagui/portal 1.0.1-beta.21 → 1.0.1-beta.211
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.js +266 -0
- package/dist/cjs/GorhomPortal.js.map +7 -0
- package/dist/cjs/Portal.js +19 -31
- package/dist/cjs/Portal.js.map +2 -2
- package/dist/cjs/Portal.native.js +66 -0
- package/dist/cjs/Portal.native.js.map +7 -0
- package/dist/cjs/PortalProps.js +17 -0
- package/dist/cjs/PortalProps.js.map +7 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/GorhomPortal.js +237 -0
- package/dist/esm/GorhomPortal.js.map +7 -0
- package/dist/esm/Portal.js +11 -15
- package/dist/esm/Portal.js.map +2 -2
- package/dist/esm/Portal.native.js +36 -0
- package/dist/esm/Portal.native.js.map +7 -0
- package/dist/esm/PortalProps.js +1 -0
- package/dist/esm/PortalProps.js.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/jsx/GorhomPortal.js +223 -0
- package/dist/jsx/GorhomPortal.js.map +7 -0
- package/dist/jsx/Portal.js +6 -12
- package/dist/jsx/Portal.js.map +7 -0
- package/dist/jsx/Portal.native.js +21 -0
- package/dist/jsx/Portal.native.js.map +7 -0
- package/dist/jsx/PortalProps.js +1 -0
- package/dist/jsx/PortalProps.js.map +7 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +9 -7
- package/src/GorhomPortal.tsx +402 -0
- package/src/Portal.native.tsx +40 -0
- package/src/Portal.tsx +37 -0
- package/src/PortalProps.tsx +6 -0
- package/src/index.tsx +2 -0
- package/types/GorhomPortal.d.ts +106 -0
- package/types/Portal.d.ts +3 -3
- package/types/Portal.native.d.ts +3 -0
- package/types/PortalProps.d.ts +6 -0
- package/types/index.d.ts +1 -0
- package/types/Portal.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare enum ACTIONS {
|
|
4
|
+
REGISTER_HOST = 0,
|
|
5
|
+
DEREGISTER_HOST = 1,
|
|
6
|
+
ADD_UPDATE_PORTAL = 2,
|
|
7
|
+
REMOVE_PORTAL = 3
|
|
8
|
+
}
|
|
9
|
+
declare const INITIAL_STATE: {};
|
|
10
|
+
export { ACTIONS, INITIAL_STATE };
|
|
11
|
+
export interface AddUpdatePortalAction {
|
|
12
|
+
type: ACTIONS;
|
|
13
|
+
hostName: string;
|
|
14
|
+
portalName: string;
|
|
15
|
+
node: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface RemovePortalAction {
|
|
18
|
+
type: ACTIONS;
|
|
19
|
+
hostName: string;
|
|
20
|
+
portalName: string;
|
|
21
|
+
}
|
|
22
|
+
export interface RegisterHostAction {
|
|
23
|
+
type: ACTIONS;
|
|
24
|
+
hostName: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UnregisterHostAction {
|
|
27
|
+
type: ACTIONS;
|
|
28
|
+
hostName: string;
|
|
29
|
+
}
|
|
30
|
+
export declare type ActionTypes = AddUpdatePortalAction | RemovePortalAction | RegisterHostAction | UnregisterHostAction;
|
|
31
|
+
export declare const usePortal: (hostName?: string) => {
|
|
32
|
+
registerHost: () => void;
|
|
33
|
+
deregisterHost: () => void;
|
|
34
|
+
addPortal: (name: string, node: ReactNode) => void;
|
|
35
|
+
updatePortal: (name: string, node: ReactNode) => void;
|
|
36
|
+
removePortal: (name: string) => void;
|
|
37
|
+
};
|
|
38
|
+
export interface PortalProviderProps {
|
|
39
|
+
/**
|
|
40
|
+
* Defines whether to add a default root host or not.
|
|
41
|
+
*
|
|
42
|
+
* @default true
|
|
43
|
+
* @type boolean
|
|
44
|
+
*/
|
|
45
|
+
shouldAddRootHost?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Defines the root portal host name.
|
|
48
|
+
*
|
|
49
|
+
* @default "root"
|
|
50
|
+
* @type string
|
|
51
|
+
*/
|
|
52
|
+
rootHostName?: string;
|
|
53
|
+
children: ReactNode | ReactNode[];
|
|
54
|
+
}
|
|
55
|
+
export declare const PortalProvider: React.MemoExoticComponent<({ rootHostName, shouldAddRootHost, children, }: PortalProviderProps) => JSX.Element>;
|
|
56
|
+
export interface PortalHostProps {
|
|
57
|
+
/**
|
|
58
|
+
* Host's key or name to be used as an identifier.
|
|
59
|
+
* @type string
|
|
60
|
+
*/
|
|
61
|
+
name: string;
|
|
62
|
+
}
|
|
63
|
+
export declare const PortalHost: React.MemoExoticComponent<({ name }: PortalHostProps) => JSX.Element>;
|
|
64
|
+
export interface PortalItemProps {
|
|
65
|
+
/**
|
|
66
|
+
* Portal's key or name to be used as an identifier.
|
|
67
|
+
* @type string
|
|
68
|
+
* @default nanoid generated unique key.
|
|
69
|
+
*/
|
|
70
|
+
name?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Host's name to teleport the portal content to.
|
|
73
|
+
* @type string
|
|
74
|
+
* @default 'root'
|
|
75
|
+
*/
|
|
76
|
+
hostName?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Override internal mounting functionality, this is useful
|
|
79
|
+
* if you want to trigger any action before mounting the portal content.
|
|
80
|
+
* @type (mount?: () => void) => void
|
|
81
|
+
* @default undefined
|
|
82
|
+
*/
|
|
83
|
+
handleOnMount?: (mount: () => void) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Override internal un-mounting functionality, this is useful
|
|
86
|
+
* if you want to trigger any action before un-mounting the portal content.
|
|
87
|
+
* @type (unmount?: () => void) => void
|
|
88
|
+
* @default undefined
|
|
89
|
+
*/
|
|
90
|
+
handleOnUnmount?: (unmount: () => void) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Override internal updating functionality, this is useful
|
|
93
|
+
* if you want to trigger any action before updating the portal content.
|
|
94
|
+
* @type (update?: () => void) => void
|
|
95
|
+
* @default undefined
|
|
96
|
+
*/
|
|
97
|
+
handleOnUpdate?: (update: () => void) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Portal's content.
|
|
100
|
+
* @type ReactNode
|
|
101
|
+
* @default undefined
|
|
102
|
+
*/
|
|
103
|
+
children?: ReactNode | ReactNode[];
|
|
104
|
+
}
|
|
105
|
+
export declare const PortalItem: React.MemoExoticComponent<({ name, hostName, handleOnMount, handleOnUnmount, handleOnUpdate, children, }: PortalItemProps) => null>;
|
|
106
|
+
//# sourceMappingURL=GorhomPortal.d.ts.map
|
package/types/Portal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import '@tamagui/polyfill-dev';
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PortalProps } from './PortalProps';
|
|
4
|
+
export declare const Portal: ({ host, ...props }: PortalProps) => React.ReactPortal | null;
|
|
5
5
|
//# sourceMappingURL=Portal.d.ts.map
|
package/types/index.d.ts
CHANGED
package/types/Portal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":";AAAA,OAAO,uBAAuB,CAAA;AAG9B,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMrD,eAAO,MAAM,MAAM,UAAW,WAAW,uBAgBxC,CAAA"}
|
package/types/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|