@wral/active-alerts 0.2.1 → 0.2.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/define.mjs
CHANGED
|
@@ -45,10 +45,10 @@ const at = (i) => new tt(typeof i == "string" ? i : i + "", void 0, j), lt = (i,
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: ct, defineProperty: dt, getOwnPropertyDescriptor: pt, getOwnPropertyNames: ut, getOwnPropertySymbols: ft, getPrototypeOf:
|
|
48
|
+
const { is: ct, defineProperty: dt, getOwnPropertyDescriptor: pt, getOwnPropertyNames: ut, getOwnPropertySymbols: ft, getPrototypeOf: mt } = Object, I = globalThis, F = I.trustedTypes, $t = F ? F.emptyScript : "", gt = I.reactiveElementPolyfillSupport, x = (i, t) => i, z = { toAttribute(i, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
i = i ?
|
|
51
|
+
i = i ? $t : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -104,7 +104,7 @@ let b = class extends HTMLElement {
|
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
106
|
if (this.hasOwnProperty(x("elementProperties"))) return;
|
|
107
|
-
const t =
|
|
107
|
+
const t = mt(this);
|
|
108
108
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
@@ -262,9 +262,9 @@ b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[x("elementProper
|
|
|
262
262
|
* Copyright 2017 Google LLC
|
|
263
263
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
264
264
|
*/
|
|
265
|
-
const D = globalThis, H = D.trustedTypes, J = H ? H.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, st = "$lit$",
|
|
265
|
+
const D = globalThis, H = D.trustedTypes, J = H ? H.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, st = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, it = "?" + $, _t = `<${it}>`, A = document, P = () => A.createComment(""), U = (i) => i === null || typeof i != "object" && typeof i != "function", B = Array.isArray, yt = (i) => B(i) || typeof i?.[Symbol.iterator] == "function", R = `[
|
|
266
266
|
\f\r]`, w = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Z = /-->/g, G = />/g, g = RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^
|
|
267
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), Q = /'/g, X = /"/g, rt = /^(?:script|style|textarea|title)$/i, At = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }),
|
|
267
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Q = /'/g, X = /"/g, rt = /^(?:script|style|textarea|title)$/i, At = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), f = At(1), E = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), Y = /* @__PURE__ */ new WeakMap(), y = A.createTreeWalker(A, 129);
|
|
268
268
|
function nt(i, t) {
|
|
269
269
|
if (!B(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
270
270
|
return J !== void 0 ? J.createHTML(t) : t;
|
|
@@ -274,10 +274,10 @@ const vt = (i, t) => {
|
|
|
274
274
|
let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = w;
|
|
275
275
|
for (let c = 0; c < e; c++) {
|
|
276
276
|
const a = i[c];
|
|
277
|
-
let d, l, h = -1,
|
|
278
|
-
for (;
|
|
279
|
-
const
|
|
280
|
-
n += o === w ? a + _t : h >= 0 ? (s.push(d), a.slice(0, h) + st + a.slice(h) +
|
|
277
|
+
let d, l, h = -1, u = 0;
|
|
278
|
+
for (; u < a.length && (o.lastIndex = u, l = o.exec(a), l !== null); ) u = o.lastIndex, o === w ? l[1] === "!--" ? o = Z : l[1] !== void 0 ? o = G : l[2] !== void 0 ? (rt.test(l[2]) && (r = RegExp("</" + l[2], "g")), o = g) : l[3] !== void 0 && (o = g) : o === g ? l[0] === ">" ? (o = r ?? w, h = -1) : l[1] === void 0 ? h = -2 : (h = o.lastIndex - l[2].length, d = l[1], o = l[3] === void 0 ? g : l[3] === '"' ? X : Q) : o === X || o === Q ? o = g : o === Z || o === G ? o = w : (o = g, r = void 0);
|
|
279
|
+
const m = o === g && i[c + 1].startsWith("/>") ? " " : "";
|
|
280
|
+
n += o === w ? a + _t : h >= 0 ? (s.push(d), a.slice(0, h) + st + a.slice(h) + $ + m) : a + $ + (h === -2 ? c : m);
|
|
281
281
|
}
|
|
282
282
|
return [nt(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
|
|
283
283
|
};
|
|
@@ -294,21 +294,21 @@ class T {
|
|
|
294
294
|
for (; (r = y.nextNode()) !== null && a.length < c; ) {
|
|
295
295
|
if (r.nodeType === 1) {
|
|
296
296
|
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(st)) {
|
|
297
|
-
const
|
|
298
|
-
a.push({ type: 1, index: n, name: N[2], strings:
|
|
299
|
-
} else h.startsWith(
|
|
297
|
+
const u = l[o++], m = r.getAttribute(h).split($), N = /([.?@])?(.*)/.exec(u);
|
|
298
|
+
a.push({ type: 1, index: n, name: N[2], strings: m, ctor: N[1] === "." ? Et : N[1] === "?" ? St : N[1] === "@" ? wt : M }), r.removeAttribute(h);
|
|
299
|
+
} else h.startsWith($) && (a.push({ type: 6, index: n }), r.removeAttribute(h));
|
|
300
300
|
if (rt.test(r.tagName)) {
|
|
301
|
-
const h = r.textContent.split(
|
|
302
|
-
if (
|
|
301
|
+
const h = r.textContent.split($), u = h.length - 1;
|
|
302
|
+
if (u > 0) {
|
|
303
303
|
r.textContent = H ? H.emptyScript : "";
|
|
304
|
-
for (let
|
|
305
|
-
r.append(h[
|
|
304
|
+
for (let m = 0; m < u; m++) r.append(h[m], P()), y.nextNode(), a.push({ type: 2, index: ++n });
|
|
305
|
+
r.append(h[u], P());
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
} else if (r.nodeType === 8) if (r.data === it) a.push({ type: 2, index: n });
|
|
309
309
|
else {
|
|
310
310
|
let h = -1;
|
|
311
|
-
for (; (h = r.data.indexOf(
|
|
311
|
+
for (; (h = r.data.indexOf($, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += $.length - 1;
|
|
312
312
|
}
|
|
313
313
|
n++;
|
|
314
314
|
}
|
|
@@ -807,7 +807,7 @@ class ot extends C {
|
|
|
807
807
|
render() {
|
|
808
808
|
const { items: t, loading: e, error: s } = this, r = (n, o) => {
|
|
809
809
|
const c = Bt(n.effectiveFrom), a = String(n.topic || "").trim().toLowerCase();
|
|
810
|
-
return
|
|
810
|
+
return f`
|
|
811
811
|
<li class="alert" data-index=${o} aria-label="Site Alert">
|
|
812
812
|
<div class="thumb">
|
|
813
813
|
<img
|
|
@@ -821,35 +821,34 @@ class ot extends C {
|
|
|
821
821
|
<div class="label ${a}">
|
|
822
822
|
${jt(n.caption)}
|
|
823
823
|
</div>
|
|
824
|
-
${c ?
|
|
824
|
+
${c ? f`
|
|
825
825
|
<span class="date">
|
|
826
826
|
${c}
|
|
827
827
|
</span>
|
|
828
828
|
` : ""}
|
|
829
829
|
</div>
|
|
830
|
-
${n.url ?
|
|
831
|
-
<a class="title" href=${n.url}>${n.title}</a>
|
|
832
|
-
` :
|
|
833
|
-
<div class="title no-link">${n.title}</div>
|
|
830
|
+
${n.url ? f`
|
|
831
|
+
<a class="title" href=${n.url}>${n.body || n.title}</a>
|
|
832
|
+
` : f`
|
|
833
|
+
<div class="title no-link">${n.body || n.title}</div>
|
|
834
834
|
`}
|
|
835
|
-
${n.body ? u`<p class="body">${n.body}</p>` : ""}
|
|
836
835
|
</div>
|
|
837
836
|
</li>
|
|
838
837
|
`;
|
|
839
838
|
};
|
|
840
|
-
return
|
|
839
|
+
return f`
|
|
841
840
|
<div class="wrapper" role="region" aria-live="polite">
|
|
842
841
|
<div class="heading">
|
|
843
842
|
<span>Active Alerts</span>
|
|
844
|
-
${e ?
|
|
843
|
+
${e ? f`<span class="pill">Loading…</span>` : ""}
|
|
845
844
|
</div>
|
|
846
845
|
|
|
847
|
-
${s ?
|
|
848
|
-
${!s && !e && !t.length ?
|
|
846
|
+
${s ? f`<div class="status error">${s}</div>` : ""}
|
|
847
|
+
${!s && !e && !t.length ? f`
|
|
849
848
|
<div class="empty">No active alerts right now.</div>
|
|
850
849
|
` : ""}
|
|
851
850
|
|
|
852
|
-
${t.length ?
|
|
851
|
+
${t.length ? f`
|
|
853
852
|
<ul class="list">
|
|
854
853
|
${t.map(r)}
|
|
855
854
|
</ul>
|
package/dist/index.mjs
CHANGED
|
@@ -247,11 +247,10 @@ class y extends d {
|
|
|
247
247
|
` : ""}
|
|
248
248
|
</div>
|
|
249
249
|
${r.url ? i`
|
|
250
|
-
<a class="title" href=${r.url}>${r.title}</a>
|
|
250
|
+
<a class="title" href=${r.url}>${r.body || r.title}</a>
|
|
251
251
|
` : i`
|
|
252
|
-
<div class="title no-link">${r.title}</div>
|
|
252
|
+
<div class="title no-link">${r.body || r.title}</div>
|
|
253
253
|
`}
|
|
254
|
-
${r.body ? i`<p class="body">${r.body}</p>` : ""}
|
|
255
254
|
</div>
|
|
256
255
|
</li>
|
|
257
256
|
`;
|