@scalar/use-toasts 0.5.15 → 0.6.4

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @scalar/use-toasts
2
2
 
3
+ ## 0.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 45dc04b: fix: can’t release packages
8
+
9
+ ## 0.6.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 05e2e27: chore: add provenance statement
14
+
15
+ ## 0.6.2
16
+
17
+ ### Patch Changes
18
+
19
+ - b234d1d: feat: added two events to standalone references build with tests
20
+
21
+ ## 0.6.1
22
+
23
+ ### Patch Changes
24
+
25
+ - a8c3045: build: re-introduce @scalar/use-toasts package
26
+
3
27
  ## 0.5.15
4
28
 
5
29
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Scalar
3
+ Copyright (c) 2023-present Scalar
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 { FlowToastContainer } from '@scalar/use-toasts'
19
+ import { ScalarToasts } from '@scalar/use-toasts'
20
20
  </script>
21
-
22
21
  <template>
23
- <FlowToastContainer />
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
- addToast({ title: 'Hello :-)' }, { timeout: 2000 })
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,2 @@
1
+ export * from './useToasts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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 * from './FlowToast';
2
- export { default as FlowToastContainer } from './FlowToastContainer.vue';
1
+ export { default as ScalarToasts } from './components/ScalarToasts.vue';
2
+ export * from './hooks';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA"}
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,235 +3,611 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode(".progress-ring[data-v-6d218ca0] {\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n animation: linear turn-6d218ca0 reverse forwards;\n}\n@keyframes turn-6d218ca0 {\nfrom {\n stroke-dashoffset: var(--2d61a1b2);\n}\nto {\n stroke-dashoffset: 0;\n}\n}\n\n.toast-layout[data-v-c76046db] {\n pointer-events: initial;\n\n box-sizing: border-box;\n\n padding: 18px;\n background: var(--theme-background-1, var(--default-theme-background-1));\n border-radius: var(--theme-radius-lg, var(--default-theme-radius-lg));\n font-size: var(--theme-font-size-3, var(--default-theme-font-size-3));\n color: var(--theme-color-1, var(--default-theme-color-1));\n display: grid;\n grid-template-columns: auto 1fr auto;\n grid-template-areas:\n 'icon title timeout'\n '. description description';\n align-items: center;\n position: relative;\n\n width: 100%;\n}\n.toast-title[data-v-c76046db] {\n grid-area: title;\n font-weight: var(--theme-font-semibold, var(--default-theme-font-semibold));\n display: flex;\n align-items: center;\n}\n.toast-description[data-v-c76046db] {\n grid-area: description;\n margin-top: 5px;\n line-height: 1.45;\n color: var(--theme-color-2, var(--default-theme-color-2));\n}\n.toast-icon[data-v-c76046db] {\n grid-area: icon;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 10px;\n color: var(--theme-color-2, var(--default-theme-color-2));\n}\n.toast-icon[data-v-c76046db] > * {\n width: 14px;\n height: 14px;\n}\n.toast-timeout[data-v-c76046db] {\n grid-area: timeout;\n margin-left: 10px;\n width: 16px;\n height: 16px;\n display: flex;\n color: var(--theme-color-ghost, var(--default-theme-color-ghost));\n}\n.toast-error .toast-icon[data-v-c76046db],\n.toast-error .toast-title[data-v-c76046db] {\n color: var(--theme-error-color, var(--default-theme-color-red));\n}\n\n.toast[data-v-5e2e8f38] {\n pointer-events: initial;\n filter: brightness(\n var(--theme-lifted-brightness, var(--default-theme-lifted-brightness))\n );\n\n background: var(--theme-background-1, var(--default-theme-background-1));\n border-radius: var(--theme-radius-lg, var(--default-theme-radius-lg));\n box-shadow: var(--theme-shadow-2, var(--default-theme-shadow-2));\n font-family: var(--theme-font, var(--default-theme-font));\n\n width: 380px;\n max-width: 100%;\n min-width: 0;\n}\n\n.toast-container[data-v-e7c9664e] {\n width: 100dvw;\n height: 100svh;\n position: fixed;\n bottom: 0;\n left: 0;\n z-index: 1000000;\n\n box-sizing: border-box;\n\n pointer-events: none;\n\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n justify-content: flex-end;\n gap: 12px;\n\n padding: 48px;\n}\n@media screen and (max-width: 600px) {\n /* Less padding for toasts on mobile */\n.toast-container[data-v-e7c9664e] {\n padding: 24px;\n}\n}\n.toasts-move[data-v-e7c9664e],\n.toasts-enter-active[data-v-e7c9664e],\n.toasts-leave-active[data-v-e7c9664e] {\n transition: all 0.5s ease;\n}\n.toasts-enter-from[data-v-e7c9664e],\n.toasts-leave-to[data-v-e7c9664e] {\n opacity: 0;\n transform: translateX(30px);\n}\n.toast-leave-active[data-v-e7c9664e] {\n position: absolute;\n}"));
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 { nanoid } from "nanoid";
14
- import { reactive, readonly, defineComponent, useCssVars, computed, openBlock, createElementBlock, createElementVNode, normalizeStyle, normalizeClass, renderSlot, createCommentVNode, createBlock, resolveDynamicComponent, createSlots, withCtx, createVNode, createTextVNode, toDisplayString, Fragment, TransitionGroup, renderList, unref } from "vue";
15
- const toasts = reactive([]);
16
- function createToast(content, options) {
17
- const id = nanoid();
18
- toasts.push({ id, ...content, options });
19
- let timer;
20
- if (options == null ? void 0 : options.timeout) {
21
- timer = setTimeout(() => {
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
- return createToast(contents, options);
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
- function addErrorToast(message) {
39
- return createToast(
40
- {
41
- title: "Something went wrong...",
42
- description: message,
43
- status: "Error"
44
- },
45
- {
46
- timeout: 5e3
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
- function addCustomToast(component, options) {
51
- return createToast({ component }, options);
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
- function useToasts() {
54
- return {
55
- toasts: readonly(toasts),
56
- addToast,
57
- removeToast,
58
- clearToasts
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
- function removeToast(id) {
62
- const idx = toasts.findIndex((t) => t.id === id);
63
- if (idx < 0)
64
- return;
65
- toasts.splice(idx, 1);
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
- function clearToasts() {
68
- toasts.splice(0, toasts.length);
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 _hoisted_1$3 = { viewBox: "0 0 24 24" };
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 _export_sfc = (sfc, props) => {
104
- const target = sfc.__vccOpts || sfc;
105
- for (const [key, val] of props) {
106
- target[key] = val;
107
- }
108
- return target;
109
- };
110
- const FlowProgressRing = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-6d218ca0"]]);
111
- const _hoisted_1$2 = {
112
- key: 0,
113
- class: "toast-icon"
114
- };
115
- const _hoisted_2 = { class: "toast-title" };
116
- 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 = {
117
230
  key: 1,
118
- class: "toast-description text-copy-light"
119
- };
120
- const _hoisted_4 = {
121
- key: 2,
122
- class: "toast-timeout"
123
- };
124
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
125
- __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",
126
234
  props: {
127
- status: {}
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: {}
128
248
  },
129
- setup(__props) {
130
- return (_ctx, _cache) => {
131
- return openBlock(), createElementBlock("div", {
132
- class: normalizeClass(["toast-layout", { "toast-error": _ctx.status === "Error" }])
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
133
385
  }, [
134
- _ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
135
- renderSlot(_ctx.$slots, "icon", {}, void 0, true)
136
- ])) : createCommentVNode("", true),
137
- createElementVNode("div", _hoisted_2, [
138
- renderSlot(_ctx.$slots, "title", {}, void 0, true)
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)
139
408
  ]),
140
- _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_3, [
141
- renderSlot(_ctx.$slots, "description", {}, void 0, true)
142
- ])) : createCommentVNode("", true),
143
- _ctx.$slots.timeout ? (openBlock(), createElementBlock("div", _hoisted_4, [
144
- renderSlot(_ctx.$slots, "timeout", {}, void 0, true)
145
- ])) : createCommentVNode("", true)
146
- ], 2);
147
- };
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));
148
433
  }
149
- });
150
- const FlowToastLayout = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c76046db"]]);
151
- const _hoisted_1$1 = { class: "toast" };
152
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
153
- __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",
154
438
  props: {
155
- toast: {}
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" }
156
454
  },
157
- setup(__props) {
158
- const isCustom = (t) => {
159
- return t.component !== void 0;
160
- };
161
- return (_ctx, _cache) => {
162
- var _a, _b;
163
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
164
- isCustom(_ctx.toast) ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.toast.component), { key: 0 }, createSlots({ _: 2 }, [
165
- ((_a = _ctx.toast.options) == null ? void 0 : _a.timeout) ? {
166
- name: "timeout",
167
- fn: withCtx(() => [
168
- createVNode(FlowProgressRing, {
169
- duration: _ctx.toast.options.timeout
170
- }, null, 8, ["duration"])
171
- ]),
172
- key: "0"
173
- } : void 0
174
- ]), 1024)) : createCommentVNode("", true),
175
- !isCustom(_ctx.toast) ? (openBlock(), createBlock(FlowToastLayout, {
176
- key: 1,
177
- status: _ctx.toast.status
178
- }, createSlots({
179
- title: withCtx(() => [
180
- createTextVNode(toDisplayString(_ctx.toast.title), 1)
181
- ]),
182
- _: 2
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)
183
539
  }, [
184
- _ctx.toast.description ? {
185
- name: "description",
186
- fn: withCtx(() => [
187
- typeof _ctx.toast.description === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
188
- createTextVNode(toDisplayString(_ctx.toast.description), 1)
189
- ], 64)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.toast.description), { key: 1 }))
190
- ]),
191
- key: "0"
192
- } : void 0,
193
- ((_b = _ctx.toast.options) == null ? void 0 : _b.timeout) ? {
194
- name: "timeout",
195
- fn: withCtx(() => [
196
- createVNode(FlowProgressRing, {
197
- duration: _ctx.toast.options.timeout
198
- }, null, 8, ["duration"])
199
- ]),
200
- key: "1"
201
- } : void 0
202
- ]), 1032, ["status"])) : createCommentVNode("", true)
203
- ]);
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);
204
566
  };
