@m3e/snackbar 1.0.5 → 1.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/index.js +513 -318
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -144
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -18
package/dist/index.js
CHANGED
|
@@ -19,33 +19,30 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
19
19
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
20
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
21
|
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
-
***************************************************************************** */
|
|
23
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
47
|
-
var e = new Error(message);
|
|
48
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
22
|
+
***************************************************************************** */
|
|
23
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
24
|
+
|
|
25
|
+
function __decorate(decorators, target, key, desc) {
|
|
26
|
+
var c = arguments.length,
|
|
27
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
28
|
+
d;
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
}
|
|
32
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
33
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
34
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
35
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
36
|
+
}
|
|
37
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
38
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
39
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
40
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
41
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
42
|
+
}
|
|
43
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
44
|
+
var e = new Error(message);
|
|
45
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49
46
|
};
|
|
50
47
|
|
|
51
48
|
/**
|
|
@@ -53,26 +50,372 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
53
50
|
* Copyright 2017 Google LLC
|
|
54
51
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
52
|
*/
|
|
56
|
-
const t$1=t=>(e,o)=>
|
|
53
|
+
const t$1 = t => (e, o) => {
|
|
54
|
+
void 0 !== o ? o.addInitializer(() => {
|
|
55
|
+
customElements.define(t, e);
|
|
56
|
+
}) : customElements.define(t, e);
|
|
57
|
+
};
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* @license
|
|
60
61
|
* Copyright 2019 Google LLC
|
|
61
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
63
|
*/
|
|
63
|
-
const t
|
|
64
|
+
const t = globalThis,
|
|
65
|
+
e$1 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
66
|
+
s = Symbol(),
|
|
67
|
+
o$2 = new WeakMap();
|
|
68
|
+
let n$2 = class n {
|
|
69
|
+
constructor(t, e, o) {
|
|
70
|
+
if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
71
|
+
this.cssText = t, this.t = e;
|
|
72
|
+
}
|
|
73
|
+
get styleSheet() {
|
|
74
|
+
let t = this.o;
|
|
75
|
+
const s = this.t;
|
|
76
|
+
if (e$1 && void 0 === t) {
|
|
77
|
+
const e = void 0 !== s && 1 === s.length;
|
|
78
|
+
e && (t = o$2.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$2.set(s, t));
|
|
79
|
+
}
|
|
80
|
+
return t;
|
|
81
|
+
}
|
|
82
|
+
toString() {
|
|
83
|
+
return this.cssText;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const r$2 = t => new n$2("string" == typeof t ? t : t + "", void 0, s),
|
|
87
|
+
S = (s, o) => {
|
|
88
|
+
if (e$1) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
|
|
89
|
+
const o = document.createElement("style"),
|
|
90
|
+
n = t.litNonce;
|
|
91
|
+
void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
c$1 = e$1 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
|
|
95
|
+
let e = "";
|
|
96
|
+
for (const s of t.cssRules) e += s.cssText;
|
|
97
|
+
return r$2(e);
|
|
98
|
+
})(t) : t;
|
|
64
99
|
|
|
65
100
|
/**
|
|
66
101
|
* @license
|
|
67
102
|
* Copyright 2017 Google LLC
|
|
68
103
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
|
-
*/
|
|
104
|
+
*/
|
|
105
|
+
const {
|
|
106
|
+
is: i,
|
|
107
|
+
defineProperty: e,
|
|
108
|
+
getOwnPropertyDescriptor: h,
|
|
109
|
+
getOwnPropertyNames: r$1,
|
|
110
|
+
getOwnPropertySymbols: o$1,
|
|
111
|
+
getPrototypeOf: n$1
|
|
112
|
+
} = Object,
|
|
113
|
+
a = globalThis,
|
|
114
|
+
c = a.trustedTypes,
|
|
115
|
+
l = c ? c.emptyScript : "",
|
|
116
|
+
p = a.reactiveElementPolyfillSupport,
|
|
117
|
+
d = (t, s) => t,
|
|
118
|
+
u = {
|
|
119
|
+
toAttribute(t, s) {
|
|
120
|
+
switch (s) {
|
|
121
|
+
case Boolean:
|
|
122
|
+
t = t ? l : null;
|
|
123
|
+
break;
|
|
124
|
+
case Object:
|
|
125
|
+
case Array:
|
|
126
|
+
t = null == t ? t : JSON.stringify(t);
|
|
127
|
+
}
|
|
128
|
+
return t;
|
|
129
|
+
},
|
|
130
|
+
fromAttribute(t, s) {
|
|
131
|
+
let i = t;
|
|
132
|
+
switch (s) {
|
|
133
|
+
case Boolean:
|
|
134
|
+
i = null !== t;
|
|
135
|
+
break;
|
|
136
|
+
case Number:
|
|
137
|
+
i = null === t ? null : Number(t);
|
|
138
|
+
break;
|
|
139
|
+
case Object:
|
|
140
|
+
case Array:
|
|
141
|
+
try {
|
|
142
|
+
i = JSON.parse(t);
|
|
143
|
+
} catch (t) {
|
|
144
|
+
i = null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return i;
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
f = (t, s) => !i(t, s),
|
|
151
|
+
b = {
|
|
152
|
+
attribute: true,
|
|
153
|
+
type: String,
|
|
154
|
+
converter: u,
|
|
155
|
+
reflect: false,
|
|
156
|
+
useDefault: false,
|
|
157
|
+
hasChanged: f
|
|
158
|
+
};
|
|
159
|
+
Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
|
|
160
|
+
class y extends HTMLElement {
|
|
161
|
+
static addInitializer(t) {
|
|
162
|
+
this._$Ei(), (this.l ??= []).push(t);
|
|
163
|
+
}
|
|
164
|
+
static get observedAttributes() {
|
|
165
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
166
|
+
}
|
|
167
|
+
static createProperty(t, s = b) {
|
|
168
|
+
if (s.state && (s.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = true), this.elementProperties.set(t, s), !s.noAccessor) {
|
|
169
|
+
const i = Symbol(),
|
|
170
|
+
h = this.getPropertyDescriptor(t, i, s);
|
|
171
|
+
void 0 !== h && e(this.prototype, t, h);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
static getPropertyDescriptor(t, s, i) {
|
|
175
|
+
const {
|
|
176
|
+
get: e,
|
|
177
|
+
set: r
|
|
178
|
+
} = h(this.prototype, t) ?? {
|
|
179
|
+
get() {
|
|
180
|
+
return this[s];
|
|
181
|
+
},
|
|
182
|
+
set(t) {
|
|
183
|
+
this[s] = t;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
187
|
+
get: e,
|
|
188
|
+
set(s) {
|
|
189
|
+
const h = e?.call(this);
|
|
190
|
+
r?.call(this, s), this.requestUpdate(t, h, i);
|
|
191
|
+
},
|
|
192
|
+
configurable: true,
|
|
193
|
+
enumerable: true
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static getPropertyOptions(t) {
|
|
197
|
+
return this.elementProperties.get(t) ?? b;
|
|
198
|
+
}
|
|
199
|
+
static _$Ei() {
|
|
200
|
+
if (this.hasOwnProperty(d("elementProperties"))) return;
|
|
201
|
+
const t = n$1(this);
|
|
202
|
+
t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
203
|
+
}
|
|
204
|
+
static finalize() {
|
|
205
|
+
if (this.hasOwnProperty(d("finalized"))) return;
|
|
206
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
207
|
+
const t = this.properties,
|
|
208
|
+
s = [...r$1(t), ...o$1(t)];
|
|
209
|
+
for (const i of s) this.createProperty(i, t[i]);
|
|
210
|
+
}
|
|
211
|
+
const t = this[Symbol.metadata];
|
|
212
|
+
if (null !== t) {
|
|
213
|
+
const s = litPropertyMetadata.get(t);
|
|
214
|
+
if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
|
|
215
|
+
}
|
|
216
|
+
this._$Eh = new Map();
|
|
217
|
+
for (const [t, s] of this.elementProperties) {
|
|
218
|
+
const i = this._$Eu(t, s);
|
|
219
|
+
void 0 !== i && this._$Eh.set(i, t);
|
|
220
|
+
}
|
|
221
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
222
|
+
}
|
|
223
|
+
static finalizeStyles(s) {
|
|
224
|
+
const i = [];
|
|
225
|
+
if (Array.isArray(s)) {
|
|
226
|
+
const e = new Set(s.flat(1 / 0).reverse());
|
|
227
|
+
for (const s of e) i.unshift(c$1(s));
|
|
228
|
+
} else void 0 !== s && i.push(c$1(s));
|
|
229
|
+
return i;
|
|
230
|
+
}
|
|
231
|
+
static _$Eu(t, s) {
|
|
232
|
+
const i = s.attribute;
|
|
233
|
+
return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
|
|
234
|
+
}
|
|
235
|
+
constructor() {
|
|
236
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
237
|
+
}
|
|
238
|
+
_$Ev() {
|
|
239
|
+
this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
|
|
240
|
+
}
|
|
241
|
+
addController(t) {
|
|
242
|
+
(this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
|
|
243
|
+
}
|
|
244
|
+
removeController(t) {
|
|
245
|
+
this._$EO?.delete(t);
|
|
246
|
+
}
|
|
247
|
+
_$E_() {
|
|
248
|
+
const t = new Map(),
|
|
249
|
+
s = this.constructor.elementProperties;
|
|
250
|
+
for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
251
|
+
t.size > 0 && (this._$Ep = t);
|
|
252
|
+
}
|
|
253
|
+
createRenderRoot() {
|
|
254
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
255
|
+
return S(t, this.constructor.elementStyles), t;
|
|
256
|
+
}
|
|
257
|
+
connectedCallback() {
|
|
258
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
|
|
259
|
+
}
|
|
260
|
+
enableUpdating(t) {}
|
|
261
|
+
disconnectedCallback() {
|
|
262
|
+
this._$EO?.forEach(t => t.hostDisconnected?.());
|
|
263
|
+
}
|
|
264
|
+
attributeChangedCallback(t, s, i) {
|
|
265
|
+
this._$AK(t, i);
|
|
266
|
+
}
|
|
267
|
+
_$ET(t, s) {
|
|
268
|
+
const i = this.constructor.elementProperties.get(t),
|
|
269
|
+
e = this.constructor._$Eu(t, i);
|
|
270
|
+
if (void 0 !== e && true === i.reflect) {
|
|
271
|
+
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
|
|
272
|
+
this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
_$AK(t, s) {
|
|
276
|
+
const i = this.constructor,
|
|
277
|
+
e = i._$Eh.get(t);
|
|
278
|
+
if (void 0 !== e && this._$Em !== e) {
|
|
279
|
+
const t = i.getPropertyOptions(e),
|
|
280
|
+
h = "function" == typeof t.converter ? {
|
|
281
|
+
fromAttribute: t.converter
|
|
282
|
+
} : void 0 !== t.converter?.fromAttribute ? t.converter : u;
|
|
283
|
+
this._$Em = e;
|
|
284
|
+
const r = h.fromAttribute(s, t.type);
|
|
285
|
+
this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
requestUpdate(t, s, i) {
|
|
289
|
+
if (void 0 !== t) {
|
|
290
|
+
const e = this.constructor,
|
|
291
|
+
h = this[t];
|
|
292
|
+
if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
|
|
293
|
+
this.C(t, s, i);
|
|
294
|
+
}
|
|
295
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
296
|
+
}
|
|
297
|
+
C(t, s, {
|
|
298
|
+
useDefault: i,
|
|
299
|
+
reflect: e,
|
|
300
|
+
wrapped: h
|
|
301
|
+
}, r) {
|
|
302
|
+
i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
|
|
303
|
+
}
|
|
304
|
+
async _$EP() {
|
|
305
|
+
this.isUpdatePending = true;
|
|
306
|
+
try {
|
|
307
|
+
await this._$ES;
|
|
308
|
+
} catch (t) {
|
|
309
|
+
Promise.reject(t);
|
|
310
|
+
}
|
|
311
|
+
const t = this.scheduleUpdate();
|
|
312
|
+
return null != t && (await t), !this.isUpdatePending;
|
|
313
|
+
}
|
|
314
|
+
scheduleUpdate() {
|
|
315
|
+
return this.performUpdate();
|
|
316
|
+
}
|
|
317
|
+
performUpdate() {
|
|
318
|
+
if (!this.isUpdatePending) return;
|
|
319
|
+
if (!this.hasUpdated) {
|
|
320
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
321
|
+
for (const [t, s] of this._$Ep) this[t] = s;
|
|
322
|
+
this._$Ep = void 0;
|
|
323
|
+
}
|
|
324
|
+
const t = this.constructor.elementProperties;
|
|
325
|
+
if (t.size > 0) for (const [s, i] of t) {
|
|
326
|
+
const {
|
|
327
|
+
wrapped: t
|
|
328
|
+
} = i,
|
|
329
|
+
e = this[s];
|
|
330
|
+
true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
let t = false;
|
|
334
|
+
const s = this._$AL;
|
|
335
|
+
try {
|
|
336
|
+
t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
|
|
337
|
+
} catch (s) {
|
|
338
|
+
throw t = false, this._$EM(), s;
|
|
339
|
+
}
|
|
340
|
+
t && this._$AE(s);
|
|
341
|
+
}
|
|
342
|
+
willUpdate(t) {}
|
|
343
|
+
_$AE(t) {
|
|
344
|
+
this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
|
|
345
|
+
}
|
|
346
|
+
_$EM() {
|
|
347
|
+
this._$AL = new Map(), this.isUpdatePending = false;
|
|
348
|
+
}
|
|
349
|
+
get updateComplete() {
|
|
350
|
+
return this.getUpdateComplete();
|
|
351
|
+
}
|
|
352
|
+
getUpdateComplete() {
|
|
353
|
+
return this._$ES;
|
|
354
|
+
}
|
|
355
|
+
shouldUpdate(t) {
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
update(t) {
|
|
359
|
+
this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
|
|
360
|
+
}
|
|
361
|
+
updated(t) {}
|
|
362
|
+
firstUpdated(t) {}
|
|
363
|
+
}
|
|
364
|
+
y.elementStyles = [], y.shadowRootOptions = {
|
|
365
|
+
mode: "open"
|
|
366
|
+
}, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
|
|
367
|
+
ReactiveElement: y
|
|
368
|
+
}), (a.reactiveElementVersions ??= []).push("2.1.1");
|
|
70
369
|
|
|
71
370
|
/**
|
|
72
371
|
* @license
|
|
73
372
|
* Copyright 2017 Google LLC
|
|
74
373
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
|
-
*/
|
|
374
|
+
*/
|
|
375
|
+
const o = {
|
|
376
|
+
attribute: true,
|
|
377
|
+
type: String,
|
|
378
|
+
converter: u,
|
|
379
|
+
reflect: false,
|
|
380
|
+
hasChanged: f
|
|
381
|
+
},
|
|
382
|
+
r = (t = o, e, r) => {
|
|
383
|
+
const {
|
|
384
|
+
kind: n,
|
|
385
|
+
metadata: i
|
|
386
|
+
} = r;
|
|
387
|
+
let s = globalThis.litPropertyMetadata.get(i);
|
|
388
|
+
if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), "setter" === n && ((t = Object.create(t)).wrapped = true), s.set(r.name, t), "accessor" === n) {
|
|
389
|
+
const {
|
|
390
|
+
name: o
|
|
391
|
+
} = r;
|
|
392
|
+
return {
|
|
393
|
+
set(r) {
|
|
394
|
+
const n = e.get.call(this);
|
|
395
|
+
e.set.call(this, r), this.requestUpdate(o, n, t);
|
|
396
|
+
},
|
|
397
|
+
init(e) {
|
|
398
|
+
return void 0 !== e && this.C(o, void 0, t, e), e;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
if ("setter" === n) {
|
|
403
|
+
const {
|
|
404
|
+
name: o
|
|
405
|
+
} = r;
|
|
406
|
+
return function (r) {
|
|
407
|
+
const n = this[o];
|
|
408
|
+
e.call(this, r), this.requestUpdate(o, n, t);
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
throw Error("Unsupported decorator location: " + n);
|
|
412
|
+
};
|
|
413
|
+
function n(t) {
|
|
414
|
+
return (e, o) => "object" == typeof o ? r(t, e, o) : ((t, e, o) => {
|
|
415
|
+
const r = e.hasOwnProperty(o);
|
|
416
|
+
return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
|
|
417
|
+
})(t, e, o);
|
|
418
|
+
}
|
|
76
419
|
|
|
77
420
|
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
|
|
78
421
|
var _M3eSnackbarElement_instances, _M3eSnackbarElement_timeoutId, _M3eSnackbarElement_actionTaken, _M3eSnackbarElement_beforeToggleHandler, _M3eSnackbarElement_renderActionButton, _M3eSnackbarElement_renderCloseButton, _M3eSnackbarElement_handleActionClick, _M3eSnackbarElement_handleBeforeToggle;
|
|
@@ -99,261 +442,116 @@ var M3eSnackbarElement_1;
|
|
|
99
442
|
* @cssprop --m3e-snackbar-max-width - Maximum width of the snackbar.
|
|
100
443
|
*/
|
|
101
444
|
let M3eSnackbarElement = M3eSnackbarElement_1 = class M3eSnackbarElement extends Role(LitElement, "status") {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</div>`;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
445
|
+
constructor() {
|
|
446
|
+
super(...arguments);
|
|
447
|
+
_M3eSnackbarElement_instances.add(this);
|
|
448
|
+
/** @private */
|
|
449
|
+
_M3eSnackbarElement_timeoutId.set(this, -1);
|
|
450
|
+
/** @private */
|
|
451
|
+
_M3eSnackbarElement_actionTaken.set(this, false);
|
|
452
|
+
/** @private */
|
|
453
|
+
_M3eSnackbarElement_beforeToggleHandler.set(this, e => __classPrivateFieldGet(this, _M3eSnackbarElement_instances, "m", _M3eSnackbarElement_handleBeforeToggle).call(this, e));
|
|
454
|
+
/**
|
|
455
|
+
* The length of time, in milliseconds, to wait before automatically dismissing the snackbar.
|
|
456
|
+
* @default 3000
|
|
457
|
+
*/
|
|
458
|
+
this.duration = 3000;
|
|
459
|
+
/**
|
|
460
|
+
* The label of the snackbar's action.
|
|
461
|
+
* @default ""
|
|
462
|
+
*/
|
|
463
|
+
this.action = "";
|
|
464
|
+
/**
|
|
465
|
+
* Whether a button is presented that can be used to close the snackbar.
|
|
466
|
+
* @default false
|
|
467
|
+
*/
|
|
468
|
+
this.dismissible = false;
|
|
469
|
+
/**
|
|
470
|
+
* The accessible label given to the button used to dismiss the snackbar.
|
|
471
|
+
* @default "Close"
|
|
472
|
+
*/
|
|
473
|
+
this.closeLabel = "Close";
|
|
474
|
+
}
|
|
475
|
+
/** The currently open snackbar. */
|
|
476
|
+
static get current() {
|
|
477
|
+
return M3eSnackbarElement_1.__current;
|
|
478
|
+
}
|
|
479
|
+
/** Whether the user clicked the action. */
|
|
480
|
+
get isActionTaken() {
|
|
481
|
+
return __classPrivateFieldGet(this, _M3eSnackbarElement_actionTaken, "f");
|
|
482
|
+
}
|
|
483
|
+
/** @inheritdoc */
|
|
484
|
+
connectedCallback() {
|
|
485
|
+
super.connectedCallback();
|
|
486
|
+
this.addEventListener("beforetoggle", __classPrivateFieldGet(this, _M3eSnackbarElement_beforeToggleHandler, "f"));
|
|
487
|
+
this.setAttribute("popover", "manual");
|
|
488
|
+
this.ariaLive = "polite";
|
|
489
|
+
}
|
|
490
|
+
/** @inheritdoc */
|
|
491
|
+
disconnectedCallback() {
|
|
492
|
+
super.disconnectedCallback();
|
|
493
|
+
this.removeEventListener("beforetoggle", __classPrivateFieldGet(this, _M3eSnackbarElement_beforeToggleHandler, "f"));
|
|
494
|
+
}
|
|
495
|
+
/** @inheritdoc */
|
|
496
|
+
render() {
|
|
497
|
+
return html`<div class="contents"><span class="supporting-text"><slot></slot></span>${__classPrivateFieldGet(this, _M3eSnackbarElement_instances, "m", _M3eSnackbarElement_renderActionButton).call(this)} ${__classPrivateFieldGet(this, _M3eSnackbarElement_instances, "m", _M3eSnackbarElement_renderCloseButton).call(this)}</div>`;
|
|
498
|
+
}
|
|
499
|
+
/** @inheritdoc */
|
|
500
|
+
updated(_changedProperties) {
|
|
501
|
+
super.updated(_changedProperties);
|
|
502
|
+
// After render, compute the (unscaled) height of the snackbar in order
|
|
503
|
+
// to properly position it relative to the viewport.
|
|
504
|
+
// top: calc(100vh - var(--_snackbar-height, 0px) - var(--m3e-snackbar-margin, 1rem));
|
|
505
|
+
this.style.setProperty("--_snackbar-height", `${this.getBoundingClientRect().height / 0.8}px`);
|
|
506
|
+
}
|
|
164
507
|
};
|
|
165
508
|
_M3eSnackbarElement_timeoutId = new WeakMap();
|
|
166
509
|
_M3eSnackbarElement_actionTaken = new WeakMap();
|
|
167
510
|
_M3eSnackbarElement_beforeToggleHandler = new WeakMap();
|
|
168
511
|
_M3eSnackbarElement_instances = new WeakSet();
|
|
169
512
|
_M3eSnackbarElement_renderActionButton = function _M3eSnackbarElement_renderActionButton() {
|
|
170
|
-
|
|
513
|
+
return !this.action ? nothing : html`<m3e-button @click="${__classPrivateFieldGet(this, _M3eSnackbarElement_instances, "m", _M3eSnackbarElement_handleActionClick)}">${this.action}</m3e-button>`;
|
|
171
514
|
};
|
|
172
515
|
_M3eSnackbarElement_renderCloseButton = function _M3eSnackbarElement_renderCloseButton() {
|
|
173
|
-
|
|
174
|
-
? nothing
|
|
175
|
-
: html `<m3e-icon-button aria-label="${this.closeLabel}" @click="${this.hidePopover}">
|
|
176
|
-
<slot name="close-icon">
|
|
177
|
-
<svg class="close-icon" viewBox="0 -960 960 960" fill="currentColor">
|
|
178
|
-
<path
|
|
179
|
-
d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
|
|
180
|
-
/>
|
|
181
|
-
</svg>
|
|
182
|
-
</slot>
|
|
183
|
-
</m3e-icon-button>`;
|
|
516
|
+
return !this.dismissible ? nothing : html`<m3e-icon-button aria-label="${this.closeLabel}" @click="${this.hidePopover}"><slot name="close-icon"><svg class="close-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg></slot></m3e-icon-button>`;
|
|
184
517
|
};
|
|
185
518
|
_M3eSnackbarElement_handleActionClick = function _M3eSnackbarElement_handleActionClick() {
|
|
186
|
-
|
|
187
|
-
|
|
519
|
+
__classPrivateFieldSet(this, _M3eSnackbarElement_actionTaken, true, "f");
|
|
520
|
+
this.hidePopover();
|
|
188
521
|
};
|
|
189
522
|
_M3eSnackbarElement_handleBeforeToggle = function _M3eSnackbarElement_handleBeforeToggle(e) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
523
|
+
if (e.newState == "open") {
|
|
524
|
+
M3eSnackbarElement_1.__current?.hidePopover();
|
|
525
|
+
M3eSnackbarElement_1.__current = this;
|
|
526
|
+
if (this.duration > 0) {
|
|
527
|
+
__classPrivateFieldSet(this, _M3eSnackbarElement_timeoutId, setTimeout(() => this.hidePopover(), this.duration), "f");
|
|
196
528
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
clearTimeout(__classPrivateFieldGet(this, _M3eSnackbarElement_timeoutId, "f"));
|
|
529
|
+
} else {
|
|
530
|
+
if (M3eSnackbarElement_1.__current === this) {
|
|
531
|
+
M3eSnackbarElement_1.__current = null;
|
|
202
532
|
}
|
|
533
|
+
clearTimeout(__classPrivateFieldGet(this, _M3eSnackbarElement_timeoutId, "f"));
|
|
534
|
+
}
|
|
203
535
|
};
|
|
204
536
|
/** The styles of the element. */
|
|
205
|
-
M3eSnackbarElement.styles = css `
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
transform: scale(0.8);
|
|
224
|
-
transition: ${unsafeCSS(`opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},
|
|
225
|
-
transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},
|
|
226
|
-
overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,
|
|
227
|
-
visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`)};
|
|
228
|
-
}
|
|
229
|
-
:host::backdrop {
|
|
230
|
-
background-color: transparent;
|
|
231
|
-
}
|
|
232
|
-
:host(:popover-open) {
|
|
233
|
-
visibility: visible;
|
|
234
|
-
opacity: 1;
|
|
235
|
-
transform: scale(1);
|
|
236
|
-
}
|
|
237
|
-
@starting-style {
|
|
238
|
-
:host(:popover-open) {
|
|
239
|
-
opacity: 0;
|
|
240
|
-
transform: scale(0.8);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
:host([dismissible]) {
|
|
244
|
-
padding-inline-end: 0.5rem;
|
|
245
|
-
}
|
|
246
|
-
.contents {
|
|
247
|
-
display: contents;
|
|
248
|
-
font-size: var(--m3e-snackbar-supporting-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize});
|
|
249
|
-
font-weight: var(
|
|
250
|
-
--m3e-snackbar-supporting-text-font-weight,
|
|
251
|
-
${DesignToken.typescale.standard.label.large.fontWeight}
|
|
252
|
-
);
|
|
253
|
-
line-height: var(
|
|
254
|
-
--m3e-snackbar-supporting-text-line-height,
|
|
255
|
-
${DesignToken.typescale.standard.label.large.lineHeight}
|
|
256
|
-
);
|
|
257
|
-
letter-spacing: var(
|
|
258
|
-
--m3e-snackbar-supporting-text-tracking,
|
|
259
|
-
${DesignToken.typescale.standard.label.large.tracking}
|
|
260
|
-
);
|
|
261
|
-
color: var(--m3e-snackbar-supporting-text-color, ${DesignToken.color.inverseOnSurface});
|
|
262
|
-
|
|
263
|
-
--m3e-text-button-label-text-color: var(--m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary});
|
|
264
|
-
--m3e-text-button-hover-label-text-color: var(
|
|
265
|
-
--m3e-snackbar-action-text-color,
|
|
266
|
-
${DesignToken.color.inversePrimary}
|
|
267
|
-
);
|
|
268
|
-
--m3e-text-button-hover-state-layer-color: var(
|
|
269
|
-
--m3e-snackbar-action-text-color,
|
|
270
|
-
${DesignToken.color.inversePrimary}
|
|
271
|
-
);
|
|
272
|
-
--m3e-text-button-focus-label-text-color: var(
|
|
273
|
-
--m3e-snackbar-action-text-color,
|
|
274
|
-
${DesignToken.color.inversePrimary}
|
|
275
|
-
);
|
|
276
|
-
--m3e-text-button-focus-state-layer-color: var(
|
|
277
|
-
--m3e-snackbar-action-text-color,
|
|
278
|
-
${DesignToken.color.inversePrimary}
|
|
279
|
-
);
|
|
280
|
-
--m3e-text-button-pressed-label-text-color: var(
|
|
281
|
-
--m3e-snackbar-action-text-color,
|
|
282
|
-
${DesignToken.color.inversePrimary}
|
|
283
|
-
);
|
|
284
|
-
--m3e-text-button-pressed-state-layer-color: var(
|
|
285
|
-
--m3e-snackbar-action-text-color,
|
|
286
|
-
${DesignToken.color.inversePrimary}
|
|
287
|
-
);
|
|
288
|
-
--m3e-standard-icon-button-icon-color: var(
|
|
289
|
-
--m3e-snackbar-close-icon-color,
|
|
290
|
-
${DesignToken.color.inverseOnSurface}
|
|
291
|
-
);
|
|
292
|
-
--m3e-standard-icon-button-hover-icon-color: var(
|
|
293
|
-
--m3e-snackbar-close-icon-color,
|
|
294
|
-
${DesignToken.color.inverseOnSurface}
|
|
295
|
-
);
|
|
296
|
-
--m3e-standard-icon-button-hover-state-layer-color: var(
|
|
297
|
-
--m3e-snackbar-close-icon-color,
|
|
298
|
-
${DesignToken.color.inverseOnSurface}
|
|
299
|
-
);
|
|
300
|
-
--m3e-standard-icon-button-focus-icon-color: var(
|
|
301
|
-
--m3e-snackbar-close-icon-color,
|
|
302
|
-
${DesignToken.color.inverseOnSurface}
|
|
303
|
-
);
|
|
304
|
-
--m3e-standard-icon-button-focus-state-layer-color: var(
|
|
305
|
-
--m3e-snackbar-close-icon-color,
|
|
306
|
-
${DesignToken.color.inverseOnSurface}
|
|
307
|
-
);
|
|
308
|
-
--m3e-standard-icon-button-pressed-icon-color: var(
|
|
309
|
-
--m3e-snackbar-close-icon-color,
|
|
310
|
-
${DesignToken.color.inverseOnSurface}
|
|
311
|
-
);
|
|
312
|
-
--m3e-standard-icon-button-pressed-state-layer-color: var(
|
|
313
|
-
--m3e-snackbar-close-icon-color,
|
|
314
|
-
${DesignToken.color.inverseOnSurface}
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
.supporting-text {
|
|
318
|
-
flex: 1 1 auto;
|
|
319
|
-
display: -webkit-box;
|
|
320
|
-
-webkit-line-clamp: 2;
|
|
321
|
-
-webkit-box-orient: vertical;
|
|
322
|
-
overflow: hidden;
|
|
323
|
-
line-clamp: 2;
|
|
324
|
-
margin-block: var(--m3e-snackbar-supporting-text-margin-block, 0.875rem);
|
|
325
|
-
}
|
|
326
|
-
::slotted([slot="close-icon"]),
|
|
327
|
-
.close-icon {
|
|
328
|
-
width: 1em;
|
|
329
|
-
font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important;
|
|
330
|
-
}
|
|
331
|
-
@media (forced-colors: active) {
|
|
332
|
-
:host {
|
|
333
|
-
background-color: Canvas;
|
|
334
|
-
color: CanvasText;
|
|
335
|
-
border-radius: ${DesignToken.shape.corner.small};
|
|
336
|
-
box-sizing: border-box;
|
|
337
|
-
border: 1px solid CanvasText;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
`;
|
|
341
|
-
/** @private */ M3eSnackbarElement.__current = null;
|
|
342
|
-
__decorate([
|
|
343
|
-
n({ type: Number })
|
|
344
|
-
], M3eSnackbarElement.prototype, "duration", void 0);
|
|
345
|
-
__decorate([
|
|
346
|
-
n()
|
|
347
|
-
], M3eSnackbarElement.prototype, "action", void 0);
|
|
348
|
-
__decorate([
|
|
349
|
-
n({ type: Boolean, reflect: true })
|
|
350
|
-
], M3eSnackbarElement.prototype, "dismissible", void 0);
|
|
351
|
-
__decorate([
|
|
352
|
-
n({ attribute: "close-label" })
|
|
353
|
-
], M3eSnackbarElement.prototype, "closeLabel", void 0);
|
|
354
|
-
M3eSnackbarElement = M3eSnackbarElement_1 = __decorate([
|
|
355
|
-
t$1("m3e-snackbar")
|
|
356
|
-
], M3eSnackbarElement);
|
|
537
|
+
M3eSnackbarElement.styles = css`:host { position: fixed; top: calc(100vh - var(--_snackbar-height, 0px) - var(--m3e-snackbar-margin, 1rem)); display: inline-flex; align-items: center; padding: unset; margin: unset; margin-inline: auto; border: unset; border-radius: var(--m3e-snackbar-container-shape, ${DesignToken.shape.corner.extraSmall}); background-color: var(--m3e-snackbar-container-color, ${DesignToken.color.inverseSurface}); padding: var(--m3e-snackbar-padding, 0 1rem 0 1rem); min-width: var(--m3e-snackbar-min-width, 21.5rem); max-width: var(--m3e-snackbar-max-width, 42rem); box-sizing: border-box; visibility: hidden; opacity: 0; transform: scale(0.8); transition: ${unsafeCSS(`opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},
|
|
538
|
+
transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},
|
|
539
|
+
overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,
|
|
540
|
+
visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`)}; } :host::backdrop { background-color: transparent; } :host(:popover-open) { visibility: visible; opacity: 1; transform: scale(1); } @starting-style { :host(:popover-open) { opacity: 0; transform: scale(0.8); } } :host([dismissible]) { padding-inline-end: 0.5rem; } .contents { display: contents; font-size: var(--m3e-snackbar-supporting-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var( --m3e-snackbar-supporting-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight} ); line-height: var( --m3e-snackbar-supporting-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight} ); letter-spacing: var( --m3e-snackbar-supporting-text-tracking, ${DesignToken.typescale.standard.label.large.tracking} ); color: var(--m3e-snackbar-supporting-text-color, ${DesignToken.color.inverseOnSurface}); --m3e-text-button-label-text-color: var(--m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary}); --m3e-text-button-hover-label-text-color: var( --m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary} ); --m3e-text-button-hover-state-layer-color: var( --m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary} ); --m3e-text-button-focus-label-text-color: var( --m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary} ); --m3e-text-button-focus-state-layer-color: var( --m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary} ); --m3e-text-button-pressed-label-text-color: var( --m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary} ); --m3e-text-button-pressed-state-layer-color: var( --m3e-snackbar-action-text-color, ${DesignToken.color.inversePrimary} ); --m3e-standard-icon-button-icon-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); --m3e-standard-icon-button-hover-icon-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); --m3e-standard-icon-button-hover-state-layer-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); --m3e-standard-icon-button-focus-icon-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); --m3e-standard-icon-button-focus-state-layer-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); --m3e-standard-icon-button-pressed-icon-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); --m3e-standard-icon-button-pressed-state-layer-color: var( --m3e-snackbar-close-icon-color, ${DesignToken.color.inverseOnSurface} ); } .supporting-text { flex: 1 1 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 2; margin-block: var(--m3e-snackbar-supporting-text-margin-block, 0.875rem); } ::slotted([slot="close-icon"]), .close-icon { width: 1em; font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important; } @media (forced-colors: active) { :host { background-color: Canvas; color: CanvasText; border-radius: ${DesignToken.shape.corner.small}; box-sizing: border-box; border: 1px solid CanvasText; } }`;
|
|
541
|
+
/** @private */
|
|
542
|
+
M3eSnackbarElement.__current = null;
|
|
543
|
+
__decorate([n({
|
|
544
|
+
type: Number
|
|
545
|
+
})], M3eSnackbarElement.prototype, "duration", void 0);
|
|
546
|
+
__decorate([n()], M3eSnackbarElement.prototype, "action", void 0);
|
|
547
|
+
__decorate([n({
|
|
548
|
+
type: Boolean,
|
|
549
|
+
reflect: true
|
|
550
|
+
})], M3eSnackbarElement.prototype, "dismissible", void 0);
|
|
551
|
+
__decorate([n({
|
|
552
|
+
attribute: "close-label"
|
|
553
|
+
})], M3eSnackbarElement.prototype, "closeLabel", void 0);
|
|
554
|
+
M3eSnackbarElement = M3eSnackbarElement_1 = __decorate([t$1("m3e-snackbar")], M3eSnackbarElement);
|
|
357
555
|
|
|
358
556
|
/**
|
|
359
557
|
* Presents short updates about application processes at the bottom of the screen from anywhere in an application.
|
|
@@ -372,56 +570,53 @@ M3eSnackbarElement = M3eSnackbarElement_1 = __decorate([
|
|
|
372
570
|
* });
|
|
373
571
|
*/
|
|
374
572
|
class M3eSnackbar {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
actualOptions = dismissibleOrOptions;
|
|
395
|
-
}
|
|
396
|
-
if (options) {
|
|
397
|
-
actualOptions = options;
|
|
398
|
-
}
|
|
399
|
-
if (actualOptions?.duration !== undefined) {
|
|
400
|
-
snackbar.duration = actualOptions.duration;
|
|
401
|
-
}
|
|
402
|
-
if (actualOptions?.closeLabel) {
|
|
403
|
-
snackbar.closeLabel = actualOptions.closeLabel;
|
|
404
|
-
}
|
|
405
|
-
snackbar.addEventListener("toggle", (e) => {
|
|
406
|
-
if (e.newState === "closed") {
|
|
407
|
-
if (prefersReducedMotion()) {
|
|
408
|
-
snackbar.remove();
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
snackbar.addEventListener("transitionend", () => snackbar.remove(), { once: true });
|
|
412
|
-
}
|
|
413
|
-
if (snackbar.isActionTaken) {
|
|
414
|
-
actualOptions?.actionCallback?.();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
(document.querySelector("m3e-theme") ?? document.body).append(snackbar);
|
|
419
|
-
snackbar.showPopover();
|
|
573
|
+
static open(message, actionOrDismissibleOrOptions, dismissibleOrOptions, options) {
|
|
574
|
+
if (isServer) return;
|
|
575
|
+
const snackbar = document.createElement("m3e-snackbar");
|
|
576
|
+
snackbar.append(document.createTextNode(message));
|
|
577
|
+
let actualOptions = undefined;
|
|
578
|
+
if (typeof actionOrDismissibleOrOptions == "string") {
|
|
579
|
+
snackbar.action = actionOrDismissibleOrOptions;
|
|
580
|
+
} else if (typeof actionOrDismissibleOrOptions == "boolean") {
|
|
581
|
+
snackbar.dismissible = actionOrDismissibleOrOptions;
|
|
582
|
+
} else {
|
|
583
|
+
actualOptions = actionOrDismissibleOrOptions;
|
|
584
|
+
}
|
|
585
|
+
if (typeof dismissibleOrOptions == "boolean") {
|
|
586
|
+
snackbar.dismissible = dismissibleOrOptions;
|
|
587
|
+
} else {
|
|
588
|
+
actualOptions = dismissibleOrOptions;
|
|
589
|
+
}
|
|
590
|
+
if (options) {
|
|
591
|
+
actualOptions = options;
|
|
420
592
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
M3eSnackbarElement.current?.hidePopover();
|
|
593
|
+
if (actualOptions?.duration !== undefined) {
|
|
594
|
+
snackbar.duration = actualOptions.duration;
|
|
424
595
|
}
|
|
596
|
+
if (actualOptions?.closeLabel) {
|
|
597
|
+
snackbar.closeLabel = actualOptions.closeLabel;
|
|
598
|
+
}
|
|
599
|
+
snackbar.addEventListener("toggle", e => {
|
|
600
|
+
if (e.newState === "closed") {
|
|
601
|
+
if (prefersReducedMotion()) {
|
|
602
|
+
snackbar.remove();
|
|
603
|
+
} else {
|
|
604
|
+
snackbar.addEventListener("transitionend", () => snackbar.remove(), {
|
|
605
|
+
once: true
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
if (snackbar.isActionTaken) {
|
|
609
|
+
actualOptions?.actionCallback?.();
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
(document.querySelector("m3e-theme") ?? document.body).append(snackbar);
|
|
614
|
+
snackbar.showPopover();
|
|
615
|
+
}
|
|
616
|
+
/** Dismisses the currently visible snackbar. */
|
|
617
|
+
static dismiss() {
|
|
618
|
+
M3eSnackbarElement.current?.hidePopover();
|
|
619
|
+
}
|
|
425
620
|
}
|
|
426
621
|
globalThis.M3eSnackbar = M3eSnackbar;
|
|
427
622
|
|