@overlastic/react 0.5.1 → 0.7.0
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/README.md +2 -2
- package/dist/index.cjs +12 -11
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.global.js +9 -8
- package/dist/index.js +9 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://overlastic.vercel.app/" target="blank">
|
|
3
|
-
<img src="https://github.com/hairyf/overlastic/raw/master/docs/public/
|
|
3
|
+
<img src="https://github.com/hairyf/overlastic/raw/master/docs/public/logo.svg" width="120" alt="Nest Logo" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -26,4 +26,4 @@ $ npm install --save @overlastic/react
|
|
|
26
26
|
|
|
27
27
|
## Quick Start
|
|
28
28
|
|
|
29
|
-
[Overview & Tutorial](https://overlastic.vercel.app/
|
|
29
|
+
[Overview & Tutorial](https://overlastic.vercel.app/react/)
|
package/dist/index.cjs
CHANGED
|
@@ -23,9 +23,9 @@ __export(src_exports, {
|
|
|
23
23
|
OverlayProvider: () => OverlayProvider,
|
|
24
24
|
defineOverlay: () => defineOverlay,
|
|
25
25
|
renderOverlay: () => renderOverlay,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
useExtendOverlay: () => useExtendOverlay,
|
|
27
|
+
useOverlayHolder: () => useOverlayHolder,
|
|
28
|
+
useOverlayInject: () => useOverlayInject
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(src_exports);
|
|
31
31
|
|
|
@@ -54,7 +54,7 @@ function defineAnonymousComponent(component) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// src/composable/define.ts
|
|
57
|
-
function
|
|
57
|
+
function useExtendOverlay(options = {}) {
|
|
58
58
|
const { immediate = true, duration = 0, automatic = true } = options;
|
|
59
59
|
const context = (0, import_react2.useContext)(ScriptsContext);
|
|
60
60
|
const dec = Reflect.get(context, "in_dec");
|
|
@@ -123,14 +123,15 @@ var import_pascal_case = require("pascal-case");
|
|
|
123
123
|
var import_react4 = require("react");
|
|
124
124
|
var import_react_dom = require("react-dom");
|
|
125
125
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
126
|
-
function useOverlayHolder(
|
|
126
|
+
function useOverlayHolder(component, options = {}) {
|
|
127
127
|
const { callback, scripts, props, refresh } = useRefreshMetadata();
|
|
128
128
|
const name = (0, import_core3.defineName)(options.id, options.autoIncrement);
|
|
129
129
|
function render() {
|
|
130
130
|
const root = options.root || (typeof document !== "undefined" ? document.body : void 0);
|
|
131
|
+
const Comp = component;
|
|
131
132
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { id: name, children: [
|
|
132
133
|
" ",
|
|
133
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { ...props }),
|
|
134
135
|
" "
|
|
135
136
|
] });
|
|
136
137
|
return options.root !== false && root ? (0, import_react_dom.createPortal)(content, root) : content;
|
|
@@ -173,7 +174,7 @@ function useRefreshMetadata() {
|
|
|
173
174
|
return { callback, scripts, props, refresh };
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
// src/composable/
|
|
177
|
+
// src/composable/inject.tsx
|
|
177
178
|
var import_core4 = require("@overlastic/core");
|
|
178
179
|
var import_react5 = require("react");
|
|
179
180
|
var import_pascal_case2 = require("pascal-case");
|
|
@@ -196,7 +197,7 @@ var { define } = (0, import_core4.createConstructor)((Instance, props, options)
|
|
|
196
197
|
}
|
|
197
198
|
render(InstanceWithProvider, props);
|
|
198
199
|
}, { container: false });
|
|
199
|
-
function
|
|
200
|
+
function useOverlayInject(Instance) {
|
|
200
201
|
const { render, vanish } = (0, import_react5.useContext)(InstancesContext);
|
|
201
202
|
return define(Instance, { render, vanish });
|
|
202
203
|
}
|
|
@@ -254,7 +255,7 @@ function OverlayProvider(props) {
|
|
|
254
255
|
OverlayProvider,
|
|
255
256
|
defineOverlay,
|
|
256
257
|
renderOverlay,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
useExtendOverlay,
|
|
259
|
+
useOverlayHolder,
|
|
260
|
+
useOverlayInject
|
|
260
261
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
1
|
import { Dispatch, SetStateAction, FC, PropsWithChildren } from 'react';
|
|
3
2
|
import * as _overlastic_core from '@overlastic/core';
|
|
4
3
|
import { ImperativeOverlay, MountOptions } from '@overlastic/core';
|
|
4
|
+
import { GlobalMountOptions } from '@vue/test-utils/dist/types';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
type PropsWidthOverlays<P = unknown> = P & {
|
|
@@ -24,7 +24,7 @@ interface PromptifyEvents {
|
|
|
24
24
|
*/
|
|
25
25
|
resolve?: string;
|
|
26
26
|
}
|
|
27
|
-
interface
|
|
27
|
+
interface ExtendOverlayOptions {
|
|
28
28
|
/** animation duration to avoid premature destruction of components */
|
|
29
29
|
duration?: number;
|
|
30
30
|
/** whether to set visible to true immediately */
|
|
@@ -50,13 +50,13 @@ interface OverlayDefineOptions {
|
|
|
50
50
|
*/
|
|
51
51
|
automatic?: boolean;
|
|
52
52
|
}
|
|
53
|
-
interface
|
|
53
|
+
interface ExtendOverlayReturn {
|
|
54
54
|
/** the notification reject, modify visible, and destroy it after the duration ends */
|
|
55
|
-
reject:
|
|
55
|
+
reject: (reason?: any) => void;
|
|
56
56
|
/** the notification resolve, modify visible, and destroy it after the duration ends */
|
|
57
|
-
resolve:
|
|
57
|
+
resolve: (value?: any) => void;
|
|
58
58
|
/** destroy the current instance (immediately) */
|
|
59
|
-
vanish:
|
|
59
|
+
vanish: () => void;
|
|
60
60
|
/** visible control popup display and hide */
|
|
61
61
|
visible: boolean;
|
|
62
62
|
/** visible dispatch change */
|
|
@@ -64,20 +64,20 @@ interface ProgramsReturn {
|
|
|
64
64
|
/** current deferred */
|
|
65
65
|
deferred?: Promise<any>;
|
|
66
66
|
}
|
|
67
|
-
declare function
|
|
67
|
+
declare function useExtendOverlay(options?: ExtendOverlayOptions): ExtendOverlayReturn;
|
|
68
68
|
|
|
69
69
|
type InjectionHolder<Props, Resolved> = [JSX.Element, ImperativeOverlay<Props, Resolved>];
|
|
70
|
-
declare function useOverlayHolder<Props, Resolved = void>(
|
|
70
|
+
declare function useOverlayHolder<Props, Resolved = void>(component: FC<Props>, options?: MountOptions): InjectionHolder<Props, Resolved>;
|
|
71
71
|
|
|
72
72
|
interface Options {
|
|
73
73
|
render: (instance: FC, props: any) => void;
|
|
74
74
|
vanish: (instance: FC) => void;
|
|
75
75
|
}
|
|
76
|
-
declare function
|
|
76
|
+
declare function useOverlayInject<Props, Resolved>(Instance: FC<Props>): _overlastic_core.ImperativeOverlay<Props, Resolved, Options>;
|
|
77
77
|
|
|
78
|
-
declare const defineOverlay: <Props, Resolved = void>(instance:
|
|
79
|
-
declare const renderOverlay: <Props, Resolved = void>(instance:
|
|
78
|
+
declare const defineOverlay: <Props, Resolved = void>(instance: React.FC<Props>, options?: GlobalMountOptions | undefined) => ImperativeOverlay<Props, Resolved, unknown>;
|
|
79
|
+
declare const renderOverlay: <Props, Resolved = void>(instance: React.FC<Props>, props?: Props | undefined, options?: GlobalMountOptions | undefined) => Promise<Resolved>;
|
|
80
80
|
|
|
81
81
|
declare function OverlayProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
82
82
|
|
|
83
|
-
export { type
|
|
83
|
+
export { type ExtendOverlayOptions, type ExtendOverlayReturn, type InjectionHolder, OverlayProvider, type PropsWidthOverlays, defineOverlay, renderOverlay, useExtendOverlay, useOverlayHolder, useOverlayInject };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
1
|
import { Dispatch, SetStateAction, FC, PropsWithChildren } from 'react';
|
|
3
2
|
import * as _overlastic_core from '@overlastic/core';
|
|
4
3
|
import { ImperativeOverlay, MountOptions } from '@overlastic/core';
|
|
4
|
+
import { GlobalMountOptions } from '@vue/test-utils/dist/types';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
type PropsWidthOverlays<P = unknown> = P & {
|
|
@@ -24,7 +24,7 @@ interface PromptifyEvents {
|
|
|
24
24
|
*/
|
|
25
25
|
resolve?: string;
|
|
26
26
|
}
|
|
27
|
-
interface
|
|
27
|
+
interface ExtendOverlayOptions {
|
|
28
28
|
/** animation duration to avoid premature destruction of components */
|
|
29
29
|
duration?: number;
|
|
30
30
|
/** whether to set visible to true immediately */
|
|
@@ -50,13 +50,13 @@ interface OverlayDefineOptions {
|
|
|
50
50
|
*/
|
|
51
51
|
automatic?: boolean;
|
|
52
52
|
}
|
|
53
|
-
interface
|
|
53
|
+
interface ExtendOverlayReturn {
|
|
54
54
|
/** the notification reject, modify visible, and destroy it after the duration ends */
|
|
55
|
-
reject:
|
|
55
|
+
reject: (reason?: any) => void;
|
|
56
56
|
/** the notification resolve, modify visible, and destroy it after the duration ends */
|
|
57
|
-
resolve:
|
|
57
|
+
resolve: (value?: any) => void;
|
|
58
58
|
/** destroy the current instance (immediately) */
|
|
59
|
-
vanish:
|
|
59
|
+
vanish: () => void;
|
|
60
60
|
/** visible control popup display and hide */
|
|
61
61
|
visible: boolean;
|
|
62
62
|
/** visible dispatch change */
|
|
@@ -64,20 +64,20 @@ interface ProgramsReturn {
|
|
|
64
64
|
/** current deferred */
|
|
65
65
|
deferred?: Promise<any>;
|
|
66
66
|
}
|
|
67
|
-
declare function
|
|
67
|
+
declare function useExtendOverlay(options?: ExtendOverlayOptions): ExtendOverlayReturn;
|
|
68
68
|
|
|
69
69
|
type InjectionHolder<Props, Resolved> = [JSX.Element, ImperativeOverlay<Props, Resolved>];
|
|
70
|
-
declare function useOverlayHolder<Props, Resolved = void>(
|
|
70
|
+
declare function useOverlayHolder<Props, Resolved = void>(component: FC<Props>, options?: MountOptions): InjectionHolder<Props, Resolved>;
|
|
71
71
|
|
|
72
72
|
interface Options {
|
|
73
73
|
render: (instance: FC, props: any) => void;
|
|
74
74
|
vanish: (instance: FC) => void;
|
|
75
75
|
}
|
|
76
|
-
declare function
|
|
76
|
+
declare function useOverlayInject<Props, Resolved>(Instance: FC<Props>): _overlastic_core.ImperativeOverlay<Props, Resolved, Options>;
|
|
77
77
|
|
|
78
|
-
declare const defineOverlay: <Props, Resolved = void>(instance:
|
|
79
|
-
declare const renderOverlay: <Props, Resolved = void>(instance:
|
|
78
|
+
declare const defineOverlay: <Props, Resolved = void>(instance: React.FC<Props>, options?: GlobalMountOptions | undefined) => ImperativeOverlay<Props, Resolved, unknown>;
|
|
79
|
+
declare const renderOverlay: <Props, Resolved = void>(instance: React.FC<Props>, props?: Props | undefined, options?: GlobalMountOptions | undefined) => Promise<Resolved>;
|
|
80
80
|
|
|
81
81
|
declare function OverlayProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
82
82
|
|
|
83
|
-
export { type
|
|
83
|
+
export { type ExtendOverlayOptions, type ExtendOverlayReturn, type InjectionHolder, OverlayProvider, type PropsWidthOverlays, defineOverlay, renderOverlay, useExtendOverlay, useOverlayHolder, useOverlayInject };
|
package/dist/index.global.js
CHANGED
|
@@ -32220,9 +32220,9 @@ var OverlaysReact = (() => {
|
|
|
32220
32220
|
OverlayProvider: () => OverlayProvider,
|
|
32221
32221
|
defineOverlay: () => defineOverlay,
|
|
32222
32222
|
renderOverlay: () => renderOverlay,
|
|
32223
|
-
|
|
32224
|
-
|
|
32225
|
-
|
|
32223
|
+
useExtendOverlay: () => useExtendOverlay,
|
|
32224
|
+
useOverlayHolder: () => useOverlayHolder,
|
|
32225
|
+
useOverlayInject: () => useOverlayInject
|
|
32226
32226
|
});
|
|
32227
32227
|
|
|
32228
32228
|
// ../@core/src/define/global.ts
|
|
@@ -32357,7 +32357,7 @@ var OverlaysReact = (() => {
|
|
|
32357
32357
|
}
|
|
32358
32358
|
|
|
32359
32359
|
// src/composable/define.ts
|
|
32360
|
-
function
|
|
32360
|
+
function useExtendOverlay(options = {}) {
|
|
32361
32361
|
const { immediate = true, duration = 0, automatic = true } = options;
|
|
32362
32362
|
const context2 = (0, import_react2.useContext)(ScriptsContext);
|
|
32363
32363
|
const dec = Reflect.get(context2, "in_dec");
|
|
@@ -32484,14 +32484,15 @@ var OverlaysReact = (() => {
|
|
|
32484
32484
|
var import_react4 = __toESM(require_react(), 1);
|
|
32485
32485
|
var import_react_dom = __toESM(require_react_dom(), 1);
|
|
32486
32486
|
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
32487
|
-
function useOverlayHolder(
|
|
32487
|
+
function useOverlayHolder(component, options = {}) {
|
|
32488
32488
|
const { callback, scripts, props, refresh } = useRefreshMetadata();
|
|
32489
32489
|
const name = defineName(options.id, options.autoIncrement);
|
|
32490
32490
|
function render() {
|
|
32491
32491
|
const root = options.root || (typeof document !== "undefined" ? document.body : void 0);
|
|
32492
|
+
const Comp = component;
|
|
32492
32493
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { id: name, children: [
|
|
32493
32494
|
" ",
|
|
32494
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32495
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { ...props }),
|
|
32495
32496
|
" "
|
|
32496
32497
|
] });
|
|
32497
32498
|
return options.root !== false && root ? (0, import_react_dom.createPortal)(content, root) : content;
|
|
@@ -32534,7 +32535,7 @@ var OverlaysReact = (() => {
|
|
|
32534
32535
|
return { callback, scripts, props, refresh };
|
|
32535
32536
|
}
|
|
32536
32537
|
|
|
32537
|
-
// src/composable/
|
|
32538
|
+
// src/composable/inject.tsx
|
|
32538
32539
|
var import_react5 = __toESM(require_react(), 1);
|
|
32539
32540
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
32540
32541
|
var { define } = createConstructor((Instance, props, options) => {
|
|
@@ -32555,7 +32556,7 @@ var OverlaysReact = (() => {
|
|
|
32555
32556
|
}
|
|
32556
32557
|
render(InstanceWithProvider, props);
|
|
32557
32558
|
}, { container: false });
|
|
32558
|
-
function
|
|
32559
|
+
function useOverlayInject(Instance) {
|
|
32559
32560
|
const { render, vanish } = (0, import_react5.useContext)(InstancesContext);
|
|
32560
32561
|
return define(Instance, { render, vanish });
|
|
32561
32562
|
}
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function defineAnonymousComponent(component) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// src/composable/define.ts
|
|
26
|
-
function
|
|
26
|
+
function useExtendOverlay(options = {}) {
|
|
27
27
|
const { immediate = true, duration = 0, automatic = true } = options;
|
|
28
28
|
const context = useContext(ScriptsContext);
|
|
29
29
|
const dec = Reflect.get(context, "in_dec");
|
|
@@ -92,14 +92,15 @@ import { pascalCase } from "pascal-case";
|
|
|
92
92
|
import { useRef, useState as useState2 } from "react";
|
|
93
93
|
import { createPortal } from "react-dom";
|
|
94
94
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
95
|
-
function useOverlayHolder(
|
|
95
|
+
function useOverlayHolder(component, options = {}) {
|
|
96
96
|
const { callback, scripts, props, refresh } = useRefreshMetadata();
|
|
97
97
|
const name = defineName(options.id, options.autoIncrement);
|
|
98
98
|
function render() {
|
|
99
99
|
const root = options.root || (typeof document !== "undefined" ? document.body : void 0);
|
|
100
|
+
const Comp = component;
|
|
100
101
|
const content = /* @__PURE__ */ jsxs("div", { id: name, children: [
|
|
101
102
|
" ",
|
|
102
|
-
/* @__PURE__ */ jsx(
|
|
103
|
+
/* @__PURE__ */ jsx(Comp, { ...props }),
|
|
103
104
|
" "
|
|
104
105
|
] });
|
|
105
106
|
return options.root !== false && root ? createPortal(content, root) : content;
|
|
@@ -142,7 +143,7 @@ function useRefreshMetadata() {
|
|
|
142
143
|
return { callback, scripts, props, refresh };
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
// src/composable/
|
|
146
|
+
// src/composable/inject.tsx
|
|
146
147
|
import { createConstructor } from "@overlastic/core";
|
|
147
148
|
import { useContext as useContext2 } from "react";
|
|
148
149
|
import { pascalCase as pascalCase2 } from "pascal-case";
|
|
@@ -165,7 +166,7 @@ var { define } = createConstructor((Instance, props, options) => {
|
|
|
165
166
|
}
|
|
166
167
|
render(InstanceWithProvider, props);
|
|
167
168
|
}, { container: false });
|
|
168
|
-
function
|
|
169
|
+
function useOverlayInject(Instance) {
|
|
169
170
|
const { render, vanish } = useContext2(InstancesContext);
|
|
170
171
|
return define(Instance, { render, vanish });
|
|
171
172
|
}
|
|
@@ -222,7 +223,7 @@ export {
|
|
|
222
223
|
OverlayProvider,
|
|
223
224
|
defineOverlay,
|
|
224
225
|
renderOverlay,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
useExtendOverlay,
|
|
227
|
+
useOverlayHolder,
|
|
228
|
+
useOverlayInject
|
|
228
229
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@overlastic/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/hairyf/overlastic#readme",
|
|
7
7
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"pascal-case": "3.1.2",
|
|
33
33
|
"react": "^18.3.1",
|
|
34
34
|
"react-dom": "^18.3.1",
|
|
35
|
-
"@overlastic/core": "^0.
|
|
35
|
+
"@overlastic/core": "^0.7.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/react": "^18.3.2",
|