@samline/notify 0.1.1 → 0.1.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/README.md +9 -7
- package/docs/browser.md +4 -4
- package/package.json +9 -7
- package/CHANGELOG.md +0 -13
- package/dist/core/index.d.ts +0 -47
- package/dist/core/index.test.d.ts +0 -1
- package/dist/notifications.umd.js +0 -1133
- package/dist/react/Toaster.d.ts +0 -6
- package/dist/react/index.d.ts +0 -10
- package/dist/samline.notifications.umd.js +0 -1131
- package/dist/svelte/store.d.ts +0 -3
- package/dist/vanilla/index.d.ts +0 -13
- package/dist/vanilla/toasterManager.d.ts +0 -6
- package/dist/vue/index.d.ts +0 -20
- package/examples/no-bundler/index.html +0 -25
- package/src/core/index.test.ts +0 -26
- package/src/core/index.ts +0 -122
- package/src/react/Toaster.tsx +0 -67
- package/src/react/index.ts +0 -13
- package/src/styles/sileo.css +0 -49
- package/src/svelte/Toaster.svelte +0 -69
- package/src/svelte/store.ts +0 -9
- package/src/vanilla/index.ts +0 -22
- package/src/vanilla/toasterManager.ts +0 -132
- package/src/vue/index.ts +0 -61
- package/test/smoke/no-bundler.test.ts +0 -10
- package/test/smoke/svelte.test.ts +0 -12
- package/tsconfig.json +0 -16
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
## @samline/notify
|
|
2
|
-
A Sileo-inspired notifications engine
|
|
2
|
+
A Sileo-inspired notifications engine providing a framework-agnostic core and lightweight adapters for Vanilla JS, React, Vue and Svelte.
|
|
3
|
+
|
|
4
|
+
Inspired by Sileo — see the original project: https://github.com/hiaaryan/sileo
|
|
3
5
|
|
|
4
6
|
Table of Contents
|
|
5
7
|
|
|
@@ -45,8 +47,8 @@ CDN / Browser
|
|
|
45
47
|
Use the browser build when your project loads scripts directly and cannot compile npm modules (Shopify, WordPress, plain HTML). Example CDN usage (replace version):
|
|
46
48
|
|
|
47
49
|
```html
|
|
48
|
-
<script src="/
|
|
49
|
-
<link rel="stylesheet" href="/
|
|
50
|
+
<script src="https://unpkg.com/@samline/notify@latest/dist/notify.umd.js"></script>
|
|
51
|
+
<link rel="stylesheet" href="https://unpkg.com/@samline/notify@latest/dist/styles.css">
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
Entry Points
|
|
@@ -57,7 +59,7 @@ Choose the entrypoint matching your stack so you only import what you need.
|
|
|
57
59
|
| --- | --- | --- |
|
|
58
60
|
| Vanilla JS | `import { default as notifications } from '@samline/notify'` | [docs/vanilla.md](docs/vanilla.md) |
|
|
59
61
|
| Vanilla explicit subpath | `import { sileo } from '@samline/notify/vanilla'` | [docs/vanilla.md](docs/vanilla.md) |
|
|
60
|
-
| Browser / CDN | `<script src="/
|
|
62
|
+
| Browser / CDN | `<script src="https://unpkg.com/@samline/notify@latest/dist/notify.umd.js"></script>` | [docs/browser.md](docs/browser.md) |
|
|
61
63
|
| React | `import { Toaster } from '@samline/notify/react'` | [docs/react.md](docs/react.md) |
|
|
62
64
|
| Vue | `import Notifications from '@samline/notify/vue'` | [docs/vue.md](docs/vue.md) |
|
|
63
65
|
| Svelte | `import Toaster from '@samline/notify/svelte'` | [docs/svelte.md](docs/svelte.md) |
|
|
@@ -67,12 +69,12 @@ Quick Start
|
|
|
67
69
|
Vanilla example (UMD / modules):
|
|
68
70
|
|
|
69
71
|
```html
|
|
70
|
-
<script src="/
|
|
71
|
-
<link rel="stylesheet" href="/
|
|
72
|
+
<script src="https://unpkg.com/@samline/notify@latest/dist/notify.umd.js"></script>
|
|
73
|
+
<link rel="stylesheet" href="https://unpkg.com/@samline/notify@latest/dist/styles.css">
|
|
72
74
|
<script>
|
|
73
75
|
const api = window.notify || window.notifications;
|
|
74
76
|
api.initToasters(document.body, ['top-right']);
|
|
75
|
-
api.notify({ title: '
|
|
77
|
+
api.notify({ title: 'Saved', description: 'Changes saved', type: 'success' });
|
|
76
78
|
</script>
|
|
77
79
|
```
|
|
78
80
|
|
package/docs/browser.md
CHANGED
|
@@ -5,8 +5,8 @@ Quick start
|
|
|
5
5
|
Include the UMD bundle and stylesheet in a static page:
|
|
6
6
|
|
|
7
7
|
```html
|
|
8
|
-
<link rel="stylesheet" href="/
|
|
9
|
-
<script src="/
|
|
8
|
+
<link rel="stylesheet" href="https://unpkg.com/@samline/notify@latest/dist/styles.css">
|
|
9
|
+
<script src="https://unpkg.com/@samline/notify@latest/dist/notify.umd.js"></script>
|
|
10
10
|
<script>
|
|
11
11
|
const api = window.notify || window.notifications;
|
|
12
12
|
api.initToasters(document.body, ['top-right']);
|
|
@@ -27,8 +27,8 @@ Use the browser build when your project loads scripts directly in the page and c
|
|
|
27
27
|
Example using the UMD build (replace path/version as needed):
|
|
28
28
|
|
|
29
29
|
```html
|
|
30
|
-
<link rel="stylesheet" href="/
|
|
31
|
-
<script src="/
|
|
30
|
+
<link rel="stylesheet" href="https://unpkg.com/@samline/notify@latest/dist/styles.css">
|
|
31
|
+
<script src="https://unpkg.com/@samline/notify@latest/dist/notify.umd.js"></script>
|
|
32
32
|
<script>
|
|
33
33
|
document.addEventListener('DOMContentLoaded', () => {
|
|
34
34
|
const api = window.notify || window.notifications;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samline/notify",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Notifications engine inspired by Sileo, with adapters for vanilla, React, Vue and Svelte.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -42,13 +42,15 @@
|
|
|
42
42
|
"@types/node": "^20.0.0",
|
|
43
43
|
"@types/react": "^18.2.0",
|
|
44
44
|
"@types/react-dom": "^18.2.0"
|
|
45
|
-
}
|
|
46
|
-
,
|
|
45
|
+
},
|
|
47
46
|
"devDependenciesMeta": {
|
|
48
|
-
"@types/react": {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
"@types/react": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"@types/react-dom": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
52
54
|
"dependencies": {
|
|
53
55
|
"motion": "^10.0.0"
|
|
54
56
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.1.0 - Initial rename and multi-adapter release
|
|
4
|
-
|
|
5
|
-
- Renamed internal controller `sileo` -> `notify` (kept `sileo` alias for compatibility).
|
|
6
|
-
- Package renamed to `@samline/notify`.
|
|
7
|
-
- UMD build changed to `dist/notify.umd.js` and exposes `window.notify` (compat `window.notifications`).
|
|
8
|
-
- Updated docs, examples and tests to reflect the rename.
|
|
9
|
-
- Copied styles to `dist/styles.css` as part of build.
|
|
10
|
-
|
|
11
|
-
## 0.1.1 - Republish
|
|
12
|
-
|
|
13
|
-
- Republished after registry conflict on 0.1.0. No functional changes.
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export type Position = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
2
|
-
export type ToastType = 'success' | 'error' | 'info' | 'warning' | 'loading' | 'action';
|
|
3
|
-
export interface ToastButton {
|
|
4
|
-
title: string;
|
|
5
|
-
onClick: () => void;
|
|
6
|
-
}
|
|
7
|
-
export interface ToastOptions {
|
|
8
|
-
title?: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
position?: Position;
|
|
11
|
-
duration?: number | null;
|
|
12
|
-
type?: ToastType;
|
|
13
|
-
button?: ToastButton;
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}
|
|
16
|
-
export interface ToastItem {
|
|
17
|
-
id: string;
|
|
18
|
-
options: ToastOptions;
|
|
19
|
-
createdAt: number;
|
|
20
|
-
}
|
|
21
|
-
type Listener = (items: ToastItem[]) => void;
|
|
22
|
-
declare class NotifyController {
|
|
23
|
-
private toasts;
|
|
24
|
-
private listeners;
|
|
25
|
-
private idCounter;
|
|
26
|
-
private nextId;
|
|
27
|
-
subscribe(fn: Listener): () => boolean;
|
|
28
|
-
private notify;
|
|
29
|
-
getToasts(): ToastItem[];
|
|
30
|
-
show(opts: ToastOptions): string;
|
|
31
|
-
success(opts: ToastOptions): string;
|
|
32
|
-
error(opts: ToastOptions): string;
|
|
33
|
-
info(opts: ToastOptions): string;
|
|
34
|
-
warning(opts: ToastOptions): string;
|
|
35
|
-
action(opts: ToastOptions): string;
|
|
36
|
-
dismiss(id: string): void;
|
|
37
|
-
clear(position?: Position): void;
|
|
38
|
-
promise<T = any>(p: Promise<T>, opts: {
|
|
39
|
-
loading: ToastOptions;
|
|
40
|
-
success?: ToastOptions | ((r: T) => ToastOptions);
|
|
41
|
-
error?: ToastOptions | ((e: any) => ToastOptions);
|
|
42
|
-
position?: Position;
|
|
43
|
-
}): Promise<T>;
|
|
44
|
-
}
|
|
45
|
-
export declare const notify: NotifyController;
|
|
46
|
-
export declare const sileo: NotifyController;
|
|
47
|
-
export default notify;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|