@samline/notify 1.0.2 → 2.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.
Files changed (84) hide show
  1. package/{LICENSE → LICENSE.md} +2 -2
  2. package/README.md +27 -163
  3. package/dist/_runtime.d.mts +87 -0
  4. package/dist/_runtime.d.ts +87 -0
  5. package/dist/_runtime.js +97 -0
  6. package/dist/_runtime.mjs +83 -0
  7. package/dist/browser/assets-client-B-VVPPYQ.js +114 -0
  8. package/dist/browser/assets-client-CUzxHubR.mjs +108 -0
  9. package/dist/browser/index-client-BBOQyMFk.mjs +173 -0
  10. package/dist/browser/index-client-Czb7hTpD.js +181 -0
  11. package/dist/browser/index.d.mts +134 -0
  12. package/dist/browser/index.d.ts +134 -0
  13. package/dist/browser/index.js +34 -0
  14. package/dist/browser/index.mjs +26 -0
  15. package/dist/browser/render-client-CjcQoukB.js +981 -0
  16. package/dist/browser/render-client-bGRSTd-L.mjs +974 -0
  17. package/dist/core/index.d.mts +68 -0
  18. package/dist/core/index.d.ts +68 -0
  19. package/dist/core/index.js +1 -0
  20. package/dist/core/index.mjs +1 -0
  21. package/dist/index.d.mts +131 -0
  22. package/dist/index.d.ts +131 -0
  23. package/dist/index.js +1240 -0
  24. package/dist/index.mjs +1228 -0
  25. package/dist/react/index.d.mts +158 -0
  26. package/dist/react/index.d.ts +158 -0
  27. package/dist/react/index.js +1116 -0
  28. package/dist/react/index.mjs +1107 -0
  29. package/dist/styles.css +589 -422
  30. package/dist/svelte/assets-client-B-VVPPYQ.js +114 -0
  31. package/dist/svelte/assets-client-CUzxHubR.mjs +108 -0
  32. package/dist/svelte/index-client-DbXbWMIe.js +177 -0
  33. package/dist/svelte/index-client-Dj_WfPK9.mjs +170 -0
  34. package/dist/svelte/index.d.mts +14 -0
  35. package/dist/svelte/index.d.ts +14 -0
  36. package/dist/svelte/index.js +43 -0
  37. package/dist/svelte/index.mjs +36 -0
  38. package/dist/svelte/render-client-CjcQoukB.js +981 -0
  39. package/dist/svelte/render-client-bGRSTd-L.mjs +974 -0
  40. package/dist/vue/assets-client-B-VVPPYQ.js +114 -0
  41. package/dist/vue/assets-client-CUzxHubR.mjs +108 -0
  42. package/dist/vue/index-client-DbXbWMIe.js +177 -0
  43. package/dist/vue/index-client-Dj_WfPK9.mjs +170 -0
  44. package/dist/vue/index.d.mts +50 -0
  45. package/dist/vue/index.d.ts +50 -0
  46. package/dist/vue/index.js +110 -0
  47. package/dist/vue/index.mjs +104 -0
  48. package/dist/vue/render-client-CjcQoukB.js +981 -0
  49. package/dist/vue/render-client-bGRSTd-L.mjs +974 -0
  50. package/package.json +140 -95
  51. package/dist/browser-notify.js +0 -68
  52. package/dist/cc-2Yt7NqMX.mjs +0 -21
  53. package/dist/cc-B6peeNak.mjs +0 -33
  54. package/dist/cc-BWuAzFJ6.js +0 -12
  55. package/dist/cc-CaBHsjUt.js +0 -34
  56. package/dist/cc-DGff5sSY.js +0 -21
  57. package/dist/cc-he3fHS3P.mjs +0 -12
  58. package/dist/notify.d.mts +0 -48
  59. package/dist/notify.d.mts.map +0 -1
  60. package/dist/notify.d.ts +0 -48
  61. package/dist/notify.d.ts.map +0 -1
  62. package/dist/notify.js +0 -206
  63. package/dist/notify.mjs +0 -202
  64. package/dist/react-notify-12s--2JK5UjB.mjs +0 -1244
  65. package/dist/react-notify-12s-Kv2M6zlv.js +0 -1247
  66. package/dist/react.d.mts +0 -70
  67. package/dist/react.d.mts.map +0 -1
  68. package/dist/react.d.ts +0 -70
  69. package/dist/react.d.ts.map +0 -1
  70. package/dist/react.js +0 -19
  71. package/dist/react.mjs +0 -10
  72. package/dist/render-notify-toasts.js +0 -213
  73. package/dist/svelte.d.mts +0 -49
  74. package/dist/svelte.d.mts.map +0 -1
  75. package/dist/svelte.d.ts +0 -49
  76. package/dist/svelte.d.ts.map +0 -1
  77. package/dist/svelte.js +0 -284
  78. package/dist/svelte.mjs +0 -280
  79. package/dist/vue.d.mts +0 -107
  80. package/dist/vue.d.mts.map +0 -1
  81. package/dist/vue.d.ts +0 -107
  82. package/dist/vue.d.ts.map +0 -1
  83. package/dist/vue.js +0 -2215
  84. package/dist/vue.mjs +0 -2211
