@scalar/use-toasts 0.5.14 → 0.6.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.
- package/CHANGELOG.md +12 -0
- package/LICENSE +1 -1
- package/README.md +7 -4
- package/dist/components/ScalarToasts.vue.d.ts +3 -0
- package/dist/components/ScalarToasts.vue.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useToasts.d.ts +11 -0
- package/dist/hooks/useToasts.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +574 -202
- package/package.json +8 -7
- package/dist/FlowProgressRing.vue.d.ts +0 -16
- package/dist/FlowProgressRing.vue.d.ts.map +0 -1
- package/dist/FlowToast.d.ts +0 -44
- package/dist/FlowToast.d.ts.map +0 -1
- package/dist/FlowToast.vue.d.ts +0 -17
- package/dist/FlowToast.vue.d.ts.map +0 -1
- package/dist/FlowToastContainer.vue.d.ts +0 -3
- package/dist/FlowToastContainer.vue.d.ts.map +0 -1
- package/dist/FlowToastLayout.vue.d.ts +0 -26
- package/dist/FlowToastLayout.vue.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scalar/use-toasts
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a8c3045: build: re-introduce @scalar/use-toasts package
|
|
8
|
+
|
|
9
|
+
## 0.5.15
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- c6b95ca: chore: upgrade from Vite 4 to Vite 5
|
|
14
|
+
|
|
3
15
|
## 0.5.14
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -16,11 +16,10 @@ npm install @scalar/use-toasts
|
|
|
16
16
|
```vue
|
|
17
17
|
// App.vue
|
|
18
18
|
<script setup>
|
|
19
|
-
import {
|
|
19
|
+
import { ScalarToasts } from '@scalar/use-toasts'
|
|
20
20
|
</script>
|
|
21
|
-
|
|
22
21
|
<template>
|
|
23
|
-
<
|
|
22
|
+
<ScalarToasts />
|
|
24
23
|
</template>
|
|
25
24
|
```
|
|
26
25
|
|
|
@@ -29,6 +28,10 @@ import { FlowToastContainer } from '@scalar/use-toasts'
|
|
|
29
28
|
<script setup>
|
|
30
29
|
import { useToasts } from '@scalar/use-toasts'
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
const { toast } = useToasts()
|
|
32
|
+
|
|
33
|
+
const sendMessage = () => {
|
|
34
|
+
toast('This is a message from the toaster!', 'success', { timeout: 2000 })
|
|
35
|
+
}
|
|
33
36
|
</script>
|
|
34
37
|
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=ScalarToasts.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarToasts.vue.d.ts","sourceRoot":"","sources":["../../src/components/ScalarToasts.vue.ts"],"names":[],"mappings":";AA+EA,wBAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ToastOptions = {
|
|
2
|
+
timeout?: number;
|
|
3
|
+
};
|
|
4
|
+
export type ToastFunction = (message: string, level?: 'warn' | 'info' | 'error', options?: ToastOptions) => void | null;
|
|
5
|
+
export declare function initializeToasts(toastFunction: ToastFunction): void;
|
|
6
|
+
/** Emit toasts */
|
|
7
|
+
export declare function useToasts(): {
|
|
8
|
+
initializeToasts: typeof initializeToasts;
|
|
9
|
+
toast: (message: string, level?: 'warn' | 'info' | 'error', options?: ToastOptions) => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useToasts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToasts.d.ts","sourceRoot":"","sources":["../../src/hooks/useToasts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,CAC1B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EACjC,OAAO,CAAC,EAAE,YAAY,KACnB,IAAI,GAAG,IAAI,CAAA;AAQhB,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,QAE5D;AAED,kBAAkB;AAClB,wBAAgB,SAAS;;qBAIV,MAAM,UACR,MAAM,GAAG,MAAM,GAAG,OAAO,YACvB,YAAY;EAK1B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { default as ScalarToasts } from './components/ScalarToasts.vue';
|
|
2
|
+
export * from './hooks';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,239 +3,611 @@
|
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document != "undefined") {
|
|
5
5
|
var elementStyle = document.createElement("style");
|
|
6
|
-
elementStyle.appendChild(document.createTextNode("
|
|
6
|
+
elementStyle.appendChild(document.createTextNode("/**\n* We need to be explicit to avoid !important. :)\n*\n* Original: https://github.com/xiaoluoboding/vue-sonner/blob/311ecc8d9a51b619f968e20f4b44992ad8412850/packages/styles.css#L91-L103\n*/\n.toaster[data-sonner-toast][data-styled='true'] {\n background: var(--scalar-background-1);\n color: var(--scalar-color-1);\n padding: 18px;\n border-color: var(--scalar-background-3);\n border-radius: var(--scalar-radius-lg);\n font-size: var(--scalar-font-size-3);\n}\n.toaster[data-sonner-toast][data-type='error'] {\n background: var(--scalar-color-red);\n border-color: transparent;\n color: white;\n}\n.toaster[data-sonner-toast][data-type='warning'] {\n background: var(--scalar-color-orange);\n border-color: transparent;\n color: rgba(0, 0, 0, 0.8);\n}"));
|
|
7
7
|
document.head.appendChild(elementStyle);
|
|
8
8
|
}
|
|
9
9
|
} catch (e) {
|
|
10
10
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
removeToast(id);
|
|
23
|
-
}, options.timeout);
|
|
24
|
-
}
|
|
25
|
-
const dismiss = () => {
|
|
26
|
-
if (timer)
|
|
27
|
-
clearTimeout(timer);
|
|
28
|
-
removeToast(id);
|
|
29
|
-
};
|
|
30
|
-
const active = () => {
|
|
31
|
-
return toasts.some((t) => t.id === id);
|
|
32
|
-
};
|
|
33
|
-
return { id, dismiss, active };
|
|
13
|
+
import { defineComponent, useAttrs, ref, computed, onMounted, nextTick, onUnmounted, watch, watchEffect, openBlock, createElementBlock, unref, createElementVNode, normalizeStyle, Fragment, renderList, createBlock, normalizeClass, createVNode, createCommentVNode, createTextVNode, toDisplayString, resolveDynamicComponent } from "vue";
|
|
14
|
+
var yt = Object.defineProperty;
|
|
15
|
+
var xt = (r, t, e) => t in r ? yt(r, t, { enumerable: true, configurable: true, writable: true, value: e }) : r[t] = e;
|
|
16
|
+
var g = (r, t, e) => (xt(r, typeof t != "symbol" ? t + "" : t, e), e);
|
|
17
|
+
function wt(r) {
|
|
18
|
+
if (!r || typeof document > "u")
|
|
19
|
+
return;
|
|
20
|
+
let t = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
21
|
+
e.type = "text/css", t.appendChild(e), e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r));
|
|
34
22
|
}
|
|
35
|
-
function addToast(contents, options) {
|
|
36
|
-
|
|
23
|
+
wt("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999}[data-sonner-toaster][data-x-position=right]{right:max(var(--offset),env(safe-area-inset-right))}[data-sonner-toaster][data-x-position=left]{left:max(var(--offset),env(safe-area-inset-left))}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:max(var(--offset),env(safe-area-inset-top))}[data-sonner-toaster][data-y-position=bottom]{bottom:max(var(--offset),env(safe-area-inset-bottom))}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;will-change:transform,opacity,height;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast] [data-description]{font-weight:400;line-height:1.4;color:inherit}[data-sonner-toast] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast] [data-icon]{display:flex;height:20px;width:20px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast] [data-icon]>*{flex-shrink:0}[data-sonner-toast] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:0;transition:opacity .4s,box-shadow .2s;z-index:100}[data-sonner-toast] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toast][data-theme=dark] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;opacity:0;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]{opacity:1}[data-sonner-toast]:focus [data-close-button]{opacity:1}[data-sonner-toast]:focus-within [data-close-button]{opacity:1}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]:before{content:'';position:absolute;left:0;right:0;height:100%}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast]:after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount,0));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{from{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;--mobile-offset:16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - 32px)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 91%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 91%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 91%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 100%, 12%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 12%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-rich-colors=true] [data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true] [data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true] [data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true] [data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{display:none;transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}");
|
|
24
|
+
let tt = 1;
|
|
25
|
+
class Bt {
|
|
26
|
+
constructor() {
|
|
27
|
+
g(this, "subscribers");
|
|
28
|
+
g(this, "toasts");
|
|
29
|
+
g(this, "subscribe", (t) => (this.subscribers.push(t), () => {
|
|
30
|
+
const e = this.subscribers.indexOf(t);
|
|
31
|
+
this.subscribers.splice(e, 1);
|
|
32
|
+
}));
|
|
33
|
+
g(this, "publish", (t) => {
|
|
34
|
+
this.subscribers.forEach((e) => e(t));
|
|
35
|
+
});
|
|
36
|
+
g(this, "addToast", (t) => {
|
|
37
|
+
this.publish(t), this.toasts = [...this.toasts, t];
|
|
38
|
+
});
|
|
39
|
+
g(this, "create", (t) => {
|
|
40
|
+
var h;
|
|
41
|
+
const { message: e, ...n } = t, a = typeof (t == null ? void 0 : t.id) == "number" || ((h = t.id) == null ? void 0 : h.length) > 0 ? t.id : tt++, p = this.toasts.findIndex((x) => x.id === a), u = t.dismissible === void 0 ? true : t.dismissible;
|
|
42
|
+
return p !== -1 ? this.toasts = this.toasts.map((x) => x.id === a ? (this.publish({ ...x, ...t, id: a, title: e }), {
|
|
43
|
+
...x,
|
|
44
|
+
...t,
|
|
45
|
+
id: a,
|
|
46
|
+
dismissible: u,
|
|
47
|
+
title: e
|
|
48
|
+
}) : x) : this.addToast({ title: e, ...n, dismissible: u, id: a }), a;
|
|
49
|
+
});
|
|
50
|
+
g(this, "dismiss", (t) => (t || this.toasts.forEach((e) => {
|
|
51
|
+
this.subscribers.forEach(
|
|
52
|
+
(n) => n({ id: e.id, dismiss: true })
|
|
53
|
+
);
|
|
54
|
+
}), this.subscribers.forEach((e) => e({ id: t, dismiss: true })), t));
|
|
55
|
+
g(this, "message", (t, e) => this.create({ ...e, message: t }));
|
|
56
|
+
g(this, "error", (t, e) => this.create({ ...e, type: "error", message: t }));
|
|
57
|
+
g(this, "success", (t, e) => this.create({ ...e, type: "success", message: t }));
|
|
58
|
+
g(this, "info", (t, e) => this.create({ ...e, type: "info", message: t }));
|
|
59
|
+
g(this, "warning", (t, e) => this.create({ ...e, type: "warning", message: t }));
|
|
60
|
+
g(this, "loading", (t, e) => this.create({ ...e, type: "loading", message: t }));
|
|
61
|
+
g(this, "promise", (t, e) => {
|
|
62
|
+
if (!e)
|
|
63
|
+
return;
|
|
64
|
+
let n;
|
|
65
|
+
e.loading !== void 0 && (n = this.create({
|
|
66
|
+
...e,
|
|
67
|
+
promise: t,
|
|
68
|
+
type: "loading",
|
|
69
|
+
message: e.loading
|
|
70
|
+
}));
|
|
71
|
+
const a = t instanceof Promise ? t : t();
|
|
72
|
+
let p = n !== void 0;
|
|
73
|
+
return a.then((u) => {
|
|
74
|
+
if (e.success !== void 0) {
|
|
75
|
+
p = false;
|
|
76
|
+
const h = typeof e.success == "function" ? e.success(u) : e.success;
|
|
77
|
+
this.create({ id: n, type: "success", message: h });
|
|
78
|
+
}
|
|
79
|
+
}).catch((u) => {
|
|
80
|
+
if (e.error !== void 0) {
|
|
81
|
+
p = false;
|
|
82
|
+
const h = typeof e.error == "function" ? e.error(u) : e.error;
|
|
83
|
+
this.create({ id: n, type: "error", message: h });
|
|
84
|
+
}
|
|
85
|
+
}).finally(() => {
|
|
86
|
+
var u;
|
|
87
|
+
p && (this.dismiss(n), n = void 0), (u = e.finally) == null || u.call(e);
|
|
88
|
+
}), n;
|
|
89
|
+
});
|
|
90
|
+
g(this, "custom", (t, e) => {
|
|
91
|
+
const n = (e == null ? void 0 : e.id) || tt++;
|
|
92
|
+
return this.publish({ ...e, id: n, title: t }), n;
|
|
93
|
+
});
|
|
94
|
+
this.subscribers = [], this.toasts = [];
|
|
95
|
+
}
|
|
37
96
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
97
|
+
const k = new Bt(), Et = (r, t) => {
|
|
98
|
+
const e = (t == null ? void 0 : t.id) || tt++;
|
|
99
|
+
return k.publish({
|
|
100
|
+
title: r,
|
|
101
|
+
...t,
|
|
102
|
+
id: e
|
|
103
|
+
}), e;
|
|
104
|
+
}, St = Et, Ie = Object.assign(St, {
|
|
105
|
+
success: k.success,
|
|
106
|
+
info: k.info,
|
|
107
|
+
warning: k.warning,
|
|
108
|
+
error: k.error,
|
|
109
|
+
custom: k.custom,
|
|
110
|
+
message: k.message,
|
|
111
|
+
promise: k.promise,
|
|
112
|
+
dismiss: k.dismiss,
|
|
113
|
+
loading: k.loading
|
|
114
|
+
}), It = ["data-visible"], zt = { className: "sonner-spinner" }, Nt = /* @__PURE__ */ defineComponent({
|
|
115
|
+
__name: "Loader",
|
|
116
|
+
props: {
|
|
117
|
+
visible: Boolean
|
|
118
|
+
},
|
|
119
|
+
setup(r) {
|
|
120
|
+
const t = Array(12).fill(0);
|
|
121
|
+
return (e, n) => (openBlock(), createElementBlock("div", {
|
|
122
|
+
className: "sonner-loading-wrapper",
|
|
123
|
+
"data-visible": r.visible
|
|
124
|
+
}, [
|
|
125
|
+
createElementVNode("div", zt, [
|
|
126
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(t), (a) => (openBlock(), createElementBlock("div", {
|
|
127
|
+
key: `spinner-bar-${a}`,
|
|
128
|
+
className: "sonner-loading-bar"
|
|
129
|
+
}))), 128))
|
|
130
|
+
])
|
|
131
|
+
], 8, It));
|
|
132
|
+
}
|
|
133
|
+
}), H = (r, t) => {
|
|
134
|
+
const e = r.__vccOpts || r;
|
|
135
|
+
for (const [n, a] of t)
|
|
136
|
+
e[n] = a;
|
|
137
|
+
return e;
|
|
138
|
+
}, Mt = {}, Ot = {
|
|
139
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
140
|
+
viewBox: "0 0 20 20",
|
|
141
|
+
fill: "currentColor",
|
|
142
|
+
height: "20",
|
|
143
|
+
width: "20"
|
|
144
|
+
}, Pt = /* @__PURE__ */ createElementVNode("path", {
|
|
145
|
+
"fill-rule": "evenodd",
|
|
146
|
+
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",
|
|
147
|
+
"clip-rule": "evenodd"
|
|
148
|
+
}, null, -1), At = [
|
|
149
|
+
Pt
|
|
150
|
+
];
|
|
151
|
+
function Dt(r, t) {
|
|
152
|
+
return openBlock(), createElementBlock("svg", Ot, At);
|
|
49
153
|
}
|
|
50
|
-
|
|
51
|
-
|
|
154
|
+
const Yt = /* @__PURE__ */ H(Mt, [["render", Dt]]), Rt = {}, Ht = {
|
|
155
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
156
|
+
viewBox: "0 0 20 20",
|
|
157
|
+
fill: "currentColor",
|
|
158
|
+
height: "20",
|
|
159
|
+
width: "20"
|
|
160
|
+
}, Lt = /* @__PURE__ */ createElementVNode("path", {
|
|
161
|
+
"fill-rule": "evenodd",
|
|
162
|
+
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",
|
|
163
|
+
"clip-rule": "evenodd"
|
|
164
|
+
}, null, -1), Ut = [
|
|
165
|
+
Lt
|
|
166
|
+
];
|
|
167
|
+
function Vt(r, t) {
|
|
168
|
+
return openBlock(), createElementBlock("svg", Ht, Ut);
|
|
52
169
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
170
|
+
const jt = /* @__PURE__ */ H(Rt, [["render", Vt]]), Ft = {}, Kt = {
|
|
171
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
172
|
+
viewBox: "0 0 24 24",
|
|
173
|
+
fill: "currentColor",
|
|
174
|
+
height: "20",
|
|
175
|
+
width: "20"
|
|
176
|
+
}, Wt = /* @__PURE__ */ createElementVNode("path", {
|
|
177
|
+
"fill-rule": "evenodd",
|
|
178
|
+
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",
|
|
179
|
+
"clip-rule": "evenodd"
|
|
180
|
+
}, null, -1), Xt = [
|
|
181
|
+
Wt
|
|
182
|
+
];
|
|
183
|
+
function Gt(r, t) {
|
|
184
|
+
return openBlock(), createElementBlock("svg", Kt, Xt);
|
|
60
185
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
186
|
+
const qt = /* @__PURE__ */ H(Ft, [["render", Gt]]), Jt = {}, Qt = {
|
|
187
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
188
|
+
viewBox: "0 0 20 20",
|
|
189
|
+
fill: "currentColor",
|
|
190
|
+
height: "20",
|
|
191
|
+
width: "20"
|
|
192
|
+
}, Zt = /* @__PURE__ */ createElementVNode("path", {
|
|
193
|
+
"fill-rule": "evenodd",
|
|
194
|
+
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",
|
|
195
|
+
"clip-rule": "evenodd"
|
|
196
|
+
}, null, -1), te = [
|
|
197
|
+
Zt
|
|
198
|
+
];
|
|
199
|
+
function ee(r, t) {
|
|
200
|
+
return openBlock(), createElementBlock("svg", Qt, te);
|
|
66
201
|
}
|
|
67
|
-
|
|
68
|
-
|
|
202
|
+
const ae = /* @__PURE__ */ H(Jt, [["render", ee]]), oe = {}, se = {
|
|
203
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
204
|
+
width: "12",
|
|
205
|
+
height: "12",
|
|
206
|
+
viewBox: "0 0 24 24",
|
|
207
|
+
fill: "none",
|
|
208
|
+
stroke: "currentColor",
|
|
209
|
+
"stoke-width": "1.5",
|
|
210
|
+
"stroke-linecap": "round",
|
|
211
|
+
"stroke-linejoin": "round"
|
|
212
|
+
}, ne = /* @__PURE__ */ createElementVNode("line", {
|
|
213
|
+
x1: "18",
|
|
214
|
+
y1: "6",
|
|
215
|
+
x2: "6",
|
|
216
|
+
y2: "18"
|
|
217
|
+
}, null, -1), re = /* @__PURE__ */ createElementVNode("line", {
|
|
218
|
+
x1: "6",
|
|
219
|
+
y1: "6",
|
|
220
|
+
x2: "18",
|
|
221
|
+
y2: "18"
|
|
222
|
+
}, null, -1), ie = [
|
|
223
|
+
ne,
|
|
224
|
+
re
|
|
225
|
+
];
|
|
226
|
+
function le(r, t) {
|
|
227
|
+
return openBlock(), createElementBlock("svg", se, ie);
|
|
69
228
|
}
|
|
70
|
-
const
|
|
71
|
-
const _hoisted_2$1 = ["stroke-dasharray"];
|
|
72
|
-
const stroke = 2;
|
|
73
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
74
|
-
__name: "FlowProgressRing",
|
|
75
|
-
props: {
|
|
76
|
-
duration: {}
|
|
77
|
-
},
|
|
78
|
-
setup(__props) {
|
|
79
|
-
const props = __props;
|
|
80
|
-
useCssVars((_ctx) => ({
|
|
81
|
-
"2d61a1b2": circumference
|
|
82
|
-
}));
|
|
83
|
-
const normalizedRadius = 12 - stroke * 2;
|
|
84
|
-
const circumference = normalizedRadius * 2 * Math.PI;
|
|
85
|
-
const animationDuration = computed(() => `${props.duration}ms`);
|
|
86
|
-
return (_ctx, _cache) => {
|
|
87
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$3, [
|
|
88
|
-
createElementVNode("circle", {
|
|
89
|
-
class: "progress-ring",
|
|
90
|
-
cx: 12,
|
|
91
|
-
cy: 12,
|
|
92
|
-
fill: "transparent",
|
|
93
|
-
r: normalizedRadius,
|
|
94
|
-
stroke: "currentColor",
|
|
95
|
-
"stroke-dasharray": circumference + " " + circumference,
|
|
96
|
-
"stroke-width": stroke,
|
|
97
|
-
style: normalizeStyle({ animationDuration: animationDuration.value })
|
|
98
|
-
}, null, 12, _hoisted_2$1)
|
|
99
|
-
]);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
const FlowProgressRing_vue_vue_type_style_index_0_scoped_6d218ca0_lang = "";
|
|
104
|
-
const _export_sfc = (sfc, props) => {
|
|
105
|
-
const target = sfc.__vccOpts || sfc;
|
|
106
|
-
for (const [key, val] of props) {
|
|
107
|
-
target[key] = val;
|
|
108
|
-
}
|
|
109
|
-
return target;
|
|
110
|
-
};
|
|
111
|
-
const FlowProgressRing = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-6d218ca0"]]);
|
|
112
|
-
const _hoisted_1$2 = {
|
|
113
|
-
key: 0,
|
|
114
|
-
class: "toast-icon"
|
|
115
|
-
};
|
|
116
|
-
const _hoisted_2 = { class: "toast-title" };
|
|
117
|
-
const _hoisted_3 = {
|
|
229
|
+
const de = /* @__PURE__ */ H(oe, [["render", le]]), ce = ["aria-live", "data-styled", "data-mounted", "data-promise", "data-removed", "data-visible", "data-y-position", "data-x-position", "data-index", "data-front", "data-swiping", "data-type", "data-invert", "data-swipe-out", "data-expanded"], ue = ["data-disabled"], fe = {
|
|
118
230
|
key: 1,
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
key: 2,
|
|
123
|
-
class: "toast-timeout"
|
|
124
|
-
};
|
|
125
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
126
|
-
__name: "FlowToastLayout",
|
|
231
|
+
"data-icon": ""
|
|
232
|
+
}, pe = { "data-content": "" }, me = { "data-title": "" }, he = 4e3, ge = 14, ve = 20, be = 200, ye = /* @__PURE__ */ defineComponent({
|
|
233
|
+
__name: "Toast",
|
|
127
234
|
props: {
|
|
128
|
-
|
|
235
|
+
toast: {},
|
|
236
|
+
toasts: {},
|
|
237
|
+
index: {},
|
|
238
|
+
expanded: { type: Boolean },
|
|
239
|
+
invert: { type: Boolean },
|
|
240
|
+
heights: {},
|
|
241
|
+
position: {},
|
|
242
|
+
visibleToasts: {},
|
|
243
|
+
expandByDefault: { type: Boolean },
|
|
244
|
+
closeButton: { type: Boolean },
|
|
245
|
+
interacting: { type: Boolean },
|
|
246
|
+
duration: {},
|
|
247
|
+
descriptionClass: {}
|
|
129
248
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
249
|
+
emits: ["update:heights", "removeToast"],
|
|
250
|
+
setup(r, { emit: t }) {
|
|
251
|
+
const e = (o) => !!o.promise, n = t, a = r, p = ref(false), u = ref(false), h = ref(false), x = ref(false), w = ref(null), z = ref(0), L = ref(0), U = ref(null), s = ref(null), i = computed(() => a.index === 0), b = computed(() => a.index + 1 <= a.visibleToasts), y = computed(() => a.toast.type), N = computed(() => a.toast.dismissible), B = a.toast.className || "", E = a.toast.descriptionClassName || "", V = a.toast.style || {}, P = computed(
|
|
252
|
+
() => a.heights.findIndex((o) => o.toastId === a.toast.id) || 0
|
|
253
|
+
), K = computed(
|
|
254
|
+
() => a.toast.duration || a.duration || he
|
|
255
|
+
), W = ref(0), A = ref(0), X = ref(K.value), at = ref(0), M = ref(null), G = computed(() => a.position.split("-")), ct = computed(() => G.value[0]), ut = computed(() => G.value[1]), ft = computed(() => a.heights.reduce((o, l, m) => m >= P.value ? o : o + l.height, 0)), pt = computed(() => a.toast.invert || a.invert), q = computed(() => w.value === "loading"), j = computed(
|
|
256
|
+
() => w.value ?? (a.toast.type || null)
|
|
257
|
+
), J = computed(() => !e(a.toast) && typeof a.toast.title == "object"), mt = computed(() => {
|
|
258
|
+
if (!e(a.toast))
|
|
259
|
+
return null;
|
|
260
|
+
switch (w.value) {
|
|
261
|
+
case "loading":
|
|
262
|
+
return a.toast.loading;
|
|
263
|
+
case "success":
|
|
264
|
+
return typeof a.toast.success == "function" ? U.value : a.toast.success;
|
|
265
|
+
case "error":
|
|
266
|
+
return typeof a.toast.error == "function" ? U.value : a.toast.error;
|
|
267
|
+
default:
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
onMounted(() => p.value = true), watchEffect(() => {
|
|
272
|
+
A.value = P.value * ge + ft.value;
|
|
273
|
+
});
|
|
274
|
+
function ht() {
|
|
275
|
+
var o, l;
|
|
276
|
+
(!q.value || N.value) && (S(), (l = (o = a.toast).onDismiss) == null || l.call(o, a.toast));
|
|
277
|
+
}
|
|
278
|
+
function S() {
|
|
279
|
+
u.value = true, z.value = A.value;
|
|
280
|
+
const o = a.heights.filter(
|
|
281
|
+
(l) => l.toastId !== a.toast.id
|
|
282
|
+
);
|
|
283
|
+
n("update:heights", o), setTimeout(() => {
|
|
284
|
+
n("removeToast", a.toast);
|
|
285
|
+
}, be);
|
|
286
|
+
}
|
|
287
|
+
const gt = (o) => {
|
|
288
|
+
q || (z.value = A.value, o.target.setPointerCapture(o.pointerId), o.target.tagName !== "BUTTON" && (h.value = true, M.value = { x: o.clientX, y: o.clientY }));
|
|
289
|
+
}, vt = (o) => {
|
|
290
|
+
var m, D, _, $;
|
|
291
|
+
if (x.value)
|
|
292
|
+
return;
|
|
293
|
+
M.value = null;
|
|
294
|
+
const l = Number(
|
|
295
|
+
((m = s.value) == null ? void 0 : m.style.getPropertyValue("--swipe-amount").replace("px", "")) || 0
|
|
296
|
+
);
|
|
297
|
+
if (Math.abs(l) >= ve) {
|
|
298
|
+
z.value = A.value, (_ = (D = a.toast).onDismiss) == null || _.call(D, a.toast), S(), x.value = true;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
($ = s.value) == null || $.style.setProperty("--swipe-amount", "0px"), h.value = true;
|
|
302
|
+
}, bt = (o) => {
|
|
303
|
+
var ot;
|
|
304
|
+
if (!M.value)
|
|
305
|
+
return;
|
|
306
|
+
const l = o.clientY - M.value.y, m = o.clientX - M.value.x, _ = (G.value[0] === "top" ? Math.min : Math.max)(0, l), $ = o.pointerType === "touch" ? 10 : 2;
|
|
307
|
+
Math.abs(_) > $ ? (ot = s.value) == null || ot.style.setProperty("--swipe-amount", `${l}px`) : Math.abs(m) > $ && (M.value = null);
|
|
308
|
+
};
|
|
309
|
+
return watchEffect((o) => {
|
|
310
|
+
if (a.toast.promise && w.value === "loading" || a.toast.duration === 1 / 0)
|
|
311
|
+
return;
|
|
312
|
+
let l;
|
|
313
|
+
const m = () => {
|
|
314
|
+
if (at.value < W.value) {
|
|
315
|
+
const _ = (/* @__PURE__ */ new Date()).getTime() - W.value;
|
|
316
|
+
X.value = X.value - _;
|
|
317
|
+
}
|
|
318
|
+
at.value = (/* @__PURE__ */ new Date()).getTime();
|
|
319
|
+
}, D = () => {
|
|
320
|
+
W.value = (/* @__PURE__ */ new Date()).getTime(), l = setTimeout(() => {
|
|
321
|
+
var _, $;
|
|
322
|
+
($ = (_ = a.toast).onAutoClose) == null || $.call(_, a.toast), S();
|
|
323
|
+
}, X.value);
|
|
324
|
+
};
|
|
325
|
+
a.expanded || a.interacting ? m() : D(), o(() => {
|
|
326
|
+
clearTimeout(l);
|
|
327
|
+
});
|
|
328
|
+
}), onMounted(() => {
|
|
329
|
+
if (s.value) {
|
|
330
|
+
const o = s.value.getBoundingClientRect().height;
|
|
331
|
+
L.value = o;
|
|
332
|
+
const l = [{ toastId: a.toast.id, height: o }, ...a.heights];
|
|
333
|
+
n("update:heights", l);
|
|
334
|
+
}
|
|
335
|
+
}), onUnmounted(() => {
|
|
336
|
+
if (s.value) {
|
|
337
|
+
const o = a.heights.filter(
|
|
338
|
+
(l) => l.toastId !== a.toast.id
|
|
339
|
+
);
|
|
340
|
+
n("update:heights", o);
|
|
341
|
+
}
|
|
342
|
+
}), watchEffect(() => {
|
|
343
|
+
a.toast.delete && S();
|
|
344
|
+
}), (o, l) => (openBlock(), createElementBlock("li", {
|
|
345
|
+
"aria-live": o.toast.important ? "assertive" : "polite",
|
|
346
|
+
"aria-atomic": "",
|
|
347
|
+
role: "status",
|
|
348
|
+
tabindex: "0",
|
|
349
|
+
ref_key: "toastRef",
|
|
350
|
+
ref: s,
|
|
351
|
+
"data-sonner-toast": "",
|
|
352
|
+
class: normalizeClass(unref(B)),
|
|
353
|
+
"data-styled": !J.value,
|
|
354
|
+
"data-mounted": p.value,
|
|
355
|
+
"data-promise": !!o.toast.promise,
|
|
356
|
+
"data-removed": u.value,
|
|
357
|
+
"data-visible": b.value,
|
|
358
|
+
"data-y-position": ct.value,
|
|
359
|
+
"data-x-position": ut.value,
|
|
360
|
+
"data-index": a.index,
|
|
361
|
+
"data-front": i.value,
|
|
362
|
+
"data-swiping": h.value,
|
|
363
|
+
"data-type": w.value !== "loading" && w.value ? w.value : y.value,
|
|
364
|
+
"data-invert": pt.value,
|
|
365
|
+
"data-swipe-out": x.value,
|
|
366
|
+
"data-expanded": !!(a.expanded || a.expandByDefault && p.value),
|
|
367
|
+
style: normalizeStyle({
|
|
368
|
+
"--index": a.index,
|
|
369
|
+
"--toasts-before": a.index,
|
|
370
|
+
"--z-index": o.toasts.length - a.index,
|
|
371
|
+
"--offset": `${u.value ? z.value : A.value}px`,
|
|
372
|
+
"--initial-height": a.expandByDefault ? "auto" : `${L.value}px`,
|
|
373
|
+
...unref(V)
|
|
374
|
+
}),
|
|
375
|
+
onPointerdown: gt,
|
|
376
|
+
onPointerup: vt,
|
|
377
|
+
onPointermove: bt
|
|
378
|
+
}, [
|
|
379
|
+
a.closeButton && !J.value ? (openBlock(), createElementBlock("button", {
|
|
380
|
+
key: 0,
|
|
381
|
+
"aria-label": "Close toast",
|
|
382
|
+
"data-close-button": "",
|
|
383
|
+
"data-disabled": q.value,
|
|
384
|
+
onClick: ht
|
|
134
385
|
}, [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
386
|
+
createVNode(de)
|
|
387
|
+
], 8, ue)) : createCommentVNode("", true),
|
|
388
|
+
y.value || o.toast.icon || o.toast.promise ? (openBlock(), createElementBlock("div", fe, [
|
|
389
|
+
typeof o.toast.promise == "function" || y.value === "loading" ? (openBlock(), createBlock(Nt, {
|
|
390
|
+
key: 0,
|
|
391
|
+
visible: w.value === "loading" || y.value === "loading"
|
|
392
|
+
}, null, 8, ["visible"])) : createCommentVNode("", true),
|
|
393
|
+
j.value === "success" ? (openBlock(), createBlock(Yt, { key: 1 })) : j.value === "info" ? (openBlock(), createBlock(jt, { key: 2 })) : j.value === "warning" ? (openBlock(), createBlock(qt, { key: 3 })) : j.value === "error" ? (openBlock(), createBlock(ae, { key: 4 })) : createCommentVNode("", true)
|
|
394
|
+
])) : createCommentVNode("", true),
|
|
395
|
+
createElementVNode("div", pe, [
|
|
396
|
+
createElementVNode("div", me, [
|
|
397
|
+
typeof o.toast.title == "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
398
|
+
createTextVNode(toDisplayString(o.toast.title), 1)
|
|
399
|
+
], 64)) : o.toast.title === void 0 || o.toast.title === null ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
400
|
+
createTextVNode(toDisplayString(mt.value), 1)
|
|
401
|
+
], 64)) : J.value ? (openBlock(), createBlock(resolveDynamicComponent(o.toast.title), {
|
|
402
|
+
key: 2,
|
|
403
|
+
onCloseToast: l[0] || (l[0] = () => {
|
|
404
|
+
var m;
|
|
405
|
+
S(), (m = o.toast.cancel) != null && m.onClick && o.toast.cancel.onClick();
|
|
406
|
+
})
|
|
407
|
+
}, null, 32)) : createCommentVNode("", true)
|
|
140
408
|
]),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
409
|
+
o.toast.description ? (openBlock(), createElementBlock("div", {
|
|
410
|
+
key: 0,
|
|
411
|
+
"data-description": "",
|
|
412
|
+
class: normalizeClass(o.descriptionClass + unref(E))
|
|
413
|
+
}, toDisplayString(o.toast.description), 3)) : createCommentVNode("", true)
|
|
414
|
+
]),
|
|
415
|
+
o.toast.cancel ? (openBlock(), createElementBlock("button", {
|
|
416
|
+
key: 2,
|
|
417
|
+
"data-button": "",
|
|
418
|
+
"data-cancel": "",
|
|
419
|
+
onClick: l[1] || (l[1] = () => {
|
|
420
|
+
var m;
|
|
421
|
+
S(), (m = o.toast.cancel) != null && m.onClick && o.toast.cancel.onClick();
|
|
422
|
+
})
|
|
423
|
+
}, toDisplayString(o.toast.cancel.label), 1)) : createCommentVNode("", true),
|
|
424
|
+
o.toast.action ? (openBlock(), createElementBlock("button", {
|
|
425
|
+
key: 3,
|
|
426
|
+
"data-button": "",
|
|
427
|
+
onClick: l[2] || (l[2] = () => {
|
|
428
|
+
var m;
|
|
429
|
+
S(), (m = o.toast.action) == null || m.onClick();
|
|
430
|
+
})
|
|
431
|
+
}, toDisplayString(o.toast.action.label), 1)) : createCommentVNode("", true)
|
|
432
|
+
], 46, ce));
|
|
149
433
|
}
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
155
|
-
__name: "FlowToast",
|
|
434
|
+
}), xe = ["aria-label"], we = ["dir", "data-theme", "data-rich-colors", "data-y-position", "data-x-position"], ke = 3, rt = "32px", Te = 4e3, _e = 356, it = 14, $e = typeof window < "u" && typeof document < "u", Ce = /* @__PURE__ */ defineComponent({
|
|
435
|
+
name: "Toaster",
|
|
436
|
+
inheritAttrs: false,
|
|
437
|
+
__name: "Toaster",
|
|
156
438
|
props: {
|
|
157
|
-
|
|
439
|
+
invert: { type: Boolean, default: false },
|
|
440
|
+
theme: { default: "light" },
|
|
441
|
+
position: { default: "bottom-right" },
|
|
442
|
+
hotkey: { default: () => ["altKey", "KeyT"] },
|
|
443
|
+
richColors: { type: Boolean, default: false },
|
|
444
|
+
expand: { type: Boolean, default: false },
|
|
445
|
+
duration: { default: Te },
|
|
446
|
+
gap: { default: it },
|
|
447
|
+
visibleToasts: { default: ke },
|
|
448
|
+
closeButton: { type: Boolean, default: false },
|
|
449
|
+
toastOptions: { default: () => ({}) },
|
|
450
|
+
className: { default: "" },
|
|
451
|
+
style: { default: () => ({}) },
|
|
452
|
+
offset: { default: rt },
|
|
453
|
+
dir: { default: "auto" }
|
|
158
454
|
},
|
|
159
|
-
setup(
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
455
|
+
setup(r) {
|
|
456
|
+
const t = r, e = useAttrs(), n = ref([]), a = ref([]), p = ref(false), u = ref(false), h = ref(
|
|
457
|
+
t.theme !== "system" ? t.theme : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
|
|
458
|
+
), x = computed(() => t.position.split("-")), w = ref(null), z = t.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
459
|
+
function L(s) {
|
|
460
|
+
n.value = n.value.filter(({ id: i }) => i !== s.id);
|
|
461
|
+
}
|
|
462
|
+
function U() {
|
|
463
|
+
if (typeof window > "u")
|
|
464
|
+
return "ltr";
|
|
465
|
+
const s = document.documentElement.getAttribute("dir");
|
|
466
|
+
return s === "auto" || !s ? window.getComputedStyle(document.documentElement).direction : s;
|
|
467
|
+
}
|
|
468
|
+
return onMounted(() => {
|
|
469
|
+
const s = k.subscribe((i) => {
|
|
470
|
+
if (i.dismiss) {
|
|
471
|
+
n.value = n.value.map(
|
|
472
|
+
(b) => b.id === i.id ? { ...b, delete: true } : b
|
|
473
|
+
);
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
nextTick(() => {
|
|
477
|
+
const b = n.value.findIndex((y) => y.id === i.id);
|
|
478
|
+
b !== -1 ? n.value.splice(b, 1, i) : n.value = [i, ...n.value];
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
onUnmounted(() => {
|
|
482
|
+
s();
|
|
483
|
+
});
|
|
484
|
+
}), watch(
|
|
485
|
+
() => t.theme,
|
|
486
|
+
(s) => {
|
|
487
|
+
if (s !== "system") {
|
|
488
|
+
h.value = s;
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
s === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? h.value = "dark" : h.value = "light"), !(typeof window > "u") && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({ matches: i }) => {
|
|
492
|
+
i ? h.value = "dark" : h.value = "light";
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
), watchEffect(() => {
|
|
496
|
+
n.value.length <= 1 && (p.value = false);
|
|
497
|
+
}), watchEffect((s) => {
|
|
498
|
+
function i(b) {
|
|
499
|
+
var N, B;
|
|
500
|
+
t.hotkey.every(
|
|
501
|
+
(E) => b[E] || b.code === E
|
|
502
|
+
) && (p.value = true, (N = w.value) == null || N.focus()), b.code === "Escape" && (document.activeElement === w.value || (B = w.value) != null && B.contains(document.activeElement)) && (p.value = false);
|
|
503
|
+
}
|
|
504
|
+
$e && (document.addEventListener("keydown", i), s(() => {
|
|
505
|
+
document.removeEventListener("keydown", i);
|
|
506
|
+
}));
|
|
507
|
+
}), (s, i) => {
|
|
508
|
+
var b;
|
|
509
|
+
return openBlock(), createElementBlock("section", {
|
|
510
|
+
"aria-label": `Notifications ${unref(z)}`,
|
|
511
|
+
tabIndex: -1
|
|
512
|
+
}, [
|
|
513
|
+
createElementVNode("ol", {
|
|
514
|
+
ref_key: "listRef",
|
|
515
|
+
ref: w,
|
|
516
|
+
"data-sonner-toaster": "",
|
|
517
|
+
dir: s.dir === "auto" ? U() : s.dir,
|
|
518
|
+
tabIndex: -1,
|
|
519
|
+
"data-theme": s.theme,
|
|
520
|
+
"data-rich-colors": s.richColors,
|
|
521
|
+
"data-y-position": x.value[0],
|
|
522
|
+
"data-x-position": x.value[1],
|
|
523
|
+
style: normalizeStyle(
|
|
524
|
+
{
|
|
525
|
+
"--front-toast-height": `${(b = a.value[0]) == null ? void 0 : b.height}px`,
|
|
526
|
+
"--offset": typeof s.offset == "number" ? `${s.offset}px` : s.offset || rt,
|
|
527
|
+
"--width": `${_e}px`,
|
|
528
|
+
"--gap": `${it}px`,
|
|
529
|
+
...unref(e).style
|
|
530
|
+
}
|
|
531
|
+
),
|
|
532
|
+
onMouseenter: i[1] || (i[1] = (y) => p.value = true),
|
|
533
|
+
onMousemove: i[2] || (i[2] = (y) => p.value = true),
|
|
534
|
+
onMouseleave: i[3] || (i[3] = () => {
|
|
535
|
+
u.value || (p.value = false);
|
|
536
|
+
}),
|
|
537
|
+
onPointerdown: i[4] || (i[4] = (y) => u.value = false),
|
|
538
|
+
onPointerup: i[5] || (i[5] = (y) => u.value = false)
|
|
185
539
|
}, [
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
540
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(n.value, (y, N) => {
|
|
541
|
+
var B, E, V, P;
|
|
542
|
+
return openBlock(), createBlock(ye, {
|
|
543
|
+
key: y.id,
|
|
544
|
+
index: N,
|
|
545
|
+
toast: y,
|
|
546
|
+
duration: ((B = s.toastOptions) == null ? void 0 : B.duration) ?? s.duration,
|
|
547
|
+
className: (E = s.toastOptions) == null ? void 0 : E.className,
|
|
548
|
+
descriptionClassName: (V = s.toastOptions) == null ? void 0 : V.descriptionClassName,
|
|
549
|
+
invert: s.invert,
|
|
550
|
+
visibleToasts: s.visibleToasts,
|
|
551
|
+
closeButton: s.closeButton,
|
|
552
|
+
interacting: u.value,
|
|
553
|
+
position: s.position,
|
|
554
|
+
style: normalizeStyle((P = s.toastOptions) == null ? void 0 : P.style),
|
|
555
|
+
toasts: n.value,
|
|
556
|
+
expandByDefault: s.expand,
|
|
557
|
+
gap: s.gap,
|
|
558
|
+
expanded: p.value,
|
|
559
|
+
heights: a.value,
|
|
560
|
+
"onUpdate:heights": i[0] || (i[0] = (K) => a.value = K),
|
|
561
|
+
onRemoveToast: L
|
|
562
|
+
}, null, 8, ["index", "toast", "duration", "className", "descriptionClassName", "invert", "visibleToasts", "closeButton", "interacting", "position", "style", "toasts", "expandByDefault", "gap", "expanded", "heights"]);
|
|
563
|
+
}), 128))
|
|
564
|
+
], 44, we)
|
|
565
|
+
], 8, xe);
|
|
206
566
|
};
|
|
207
567
|
}
|
|
208
568
|
});
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
569
|
+
const state = {
|
|
570
|
+
toast: () => null
|
|
571
|
+
};
|
|
572
|
+
function initializeToasts(toastFunction) {
|
|
573
|
+
state.toast = toastFunction;
|
|
574
|
+
}
|
|
575
|
+
function useToasts() {
|
|
576
|
+
return {
|
|
577
|
+
initializeToasts,
|
|
578
|
+
toast: (message, level = "info", options = { timeout: 3e3 }) => {
|
|
579
|
+
state.toast(message, level, options);
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
212
583
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
213
|
-
__name: "
|
|
584
|
+
__name: "ScalarToasts",
|
|
214
585
|
setup(__props) {
|
|
215
|
-
const
|
|
586
|
+
const isClientMounted = ref(false);
|
|
587
|
+
onMounted(() => isClientMounted.value = true);
|
|
588
|
+
const toastMethods = {
|
|
589
|
+
success: Ie.success,
|
|
590
|
+
error: Ie.error,
|
|
591
|
+
warn: Ie.warning,
|
|
592
|
+
info: Ie
|
|
593
|
+
};
|
|
594
|
+
const { initializeToasts: initializeToasts2 } = useToasts();
|
|
595
|
+
initializeToasts2((message, level = "info", options = {}) => {
|
|
596
|
+
const toastAction = toastMethods[level] || toastMethods.info;
|
|
597
|
+
toastAction(message, {
|
|
598
|
+
duration: options.timeout || 3e3
|
|
599
|
+
});
|
|
600
|
+
});
|
|
216
601
|
return (_ctx, _cache) => {
|
|
217
|
-
return openBlock(),
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return openBlock(), createBlock(FlowToast, {
|
|
222
|
-
key: toast.id,
|
|
223
|
-
toast
|
|
224
|
-
}, null, 8, ["toast"]);
|
|
225
|
-
}), 128))
|
|
226
|
-
]),
|
|
227
|
-
_: 1
|
|
228
|
-
})
|
|
229
|
-
]);
|
|
602
|
+
return isClientMounted.value ? (openBlock(), createBlock(unref(Ce), {
|
|
603
|
+
key: 0,
|
|
604
|
+
toastOptions: { className: "toaster" }
|
|
605
|
+
})) : createCommentVNode("", true);
|
|
230
606
|
};
|
|
231
607
|
}
|
|
232
608
|
});
|
|
233
|
-
const FlowToastContainer_vue_vue_type_style_index_0_scoped_e7c9664e_lang = "";
|
|
234
|
-
const FlowToastContainer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e7c9664e"]]);
|
|
235
609
|
export {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
addErrorToast,
|
|
239
|
-
addToast,
|
|
610
|
+
_sfc_main as ScalarToasts,
|
|
611
|
+
initializeToasts,
|
|
240
612
|
useToasts
|
|
241
613
|
};
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"vue",
|
|
13
13
|
"vue3"
|
|
14
14
|
],
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.6.1",
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=18"
|
|
18
18
|
},
|
|
@@ -28,19 +28,20 @@
|
|
|
28
28
|
"directory": "packages/use-toasts"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@vitejs/plugin-vue": "^
|
|
32
|
-
"@vitest/coverage-v8": "^
|
|
31
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
32
|
+
"@vitest/coverage-v8": "^1.2.2",
|
|
33
33
|
"nanoid": "^5.0.1",
|
|
34
34
|
"tsc-alias": "^1.8.8",
|
|
35
|
-
"vite": "^
|
|
36
|
-
"vite-plugin-css-injected-by-js": "^3.
|
|
37
|
-
"vitest": "^
|
|
35
|
+
"vite": "^5.1.1",
|
|
36
|
+
"vite-plugin-css-injected-by-js": "^3.4.0",
|
|
37
|
+
"vitest": "^1.2.2",
|
|
38
38
|
"vue": "^3.3.0",
|
|
39
39
|
"vue-tsc": "^1.8.19"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"nanoid": "4 - 5",
|
|
43
|
-
"vue": "^3.3.0"
|
|
43
|
+
"vue": "^3.3.0",
|
|
44
|
+
"vue-sonner": "^1.0.3"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "vite build && pnpm types:build && tsc-alias -p tsconfig.build.json",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
-
duration: number;
|
|
3
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
duration: number;
|
|
5
|
-
}>>>, {}, {}>;
|
|
6
|
-
export default _default;
|
|
7
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
8
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
9
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
10
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
11
|
-
} : {
|
|
12
|
-
type: import('vue').PropType<T[K]>;
|
|
13
|
-
required: true;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=FlowProgressRing.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowProgressRing.vue.d.ts","sourceRoot":"","sources":["../src/FlowProgressRing.vue.ts"],"names":[],"mappings":";cA+EY,MAAM;;cAAN,MAAM;;AAFlB,wBAQG;AAGH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
|
package/dist/FlowToast.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type Component } from 'vue';
|
|
2
|
-
export type ToastStatus = 'Error';
|
|
3
|
-
type ToastOptions = {
|
|
4
|
-
timeout?: number;
|
|
5
|
-
};
|
|
6
|
-
type BaseToast = {
|
|
7
|
-
id: string;
|
|
8
|
-
options?: ToastOptions;
|
|
9
|
-
};
|
|
10
|
-
type DefaultToastContent = {
|
|
11
|
-
title: string;
|
|
12
|
-
description?: Component | string;
|
|
13
|
-
status?: ToastStatus;
|
|
14
|
-
};
|
|
15
|
-
type CustomToastContent = {
|
|
16
|
-
component: Component;
|
|
17
|
-
};
|
|
18
|
-
export type DefaultToast = DefaultToastContent & BaseToast;
|
|
19
|
-
export type CustomToast = CustomToastContent & BaseToast;
|
|
20
|
-
export type Toast = DefaultToast | CustomToast;
|
|
21
|
-
export type ToastHandle = {
|
|
22
|
-
id: string;
|
|
23
|
-
dismiss: () => void;
|
|
24
|
-
active: () => boolean;
|
|
25
|
-
};
|
|
26
|
-
/** Shows a toast the given options */
|
|
27
|
-
export declare function addToast(contents: DefaultToastContent, options?: ToastOptions): ToastHandle;
|
|
28
|
-
/** Shows a toast with an error status */
|
|
29
|
-
export declare function addErrorToast(message: Component | string): ToastHandle;
|
|
30
|
-
/** Shows a toast with a custom component */
|
|
31
|
-
export declare function addCustomToast(component: Component, options?: ToastOptions): ToastHandle;
|
|
32
|
-
/** Gets access to all the toasts */
|
|
33
|
-
export declare function useToasts(): {
|
|
34
|
-
toasts: readonly Toast[];
|
|
35
|
-
addToast: typeof addToast;
|
|
36
|
-
removeToast: typeof removeToast;
|
|
37
|
-
clearToasts: typeof clearToasts;
|
|
38
|
-
};
|
|
39
|
-
/** Remove a toast by id */
|
|
40
|
-
declare function removeToast(id: string): void;
|
|
41
|
-
/** Clear all toasts */
|
|
42
|
-
declare function clearToasts(): void;
|
|
43
|
-
export {};
|
|
44
|
-
//# sourceMappingURL=FlowToast.d.ts.map
|
package/dist/FlowToast.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowToast.d.ts","sourceRoot":"","sources":["../src/FlowToast.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAsB,MAAM,KAAK,CAAA;AAExD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAA;AAEjC,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAChC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AACD,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAID,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,SAAS,CAAA;AAC1D,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,SAAS,CAAA;AACxD,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,WAAW,CAAA;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,MAAM,EAAE,MAAM,OAAO,CAAA;CACtB,CAAA;AA6BD,sCAAsC;AACtC,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,CAAC,EAAE,YAAY,GACrB,WAAW,CAEb;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,eAWxD;AAED,4CAA4C;AAC5C,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,YAAY,GACrB,WAAW,CAEb;AAED,oCAAoC;AACpC,wBAAgB,SAAS;;;;;EAOxB;AAED,2BAA2B;AAC3B,iBAAS,WAAW,CAAC,EAAE,EAAE,MAAM,QAI9B;AAED,uBAAuB;AACvB,iBAAS,WAAW,SAEnB"}
|
package/dist/FlowToast.vue.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Toast } from './FlowToast';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
toast: Toast;
|
|
4
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
-
toast: Toast;
|
|
6
|
-
}>>>, {}, {}>;
|
|
7
|
-
export default _default;
|
|
8
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
10
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
-
} : {
|
|
13
|
-
type: import('vue').PropType<T[K]>;
|
|
14
|
-
required: true;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=FlowToast.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowToast.vue.d.ts","sourceRoot":"","sources":["../src/FlowToast.vue.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAe,KAAK,EAAE,MAAM,aAAa,CAAA;;WAkL5C,KAAK;;WAAL,KAAK;;AAFd,wBAQG;AAGH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
-
export default _default;
|
|
3
|
-
//# sourceMappingURL=FlowToastContainer.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowToastContainer.vue.d.ts","sourceRoot":"","sources":["../src/FlowToastContainer.vue.ts"],"names":[],"mappings":";AAyFA,wBAKG"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
-
status?: "Error" | undefined;
|
|
3
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
status?: "Error" | undefined;
|
|
5
|
-
}>>>, {}, {}>, {
|
|
6
|
-
icon?(_: {}): any;
|
|
7
|
-
title?(_: {}): any;
|
|
8
|
-
description?(_: {}): any;
|
|
9
|
-
timeout?(_: {}): any;
|
|
10
|
-
}>;
|
|
11
|
-
export default _default;
|
|
12
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
13
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
14
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
15
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
16
|
-
} : {
|
|
17
|
-
type: import('vue').PropType<T[K]>;
|
|
18
|
-
required: true;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
-
new (): {
|
|
23
|
-
$slots: S;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=FlowToastLayout.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowToastLayout.vue.d.ts","sourceRoot":"","sources":["../src/FlowToastLayout.vue.ts"],"names":[],"mappings":";;;;;;;;;;AAmKA,wBAAwG;AAGxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
|