promise-portal 1.0.5 → 1.0.6
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/index.cjs +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -94,10 +94,11 @@ var definePortal = (component, { instance, unmountDelay } = {}) => {
|
|
|
94
94
|
return p;
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
-
var detectPromisePortalInstance = ({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
var detectPromisePortalInstance = (config = {}) => {
|
|
98
|
+
const {
|
|
99
|
+
style = "position:fixed;top:0;right:0;text-align:right;line-height:1.3;color:red;z-index:9999;",
|
|
100
|
+
text = `Detected that the promise-portal instance has not been properly destroyed<br>Please make sure to call resolve/reject to release the instance correctly.`
|
|
101
|
+
} = config;
|
|
101
102
|
const nodes = document.querySelectorAll("[data-promise-portal-container]");
|
|
102
103
|
if (nodes.length > 0) {
|
|
103
104
|
let el = document.querySelector("[data-promise-portal-detector]");
|
|
@@ -111,7 +112,7 @@ var detectPromisePortalInstance = ({
|
|
|
111
112
|
} else {
|
|
112
113
|
document.querySelector("[data-promise-portal-detector]")?.remove();
|
|
113
114
|
}
|
|
114
|
-
setTimeout(detectPromisePortalInstance, 200);
|
|
115
|
+
setTimeout(() => detectPromisePortalInstance(config), 200);
|
|
115
116
|
};
|
|
116
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
117
118
|
0 && (module.exports = {
|
package/dist/index.d.ts
CHANGED
|
@@ -24,9 +24,10 @@ declare const setActiveInstance: (instance: PromisePortal) => PromisePortal<any>
|
|
|
24
24
|
declare const createPromisePortal: (defaultOptions?: {}) => PromisePortal<any>;
|
|
25
25
|
declare const usePortalContext: <TOutput = any>() => PortalContext<TOutput>;
|
|
26
26
|
declare const definePortal: <TOutput = any, TProps = any>(component: Component, { instance, unmountDelay }?: PortalOptions<TOutput>) => (props?: TProps | undefined, children?: unknown) => Promise<TOutput>;
|
|
27
|
-
|
|
28
|
-
style?: string
|
|
29
|
-
text?: string
|
|
30
|
-
}
|
|
27
|
+
interface DetectPromisePortalInstanceConfig {
|
|
28
|
+
style?: string;
|
|
29
|
+
text?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const detectPromisePortalInstance: (config?: DetectPromisePortalInstanceConfig) => void;
|
|
31
32
|
|
|
32
|
-
export { PortalContext, PortalOptions, PromisePortal, createPromisePortal, definePortal, detectPromisePortalInstance, getActiveInstance, setActiveInstance, usePortalContext };
|
|
33
|
+
export { DetectPromisePortalInstanceConfig, PortalContext, PortalOptions, PromisePortal, createPromisePortal, definePortal, detectPromisePortalInstance, getActiveInstance, setActiveInstance, usePortalContext };
|
package/dist/index.js
CHANGED
|
@@ -65,10 +65,11 @@ var definePortal = (component, { instance, unmountDelay } = {}) => {
|
|
|
65
65
|
return p;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
var detectPromisePortalInstance = ({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
var detectPromisePortalInstance = (config = {}) => {
|
|
69
|
+
const {
|
|
70
|
+
style = "position:fixed;top:0;right:0;text-align:right;line-height:1.3;color:red;z-index:9999;",
|
|
71
|
+
text = `Detected that the promise-portal instance has not been properly destroyed<br>Please make sure to call resolve/reject to release the instance correctly.`
|
|
72
|
+
} = config;
|
|
72
73
|
const nodes = document.querySelectorAll("[data-promise-portal-container]");
|
|
73
74
|
if (nodes.length > 0) {
|
|
74
75
|
let el = document.querySelector("[data-promise-portal-detector]");
|
|
@@ -82,7 +83,7 @@ var detectPromisePortalInstance = ({
|
|
|
82
83
|
} else {
|
|
83
84
|
document.querySelector("[data-promise-portal-detector]")?.remove();
|
|
84
85
|
}
|
|
85
|
-
setTimeout(detectPromisePortalInstance, 200);
|
|
86
|
+
setTimeout(() => detectPromisePortalInstance(config), 200);
|
|
86
87
|
};
|
|
87
88
|
export {
|
|
88
89
|
createPromisePortal,
|