@cas-smartdesign/snackbar 3.0.1 → 3.0.2
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/dist/docs/doc.mjs +2 -3
- package/package.json +3 -3
- package/readme.md +0 -2
package/dist/docs/doc.mjs
CHANGED
|
@@ -242,7 +242,7 @@ export { createSlideAnimationParams, createMessage, createErrorMessage, createCl
|
|
|
242
242
|
>
|
|
243
243
|
${this.renderSnackbarContent(e,t==null?void 0:t.closeAction)}
|
|
244
244
|
</sd-snackbar>
|
|
245
|
-
`}renderSnackbarContent(e,t){return Ce` ${e}${t||""} `}updateQueue(){if(this._queue.length===0)return;const{direction:e,snackbar:t}=this._queue[0];e==="in"?this._rendered.length===this.maxStack?this.requestOldestSnackbarClose():(this.prepareSnackbarForRender(t),this._rendered.push(t),this.renderSnackbars(),this._queue.shift(),this.updateQueue()):this.requestSnackbarClose(t.id)}requestOldestSnackbarClose(){const e=this._rendered.find(({requestClose:t,options:n})=>!t&&(n==null?void 0:n.autoHideDuration));e&&(e.requestClose=!0,this._queue.unshift({snackbar:e,direction:"out"}),this.updateQueue())}requestSnackbarClose(e){const t=this._rendered.findIndex(n=>n.id===e);if(t!==-1){const n=this._rendered[t];n.closing||(n.requestClose=!0,window.clearTimeout(n.timer),this.closeSnackbar(t))}}closeSnackbar(e){var r;const t=this._rendered[e],n=this.children.item(e);n&&(t.closing=!0,(r=t.options)!=null&&r.waitOnHover&&n.matches(":hover")?n.addEventListener("mouseleave",()=>{n.close().then(()=>{this.removeSnackbarAndUpdate(t)})}):n.close().then(()=>{this.removeSnackbarAndUpdate(t)}))}removeSnackbarAndUpdate(e){this.removeSnackbarFromQueue(e),this.removeSnackbarFromRendered(e),this.requestUpdate(),this.updateComplete.then(()=>this.updateQueue())}removeSnackbarFromQueue(e){const t=this._queue.findIndex(({snackbar:n})=>n.id===e.id);t!==-1&&this._queue.splice(t,1)}removeSnackbarFromRendered(e){const t=this._rendered.findIndex(n=>n.id==e.id);t!==-1&&this._rendered.splice(t,1)}setupTimeoutForAutoHideSnackbar(e){e.timer=window.setTimeout(()=>{this._queue.push({snackbar:e,direction:"out"}),this.updateQueue()},e.options.autoHideDuration)}prepareSnackbarForRender(e){const{options:t,message:n}=e;if(n.slot="message",t){const{autoHideDuration:r,waitForMouseMove:o}=t;r&&(o?this.listenForMouseMove(e):this.setupTimeoutForAutoHideSnackbar(e)),this.setupAction(e)}}listenForMouseMove(e){window.addEventListener("mousemove",this.handleWindowMouseMove.bind(this,e),{once:!0})}handleWindowMouseMove(e){this.setupTimeoutForAutoHideSnackbar(e)}setupAction(e){const{options:{closeAction:t}}=e;t&&(t.addEventListener("click",()=>{this._queue.unshift({snackbar:e,direction:"out"}),this.updateQueue()}),t.slot="action")}},Z.ID="sd-snackbar-provider",Z.ensureDefined=()=>{Ft.ensureDefined(),customElements.get(Z.ID)||customElements.define(Z.ID,Z)},Z);Ri([Pi({type:String,reflect:!0,attribute:"vertical-position"})],un.prototype,"verticalPosition",2);Ri([Pi({type:String,reflect:!0,attribute:"horizontal-position"})],un.prototype,"horizontalPosition",2);let
|
|
245
|
+
`}renderSnackbarContent(e,t){return Ce` ${e}${t||""} `}updateQueue(){if(this._queue.length===0)return;const{direction:e,snackbar:t}=this._queue[0];e==="in"?this._rendered.length===this.maxStack?this.requestOldestSnackbarClose():(this.prepareSnackbarForRender(t),this._rendered.push(t),this.renderSnackbars(),this._queue.shift(),this.updateQueue()):this.requestSnackbarClose(t.id)}requestOldestSnackbarClose(){const e=this._rendered.find(({requestClose:t,options:n})=>!t&&(n==null?void 0:n.autoHideDuration));e&&(e.requestClose=!0,this._queue.unshift({snackbar:e,direction:"out"}),this.updateQueue())}requestSnackbarClose(e){const t=this._rendered.findIndex(n=>n.id===e);if(t!==-1){const n=this._rendered[t];n.closing||(n.requestClose=!0,window.clearTimeout(n.timer),this.closeSnackbar(t))}}closeSnackbar(e){var r;const t=this._rendered[e],n=this.children.item(e);n&&(t.closing=!0,(r=t.options)!=null&&r.waitOnHover&&n.matches(":hover")?n.addEventListener("mouseleave",()=>{n.close().then(()=>{this.removeSnackbarAndUpdate(t)})}):n.close().then(()=>{this.removeSnackbarAndUpdate(t)}))}removeSnackbarAndUpdate(e){this.removeSnackbarFromQueue(e),this.removeSnackbarFromRendered(e),this.requestUpdate(),this.updateComplete.then(()=>this.updateQueue())}removeSnackbarFromQueue(e){const t=this._queue.findIndex(({snackbar:n})=>n.id===e.id);t!==-1&&this._queue.splice(t,1)}removeSnackbarFromRendered(e){const t=this._rendered.findIndex(n=>n.id==e.id);t!==-1&&this._rendered.splice(t,1)}setupTimeoutForAutoHideSnackbar(e){e.timer=window.setTimeout(()=>{this._queue.push({snackbar:e,direction:"out"}),this.updateQueue()},e.options.autoHideDuration)}prepareSnackbarForRender(e){const{options:t,message:n}=e;if(n.slot="message",t){const{autoHideDuration:r,waitForMouseMove:o}=t;r&&(o?this.listenForMouseMove(e):this.setupTimeoutForAutoHideSnackbar(e)),this.setupAction(e)}}listenForMouseMove(e){window.addEventListener("mousemove",this.handleWindowMouseMove.bind(this,e),{once:!0})}handleWindowMouseMove(e){this.setupTimeoutForAutoHideSnackbar(e)}setupAction(e){const{options:{closeAction:t}}=e;t&&(t.addEventListener("click",()=>{this._queue.unshift({snackbar:e,direction:"out"}),this.updateQueue()}),t.slot="action")}},Z.ID="sd-snackbar-provider",Z.ensureDefined=()=>{Ft.ensureDefined(),customElements.get(Z.ID)||customElements.define(Z.ID,Z)},Z);Ri([Pi({type:String,reflect:!0,attribute:"vertical-position"})],un.prototype,"verticalPosition",2);Ri([Pi({type:String,reflect:!0,attribute:"horizontal-position"})],un.prototype,"horizontalPosition",2);let Ol=un;const re=class re extends ge{static get styles(){return[bi`
|
|
246
246
|
${ln(rs)}
|
|
247
247
|
`]}firstUpdated(e){if(super.firstUpdated(e),this.animationIn){const{keyframes:t,options:n}=this.animationIn;this.animate(t,n)}}close(){return new Promise(e=>{if(this.animationOut){const{keyframes:t,options:n}=this.animationOut,r=this.animate(t,n);r.onfinish=()=>{this.collapse(),this.addEventListener("transitionend",({propertyName:o})=>{o==="height"&&e()})}}else this.collapse(),e()})}render(){return Ce`
|
|
248
248
|
<div class="root">
|
|
@@ -403,8 +403,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),P=h,S=m),x===void 0&&(
|
|
|
403
403
|
</ul>
|
|
404
404
|
</li>
|
|
405
405
|
</ul>
|
|
406
|
-
|
|
407
|
-
`;document.querySelector("#markdown-container").innerHTML=_l;wl(Object.assign({"./examples/configurable_example/index.ts":Jr}));export{Cl as S};
|
|
406
|
+
`,Sl=document.querySelector("#markdown-container");Sl.innerHTML=_l;wl(Object.assign({"./examples/configurable_example/index.ts":Jr}),document.querySelector(".markdown-body"));export{Ol as S};
|
|
408
407
|
function __vite__mapDeps(indexes) {
|
|
409
408
|
if (!__vite__mapDeps.viteFileDeps) {
|
|
410
409
|
__vite__mapDeps.viteFileDeps = []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cas-smartdesign/snackbar",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A snackbar element based on LitElement",
|
|
5
5
|
"main": "dist/snackbar-with-externals.js",
|
|
6
6
|
"module": "dist/snackbar.mjs",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@cas-smartdesign/element-preview": "^0.2.
|
|
22
|
-
"@cas-smartdesign/license-generator": "^1.6.
|
|
21
|
+
"@cas-smartdesign/element-preview": "^0.2.2",
|
|
22
|
+
"@cas-smartdesign/license-generator": "^1.6.3"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"version": "pnpm version",
|
package/readme.md
CHANGED
|
@@ -77,5 +77,3 @@ A highly configurable element for displaying toast notifications based on [lit-e
|
|
|
77
77
|
- The animation played when:
|
|
78
78
|
- opening a snackbar can be set by the animationIn property on the SnackbarProvider
|
|
79
79
|
- closing a snackbar can be set by the animationOut property on the SnackbarProvider
|
|
80
|
-
|
|
81
|
-
## Demo
|