@overlastic/vue2 0.5.0 → 0.6.1

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 CHANGED
@@ -1,83 +1,29 @@
1
- # Getting Started
1
+ <p align="center">
2
+ <a href="https://overlastic.vercel.app/" target="blank">
3
+ <img src="https://github.com/hairyf/overlastic/raw/master/docs/public/logo.svg" width="120" alt="Nest Logo" />
4
+ </a>
5
+ </p>
2
6
 
3
- > overlays only supports Vue3 | Vue2 Composition-api
7
+ <p align="center">
8
+ A create modal | dialog | popup promise deferred library
9
+ </p>
4
10
 
5
- ## Install
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/@overlastic/vue2"><img src="https://img.shields.io/npm/v/@overlastic/vue2.svg" alt="NPM Version" /></a>
13
+ <a href="https://www.npmjs.com/@overlastic/vue2"><img src="https://img.shields.io/npm/l/@overlastic/vue2.svg" alt="Package License" /></a>
14
+ <a href="https://www.npmjs.com/@overlastic/vue2"><img src="https://img.shields.io/npm/dm/@overlastic/vue2.svg" alt="NPM Downloads" /></a>
15
+ </p>
6
16
 
7
- With pnpm:
8
- ```sh
9
- pnpm add @overlastic/vue
10
- ```
11
-
12
- With yarn:
13
- ```sh
14
- yarn add @overlastic/vue
15
- ```
17
+ ## Description
16
18
 
17
- ## Global
19
+ Create messages or dialog overlays using Overlastic in Vue2 APP.
18
20
 
19
- You can register overlays globally, which will inherit the application context for all popups.
21
+ ## Installation
20
22
 