205
567
  }
206
568
  });
207
- const FlowToast = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5e2e8f38"]]);
208
- const _hoisted_1 = { class: "toast-container" };
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
+ }
209
583
  const _sfc_main = /* @__PURE__ */ defineComponent({
210
- __name: "FlowToastContainer",
584
+ __name: "ScalarToasts",
211
585
  setup(__props) {
212
- const { toasts: toasts2 } = useToasts();
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
+ });
213
601
  return (_ctx, _cache) => {
214
- return openBlock(), createElementBlock("div", _hoisted_1, [
215
- createVNode(TransitionGroup, { name: "toasts" }, {
216
- default: withCtx(() => [
217
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(toasts2), (toast) => {
218
- return openBlock(), createBlock(FlowToast, {
219
- key: toast.id,
220
- toast
221
- }, null, 8, ["toast"]);
222
- }), 128))
223
- ]),
224
- _: 1
225
- })
226
- ]);
602
+ return isClientMounted.value ? (openBlock(), createBlock(unref(Ce), {
603
+ key: 0,
604
+ toastOptions: { className: "toaster" }
605
+ })) : createCommentVNode("", true);
227
606
  };
228
607
  }
229
608
  });
230
- const FlowToastContainer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e7c9664e"]]);
231
609
  export {
232
- FlowToastContainer,
233
- addCustomToast,
234
- addErrorToast,
235
- addToast,
610
+ _sfc_main as ScalarToasts,
611
+ initializeToasts,
236
612
  useToasts
237
613
  };
