@samline/notify 0.2.7 → 1.0.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 +22 -0
- package/README.md +121 -150
- package/dist/browser-notify.js +69 -0
- package/dist/cc-2Yt7NqMX.mjs +21 -0
- package/dist/cc-B6peeNak.mjs +33 -0
- package/dist/cc-BWuAzFJ6.js +12 -0
- package/dist/cc-CaBHsjUt.js +34 -0
- package/dist/cc-DGff5sSY.js +21 -0
- package/dist/cc-he3fHS3P.mjs +12 -0
- package/dist/notify.d.mts +44 -0
- package/dist/notify.d.mts.map +1 -0
- package/dist/notify.d.ts +44 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +90 -0
- package/dist/notify.mjs +87 -0
- package/dist/react-notify-12s-7LOZlSBi.js +1068 -0
- package/dist/react-notify-12s-BjWbwTu8.mjs +1066 -0
- package/dist/react.d.mts +66 -0
- package/dist/react.d.mts.map +1 -0
- package/dist/react.d.ts +66 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +18 -0
- package/dist/react.mjs +10 -0
- package/dist/styles.css +477 -89
- package/dist/svelte.d.mts +45 -0
- package/dist/svelte.d.mts.map +1 -0
- package/dist/svelte.d.ts +45 -0
- package/dist/svelte.d.ts.map +1 -0
- package/dist/svelte.js +168 -0
- package/dist/svelte.mjs +165 -0
- package/dist/vue.d.mts +103 -0
- package/dist/vue.d.mts.map +1 -0
- package/dist/vue.d.ts +103 -0
- package/dist/vue.d.ts.map +1 -0
- package/dist/vue.js +2099 -0
- package/dist/vue.mjs +2096 -0
- package/package.json +95 -57
- package/dist/index.cjs.js +0 -1249
- package/dist/index.esm.js +0 -1242
- package/dist/notify.umd.js +0 -1255
- package/docs/browser.md +0 -92
- package/docs/react.md +0 -275
- package/docs/svelte.md +0 -267
- package/docs/vanilla.md +0 -256
- package/docs/vue.md +0 -301
- package/rollup.config.mjs +0 -56
package/dist/svelte.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
var cc = require('./cc-BWuAzFJ6.js');
|
|
4
|
+
|
|
5
|
+
// Store the references to globals in case someone tries to monkey patch these, causing the below
|
|
6
|
+
// to de-opt (this occurs often when using popular extensions).
|
|
7
|
+
const noop = ()=>{};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {unknown} a
|
|
11
|
+
* @param {unknown} b
|
|
12
|
+
* @returns {boolean}
|
|
13
|
+
*/ function safe_not_equal(a, b) {
|
|
14
|
+
return a != a ? b == b : a !== b || a !== null && typeof a === 'object' || typeof a === 'function';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var _globalThis_document;
|
|
18
|
+
/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */ new class StaleReactionError extends Error {
|
|
19
|
+
constructor(...args){
|
|
20
|
+
super(...args), this.name = 'StaleReactionError', this.message = 'The reaction that called `getAbortSignal()` was re-run or destroyed';
|
|
21
|
+
}
|
|
22
|
+
}();
|
|
23
|
+
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
24
|
+
!!((_globalThis_document = globalThis.document) == null ? void 0 : _globalThis_document.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes('xml');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @type {Array<SubscribeInvalidateTuple<any> | any>}
|
|
28
|
+
*/ const subscriber_queue = [];
|
|
29
|
+
/**
|
|
30
|
+
* Create a `Writable` store that allows both updating and reading by subscription.
|
|
31
|
+
*
|
|
32
|
+
* @template T
|
|
33
|
+
* @param {T} [value] initial value
|
|
34
|
+
* @param {StartStopNotifier<T>} [start]
|
|
35
|
+
* @returns {Writable<T>}
|
|
36
|
+
*/ function writable(value, start = noop) {
|
|
37
|
+
/** @type {Unsubscriber | null} */ let stop = null;
|
|
38
|
+
/** @type {Set<SubscribeInvalidateTuple<T>>} */ const subscribers = new Set();
|
|
39
|
+
/**
|
|
40
|
+
* @param {T} new_value
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/ function set(new_value) {
|
|
43
|
+
if (safe_not_equal(value, new_value)) {
|
|
44
|
+
value = new_value;
|
|
45
|
+
if (stop) {
|
|
46
|
+
// store is ready
|
|
47
|
+
const run_queue = !subscriber_queue.length;
|
|
48
|
+
for (const subscriber of subscribers){
|
|
49
|
+
subscriber[1]();
|
|
50
|
+
subscriber_queue.push(subscriber, value);
|
|
51
|
+
}
|
|
52
|
+
if (run_queue) {
|
|
53
|
+
for(let i = 0; i < subscriber_queue.length; i += 2){
|
|
54
|
+
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
|
55
|
+
}
|
|
56
|
+
subscriber_queue.length = 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param {Updater<T>} fn
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/ function update(fn) {
|
|
65
|
+
set(fn(/** @type {T} */ value));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @param {Subscriber<T>} run
|
|
69
|
+
* @param {() => void} [invalidate]
|
|
70
|
+
* @returns {Unsubscriber}
|
|
71
|
+
*/ function subscribe(run, invalidate = noop) {
|
|
72
|
+
/** @type {SubscribeInvalidateTuple<T>} */ const subscriber = [
|
|
73
|
+
run,
|
|
74
|
+
invalidate
|
|
75
|
+
];
|
|
76
|
+
subscribers.add(subscriber);
|
|
77
|
+
if (subscribers.size === 1) {
|
|
78
|
+
stop = start(set, update) || noop;
|
|
79
|
+
}
|
|
80
|
+
run(/** @type {T} */ value);
|
|
81
|
+
return ()=>{
|
|
82
|
+
subscribers.delete(subscriber);
|
|
83
|
+
if (subscribers.size === 0 && stop) {
|
|
84
|
+
stop();
|
|
85
|
+
stop = null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
set,
|
|
91
|
+
update,
|
|
92
|
+
subscribe
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Notify logic (no React dependencies)
|
|
97
|
+
// Provides toast management and utilities for VanillaJS, Vue, Svelte, etc.
|
|
98
|
+
class NotifyCore {
|
|
99
|
+
generateId() {
|
|
100
|
+
return `${++this.idCounter}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
101
|
+
}
|
|
102
|
+
subscribe(fn) {
|
|
103
|
+
this.listeners.add(fn);
|
|
104
|
+
fn(this.toasts);
|
|
105
|
+
return ()=>this.listeners.delete(fn);
|
|
106
|
+
}
|
|
107
|
+
emit() {
|
|
108
|
+
for (const fn of this.listeners)fn(this.toasts);
|
|
109
|
+
}
|
|
110
|
+
update(fn) {
|
|
111
|
+
this.toasts = fn(this.toasts);
|
|
112
|
+
this.emit();
|
|
113
|
+
}
|
|
114
|
+
dismiss(id) {
|
|
115
|
+
const item = this.toasts.find((t)=>t.id === id);
|
|
116
|
+
if (!item || item.exiting) return;
|
|
117
|
+
this.update((prev)=>prev.map((t)=>t.id === id ? cc._extends({}, t, {
|
|
118
|
+
exiting: true
|
|
119
|
+
}) : t));
|
|
120
|
+
setTimeout(()=>this.update((prev)=>prev.filter((t)=>t.id !== id)), 600);
|
|
121
|
+
}
|
|
122
|
+
show(opts) {
|
|
123
|
+
var _ref, _ref1, _opts_type;
|
|
124
|
+
// Use a unique identifier based on options (e.g., the title or a generated key)
|
|
125
|
+
// If not provided, use a default one
|
|
126
|
+
const id = opts.title ? `notify-${opts.title}` : "notify-default";
|
|
127
|
+
const prevItem = this.toasts.find((t)=>t.id === id);
|
|
128
|
+
const instanceId = (_ref = prevItem == null ? void 0 : prevItem.instanceId) != null ? _ref : this.generateId();
|
|
129
|
+
// Set the state correctly
|
|
130
|
+
const state = (_ref1 = (_opts_type = opts.type) != null ? _opts_type : prevItem == null ? void 0 : prevItem.type) != null ? _ref1 : "success";
|
|
131
|
+
const item = cc._extends({}, prevItem, opts, {
|
|
132
|
+
id,
|
|
133
|
+
instanceId,
|
|
134
|
+
type: state
|
|
135
|
+
});
|
|
136
|
+
this.update((prev)=>{
|
|
137
|
+
const filtered = prev.filter((t)=>t.id !== id);
|
|
138
|
+
return [
|
|
139
|
+
...filtered,
|
|
140
|
+
item
|
|
141
|
+
];
|
|
142
|
+
});
|
|
143
|
+
return id;
|
|
144
|
+
}
|
|
145
|
+
getToasts() {
|
|
146
|
+
return this.toasts;
|
|
147
|
+
}
|
|
148
|
+
constructor(){
|
|
149
|
+
this.toasts = [];
|
|
150
|
+
this.listeners = new Set();
|
|
151
|
+
this.position = "top-right";
|
|
152
|
+
this.options = undefined;
|
|
153
|
+
this.idCounter = 0;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Global instance for multiplatform usage
|
|
157
|
+
const notifyCore = new NotifyCore();
|
|
158
|
+
|
|
159
|
+
// Svelte wrapper for Notify
|
|
160
|
+
// Provides a store and function to show toasts in Svelte
|
|
161
|
+
const notifyToasts = writable(notifyCore.getToasts());
|
|
162
|
+
notifyCore.subscribe((t)=>notifyToasts.set(t));
|
|
163
|
+
function showNotifyToast(options) {
|
|
164
|
+
return notifyCore.show(options);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
exports.notifyToasts = notifyToasts;
|
|
168
|
+
exports.showNotifyToast = showNotifyToast;
|
package/dist/svelte.mjs
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { _ as _extends } from './cc-he3fHS3P.mjs';
|
|
2
|
+
|
|
3
|
+
// Store the references to globals in case someone tries to monkey patch these, causing the below
|
|
4
|
+
// to de-opt (this occurs often when using popular extensions).
|
|
5
|
+
const noop = ()=>{};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {unknown} a
|
|
9
|
+
* @param {unknown} b
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/ function safe_not_equal(a, b) {
|
|
12
|
+
return a != a ? b == b : a !== b || a !== null && typeof a === 'object' || typeof a === 'function';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var _globalThis_document;
|
|
16
|
+
/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */ new class StaleReactionError extends Error {
|
|
17
|
+
constructor(...args){
|
|
18
|
+
super(...args), this.name = 'StaleReactionError', this.message = 'The reaction that called `getAbortSignal()` was re-run or destroyed';
|
|
19
|
+
}
|
|
20
|
+
}();
|
|
21
|
+
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
22
|
+
!!((_globalThis_document = globalThis.document) == null ? void 0 : _globalThis_document.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes('xml');
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @type {Array<SubscribeInvalidateTuple<any> | any>}
|
|
26
|
+
*/ const subscriber_queue = [];
|
|
27
|
+
/**
|
|
28
|
+
* Create a `Writable` store that allows both updating and reading by subscription.
|
|
29
|
+
*
|
|
30
|
+
* @template T
|
|
31
|
+
* @param {T} [value] initial value
|
|
32
|
+
* @param {StartStopNotifier<T>} [start]
|
|
33
|
+
* @returns {Writable<T>}
|
|
34
|
+
*/ function writable(value, start = noop) {
|
|
35
|
+
/** @type {Unsubscriber | null} */ let stop = null;
|
|
36
|
+
/** @type {Set<SubscribeInvalidateTuple<T>>} */ const subscribers = new Set();
|
|
37
|
+
/**
|
|
38
|
+
* @param {T} new_value
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/ function set(new_value) {
|
|
41
|
+
if (safe_not_equal(value, new_value)) {
|
|
42
|
+
value = new_value;
|
|
43
|
+
if (stop) {
|
|
44
|
+
// store is ready
|
|
45
|
+
const run_queue = !subscriber_queue.length;
|
|
46
|
+
for (const subscriber of subscribers){
|
|
47
|
+
subscriber[1]();
|
|
48
|
+
subscriber_queue.push(subscriber, value);
|
|
49
|
+
}
|
|
50
|
+
if (run_queue) {
|
|
51
|
+
for(let i = 0; i < subscriber_queue.length; i += 2){
|
|
52
|
+
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
|
53
|
+
}
|
|
54
|
+
subscriber_queue.length = 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param {Updater<T>} fn
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/ function update(fn) {
|
|
63
|
+
set(fn(/** @type {T} */ value));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @param {Subscriber<T>} run
|
|
67
|
+
* @param {() => void} [invalidate]
|
|
68
|
+
* @returns {Unsubscriber}
|
|
69
|
+
*/ function subscribe(run, invalidate = noop) {
|
|
70
|
+
/** @type {SubscribeInvalidateTuple<T>} */ const subscriber = [
|
|
71
|
+
run,
|
|
72
|
+
invalidate
|
|
73
|
+
];
|
|
74
|
+
subscribers.add(subscriber);
|
|
75
|
+
if (subscribers.size === 1) {
|
|
76
|
+
stop = start(set, update) || noop;
|
|
77
|
+
}
|
|
78
|
+
run(/** @type {T} */ value);
|
|
79
|
+
return ()=>{
|
|
80
|
+
subscribers.delete(subscriber);
|
|
81
|
+
if (subscribers.size === 0 && stop) {
|
|
82
|
+
stop();
|
|
83
|
+
stop = null;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
set,
|
|
89
|
+
update,
|
|
90
|
+
subscribe
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Notify logic (no React dependencies)
|
|
95
|
+
// Provides toast management and utilities for VanillaJS, Vue, Svelte, etc.
|
|
96
|
+
class NotifyCore {
|
|
97
|
+
generateId() {
|
|
98
|
+
return `${++this.idCounter}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
99
|
+
}
|
|
100
|
+
subscribe(fn) {
|
|
101
|
+
this.listeners.add(fn);
|
|
102
|
+
fn(this.toasts);
|
|
103
|
+
return ()=>this.listeners.delete(fn);
|
|
104
|
+
}
|
|
105
|
+
emit() {
|
|
106
|
+
for (const fn of this.listeners)fn(this.toasts);
|
|
107
|
+
}
|
|
108
|
+
update(fn) {
|
|
109
|
+
this.toasts = fn(this.toasts);
|
|
110
|
+
this.emit();
|
|
111
|
+
}
|
|
112
|
+
dismiss(id) {
|
|
113
|
+
const item = this.toasts.find((t)=>t.id === id);
|
|
114
|
+
if (!item || item.exiting) return;
|
|
115
|
+
this.update((prev)=>prev.map((t)=>t.id === id ? _extends({}, t, {
|
|
116
|
+
exiting: true
|
|
117
|
+
}) : t));
|
|
118
|
+
setTimeout(()=>this.update((prev)=>prev.filter((t)=>t.id !== id)), 600);
|
|
119
|
+
}
|
|
120
|
+
show(opts) {
|
|
121
|
+
var _ref, _ref1, _opts_type;
|
|
122
|
+
// Use a unique identifier based on options (e.g., the title or a generated key)
|
|
123
|
+
// If not provided, use a default one
|
|
124
|
+
const id = opts.title ? `notify-${opts.title}` : "notify-default";
|
|
125
|
+
const prevItem = this.toasts.find((t)=>t.id === id);
|
|
126
|
+
const instanceId = (_ref = prevItem == null ? void 0 : prevItem.instanceId) != null ? _ref : this.generateId();
|
|
127
|
+
// Set the state correctly
|
|
128
|
+
const state = (_ref1 = (_opts_type = opts.type) != null ? _opts_type : prevItem == null ? void 0 : prevItem.type) != null ? _ref1 : "success";
|
|
129
|
+
const item = _extends({}, prevItem, opts, {
|
|
130
|
+
id,
|
|
131
|
+
instanceId,
|
|
132
|
+
type: state
|
|
133
|
+
});
|
|
134
|
+
this.update((prev)=>{
|
|
135
|
+
const filtered = prev.filter((t)=>t.id !== id);
|
|
136
|
+
return [
|
|
137
|
+
...filtered,
|
|
138
|
+
item
|
|
139
|
+
];
|
|
140
|
+
});
|
|
141
|
+
return id;
|
|
142
|
+
}
|
|
143
|
+
getToasts() {
|
|
144
|
+
return this.toasts;
|
|
145
|
+
}
|
|
146
|
+
constructor(){
|
|
147
|
+
this.toasts = [];
|
|
148
|
+
this.listeners = new Set();
|
|
149
|
+
this.position = "top-right";
|
|
150
|
+
this.options = undefined;
|
|
151
|
+
this.idCounter = 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Global instance for multiplatform usage
|
|
155
|
+
const notifyCore = new NotifyCore();
|
|
156
|
+
|
|
157
|
+
// Svelte wrapper for Notify
|
|
158
|
+
// Provides a store and function to show toasts in Svelte
|
|
159
|
+
const notifyToasts = writable(notifyCore.getToasts());
|
|
160
|
+
notifyCore.subscribe((t)=>notifyToasts.set(t));
|
|
161
|
+
function showNotifyToast(options) {
|
|
162
|
+
return notifyCore.show(options);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { notifyToasts, showNotifyToast };
|
package/dist/vue.d.mts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
|
|
3
|
+
type NotifyState = "success" | "loading" | "error" | "warning" | "info" | "action";
|
|
4
|
+
interface NotifyStyles {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
badge?: string;
|
|
8
|
+
button?: string;
|
|
9
|
+
}
|
|
10
|
+
interface NotifyButton {
|
|
11
|
+
title: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const NOTIFY_POSITIONS: readonly ["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"];
|
|
15
|
+
type NotifyPosition = (typeof NOTIFY_POSITIONS)[number];
|
|
16
|
+
interface NotifyOptions {
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
type?: NotifyState;
|
|
20
|
+
position?: NotifyPosition;
|
|
21
|
+
duration?: number | null;
|
|
22
|
+
icon?: any;
|
|
23
|
+
styles?: NotifyStyles;
|
|
24
|
+
fill?: string;
|
|
25
|
+
roundness?: number;
|
|
26
|
+
autopilot?: boolean | {
|
|
27
|
+
expand?: number;
|
|
28
|
+
collapse?: number;
|
|
29
|
+
};
|
|
30
|
+
button?: NotifyButton;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface NotifyItem extends NotifyOptions {
|
|
34
|
+
id: string;
|
|
35
|
+
instanceId: string;
|
|
36
|
+
exiting?: boolean;
|
|
37
|
+
autoExpandDelayMs?: number;
|
|
38
|
+
autoCollapseDelayMs?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare function useNotifyToasts(): {
|
|
42
|
+
toasts: vue.Ref<{
|
|
43
|
+
id: string;
|
|
44
|
+
instanceId: string;
|
|
45
|
+
exiting?: boolean | undefined;
|
|
46
|
+
autoExpandDelayMs?: number | undefined;
|
|
47
|
+
autoCollapseDelayMs?: number | undefined;
|
|
48
|
+
title?: string | undefined;
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
type?: NotifyState | undefined;
|
|
51
|
+
position?: NotifyPosition | undefined;
|
|
52
|
+
duration?: number | null | undefined;
|
|
53
|
+
icon?: any;
|
|
54
|
+
styles?: {
|
|
55
|
+
title?: string | undefined;
|
|
56
|
+
description?: string | undefined;
|
|
57
|
+
badge?: string | undefined;
|
|
58
|
+
button?: string | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
fill?: string | undefined;
|
|
61
|
+
roundness?: number | undefined;
|
|
62
|
+
autopilot?: boolean | {
|
|
63
|
+
expand?: number | undefined;
|
|
64
|
+
collapse?: number | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
button?: {
|
|
67
|
+
title: string;
|
|
68
|
+
onClick: () => void;
|
|
69
|
+
} | undefined;
|
|
70
|
+
}[], NotifyItem[] | {
|
|
71
|
+
id: string;
|
|
72
|
+
instanceId: string;
|
|
73
|
+
exiting?: boolean | undefined;
|
|
74
|
+
autoExpandDelayMs?: number | undefined;
|
|
75
|
+
autoCollapseDelayMs?: number | undefined;
|
|
76
|
+
title?: string | undefined;
|
|
77
|
+
description?: string | undefined;
|
|
78
|
+
type?: NotifyState | undefined;
|
|
79
|
+
position?: NotifyPosition | undefined;
|
|
80
|
+
duration?: number | null | undefined;
|
|
81
|
+
icon?: any;
|
|
82
|
+
styles?: {
|
|
83
|
+
title?: string | undefined;
|
|
84
|
+
description?: string | undefined;
|
|
85
|
+
badge?: string | undefined;
|
|
86
|
+
button?: string | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
fill?: string | undefined;
|
|
89
|
+
roundness?: number | undefined;
|
|
90
|
+
autopilot?: boolean | {
|
|
91
|
+
expand?: number | undefined;
|
|
92
|
+
collapse?: number | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
button?: {
|
|
95
|
+
title: string;
|
|
96
|
+
onClick: () => void;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}[]>;
|
|
99
|
+
};
|
|
100
|
+
declare function showNotifyToast(options: NotifyOptions): string;
|
|
101
|
+
|
|
102
|
+
export { showNotifyToast, useNotifyToasts };
|
|
103
|
+
//# sourceMappingURL=vue.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.mts","sources":["../src/types.ts","../src/core/notify-core.ts","../src/vue-notify.ts"],"mappings":";;AAAA,KAAK,WAAW;AAChB,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B,KAAK,cAAc,WAAW,gBAAgB;AAC9C,UAAU,aAAa;AACvB;AACA;AACA,WAAW,WAAW;AACtB,eAAe,cAAc;AAC7B;AACA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB;;AC1BA,UAAU,UAAU,SAAS,aAAa;AAC1C;AACA;AACA;AACA;AACA;AACA;;ACJA,iBAAiB,eAAe;AAChC,YAAY,GAAG,CAAC,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,WAAmB;AAClC,mBAAmBC,cAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAA6B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeF,WAAmB;AAClC,mBAAmBC,cAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAe,UAAU,aAAa;;;;","names":["__types.NotifyState","__types.NotifyPosition","__core_notify_core.NotifyItem"]}
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
|
|
3
|
+
type NotifyState = "success" | "loading" | "error" | "warning" | "info" | "action";
|
|
4
|
+
interface NotifyStyles {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
badge?: string;
|
|
8
|
+
button?: string;
|
|
9
|
+
}
|
|
10
|
+
interface NotifyButton {
|
|
11
|
+
title: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const NOTIFY_POSITIONS: readonly ["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"];
|
|
15
|
+
type NotifyPosition = (typeof NOTIFY_POSITIONS)[number];
|
|
16
|
+
interface NotifyOptions {
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
type?: NotifyState;
|
|
20
|
+
position?: NotifyPosition;
|
|
21
|
+
duration?: number | null;
|
|
22
|
+
icon?: any;
|
|
23
|
+
styles?: NotifyStyles;
|
|
24
|
+
fill?: string;
|
|
25
|
+
roundness?: number;
|
|
26
|
+
autopilot?: boolean | {
|
|
27
|
+
expand?: number;
|
|
28
|
+
collapse?: number;
|
|
29
|
+
};
|
|
30
|
+
button?: NotifyButton;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface NotifyItem extends NotifyOptions {
|
|
34
|
+
id: string;
|
|
35
|
+
instanceId: string;
|
|
36
|
+
exiting?: boolean;
|
|
37
|
+
autoExpandDelayMs?: number;
|
|
38
|
+
autoCollapseDelayMs?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare function useNotifyToasts(): {
|
|
42
|
+
toasts: vue.Ref<{
|
|
43
|
+
id: string;
|
|
44
|
+
instanceId: string;
|
|
45
|
+
exiting?: boolean | undefined;
|
|
46
|
+
autoExpandDelayMs?: number | undefined;
|
|
47
|
+
autoCollapseDelayMs?: number | undefined;
|
|
48
|
+
title?: string | undefined;
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
type?: NotifyState | undefined;
|
|
51
|
+
position?: NotifyPosition | undefined;
|
|
52
|
+
duration?: number | null | undefined;
|
|
53
|
+
icon?: any;
|
|
54
|
+
styles?: {
|
|
55
|
+
title?: string | undefined;
|
|
56
|
+
description?: string | undefined;
|
|
57
|
+
badge?: string | undefined;
|
|
58
|
+
button?: string | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
fill?: string | undefined;
|
|
61
|
+
roundness?: number | undefined;
|
|
62
|
+
autopilot?: boolean | {
|
|
63
|
+
expand?: number | undefined;
|
|
64
|
+
collapse?: number | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
button?: {
|
|
67
|
+
title: string;
|
|
68
|
+
onClick: () => void;
|
|
69
|
+
} | undefined;
|
|
70
|
+
}[], NotifyItem[] | {
|
|
71
|
+
id: string;
|
|
72
|
+
instanceId: string;
|
|
73
|
+
exiting?: boolean | undefined;
|
|
74
|
+
autoExpandDelayMs?: number | undefined;
|
|
75
|
+
autoCollapseDelayMs?: number | undefined;
|
|
76
|
+
title?: string | undefined;
|
|
77
|
+
description?: string | undefined;
|
|
78
|
+
type?: NotifyState | undefined;
|
|
79
|
+
position?: NotifyPosition | undefined;
|
|
80
|
+
duration?: number | null | undefined;
|
|
81
|
+
icon?: any;
|
|
82
|
+
styles?: {
|
|
83
|
+
title?: string | undefined;
|
|
84
|
+
description?: string | undefined;
|
|
85
|
+
badge?: string | undefined;
|
|
86
|
+
button?: string | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
fill?: string | undefined;
|
|
89
|
+
roundness?: number | undefined;
|
|
90
|
+
autopilot?: boolean | {
|
|
91
|
+
expand?: number | undefined;
|
|
92
|
+
collapse?: number | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
button?: {
|
|
95
|
+
title: string;
|
|
96
|
+
onClick: () => void;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}[]>;
|
|
99
|
+
};
|
|
100
|
+
declare function showNotifyToast(options: NotifyOptions): string;
|
|
101
|
+
|
|
102
|
+
export { showNotifyToast, useNotifyToasts };
|
|
103
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sources":["../src/types.ts","../src/core/notify-core.ts","../src/vue-notify.ts"],"mappings":";;AAAA,KAAK,WAAW;AAChB,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B,KAAK,cAAc,WAAW,gBAAgB;AAC9C,UAAU,aAAa;AACvB;AACA;AACA,WAAW,WAAW;AACtB,eAAe,cAAc;AAC7B;AACA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB;;AC1BA,UAAU,UAAU,SAAS,aAAa;AAC1C;AACA;AACA;AACA;AACA;AACA;;ACJA,iBAAiB,eAAe;AAChC,YAAY,GAAG,CAAC,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,WAAmB;AAClC,mBAAmBC,cAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAA6B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeF,WAAmB;AAClC,mBAAmBC,cAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAe,UAAU,aAAa;;;;","names":["__types.NotifyState","__types.NotifyPosition","__core_notify_core.NotifyItem"]}
|