@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
@@ -1,4 +1,4 @@
1
- import { W as t } from "./wral-active-alerts-Dd9mTg2z.js";
1
+ import { W as t } from "./wral-active-alerts-Cm01hLhV.js";
2
2
  function i() {
3
3
  const e = globalThis?.customElements;
4
4
  e && (e.get("wral-active-alerts") || e.define("wral-active-alerts", t));
@@ -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: $t } = Object, I = globalThis, F = I.trustedTypes, mt = F ? F.emptyScript : "", gt = I.reactiveElementPolyfillSupport, x = (i, t) => i, z = { toAttribute(i, t) {
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 ? mt : null;
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 = $t(this);
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$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, it = "?" + m, _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 = `[
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 }), u = At(1), E = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), Y = /* @__PURE__ */ new WeakMap(), y = A.createTreeWalker(A, 129);
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, f = 0;
278
- for (; f < a.length && (o.lastIndex = f, l = o.exec(a), l !== null); ) f = 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 $ = 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 + m + (h === -2 ? c : $);
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 f = l[o++], $ = r.getAttribute(h).split(m), N = /([.?@])?(.*)/.exec(f);
298
- a.push({ type: 1, index: n, name: N[2], strings: $, ctor: N[1] === "." ? Et : N[1] === "?" ? St : N[1] === "@" ? wt : M }), r.removeAttribute(h);
299
- } else h.startsWith(m) && (a.push({ type: 6, index: n }), r.removeAttribute(h));
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(m), f = h.length - 1;
302
- if (f > 0) {
301
+ const h = r.textContent.split($), u = h.length - 1;
302
+ if (u > 0) {
303
303
  r.textContent = H ? H.emptyScript : "";
304
- for (let $ = 0; $ < f; $++) r.append(h[$], P()), y.nextNode(), a.push({ type: 2, index: ++n });
305
- r.append(h[f], P());
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(m, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += m.length - 1;
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 u`
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 ? u`
824
+ ${c ? f`
825
825
  <span class="date">
826
826
  ${c}
827
827
  </span>
828
828
  ` : ""}
829
829
  </div>
830
- ${n.url ? u`
831
- <a class="title" href=${n.url}>${n.title}</a>
832
- ` : u`
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 u`
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 ? u`<span class="pill">Loading…</span>` : ""}
843
+ ${e ? f`<span class="pill">Loading…</span>` : ""}
845
844
  </div>
846
845
 
847
- ${s ? u`<div class="status error">${s}</div>` : ""}
848
- ${!s && !e && !t.length ? u`
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 ? u`
851
+ ${t.length ? f`
853
852
  <ul class="list">
854
853
  ${t.map(r)}
855
854
  </ul>
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { W as r, n as s, s as l } from "./wral-active-alerts-Dd9mTg2z.js";
1
+ import { W as r, n as s, s as l } from "./wral-active-alerts-Cm01hLhV.js";
2
2
  export {
3
3
  r as WralActiveAlerts,
4
4
  s as normalizeAlert,
@@ -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
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wral/active-alerts",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Lit web component for rendering the current set of active WRAL alerts.",
6
6
  "author": "Dominick Jones <djones@wral.com>",