package/package.json CHANGED
@@ -5,6 +5,11 @@
5
5
  "author": "Scalar (https://github.com/scalar)",
6
6
  "homepage": "https://github.com/scalar/scalar",
7
7
  "bugs": "https://github.com/scalar/scalar/issues/new/choose",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/scalar/scalar.git",
11
+ "directory": "packages/use-toasts"
12
+ },
8
13
  "keywords": [
9
14
  "composable",
10
15
  "notifcation",
@@ -12,7 +17,7 @@
12
17
  "vue",
13
18
  "vue3"
14
19
  ],
15
- "version": "0.5.15",
20
+ "version": "0.6.4",
16
21
  "engines": {
17
22
  "node": ">=18"
18
23
  },
@@ -22,25 +27,21 @@
22
27
  "dist",
23
28
  "CHANGELOG.md"
24
29
  ],
25
- "repository": {
26
- "type": "git",
27
- "url": "https://github.com/scalar/scalar.git",
28
- "directory": "packages/use-toasts"
29
- },
30
30
  "devDependencies": {
31
31
  "@vitejs/plugin-vue": "^5.0.4",
32
- "@vitest/coverage-v8": "^1.2.2",
32
+ "@vitest/coverage-v8": "^1.5.0",
33
33
  "nanoid": "^5.0.1",
34
34
  "tsc-alias": "^1.8.8",
35
- "vite": "^5.1.1",
35
+ "vite": "^5.2.10",
36
36
  "vite-plugin-css-injected-by-js": "^3.4.0",
37
- "vitest": "^1.2.2",
38
- "vue": "^3.3.0",
37
+ "vitest": "^1.5.0",
38
+ "vue": "^3.4.21",
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"}
@@ -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
@@ -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"}
@@ -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"}