@pyreon/toast 0.11.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/LICENSE +21 -0
- package/README.md +44 -0
- package/lib/analysis/index.js.html +5406 -0
- package/lib/index.js +362 -0
- package/lib/index.js.map +1 -0
- package/lib/types/index.d.ts +109 -0
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +53 -0
- package/src/index.ts +40 -0
- package/src/styles.ts +80 -0
- package/src/tests/toast.test.ts +247 -0
- package/src/toast.ts +210 -0
- package/src/toaster.tsx +155 -0
- package/src/types.ts +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Vit Bokisch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @pyreon/toast
|
|
2
|
+
|
|
3
|
+
Signal-driven toast notifications for the Pyreon framework.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @pyreon/toast
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { toast, Toaster } from "@pyreon/toast"
|
|
15
|
+
|
|
16
|
+
// Place once at app root
|
|
17
|
+
<Toaster position="top-right" />
|
|
18
|
+
|
|
19
|
+
// Show toasts from anywhere — no provider needed
|
|
20
|
+
toast.success("Saved!")
|
|
21
|
+
toast.error("Connection failed")
|
|
22
|
+
toast("Custom message", { duration: 8000 })
|
|
23
|
+
|
|
24
|
+
// Promise pattern
|
|
25
|
+
toast.promise(saveData(), {
|
|
26
|
+
loading: "Saving...",
|
|
27
|
+
success: "Done!",
|
|
28
|
+
error: "Failed",
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
- `toast(message, options?)` — show a toast, returns id
|
|
35
|
+
- `toast.success/error/warning/info(message)` — typed shortcuts
|
|
36
|
+
- `toast.loading(message)` — persistent loading toast
|
|
37
|
+
- `toast.update(id, updates)` — update an existing toast
|
|
38
|
+
- `toast.dismiss(id?)` — dismiss one or all
|
|
39
|
+
- `toast.promise(promise, { loading, success, error })` — auto-updating toast
|
|
40
|
+
- `<Toaster position? max? gap? offset? />` — render component
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|