@cas-smartdesign/snackbar 3.0.1 → 3.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/dist/docs/doc.css +1 -1
- package/dist/docs/doc.mjs +44 -48
- package/dist/snackbar-with-externals.js +15 -45
- package/dist/snackbar-with-externals.js.map +4 -4
- package/dist/snackbar.mjs +27 -29
- package/dist/snackbar.mjs.map +1 -1
- package/npm-third-party-licenses.json +52 -47
- package/package.json +4 -4
- package/readme.md +0 -2
package/dist/snackbar.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { LitElement as l,
|
|
1
|
+
import { LitElement as l, unsafeCSS as m, css as p, html as a, render as b } from "lit";
|
|
2
2
|
import { property as f } from "lit/decorators/property.js";
|
|
3
3
|
import { repeat as k } from "lit/directives/repeat.js";
|
|
4
4
|
import { ifDefined as S } from "lit/directives/if-defined.js";
|
|
5
5
|
const g = ":host{display:block;contain:layout;margin-top:6px;margin-bottom:6px;position:relative;transition:height var(--sd-snackbar-height-transition-duration, .4s)}.root{display:flex;width:100%;height:100%}", x = ":host{position:fixed;display:flex;flex-direction:column;box-sizing:border-box;max-height:100%;contain:layout}:host([vertical-position=bottom]){flex-direction:column-reverse;bottom:var(--sd-snackbar-vertical-offset, 14px)}:host([vertical-position=top]){top:var(--sd-snackbar-vertical-offset, 14px)}:host([horizontal-position=left]){left:var(--sd-snackbar-horizontal-offset, 20px)}:host([horizontal-position=center]){left:50%;transform:translate(-50%)}:host([horizontal-position=right]){right:var(--sd-snackbar-horizontal-offset, 20px)}";
|
|
6
|
-
var q = Object.defineProperty,
|
|
7
|
-
for (var s =
|
|
8
|
-
(
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
const
|
|
6
|
+
var q = Object.defineProperty, v = (h, e, t, i) => {
|
|
7
|
+
for (var s = void 0, n = h.length - 1, c; n >= 0; n--)
|
|
8
|
+
(c = h[n]) && (s = c(e, t, s) || s);
|
|
9
|
+
return s && q(e, t, s), s;
|
|
10
|
+
}, o;
|
|
11
|
+
const u = (o = class extends l {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments), this.verticalPosition = "bottom", this.horizontalPosition = "left", this.maxStack = 3, this.shouldCloseOldest = !1, this._queue = [], this._rendered = [];
|
|
14
14
|
}
|
|
15
15
|
static get styles() {
|
|
16
16
|
return [
|
|
17
|
-
|
|
18
|
-
${
|
|
17
|
+
p`
|
|
18
|
+
${m(x)}
|
|
19
19
|
`
|
|
20
20
|
];
|
|
21
21
|
}
|
|
@@ -41,14 +41,13 @@ const c = (n = class extends l {
|
|
|
41
41
|
e ? this.requestSnackbarClose(e) : this._rendered.forEach(({ id: t }) => this.requestSnackbarClose(t));
|
|
42
42
|
}
|
|
43
43
|
renderSnackbar({ message: e, options: t = {} }) {
|
|
44
|
-
var i;
|
|
45
44
|
return a`
|
|
46
45
|
<sd-snackbar
|
|
47
|
-
class="${S(
|
|
46
|
+
class="${S(t.classNames?.length > 0 ? t.classNames.join(" ") : void 0)}"
|
|
48
47
|
.animationIn="${this.animationIn}"
|
|
49
48
|
.animationOut="${this.animationOut}"
|
|
50
49
|
>
|
|
51
|
-
${this.renderSnackbarContent(e, t
|
|
50
|
+
${this.renderSnackbarContent(e, t?.closeAction)}
|
|
52
51
|
</sd-snackbar>
|
|
53
52
|
`;
|
|
54
53
|
}
|
|
@@ -63,7 +62,7 @@ const c = (n = class extends l {
|
|
|
63
62
|
}
|
|
64
63
|
requestOldestSnackbarClose() {
|
|
65
64
|
const e = this._rendered.find(
|
|
66
|
-
({ requestClose: t, options: i }) => !t &&
|
|
65
|
+
({ requestClose: t, options: i }) => !t && i?.autoHideDuration
|
|
67
66
|
);
|
|
68
67
|
e && (e.requestClose = !0, this._queue.unshift({ snackbar: e, direction: "out" }), this.updateQueue());
|
|
69
68
|
}
|
|
@@ -75,9 +74,8 @@ const c = (n = class extends l {
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
closeSnackbar(e) {
|
|
78
|
-
var s;
|
|
79
77
|
const t = this._rendered[e], i = this.children.item(e);
|
|
80
|
-
i && (t.closing = !0,
|
|
78
|
+
i && (t.closing = !0, t.options?.waitOnHover && i.matches(":hover") ? i.addEventListener("mouseleave", () => {
|
|
81
79
|
i.close().then(() => {
|
|
82
80
|
this.removeSnackbarAndUpdate(t);
|
|
83
81
|
});
|
|
@@ -104,8 +102,8 @@ const c = (n = class extends l {
|
|
|
104
102
|
prepareSnackbarForRender(e) {
|
|
105
103
|
const { options: t, message: i } = e;
|
|
106
104
|
if (i.slot = "message", t) {
|
|
107
|
-
const { autoHideDuration: s, waitForMouseMove:
|
|
108
|
-
s && (
|
|
105
|
+
const { autoHideDuration: s, waitForMouseMove: n } = t;
|
|
106
|
+
s && (n ? this.listenForMouseMove(e) : this.setupTimeoutForAutoHideSnackbar(e)), this.setupAction(e);
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
listenForMouseMove(e) {
|
|
@@ -122,21 +120,21 @@ const c = (n = class extends l {
|
|
|
122
120
|
this._queue.unshift({ snackbar: e, direction: "out" }), this.updateQueue();
|
|
123
121
|
}), t.slot = "action");
|
|
124
122
|
}
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
},
|
|
123
|
+
}, o.ID = "sd-snackbar-provider", o.ensureDefined = () => {
|
|
124
|
+
d.ensureDefined(), customElements.get(o.ID) || customElements.define(o.ID, o);
|
|
125
|
+
}, o);
|
|
128
126
|
v([
|
|
129
127
|
f({ type: String, reflect: !0, attribute: "vertical-position" })
|
|
130
|
-
],
|
|
128
|
+
], u.prototype, "verticalPosition");
|
|
131
129
|
v([
|
|
132
130
|
f({ type: String, reflect: !0, attribute: "horizontal-position" })
|
|
133
|
-
],
|
|
134
|
-
let F =
|
|
131
|
+
], u.prototype, "horizontalPosition");
|
|
132
|
+
let F = u;
|
|
135
133
|
const r = class r extends l {
|
|
136
134
|
static get styles() {
|
|
137
135
|
return [
|
|
138
|
-
|
|
139
|
-
${
|
|
136
|
+
p`
|
|
137
|
+
${m(g)}
|
|
140
138
|
`
|
|
141
139
|
];
|
|
142
140
|
}
|
|
@@ -151,8 +149,8 @@ const r = class r extends l {
|
|
|
151
149
|
if (this.animationOut) {
|
|
152
150
|
const { keyframes: t, options: i } = this.animationOut, s = this.animate(t, i);
|
|
153
151
|
s.onfinish = () => {
|
|
154
|
-
this.collapse(), this.addEventListener("transitionend", ({ propertyName:
|
|
155
|
-
|
|
152
|
+
this.collapse(), this.addEventListener("transitionend", ({ propertyName: n }) => {
|
|
153
|
+
n === "height" && e();
|
|
156
154
|
});
|
|
157
155
|
};
|
|
158
156
|
} else
|
|
@@ -178,9 +176,9 @@ const r = class r extends l {
|
|
|
178
176
|
r.ID = "sd-snackbar", r.ensureDefined = () => {
|
|
179
177
|
customElements.get(r.ID) || customElements.define(r.ID, r);
|
|
180
178
|
};
|
|
181
|
-
let
|
|
179
|
+
let d = r;
|
|
182
180
|
export {
|
|
183
|
-
|
|
181
|
+
d as Snackbar,
|
|
184
182
|
F as SnackbarProvider
|
|
185
183
|
};
|
|
186
184
|
//# sourceMappingURL=snackbar.mjs.map
|
package/dist/snackbar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snackbar.mjs","sources":["../snackbar-provider.ts","../snackbar.ts"],"sourcesContent":["import { LitElement, TemplateResult, html, unsafeCSS, css, render } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport type { VerticalPosition, HorizontalPosition, ISnackbar, IAnimationParams, IAction } from \"./types\";\nimport { Snackbar } from \"./snackbar\";\n\nimport style from \"./scss/provider.scss?inline\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [SnackbarProvider.ID]: SnackbarProvider;\n }\n}\n\nclass SnackbarProvider extends LitElement {\n public static readonly ID = \"sd-snackbar-provider\";\n public static ensureDefined = (): void => {\n Snackbar.ensureDefined();\n if (!customElements.get(SnackbarProvider.ID)) {\n customElements.define(SnackbarProvider.ID, SnackbarProvider);\n }\n };\n @property({ type: String, reflect: true, attribute: \"vertical-position\" })\n public verticalPosition: VerticalPosition = \"bottom\";\n @property({ type: String, reflect: true, attribute: \"horizontal-position\" })\n public horizontalPosition: HorizontalPosition = \"left\";\n public maxStack = 3;\n public animationIn: IAnimationParams;\n public animationOut: IAnimationParams;\n public shouldCloseOldest = false;\n\n private _queue: IAction[] = [];\n private _rendered: ISnackbar[] = [];\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public render(): TemplateResult {\n this.renderSnackbars();\n return html` <slot></slot> `;\n }\n\n public renderSnackbars(): void {\n render(\n html`\n ${repeat(\n this._rendered,\n ({ id }) => id,\n (snackbar) => this.renderSnackbar(snackbar),\n )}\n `,\n this,\n );\n }\n\n public open(snackbar: ISnackbar): void {\n this._queue.push({ snackbar, direction: \"in\" });\n this.updateQueue();\n }\n\n public close(snackId?: string): void {\n snackId\n ? this.requestSnackbarClose(snackId)\n : this._rendered.forEach(({ id }) => this.requestSnackbarClose(id));\n }\n\n private renderSnackbar({ message, options = {} }: ISnackbar): TemplateResult {\n return html`\n <sd-snackbar\n class=\"${ifDefined(options.classNames?.length > 0 ? options.classNames.join(\" \") : undefined)}\"\n .animationIn=\"${this.animationIn}\"\n .animationOut=\"${this.animationOut}\"\n >\n ${this.renderSnackbarContent(message, options?.closeAction)}\n </sd-snackbar>\n `;\n }\n\n private renderSnackbarContent(message: HTMLElement, action?: HTMLElement): TemplateResult {\n return html` ${message}${action ? action : \"\"} `;\n }\n\n private updateQueue(): void {\n if (this._queue.length === 0) {\n return;\n }\n\n const { direction, snackbar } = this._queue[0];\n if (direction === \"in\") {\n if (this._rendered.length === this.maxStack) {\n this.requestOldestSnackbarClose();\n } else {\n this.prepareSnackbarForRender(snackbar);\n this._rendered.push(snackbar);\n this.renderSnackbars();\n this._queue.shift();\n this.updateQueue();\n }\n } else {\n this.requestSnackbarClose(snackbar.id);\n }\n }\n\n private requestOldestSnackbarClose(): void {\n const oldestNotMarkedForLeave = this._rendered.find(\n ({ requestClose, options }) => !requestClose && options?.autoHideDuration,\n );\n if (oldestNotMarkedForLeave) {\n oldestNotMarkedForLeave.requestClose = true;\n this._queue.unshift({ snackbar: oldestNotMarkedForLeave, direction: \"out\" });\n this.updateQueue();\n }\n }\n\n private requestSnackbarClose(id?: string): void {\n const ind = this._rendered.findIndex((snack) => snack.id === id);\n if (ind !== -1) {\n const snackbar = this._rendered[ind];\n if (!snackbar.closing) {\n snackbar.requestClose = true;\n window.clearTimeout(snackbar.timer);\n this.closeSnackbar(ind);\n }\n }\n }\n\n private closeSnackbar(ind: number): void {\n const snackbar = this._rendered[ind];\n const snackbarElement = (this.children as HTMLCollectionOf<Snackbar>).item(ind);\n if (snackbarElement) {\n snackbar.closing = true;\n if (snackbar.options?.waitOnHover && snackbarElement.matches(\":hover\")) {\n snackbarElement.addEventListener(\"mouseleave\", () => {\n snackbarElement.close().then(() => {\n this.removeSnackbarAndUpdate(snackbar);\n });\n });\n } else {\n snackbarElement.close().then(() => {\n this.removeSnackbarAndUpdate(snackbar);\n });\n }\n }\n }\n\n private removeSnackbarAndUpdate(snackbar: ISnackbar): void {\n this.removeSnackbarFromQueue(snackbar);\n this.removeSnackbarFromRendered(snackbar);\n\n this.requestUpdate();\n this.updateComplete.then(() => this.updateQueue());\n }\n\n private removeSnackbarFromQueue(snack: ISnackbar): void {\n const ind = this._queue.findIndex(({ snackbar }) => snackbar.id === snack.id);\n if (ind !== -1) {\n this._queue.splice(ind, 1);\n }\n }\n\n private removeSnackbarFromRendered(snack: ISnackbar): void {\n const ind = this._rendered.findIndex((snackbar) => snackbar.id == snack.id);\n if (ind !== -1) {\n this._rendered.splice(ind, 1);\n }\n }\n\n private setupTimeoutForAutoHideSnackbar(snackbar: ISnackbar): void {\n snackbar.timer = window.setTimeout(() => {\n this._queue.push({ snackbar, direction: \"out\" });\n this.updateQueue();\n }, snackbar.options.autoHideDuration);\n }\n\n private prepareSnackbarForRender(snackbar: ISnackbar): void {\n const { options, message } = snackbar;\n message.slot = \"message\";\n if (options) {\n const { autoHideDuration, waitForMouseMove } = options;\n if (autoHideDuration) {\n if (waitForMouseMove) {\n this.listenForMouseMove(snackbar);\n } else {\n this.setupTimeoutForAutoHideSnackbar(snackbar);\n }\n }\n\n this.setupAction(snackbar);\n }\n }\n\n private listenForMouseMove(snackbar: ISnackbar): void {\n window.addEventListener(\"mousemove\", this.handleWindowMouseMove.bind(this, snackbar), { once: true });\n }\n\n private handleWindowMouseMove(snackbar: ISnackbar): void {\n this.setupTimeoutForAutoHideSnackbar(snackbar);\n }\n\n private setupAction(snackbar: ISnackbar): void {\n const {\n options: { closeAction: action },\n } = snackbar;\n if (action) {\n action.addEventListener(\"click\", () => {\n this._queue.unshift({ snackbar, direction: \"out\" });\n this.updateQueue();\n });\n action.slot = \"action\";\n }\n }\n}\n\nexport { SnackbarProvider };\n","import { LitElement, TemplateResult, html, unsafeCSS, PropertyValues, css } from \"lit\";\nimport type { IAnimationParams } from \"./types\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Snackbar.ID]: Snackbar;\n }\n}\nimport style from \"./scss/snackbar.scss?inline\";\n\nclass Snackbar extends LitElement {\n public static readonly ID = \"sd-snackbar\";\n public static ensureDefined = (): void => {\n if (!customElements.get(Snackbar.ID)) {\n customElements.define(Snackbar.ID, Snackbar);\n }\n };\n\n public animationIn: IAnimationParams;\n public animationOut: IAnimationParams;\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n if (this.animationIn) {\n const { keyframes, options } = this.animationIn;\n this.animate(keyframes, options);\n }\n }\n\n public close(): Promise<void> {\n return new Promise<void>((resolve) => {\n if (this.animationOut) {\n const { keyframes, options } = this.animationOut;\n const animation = this.animate(keyframes, options);\n animation.onfinish = () => {\n // height and opacity are needed to be set to 0\n // so that moving newer snackbars can be animated\n this.collapse();\n this.addEventListener(\"transitionend\", ({ propertyName }) => {\n if (propertyName === \"height\") {\n resolve();\n }\n });\n };\n } else {\n this.collapse();\n resolve();\n }\n });\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"root\">\n <div class=\"message\">\n <slot name=\"message\"></slot>\n </div>\n <div class=\"action\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n `;\n }\n\n private collapse(): void {\n this.style.height = \"0\";\n this.style.opacity = \"0\";\n }\n}\n\nexport { Snackbar };\nexport * from \"./snackbar-provider\";\nexport type * from \"./types\";\n"],"names":["_SnackbarProvider","_a","LitElement","css","unsafeCSS","style","html","render","repeat","id","snackbar","snackId","message","options","ifDefined","action","direction","oldestNotMarkedForLeave","requestClose","ind","snack","snackbarElement","autoHideDuration","waitForMouseMove","Snackbar","__decorateClass","property","SnackbarProvider","_Snackbar","changedProperties","keyframes","resolve","animation","propertyName"],"mappings":";;;;;;;;;;AAeA,MAAMA,KAANC,IAAA,cAA+BC,EAAW;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA,GASI,KAAO,mBAAqC,UAE5C,KAAO,qBAAyC,QAChD,KAAO,WAAW,GAGlB,KAAO,oBAAoB,IAE3B,KAAQ,SAAoB,IAC5B,KAAQ,YAAyB;EAAC;AAAA,EAElC,WAAW,SAAS;AACT,WAAA;AAAA,MACHC;AAAA,kBACMC,EAAUC,CAAK,CAAC;AAAA;AAAA,IAAA;AAAA,EAG9B;AAAA,EAEO,SAAyB;AAC5B,gBAAK,gBAAgB,GACdC;AAAA,EACX;AAAA,EAEO,kBAAwB;AAC3B,IAAAC;AAAA,MACID;AAAA,kBACME;AAAA,QACE,KAAK;AAAA,QACL,CAAC,EAAE,IAAAC,EAAA,MAASA;AAAA,QACZ,CAACC,MAAa,KAAK,eAAeA,CAAQ;AAAA,MAAA,CAC7C;AAAA;AAAA,MAEL;AAAA,IAAA;AAAA,EAER;A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,UAAU;AAAA,EACzB;AACJ;AAjEIsB,EAAuB,KAAK,eAC5BA,EAAc,gBAAgB,MAAY;AACtC,EAAK,eAAe,IAAIA,EAAS,EAAE,KAChB,eAAA,OAAOA,EAAS,IAAIA,CAAQ;AAC/C;AALR,IAAMJ,IAANI;"}
|
|
1
|
+
{"version":3,"file":"snackbar.mjs","sources":["../snackbar-provider.ts","../snackbar.ts"],"sourcesContent":["import { LitElement, TemplateResult, html, unsafeCSS, css, render } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport type { VerticalPosition, HorizontalPosition, ISnackbar, IAnimationParams, IAction } from \"./types\";\nimport { Snackbar } from \"./snackbar\";\n\nimport style from \"./scss/provider.scss?inline\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [SnackbarProvider.ID]: SnackbarProvider;\n }\n}\n\nclass SnackbarProvider extends LitElement {\n public static readonly ID = \"sd-snackbar-provider\";\n public static ensureDefined = (): void => {\n Snackbar.ensureDefined();\n if (!customElements.get(SnackbarProvider.ID)) {\n customElements.define(SnackbarProvider.ID, SnackbarProvider);\n }\n };\n @property({ type: String, reflect: true, attribute: \"vertical-position\" })\n public verticalPosition: VerticalPosition = \"bottom\";\n @property({ type: String, reflect: true, attribute: \"horizontal-position\" })\n public horizontalPosition: HorizontalPosition = \"left\";\n public maxStack = 3;\n public animationIn: IAnimationParams;\n public animationOut: IAnimationParams;\n public shouldCloseOldest = false;\n\n private _queue: IAction[] = [];\n private _rendered: ISnackbar[] = [];\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public render(): TemplateResult {\n this.renderSnackbars();\n return html` <slot></slot> `;\n }\n\n public renderSnackbars(): void {\n render(\n html`\n ${repeat(\n this._rendered,\n ({ id }) => id,\n (snackbar) => this.renderSnackbar(snackbar),\n )}\n `,\n this,\n );\n }\n\n public open(snackbar: ISnackbar): void {\n this._queue.push({ snackbar, direction: \"in\" });\n this.updateQueue();\n }\n\n public close(snackId?: string): void {\n if (snackId) {\n this.requestSnackbarClose(snackId);\n } else {\n this._rendered.forEach(({ id }) => this.requestSnackbarClose(id));\n }\n }\n\n private renderSnackbar({ message, options = {} }: ISnackbar): TemplateResult {\n return html`\n <sd-snackbar\n class=\"${ifDefined(options.classNames?.length > 0 ? options.classNames.join(\" \") : undefined)}\"\n .animationIn=\"${this.animationIn}\"\n .animationOut=\"${this.animationOut}\"\n >\n ${this.renderSnackbarContent(message, options?.closeAction)}\n </sd-snackbar>\n `;\n }\n\n private renderSnackbarContent(message: HTMLElement, action?: HTMLElement): TemplateResult {\n return html` ${message}${action ? action : \"\"} `;\n }\n\n private updateQueue(): void {\n if (this._queue.length === 0) {\n return;\n }\n\n const { direction, snackbar } = this._queue[0];\n if (direction === \"in\") {\n if (this._rendered.length === this.maxStack) {\n this.requestOldestSnackbarClose();\n } else {\n this.prepareSnackbarForRender(snackbar);\n this._rendered.push(snackbar);\n this.renderSnackbars();\n this._queue.shift();\n this.updateQueue();\n }\n } else {\n this.requestSnackbarClose(snackbar.id);\n }\n }\n\n private requestOldestSnackbarClose(): void {\n const oldestNotMarkedForLeave = this._rendered.find(\n ({ requestClose, options }) => !requestClose && options?.autoHideDuration,\n );\n if (oldestNotMarkedForLeave) {\n oldestNotMarkedForLeave.requestClose = true;\n this._queue.unshift({ snackbar: oldestNotMarkedForLeave, direction: \"out\" });\n this.updateQueue();\n }\n }\n\n private requestSnackbarClose(id?: string): void {\n const ind = this._rendered.findIndex((snack) => snack.id === id);\n if (ind !== -1) {\n const snackbar = this._rendered[ind];\n if (!snackbar.closing) {\n snackbar.requestClose = true;\n window.clearTimeout(snackbar.timer);\n this.closeSnackbar(ind);\n }\n }\n }\n\n private closeSnackbar(ind: number): void {\n const snackbar = this._rendered[ind];\n const snackbarElement = (this.children as HTMLCollectionOf<Snackbar>).item(ind);\n if (snackbarElement) {\n snackbar.closing = true;\n if (snackbar.options?.waitOnHover && snackbarElement.matches(\":hover\")) {\n snackbarElement.addEventListener(\"mouseleave\", () => {\n snackbarElement.close().then(() => {\n this.removeSnackbarAndUpdate(snackbar);\n });\n });\n } else {\n snackbarElement.close().then(() => {\n this.removeSnackbarAndUpdate(snackbar);\n });\n }\n }\n }\n\n private removeSnackbarAndUpdate(snackbar: ISnackbar): void {\n this.removeSnackbarFromQueue(snackbar);\n this.removeSnackbarFromRendered(snackbar);\n\n this.requestUpdate();\n this.updateComplete.then(() => this.updateQueue());\n }\n\n private removeSnackbarFromQueue(snack: ISnackbar): void {\n const ind = this._queue.findIndex(({ snackbar }) => snackbar.id === snack.id);\n if (ind !== -1) {\n this._queue.splice(ind, 1);\n }\n }\n\n private removeSnackbarFromRendered(snack: ISnackbar): void {\n const ind = this._rendered.findIndex((snackbar) => snackbar.id == snack.id);\n if (ind !== -1) {\n this._rendered.splice(ind, 1);\n }\n }\n\n private setupTimeoutForAutoHideSnackbar(snackbar: ISnackbar): void {\n snackbar.timer = window.setTimeout(() => {\n this._queue.push({ snackbar, direction: \"out\" });\n this.updateQueue();\n }, snackbar.options.autoHideDuration);\n }\n\n private prepareSnackbarForRender(snackbar: ISnackbar): void {\n const { options, message } = snackbar;\n message.slot = \"message\";\n if (options) {\n const { autoHideDuration, waitForMouseMove } = options;\n if (autoHideDuration) {\n if (waitForMouseMove) {\n this.listenForMouseMove(snackbar);\n } else {\n this.setupTimeoutForAutoHideSnackbar(snackbar);\n }\n }\n\n this.setupAction(snackbar);\n }\n }\n\n private listenForMouseMove(snackbar: ISnackbar): void {\n window.addEventListener(\"mousemove\", this.handleWindowMouseMove.bind(this, snackbar), { once: true });\n }\n\n private handleWindowMouseMove(snackbar: ISnackbar): void {\n this.setupTimeoutForAutoHideSnackbar(snackbar);\n }\n\n private setupAction(snackbar: ISnackbar): void {\n const {\n options: { closeAction: action },\n } = snackbar;\n if (action) {\n action.addEventListener(\"click\", () => {\n this._queue.unshift({ snackbar, direction: \"out\" });\n this.updateQueue();\n });\n action.slot = \"action\";\n }\n }\n}\n\nexport { SnackbarProvider };\n","import { LitElement, TemplateResult, html, unsafeCSS, PropertyValues, css } from \"lit\";\nimport type { IAnimationParams } from \"./types\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Snackbar.ID]: Snackbar;\n }\n}\nimport style from \"./scss/snackbar.scss?inline\";\n\nclass Snackbar extends LitElement {\n public static readonly ID = \"sd-snackbar\";\n public static ensureDefined = (): void => {\n if (!customElements.get(Snackbar.ID)) {\n customElements.define(Snackbar.ID, Snackbar);\n }\n };\n\n public animationIn: IAnimationParams;\n public animationOut: IAnimationParams;\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n if (this.animationIn) {\n const { keyframes, options } = this.animationIn;\n this.animate(keyframes, options);\n }\n }\n\n public close(): Promise<void> {\n return new Promise<void>((resolve) => {\n if (this.animationOut) {\n const { keyframes, options } = this.animationOut;\n const animation = this.animate(keyframes, options);\n animation.onfinish = () => {\n // height and opacity are needed to be set to 0\n // so that moving newer snackbars can be animated\n this.collapse();\n this.addEventListener(\"transitionend\", ({ propertyName }) => {\n if (propertyName === \"height\") {\n resolve();\n }\n });\n };\n } else {\n this.collapse();\n resolve();\n }\n });\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"root\">\n <div class=\"message\">\n <slot name=\"message\"></slot>\n </div>\n <div class=\"action\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n `;\n }\n\n private collapse(): void {\n this.style.height = \"0\";\n this.style.opacity = \"0\";\n }\n}\n\nexport { Snackbar };\nexport * from \"./snackbar-provider\";\nexport type * from \"./types\";\n"],"names":["_SnackbarProvider","_a","LitElement","css","unsafeCSS","style","html","render","repeat","id","snackbar","snackId","message","options","ifDefined","action","direction","oldestNotMarkedForLeave","requestClose","ind","snack","snackbarElement","autoHideDuration","waitForMouseMove","Snackbar","__decorateClass","property","Snack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AAQiB,GAAWjB,CAAO;AAAA,IACnC;AAAA,EACJ;AAAA,EAEO,QAAuB;AAC1B,WAAO,IAAI,QAAc,CAACkB,MAAY;AAClC,UAAI,KAAK,cAAc;AACnB,cAAM,EAAE,WAAAD,GAAW,SAAAjB,EAAA,IAAY,KAAK,cAC9BmB,IAAY,KAAK,QAAQF,GAAWjB,CAAO;AACjD,QAAAmB,EAAU,WAAW,MAAM;AAGvB,eAAK,SAAA,GACL,KAAK,iBAAiB,iBAAiB,CAAC,EAAE,cAAAC,QAAmB;AACzD,YAAIA,MAAiB,YACjBF,EAAA;AAAA,UAER,CAAC;AAAA,QACL;AAAA,MACJ;AACI,aAAK,SAAA,GACLA,EAAA;AAAA,IAER,CAAC;AAAA,EACL;AAAA,EAEO,SAAyB;AAC5B,WAAOzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUX;AAAA,EAEQ,WAAiB;AACrB,SAAK,MAAM,SAAS,KACpB,KAAK,MAAM,UAAU;AAAA,EACzB;AACJ;AAjEIsB,EAAuB,KAAK,eAC5BA,EAAc,gBAAgB,MAAY;AACtC,EAAK,eAAe,IAAIA,EAAS,EAAE,KAC/B,eAAe,OAAOA,EAAS,IAAIA,CAAQ;AAEnD;AANJ,IAAMJ,IAANI;"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@cypress/vite-dev-server@
|
|
2
|
+
"@cypress/vite-dev-server@7.0.0": {
|
|
3
3
|
"licenses": "MIT",
|
|
4
4
|
"repository": "https://github.com/cypress-io/cypress",
|
|
5
5
|
"licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
6
|
},
|
|
7
|
-
"@
|
|
7
|
+
"@eslint/js@9.34.0": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/eslint/eslint",
|
|
10
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
11
|
+
},
|
|
12
|
+
"@rollup/plugin-node-resolve@16.0.1": {
|
|
8
13
|
"licenses": "MIT",
|
|
9
14
|
"repository": "https://github.com/rollup/plugins",
|
|
10
15
|
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
11
16
|
},
|
|
12
|
-
"@types/node@
|
|
17
|
+
"@types/node@24.3.0": {
|
|
13
18
|
"licenses": "MIT",
|
|
14
19
|
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
15
20
|
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
@@ -19,47 +24,42 @@
|
|
|
19
24
|
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
25
|
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
26
|
},
|
|
22
|
-
"@typescript-eslint/eslint-plugin@
|
|
27
|
+
"@typescript-eslint/eslint-plugin@8.41.0": {
|
|
23
28
|
"licenses": "MIT",
|
|
24
29
|
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
25
30
|
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
26
31
|
},
|
|
27
|
-
"@typescript-eslint/parser@
|
|
28
|
-
"licenses": "
|
|
32
|
+
"@typescript-eslint/parser@8.41.0": {
|
|
33
|
+
"licenses": "MIT",
|
|
29
34
|
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
35
|
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
36
|
},
|
|
32
|
-
"@vitest/coverage-v8@
|
|
37
|
+
"@vitest/coverage-v8@3.2.4": {
|
|
33
38
|
"licenses": "MIT",
|
|
34
39
|
"repository": "https://github.com/vitest-dev/vitest",
|
|
35
40
|
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
36
41
|
},
|
|
37
|
-
"@vitest/ui@
|
|
42
|
+
"@vitest/ui@3.2.4": {
|
|
38
43
|
"licenses": "MIT",
|
|
39
44
|
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
45
|
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
46
|
},
|
|
42
|
-
"axe-core@4.
|
|
47
|
+
"axe-core@4.10.3": {
|
|
43
48
|
"licenses": "MPL-2.0",
|
|
44
49
|
"repository": "https://github.com/dequelabs/axe-core",
|
|
45
50
|
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
46
51
|
},
|
|
47
|
-
"cypress-axe@1.
|
|
52
|
+
"cypress-axe@1.7.0": {
|
|
48
53
|
"licenses": "MIT",
|
|
49
54
|
"repository": "https://github.com/component-driven/cypress-axe",
|
|
50
55
|
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
51
56
|
},
|
|
52
|
-
"cypress
|
|
53
|
-
"licenses": "MIT",
|
|
54
|
-
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
55
|
-
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
56
|
-
},
|
|
57
|
-
"cypress@13.6.2": {
|
|
57
|
+
"cypress@15.0.0": {
|
|
58
58
|
"licenses": "MIT",
|
|
59
59
|
"repository": "https://github.com/cypress-io/cypress",
|
|
60
60
|
"licenseUrl": "https://cypress.io"
|
|
61
61
|
},
|
|
62
|
-
"esbuild@0.
|
|
62
|
+
"esbuild@0.25.9": {
|
|
63
63
|
"licenses": "MIT",
|
|
64
64
|
"repository": "https://github.com/evanw/esbuild",
|
|
65
65
|
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
@@ -69,57 +69,57 @@
|
|
|
69
69
|
"repository": "https://github.com/google/eslint-config-google",
|
|
70
70
|
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
71
71
|
},
|
|
72
|
-
"eslint-config-prettier@
|
|
72
|
+
"eslint-config-prettier@10.1.8": {
|
|
73
73
|
"licenses": "MIT",
|
|
74
74
|
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
75
75
|
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
76
76
|
},
|
|
77
|
-
"eslint@
|
|
77
|
+
"eslint@9.34.0": {
|
|
78
78
|
"licenses": "MIT",
|
|
79
79
|
"repository": "https://github.com/eslint/eslint",
|
|
80
80
|
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
81
81
|
},
|
|
82
|
-
"github-markdown-css@5.
|
|
82
|
+
"github-markdown-css@5.8.1": {
|
|
83
83
|
"licenses": "MIT",
|
|
84
84
|
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
85
85
|
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
86
86
|
},
|
|
87
|
-
"highlight.js@11.
|
|
87
|
+
"highlight.js@11.11.1": {
|
|
88
88
|
"licenses": "BSD-3-Clause",
|
|
89
89
|
"repository": "https://github.com/highlightjs/highlight.js",
|
|
90
90
|
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
91
91
|
},
|
|
92
|
-
"junit-report-builder@
|
|
92
|
+
"junit-report-builder@5.1.1": {
|
|
93
93
|
"licenses": "MIT",
|
|
94
94
|
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
95
95
|
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
96
96
|
},
|
|
97
|
-
"lint-staged@
|
|
97
|
+
"lint-staged@16.1.5": {
|
|
98
98
|
"licenses": "MIT",
|
|
99
|
-
"repository": "https://github.com/
|
|
100
|
-
"licenseUrl": "https://github.com/
|
|
99
|
+
"repository": "https://github.com/lint-staged/lint-staged",
|
|
100
|
+
"licenseUrl": "https://github.com/lint-staged/lint-staged/raw/HEAD/LICENSE"
|
|
101
101
|
},
|
|
102
|
-
"lit@
|
|
102
|
+
"lit@3.3.1": {
|
|
103
103
|
"licenses": "BSD-3-Clause",
|
|
104
104
|
"repository": "https://github.com/lit/lit",
|
|
105
105
|
"licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
|
|
106
106
|
},
|
|
107
|
-
"marked@
|
|
107
|
+
"marked@16.2.1": {
|
|
108
108
|
"licenses": "MIT",
|
|
109
109
|
"repository": "https://github.com/markedjs/marked",
|
|
110
110
|
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
111
|
},
|
|
112
|
-
"postcss-prefix-selector@1.
|
|
112
|
+
"postcss-prefix-selector@2.1.1": {
|
|
113
113
|
"licenses": "MIT",
|
|
114
114
|
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
115
|
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
116
|
},
|
|
117
|
-
"postcss@8.
|
|
117
|
+
"postcss@8.5.6": {
|
|
118
118
|
"licenses": "MIT",
|
|
119
119
|
"repository": "https://github.com/postcss/postcss",
|
|
120
120
|
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
121
|
},
|
|
122
|
-
"prettier@3.
|
|
122
|
+
"prettier@3.6.2": {
|
|
123
123
|
"licenses": "MIT",
|
|
124
124
|
"repository": "https://github.com/prettier/prettier",
|
|
125
125
|
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
@@ -129,62 +129,67 @@
|
|
|
129
129
|
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
130
|
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
131
|
},
|
|
132
|
-
"sass@1.
|
|
132
|
+
"sass@1.91.0": {
|
|
133
133
|
"licenses": "MIT",
|
|
134
134
|
"repository": "https://github.com/sass/dart-sass",
|
|
135
135
|
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
136
|
},
|
|
137
|
-
"stylelint-config-recommended-scss@
|
|
137
|
+
"stylelint-config-recommended-scss@16.0.0": {
|
|
138
138
|
"licenses": "MIT",
|
|
139
139
|
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
140
|
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
141
|
},
|
|
142
|
-
"stylelint-config-standard@
|
|
142
|
+
"stylelint-config-standard@39.0.0": {
|
|
143
143
|
"licenses": "MIT",
|
|
144
144
|
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
145
|
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
146
|
},
|
|
147
|
-
"stylelint-scss@6.
|
|
147
|
+
"stylelint-scss@6.12.1": {
|
|
148
148
|
"licenses": "MIT",
|
|
149
149
|
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
150
|
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
151
|
},
|
|
152
|
-
"stylelint@16.1
|
|
152
|
+
"stylelint@16.23.1": {
|
|
153
153
|
"licenses": "MIT",
|
|
154
154
|
"repository": "https://github.com/stylelint/stylelint",
|
|
155
155
|
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
156
|
},
|
|
157
|
-
"tsup@8.0
|
|
157
|
+
"tsup@8.5.0": {
|
|
158
158
|
"licenses": "MIT",
|
|
159
159
|
"repository": "https://github.com/egoist/tsup",
|
|
160
160
|
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
161
|
},
|
|
162
|
-
"turbo@
|
|
163
|
-
"licenses": "
|
|
164
|
-
"repository": "https://github.com/vercel/
|
|
165
|
-
"licenseUrl": "https://github.com/vercel/
|
|
162
|
+
"turbo@2.5.6": {
|
|
163
|
+
"licenses": "MIT",
|
|
164
|
+
"repository": "https://github.com/vercel/turborepo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turborepo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript-eslint@8.41.0": {
|
|
168
|
+
"licenses": "MIT",
|
|
169
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
170
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
166
171
|
},
|
|
167
|
-
"typescript@5.
|
|
172
|
+
"typescript@5.9.2": {
|
|
168
173
|
"licenses": "Apache-2.0",
|
|
169
|
-
"repository": "https://github.com/
|
|
170
|
-
"licenseUrl": "https://github.com/
|
|
174
|
+
"repository": "https://github.com/microsoft/TypeScript",
|
|
175
|
+
"licenseUrl": "https://github.com/microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
176
|
},
|
|
172
|
-
"vite-tsconfig-paths@
|
|
177
|
+
"vite-tsconfig-paths@5.1.4": {
|
|
173
178
|
"licenses": "MIT",
|
|
174
179
|
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
180
|
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
181
|
},
|
|
177
|
-
"vite@
|
|
182
|
+
"vite@7.1.3": {
|
|
178
183
|
"licenses": "MIT",
|
|
179
184
|
"repository": "https://github.com/vitejs/vite",
|
|
180
185
|
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
186
|
},
|
|
182
|
-
"vitest@
|
|
187
|
+
"vitest@3.2.4": {
|
|
183
188
|
"licenses": "MIT",
|
|
184
189
|
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
190
|
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
191
|
},
|
|
187
|
-
"yargs@
|
|
192
|
+
"yargs@18.0.0": {
|
|
188
193
|
"licenses": "MIT",
|
|
189
194
|
"repository": "https://github.com/yargs/yargs",
|
|
190
195
|
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cas-smartdesign/snackbar",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A snackbar element based on LitElement",
|
|
5
5
|
"main": "dist/snackbar-with-externals.js",
|
|
6
6
|
"module": "dist/snackbar.mjs",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"types": "dist/snackbar.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"lit": "^
|
|
10
|
+
"lit": "^3.3.1"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@cas-smartdesign/element-preview": "^0.
|
|
22
|
-
"@cas-smartdesign/license-generator": "^1.
|
|
21
|
+
"@cas-smartdesign/element-preview": "^0.3.0",
|
|
22
|
+
"@cas-smartdesign/license-generator": "^1.7.0"
|
|
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
|