vue-sileo 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/vue-sileo.cjs +1 -0
- package/dist/vue-sileo.css +2 -0
- package/dist/vue-sileo.mjs +657 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sileo-vue contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>vue-sileo</h1>
|
|
3
|
+
<p>Physics-based toast notifications for Vue 3</p>
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://www.npmjs.com/package/vue-sileo">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/vue-sileo" alt="npm" />
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
A Vue 3 port of [sileo](https://github.com/hiaaryan/sileo) by [@hiaaryan](https://github.com/hiaaryan). All credit for the design and animations goes to the original library.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install vue-sileo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { Toaster, sileo } from "vue-sileo";
|
|
24
|
+
import "vue-sileo/styles.css";
|
|
25
|
+
|
|
26
|
+
function notify() {
|
|
27
|
+
sileo.success({
|
|
28
|
+
title: "Success",
|
|
29
|
+
description: "Your changes have been saved.",
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<Toaster position="top-right" />
|
|
36
|
+
<button @click="notify">Save</button>
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
### Toast Types
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
sileo.success({ title: "Success", description: "Operation completed" });
|
|
46
|
+
sileo.error({ title: "Error", description: "Something went wrong" });
|
|
47
|
+
sileo.warning({ title: "Warning", description: "Please confirm" });
|
|
48
|
+
sileo.info({ title: "Info", description: "New version available" });
|
|
49
|
+
sileo.action({
|
|
50
|
+
title: "Update",
|
|
51
|
+
description: "Click to install",
|
|
52
|
+
button: { title: "Install", onClick: () => {} }
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Promise Handling
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
sileo.promise(
|
|
60
|
+
fetchData(),
|
|
61
|
+
{
|
|
62
|
+
loading: { title: "Loading..." },
|
|
63
|
+
success: (data) => ({ title: "Done", description: data }),
|
|
64
|
+
error: (err) => ({ title: "Failed", description: err.message }),
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Configuration
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<Toaster
|
|
73
|
+
position="top-right"
|
|
74
|
+
:offset="16"
|
|
75
|
+
:options="{ duration: 5000, roundness: 18 }"
|
|
76
|
+
/>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Positions**: `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right`
|
|
80
|
+
|
|
81
|
+
### Options
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
{
|
|
85
|
+
title?: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
position?: SileoPosition;
|
|
88
|
+
duration?: number | null; // milliseconds, null = infinite
|
|
89
|
+
fill?: string; // background color
|
|
90
|
+
roundness?: number; // border radius
|
|
91
|
+
autopilot?: boolean; // auto expand/collapse
|
|
92
|
+
button?: { title: string; onClick: () => void };
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Credits
|
|
97
|
+
|
|
98
|
+
This is a Vue 3 port of [sileo](https://github.com/hiaaryan/sileo) by [@hiaaryan](https://github.com/hiaaryan). Check out the [original library](https://sileo.aaryan.design) and [documentation](https://sileo.aaryan.design/docs).
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`);var t=6e3;t*.1;var n=t*.025,r=t-2e3;const i=e=>e.includes(`right`)?`right`:e.includes(`center`)?`center`:`left`,a=e=>e.startsWith(`top`)?`bottom`:`top`,o={toasts:[],listeners:new Set,position:`top-right`,options:void 0,emit(){for(let e of this.listeners)e(this.toasts)},update(e){this.toasts=e(this.toasts),this.emit()}};var s=0,c=()=>`${++s}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;const l=e=>`${e.id}:${e.instanceId}`;var u=e=>{let t=o.toasts.find(t=>t.id===e);!t||t.exiting||(o.update(t=>t.map(t=>t.id===e?{...t,exiting:!0}:t)),setTimeout(()=>o.update(t=>t.filter(t=>t.id!==e)),600))},d=(e,t)=>{if(e.autopilot===!1||!t||t<=0)return{};let i=typeof e.autopilot==`object`?e.autopilot:void 0,a=e=>Math.min(t,Math.max(0,e));return{expandDelayMs:a(i?.expand??n),collapseDelayMs:a(i?.collapse??r)}},f=e=>({...o.options,...e,styles:{...o.options?.styles,...e.styles}}),p=(e,t,n)=>{let r=d(e,e.duration??6e3);return{...e,id:t,instanceId:c(),position:e.position??n??o.position,autoExpandDelayMs:r.expandDelayMs,autoCollapseDelayMs:r.collapseDelayMs}},m=e=>{let t=o.toasts.filter(e=>!e.exiting),n=f(e),r=n.id??`sileo-default`,i=t.find(e=>e.id===r),a=p(n,r,i?.position);return i?o.update(e=>e.map(e=>e.id===r?a:e)):o.update(e=>[...e.filter(e=>e.id!==r),a]),{id:r,duration:n.duration??6e3}},h=(e,t)=>{let n=o.toasts.find(t=>t.id===e);if(!n)return;let r=p(f(t),e,n.position);o.update(t=>t.map(t=>t.id===e?r:t))};const g={show:e=>m(e).id,success:e=>m({...e,state:`success`}).id,error:e=>m({...e,state:`error`}).id,warning:e=>m({...e,state:`warning`}).id,info:e=>m({...e,state:`info`}).id,action:e=>m({...e,state:`action`}).id,promise:(e,t)=>{let{id:n}=m({...t.loading,state:`loading`,duration:null,position:t.position}),r=typeof e==`function`?e():e;return r.then(e=>{t.action?h(n,{...typeof t.action==`function`?t.action(e):t.action,state:`action`,id:n}):h(n,{...typeof t.success==`function`?t.success(e):t.success,state:`success`,id:n})}).catch(e=>{h(n,{...typeof t.error==`function`?t.error(e):t.error,state:`error`,id:n})}),r},dismiss:u,clear:e=>o.update(t=>e?t.filter(t=>t.position!==e):[])};var _={xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`};const v=()=>(0,e.h)(`svg`,_,[(0,e.h)(`title`,`Arrow Right`),(0,e.h)(`path`,{d:`M5 12h14`}),(0,e.h)(`path`,{d:`m12 5 7 7-7 7`})]),ee=()=>(0,e.h)(`svg`,_,[(0,e.h)(`title`,`Life Buoy`),(0,e.h)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,e.h)(`path`,{d:`m4.93 4.93 4.24 4.24`}),(0,e.h)(`path`,{d:`m14.83 9.17 4.24-4.24`}),(0,e.h)(`path`,{d:`m14.83 14.83 4.24 4.24`}),(0,e.h)(`path`,{d:`m9.17 14.83-4.24 4.24`}),(0,e.h)(`circle`,{cx:`12`,cy:`12`,r:`4`})]),y=()=>(0,e.h)(`svg`,{..._,"data-sileo-icon":`spin`,"aria-hidden":`true`},[(0,e.h)(`title`,`Loader Circle`),(0,e.h)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})]),b=()=>(0,e.h)(`svg`,_,[(0,e.h)(`title`,`X`),(0,e.h)(`path`,{d:`M18 6 6 18`}),(0,e.h)(`path`,{d:`m6 6 12 12`})]),x=()=>(0,e.h)(`svg`,_,[(0,e.h)(`title`,`Circle Alert`),(0,e.h)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,e.h)(`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}),(0,e.h)(`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`})]),te=()=>(0,e.h)(`svg`,_,[(0,e.h)(`title`,`Check`),(0,e.h)(`path`,{d:`M20 6 9 17l-5-5`})]);var ne=[`data-ready`,`data-expanded`,`data-exiting`,`data-edge`,`data-position`,`data-state`],re=[`data-edge`],ie=[`height`,`viewBox`],ae=[`id`],oe=[`stdDeviation`],se=[`filter`],ce=[`x`,`rx`,`ry`,`fill`],le=[`height`,`rx`,`ry`,`fill`],ue=[`data-edge`],de={"data-sileo-header-stack":``},fe=[`data-state`],pe=[`data-state`],me=[`data-state`],he=[`data-state`],ge=[`data-edge`,`data-visible`],_e=[`data-state`],S=40,C=350,ve=18,ye=.5,be=10,xe=2.25,Se=200,Ce=150,we=30,Te=20,w=(0,e.defineComponent)({__name:`Sileo`,props:{id:{},fill:{default:`var(--sileo-fill)`},state:{default:`success`},title:{},description:{},position:{default:`left`},expand:{default:`bottom`},icon:{},styles:{},button:{},roundness:{},exiting:{type:Boolean,default:!1},autoExpandDelayMs:{},autoCollapseDelayMs:{},canExpand:{type:Boolean},interruptKey:{},refreshKey:{}},emits:[`mouseenter`,`mouseleave`,`dismiss`],setup(t,{emit:n}){let r={success:(0,e.h)(te),loading:(0,e.h)(y),error:(0,e.h)(b),warning:(0,e.h)(x),info:(0,e.h)(ee),action:(0,e.h)(v)},i=t,a=n,o=(0,e.computed)(()=>i.title??i.state),s=(0,e.ref)({title:o.value,description:i.description,state:i.state,icon:i.icon,styles:i.styles,button:i.button,fill:i.fill}),c=(0,e.ref)(i.refreshKey),l=(0,e.ref)(!1),u=(0,e.ref)(!1),d=(0,e.ref)(0),f=(0,e.ref)(0),p=(0,e.computed)(()=>!!s.value.description||!!s.value.button),m=(0,e.computed)(()=>s.value.state===`loading`),h=(0,e.computed)(()=>p.value&&l.value&&!m.value),g=(0,e.computed)(()=>m.value?!1:i.canExpand??(!i.interruptKey||i.interruptKey===i.id)),_=(0,e.computed)(()=>`${s.value.state}-${s.value.title}`),w=(0,e.computed)(()=>`sileo-gooey-${i.id}`),T=(0,e.computed)(()=>Math.max(0,i.roundness??ve)),E=(0,e.computed)(()=>T.value*ye),D=(0,e.ref)(null),O=(0,e.ref)(null),k=(0,e.ref)(null),A=(0,e.ref)(null),j=null,M=null,N=null,P=null,F=null,I=i.refreshKey,L=null,R=(0,e.ref)({current:{key:_.value,view:s.value},prev:null}),z=(0,e.computed)(()=>({title:o.value,description:i.description,state:i.state,icon:i.icon,styles:i.styles,button:i.button,fill:i.fill})),B=S*xe,V=(0,e.computed)(()=>p.value?Math.max(B,S+f.value):B),H=V.value,U=(0,e.computed)(()=>h.value?(H=V.value,V.value):H),W=(0,e.computed)(()=>p.value?Math.max(U.value,B):S),Ee=(0,e.computed)(()=>Math.max(0,U.value-S)),G=(0,e.computed)(()=>Math.max(d.value||S,S)),De=(0,e.computed)(()=>S+E.value*3),Oe=(0,e.computed)(()=>i.position===`right`?C-G.value:i.position===`center`?(C-G.value)/2:0),ke=(0,e.computed)(()=>({"--_h":`${h.value?U.value:S}px`,"--_pw":`${G.value}px`,"--_px":`${Oe.value}px`,"--_sy":`${h.value?1:S/De.value}`,"--_ph":`${De.value}px`,"--_by":`${h.value?1:0}`,"--_ht":`translateY(${h.value?i.expand===`bottom`?3:-3:0}px) scale(${h.value?.9:1})`,"--_co":`${h.value?1:0}`})),K=null,q=0,J=null,Y=0;function Ae(){let e=k.value,t=O.value;if(!e||!t)return;if(F===null){let e=getComputedStyle(t);F=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)}let n=e.scrollWidth+F+be;n>be&&d.value!==n&&(d.value=n)}function je(){Me();let e=k.value;e&&(Ae(),K=new ResizeObserver(()=>{cancelAnimationFrame(q),q=requestAnimationFrame(Ae)}),K.observe(e))}function Me(){K&&=(cancelAnimationFrame(q),K.disconnect(),null)}function Ne(){if(!p.value){f.value=0;return}let e=A.value;if(!e)return;let t=e.scrollHeight;f.value!==t&&(f.value=t)}function X(){Z();let e=A.value;e&&(Ne(),J=new ResizeObserver(()=>{cancelAnimationFrame(Y),Y=requestAnimationFrame(Ne)}),J.observe(e))}function Z(){J&&=(cancelAnimationFrame(Y),J.disconnect(),null)}(0,e.watch)([_,s],()=>{let e=_.value,t=s.value;R.value.current.key===e?R.value.current.view!==t&&(R.value={...R.value,current:{key:e,view:t}}):R.value={prev:R.value.current,current:{key:e,view:t}}},{flush:`sync`}),(0,e.watch)(()=>R.value.current.key,()=>{(0,e.nextTick)(je)}),(0,e.watch)(()=>R.value.prev,e=>{e&&(j&&clearTimeout(j),j=window.setTimeout(()=>{j=null,R.value={...R.value,prev:null}},Ce))}),(0,e.watch)(p,t=>{t?(0,e.nextTick)(X):(f.value=0,Z())}),(0,e.watch)([()=>i.refreshKey,z],()=>{let e=i.refreshKey,t=z.value;if(e===void 0){s.value=t,c.value=void 0,L=null,I=e;return}I!==e&&(I=e,P&&=(clearTimeout(P),null),h.value?(L={key:e,payload:t},l.value=!1,P=window.setTimeout(()=>{P=null,L&&=(s.value=L.payload,c.value=L.key,null)},Se)):(L=null,s.value=t,c.value=e))},{deep:!1}),(0,e.watch)([()=>i.autoCollapseDelayMs,()=>i.autoExpandDelayMs,p,g,()=>i.exiting,c],()=>{if(!p.value)return;if(M&&clearTimeout(M),N&&clearTimeout(N),i.exiting||!g.value){l.value=!1;return}if(i.autoExpandDelayMs==null&&i.autoCollapseDelayMs==null)return;let e=i.autoExpandDelayMs??0,t=i.autoCollapseDelayMs??0;e>0?M=window.setTimeout(()=>l.value=!0,e):l.value=!0,t>0&&(N=window.setTimeout(()=>l.value=!1,t))},{immediate:!0}),(0,e.watch)(h,e=>{e&&(H=V.value)});function Pe(e){a(`mouseenter`,e),p.value&&(l.value=!0)}function Fe(e){a(`mouseleave`,e),l.value=!1}function Ie(e){e.propertyName!==`height`&&e.propertyName!==`transform`||h.value||(L&&=(P&&=(clearTimeout(P),null),s.value=L.payload,c.value=L.key,null))}let Q=null;function Le(e){i.exiting||e.target.closest(`[data-sileo-button]`)||(Q=e.clientY,e.currentTarget.setPointerCapture(e.pointerId))}function Re(e){if(Q===null)return;let t=e.clientY-Q,n=t>0?1:-1,r=Math.min(Math.abs(t),Te)*n,i=D.value;i&&(i.style.transform=`translateY(${r}px)`)}function ze(e){if(Q===null)return;let t=e.clientY-Q;Q=null;let n=D.value;n&&(n.style.transform=``),Math.abs(t)>we&&a(`dismiss`)}(0,e.onMounted)(()=>{requestAnimationFrame(()=>u.value=!0),(0,e.nextTick)(()=>{je(),p.value&&X()});let t=D.value;t&&(t.addEventListener(`pointermove`,Re,{passive:!0}),t.addEventListener(`pointerup`,ze,{passive:!0}))}),(0,e.onUnmounted)(()=>{Me(),Z(),j&&clearTimeout(j),M&&clearTimeout(M),N&&clearTimeout(N),P&&clearTimeout(P);let e=D.value;e&&(e.removeEventListener(`pointermove`,Re),e.removeEventListener(`pointerup`,ze))});function $(e){return e.icon===void 0?r[e.state]??null:e.icon}function Be(e){e.preventDefault(),e.stopPropagation(),s.value.button?.onClick()}return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{ref_key:`buttonRef`,ref:D,type:`button`,"data-sileo-toast":``,"data-ready":u.value,"data-expanded":h.value,"data-exiting":i.exiting,"data-edge":i.expand,"data-position":i.position,"data-state":s.value.state,style:(0,e.normalizeStyle)(ke.value),onMouseenter:Pe,onMouseleave:Fe,onTransitionend:Ie,onPointerdown:Le},[(0,e.createElementVNode)(`div`,{"data-sileo-canvas":``,"data-edge":i.expand},[((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{"data-sileo-svg":``,width:C,height:W.value,viewBox:`0 0 ${C} ${W.value}`},[n[2]||=(0,e.createElementVNode)(`title`,null,`Sileo Notification`,-1),(0,e.createElementVNode)(`defs`,null,[(0,e.createElementVNode)(`filter`,{id:w.value,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`},[(0,e.createElementVNode)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:E.value,result:`blur`},null,8,oe),n[0]||=(0,e.createElementVNode)(`feColorMatrix`,{in:`blur`,mode:`matrix`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10`,result:`goo`},null,-1),n[1]||=(0,e.createElementVNode)(`feComposite`,{in:`SourceGraphic`,in2:`goo`,operator:`atop`},null,-1)],8,ae)]),(0,e.createElementVNode)(`g`,{filter:`url(#${w.value})`},[(0,e.createElementVNode)(`rect`,{"data-sileo-pill":``,x:Oe.value,rx:T.value,ry:T.value,fill:s.value.fill},null,8,ce),(0,e.createElementVNode)(`rect`,{"data-sileo-body":``,y:S,width:C,height:Ee.value,rx:T.value,ry:T.value,fill:s.value.fill},null,8,le)],8,se)],8,ie))],8,re),(0,e.createElementVNode)(`div`,{ref_key:`headerRef`,ref:O,"data-sileo-header":``,"data-edge":i.expand},[(0,e.createElementVNode)(`div`,de,[((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`innerRef`,ref:k,key:R.value.current.key,"data-sileo-header-inner":``,"data-layer":`current`},[(0,e.createElementVNode)(`div`,{"data-sileo-badge":``,"data-state":R.value.current.view.state,class:(0,e.normalizeClass)(R.value.current.view.styles?.badge)},[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(()=>$(R.value.current.view))))],10,fe),(0,e.createElementVNode)(`span`,{"data-sileo-title":``,"data-state":R.value.current.view.state,class:(0,e.normalizeClass)(R.value.current.view.styles?.title)},(0,e.toDisplayString)(R.value.current.view.title),11,pe)])),R.value.prev?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:R.value.prev.key,"data-sileo-header-inner":``,"data-layer":`prev`,"data-exiting":`true`},[(0,e.createElementVNode)(`div`,{"data-sileo-badge":``,"data-state":R.value.prev.view.state,class:(0,e.normalizeClass)(R.value.prev.view.styles?.badge)},[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(()=>$(R.value.prev.view))))],10,me),(0,e.createElementVNode)(`span`,{"data-sileo-title":``,"data-state":R.value.prev.view.state,class:(0,e.normalizeClass)(R.value.prev.view.styles?.title)},(0,e.toDisplayString)(R.value.prev.view.title),11,he)])):(0,e.createCommentVNode)(``,!0)])],8,ue),p.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,"data-sileo-content":``,"data-edge":i.expand,"data-visible":h.value},[(0,e.createElementVNode)(`div`,{ref_key:`contentRef`,ref:A,"data-sileo-description":``,class:(0,e.normalizeClass)(s.value.styles?.description)},[typeof s.value.description==`string`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)((0,e.toDisplayString)(s.value.description),1)],64)):s.value.description?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(()=>s.value.description),{key:1})):(0,e.createCommentVNode)(``,!0),s.value.button?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,{key:2,href:`#`,"data-sileo-button":``,"data-state":s.value.state,class:(0,e.normalizeClass)(s.value.styles?.button),onClick:Be},(0,e.toDisplayString)(s.value.button.title),11,_e)):(0,e.createCommentVNode)(``,!0)],2)],8,ge)):(0,e.createCommentVNode)(``,!0)],44,ne))}});const T=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`];var E=[`data-position`],D=(0,e.defineComponent)({__name:`Toaster`,props:{position:{default:`top-right`},offset:{},options:{}},setup(t){let n=t,r=(0,e.ref)(o.toasts),s=(0,e.ref)(),c=!1,u=new Map,d,f=new Map;function p(){for(let e of u.values())clearTimeout(e);u.clear()}function m(e){g.dismiss(e)}function h(e){if(!c)for(let t of e){if(t.exiting)continue;let e=l(t);if(u.has(e))continue;let n=t.duration??6e3;n===null||n<=0||u.set(e,window.setTimeout(()=>m(t.id),n))}}let _=(0,e.computed)(()=>{let e=r.value;for(let t=e.length-1;t>=0;t--)if(!e[t].exiting)return e[t].id}),v=(0,e.computed)(()=>{let e={};for(let t of r.value){let r=t.position??n.position,i=e[r];i?i.push(t):e[r]=[t]}return e});(0,e.watch)(_,e=>{d=e,s.value=e}),(0,e.watch)(()=>n.position,e=>{o.position=e},{immediate:!0}),(0,e.watch)(()=>n.options,e=>{o.options=e},{immediate:!0}),(0,e.watch)(r,e=>{let t=new Set(e.map(l)),n=new Set(e.map(e=>e.id));for(let[e,n]of u)t.has(e)||(clearTimeout(n),u.delete(e));for(let e of f.keys())n.has(e)||f.delete(e);h(e)},{deep:!0});function ee(){c||(c=!0,p())}function y(){c&&(c=!1,h(r.value))}function b(e){let t=f.get(e);return t||(t={enter:t=>{s.value!==e&&(s.value=e),ee()},leave:e=>{s.value!==d&&(s.value=d),y()},dismiss:()=>m(e)},f.set(e,t),t)}function x(e){if(n.offset===void 0)return;let t=typeof n.offset==`object`?n.offset:{top:n.offset,right:n.offset,bottom:n.offset,left:n.offset},r={},i=e=>typeof e==`number`?`${e}px`:e;return e.startsWith(`top`)&&t.top&&(r.top=i(t.top)),e.startsWith(`bottom`)&&t.bottom&&(r.bottom=i(t.bottom)),e.endsWith(`left`)&&t.left&&(r.left=i(t.left)),e.endsWith(`right`)&&t.right&&(r.right=i(t.right)),r}return(0,e.onMounted)(()=>{o.listeners.add(e=>{r.value=[...e]})}),(0,e.onUnmounted)(()=>{o.listeners.clear(),p()}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[(0,e.renderSlot)(t.$slots,`default`),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)((0,e.unref)(T),t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:t},[v.value[t]?.length?((0,e.openBlock)(),(0,e.createElementBlock)(`section`,{key:0,"data-sileo-viewport":``,"data-position":t,"aria-live":`polite`,style:(0,e.normalizeStyle)(x(t))},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(v.value[t],n=>((0,e.openBlock)(),(0,e.createBlock)(w,{key:n.id,id:n.id,state:n.state,title:n.title,description:n.description,position:(0,e.unref)(i)(t),expand:(0,e.unref)(a)(t),icon:n.icon,fill:n.fill,styles:n.styles,button:n.button,roundness:n.roundness,exiting:n.exiting,"auto-expand-delay-ms":n.autoExpandDelayMs,"auto-collapse-delay-ms":n.autoCollapseDelayMs,"refresh-key":n.instanceId,"can-expand":s.value===void 0||s.value===n.id,onMouseenter:e=>b(n.id).enter(e),onMouseleave:e=>b(n.id).leave(e),onDismiss:e=>b(n.id).dismiss()},null,8,[`id`,`state`,`title`,`description`,`position`,`expand`,`icon`,`fill`,`styles`,`button`,`roundness`,`exiting`,`auto-expand-delay-ms`,`auto-collapse-delay-ms`,`refresh-key`,`can-expand`,`onMouseenter`,`onMouseleave`,`onDismiss`]))),128))],12,E)):(0,e.createCommentVNode)(``,!0)],64))),128))],64))}});exports.Toaster=D,exports.sileo=g;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
:root{--sileo-spring-easing:linear(0, .002 0.6%, .007 1.2%, .015 1.8%, .026 2.4%, .041 3.1%, .06 3.8%, .108 5.3%, .157 6.6%, .214 8%, .467 13.7%, .577 16.3%, .631 17.7%, .682 19.1%, .73 20.5%, .771 21.8%, .808 23.1%, .844 24.5%, .874 25.8%, .903 27.2%, .928 28.6%, .952 30.1%, .972 31.6%, .988 33.1%, 1.01 35.7%, 1.025 38.5%, 1.034 41.6%, 1.038 45%, 1.035 50.1%, 1.012 64.2%, 1.003 73%, .999 83.7%, 1);--sileo-duration:.6s;--sileo-height:40px;--sileo-width:350px;--sileo-state-success:oklch(72.3% .219 142.136);--sileo-state-loading:oklch(55.6% 0 0);--sileo-state-error:oklch(63.7% .237 25.331);--sileo-state-warning:oklch(79.5% .184 86.047);--sileo-state-info:oklch(68.5% .169 237.323);--sileo-state-action:oklch(62.3% .214 259.815);--sileo-fill:#fff;--sileo-text:#0a0a0a;--sileo-description:#525252}[data-theme=light]{--sileo-fill:#0a0a0a;--sileo-text:#fff;--sileo-description:#d4d4d4}[data-sileo-toast]{cursor:pointer;pointer-events:auto;touch-action:none;width:var(--sileo-width);height:var(--_h,var(--sileo-height));opacity:0;transform-origin:50%;contain:layout style;background:0 0;border:0;padding:0;position:relative;overflow:visible;transform:translateZ(0)scale(.95)}[data-sileo-toast][data-state=loading]{cursor:default}[data-sileo-toast][data-ready=true]{opacity:1;transition:transform calc(var(--sileo-duration) * .66) var(--sileo-spring-easing), opacity calc(var(--sileo-duration) * .66) var(--sileo-spring-easing), margin-bottom calc(var(--sileo-duration) * .66) var(--sileo-spring-easing), margin-top calc(var(--sileo-duration) * .66) var(--sileo-spring-easing), height var(--sileo-duration) var(--sileo-spring-easing);transform:translateZ(0)scale(1)}[data-sileo-viewport][data-position^=top] [data-sileo-toast]:not([data-ready=true]){transform:translateY(-6px)scale(.95)}[data-sileo-viewport][data-position^=bottom] [data-sileo-toast]:not([data-ready=true]){transform:translateY(6px)scale(.95)}[data-sileo-toast][data-ready=true][data-exiting=true]{opacity:0;pointer-events:none}[data-sileo-viewport][data-position^=top] [data-sileo-toast][data-ready=true][data-exiting=true]{transform:translateY(-6px)scale(.95)}[data-sileo-viewport][data-position^=bottom] [data-sileo-toast][data-ready=true][data-exiting=true]{transform:translateY(6px)scale(.95)}[data-sileo-canvas]{pointer-events:none;contain:layout style;position:absolute;left:0;right:0;overflow:visible;transform:translateZ(0)}[data-sileo-canvas][data-edge=top]{bottom:0;transform:scaleY(-1)translateZ(0)}[data-sileo-canvas][data-edge=bottom]{top:0}[data-sileo-svg]{overflow:visible}[data-sileo-pill],[data-sileo-body]{transform-box:fill-box;transform-origin:50% 0}[data-sileo-pill]{transform:scaleY(var(--_sy,1));width:var(--_pw);height:var(--_ph)}[data-sileo-body]{transform:scaleY(var(--_by,0));opacity:var(--_by,0)}[data-sileo-toast][data-ready=true] [data-sileo-pill]{transition:transform var(--sileo-duration) var(--sileo-spring-easing), width var(--sileo-duration) var(--sileo-spring-easing), x var(--sileo-duration) var(--sileo-spring-easing)}[data-sileo-toast][data-ready=true][data-expanded=true] [data-sileo-pill]{transition-delay:calc(var(--sileo-duration) * .08)}[data-sileo-toast][data-ready=true] [data-sileo-body]{transition:transform var(--sileo-duration) var(--sileo-spring-easing), opacity var(--sileo-duration) var(--sileo-spring-easing)}[data-sileo-header]{z-index:20;height:var(--sileo-height);left:var(--_px,0px);transform:var(--_ht);max-width:var(--_pw);align-items:center;padding:.5rem;display:flex;position:absolute;overflow:hidden}[data-sileo-toast][data-ready=true] [data-sileo-header]{transition:transform var(--sileo-duration) var(--sileo-spring-easing), left var(--sileo-duration) var(--sileo-spring-easing), max-width var(--sileo-duration) var(--sileo-spring-easing)}[data-sileo-header][data-edge=top]{bottom:0}[data-sileo-header][data-edge=bottom]{top:0}[data-sileo-header-stack]{align-items:center;height:100%;display:inline-flex;position:relative}[data-sileo-header-inner]{white-space:nowrap;opacity:1;filter:blur();will-change:opacity, filter;align-items:center;gap:.5rem;display:flex}[data-sileo-header-inner][data-layer=current]{animation:sileo-header-enter var(--sileo-duration) var(--sileo-spring-easing) both}[data-sileo-header-inner][data-layer=prev]{pointer-events:none;position:absolute;top:0;left:0}[data-sileo-header-inner][data-exiting=true]{animation:.3s forwards sileo-header-exit}[data-sileo-badge]{box-sizing:border-box;width:24px;height:24px;color:var(--sileo-tone,currentColor);background-color:var(--sileo-tone-bg,transparent);border-radius:9999px;flex-shrink:0;justify-content:center;align-items:center;padding:2px;display:flex}[data-sileo-title]{text-transform:capitalize;color:var(--sileo-tone,currentColor);font-size:.825rem;font-weight:500;line-height:1rem}:is([data-sileo-badge],[data-sileo-title])[data-state]{--_c:var(--sileo-state-success);--sileo-tone:var(--_c);--sileo-tone-bg:color-mix(in oklch, var(--_c) 20%, transparent)}:is([data-sileo-badge],[data-sileo-title])[data-state=loading]{--_c:var(--sileo-state-loading)}:is([data-sileo-badge],[data-sileo-title])[data-state=error]{--_c:var(--sileo-state-error)}:is([data-sileo-badge],[data-sileo-title])[data-state=warning]{--_c:var(--sileo-state-warning)}:is([data-sileo-badge],[data-sileo-title])[data-state=info]{--_c:var(--sileo-state-info)}:is([data-sileo-badge],[data-sileo-title])[data-state=action]{--_c:var(--sileo-state-action)}[data-sileo-content]{z-index:10;pointer-events:none;width:100%;opacity:var(--_co,0);position:absolute;left:0}[data-sileo-content]:not([data-visible=true]){content-visibility:hidden}[data-sileo-toast][data-ready=true] [data-sileo-content]{transition:opacity calc(var(--sileo-duration) * .08) var(--sileo-spring-easing) calc(var(--sileo-duration) * .04)}[data-sileo-content][data-edge=top]{top:0}[data-sileo-content][data-edge=bottom]{top:var(--sileo-height)}[data-sileo-content][data-visible=true]{pointer-events:auto}[data-sileo-toast][data-ready=true] [data-sileo-content][data-visible=true]{transition:opacity var(--sileo-duration) var(--sileo-spring-easing) calc(var(--sileo-duration) * .25)}[data-sileo-description]{text-align:left;width:100%;color:var(--sileo-description);contain:layout style;content-visibility:auto;padding:1rem;font-size:.875rem;line-height:1.25rem}[data-sileo-button]{cursor:pointer;height:1.75rem;color:var(--sileo-btn-color,currentColor);background-color:var(--sileo-btn-bg,transparent);border:0;border-radius:9999px;justify-content:center;align-items:center;margin-top:.75rem;padding:0 .625rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex}[data-sileo-button]:hover{background-color:var(--sileo-btn-bg-hover,transparent)}[data-sileo-button][data-state]{--_c:var(--sileo-state-success);--sileo-btn-color:var(--_c);--sileo-btn-bg:color-mix(in oklch, var(--_c) 15%, transparent);--sileo-btn-bg-hover:color-mix(in oklch, var(--_c) 25%, transparent)}[data-sileo-button][data-state=loading]{--_c:var(--sileo-state-loading)}[data-sileo-button][data-state=error]{--_c:var(--sileo-state-error)}[data-sileo-button][data-state=warning]{--_c:var(--sileo-state-warning)}[data-sileo-button][data-state=info]{--_c:var(--sileo-state-info)}[data-sileo-button][data-state=action]{--_c:var(--sileo-state-action)}[data-sileo-icon=spin]{animation:1s linear infinite sileo-spin}@keyframes sileo-spin{to{rotate:360deg}}@keyframes sileo-header-enter{0%{opacity:0;filter:blur(6px)}to{opacity:1;filter:blur()}}@keyframes sileo-header-exit{0%{opacity:1;filter:blur()}to{opacity:0;filter:blur(6px)}}[data-sileo-viewport]{z-index:50;pointer-events:none;contain:layout style;gap:.75rem;max-width:calc(100vw - 1.5rem);padding:.75rem;display:flex;position:fixed}[data-sileo-viewport][data-position^=top] [data-sileo-toast]:not([data-ready=true]){margin-bottom:calc(-1 * (var(--sileo-height) + .75rem))}[data-sileo-viewport][data-position^=bottom] [data-sileo-toast]:not([data-ready=true]){margin-top:calc(-1 * (var(--sileo-height) + .75rem))}[data-sileo-viewport][data-position^=top]{flex-direction:column-reverse;top:0}[data-sileo-viewport][data-position^=bottom]{flex-direction:column;bottom:0}[data-sileo-viewport][data-position$=left]{align-items:flex-start;left:0}[data-sileo-viewport][data-position$=right]{align-items:flex-end;right:0}[data-sileo-viewport][data-position$=center]{align-items:center;left:50%;transform:translate(-50%)}@media (prefers-reduced-motion:no-preference){[data-sileo-toast][data-ready=true]:hover,[data-sileo-toast][data-ready=true][data-exiting=true]{will-change:transform, opacity, height}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms;animation-duration:.01ms;animation-iteration-count:1}}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, h as c, nextTick as l, normalizeClass as u, normalizeStyle as ee, onMounted as te, onUnmounted as ne, openBlock as d, ref as f, renderList as p, renderSlot as re, resolveDynamicComponent as m, toDisplayString as h, unref as g, watch as _ } from "vue";
|
|
2
|
+
var v = 6e3;
|
|
3
|
+
v * .1;
|
|
4
|
+
var y = v * .025, b = v - 2e3;
|
|
5
|
+
const x = (e) => e.includes("right") ? "right" : e.includes("center") ? "center" : "left", S = (e) => e.startsWith("top") ? "bottom" : "top", C = {
|
|
6
|
+
toasts: [],
|
|
7
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
8
|
+
position: "top-right",
|
|
9
|
+
options: void 0,
|
|
10
|
+
emit() {
|
|
11
|
+
for (let e of this.listeners) e(this.toasts);
|
|
12
|
+
},
|
|
13
|
+
update(e) {
|
|
14
|
+
this.toasts = e(this.toasts), this.emit();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var w = 0, T = () => `${++w}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
18
|
+
const E = (e) => `${e.id}:${e.instanceId}`;
|
|
19
|
+
var D = (e) => {
|
|
20
|
+
let t = C.toasts.find((t) => t.id === e);
|
|
21
|
+
!t || t.exiting || (C.update((t) => t.map((t) => t.id === e ? {
|
|
22
|
+
...t,
|
|
23
|
+
exiting: !0
|
|
24
|
+
} : t)), setTimeout(() => C.update((t) => t.filter((t) => t.id !== e)), 600));
|
|
25
|
+
}, O = (e, t) => {
|
|
26
|
+
if (e.autopilot === !1 || !t || t <= 0) return {};
|
|
27
|
+
let n = typeof e.autopilot == "object" ? e.autopilot : void 0, r = (e) => Math.min(t, Math.max(0, e));
|
|
28
|
+
return {
|
|
29
|
+
expandDelayMs: r(n?.expand ?? y),
|
|
30
|
+
collapseDelayMs: r(n?.collapse ?? b)
|
|
31
|
+
};
|
|
32
|
+
}, k = (e) => ({
|
|
33
|
+
...C.options,
|
|
34
|
+
...e,
|
|
35
|
+
styles: {
|
|
36
|
+
...C.options?.styles,
|
|
37
|
+
...e.styles
|
|
38
|
+
}
|
|
39
|
+
}), A = (e, t, n) => {
|
|
40
|
+
let r = O(e, e.duration ?? 6e3);
|
|
41
|
+
return {
|
|
42
|
+
...e,
|
|
43
|
+
id: t,
|
|
44
|
+
instanceId: T(),
|
|
45
|
+
position: e.position ?? n ?? C.position,
|
|
46
|
+
autoExpandDelayMs: r.expandDelayMs,
|
|
47
|
+
autoCollapseDelayMs: r.collapseDelayMs
|
|
48
|
+
};
|
|
49
|
+
}, j = (e) => {
|
|
50
|
+
let t = C.toasts.filter((e) => !e.exiting), n = k(e), r = n.id ?? "sileo-default", i = t.find((e) => e.id === r), a = A(n, r, i?.position);
|
|
51
|
+
return i ? C.update((e) => e.map((e) => e.id === r ? a : e)) : C.update((e) => [...e.filter((e) => e.id !== r), a]), {
|
|
52
|
+
id: r,
|
|
53
|
+
duration: n.duration ?? 6e3
|
|
54
|
+
};
|
|
55
|
+
}, M = (e, t) => {
|
|
56
|
+
let n = C.toasts.find((t) => t.id === e);
|
|
57
|
+
if (!n) return;
|
|
58
|
+
let r = A(k(t), e, n.position);
|
|
59
|
+
C.update((t) => t.map((t) => t.id === e ? r : t));
|
|
60
|
+
};
|
|
61
|
+
const N = {
|
|
62
|
+
show: (e) => j(e).id,
|
|
63
|
+
success: (e) => j({
|
|
64
|
+
...e,
|
|
65
|
+
state: "success"
|
|
66
|
+
}).id,
|
|
67
|
+
error: (e) => j({
|
|
68
|
+
...e,
|
|
69
|
+
state: "error"
|
|
70
|
+
}).id,
|
|
71
|
+
warning: (e) => j({
|
|
72
|
+
...e,
|
|
73
|
+
state: "warning"
|
|
74
|
+
}).id,
|
|
75
|
+
info: (e) => j({
|
|
76
|
+
...e,
|
|
77
|
+
state: "info"
|
|
78
|
+
}).id,
|
|
79
|
+
action: (e) => j({
|
|
80
|
+
...e,
|
|
81
|
+
state: "action"
|
|
82
|
+
}).id,
|
|
83
|
+
promise: (e, t) => {
|
|
84
|
+
let { id: n } = j({
|
|
85
|
+
...t.loading,
|
|
86
|
+
state: "loading",
|
|
87
|
+
duration: null,
|
|
88
|
+
position: t.position
|
|
89
|
+
}), r = typeof e == "function" ? e() : e;
|
|
90
|
+
return r.then((e) => {
|
|
91
|
+
t.action ? M(n, {
|
|
92
|
+
...typeof t.action == "function" ? t.action(e) : t.action,
|
|
93
|
+
state: "action",
|
|
94
|
+
id: n
|
|
95
|
+
}) : M(n, {
|
|
96
|
+
...typeof t.success == "function" ? t.success(e) : t.success,
|
|
97
|
+
state: "success",
|
|
98
|
+
id: n
|
|
99
|
+
});
|
|
100
|
+
}).catch((e) => {
|
|
101
|
+
M(n, {
|
|
102
|
+
...typeof t.error == "function" ? t.error(e) : t.error,
|
|
103
|
+
state: "error",
|
|
104
|
+
id: n
|
|
105
|
+
});
|
|
106
|
+
}), r;
|
|
107
|
+
},
|
|
108
|
+
dismiss: D,
|
|
109
|
+
clear: (e) => C.update((t) => e ? t.filter((t) => t.position !== e) : [])
|
|
110
|
+
};
|
|
111
|
+
var P = {
|
|
112
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
+
width: "16",
|
|
114
|
+
height: "16",
|
|
115
|
+
viewBox: "0 0 24 24",
|
|
116
|
+
fill: "none",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
"stroke-width": "2",
|
|
119
|
+
"stroke-linecap": "round",
|
|
120
|
+
"stroke-linejoin": "round"
|
|
121
|
+
};
|
|
122
|
+
const ie = () => c("svg", P, [
|
|
123
|
+
c("title", "Arrow Right"),
|
|
124
|
+
c("path", { d: "M5 12h14" }),
|
|
125
|
+
c("path", { d: "m12 5 7 7-7 7" })
|
|
126
|
+
]), ae = () => c("svg", P, [
|
|
127
|
+
c("title", "Life Buoy"),
|
|
128
|
+
c("circle", {
|
|
129
|
+
cx: "12",
|
|
130
|
+
cy: "12",
|
|
131
|
+
r: "10"
|
|
132
|
+
}),
|
|
133
|
+
c("path", { d: "m4.93 4.93 4.24 4.24" }),
|
|
134
|
+
c("path", { d: "m14.83 9.17 4.24-4.24" }),
|
|
135
|
+
c("path", { d: "m14.83 14.83 4.24 4.24" }),
|
|
136
|
+
c("path", { d: "m9.17 14.83-4.24 4.24" }),
|
|
137
|
+
c("circle", {
|
|
138
|
+
cx: "12",
|
|
139
|
+
cy: "12",
|
|
140
|
+
r: "4"
|
|
141
|
+
})
|
|
142
|
+
]), oe = () => c("svg", {
|
|
143
|
+
...P,
|
|
144
|
+
"data-sileo-icon": "spin",
|
|
145
|
+
"aria-hidden": "true"
|
|
146
|
+
}, [c("title", "Loader Circle"), c("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })]), se = () => c("svg", P, [
|
|
147
|
+
c("title", "X"),
|
|
148
|
+
c("path", { d: "M18 6 6 18" }),
|
|
149
|
+
c("path", { d: "m6 6 12 12" })
|
|
150
|
+
]), ce = () => c("svg", P, [
|
|
151
|
+
c("title", "Circle Alert"),
|
|
152
|
+
c("circle", {
|
|
153
|
+
cx: "12",
|
|
154
|
+
cy: "12",
|
|
155
|
+
r: "10"
|
|
156
|
+
}),
|
|
157
|
+
c("line", {
|
|
158
|
+
x1: "12",
|
|
159
|
+
x2: "12",
|
|
160
|
+
y1: "8",
|
|
161
|
+
y2: "12"
|
|
162
|
+
}),
|
|
163
|
+
c("line", {
|
|
164
|
+
x1: "12",
|
|
165
|
+
x2: "12.01",
|
|
166
|
+
y1: "16",
|
|
167
|
+
y2: "16"
|
|
168
|
+
})
|
|
169
|
+
]), le = () => c("svg", P, [c("title", "Check"), c("path", { d: "M20 6 9 17l-5-5" })]);
|
|
170
|
+
var ue = [
|
|
171
|
+
"data-ready",
|
|
172
|
+
"data-expanded",
|
|
173
|
+
"data-exiting",
|
|
174
|
+
"data-edge",
|
|
175
|
+
"data-position",
|
|
176
|
+
"data-state"
|
|
177
|
+
], de = ["data-edge"], fe = ["height", "viewBox"], pe = ["id"], me = ["stdDeviation"], he = ["filter"], ge = [
|
|
178
|
+
"x",
|
|
179
|
+
"rx",
|
|
180
|
+
"ry",
|
|
181
|
+
"fill"
|
|
182
|
+
], _e = [
|
|
183
|
+
"height",
|
|
184
|
+
"rx",
|
|
185
|
+
"ry",
|
|
186
|
+
"fill"
|
|
187
|
+
], ve = ["data-edge"], ye = { "data-sileo-header-stack": "" }, be = ["data-state"], xe = ["data-state"], Se = ["data-state"], Ce = ["data-state"], we = ["data-edge", "data-visible"], Te = ["data-state"], F = 40, I = 350, Ee = 18, De = .5, Oe = 10, ke = 2.25, Ae = 200, je = 150, Me = 30, Ne = 20, L = /* @__PURE__ */ s({
|
|
188
|
+
__name: "Sileo",
|
|
189
|
+
props: {
|
|
190
|
+
id: {},
|
|
191
|
+
fill: { default: "var(--sileo-fill)" },
|
|
192
|
+
state: { default: "success" },
|
|
193
|
+
title: {},
|
|
194
|
+
description: {},
|
|
195
|
+
position: { default: "left" },
|
|
196
|
+
expand: { default: "bottom" },
|
|
197
|
+
icon: {},
|
|
198
|
+
styles: {},
|
|
199
|
+
button: {},
|
|
200
|
+
roundness: {},
|
|
201
|
+
exiting: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: !1
|
|
204
|
+
},
|
|
205
|
+
autoExpandDelayMs: {},
|
|
206
|
+
autoCollapseDelayMs: {},
|
|
207
|
+
canExpand: { type: Boolean },
|
|
208
|
+
interruptKey: {},
|
|
209
|
+
refreshKey: {}
|
|
210
|
+
},
|
|
211
|
+
emits: [
|
|
212
|
+
"mouseenter",
|
|
213
|
+
"mouseleave",
|
|
214
|
+
"dismiss"
|
|
215
|
+
],
|
|
216
|
+
setup(s, { emit: p }) {
|
|
217
|
+
let re = {
|
|
218
|
+
success: c(le),
|
|
219
|
+
loading: c(oe),
|
|
220
|
+
error: c(se),
|
|
221
|
+
warning: c(ce),
|
|
222
|
+
info: c(ae),
|
|
223
|
+
action: c(ie)
|
|
224
|
+
}, g = s, v = p, y = t(() => g.title ?? g.state), b = f({
|
|
225
|
+
title: y.value,
|
|
226
|
+
description: g.description,
|
|
227
|
+
state: g.state,
|
|
228
|
+
icon: g.icon,
|
|
229
|
+
styles: g.styles,
|
|
230
|
+
button: g.button,
|
|
231
|
+
fill: g.fill
|
|
232
|
+
}), x = f(g.refreshKey), S = f(!1), C = f(!1), w = f(0), T = f(0), E = t(() => !!b.value.description || !!b.value.button), D = t(() => b.value.state === "loading"), O = t(() => E.value && S.value && !D.value), k = t(() => D.value ? !1 : g.canExpand ?? (!g.interruptKey || g.interruptKey === g.id)), A = t(() => `${b.value.state}-${b.value.title}`), j = t(() => `sileo-gooey-${g.id}`), M = t(() => Math.max(0, g.roundness ?? Ee)), N = t(() => M.value * De), P = f(null), L = f(null), R = f(null), z = f(null), B = null, V = null, H = null, U = null, W = null, G = g.refreshKey, K = null, q = f({
|
|
233
|
+
current: {
|
|
234
|
+
key: A.value,
|
|
235
|
+
view: b.value
|
|
236
|
+
},
|
|
237
|
+
prev: null
|
|
238
|
+
}), Pe = t(() => ({
|
|
239
|
+
title: y.value,
|
|
240
|
+
description: g.description,
|
|
241
|
+
state: g.state,
|
|
242
|
+
icon: g.icon,
|
|
243
|
+
styles: g.styles,
|
|
244
|
+
button: g.button,
|
|
245
|
+
fill: g.fill
|
|
246
|
+
})), J = F * ke, Y = t(() => E.value ? Math.max(J, F + T.value) : J), X = Y.value, Fe = t(() => O.value ? (X = Y.value, Y.value) : X), Ie = t(() => E.value ? Math.max(Fe.value, J) : F), Le = t(() => Math.max(0, Fe.value - F)), Re = t(() => Math.max(w.value || F, F)), ze = t(() => F + N.value * 3), Be = t(() => g.position === "right" ? I - Re.value : g.position === "center" ? (I - Re.value) / 2 : 0), Ve = t(() => ({
|
|
247
|
+
"--_h": `${O.value ? Fe.value : F}px`,
|
|
248
|
+
"--_pw": `${Re.value}px`,
|
|
249
|
+
"--_px": `${Be.value}px`,
|
|
250
|
+
"--_sy": `${O.value ? 1 : F / ze.value}`,
|
|
251
|
+
"--_ph": `${ze.value}px`,
|
|
252
|
+
"--_by": `${O.value ? 1 : 0}`,
|
|
253
|
+
"--_ht": `translateY(${O.value ? g.expand === "bottom" ? 3 : -3 : 0}px) scale(${O.value ? .9 : 1})`,
|
|
254
|
+
"--_co": `${O.value ? 1 : 0}`
|
|
255
|
+
})), Z = null, He = 0, Q = null, Ue = 0;
|
|
256
|
+
function We() {
|
|
257
|
+
let e = R.value, t = L.value;
|
|
258
|
+
if (!e || !t) return;
|
|
259
|
+
if (W === null) {
|
|
260
|
+
let e = getComputedStyle(t);
|
|
261
|
+
W = parseFloat(e.paddingLeft) + parseFloat(e.paddingRight);
|
|
262
|
+
}
|
|
263
|
+
let n = e.scrollWidth + W + Oe;
|
|
264
|
+
n > Oe && w.value !== n && (w.value = n);
|
|
265
|
+
}
|
|
266
|
+
function Ge() {
|
|
267
|
+
Ke();
|
|
268
|
+
let e = R.value;
|
|
269
|
+
e && (We(), Z = new ResizeObserver(() => {
|
|
270
|
+
cancelAnimationFrame(He), He = requestAnimationFrame(We);
|
|
271
|
+
}), Z.observe(e));
|
|
272
|
+
}
|
|
273
|
+
function Ke() {
|
|
274
|
+
Z &&= (cancelAnimationFrame(He), Z.disconnect(), null);
|
|
275
|
+
}
|
|
276
|
+
function qe() {
|
|
277
|
+
if (!E.value) {
|
|
278
|
+
T.value = 0;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
let e = z.value;
|
|
282
|
+
if (!e) return;
|
|
283
|
+
let t = e.scrollHeight;
|
|
284
|
+
T.value !== t && (T.value = t);
|
|
285
|
+
}
|
|
286
|
+
function Je() {
|
|
287
|
+
Ye();
|
|
288
|
+
let e = z.value;
|
|
289
|
+
e && (qe(), Q = new ResizeObserver(() => {
|
|
290
|
+
cancelAnimationFrame(Ue), Ue = requestAnimationFrame(qe);
|
|
291
|
+
}), Q.observe(e));
|
|
292
|
+
}
|
|
293
|
+
function Ye() {
|
|
294
|
+
Q &&= (cancelAnimationFrame(Ue), Q.disconnect(), null);
|
|
295
|
+
}
|
|
296
|
+
_([A, b], () => {
|
|
297
|
+
let e = A.value, t = b.value;
|
|
298
|
+
q.value.current.key === e ? q.value.current.view !== t && (q.value = {
|
|
299
|
+
...q.value,
|
|
300
|
+
current: {
|
|
301
|
+
key: e,
|
|
302
|
+
view: t
|
|
303
|
+
}
|
|
304
|
+
}) : q.value = {
|
|
305
|
+
prev: q.value.current,
|
|
306
|
+
current: {
|
|
307
|
+
key: e,
|
|
308
|
+
view: t
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
}, { flush: "sync" }), _(() => q.value.current.key, () => {
|
|
312
|
+
l(Ge);
|
|
313
|
+
}), _(() => q.value.prev, (e) => {
|
|
314
|
+
e && (B && clearTimeout(B), B = window.setTimeout(() => {
|
|
315
|
+
B = null, q.value = {
|
|
316
|
+
...q.value,
|
|
317
|
+
prev: null
|
|
318
|
+
};
|
|
319
|
+
}, je));
|
|
320
|
+
}), _(E, (e) => {
|
|
321
|
+
e ? l(Je) : (T.value = 0, Ye());
|
|
322
|
+
}), _([() => g.refreshKey, Pe], () => {
|
|
323
|
+
let e = g.refreshKey, t = Pe.value;
|
|
324
|
+
if (e === void 0) {
|
|
325
|
+
b.value = t, x.value = void 0, K = null, G = e;
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
G !== e && (G = e, U &&= (clearTimeout(U), null), O.value ? (K = {
|
|
329
|
+
key: e,
|
|
330
|
+
payload: t
|
|
331
|
+
}, S.value = !1, U = window.setTimeout(() => {
|
|
332
|
+
U = null, K &&= (b.value = K.payload, x.value = K.key, null);
|
|
333
|
+
}, Ae)) : (K = null, b.value = t, x.value = e));
|
|
334
|
+
}, { deep: !1 }), _([
|
|
335
|
+
() => g.autoCollapseDelayMs,
|
|
336
|
+
() => g.autoExpandDelayMs,
|
|
337
|
+
E,
|
|
338
|
+
k,
|
|
339
|
+
() => g.exiting,
|
|
340
|
+
x
|
|
341
|
+
], () => {
|
|
342
|
+
if (!E.value) return;
|
|
343
|
+
if (V && clearTimeout(V), H && clearTimeout(H), g.exiting || !k.value) {
|
|
344
|
+
S.value = !1;
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (g.autoExpandDelayMs == null && g.autoCollapseDelayMs == null) return;
|
|
348
|
+
let e = g.autoExpandDelayMs ?? 0, t = g.autoCollapseDelayMs ?? 0;
|
|
349
|
+
e > 0 ? V = window.setTimeout(() => S.value = !0, e) : S.value = !0, t > 0 && (H = window.setTimeout(() => S.value = !1, t));
|
|
350
|
+
}, { immediate: !0 }), _(O, (e) => {
|
|
351
|
+
e && (X = Y.value);
|
|
352
|
+
});
|
|
353
|
+
function Xe(e) {
|
|
354
|
+
v("mouseenter", e), E.value && (S.value = !0);
|
|
355
|
+
}
|
|
356
|
+
function Ze(e) {
|
|
357
|
+
v("mouseleave", e), S.value = !1;
|
|
358
|
+
}
|
|
359
|
+
function Qe(e) {
|
|
360
|
+
e.propertyName !== "height" && e.propertyName !== "transform" || O.value || (K &&= (U &&= (clearTimeout(U), null), b.value = K.payload, x.value = K.key, null));
|
|
361
|
+
}
|
|
362
|
+
let $ = null;
|
|
363
|
+
function $e(e) {
|
|
364
|
+
g.exiting || e.target.closest("[data-sileo-button]") || ($ = e.clientY, e.currentTarget.setPointerCapture(e.pointerId));
|
|
365
|
+
}
|
|
366
|
+
function et(e) {
|
|
367
|
+
if ($ === null) return;
|
|
368
|
+
let t = e.clientY - $, n = t > 0 ? 1 : -1, r = Math.min(Math.abs(t), Ne) * n, i = P.value;
|
|
369
|
+
i && (i.style.transform = `translateY(${r}px)`);
|
|
370
|
+
}
|
|
371
|
+
function tt(e) {
|
|
372
|
+
if ($ === null) return;
|
|
373
|
+
let t = e.clientY - $;
|
|
374
|
+
$ = null;
|
|
375
|
+
let n = P.value;
|
|
376
|
+
n && (n.style.transform = ""), Math.abs(t) > Me && v("dismiss");
|
|
377
|
+
}
|
|
378
|
+
te(() => {
|
|
379
|
+
requestAnimationFrame(() => C.value = !0), l(() => {
|
|
380
|
+
Ge(), E.value && Je();
|
|
381
|
+
});
|
|
382
|
+
let e = P.value;
|
|
383
|
+
e && (e.addEventListener("pointermove", et, { passive: !0 }), e.addEventListener("pointerup", tt, { passive: !0 }));
|
|
384
|
+
}), ne(() => {
|
|
385
|
+
Ke(), Ye(), B && clearTimeout(B), V && clearTimeout(V), H && clearTimeout(H), U && clearTimeout(U);
|
|
386
|
+
let e = P.value;
|
|
387
|
+
e && (e.removeEventListener("pointermove", et), e.removeEventListener("pointerup", tt));
|
|
388
|
+
});
|
|
389
|
+
function nt(e) {
|
|
390
|
+
return e.icon === void 0 ? re[e.state] ?? null : e.icon;
|
|
391
|
+
}
|
|
392
|
+
function rt(e) {
|
|
393
|
+
e.preventDefault(), e.stopPropagation(), b.value.button?.onClick();
|
|
394
|
+
}
|
|
395
|
+
return (t, s) => (d(), i("button", {
|
|
396
|
+
ref_key: "buttonRef",
|
|
397
|
+
ref: P,
|
|
398
|
+
type: "button",
|
|
399
|
+
"data-sileo-toast": "",
|
|
400
|
+
"data-ready": C.value,
|
|
401
|
+
"data-expanded": O.value,
|
|
402
|
+
"data-exiting": g.exiting,
|
|
403
|
+
"data-edge": g.expand,
|
|
404
|
+
"data-position": g.position,
|
|
405
|
+
"data-state": b.value.state,
|
|
406
|
+
style: ee(Ve.value),
|
|
407
|
+
onMouseenter: Xe,
|
|
408
|
+
onMouseleave: Ze,
|
|
409
|
+
onTransitionend: Qe,
|
|
410
|
+
onPointerdown: $e
|
|
411
|
+
}, [
|
|
412
|
+
a("div", {
|
|
413
|
+
"data-sileo-canvas": "",
|
|
414
|
+
"data-edge": g.expand
|
|
415
|
+
}, [(d(), i("svg", {
|
|
416
|
+
"data-sileo-svg": "",
|
|
417
|
+
width: I,
|
|
418
|
+
height: Ie.value,
|
|
419
|
+
viewBox: `0 0 ${I} ${Ie.value}`
|
|
420
|
+
}, [
|
|
421
|
+
s[2] ||= a("title", null, "Sileo Notification", -1),
|
|
422
|
+
a("defs", null, [a("filter", {
|
|
423
|
+
id: j.value,
|
|
424
|
+
x: "-20%",
|
|
425
|
+
y: "-20%",
|
|
426
|
+
width: "140%",
|
|
427
|
+
height: "140%",
|
|
428
|
+
colorInterpolationFilters: "sRGB"
|
|
429
|
+
}, [
|
|
430
|
+
a("feGaussianBlur", {
|
|
431
|
+
in: "SourceGraphic",
|
|
432
|
+
stdDeviation: N.value,
|
|
433
|
+
result: "blur"
|
|
434
|
+
}, null, 8, me),
|
|
435
|
+
s[0] ||= a("feColorMatrix", {
|
|
436
|
+
in: "blur",
|
|
437
|
+
mode: "matrix",
|
|
438
|
+
values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10",
|
|
439
|
+
result: "goo"
|
|
440
|
+
}, null, -1),
|
|
441
|
+
s[1] ||= a("feComposite", {
|
|
442
|
+
in: "SourceGraphic",
|
|
443
|
+
in2: "goo",
|
|
444
|
+
operator: "atop"
|
|
445
|
+
}, null, -1)
|
|
446
|
+
], 8, pe)]),
|
|
447
|
+
a("g", { filter: `url(#${j.value})` }, [a("rect", {
|
|
448
|
+
"data-sileo-pill": "",
|
|
449
|
+
x: Be.value,
|
|
450
|
+
rx: M.value,
|
|
451
|
+
ry: M.value,
|
|
452
|
+
fill: b.value.fill
|
|
453
|
+
}, null, 8, ge), a("rect", {
|
|
454
|
+
"data-sileo-body": "",
|
|
455
|
+
y: F,
|
|
456
|
+
width: I,
|
|
457
|
+
height: Le.value,
|
|
458
|
+
rx: M.value,
|
|
459
|
+
ry: M.value,
|
|
460
|
+
fill: b.value.fill
|
|
461
|
+
}, null, 8, _e)], 8, he)
|
|
462
|
+
], 8, fe))], 8, de),
|
|
463
|
+
a("div", {
|
|
464
|
+
ref_key: "headerRef",
|
|
465
|
+
ref: L,
|
|
466
|
+
"data-sileo-header": "",
|
|
467
|
+
"data-edge": g.expand
|
|
468
|
+
}, [a("div", ye, [(d(), i("div", {
|
|
469
|
+
ref_key: "innerRef",
|
|
470
|
+
ref: R,
|
|
471
|
+
key: q.value.current.key,
|
|
472
|
+
"data-sileo-header-inner": "",
|
|
473
|
+
"data-layer": "current"
|
|
474
|
+
}, [a("div", {
|
|
475
|
+
"data-sileo-badge": "",
|
|
476
|
+
"data-state": q.value.current.view.state,
|
|
477
|
+
class: u(q.value.current.view.styles?.badge)
|
|
478
|
+
}, [(d(), n(m(() => nt(q.value.current.view))))], 10, be), a("span", {
|
|
479
|
+
"data-sileo-title": "",
|
|
480
|
+
"data-state": q.value.current.view.state,
|
|
481
|
+
class: u(q.value.current.view.styles?.title)
|
|
482
|
+
}, h(q.value.current.view.title), 11, xe)])), q.value.prev ? (d(), i("div", {
|
|
483
|
+
key: q.value.prev.key,
|
|
484
|
+
"data-sileo-header-inner": "",
|
|
485
|
+
"data-layer": "prev",
|
|
486
|
+
"data-exiting": "true"
|
|
487
|
+
}, [a("div", {
|
|
488
|
+
"data-sileo-badge": "",
|
|
489
|
+
"data-state": q.value.prev.view.state,
|
|
490
|
+
class: u(q.value.prev.view.styles?.badge)
|
|
491
|
+
}, [(d(), n(m(() => nt(q.value.prev.view))))], 10, Se), a("span", {
|
|
492
|
+
"data-sileo-title": "",
|
|
493
|
+
"data-state": q.value.prev.view.state,
|
|
494
|
+
class: u(q.value.prev.view.styles?.title)
|
|
495
|
+
}, h(q.value.prev.view.title), 11, Ce)])) : r("", !0)])], 8, ve),
|
|
496
|
+
E.value ? (d(), i("div", {
|
|
497
|
+
key: 0,
|
|
498
|
+
"data-sileo-content": "",
|
|
499
|
+
"data-edge": g.expand,
|
|
500
|
+
"data-visible": O.value
|
|
501
|
+
}, [a("div", {
|
|
502
|
+
ref_key: "contentRef",
|
|
503
|
+
ref: z,
|
|
504
|
+
"data-sileo-description": "",
|
|
505
|
+
class: u(b.value.styles?.description)
|
|
506
|
+
}, [typeof b.value.description == "string" ? (d(), i(e, { key: 0 }, [o(h(b.value.description), 1)], 64)) : b.value.description ? (d(), n(m(() => b.value.description), { key: 1 })) : r("", !0), b.value.button ? (d(), i("a", {
|
|
507
|
+
key: 2,
|
|
508
|
+
href: "#",
|
|
509
|
+
"data-sileo-button": "",
|
|
510
|
+
"data-state": b.value.state,
|
|
511
|
+
class: u(b.value.styles?.button),
|
|
512
|
+
onClick: rt
|
|
513
|
+
}, h(b.value.button.title), 11, Te)) : r("", !0)], 2)], 8, we)) : r("", !0)
|
|
514
|
+
], 44, ue));
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
const R = [
|
|
518
|
+
"top-left",
|
|
519
|
+
"top-center",
|
|
520
|
+
"top-right",
|
|
521
|
+
"bottom-left",
|
|
522
|
+
"bottom-center",
|
|
523
|
+
"bottom-right"
|
|
524
|
+
];
|
|
525
|
+
var z = ["data-position"], B = /* @__PURE__ */ s({
|
|
526
|
+
__name: "Toaster",
|
|
527
|
+
props: {
|
|
528
|
+
position: { default: "top-right" },
|
|
529
|
+
offset: {},
|
|
530
|
+
options: {}
|
|
531
|
+
},
|
|
532
|
+
setup(a) {
|
|
533
|
+
let o = a, s = f(C.toasts), c = f(), l = !1, u = /* @__PURE__ */ new Map(), m, h = /* @__PURE__ */ new Map();
|
|
534
|
+
function v() {
|
|
535
|
+
for (let e of u.values()) clearTimeout(e);
|
|
536
|
+
u.clear();
|
|
537
|
+
}
|
|
538
|
+
function y(e) {
|
|
539
|
+
N.dismiss(e);
|
|
540
|
+
}
|
|
541
|
+
function b(e) {
|
|
542
|
+
if (!l) for (let t of e) {
|
|
543
|
+
if (t.exiting) continue;
|
|
544
|
+
let e = E(t);
|
|
545
|
+
if (u.has(e)) continue;
|
|
546
|
+
let n = t.duration ?? 6e3;
|
|
547
|
+
n === null || n <= 0 || u.set(e, window.setTimeout(() => y(t.id), n));
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
let w = t(() => {
|
|
551
|
+
let e = s.value;
|
|
552
|
+
for (let t = e.length - 1; t >= 0; t--) if (!e[t].exiting) return e[t].id;
|
|
553
|
+
}), T = t(() => {
|
|
554
|
+
let e = {};
|
|
555
|
+
for (let t of s.value) {
|
|
556
|
+
let n = t.position ?? o.position, r = e[n];
|
|
557
|
+
r ? r.push(t) : e[n] = [t];
|
|
558
|
+
}
|
|
559
|
+
return e;
|
|
560
|
+
});
|
|
561
|
+
_(w, (e) => {
|
|
562
|
+
m = e, c.value = e;
|
|
563
|
+
}), _(() => o.position, (e) => {
|
|
564
|
+
C.position = e;
|
|
565
|
+
}, { immediate: !0 }), _(() => o.options, (e) => {
|
|
566
|
+
C.options = e;
|
|
567
|
+
}, { immediate: !0 }), _(s, (e) => {
|
|
568
|
+
let t = new Set(e.map(E)), n = new Set(e.map((e) => e.id));
|
|
569
|
+
for (let [e, n] of u) t.has(e) || (clearTimeout(n), u.delete(e));
|
|
570
|
+
for (let e of h.keys()) n.has(e) || h.delete(e);
|
|
571
|
+
b(e);
|
|
572
|
+
}, { deep: !0 });
|
|
573
|
+
function D() {
|
|
574
|
+
l || (l = !0, v());
|
|
575
|
+
}
|
|
576
|
+
function O() {
|
|
577
|
+
l && (l = !1, b(s.value));
|
|
578
|
+
}
|
|
579
|
+
function k(e) {
|
|
580
|
+
let t = h.get(e);
|
|
581
|
+
return t || (t = {
|
|
582
|
+
enter: (t) => {
|
|
583
|
+
c.value !== e && (c.value = e), D();
|
|
584
|
+
},
|
|
585
|
+
leave: (e) => {
|
|
586
|
+
c.value !== m && (c.value = m), O();
|
|
587
|
+
},
|
|
588
|
+
dismiss: () => y(e)
|
|
589
|
+
}, h.set(e, t), t);
|
|
590
|
+
}
|
|
591
|
+
function A(e) {
|
|
592
|
+
if (o.offset === void 0) return;
|
|
593
|
+
let t = typeof o.offset == "object" ? o.offset : {
|
|
594
|
+
top: o.offset,
|
|
595
|
+
right: o.offset,
|
|
596
|
+
bottom: o.offset,
|
|
597
|
+
left: o.offset
|
|
598
|
+
}, n = {}, r = (e) => typeof e == "number" ? `${e}px` : e;
|
|
599
|
+
return e.startsWith("top") && t.top && (n.top = r(t.top)), e.startsWith("bottom") && t.bottom && (n.bottom = r(t.bottom)), e.endsWith("left") && t.left && (n.left = r(t.left)), e.endsWith("right") && t.right && (n.right = r(t.right)), n;
|
|
600
|
+
}
|
|
601
|
+
return te(() => {
|
|
602
|
+
C.listeners.add((e) => {
|
|
603
|
+
s.value = [...e];
|
|
604
|
+
});
|
|
605
|
+
}), ne(() => {
|
|
606
|
+
C.listeners.clear(), v();
|
|
607
|
+
}), (t, a) => (d(), i(e, null, [re(t.$slots, "default"), (d(!0), i(e, null, p(g(R), (t) => (d(), i(e, { key: t }, [T.value[t]?.length ? (d(), i("section", {
|
|
608
|
+
key: 0,
|
|
609
|
+
"data-sileo-viewport": "",
|
|
610
|
+
"data-position": t,
|
|
611
|
+
"aria-live": "polite",
|
|
612
|
+
style: ee(A(t))
|
|
613
|
+
}, [(d(!0), i(e, null, p(T.value[t], (e) => (d(), n(L, {
|
|
614
|
+
key: e.id,
|
|
615
|
+
id: e.id,
|
|
616
|
+
state: e.state,
|
|
617
|
+
title: e.title,
|
|
618
|
+
description: e.description,
|
|
619
|
+
position: g(x)(t),
|
|
620
|
+
expand: g(S)(t),
|
|
621
|
+
icon: e.icon,
|
|
622
|
+
fill: e.fill,
|
|
623
|
+
styles: e.styles,
|
|
624
|
+
button: e.button,
|
|
625
|
+
roundness: e.roundness,
|
|
626
|
+
exiting: e.exiting,
|
|
627
|
+
"auto-expand-delay-ms": e.autoExpandDelayMs,
|
|
628
|
+
"auto-collapse-delay-ms": e.autoCollapseDelayMs,
|
|
629
|
+
"refresh-key": e.instanceId,
|
|
630
|
+
"can-expand": c.value === void 0 || c.value === e.id,
|
|
631
|
+
onMouseenter: (t) => k(e.id).enter(t),
|
|
632
|
+
onMouseleave: (t) => k(e.id).leave(t),
|
|
633
|
+
onDismiss: (t) => k(e.id).dismiss()
|
|
634
|
+
}, null, 8, [
|
|
635
|
+
"id",
|
|
636
|
+
"state",
|
|
637
|
+
"title",
|
|
638
|
+
"description",
|
|
639
|
+
"position",
|
|
640
|
+
"expand",
|
|
641
|
+
"icon",
|
|
642
|
+
"fill",
|
|
643
|
+
"styles",
|
|
644
|
+
"button",
|
|
645
|
+
"roundness",
|
|
646
|
+
"exiting",
|
|
647
|
+
"auto-expand-delay-ms",
|
|
648
|
+
"auto-collapse-delay-ms",
|
|
649
|
+
"refresh-key",
|
|
650
|
+
"can-expand",
|
|
651
|
+
"onMouseenter",
|
|
652
|
+
"onMouseleave",
|
|
653
|
+
"onDismiss"
|
|
654
|
+
]))), 128))], 12, z)) : r("", !0)], 64))), 128))], 64));
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
export { B as Toaster, N as sileo };
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-sileo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "An opinionated, physics-based toast notification library for Vue.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Syndrom7/vue-sileo.git"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"vue",
|
|
12
|
+
"vue3",
|
|
13
|
+
"toast",
|
|
14
|
+
"notification",
|
|
15
|
+
"sileo",
|
|
16
|
+
"notifications",
|
|
17
|
+
"alert",
|
|
18
|
+
"message",
|
|
19
|
+
"physics",
|
|
20
|
+
"animation"
|
|
21
|
+
],
|
|
22
|
+
"author": "Syndrom7",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Syndrom7/vue-sileo/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/Syndrom7/vue-sileo#readme",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/vue-sileo.d.ts",
|
|
32
|
+
"default": "./dist/vue-sileo.mjs"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/vue-sileo.d.ts",
|
|
36
|
+
"default": "./dist/vue-sileo.cjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"./styles.css": "./dist/vue-sileo.css"
|
|
40
|
+
},
|
|
41
|
+
"main": "./dist/vue-sileo.cjs",
|
|
42
|
+
"module": "./dist/vue-sileo.mjs",
|
|
43
|
+
"types": "./dist/vue-sileo.d.ts",
|
|
44
|
+
"files": [
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"dev": "vite",
|
|
49
|
+
"build": "vue-tsc -b && vite build",
|
|
50
|
+
"preview": "vite preview"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"vue": ">=3.3"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^24.10.1",
|
|
57
|
+
"@vitejs/plugin-vue": "^6.0.2",
|
|
58
|
+
"@vue/tsconfig": "^0.8.1",
|
|
59
|
+
"typescript": "~5.9.3",
|
|
60
|
+
"vite": "^8.0.0-beta.13",
|
|
61
|
+
"vite-plugin-dts": "^4.5.4",
|
|
62
|
+
"vue": "^3.5.25",
|
|
63
|
+
"vue-tsc": "^3.1.5"
|
|
64
|
+
},
|
|
65
|
+
"overrides": {
|
|
66
|
+
"vite": "^8.0.0-beta.13"
|
|
67
|
+
}
|
|
68
|
+
}
|