@overlastic/vue 0.8.1 → 0.8.7
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 +142 -132
- package/dist/index.d.cts +62 -55
- package/dist/index.d.ts +62 -55
- package/dist/index.global.js +318 -313
- package/dist/index.js +133 -122
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -18,19 +18,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
Field: () => Field,
|
|
24
24
|
OverlaysProvider: () => OverlaysProvider,
|
|
25
|
-
default: () =>
|
|
25
|
+
default: () => index_default,
|
|
26
26
|
defineOverlay: () => defineOverlay,
|
|
27
27
|
install: () => install,
|
|
28
28
|
renderOverlay: () => renderOverlay,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
useOverlayInject: () => useOverlayInject
|
|
29
|
+
useDisclosure: () => useDisclosure,
|
|
30
|
+
useOverlay: () => useOverlay
|
|
32
31
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
33
|
|
|
35
34
|
// src/internal/index.ts
|
|
36
35
|
var context = {
|
|
@@ -39,99 +38,126 @@ var context = {
|
|
|
39
38
|
var ScriptsInjectionKey = Symbol("OverlayScripts");
|
|
40
39
|
var InstancesInjectionKey = Symbol("OverlayInstances");
|
|
41
40
|
|
|
42
|
-
// src/
|
|
41
|
+
// src/components/Field.ts
|
|
42
|
+
var import_vue = require("vue");
|
|
43
|
+
var Field = (0, import_vue.defineComponent)({
|
|
44
|
+
name: "Field",
|
|
45
|
+
props: {
|
|
46
|
+
is: {
|
|
47
|
+
type: [String, Number, Object],
|
|
48
|
+
default: ""
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
setup(props) {
|
|
52
|
+
return () => {
|
|
53
|
+
if (typeof props.is === "string" || typeof props.is === "number")
|
|
54
|
+
return props.is;
|
|
55
|
+
return props.is ? (0, import_vue.h)(props.is) : null;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// src/components/Provider.ts
|
|
61
|
+
var import_vue2 = require("vue");
|
|
43
62
|
var import_vue_demi = require("vue-demi");
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
var OverlaysProvider = (0, import_vue_demi.defineComponent)({
|
|
64
|
+
setup(_, { slots }) {
|
|
65
|
+
const instances = (0, import_vue_demi.ref)([]);
|
|
66
|
+
function render(Instance, props) {
|
|
67
|
+
instances.value.push({ Instance: (0, import_vue2.markRaw)(Instance), props });
|
|
68
|
+
}
|
|
69
|
+
function vanish(instance) {
|
|
70
|
+
instances.value = instances.value.filter(({ Instance }) => Instance !== instance);
|
|
71
|
+
}
|
|
72
|
+
(0, import_vue_demi.provide)(InstancesInjectionKey, { render, vanish });
|
|
73
|
+
return () => {
|
|
74
|
+
var _a;
|
|
75
|
+
return (0, import_vue_demi.h)(import_vue_demi.Fragment, [
|
|
76
|
+
...instances.value.map(
|
|
77
|
+
({ Instance, props }, index) => (0, import_vue_demi.h)(Instance, { ...props, key: index })
|
|
78
|
+
),
|
|
79
|
+
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
80
|
+
]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// src/composable/disclosure.ts
|
|
86
|
+
var import_core = require("@overlastic/core");
|
|
87
|
+
var import_core2 = require("@vueuse/core");
|
|
88
|
+
var import_vue_demi2 = require("vue-demi");
|
|
89
|
+
function useDisclosure(options = {}) {
|
|
47
90
|
const { duration = 0, immediate = true, model = "visible", automatic = true } = options;
|
|
48
|
-
const overlay = (0,
|
|
91
|
+
const overlay = (0, import_vue_demi2.inject)(ScriptsInjectionKey, useDeclarative(model, options));
|
|
49
92
|
const dec = Reflect.get(overlay, "in_dec");
|
|
50
93
|
const { visible, deferred, vanish } = overlay;
|
|
51
94
|
async function destroy() {
|
|
52
95
|
visible.value = false;
|
|
53
|
-
await (0,
|
|
96
|
+
await (0, import_core.delay)(duration);
|
|
54
97
|
vanish == null ? void 0 : vanish();
|
|
55
98
|
return Promise.resolve();
|
|
56
99
|
}
|
|
57
100
|
if (!dec && automatic)
|
|
58
101
|
deferred == null ? void 0 : deferred.then(destroy).catch(destroy);
|
|
59
102
|
if (!dec && immediate)
|
|
60
|
-
(0,
|
|
61
|
-
(0,
|
|
103
|
+
(0, import_vue_demi2.onMounted)(() => visible.value = true);
|
|
104
|
+
(0, import_vue_demi2.provide)(ScriptsInjectionKey, null);
|
|
62
105
|
return overlay;
|
|
63
106
|
}
|
|
64
107
|
function useDeclarative(model, options = {}) {
|
|
65
|
-
const {
|
|
66
|
-
const instance = (0,
|
|
108
|
+
const { cancel = "cancel", confirm = "confirm", close = "close" } = options.events || {};
|
|
109
|
+
const instance = (0, import_vue_demi2.getCurrentInstance)();
|
|
67
110
|
if (!instance)
|
|
68
|
-
throw new Error("Please use
|
|
69
|
-
const visible = (0,
|
|
70
|
-
const
|
|
71
|
-
instance == null ? void 0 : instance.emit(
|
|
111
|
+
throw new Error("Please use useDisclosure in component setup");
|
|
112
|
+
const visible = (0, import_core2.useVModel)(instance.props, model, instance.emit, { passive: true });
|
|
113
|
+
const _cancel = (value) => {
|
|
114
|
+
instance == null ? void 0 : instance.emit(cancel, value);
|
|
115
|
+
visible.value = false;
|
|
116
|
+
};
|
|
117
|
+
const _confirm = (value) => {
|
|
118
|
+
instance == null ? void 0 : instance.emit(confirm, value);
|
|
72
119
|
visible.value = false;
|
|
73
120
|
};
|
|
74
|
-
const
|
|
75
|
-
instance == null ? void 0 : instance.emit(
|
|
121
|
+
const _close = (value) => {
|
|
122
|
+
instance == null ? void 0 : instance.emit(close, value);
|
|
76
123
|
visible.value = false;
|
|
77
124
|
};
|
|
78
125
|
return {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
126
|
+
cancel: _cancel,
|
|
127
|
+
confirm: _confirm,
|
|
128
|
+
close: _close,
|
|
129
|
+
vanish: import_core.noop,
|
|
82
130
|
visible,
|
|
83
131
|
in_dec: true
|
|
84
132
|
};
|
|
85
133
|
}
|
|
86
134
|
|
|
87
|
-
// src/composable/
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
135
|
+
// src/composable/overlay.ts
|
|
136
|
+
var import_core4 = require("@overlastic/core");
|
|
137
|
+
var import_pascal_case = require("pascal-case");
|
|
138
|
+
var import_vue3 = require("vue");
|
|
139
|
+
|
|
140
|
+
// src/composable/utils/index.ts
|
|
141
|
+
var import_core3 = require("@overlastic/core");
|
|
142
|
+
var import_vue_demi3 = require("vue-demi");
|
|
143
|
+
function createScripts(options) {
|
|
144
|
+
const { cancel: _cancel } = options.deferred || {};
|
|
91
145
|
const { vanish: _vanish } = options;
|
|
92
|
-
const visible = (0,
|
|
146
|
+
const visible = (0, import_vue_demi3.ref)(false);
|
|
93
147
|
function vanish() {
|
|
94
148
|
_vanish == null ? void 0 : _vanish();
|
|
95
|
-
|
|
149
|
+
_cancel == null ? void 0 : _cancel();
|
|
96
150
|
}
|
|
97
151
|
return {
|
|
98
|
-
|
|
99
|
-
|
|
152
|
+
confirm: options.deferred.confirm,
|
|
153
|
+
cancel: options.deferred.cancel,
|
|
154
|
+
close: () => options.deferred.confirm(),
|
|
100
155
|
deferred: options.deferred,
|
|
101
156
|
visible,
|
|
102
157
|
vanish
|
|
103
158
|
};
|
|
104
159
|
}
|
|
105
|
-
|
|
106
|
-
// src/composable/holder.ts
|
|
107
|
-
var import_vue_demi3 = require("vue-demi");
|
|
108
|
-
var import_core3 = require("@overlastic/core");
|
|
109
|
-
var import_pascal_case = require("pascal-case");
|
|
110
|
-
function useOverlayHolder(component, options = {}) {
|
|
111
|
-
const { callback, scripts, props, refresh } = useRefreshMetadata();
|
|
112
|
-
const name = (0, import_core3.defineName)(options.id, options.autoIncrement);
|
|
113
|
-
function render() {
|
|
114
|
-
return (0, import_vue_demi3.h)(
|
|
115
|
-
import_vue_demi3.Teleport,
|
|
116
|
-
{
|
|
117
|
-
to: options.root || document.body,
|
|
118
|
-
disabled: options.root === false
|
|
119
|
-
},
|
|
120
|
-
(0, import_vue_demi3.h)("div", { id: name }, [
|
|
121
|
-
(0, import_vue_demi3.h)(component, props.value)
|
|
122
|
-
])
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
const Holder = (0, import_vue_demi3.defineComponent)({
|
|
126
|
-
name: (0, import_pascal_case.pascalCase)(name),
|
|
127
|
-
setup() {
|
|
128
|
-
(0, import_vue_demi3.provide)(ScriptsInjectionKey, scripts);
|
|
129
|
-
return () => refresh.value ? render() : null;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
return [Holder, callback];
|
|
133
|
-
}
|
|
134
|
-
function useRefreshMetadata() {
|
|
160
|
+
function createRefreshMetadata() {
|
|
135
161
|
const visible = (0, import_vue_demi3.ref)(false);
|
|
136
162
|
const refresh = (0, import_vue_demi3.ref)(false);
|
|
137
163
|
const props = (0, import_vue_demi3.ref)();
|
|
@@ -139,12 +165,12 @@ function useRefreshMetadata() {
|
|
|
139
165
|
function vanish() {
|
|
140
166
|
refresh.value = false;
|
|
141
167
|
props.value = {};
|
|
142
|
-
scripts.
|
|
168
|
+
scripts.cancel();
|
|
143
169
|
}
|
|
144
170
|
function callback(_props) {
|
|
145
171
|
scripts.deferred = (0, import_core3.createDeferred)();
|
|
146
|
-
scripts.
|
|
147
|
-
scripts.
|
|
172
|
+
scripts.confirm = scripts.deferred.confirm;
|
|
173
|
+
scripts.cancel = scripts.deferred.cancel;
|
|
148
174
|
props.value = _props;
|
|
149
175
|
refresh.value = true;
|
|
150
176
|
return scripts.deferred;
|
|
@@ -152,33 +178,63 @@ function useRefreshMetadata() {
|
|
|
152
178
|
return { callback, scripts, props, refresh };
|
|
153
179
|
}
|
|
154
180
|
|
|
155
|
-
// src/composable/
|
|
156
|
-
var
|
|
157
|
-
var import_vue = require("vue");
|
|
158
|
-
var import_pascal_case2 = require("pascal-case");
|
|
159
|
-
var { define } = (0, import_core4.createConstructor)((Instance, props, options) => {
|
|
181
|
+
// src/composable/overlay.ts
|
|
182
|
+
var { define: defineInject } = (0, import_core4.createConstructor)((Instance, props, options) => {
|
|
160
183
|
const { id, deferred, render, vanish: _vanish } = options;
|
|
161
|
-
const InstanceWithProvider = (0,
|
|
162
|
-
name: (0,
|
|
184
|
+
const InstanceWithProvider = (0, import_vue3.defineComponent)({
|
|
185
|
+
name: (0, import_pascal_case.pascalCase)(id),
|
|
163
186
|
setup: () => {
|
|
164
|
-
const scripts =
|
|
165
|
-
(0,
|
|
187
|
+
const scripts = createScripts({ vanish, deferred });
|
|
188
|
+
(0, import_vue3.provide)(ScriptsInjectionKey, scripts);
|
|
166
189
|
},
|
|
167
|
-
render: () => (0,
|
|
190
|
+
render: () => (0, import_vue3.h)(Instance, props)
|
|
168
191
|
});
|
|
169
192
|
function vanish() {
|
|
170
193
|
_vanish(InstanceWithProvider);
|
|
171
194
|
}
|
|
172
195
|
render(InstanceWithProvider, props);
|
|
173
196
|
}, { container: false });
|
|
174
|
-
function
|
|
175
|
-
const {
|
|
176
|
-
|
|
197
|
+
function defineHolder(component, options = {}) {
|
|
198
|
+
const { callback, scripts, props, refresh } = createRefreshMetadata();
|
|
199
|
+
const name = (0, import_core4.defineName)(options.id, options.autoIncrement);
|
|
200
|
+
function render() {
|
|
201
|
+
return (0, import_vue3.h)(
|
|
202
|
+
import_vue3.Teleport,
|
|
203
|
+
{
|
|
204
|
+
to: options.root || document.body,
|
|
205
|
+
disabled: options.root === false
|
|
206
|
+
},
|
|
207
|
+
(0, import_vue3.h)("div", { id: name }, [
|
|
208
|
+
(0, import_vue3.h)(component, props.value)
|
|
209
|
+
])
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
const Holder = (0, import_vue3.defineComponent)({
|
|
213
|
+
name: (0, import_pascal_case.pascalCase)(name),
|
|
214
|
+
setup() {
|
|
215
|
+
(0, import_vue3.provide)(ScriptsInjectionKey, scripts);
|
|
216
|
+
return () => refresh.value ? render() : null;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
return [
|
|
220
|
+
Holder,
|
|
221
|
+
callback
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
function useOverlay(Instance, options = {}) {
|
|
225
|
+
const { type = "inject" } = options != null ? options : {};
|
|
226
|
+
if (type === "inject") {
|
|
227
|
+
const { render, vanish } = (0, import_vue3.inject)(InstancesInjectionKey);
|
|
228
|
+
return defineInject(Instance, { render, vanish });
|
|
229
|
+
}
|
|
230
|
+
if (type === "holder") {
|
|
231
|
+
return defineHolder(Instance, options);
|
|
232
|
+
}
|
|
177
233
|
}
|
|
178
234
|
|
|
179
235
|
// src/define/constructor.ts
|
|
180
236
|
var import_core5 = require("@overlastic/core");
|
|
181
|
-
var
|
|
237
|
+
var import_pascal_case2 = require("pascal-case");
|
|
182
238
|
var import_vue_demi4 = require("vue-demi");
|
|
183
239
|
|
|
184
240
|
// src/utils/index.ts
|
|
@@ -199,9 +255,9 @@ var constructor = (0, import_core5.createConstructor)((Instance, props, options)
|
|
|
199
255
|
container.remove();
|
|
200
256
|
}
|
|
201
257
|
const InstanceWithProvider = (0, import_vue_demi4.defineComponent)({
|
|
202
|
-
name: (0,
|
|
258
|
+
name: (0, import_pascal_case2.pascalCase)(id),
|
|
203
259
|
setup: () => {
|
|
204
|
-
const scripts =
|
|
260
|
+
const scripts = createScripts({
|
|
205
261
|
vanish,
|
|
206
262
|
deferred
|
|
207
263
|
});
|
|
@@ -219,57 +275,12 @@ var constructor = (0, import_core5.createConstructor)((Instance, props, options)
|
|
|
219
275
|
var defineOverlay = constructor.define;
|
|
220
276
|
var renderOverlay = constructor.render;
|
|
221
277
|
|
|
222
|
-
// src/components/Field.ts
|
|
223
|
-
var import_vue2 = require("vue");
|
|
224
|
-
var Field = (0, import_vue2.defineComponent)({
|
|
225
|
-
name: "Field",
|
|
226
|
-
props: {
|
|
227
|
-
is: {
|
|
228
|
-
type: [String, Number, Object],
|
|
229
|
-
default: ""
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
setup(props) {
|
|
233
|
-
return () => {
|
|
234
|
-
if (typeof props.is === "string" || typeof props.is === "number")
|
|
235
|
-
return props.is;
|
|
236
|
-
return props.is ? (0, import_vue2.h)(props.is) : null;
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// src/components/Provider.ts
|
|
242
|
-
var import_vue_demi5 = require("vue-demi");
|
|
243
|
-
var import_vue3 = require("vue");
|
|
244
|
-
var OverlaysProvider = (0, import_vue_demi5.defineComponent)({
|
|
245
|
-
setup(_, { slots }) {
|
|
246
|
-
const instances = (0, import_vue_demi5.ref)([]);
|
|
247
|
-
function render(Instance, props) {
|
|
248
|
-
console.log({ Instance, props });
|
|
249
|
-
instances.value.push({ Instance: (0, import_vue3.markRaw)(Instance), props });
|
|
250
|
-
}
|
|
251
|
-
function vanish(instance) {
|
|
252
|
-
instances.value = instances.value.filter(({ Instance }) => Instance !== instance);
|
|
253
|
-
}
|
|
254
|
-
(0, import_vue_demi5.provide)(InstancesInjectionKey, { render, vanish });
|
|
255
|
-
return () => {
|
|
256
|
-
var _a;
|
|
257
|
-
return (0, import_vue_demi5.h)(import_vue_demi5.Fragment, [
|
|
258
|
-
...instances.value.map(
|
|
259
|
-
({ Instance, props }, index) => (0, import_vue_demi5.h)(Instance, { ...props, key: index })
|
|
260
|
-
),
|
|
261
|
-
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
262
|
-
]);
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
278
|
// src/index.ts
|
|
268
279
|
function install(app) {
|
|
269
280
|
context.appContext = app._context;
|
|
270
281
|
}
|
|
271
282
|
var unoverlay = { install };
|
|
272
|
-
var
|
|
283
|
+
var index_default = unoverlay;
|
|
273
284
|
// Annotate the CommonJS export names for ESM import in node:
|
|
274
285
|
0 && (module.exports = {
|
|
275
286
|
Field,
|
|
@@ -277,7 +288,6 @@ var src_default = unoverlay;
|
|
|
277
288
|
defineOverlay,
|
|
278
289
|
install,
|
|
279
290
|
renderOverlay,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
useOverlayInject
|
|
291
|
+
useDisclosure,
|
|
292
|
+
useOverlay
|
|
283
293
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,52 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { Ref, AppContext, App } from 'vue-demi';
|
|
3
|
-
import * as _overlastic_core from '@overlastic/core';
|
|
4
|
-
import { Deferred, ImperativeOverlay, GlobalMountOptions, MountOptions } from '@overlastic/core';
|
|
5
3
|
import * as vue from 'vue';
|
|
6
|
-
import {
|
|
4
|
+
import { PropType, VNode, Component, VNodeProps } from 'vue';
|
|
5
|
+
import { Deferred, MountOptions, ImperativeOverlay } from '@overlastic/core';
|
|
6
|
+
|
|
7
|
+
declare const Field: vue.DefineComponent<{
|
|
8
|
+
is: {
|
|
9
|
+
type: PropType<string | number | VNode | Component>;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
}, () => string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}> | null, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
15
|
+
is: {
|
|
16
|
+
type: PropType<string | number | VNode | Component>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
}>>, {
|
|
20
|
+
is: string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}> | Component;
|
|
23
|
+
}, {}>;
|
|
24
|
+
|
|
25
|
+
declare const OverlaysProvider: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
28
|
|
|
8
29
|
interface PromptifyEvents {
|
|
9
30
|
/**
|
|
10
|
-
*
|
|
31
|
+
* cancel event name used by the template
|
|
32
|
+
*
|
|
33
|
+
* @default 'cancel'
|
|
34
|
+
*/
|
|
35
|
+
cancel?: string;
|
|
36
|
+
/**
|
|
37
|
+
* confirm event name used by the template
|
|
11
38
|
*
|
|
12
|
-
* @default '
|
|
39
|
+
* @default 'confirm'
|
|
13
40
|
*/
|
|
14
|
-
|
|
41
|
+
confirm?: string;
|
|
15
42
|
/**
|
|
16
|
-
*
|
|
43
|
+
* confirm event name used by the template
|
|
17
44
|
*
|
|
18
|
-
* @default '
|
|
45
|
+
* @default 'close'
|
|
19
46
|
*/
|
|
20
|
-
|
|
47
|
+
close?: string;
|
|
21
48
|
}
|
|
22
|
-
interface
|
|
49
|
+
interface UseDisclosureOptions {
|
|
23
50
|
/** animation duration to avoid premature destruction of components */
|
|
24
51
|
duration?: number;
|
|
25
52
|
/** whether to set visible to true immediately */
|
|
@@ -41,11 +68,13 @@ interface ExtendOverlayOptions {
|
|
|
41
68
|
*/
|
|
42
69
|
automatic?: boolean;
|
|
43
70
|
}
|
|
44
|
-
interface
|
|
45
|
-
/** the notification
|
|
46
|
-
|
|
47
|
-
/** the notification
|
|
48
|
-
|
|
71
|
+
interface UseDisclosureReturn {
|
|
72
|
+
/** the notification cancel, modify visible, and destroy it after the duration ends */
|
|
73
|
+
cancel: (reason?: any) => void;
|
|
74
|
+
/** the notification confirm, modify visible, and destroy it after the duration ends */
|
|
75
|
+
confirm: (value?: any) => void;
|
|
76
|
+
/** the notification confirm, modify visible, and destroy it after the duration ends */
|
|
77
|
+
close: () => void;
|
|
49
78
|
/** destroy the current instance (immediately) */
|
|
50
79
|
vanish: () => void;
|
|
51
80
|
/** visible control popup display and hide */
|
|
@@ -55,61 +84,39 @@ interface ExtendOverlayReturn {
|
|
|
55
84
|
}
|
|
56
85
|
/**
|
|
57
86
|
* get overlay layer meta information
|
|
58
|
-
* @function
|
|
59
|
-
* @function
|
|
87
|
+
* @function cancel the notification cancel, modify visible, and destroy it after the duration ends
|
|
88
|
+
* @function confirm the notification confirm, modify visible, and destroy it after the duration ends
|
|
60
89
|
* @function vanish destroy the current instance (immediately)
|
|
61
90
|
* @field visible control overlay display and hide
|
|
62
91
|
*/
|
|
63
|
-
declare function
|
|
92
|
+
declare function useDisclosure(options?: UseDisclosureOptions): UseDisclosureReturn;
|
|
64
93
|
|
|
65
94
|
type AbstractFn = abstract new (...args: any) => any;
|
|
66
95
|
|
|
67
|
-
type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
type KnownKeys<T> = {
|
|
97
|
+
[K in keyof T]: T[K] extends unknown ? (unknown extends T[K] ? never : K) : never;
|
|
98
|
+
}[keyof T];
|
|
99
|
+
type PickKnown<T> = Pick<T, KnownKeys<T>>;
|
|
100
|
+
type ExtractEvent<T extends AbstractFn> = Parameters<Required<InstanceType<T>['$props']>['onConfirm']>[0];
|
|
101
|
+
type ExtractProps<T extends AbstractFn> = PickKnown<Omit<InstanceType<T>['$props'], keyof VNodeProps | `on${string}` | 'visible'>>;
|
|
102
|
+
declare function useOverlay<Comp extends AbstractFn, Resolved = ExtractEvent<Comp>>(Instance: Comp, options?: MountOptions<{
|
|
103
|
+
type?: 'inject';
|
|
104
|
+
}>): ImperativeOverlay<ExtractProps<Comp>, Resolved>;
|
|
105
|
+
declare function useOverlay<Comp extends AbstractFn, Resolved = ExtractEvent<Comp>>(Instance: Comp, options?: MountOptions<{
|
|
106
|
+
type?: 'holder';
|
|
107
|
+
}>): [Comp, ImperativeOverlay<ExtractProps<Comp>, Resolved>];
|
|
75
108
|
|
|
76
109
|
interface VMountOptions {
|
|
77
110
|
/** current app context */
|
|
78
111
|
appContext?: AppContext;
|
|
79
112
|
}
|
|
80
113
|
|
|
81
|
-
declare const defineOverlay: <Component extends AbstractFn, Resolved = any>(instance: Component, options?: MountOptions<VMountOptions> | undefined) => ImperativeOverlay<InstanceType<Component>[
|
|
82
|
-
declare const renderOverlay: <Component extends AbstractFn, Resolved = any>(instance: Component, props?: InstanceType<Component>[
|
|
83
|
-
|
|
84
|
-
declare const Field: vue.DefineComponent<{
|
|
85
|
-
is: {
|
|
86
|
-
type: PropType<string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
87
|
-
[key: string]: any;
|
|
88
|
-
}> | Component>;
|
|
89
|
-
default: string;
|
|
90
|
-
};
|
|
91
|
-
}, () => string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
92
|
-
[key: string]: any;
|
|
93
|
-
}> | null, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
94
|
-
is: {
|
|
95
|
-
type: PropType<string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
}> | Component>;
|
|
98
|
-
default: string;
|
|
99
|
-
};
|
|
100
|
-
}>>, {
|
|
101
|
-
is: string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
102
|
-
[key: string]: any;
|
|
103
|
-
}> | Component;
|
|
104
|
-
}, {}>;
|
|
105
|
-
|
|
106
|
-
declare const OverlaysProvider: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
}>, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
|
|
114
|
+
declare const defineOverlay: <Component extends AbstractFn, Resolved = any>(instance: Component, options?: MountOptions<VMountOptions> | undefined) => ImperativeOverlay<InstanceType<Component>["$props"], Resolved, VMountOptions>;
|
|
115
|
+
declare const renderOverlay: <Component extends AbstractFn, Resolved = any>(instance: Component, props?: InstanceType<Component>["$props"] | undefined, options?: MountOptions<VMountOptions> | undefined) => Promise<Resolved>;
|
|
109
116
|
|
|
110
117
|
declare function install(app: App): void;
|
|
111
118
|
declare const unoverlay: {
|
|
112
119
|
install: typeof install;
|
|
113
120
|
};
|
|
114
121
|
|
|
115
|
-
export {
|
|
122
|
+
export { Field, OverlaysProvider, type UseDisclosureOptions, type UseDisclosureReturn, unoverlay as default, defineOverlay, install, renderOverlay, useDisclosure, useOverlay };
|