@@ -0,0 +1,114 @@
1
+ 'use client';
2
+ function __insertCSS(code) {
3
+ if (!code || typeof document == 'undefined') return
4
+ let head = document.head || document.getElementsByTagName('head')[0]
5
+ let style = document.createElement('style')
6
+ style.type = 'text/css'
7
+ head.appendChild(style)
8
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
9
+ }
10
+
11
+ var React = require('react');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ var React__default = /*#__PURE__*/_interopDefault(React);
16
+
17
+ const getAsset = (type)=>{
18
+ switch(type){
19
+ case 'success':
20
+ return SuccessIcon;
21
+ case 'info':
22
+ return InfoIcon;
23
+ case 'warning':
24
+ return WarningIcon;
25
+ case 'error':
26
+ return ErrorIcon;
27
+ default:
28
+ return null;
29
+ }
30
+ };
31
+ const bars = Array(12).fill(0);
32
+ const Loader = ({ visible, className })=>{
33
+ return /*#__PURE__*/ React__default.default.createElement("div", {
34
+ className: [
35
+ 'notify-loading-wrapper',
36
+ className
37
+ ].filter(Boolean).join(' '),
38
+ "data-visible": visible
39
+ }, /*#__PURE__*/ React__default.default.createElement("div", {
40
+ className: "notify-spinner"
41
+ }, bars.map((_, i)=>/*#__PURE__*/ React__default.default.createElement("div", {
42
+ className: "notify-loading-bar",
43
+ key: `spinner-bar-${i}`
44
+ }))));
45
+ };
46
+ const SuccessIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
47
+ xmlns: "http://www.w3.org/2000/svg",
48
+ viewBox: "0 0 20 20",
49
+ fill: "currentColor",
50
+ height: "20",
51
+ width: "20"
52
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
53
+ fillRule: "evenodd",
54
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
55
+ clipRule: "evenodd"
56
+ }));
57
+ const WarningIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
58
+ xmlns: "http://www.w3.org/2000/svg",
59
+ viewBox: "0 0 24 24",
60
+ fill: "currentColor",
61
+ height: "20",
62
+ width: "20"
63
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
64
+ fillRule: "evenodd",
65
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
66
+ clipRule: "evenodd"
67
+ }));
68
+ const InfoIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
69
+ xmlns: "http://www.w3.org/2000/svg",
70
+ viewBox: "0 0 20 20",
71
+ fill: "currentColor",
72
+ height: "20",
73
+ width: "20"
74
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
75
+ fillRule: "evenodd",
76
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
77
+ clipRule: "evenodd"
78
+ }));
79
+ const ErrorIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
80
+ xmlns: "http://www.w3.org/2000/svg",
81
+ viewBox: "0 0 20 20",
82
+ fill: "currentColor",
83
+ height: "20",
84
+ width: "20"
85
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
86
+ fillRule: "evenodd",
87
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
88
+ clipRule: "evenodd"
89
+ }));
90
+ const CloseIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
91
+ xmlns: "http://www.w3.org/2000/svg",
92
+ width: "12",
93
+ height: "12",
94
+ viewBox: "0 0 24 24",
95
+ fill: "none",
96
+ stroke: "currentColor",
97
+ strokeWidth: "1.5",
98
+ strokeLinecap: "round",
99
+ strokeLinejoin: "round"
100
+ }, /*#__PURE__*/ React__default.default.createElement("line", {
101
+ x1: "18",
102
+ y1: "6",
103
+ x2: "6",
104
+ y2: "18"
105
+ }), /*#__PURE__*/ React__default.default.createElement("line", {
106
+ x1: "6",
107
+ y1: "6",
108
+ x2: "18",
109
+ y2: "18"
110
+ }));
111
+
112
+ exports.CloseIcon = CloseIcon;
113
+ exports.Loader = Loader;
114
+ exports.getAsset = getAsset;
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+ function __insertCSS(code) {
3
+ if (!code || typeof document == 'undefined') return
4
+ let head = document.head || document.getElementsByTagName('head')[0]
5
+ let style = document.createElement('style')
6
+ style.type = 'text/css'
7
+ head.appendChild(style)
8
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
9
+ }
10
+
11
+ import React from 'react';
12
+
13
+ const getAsset = (type)=>{
14
+ switch(type){
15
+ case 'success':
16
+ return SuccessIcon;
17
+ case 'info':
18
+ return InfoIcon;
19
+ case 'warning':
20
+ return WarningIcon;
21
+ case 'error':
22
+ return ErrorIcon;
23
+ default:
24
+ return null;
25
+ }
26
+ };
27
+ const bars = Array(12).fill(0);
28
+ const Loader = ({ visible, className })=>{
29
+ return /*#__PURE__*/ React.createElement("div", {
30
+ className: [
31
+ 'notify-loading-wrapper',
32
+ className
33
+ ].filter(Boolean).join(' '),
34
+ "data-visible": visible
35
+ }, /*#__PURE__*/ React.createElement("div", {
36
+ className: "notify-spinner"
37
+ }, bars.map((_, i)=>/*#__PURE__*/ React.createElement("div", {
38
+ className: "notify-loading-bar",
39
+ key: `spinner-bar-${i}`
40
+ }))));
41
+ };
42
+ const SuccessIcon = /*#__PURE__*/ React.createElement("svg", {
43
+ xmlns: "http://www.w3.org/2000/svg",
44
+ viewBox: "0 0 20 20",
45
+ fill: "currentColor",
46
+ height: "20",
47
+ width: "20"
48
+ }, /*#__PURE__*/ React.createElement("path", {
49
+ fillRule: "evenodd",
50
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
51
+ clipRule: "evenodd"
52
+ }));
53
+ const WarningIcon = /*#__PURE__*/ React.createElement("svg", {
54
+ xmlns: "http://www.w3.org/2000/svg",
55
+ viewBox: "0 0 24 24",
56
+ fill: "currentColor",
57
+ height: "20",
58
+ width: "20"
59
+ }, /*#__PURE__*/ React.createElement("path", {
60
+ fillRule: "evenodd",
61
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
62
+ clipRule: "evenodd"
63
+ }));
64
+ const InfoIcon = /*#__PURE__*/ React.createElement("svg", {
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ viewBox: "0 0 20 20",
67
+ fill: "currentColor",
68
+ height: "20",
69
+ width: "20"
70
+ }, /*#__PURE__*/ React.createElement("path", {
71
+ fillRule: "evenodd",
72
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
73
+ clipRule: "evenodd"
74
+ }));
75
+ const ErrorIcon = /*#__PURE__*/ React.createElement("svg", {
76
+ xmlns: "http://www.w3.org/2000/svg",
77
+ viewBox: "0 0 20 20",
78
+ fill: "currentColor",
79
+ height: "20",
80
+ width: "20"
81
+ }, /*#__PURE__*/ React.createElement("path", {
82
+ fillRule: "evenodd",
83
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
84
+ clipRule: "evenodd"
85
+ }));
86
+ const CloseIcon = /*#__PURE__*/ React.createElement("svg", {
87
+ xmlns: "http://www.w3.org/2000/svg",
88
+ width: "12",
89
+ height: "12",
90
+ viewBox: "0 0 24 24",
91
+ fill: "none",
92
+ stroke: "currentColor",
93
+ strokeWidth: "1.5",
94
+ strokeLinecap: "round",
95
+ strokeLinejoin: "round"
96
+ }, /*#__PURE__*/ React.createElement("line", {
97
+ x1: "18",
98
+ y1: "6",
99
+ x2: "6",
100
+ y2: "18"
101
+ }), /*#__PURE__*/ React.createElement("line", {
102
+ x1: "6",
103
+ y1: "6",
104
+ x2: "18",
105
+ y2: "18"
106
+ }));
107
+
108
+ export { CloseIcon as C, Loader as L, getAsset as g };
@@ -0,0 +1,177 @@
1
+ 'use client';
2
+ function __insertCSS(code) {
3
+ if (!code || typeof document == 'undefined') return
4
+ let head = document.head || document.getElementsByTagName('head')[0]
5
+ let style = document.createElement('style')
6
+ style.type = 'text/css'
7
+ head.appendChild(style)
8
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
9
+ }
10
+
11
+ var React = require('react');
12
+ var client = require('react-dom/client');
13
+ var renderClient = require('./render-client-CjcQoukB.js');
14
+
15
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ var React__default = /*#__PURE__*/_interopDefault(React);
18
+
19
+ let vanillaToasterRoot = null;
20
+ let vanillaToasterElement = null;
21
+ let vanillaToasterOptions = {};
22
+ function toReactAction(action) {
23
+ if (!action) return undefined;
24
+ return {
25
+ label: action.label,
26
+ onClick: (event)=>{
27
+ action.onClick?.(event);
28
+ if (action.closeOnClick === false) {
29
+ event.preventDefault();
30
+ }
31
+ }
32
+ };
33
+ }
34
+ function normalizeToastOptions(options) {
35
+ if (!options) return undefined;
36
+ return {
37
+ ...options,
38
+ action: toReactAction(options.action),
39
+ cancel: toReactAction(options.cancel)
40
+ };
41
+ }
42
+ function normalizePromiseValue(value) {
43
+ if (typeof value !== 'function') {
44
+ return value;
45
+ }
46
+ return async (data)=>value(data);
47
+ }
48
+ function normalizePromiseData(data) {
49
+ if (!data) return undefined;
50
+ const { loading, success, error, description, finally: finallyCallback, ...rest } = data;
51
+ return {
52
+ ...normalizeToastOptions(rest),
53
+ loading: loading,
54
+ success: normalizePromiseValue(success),
55
+ error: normalizePromiseValue(error),
56
+ description: description,
57
+ finally: finallyCallback
58
+ };
59
+ }
60
+ function getVanillaContainer() {
61
+ if (!renderClient.canUseDOM()) return null;
62
+ if (vanillaToasterElement?.isConnected) {
63
+ return vanillaToasterElement;
64
+ }
65
+ const existing = document.querySelector('[data-notify-vanilla-root]');
66
+ if (existing) {
67
+ vanillaToasterElement = existing;
68
+ return existing;
69
+ }
70
+ const element = document.createElement('div');
71
+ element.dataset.notifyVanillaRoot = '';
72
+ document.body.appendChild(element);
73
+ vanillaToasterElement = element;
74
+ return element;
75
+ }
76
+ function renderVanillaToaster() {
77
+ const container = getVanillaContainer();
78
+ if (!container) return null;
79
+ if (!vanillaToasterRoot) {
80
+ vanillaToasterRoot = client.createRoot(container);
81
+ }
82
+ vanillaToasterRoot.render(/*#__PURE__*/ React__default.default.createElement(renderClient.Toaster, vanillaToasterOptions));
83
+ return container;
84
+ }
85
+ function buildVanillaController(element) {
86
+ return {
87
+ element,
88
+ options: vanillaToasterOptions,
89
+ update (options = {}) {
90
+ vanillaToasterOptions = {
91
+ ...vanillaToasterOptions,
92
+ ...options
93
+ };
94
+ renderVanillaToaster();
95
+ return buildVanillaController(element);
96
+ },
97
+ destroy () {
98
+ destroyToaster();
99
+ }
100
+ };
101
+ }
102
+ function ensureVanillaToaster() {
103
+ const container = renderVanillaToaster();
104
+ return container ? buildVanillaController(container) : null;
105
+ }
106
+ function createToaster(options = {}) {
107
+ vanillaToasterOptions = {
108
+ ...vanillaToasterOptions,
109
+ ...options
110
+ };
111
+ return ensureVanillaToaster();
112
+ }
113
+ function getToaster() {
114
+ if (!vanillaToasterElement || !vanillaToasterRoot) {
115
+ return null;
116
+ }
117
+ return buildVanillaController(vanillaToasterElement);
118
+ }
119
+ function destroyToaster() {
120
+ vanillaToasterRoot?.unmount();
121
+ vanillaToasterRoot = null;
122
+ if (vanillaToasterElement?.parentNode) {
123
+ vanillaToasterElement.parentNode.removeChild(vanillaToasterElement);
124
+ }
125
+ vanillaToasterElement = null;
126
+ }
127
+ function ensureVanillaRendererMounted() {
128
+ if (!renderClient.canUseDOM()) return;
129
+ ensureVanillaToaster();
130
+ }
131
+ const toast = Object.assign((message, data)=>{
132
+ ensureVanillaRendererMounted();
133
+ return renderClient.toast(message, normalizeToastOptions(data));
134
+ }, {
135
+ success (message, data) {
136
+ ensureVanillaRendererMounted();
137
+ return renderClient.toast.success(message, normalizeToastOptions(data));
138
+ },
139
+ info (message, data) {
140
+ ensureVanillaRendererMounted();
141
+ return renderClient.toast.info(message, normalizeToastOptions(data));
142
+ },
143
+ warning (message, data) {
144
+ ensureVanillaRendererMounted();
145
+ return renderClient.toast.warning(message, normalizeToastOptions(data));
146
+ },
147
+ error (message, data) {
148
+ ensureVanillaRendererMounted();
149
+ return renderClient.toast.error(message, normalizeToastOptions(data));
150
+ },
151
+ loading (message, data) {
152
+ ensureVanillaRendererMounted();
153
+ return renderClient.toast.loading(message, normalizeToastOptions(data));
154
+ },
155
+ message (message, data) {
156
+ ensureVanillaRendererMounted();
157
+ return renderClient.toast.message(message, normalizeToastOptions(data));
158
+ },
159
+ promise (promise, data) {
160
+ ensureVanillaRendererMounted();
161
+ return renderClient.toast.promise(promise, normalizePromiseData(data));
162
+ },
163
+ dismiss (id) {
164
+ return renderClient.toast.dismiss(id);
165
+ },
166
+ getHistory () {
167
+ return renderClient.toast.getHistory();
168
+ },
169
+ getToasts () {
170
+ return renderClient.toast.getToasts();
171
+ }
172
+ });
173
+
174
+ exports.createToaster = createToaster;
175
+ exports.destroyToaster = destroyToaster;
176
+ exports.getToaster = getToaster;
177
+ exports.toast = toast;
@@ -0,0 +1,170 @@
1
+ 'use client';
2
+ function __insertCSS(code) {
3
+ if (!code || typeof document == 'undefined') return
4
+ let head = document.head || document.getElementsByTagName('head')[0]
5
+ let style = document.createElement('style')
6
+ style.type = 'text/css'
7
+ head.appendChild(style)
8
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
9
+ }
10
+
11
+ import React from 'react';
12
+ import { createRoot } from 'react-dom/client';
13
+ import { t as toast$1, c as canUseDOM, T as Toaster } from './render-client-bGRSTd-L.mjs';
14
+
15
+ let vanillaToasterRoot = null;
16
+ let vanillaToasterElement = null;
17
+ let vanillaToasterOptions = {};
18
+ function toReactAction(action) {
19
+ if (!action) return undefined;
20
+ return {
21
+ label: action.label,
22
+ onClick: (event)=>{
23
+ action.onClick?.(event);
24
+ if (action.closeOnClick === false) {
25
+ event.preventDefault();
26
+ }
27
+ }
28
+ };
29
+ }
30
+ function normalizeToastOptions(options) {
31
+ if (!options) return undefined;
32
+ return {
33
+ ...options,
34
+ action: toReactAction(options.action),
35
+ cancel: toReactAction(options.cancel)
36
+ };
37
+ }
38
+ function normalizePromiseValue(value) {
39
+ if (typeof value !== 'function') {
40
+ return value;
41
+ }
42
+ return async (data)=>value(data);
43
+ }
44
+ function normalizePromiseData(data) {
45
+ if (!data) return undefined;
46
+ const { loading, success, error, description, finally: finallyCallback, ...rest } = data;
47
+ return {
48
+ ...normalizeToastOptions(rest),
49
+ loading: loading,
50
+ success: normalizePromiseValue(success),
51
+ error: normalizePromiseValue(error),
52
+ description: description,
53
+ finally: finallyCallback
54
+ };
55
+ }
56
+ function getVanillaContainer() {
57
+ if (!canUseDOM()) return null;
58
+ if (vanillaToasterElement?.isConnected) {
59
+ return vanillaToasterElement;
60
+ }
61
+ const existing = document.querySelector('[data-notify-vanilla-root]');
62
+ if (existing) {
63
+ vanillaToasterElement = existing;
64
+ return existing;
65
+ }
66
+ const element = document.createElement('div');
67
+ element.dataset.notifyVanillaRoot = '';
68
+ document.body.appendChild(element);
69
+ vanillaToasterElement = element;
70
+ return element;
71
+ }
72
+ function renderVanillaToaster() {
73
+ const container = getVanillaContainer();
74
+ if (!container) return null;
75
+ if (!vanillaToasterRoot) {
76
+ vanillaToasterRoot = createRoot(container);
77
+ }
78
+ vanillaToasterRoot.render(/*#__PURE__*/ React.createElement(Toaster, vanillaToasterOptions));
79
+ return container;
80
+ }
81
+ function buildVanillaController(element) {
82
+ return {
83
+ element,
84
+ options: vanillaToasterOptions,
85
+ update (options = {}) {
86
+ vanillaToasterOptions = {
87
+ ...vanillaToasterOptions,
88
+ ...options
89
+ };
90
+ renderVanillaToaster();
91
+ return buildVanillaController(element);
92
+ },
93
+ destroy () {
94
+ destroyToaster();
95
+ }
96
+ };
97
+ }
98
+ function ensureVanillaToaster() {
99
+ const container = renderVanillaToaster();
100
+ return container ? buildVanillaController(container) : null;
101
+ }
102
+ function createToaster(options = {}) {
103
+ vanillaToasterOptions = {
104
+ ...vanillaToasterOptions,
105
+ ...options
106
+ };
107
+ return ensureVanillaToaster();
108
+ }
109
+ function getToaster() {
110
+ if (!vanillaToasterElement || !vanillaToasterRoot) {
111
+ return null;
112
+ }
113
+ return buildVanillaController(vanillaToasterElement);
114
+ }
115
+ function destroyToaster() {
116
+ vanillaToasterRoot?.unmount();
117
+ vanillaToasterRoot = null;
118
+ if (vanillaToasterElement?.parentNode) {
119
+ vanillaToasterElement.parentNode.removeChild(vanillaToasterElement);
120
+ }
121
+ vanillaToasterElement = null;
122
+ }
123
+ function ensureVanillaRendererMounted() {
124
+ if (!canUseDOM()) return;
125
+ ensureVanillaToaster();
126
+ }
127
+ const toast = Object.assign((message, data)=>{
128
+ ensureVanillaRendererMounted();
129
+ return toast$1(message, normalizeToastOptions(data));
130
+ }, {
131
+ success (message, data) {
132
+ ensureVanillaRendererMounted();
133
+ return toast$1.success(message, normalizeToastOptions(data));
134
+ },
135
+ info (message, data) {
136
+ ensureVanillaRendererMounted();
137
+ return toast$1.info(message, normalizeToastOptions(data));
138
+ },
139
+ warning (message, data) {
140
+ ensureVanillaRendererMounted();
141
+ return toast$1.warning(message, normalizeToastOptions(data));
142
+ },
143
+ error (message, data) {
144
+ ensureVanillaRendererMounted();
145
+ return toast$1.error(message, normalizeToastOptions(data));
146
+ },
147
+ loading (message, data) {
148
+ ensureVanillaRendererMounted();
149
+ return toast$1.loading(message, normalizeToastOptions(data));
150
+ },
151
+ message (message, data) {
152
+ ensureVanillaRendererMounted();
153
+ return toast$1.message(message, normalizeToastOptions(data));
154
+ },
155
+ promise (promise, data) {
156
+ ensureVanillaRendererMounted();
157
+ return toast$1.promise(promise, normalizePromiseData(data));
158
+ },
159
+ dismiss (id) {
160
+ return toast$1.dismiss(id);
161
+ },
162
+ getHistory () {
163
+ return toast$1.getHistory();
164
+ },
165
+ getToasts () {
166
+ return toast$1.getToasts();
167
+ }
168
+ });
169
+
170
+ export { createToaster as c, destroyToaster as d, getToaster as g, toast as t };
@@ -0,0 +1,50 @@
1
+ import * as vue from 'vue';
2
+ import { Plugin, PropType } from 'vue';
3
+ import * as ___core from '../core/index.mjs';
4
+ export { CommonToasterOptions } from '../core/index.mjs';
5
+ export { createToaster, destroyToaster, getToaster, toast } from '../index.mjs';
6
+
7
+ type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
8
+
9
+ declare const Toaster: vue.DefineComponent<{
10
+ id: StringConstructor;
11
+ theme: PropType<"light" | "dark" | "system">;
12
+ position: PropType<Position>;
13
+ expand: BooleanConstructor;
14
+ duration: NumberConstructor;
15
+ gap: NumberConstructor;
16
+ visibleToasts: NumberConstructor;
17
+ closeButton: BooleanConstructor;
18
+ className: StringConstructor;
19
+ offset: PropType<___core.CommonOffset>;
20
+ mobileOffset: PropType<___core.CommonOffset>;
21
+ dir: PropType<"rtl" | "ltr" | "auto">;
22
+ richColors: BooleanConstructor;
23
+ customAriaLabel: StringConstructor;
24
+ containerAriaLabel: StringConstructor;
25
+ }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
26
+ [key: string]: any;
27
+ }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
28
+ id: StringConstructor;
29
+ theme: PropType<"light" | "dark" | "system">;
30
+ position: PropType<Position>;
31
+ expand: BooleanConstructor;
32
+ duration: NumberConstructor;
33
+ gap: NumberConstructor;
34
+ visibleToasts: NumberConstructor;
35
+ closeButton: BooleanConstructor;
36
+ className: StringConstructor;
37
+ offset: PropType<___core.CommonOffset>;
38
+ mobileOffset: PropType<___core.CommonOffset>;
39
+ dir: PropType<"rtl" | "ltr" | "auto">;
40
+ richColors: BooleanConstructor;
41
+ customAriaLabel: StringConstructor;
42
+ containerAriaLabel: StringConstructor;
43
+ }>>, {
44
+ expand: boolean;
45
+ closeButton: boolean;
46
+ richColors: boolean;
47
+ }, {}>;
48
+ declare const NotifyPlugin: Plugin;
49
+
50
+ export { NotifyPlugin, Toaster };
@@ -0,0 +1,50 @@
1
+ import * as vue from 'vue';
2
+ import { Plugin, PropType } from 'vue';
3
+ import * as ___core from '../core/index.js';
4
+ export { CommonToasterOptions } from '../core/index.js';
5
+ export { createToaster, destroyToaster, getToaster, toast } from '../index.js';
6
+
7
+ type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
8
+
9
+ declare const Toaster: vue.DefineComponent<{
10
+ id: StringConstructor;
11
+ theme: PropType<"light" | "dark" | "system">;
12
+ position: PropType<Position>;
13
+ expand: BooleanConstructor;
14
+ duration: NumberConstructor;
15
+ gap: NumberConstructor;
16
+ visibleToasts: NumberConstructor;
17
+ closeButton: BooleanConstructor;
18
+ className: StringConstructor;
19
+ offset: PropType<___core.CommonOffset>;
20
+ mobileOffset: PropType<___core.CommonOffset>;
21
+ dir: PropType<"rtl" | "ltr" | "auto">;
22
+ richColors: BooleanConstructor;
23
+ customAriaLabel: StringConstructor;
24
+ containerAriaLabel: StringConstructor;
25
+ }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
26
+ [key: string]: any;
27
+ }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
28
+ id: StringConstructor;
29
+ theme: PropType<"light" | "dark" | "system">;
30
+ position: PropType<Position>;
31
+ expand: BooleanConstructor;
32
+ duration: NumberConstructor;
33
+ gap: NumberConstructor;
34
+ visibleToasts: NumberConstructor;
35
+ closeButton: BooleanConstructor;
36
+ className: StringConstructor;
37
+ offset: PropType<___core.CommonOffset>;
38
+ mobileOffset: PropType<___core.CommonOffset>;
39
+ dir: PropType<"rtl" | "ltr" | "auto">;
40
+ richColors: BooleanConstructor;
41
+ customAriaLabel: StringConstructor;
42
+ containerAriaLabel: StringConstructor;
43
+ }>>, {
44
+ expand: boolean;
45
+ closeButton: boolean;
46
+ richColors: boolean;
47
+ }, {}>;
48
+ declare const NotifyPlugin: Plugin;
49
+
50
+ export { NotifyPlugin, Toaster };