21
- ```ts
22
- // main.js
23
- import Vue from 'vue'
24
- import unoverlay from '@overlastic/vue'
25
-
26
- const app = new Vue({})
27
- app.use(unoverlay)
23
+ ```bash
24
+ $ npm install --save @overlastic/vue2
28
25
  ```
29
26
 
30
- ## Usage
31
-
32
- ### Step 1: Define Component
33
-
34
- overlays is suitable for most components. Using useOverlayDefine can provide finer control over the component process.
35
-
36
- ```vue
37
- <!-- overlay.vue -->
38
- <script>
39
- import { useOverlayDefine } from '@overlastic/vue2'
40
- export default {
41
- mixins: [useOverlayDefine({ duration: 1000 })],
42
- methods: {
43
- onClick() {
44
- // use this.$visible
45
- // use this.$resolve or this.$reject
46
- }
47
- }
48
- }
49
- </script>
50
-
51
- <template>
52
- <div v-if="visible" @click="resolve(`${title}:confirmed`)">
53
- {{ title }}
54
- </div>
55
- </template>
56
- ```
27
+ ## Quick Start
57
28
 
58
- ### Step 2: Create Overlay
59
-
60
- You can use the `defineOverlay` method to convert the component into a modal dialog in Javascript / Typescript, which allows you to call it.
61
-
62
- ```ts
63
- import { defineOverlay } from '@overlastic/vue'
64
- import OverlayComponent from './overlay.vue'
65
-
66
- // Convert to imperative callback
67
- const callback = defineOverlay(OverlayComponent)
68
- // Call the component and get the value of the resolve callback
69
- const value = await callback({ title: 'callbackOverlay' })
70
- // value === "callbackOverlay:confirmed"
71
- ```
72
-
73
- You can also use `renderOverlay` to directly call the component and skip the `defineOverlay` method.
74
-
75
- ```ts
76
- import { renderOverlay } from '@overlastic/vue'
77
- import OverlayComponent from './overlay.vue'
78
-
79
- const value = await renderOverlay(OverlayComponent, {
80
- title: 'useOverlayDefine'
81
- })
82
- // value === "useOverlayDefine:confirmed"
83
- ```
29
+ [Overview & Tutorial](https://overlastic.vercel.app/vue/vue2)
package/dist/index.cjs CHANGED
@@ -35,7 +35,7 @@ __export(src_exports, {
35
35
  defineOverlay: () => defineOverlay,
36
36
  install: () => install,
37
37
  renderOverlay: () => renderOverlay,
38
- useOverlayDefine: () => useOverlayDefine
38
+ useDefineOverlay: () => useDefineOverlay
39
39
  });
40
40
  module.exports = __toCommonJS(src_exports);
41
41
 
@@ -82,7 +82,7 @@ function createVisibleScripts(options) {
82
82
  // src/composable/define.ts
83
83
  var import_core = require("@overlastic/core");
84
84
  var import_vue2 = __toESM(require("vue"), 1);
85
- function useOverlayDefine(options = {}) {
85
+ function useDefineOverlay(options = {}) {
86
86
  const { duration = 0, immediate = true, model = "visible", automatic = true, events = {} } = options;
87
87
  events.reject = events.reject || "reject";
88
88
  events.resolve = events.resolve || "resolve";
@@ -187,5 +187,5 @@ var src_default = unoverlay;
187
187
  defineOverlay,
188
188
  install,
189
189
  renderOverlay,
190
- useOverlayDefine
190
+ useDefineOverlay
191
191
  });
package/dist/index.d.cts CHANGED
@@ -17,7 +17,7 @@ interface PromptifyEvents {
17
17
  */
18
18
  resolve?: string;
19
19
  }
20
- interface OverlayDefineOptions {
20
+ interface DefineOverlayOptions {
21
21
  /** duration duration to avoid premature destruction of components */
22
22
  duration?: number;
23
23
  /** whether to set visible to true immediately */
@@ -39,7 +39,7 @@ interface OverlayDefineOptions {
39
39
  */
40
40
  automatic?: boolean;
41
41
  }
42
- declare function useOverlayDefine(options?: OverlayDefineOptions): vue_types_vue.ExtendedVue<Vue__default, {
42
+ declare function useDefineOverlay(options?: DefineOverlayOptions): vue_types_vue.ExtendedVue<Vue__default, {
43
43
  runtime_visible: boolean;
44
44
  } | {
45
45
  runtime_visible?: undefined;
@@ -66,4 +66,4 @@ declare const Field: Component;
66
66
  declare function install(_ins: any, parent: any): void;
67
67
  declare const unoverlay: PluginObject<Vue__default>;
68
68
 
69
- export { Field, type OverlayDefineOptions, unoverlay as default, defineOverlay, install, renderOverlay, useOverlayDefine };
69
+ export { type DefineOverlayOptions, Field, unoverlay as default, defineOverlay, install, renderOverlay, useDefineOverlay };
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ interface PromptifyEvents {
17
17
  */
18
18
  resolve?: string;
19
19
  }
20
- interface OverlayDefineOptions {
20
+ interface DefineOverlayOptions {
21
21
  /** duration duration to avoid premature destruction of components */
22
22
  duration?: number;
23
23
  /** whether to set visible to true immediately */
@@ -39,7 +39,7 @@ interface OverlayDefineOptions {
39
39
  */
40
40
  automatic?: boolean;
41
41
  }
42
- declare function useOverlayDefine(options?: OverlayDefineOptions): vue_types_vue.ExtendedVue<Vue__default, {
42
+ declare function useDefineOverlay(options?: DefineOverlayOptions): vue_types_vue.ExtendedVue<Vue__default, {
43
43
  runtime_visible: boolean;
44
44
  } | {
45
45
  runtime_visible?: undefined;
@@ -66,4 +66,4 @@ declare const Field: Component;
66
66
  declare function install(_ins: any, parent: any): void;
67
67
  declare const unoverlay: PluginObject<Vue__default>;
68
68
 
69
- export { Field, type OverlayDefineOptions, unoverlay as default, defineOverlay, install, renderOverlay, useOverlayDefine };
69
+ export { type DefineOverlayOptions, Field, unoverlay as default, defineOverlay, install, renderOverlay, useDefineOverlay };
@@ -26,7 +26,7 @@ var OverlaysVue = (() => {
26
26
  defineOverlay: () => defineOverlay,
27
27
  install: () => install,
28
28
  renderOverlay: () => renderOverlay,
29
- useOverlayDefine: () => useOverlayDefine
29
+ useDefineOverlay: () => useDefineOverlay
30
30
  });
31
31
 
32
32
  // ../../node_modules/.pnpm/vue@2.6.0/node_modules/vue/dist/vue.runtime.esm.js
@@ -6208,7 +6208,7 @@ var OverlaysVue = (() => {
6208
6208
  }
6209
6209
 
6210
6210
  // src/composable/define.ts
6211
- function useOverlayDefine(options = {}) {
6211
+ function useDefineOverlay(options = {}) {
6212
6212
  const { duration = 0, immediate = true, model = "visible", automatic = true, events: events2 = {} } = options;
6213
6213
  events2.reject = events2.reject || "reject";
6214
6214
  events2.resolve = events2.resolve || "resolve";
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ function createVisibleScripts(options) {
41
41
  // src/composable/define.ts
42
42
  import { delay } from "@overlastic/core";
43
43
  import Vue2 from "vue";
44
- function useOverlayDefine(options = {}) {
44
+ function useDefineOverlay(options = {}) {
45
45
  const { duration = 0, immediate = true, model = "visible", automatic = true, events = {} } = options;
46
46
  events.reject = events.reject || "reject";
47
47
  events.resolve = events.resolve || "resolve";
@@ -146,5 +146,5 @@ export {
146
146
  defineOverlay,
147
147
  install,
148
148
  renderOverlay,
149
- useOverlayDefine
149
+ useDefineOverlay
150
150
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@overlastic/vue2",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.6.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/hairyf/overlastic#readme",
7
7
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "mitt": "^3.0.1",
32
32
  "pascal-case": "3.1.2",
33
- "@overlastic/core": "^0.5.0"
33
+ "@overlastic/core": "^0.6.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "vue": "^2.6"