vue-sonner
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
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<{}>>, {}, {}>; | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
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<{}>>, {}, {}>; | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
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<{}>>, {}, {}>; | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>; | ||
export default _default; |
declare const _default: import("vue").DefineComponent<{ | ||
visible: BooleanConstructor; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{ | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ | ||
visible: BooleanConstructor; | ||
@@ -5,0 +5,0 @@ }>>, { |
@@ -1,2 +0,2 @@ | ||
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<{}>>, {}, {}>; | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
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<{}>>, {}, {}>; | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>; | ||
export default _default; |
@@ -5,4 +5,4 @@ import type { Plugin } from 'vue'; | ||
import { toast } from './state'; | ||
export { Toaster, toast, ToasterProps }; | ||
export { Toaster, toast, type ToasterProps }; | ||
declare const plugin: Plugin; | ||
export default plugin; |
import type { Component } from 'vue'; | ||
import { ExternalToast, ToastT, PromiseData, PromiseT, ToastToDismiss, ToastTypes } from './types'; | ||
import type { ExternalToast, ToastT, PromiseData, PromiseT, ToastToDismiss, ToastTypes } from './types'; | ||
declare class Observer { | ||
@@ -15,24 +15,24 @@ subscribers: Array<(toast: ExternalToast | ToastToDismiss) => void>; | ||
}) => string | number; | ||
dismiss: (id?: string | number | undefined) => string | number | undefined; | ||
message: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
error: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
success: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
info: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
warning: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
loading: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
dismiss: (id?: number | string) => string | number | undefined; | ||
message: (message: string | Component, data?: ExternalToast) => string | number; | ||
error: (message: string | Component, data?: ExternalToast) => string | number; | ||
success: (message: string | Component, data?: ExternalToast) => string | number; | ||
info: (message: string | Component, data?: ExternalToast) => string | number; | ||
warning: (message: string | Component, data?: ExternalToast) => string | number; | ||
loading: (message: string | Component, data?: ExternalToast) => string | number; | ||
promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData> | undefined) => string | number | undefined; | ||
custom: (component: Component, data?: ExternalToast | undefined) => string | number; | ||
custom: (component: Component, data?: ExternalToast) => string | number; | ||
} | ||
export declare const ToastState: Observer; | ||
export declare const toast: ((message: string | Component, data?: ExternalToast | undefined) => string | number) & { | ||
success: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
info: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
warning: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
error: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
custom: (component: Component, data?: ExternalToast | undefined) => string | number; | ||
message: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
export declare const toast: ((message: string | Component, data?: ExternalToast) => string | number) & { | ||
success: (message: string | Component, data?: ExternalToast) => string | number; | ||
info: (message: string | Component, data?: ExternalToast) => string | number; | ||
warning: (message: string | Component, data?: ExternalToast) => string | number; | ||
error: (message: string | Component, data?: ExternalToast) => string | number; | ||
custom: (component: Component, data?: ExternalToast) => string | number; | ||
message: (message: string | Component, data?: ExternalToast) => string | number; | ||
promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData> | undefined) => string | number | undefined; | ||
dismiss: (id?: string | number | undefined) => string | number | undefined; | ||
loading: (message: string | Component, data?: ExternalToast | undefined) => string | number; | ||
dismiss: (id?: number | string) => string | number | undefined; | ||
loading: (message: string | Component, data?: ExternalToast) => string | number; | ||
}; | ||
export {}; |
@@ -1,113 +0,35 @@ | ||
import type { PropType } from 'vue'; | ||
import { HeightT, Position, ToastT } from './types'; | ||
declare const _default: import("vue").DefineComponent<{ | ||
toast: { | ||
type: PropType<ToastT>; | ||
required: true; | ||
}; | ||
toasts: { | ||
type: PropType<ToastT[]>; | ||
required: true; | ||
}; | ||
index: { | ||
type: NumberConstructor; | ||
required: true; | ||
}; | ||
expanded: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
invert: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
heights: { | ||
type: PropType<HeightT[]>; | ||
required: true; | ||
}; | ||
position: { | ||
type: PropType<Position>; | ||
required: true; | ||
}; | ||
visibleToasts: { | ||
type: NumberConstructor; | ||
required: true; | ||
}; | ||
expandByDefault: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
closeButton: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
interacting: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
duration: { | ||
type: NumberConstructor; | ||
required: false; | ||
}; | ||
descriptionClass: { | ||
type: StringConstructor; | ||
required: false; | ||
}; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { | ||
import './styles.css'; | ||
import type { HeightT, Position, ToastT } from './types'; | ||
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{ | ||
toast: ToastT; | ||
toasts: ToastT[]; | ||
index: number; | ||
expanded: boolean; | ||
invert: boolean; | ||
heights: HeightT[]; | ||
position: Position; | ||
visibleToasts: number; | ||
expandByDefault: boolean; | ||
closeButton: boolean; | ||
interacting: boolean; | ||
duration?: number | undefined; | ||
descriptionClass?: string | undefined; | ||
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { | ||
"update:heights": (heights: HeightT[]) => void; | ||
removeToast: (toast: ToastT) => void; | ||
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{ | ||
toast: { | ||
type: PropType<ToastT>; | ||
required: true; | ||
}; | ||
toasts: { | ||
type: PropType<ToastT[]>; | ||
required: true; | ||
}; | ||
index: { | ||
type: NumberConstructor; | ||
required: true; | ||
}; | ||
expanded: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
invert: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
heights: { | ||
type: PropType<HeightT[]>; | ||
required: true; | ||
}; | ||
position: { | ||
type: PropType<Position>; | ||
required: true; | ||
}; | ||
visibleToasts: { | ||
type: NumberConstructor; | ||
required: true; | ||
}; | ||
expandByDefault: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
closeButton: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
interacting: { | ||
type: BooleanConstructor; | ||
required: true; | ||
}; | ||
duration: { | ||
type: NumberConstructor; | ||
required: false; | ||
}; | ||
descriptionClass: { | ||
type: StringConstructor; | ||
required: false; | ||
}; | ||
}>> & { | ||
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ | ||
toast: ToastT; | ||
toasts: ToastT[]; | ||
index: number; | ||
expanded: boolean; | ||
invert: boolean; | ||
heights: HeightT[]; | ||
position: Position; | ||
visibleToasts: number; | ||
expandByDefault: boolean; | ||
closeButton: boolean; | ||
interacting: boolean; | ||
duration?: number | undefined; | ||
descriptionClass?: string | undefined; | ||
}>>> & { | ||
"onUpdate:heights"?: ((heights: HeightT[]) => any) | undefined; | ||
@@ -117,1 +39,10 @@ onRemoveToast?: ((toast: ToastT) => any) | undefined; | ||
export default _default; | ||
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T; | ||
type __VLS_TypePropsToRuntimeProps<T> = { | ||
[K in keyof T]-?: {} extends Pick<T, K> ? { | ||
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>; | ||
} : { | ||
type: import('vue').PropType<T[K]>; | ||
required: true; | ||
}; | ||
}; |
@@ -1,3 +0,3 @@ | ||
import { CSSProperties } from 'vue'; | ||
import { Position, Theme, ToastOptions } from './types'; | ||
import { type CSSProperties } from 'vue'; | ||
import type { Position, Theme, ToastOptions } from './types'; | ||
export interface ToasterProps { | ||
@@ -20,135 +20,42 @@ invert?: boolean; | ||
} | ||
declare const _default: import("vue").DefineComponent<{ | ||
style: { | ||
type: import("vue").PropType<CSSProperties>; | ||
default: () => {}; | ||
}; | ||
dir: { | ||
type: import("vue").PropType<"auto" | "ltr" | "rtl">; | ||
default: string; | ||
}; | ||
className: { | ||
type: import("vue").PropType<string>; | ||
default: string; | ||
}; | ||
invert: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
duration: { | ||
type: import("vue").PropType<number>; | ||
default: number; | ||
}; | ||
position: { | ||
type: import("vue").PropType<Position>; | ||
default: string; | ||
}; | ||
offset: { | ||
type: import("vue").PropType<string | number>; | ||
default: string; | ||
}; | ||
visibleToasts: { | ||
type: import("vue").PropType<number>; | ||
default: number; | ||
}; | ||
closeButton: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
gap: { | ||
type: import("vue").PropType<number>; | ||
default: number; | ||
}; | ||
theme: { | ||
type: import("vue").PropType<Theme>; | ||
default: string; | ||
}; | ||
hotkey: { | ||
type: import("vue").PropType<string[]>; | ||
default: () => string[]; | ||
}; | ||
richColors: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
expand: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
toastOptions: { | ||
type: import("vue").PropType<ToastOptions>; | ||
default: () => {}; | ||
}; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{ | ||
style: { | ||
type: import("vue").PropType<CSSProperties>; | ||
default: () => {}; | ||
}; | ||
dir: { | ||
type: import("vue").PropType<"auto" | "ltr" | "rtl">; | ||
default: string; | ||
}; | ||
className: { | ||
type: import("vue").PropType<string>; | ||
default: string; | ||
}; | ||
invert: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
duration: { | ||
type: import("vue").PropType<number>; | ||
default: number; | ||
}; | ||
position: { | ||
type: import("vue").PropType<Position>; | ||
default: string; | ||
}; | ||
offset: { | ||
type: import("vue").PropType<string | number>; | ||
default: string; | ||
}; | ||
visibleToasts: { | ||
type: import("vue").PropType<number>; | ||
default: number; | ||
}; | ||
closeButton: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
gap: { | ||
type: import("vue").PropType<number>; | ||
default: number; | ||
}; | ||
theme: { | ||
type: import("vue").PropType<Theme>; | ||
default: string; | ||
}; | ||
hotkey: { | ||
type: import("vue").PropType<string[]>; | ||
default: () => string[]; | ||
}; | ||
richColors: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
expand: { | ||
type: import("vue").PropType<boolean>; | ||
default: boolean; | ||
}; | ||
toastOptions: { | ||
type: import("vue").PropType<ToastOptions>; | ||
default: () => {}; | ||
}; | ||
}>>, { | ||
style: CSSProperties; | ||
dir: "auto" | "ltr" | "rtl"; | ||
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ToasterProps>, { | ||
invert: boolean; | ||
position: string; | ||
hotkey: () => string[]; | ||
expand: boolean; | ||
closeButton: boolean; | ||
className: string; | ||
offset: string; | ||
theme: string; | ||
richColors: boolean; | ||
duration: number; | ||
style: () => {}; | ||
visibleToasts: number; | ||
toastOptions: () => {}; | ||
dir: string; | ||
gap: number; | ||
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ToasterProps>, { | ||
invert: boolean; | ||
position: string; | ||
hotkey: () => string[]; | ||
expand: boolean; | ||
closeButton: boolean; | ||
className: string; | ||
offset: string; | ||
theme: string; | ||
richColors: boolean; | ||
duration: number; | ||
style: () => {}; | ||
visibleToasts: number; | ||
toastOptions: () => {}; | ||
dir: string; | ||
gap: number; | ||
}>>>, { | ||
invert: boolean; | ||
duration: number; | ||
style: CSSProperties; | ||
className: string; | ||
position: Position; | ||
offset: string | number; | ||
visibleToasts: number; | ||
closeButton: boolean; | ||
gap: number; | ||
theme: Theme; | ||
@@ -158,4 +65,24 @@ hotkey: string[]; | ||
expand: boolean; | ||
gap: number; | ||
toastOptions: ToastOptions; | ||
offset: string | number; | ||
dir: "auto" | "ltr" | "rtl"; | ||
}, {}>; | ||
export default _default; | ||
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T; | ||
type __VLS_TypePropsToRuntimeProps<T> = { | ||
[K in keyof T]-?: {} extends Pick<T, K> ? { | ||
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>; | ||
} : { | ||
type: import('vue').PropType<T[K]>; | ||
required: true; | ||
}; | ||
}; | ||
type __VLS_WithDefaults<P, D> = { | ||
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & { | ||
default: D[K]; | ||
}> : P[K]; | ||
}; | ||
type __VLS_Prettify<T> = { | ||
[K in keyof T]: T[K]; | ||
} & {}; |
@@ -1,5 +0,5 @@ | ||
import { Component, CSSProperties } from 'vue'; | ||
export declare type ToastTypes = 'normal' | 'action' | 'success' | 'info' | 'warning' | 'error' | 'loading'; | ||
export declare type PromiseT<Data = any> = Promise<Data> | (() => Promise<Data>); | ||
export declare type PromiseData<ToastData = any> = ExternalToast & { | ||
import type { Component, CSSProperties } from 'vue'; | ||
export type ToastTypes = 'normal' | 'action' | 'success' | 'info' | 'warning' | 'error' | 'loading'; | ||
export type PromiseT<Data = any> = Promise<Data> | (() => Promise<Data>); | ||
export type PromiseData<ToastData = any> = ExternalToast & { | ||
loading?: string | Component; | ||
@@ -38,3 +38,3 @@ success?: (data: ToastData) => string | Component; | ||
} | ||
export declare type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center'; | ||
export type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center'; | ||
export interface HeightT { | ||
@@ -56,3 +56,3 @@ height: number; | ||
} | ||
export declare type Theme = 'light' | 'dark' | 'system'; | ||
export type Theme = 'light' | 'dark' | 'system'; | ||
export interface ToastToDismiss { | ||
@@ -62,4 +62,4 @@ id: number | string; | ||
} | ||
export declare type ExternalToast = Omit<ToastT, 'id' | 'type' | 'title' | 'delete'> & { | ||
export type ExternalToast = Omit<ToastT, 'id' | 'type' | 'title' | 'delete'> & { | ||
id?: number | string; | ||
}; |
@@ -1,49 +0,55 @@ | ||
var me = Object.defineProperty; | ||
var pe = (s, t, e) => t in s ? me(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e; | ||
var y = (s, t, e) => (pe(s, typeof t != "symbol" ? t + "" : t, e), e); | ||
import "./index.css"; | ||
import { defineComponent as ee, openBlock as l, createElementBlock as h, createElementVNode as $, Fragment as K, renderList as ae, unref as M, ref as c, computed as w, onMounted as Q, watchEffect as q, onUnmounted as re, normalizeClass as se, normalizeStyle as X, createVNode as ge, createCommentVNode as C, createBlock as O, createTextVNode as oe, toDisplayString as z, resolveDynamicComponent as ye, useAttrs as we, nextTick as be, watch as Te } from "vue"; | ||
let Z = 1; | ||
class xe { | ||
var yt = Object.defineProperty; | ||
var xt = (r, t, e) => t in r ? yt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e; | ||
var g = (r, t, e) => (xt(r, typeof t != "symbol" ? t + "" : t, e), e); | ||
import { defineComponent as et, openBlock as d, createElementBlock as f, createElementVNode as T, Fragment as F, renderList as lt, unref as O, ref as c, computed as v, onMounted as Q, watchEffect as R, onUnmounted as dt, normalizeClass as st, normalizeStyle as Z, createVNode as kt, createCommentVNode as C, createBlock as I, createTextVNode as nt, toDisplayString as Y, resolveDynamicComponent as Tt, useAttrs as _t, nextTick as $t, watch as Ct } from "vue"; | ||
function wt(r) { | ||
if (!r || typeof document > "u") | ||
return; | ||
let t = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style"); | ||
e.type = "text/css", t.appendChild(e), e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r)); | ||
} | ||
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}}"); | ||
let tt = 1; | ||
class Bt { | ||
constructor() { | ||
y(this, "subscribers"); | ||
y(this, "toasts"); | ||
g(this, "subscribers"); | ||
g(this, "toasts"); | ||
// We use arrow functions to maintain the correct `this` reference | ||
y(this, "subscribe", (t) => (this.subscribers.push(t), () => { | ||
g(this, "subscribe", (t) => (this.subscribers.push(t), () => { | ||
const e = this.subscribers.indexOf(t); | ||
this.subscribers.splice(e, 1); | ||
})); | ||
y(this, "publish", (t) => { | ||
g(this, "publish", (t) => { | ||
this.subscribers.forEach((e) => e(t)); | ||
}); | ||
y(this, "addToast", (t) => { | ||
g(this, "addToast", (t) => { | ||
this.publish(t), this.toasts = [...this.toasts, t]; | ||
}); | ||
y(this, "create", (t) => { | ||
var p; | ||
const { message: e, ...i } = t, u = typeof (t == null ? void 0 : t.id) == "number" || ((p = t.id) == null ? void 0 : p.length) > 0 ? t.id : Z++, m = this.toasts.findIndex((v) => v.id === u), d = t.dismissible === void 0 ? !0 : t.dismissible; | ||
return m !== -1 ? this.toasts = this.toasts.map((v) => v.id === u ? (this.publish({ ...v, ...t, id: u, title: e }), { | ||
...v, | ||
g(this, "create", (t) => { | ||
var h; | ||
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 ? !0 : t.dismissible; | ||
return p !== -1 ? this.toasts = this.toasts.map((x) => x.id === a ? (this.publish({ ...x, ...t, id: a, title: e }), { | ||
...x, | ||
...t, | ||
id: u, | ||
dismissible: d, | ||
id: a, | ||
dismissible: u, | ||
title: e | ||
}) : v) : this.addToast({ title: e, ...i, dismissible: d, id: u }), u; | ||
}) : x) : this.addToast({ title: e, ...n, dismissible: u, id: a }), a; | ||
}); | ||
y(this, "dismiss", (t) => (t || this.toasts.forEach((e) => { | ||
g(this, "dismiss", (t) => (t || this.toasts.forEach((e) => { | ||
this.subscribers.forEach( | ||
(i) => i({ id: e.id, dismiss: !0 }) | ||
(n) => n({ id: e.id, dismiss: !0 }) | ||
); | ||
}), this.subscribers.forEach((e) => e({ id: t, dismiss: !0 })), t)); | ||
y(this, "message", (t, e) => this.create({ ...e, message: t })); | ||
y(this, "error", (t, e) => this.create({ ...e, type: "error", message: t })); | ||
y(this, "success", (t, e) => this.create({ ...e, type: "success", message: t })); | ||
y(this, "info", (t, e) => this.create({ ...e, type: "info", message: t })); | ||
y(this, "warning", (t, e) => this.create({ ...e, type: "warning", message: t })); | ||
y(this, "loading", (t, e) => this.create({ ...e, type: "loading", message: t })); | ||
y(this, "promise", (t, e) => { | ||
g(this, "message", (t, e) => this.create({ ...e, message: t })); | ||
g(this, "error", (t, e) => this.create({ ...e, type: "error", message: t })); | ||
g(this, "success", (t, e) => this.create({ ...e, type: "success", message: t })); | ||
g(this, "info", (t, e) => this.create({ ...e, type: "info", message: t })); | ||
g(this, "warning", (t, e) => this.create({ ...e, type: "warning", message: t })); | ||
g(this, "loading", (t, e) => this.create({ ...e, type: "loading", message: t })); | ||
g(this, "promise", (t, e) => { | ||
if (!e) | ||
return; | ||
let i; | ||
e.loading !== void 0 && (i = this.create({ | ||
let n; | ||
e.loading !== void 0 && (n = this.create({ | ||
...e, | ||
@@ -54,25 +60,25 @@ promise: t, | ||
})); | ||
const u = t instanceof Promise ? t : t(); | ||
let m = i !== void 0; | ||
return u.then((d) => { | ||
const a = t instanceof Promise ? t : t(); | ||
let p = n !== void 0; | ||
return a.then((u) => { | ||
if (e.success !== void 0) { | ||
m = !1; | ||
const p = typeof e.success == "function" ? e.success(d) : e.success; | ||
this.create({ id: i, type: "success", message: p }); | ||
p = !1; | ||
const h = typeof e.success == "function" ? e.success(u) : e.success; | ||
this.create({ id: n, type: "success", message: h }); | ||
} | ||
}).catch((d) => { | ||
}).catch((u) => { | ||
if (e.error !== void 0) { | ||
m = !1; | ||
const p = typeof e.error == "function" ? e.error(d) : e.error; | ||
this.create({ id: i, type: "error", message: p }); | ||
p = !1; | ||
const h = typeof e.error == "function" ? e.error(u) : e.error; | ||
this.create({ id: n, type: "error", message: h }); | ||
} | ||
}).finally(() => { | ||
var d; | ||
m && (this.dismiss(i), i = void 0), (d = e.finally) == null || d.call(e); | ||
}), i; | ||
var u; | ||
p && (this.dismiss(n), n = void 0), (u = e.finally) == null || u.call(e); | ||
}), n; | ||
}); | ||
// We can't provide the toast we just created as a prop as we didn't create it yet, so we can create a default toast object, I just don't know how to use function in argument when calling()? | ||
y(this, "custom", (t, e) => { | ||
const i = (e == null ? void 0 : e.id) || Z++; | ||
return this.publish({ ...e, id: i, title: t }), i; | ||
g(this, "custom", (t, e) => { | ||
const n = (e == null ? void 0 : e.id) || tt++; | ||
return this.publish({ ...e, id: n, title: t }), n; | ||
}); | ||
@@ -82,20 +88,20 @@ this.subscribers = [], this.toasts = []; | ||
} | ||
const T = new xe(), ke = (s, t) => { | ||
const e = (t == null ? void 0 : t.id) || Z++; | ||
return T.publish({ | ||
title: s, | ||
const k = new Bt(), Et = (r, t) => { | ||
const e = (t == null ? void 0 : t.id) || tt++; | ||
return k.publish({ | ||
title: r, | ||
...t, | ||
id: e | ||
}), e; | ||
}, $e = ke, $t = Object.assign($e, { | ||
success: T.success, | ||
info: T.info, | ||
warning: T.warning, | ||
error: T.error, | ||
custom: T.custom, | ||
message: T.message, | ||
promise: T.promise, | ||
dismiss: T.dismiss, | ||
loading: T.loading | ||
}), Be = ["data-visible"], Ce = { className: "sonner-spinner" }, _e = /* @__PURE__ */ ee({ | ||
}, St = Et, Ie = Object.assign(St, { | ||
success: k.success, | ||
info: k.info, | ||
warning: k.warning, | ||
error: k.error, | ||
custom: k.custom, | ||
message: k.message, | ||
promise: k.promise, | ||
dismiss: k.dismiss, | ||
loading: k.loading | ||
}), It = ["data-visible"], zt = { className: "sonner-spinner" }, Nt = /* @__PURE__ */ et({ | ||
__name: "Loader", | ||
@@ -105,22 +111,22 @@ props: { | ||
}, | ||
setup(s) { | ||
setup(r) { | ||
const t = Array(12).fill(0); | ||
return (e, i) => (l(), h("div", { | ||
return (e, n) => (d(), f("div", { | ||
className: "sonner-loading-wrapper", | ||
"data-visible": s.visible | ||
"data-visible": r.visible | ||
}, [ | ||
$("div", Ce, [ | ||
(l(!0), h(K, null, ae(M(t), (u) => (l(), h("div", { | ||
key: `spinner-bar-${u}`, | ||
T("div", zt, [ | ||
(d(!0), f(F, null, lt(O(t), (a) => (d(), f("div", { | ||
key: `spinner-bar-${a}`, | ||
className: "sonner-loading-bar" | ||
}))), 128)) | ||
]) | ||
], 8, Be)); | ||
], 8, It)); | ||
} | ||
}), H = (s, t) => { | ||
const e = s.__vccOpts || s; | ||
for (const [i, u] of t) | ||
e[i] = u; | ||
}), H = (r, t) => { | ||
const e = r.__vccOpts || r; | ||
for (const [n, a] of t) | ||
e[n] = a; | ||
return e; | ||
}, Ee = {}, Ie = { | ||
}, Mt = {}, Ot = { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -131,13 +137,13 @@ viewBox: "0 0 20 20", | ||
width: "20" | ||
}, Ne = /* @__PURE__ */ $("path", { | ||
}, Pt = /* @__PURE__ */ T("path", { | ||
"fill-rule": "evenodd", | ||
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", | ||
"clip-rule": "evenodd" | ||
}, null, -1), Oe = [ | ||
Ne | ||
}, null, -1), At = [ | ||
Pt | ||
]; | ||
function Se(s, t) { | ||
return l(), h("svg", Ie, Oe); | ||
function Dt(r, t) { | ||
return d(), f("svg", Ot, At); | ||
} | ||
const Me = /* @__PURE__ */ H(Ee, [["render", Se]]), Pe = {}, Ae = { | ||
const Yt = /* @__PURE__ */ H(Mt, [["render", Dt]]), Rt = {}, Ht = { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -148,13 +154,13 @@ viewBox: "0 0 20 20", | ||
width: "20" | ||
}, De = /* @__PURE__ */ $("path", { | ||
}, Lt = /* @__PURE__ */ T("path", { | ||
"fill-rule": "evenodd", | ||
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", | ||
"clip-rule": "evenodd" | ||
}, null, -1), Re = [ | ||
De | ||
}, null, -1), Ut = [ | ||
Lt | ||
]; | ||
function ze(s, t) { | ||
return l(), h("svg", Ae, Re); | ||
function Vt(r, t) { | ||
return d(), f("svg", Ht, Ut); | ||
} | ||
const qe = /* @__PURE__ */ H(Pe, [["render", ze]]), He = {}, Le = { | ||
const jt = /* @__PURE__ */ H(Rt, [["render", Vt]]), Ft = {}, Kt = { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -165,13 +171,13 @@ viewBox: "0 0 24 24", | ||
width: "20" | ||
}, Ve = /* @__PURE__ */ $("path", { | ||
}, Wt = /* @__PURE__ */ T("path", { | ||
"fill-rule": "evenodd", | ||
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", | ||
"clip-rule": "evenodd" | ||
}, null, -1), Fe = [ | ||
Ve | ||
}, null, -1), Xt = [ | ||
Wt | ||
]; | ||
function Ue(s, t) { | ||
return l(), h("svg", Le, Fe); | ||
function Gt(r, t) { | ||
return d(), f("svg", Kt, Xt); | ||
} | ||
const je = /* @__PURE__ */ H(He, [["render", Ue]]), Ke = {}, We = { | ||
const qt = /* @__PURE__ */ H(Ft, [["render", Gt]]), Jt = {}, Qt = { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -182,13 +188,13 @@ viewBox: "0 0 20 20", | ||
width: "20" | ||
}, Ye = /* @__PURE__ */ $("path", { | ||
}, Zt = /* @__PURE__ */ T("path", { | ||
"fill-rule": "evenodd", | ||
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", | ||
"clip-rule": "evenodd" | ||
}, null, -1), Ge = [ | ||
Ye | ||
}, null, -1), te = [ | ||
Zt | ||
]; | ||
function Je(s, t) { | ||
return l(), h("svg", We, Ge); | ||
function ee(r, t) { | ||
return d(), f("svg", Qt, te); | ||
} | ||
const Qe = /* @__PURE__ */ H(Ke, [["render", Je]]), Xe = {}, Ze = { | ||
const ae = /* @__PURE__ */ H(Jt, [["render", ee]]), oe = {}, se = { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -203,3 +209,3 @@ width: "12", | ||
"stroke-linejoin": "round" | ||
}, et = /* @__PURE__ */ $("line", { | ||
}, ne = /* @__PURE__ */ T("line", { | ||
x1: "18", | ||
@@ -209,3 +215,3 @@ y1: "6", | ||
y2: "18" | ||
}, null, -1), tt = /* @__PURE__ */ $("line", { | ||
}, null, -1), re = /* @__PURE__ */ T("line", { | ||
x1: "6", | ||
@@ -215,86 +221,47 @@ y1: "6", | ||
y2: "18" | ||
}, null, -1), st = [ | ||
et, | ||
tt | ||
}, null, -1), ie = [ | ||
ne, | ||
re | ||
]; | ||
function ot(s, t) { | ||
return l(), h("svg", Ze, st); | ||
function le(r, t) { | ||
return d(), f("svg", se, ie); | ||
} | ||
const it = /* @__PURE__ */ H(Xe, [["render", ot]]), nt = ["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"], at = ["data-disabled"], rt = { | ||
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 = { | ||
key: 1, | ||
"data-icon": "" | ||
}, lt = { "data-content": "" }, ut = { "data-title": "" }, ct = 4e3, dt = 14, vt = 20, ft = 200, ht = /* @__PURE__ */ ee({ | ||
}, pe = { "data-content": "" }, me = { "data-title": "" }, he = 4e3, ge = 14, ve = 20, be = 200, ye = /* @__PURE__ */ et({ | ||
__name: "Toast", | ||
props: { | ||
toast: { | ||
type: Object, | ||
required: !0 | ||
}, | ||
toasts: { | ||
type: Array, | ||
required: !0 | ||
}, | ||
index: { | ||
type: Number, | ||
required: !0 | ||
}, | ||
expanded: { | ||
type: Boolean, | ||
required: !0 | ||
}, | ||
invert: { | ||
type: Boolean, | ||
required: !0 | ||
}, | ||
heights: { | ||
type: Array, | ||
required: !0 | ||
}, | ||
position: { | ||
type: String, | ||
required: !0 | ||
}, | ||
visibleToasts: { | ||
type: Number, | ||
required: !0 | ||
}, | ||
expandByDefault: { | ||
type: Boolean, | ||
required: !0 | ||
}, | ||
closeButton: { | ||
type: Boolean, | ||
required: !0 | ||
}, | ||
interacting: { | ||
type: Boolean, | ||
required: !0 | ||
}, | ||
duration: { | ||
type: Number, | ||
required: !1 | ||
}, | ||
descriptionClass: { | ||
type: String, | ||
required: !1 | ||
} | ||
toast: {}, | ||
toasts: {}, | ||
index: {}, | ||
expanded: { type: Boolean }, | ||
invert: { type: Boolean }, | ||
heights: {}, | ||
position: {}, | ||
visibleToasts: {}, | ||
expandByDefault: { type: Boolean }, | ||
closeButton: { type: Boolean }, | ||
interacting: { type: Boolean }, | ||
duration: {}, | ||
descriptionClass: {} | ||
}, | ||
emits: ["update:heights", "removeToast"], | ||
setup(s, { emit: t }) { | ||
const e = s, i = (a) => !!a.promise, u = c(!1), m = c(!1), d = c(!1), p = c(!1), v = c(null), B = c(0), L = c(0), V = c(null), x = c(null), o = w(() => e.index === 0), n = w(() => e.index + 1 <= e.visibleToasts), f = w(() => e.toast.type), b = w(() => e.toast.dismissible), S = e.toast.className || "", _ = e.toast.descriptionClassName || "", E = e.toast.style || {}, P = w( | ||
() => e.heights.findIndex((a) => a.toastId === e.toast.id) || 0 | ||
), F = w( | ||
() => e.toast.duration || e.duration || ct | ||
), A = c(0), D = c(0), W = c(F.value), te = c(0), U = c(null), Y = w(() => e.position.split("-")), le = w(() => e.heights.reduce((a, r, g) => g >= P.value ? a : a + r.height, 0)), ue = w(() => e.toast.invert || e.invert), G = w(() => v.value === "loading"), j = w( | ||
() => v.value ?? (e.toast.type || null) | ||
), J = w(() => !i(e.toast) && typeof e.toast.title == "object"), ce = w(() => { | ||
if (!i(e.toast)) | ||
setup(r, { emit: t }) { | ||
const e = (o) => !!o.promise, n = t, a = r, p = c(!1), u = c(!1), h = c(!1), x = c(!1), w = c(null), z = c(0), L = c(0), U = c(null), s = c(null), i = v(() => a.index === 0), b = v(() => a.index + 1 <= a.visibleToasts), y = v(() => a.toast.type), N = v(() => a.toast.dismissible), B = a.toast.className || "", E = a.toast.descriptionClassName || "", V = a.toast.style || {}, P = v( | ||
() => a.heights.findIndex((o) => o.toastId === a.toast.id) || 0 | ||
), K = v( | ||
() => a.toast.duration || a.duration || he | ||
), W = c(0), A = c(0), X = c(K.value), at = c(0), M = c(null), G = v(() => a.position.split("-")), ct = v(() => G.value[0]), ut = v(() => G.value[1]), ft = v(() => a.heights.reduce((o, l, m) => m >= P.value ? o : o + l.height, 0)), pt = v(() => a.toast.invert || a.invert), q = v(() => w.value === "loading"), j = v( | ||
() => w.value ?? (a.toast.type || null) | ||
), J = v(() => !e(a.toast) && typeof a.toast.title == "object"), mt = v(() => { | ||
if (!e(a.toast)) | ||
return null; | ||
switch (v.value) { | ||
switch (w.value) { | ||
case "loading": | ||
return e.toast.loading; | ||
return a.toast.loading; | ||
case "success": | ||
return typeof e.toast.success == "function" ? V.value : e.toast.success; | ||
return typeof a.toast.success == "function" ? U.value : a.toast.success; | ||
case "error": | ||
return typeof e.toast.error == "function" ? V.value : e.toast.error; | ||
return typeof a.toast.error == "function" ? U.value : a.toast.error; | ||
default: | ||
@@ -304,80 +271,77 @@ return null; | ||
}); | ||
Q(() => u.value = !0), q(() => { | ||
D.value = P.value * dt + le.value; | ||
Q(() => p.value = !0), R(() => { | ||
A.value = P.value * ge + ft.value; | ||
}); | ||
function de() { | ||
var a, r; | ||
(!G.value || b.value) && (I(), (r = (a = e.toast).onDismiss) == null || r.call(a, e.toast)); | ||
function ht() { | ||
var o, l; | ||
(!q.value || N.value) && (S(), (l = (o = a.toast).onDismiss) == null || l.call(o, a.toast)); | ||
} | ||
function I() { | ||
m.value = !0, B.value = D.value; | ||
const a = e.heights.filter( | ||
(r) => r.toastId !== e.toast.id | ||
function S() { | ||
u.value = !0, z.value = A.value; | ||
const o = a.heights.filter( | ||
(l) => l.toastId !== a.toast.id | ||
); | ||
t("update:heights", a), setTimeout(() => { | ||
t("removeToast", e.toast); | ||
}, ft); | ||
n("update:heights", o), setTimeout(() => { | ||
n("removeToast", a.toast); | ||
}, be); | ||
} | ||
const ve = (a) => { | ||
G || (B.value = D.value, a.target.setPointerCapture(a.pointerId), a.target.tagName !== "BUTTON" && (d.value = !0, U.value = a.clientY)); | ||
}, fe = (a) => { | ||
var g, N, k, R; | ||
if (p.value) | ||
const gt = (o) => { | ||
q || (z.value = A.value, o.target.setPointerCapture(o.pointerId), o.target.tagName !== "BUTTON" && (h.value = !0, M.value = { x: o.clientX, y: o.clientY })); | ||
}, vt = (o) => { | ||
var m, D, _, $; | ||
if (x.value) | ||
return; | ||
const r = Number( | ||
((g = x.value) == null ? void 0 : g.style.getPropertyValue("--swipe-amount").replace("px", "")) || 0 | ||
M.value = null; | ||
const l = Number( | ||
((m = s.value) == null ? void 0 : m.style.getPropertyValue("--swipe-amount").replace("px", "")) || 0 | ||
); | ||
if (Math.abs(r) >= vt) { | ||
B.value = D.value, (k = (N = e.toast).onDismiss) == null || k.call(N, e.toast), I(), p.value = !0; | ||
if (Math.abs(l) >= ve) { | ||
z.value = A.value, (_ = (D = a.toast).onDismiss) == null || _.call(D, a.toast), S(), x.value = !0; | ||
return; | ||
} | ||
(R = x.value) == null || R.style.setProperty("--swipe-amount", "0px"), U.value = null, d.value = !0; | ||
}, he = (a) => { | ||
var N, k; | ||
if (!U.value) | ||
($ = s.value) == null || $.style.setProperty("--swipe-amount", "0px"), h.value = !0; | ||
}, bt = (o) => { | ||
var ot; | ||
if (!M.value) | ||
return; | ||
const r = a.clientY - U.value; | ||
if (!(Y.value[0] === "top" ? r < 0 : r > 0)) { | ||
(N = x.value) == null || N.style.setProperty("--swipe-amount", "0px"); | ||
return; | ||
} | ||
(k = x.value) == null || k.style.setProperty("--swipe-amount", `${r}px`); | ||
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; | ||
Math.abs(_) > $ ? (ot = s.value) == null || ot.style.setProperty("--swipe-amount", `${l}px`) : Math.abs(m) > $ && (M.value = null); | ||
}; | ||
return q((a) => { | ||
if (e.toast.promise && v.value === "loading" || e.toast.duration === 1 / 0) | ||
return R((o) => { | ||
if (a.toast.promise && w.value === "loading" || a.toast.duration === 1 / 0) | ||
return; | ||
let r; | ||
const g = () => { | ||
if (te.value < A.value) { | ||
const k = (/* @__PURE__ */ new Date()).getTime() - A.value; | ||
W.value = W.value - k; | ||
let l; | ||
const m = () => { | ||
if (at.value < W.value) { | ||
const _ = (/* @__PURE__ */ new Date()).getTime() - W.value; | ||
X.value = X.value - _; | ||
} | ||
te.value = (/* @__PURE__ */ new Date()).getTime(); | ||
}, N = () => { | ||
A.value = (/* @__PURE__ */ new Date()).getTime(), r = setTimeout(() => { | ||
var k, R; | ||
(R = (k = e.toast).onAutoClose) == null || R.call(k, e.toast), I(); | ||
}, W.value); | ||
at.value = (/* @__PURE__ */ new Date()).getTime(); | ||
}, D = () => { | ||
W.value = (/* @__PURE__ */ new Date()).getTime(), l = setTimeout(() => { | ||
var _, $; | ||
($ = (_ = a.toast).onAutoClose) == null || $.call(_, a.toast), S(); | ||
}, X.value); | ||
}; | ||
e.expanded || e.interacting ? g() : N(), a(() => { | ||
clearTimeout(r); | ||
a.expanded || a.interacting ? m() : D(), o(() => { | ||
clearTimeout(l); | ||
}); | ||
}), Q(() => { | ||
if (x.value) { | ||
const a = x.value.getBoundingClientRect().height; | ||
L.value = a; | ||
const r = [{ toastId: e.toast.id, height: a }, ...e.heights]; | ||
t("update:heights", r); | ||
if (s.value) { | ||
const o = s.value.getBoundingClientRect().height; | ||
L.value = o; | ||
const l = [{ toastId: a.toast.id, height: o }, ...a.heights]; | ||
n("update:heights", l); | ||
} | ||
}), re(() => { | ||
if (x.value) { | ||
const a = e.heights.filter( | ||
(r) => r.toastId !== e.toast.id | ||
}), dt(() => { | ||
if (s.value) { | ||
const o = a.heights.filter( | ||
(l) => l.toastId !== a.toast.id | ||
); | ||
t("update:heights", a); | ||
n("update:heights", o); | ||
} | ||
}), q(() => { | ||
e.toast.delete && I(); | ||
}), (a, r) => (l(), h("li", { | ||
"aria-live": s.toast.important ? "assertive" : "polite", | ||
}), R(() => { | ||
a.toast.delete && S(); | ||
}), (o, l) => (d(), f("li", { | ||
"aria-live": o.toast.important ? "assertive" : "polite", | ||
"aria-atomic": "", | ||
@@ -387,88 +351,87 @@ role: "status", | ||
ref_key: "toastRef", | ||
ref: x, | ||
ref: s, | ||
"data-sonner-toast": "", | ||
class: se(M(S)), | ||
class: st(O(B)), | ||
"data-styled": !J.value, | ||
"data-mounted": u.value, | ||
"data-promise": !!s.toast.promise, | ||
"data-removed": m.value, | ||
"data-visible": n.value, | ||
"data-y-position": Y.value[0], | ||
"data-x-position": Y.value[1], | ||
"data-index": e.index, | ||
"data-front": o.value, | ||
"data-swiping": d.value, | ||
"data-type": v.value !== "loading" && v.value ? v.value : f.value, | ||
"data-invert": ue.value, | ||
"data-swipe-out": p.value, | ||
"data-expanded": !!(e.expanded || e.expandByDefault && u.value), | ||
style: X({ | ||
"--index": e.index, | ||
"--toasts-before": e.index, | ||
"--z-index": s.toasts.length - e.index, | ||
"--offset": `${m.value ? B.value : D.value}px`, | ||
"--initial-height": e.expandByDefault ? "auto" : `${L.value}px`, | ||
...M(E) | ||
"data-mounted": p.value, | ||
"data-promise": !!o.toast.promise, | ||
"data-removed": u.value, | ||
"data-visible": b.value, | ||
"data-y-position": ct.value, | ||
"data-x-position": ut.value, | ||
"data-index": a.index, | ||
"data-front": i.value, | ||
"data-swiping": h.value, | ||
"data-type": w.value !== "loading" && w.value ? w.value : y.value, | ||
"data-invert": pt.value, | ||
"data-swipe-out": x.value, | ||
"data-expanded": !!(a.expanded || a.expandByDefault && p.value), | ||
style: Z({ | ||
"--index": a.index, | ||
"--toasts-before": a.index, | ||
"--z-index": o.toasts.length - a.index, | ||
"--offset": `${u.value ? z.value : A.value}px`, | ||
"--initial-height": a.expandByDefault ? "auto" : `${L.value}px`, | ||
...O(V) | ||
}), | ||
onPointerdown: ve, | ||
onPointerup: fe, | ||
onPointermove: he | ||
onPointerdown: gt, | ||
onPointerup: vt, | ||
onPointermove: bt | ||
}, [ | ||
e.closeButton && !J.value ? (l(), h("button", { | ||
a.closeButton && !J.value ? (d(), f("button", { | ||
key: 0, | ||
"aria-label": "Close toast", | ||
"data-close-button": "", | ||
"data-disabled": G.value, | ||
onClick: de | ||
"data-disabled": q.value, | ||
onClick: ht | ||
}, [ | ||
ge(it) | ||
], 8, at)) : C("", !0), | ||
f.value || s.toast.icon || s.toast.promise ? (l(), h("div", rt, [ | ||
typeof s.toast.promise == "function" || f.value === "loading" ? (l(), O(_e, { | ||
kt(de) | ||
], 8, ue)) : C("", !0), | ||
y.value || o.toast.icon || o.toast.promise ? (d(), f("div", fe, [ | ||
typeof o.toast.promise == "function" || y.value === "loading" ? (d(), I(Nt, { | ||
key: 0, | ||
visible: v.value === "loading" || f.value === "loading" | ||
visible: w.value === "loading" || y.value === "loading" | ||
}, null, 8, ["visible"])) : C("", !0), | ||
j.value === "success" ? (l(), O(Me, { key: 1 })) : j.value === "info" ? (l(), O(qe, { key: 2 })) : j.value === "warning" ? (l(), O(je, { key: 3 })) : j.value === "error" ? (l(), O(Qe, { key: 4 })) : C("", !0) | ||
j.value === "success" ? (d(), I(Yt, { key: 1 })) : j.value === "info" ? (d(), I(jt, { key: 2 })) : j.value === "warning" ? (d(), I(qt, { key: 3 })) : j.value === "error" ? (d(), I(ae, { key: 4 })) : C("", !0) | ||
])) : C("", !0), | ||
$("div", lt, [ | ||
$("div", ut, [ | ||
typeof s.toast.title == "string" ? (l(), h(K, { key: 0 }, [ | ||
oe(z(s.toast.title), 1) | ||
], 64)) : s.toast.title === void 0 || s.toast.title === null ? (l(), h(K, { key: 1 }, [ | ||
oe(z(ce.value), 1) | ||
], 64)) : J.value ? (l(), O(ye(s.toast.title), { | ||
T("div", pe, [ | ||
T("div", me, [ | ||
typeof o.toast.title == "string" ? (d(), f(F, { key: 0 }, [ | ||
nt(Y(o.toast.title), 1) | ||
], 64)) : o.toast.title === void 0 || o.toast.title === null ? (d(), f(F, { key: 1 }, [ | ||
nt(Y(mt.value), 1) | ||
], 64)) : J.value ? (d(), I(Tt(o.toast.title), { | ||
key: 2, | ||
onCloseToast: r[0] || (r[0] = () => { | ||
var g; | ||
I(), (g = s.toast.cancel) != null && g.onClick && s.toast.cancel.onClick(); | ||
onCloseToast: l[0] || (l[0] = () => { | ||
var m; | ||
S(), (m = o.toast.cancel) != null && m.onClick && o.toast.cancel.onClick(); | ||
}) | ||
}, null, 32)) : C("", !0) | ||
]), | ||
s.toast.description ? (l(), h("div", { | ||
o.toast.description ? (d(), f("div", { | ||
key: 0, | ||
"data-description": "", | ||
class: se(s.descriptionClass + M(_)) | ||
}, z(s.toast.description), 3)) : C("", !0) | ||
class: st(o.descriptionClass + O(E)) | ||
}, Y(o.toast.description), 3)) : C("", !0) | ||
]), | ||
s.toast.cancel ? (l(), h("button", { | ||
o.toast.cancel ? (d(), f("button", { | ||
key: 2, | ||
"data-button": "", | ||
"data-cancel": "", | ||
onClick: r[1] || (r[1] = () => { | ||
var g; | ||
I(), (g = s.toast.cancel) != null && g.onClick && s.toast.cancel.onClick(); | ||
onClick: l[1] || (l[1] = () => { | ||
var m; | ||
S(), (m = o.toast.cancel) != null && m.onClick && o.toast.cancel.onClick(); | ||
}) | ||
}, z(s.toast.cancel.label), 1)) : C("", !0), | ||
s.toast.action ? (l(), h("button", { | ||
}, Y(o.toast.cancel.label), 1)) : C("", !0), | ||
o.toast.action ? (d(), f("button", { | ||
key: 3, | ||
"data-button": "", | ||
onClick: r[2] || (r[2] = () => { | ||
var g; | ||
I(), (g = s.toast.action) == null || g.onClick(); | ||
onClick: l[2] || (l[2] = () => { | ||
var m; | ||
S(), (m = o.toast.action) == null || m.onClick(); | ||
}) | ||
}, z(s.toast.action.label), 1)) : C("", !0) | ||
], 46, nt)); | ||
}, Y(o.toast.action.label), 1)) : C("", !0) | ||
], 46, ce)); | ||
} | ||
}); | ||
const mt = ["aria-label"], pt = ["dir", "data-theme", "data-rich-colors", "data-y-position", "data-x-position"], gt = 3, ie = "32px", yt = 4e3, wt = 356, ne = 14, bt = /* @__PURE__ */ ee({ | ||
}), 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__ */ et({ | ||
name: "Toaster", | ||
@@ -484,5 +447,5 @@ inheritAttrs: !1, | ||
expand: { type: Boolean, default: !1 }, | ||
duration: { default: yt }, | ||
gap: { default: ne }, | ||
visibleToasts: { default: gt }, | ||
duration: { default: Te }, | ||
gap: { default: it }, | ||
visibleToasts: { default: ke }, | ||
closeButton: { type: Boolean, default: !1 }, | ||
@@ -492,127 +455,128 @@ toastOptions: { default: () => ({}) }, | ||
style: { default: () => ({}) }, | ||
offset: { default: ie }, | ||
offset: { default: rt }, | ||
dir: { default: "auto" } | ||
}, | ||
setup(s) { | ||
const t = s, e = we(), i = c([]), u = c([]), m = c(!1), d = c(!1), p = c( | ||
setup(r) { | ||
const t = r, e = _t(), n = c([]), a = c([]), p = c(!1), u = c(!1), h = c( | ||
t.theme !== "system" ? t.theme : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" | ||
), v = w(() => t.position.split("-")), B = c(null), L = t.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, ""); | ||
function V(o) { | ||
i.value = i.value.filter(({ id: n }) => n !== o.id); | ||
), x = v(() => t.position.split("-")), w = c(null), z = t.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, ""); | ||
function L(s) { | ||
n.value = n.value.filter(({ id: i }) => i !== s.id); | ||
} | ||
function x() { | ||
function U() { | ||
if (typeof window > "u") | ||
return "ltr"; | ||
const o = document.documentElement.getAttribute("dir"); | ||
return o === "auto" || !o ? window.getComputedStyle(document.documentElement).direction : o; | ||
const s = document.documentElement.getAttribute("dir"); | ||
return s === "auto" || !s ? window.getComputedStyle(document.documentElement).direction : s; | ||
} | ||
return Q(() => { | ||
const o = T.subscribe((n) => { | ||
if (n.dismiss) { | ||
i.value = i.value.map( | ||
(f) => f.id === n.id ? { ...f, delete: !0 } : f | ||
const s = k.subscribe((i) => { | ||
if (i.dismiss) { | ||
n.value = n.value.map( | ||
(b) => b.id === i.id ? { ...b, delete: !0 } : b | ||
); | ||
return; | ||
} | ||
be(() => { | ||
const f = i.value.findIndex((b) => b.id === n.id); | ||
f !== -1 ? i.value.splice(f, 1, n) : i.value = [n, ...i.value]; | ||
$t(() => { | ||
const b = n.value.findIndex((y) => y.id === i.id); | ||
b !== -1 ? n.value.splice(b, 1, i) : n.value = [i, ...n.value]; | ||
}); | ||
}); | ||
re(() => { | ||
o(); | ||
dt(() => { | ||
s(); | ||
}); | ||
}), Te( | ||
}), Ct( | ||
() => t.theme, | ||
(o) => { | ||
if (o !== "system") { | ||
p.value = o; | ||
(s) => { | ||
if (s !== "system") { | ||
h.value = s; | ||
return; | ||
} | ||
o === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? p.value = "dark" : p.value = "light"), !(typeof window > "u") && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({ matches: n }) => { | ||
n ? p.value = "dark" : p.value = "light"; | ||
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 }) => { | ||
i ? h.value = "dark" : h.value = "light"; | ||
}); | ||
} | ||
), q(() => { | ||
i.value.length <= 1 && (m.value = !1); | ||
}), q((o) => { | ||
function n(f) { | ||
var S, _; | ||
), R(() => { | ||
n.value.length <= 1 && (p.value = !1); | ||
}), R((s) => { | ||
function i(b) { | ||
var N, B; | ||
t.hotkey.every( | ||
(E) => f[E] || f.code === E | ||
) && (m.value = !0, (S = B.value) == null || S.focus()), f.code === "Escape" && (document.activeElement === B.value || (_ = B.value) != null && _.contains(document.activeElement)) && (m.value = !1); | ||
(E) => b[E] || b.code === E | ||
) && (p.value = !0, (N = w.value) == null || N.focus()), b.code === "Escape" && (document.activeElement === w.value || (B = w.value) != null && B.contains(document.activeElement)) && (p.value = !1); | ||
} | ||
document.addEventListener("keydown", n), o(() => { | ||
document.removeEventListener("keydown", n); | ||
}); | ||
}), (o, n) => { | ||
var f; | ||
return l(), h("section", { | ||
"aria-label": `Notifications ${M(L)}`, | ||
$e && (document.addEventListener("keydown", i), s(() => { | ||
document.removeEventListener("keydown", i); | ||
})); | ||
}), (s, i) => { | ||
var b; | ||
return d(), f("section", { | ||
"aria-label": `Notifications ${O(z)}`, | ||
tabIndex: -1 | ||
}, [ | ||
$("ol", { | ||
T("ol", { | ||
ref_key: "listRef", | ||
ref: B, | ||
ref: w, | ||
"data-sonner-toaster": "", | ||
dir: o.dir === "auto" ? x() : o.dir, | ||
dir: s.dir === "auto" ? U() : s.dir, | ||
tabIndex: -1, | ||
"data-theme": o.theme, | ||
"data-rich-colors": o.richColors, | ||
"data-y-position": v.value[0], | ||
"data-x-position": v.value[1], | ||
style: X( | ||
"data-theme": s.theme, | ||
"data-rich-colors": s.richColors, | ||
"data-y-position": x.value[0], | ||
"data-x-position": x.value[1], | ||
style: Z( | ||
{ | ||
"--front-toast-height": `${(f = u.value[0]) == null ? void 0 : f.height}px`, | ||
"--offset": typeof o.offset == "number" ? `${o.offset}px` : o.offset || ie, | ||
"--width": `${wt}px`, | ||
"--gap": `${ne}px`, | ||
...M(e).style | ||
"--front-toast-height": `${(b = a.value[0]) == null ? void 0 : b.height}px`, | ||
"--offset": typeof s.offset == "number" ? `${s.offset}px` : s.offset || rt, | ||
"--width": `${_e}px`, | ||
"--gap": `${it}px`, | ||
...O(e).style | ||
} | ||
), | ||
onMouseenter: n[1] || (n[1] = (b) => m.value = !0), | ||
onMousemove: n[2] || (n[2] = (b) => m.value = !0), | ||
onMouseleave: n[3] || (n[3] = () => { | ||
d.value || (m.value = !1); | ||
onMouseenter: i[1] || (i[1] = (y) => p.value = !0), | ||
onMousemove: i[2] || (i[2] = (y) => p.value = !0), | ||
onMouseleave: i[3] || (i[3] = () => { | ||
u.value || (p.value = !1); | ||
}), | ||
onPointerdown: n[4] || (n[4] = (b) => d.value = !1), | ||
onPointerup: n[5] || (n[5] = (b) => d.value = !1) | ||
onPointerdown: i[4] || (i[4] = (y) => u.value = !1), | ||
onPointerup: i[5] || (i[5] = (y) => u.value = !1) | ||
}, [ | ||
(l(!0), h(K, null, ae(i.value, (b, S) => { | ||
var _, E, P, F; | ||
return l(), O(ht, { | ||
key: b.id, | ||
index: S, | ||
toast: b, | ||
duration: ((_ = o.toastOptions) == null ? void 0 : _.duration) ?? o.duration, | ||
className: (E = o.toastOptions) == null ? void 0 : E.className, | ||
descriptionClassName: (P = o.toastOptions) == null ? void 0 : P.descriptionClassName, | ||
invert: o.invert, | ||
visibleToasts: o.visibleToasts, | ||
closeButton: o.closeButton, | ||
interacting: d.value, | ||
position: o.position, | ||
style: X((F = o.toastOptions) == null ? void 0 : F.style), | ||
toasts: i.value, | ||
expandByDefault: o.expand, | ||
gap: o.gap, | ||
expanded: m.value, | ||
heights: u.value, | ||
"onUpdate:heights": n[0] || (n[0] = (A) => u.value = A), | ||
onRemoveToast: V | ||
(d(!0), f(F, null, lt(n.value, (y, N) => { | ||
var B, E, V, P; | ||
return d(), I(ye, { | ||
key: y.id, | ||
index: N, | ||
toast: y, | ||
duration: ((B = s.toastOptions) == null ? void 0 : B.duration) ?? s.duration, | ||
className: (E = s.toastOptions) == null ? void 0 : E.className, | ||
descriptionClassName: (V = s.toastOptions) == null ? void 0 : V.descriptionClassName, | ||
invert: s.invert, | ||
visibleToasts: s.visibleToasts, | ||
closeButton: s.closeButton, | ||
interacting: u.value, | ||
position: s.position, | ||
style: Z((P = s.toastOptions) == null ? void 0 : P.style), | ||
toasts: n.value, | ||
expandByDefault: s.expand, | ||
gap: s.gap, | ||
expanded: p.value, | ||
heights: a.value, | ||
"onUpdate:heights": i[0] || (i[0] = (K) => a.value = K), | ||
onRemoveToast: L | ||
}, null, 8, ["index", "toast", "duration", "className", "descriptionClassName", "invert", "visibleToasts", "closeButton", "interacting", "position", "style", "toasts", "expandByDefault", "gap", "expanded", "heights"]); | ||
}), 128)) | ||
], 44, pt) | ||
], 8, mt); | ||
], 44, we) | ||
], 8, xe); | ||
}; | ||
} | ||
}), Bt = { | ||
install(s) { | ||
s.component("Toaster", bt); | ||
}), ze = { | ||
install(r) { | ||
r.component("Toaster", Ce); | ||
} | ||
}; | ||
export { | ||
bt as Toaster, | ||
Bt as default, | ||
$t as toast | ||
Ce as Toaster, | ||
ze as default, | ||
Ie as toast | ||
}; | ||
//# sourceMappingURL=vue-sonner.js.map |
{ | ||
"name": "vue-sonner", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"type": "module", | ||
@@ -9,3 +9,3 @@ "author": "xiaoluoboding <xiaoluoboding@gmail.com>", | ||
"build:docs": "vite build --mode docs", | ||
"build:lib": "vue-tsc --noEmit && vite build --mode lib", | ||
"build:lib": "vite build --mode lib && vue-tsc -p tsconfig.build.json", | ||
"preview": "vite preview", | ||
@@ -23,3 +23,3 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0" | ||
], | ||
"main": "./lib/vue-sonner.umd.cjs", | ||
"main": "./lib/vue-sonner.cjs", | ||
"module": "./lib/vue-sonner.js", | ||
@@ -30,3 +30,3 @@ "exports": { | ||
"import": "./lib/vue-sonner.js", | ||
"require": "./lib/vue-sonner.umd.cjs" | ||
"require": "./lib/vue-sonner.cjs" | ||
} | ||
@@ -40,19 +40,19 @@ }, | ||
"devDependencies": { | ||
"@iconify/json": "^2.1.104", | ||
"@types/node": "^18.7.14", | ||
"@unocss/reset": "^0.45.18", | ||
"@vitejs/plugin-vue": "^3.0.3", | ||
"@vueuse/core": "^9.1.1", | ||
"@vueuse/head": "^1.1.23", | ||
"highlight.js": "^11.6.0", | ||
"typescript": "^4.6.4", | ||
"unocss": "^0.45.13", | ||
"unplugin-icons": "^0.14.9", | ||
"unplugin-vue-components": "^0.22.4", | ||
"vite": "^4.4.6", | ||
"vite-plugin-dts": "^3.3.1", | ||
"vite-plugin-lib-inject-css": "^1.0.1", | ||
"vue": "^3.3.4", | ||
"vue-tsc": "^1.8.6" | ||
"@iconify/json": "^2.2.172", | ||
"@types/node": "^18.19.8", | ||
"@unocss/reset": "^0.58.3", | ||
"@vitejs/plugin-vue": "^5.0.3", | ||
"@vue/tsconfig": "^0.5.1", | ||
"@vueuse/core": "^10.7.2", | ||
"@vueuse/head": "^2.0.0", | ||
"clean-css": "^5.3.3", | ||
"highlight.js": "^11.9.0", | ||
"typescript": "^5.3.3", | ||
"unocss": "^0.58.3", | ||
"unplugin-icons": "^0.18.2", | ||
"unplugin-vue-components": "^0.26.0", | ||
"vite": "^5.0.12", | ||
"vue": "^3.4.15", | ||
"vue-tsc": "^1.8.27" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
24
249741
1000
2
1