@overlastic/svelte 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/README.md +20 -90
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,99 +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/circle.svg" width="120" alt="Nest Logo" />
4
+ </a>
5
+ </p>
2
6
 
3
- create imperative overlays in the svelte application, supporting context inheritance!
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/svelte"><img src="https://img.shields.io/npm/v/@overlastic/svelte.svg" alt="NPM Version" /></a>
13
+ <a href="https://www.npmjs.com/@overlastic/svelte"><img src="https://img.shields.io/npm/l/@overlastic/svelte.svg" alt="Package License" /></a>
14
+ <a href="https://www.npmjs.com/@overlastic/svelte"><img src="https://img.shields.io/npm/dm/@overlastic/svelte.svg" alt="NPM Downloads" /></a>
15
+ </p>
6
16
 
7
- With pnpm:
8
- ```sh
9
- pnpm add @overlastic/svelte
10
- ```
11
-
12
- With yarn:
13
- ```sh
14
- yarn add @overlastic/svelte
15
- ```
16
-
17
- ## Usage
18
-
19
- ### Step 1: Define Component
20
-
21
- ```svelte
22
- <script lang="ts">
23
- import { useOverlayDefine, Overlay } from "@overlastic/svelte";
24
- import { fly } from "svelte/transition";
25
-
26
- export let title: number
27
- export let duration = 200
28
-
29
- // duration of overlay duration, helps prevent premature component destroy
30
- const { resolve, reject } = useOverlayDefine({ duration })
31
-
32
- function onClick() {
33
- resolve(`${title}:confirmed`)
34
- }
35
- </script>
36
-
37
- <Overlay>
38
- <div transition:fly={{ opacity: 0, duration }} on:click={onClick}>
39
- <slot name="title">
40
- { title }
41
- </slot>
42
- </div>
43
- </Overlay>
44
- ```
17
+ ## Description
45
18
 
46
- ### Step 2: Create Overlay
19
+ Create messages or dialog overlays using Overlastic in Svelte APP.
47
20
 
48
- You can use the `defineOverlay` method to convert the component into a modal dialog in Javascript / Typescript, which allows you to call it.
21
+ ## Installation
49
22
 
50
- ```ts
51
- import { defineOverlay } from '@overlastic/svelte'
52
- import OverlayComponent from './overlay.svelte'
53
-
54
- // Convert to imperative callback
55
- const callback = defineOverlay(OverlayComponent)
56
- // Call the component and get the value of the resolve callback
57
- const value = await callback({ title: 'callbackOverlay' })
58
- // value === "callbackOverlay:confirmed"
59
- ```
60
-
61
- You can also use `renderOverlay` to directly call the component and skip the `defineOverlay` method.
62
-
63
- ```ts
64
- import { renderOverlay } from '@overlastic/svelte'
65
- import OverlayComponent from './overlay.svelte'
66
-
67
- const value = await renderOverlay(OverlayComponent, {
68
- title: 'useOverlayDefine'
69
- })
70
- // value === "useOverlayDefine:confirmed"
23
+ ```bash
24
+ $ npm install --save @overlastic/svelte
71
25
  ```
72
26
 
73
- ## Controlled manner
74
-
75
- By default, you do not need to control the display and hiding of the `visible` variable. The value is controlled by the component `Overlay`, and you can pass in `visible` to control the display
27
+ ## Quick Start
76
28
 
77
- ```svelte
78
- <script lang="ts">
79
- import { useOverlayDefine, Overlay } from "@overlastic/svelte";
80
-
81
- let visible = false
82
-
83
- const { resolve, reject, deferred, vanish } = useOverlayDefine({
84
- // close the transition duration, at this point you need to manually destroy it
85
- duration: false,
86
- // cancel setting visible to true immediately
87
- immediate: false
88
- })
89
-
90
- // Manually set vanish (when promise ends)
91
- deferred.finally(() => vanish())
92
- </script>
93
-
94
- <Overlay bind:visible={visible}>
95
- <div on:click={() => resolve(`${title}:confirmed`)}>
96
- ...
97
- </div>
98
- </Overlay>
99
- ```
29
+ [Overview & Tutorial](https://overlastic.vercel.app/en/svelte/)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@overlastic/svelte",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/hairyf/overlastic#readme",
7
7
  "repository": {
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "svelte": "^3.57.0",
29
- "@overlastic/core": "^0.5.0"
29
+ "@overlastic/core": "^0.5.1"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts",