@wral/active-alerts 0.2.7 → 0.2.8
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,7 +45,7 @@ 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,
|
|
48
|
+
const { is: ct, defineProperty: dt, getOwnPropertyDescriptor: pt, getOwnPropertyNames: ut, getOwnPropertySymbols: ft, getPrototypeOf: $t } = Object, M = globalThis, F = M.trustedTypes, mt = F ? F.emptyScript : "", gt = M.reactiveElementPolyfillSupport, x = (i, t) => i, z = { toAttribute(i, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
i = i ? mt : null;
|
|
@@ -74,7 +74,7 @@ const { is: ct, defineProperty: dt, getOwnPropertyDescriptor: pt, getOwnProperty
|
|
|
74
74
|
}
|
|
75
75
|
return e;
|
|
76
76
|
} }, et = (i, t) => !ct(i, t), K = { attribute: !0, type: String, converter: z, reflect: !1, useDefault: !1, hasChanged: et };
|
|
77
|
-
Symbol.metadata ??= Symbol("metadata"),
|
|
77
|
+
Symbol.metadata ??= Symbol("metadata"), M.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
78
|
let b = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ??= []).push(t);
|
|
@@ -256,7 +256,7 @@ let b = class extends HTMLElement {
|
|
|
256
256
|
firstUpdated(t) {
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[x("elementProperties")] = /* @__PURE__ */ new Map(), b[x("finalized")] = /* @__PURE__ */ new Map(), gt?.({ ReactiveElement: b }), (
|
|
259
|
+
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[x("elementProperties")] = /* @__PURE__ */ new Map(), b[x("finalized")] = /* @__PURE__ */ new Map(), gt?.({ ReactiveElement: b }), (M.reactiveElementVersions ??= []).push("2.1.1");
|
|
260
260
|
/**
|
|
261
261
|
* @license
|
|
262
262
|
* Copyright 2017 Google LLC
|
|
@@ -295,7 +295,7 @@ class T {
|
|
|
295
295
|
if (r.nodeType === 1) {
|
|
296
296
|
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(st)) {
|
|
297
297
|
const u = l[o++], f = r.getAttribute(h).split(m), N = /([.?@])?(.*)/.exec(u);
|
|
298
|
-
a.push({ type: 1, index: n, name: N[2], strings: f, ctor: N[1] === "." ? Et : N[1] === "?" ? St : N[1] === "@" ? wt :
|
|
298
|
+
a.push({ type: 1, index: n, name: N[2], strings: f, ctor: N[1] === "." ? Et : N[1] === "?" ? St : N[1] === "@" ? wt : k }), r.removeAttribute(h);
|
|
299
299
|
} else h.startsWith(m) && (a.push({ type: 6, index: n }), r.removeAttribute(h));
|
|
300
300
|
if (rt.test(r.tagName)) {
|
|
301
301
|
const h = r.textContent.split(m), u = h.length - 1;
|
|
@@ -411,7 +411,7 @@ class O {
|
|
|
411
411
|
this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
class
|
|
414
|
+
class k {
|
|
415
415
|
get tagName() {
|
|
416
416
|
return this.element.tagName;
|
|
417
417
|
}
|
|
@@ -436,7 +436,7 @@ class M {
|
|
|
436
436
|
t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
class Et extends
|
|
439
|
+
class Et extends k {
|
|
440
440
|
constructor() {
|
|
441
441
|
super(...arguments), this.type = 3;
|
|
442
442
|
}
|
|
@@ -444,7 +444,7 @@ class Et extends M {
|
|
|
444
444
|
this.element[this.name] = t === p ? void 0 : t;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
class St extends
|
|
447
|
+
class St extends k {
|
|
448
448
|
constructor() {
|
|
449
449
|
super(...arguments), this.type = 4;
|
|
450
450
|
}
|
|
@@ -452,7 +452,7 @@ class St extends M {
|
|
|
452
452
|
this.element.toggleAttribute(this.name, !!t && t !== p);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
class wt extends
|
|
455
|
+
class wt extends k {
|
|
456
456
|
constructor(t, e, s, r, n) {
|
|
457
457
|
super(t, e, s, r, n), this.type = 5;
|
|
458
458
|
}
|
|
@@ -528,8 +528,8 @@ function Tt(i) {
|
|
|
528
528
|
getActiveAlert: _(Nt, i),
|
|
529
529
|
listAlerts: _(Ht, i),
|
|
530
530
|
getAlert: _(It, i),
|
|
531
|
-
sendAlert: _(
|
|
532
|
-
cancelAlert: _(
|
|
531
|
+
sendAlert: _(Mt, i),
|
|
532
|
+
cancelAlert: _(kt, i)
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
535
|
function Ot(i) {
|
|
@@ -546,13 +546,13 @@ function Ht(i) {
|
|
|
546
546
|
function It(i, t) {
|
|
547
547
|
return A(i, `/v1/alerts/${t}`);
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function Mt(i, t) {
|
|
550
550
|
return A(i, "/v1/alerts", {
|
|
551
551
|
method: "POST",
|
|
552
552
|
body: t
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function kt(i, t) {
|
|
556
556
|
return A(i, `/v1/alerts/${t}`, {
|
|
557
557
|
method: "DELETE"
|
|
558
558
|
});
|
|
@@ -682,13 +682,11 @@ class ot extends C {
|
|
|
682
682
|
text-decoration: underline;
|
|
683
683
|
}
|
|
684
684
|
.alert-card:focus-visible {
|
|
685
|
-
outline:
|
|
685
|
+
outline: 1px solid var(--color-secondary);
|
|
686
686
|
outline-offset: 2px;
|
|
687
687
|
}
|
|
688
688
|
.thumb {
|
|
689
689
|
overflow: hidden;
|
|
690
|
-
background: #f3f3f3;
|
|
691
|
-
border: 1px solid #ececec;
|
|
692
690
|
aspect-ratio: 16 / 9;
|
|
693
691
|
}
|
|
694
692
|
.thumb img {
|
|
@@ -701,7 +699,7 @@ class ot extends C {
|
|
|
701
699
|
.alert-body {
|
|
702
700
|
display: flex;
|
|
703
701
|
flex-direction: column;
|
|
704
|
-
gap:
|
|
702
|
+
gap: 1rem;
|
|
705
703
|
}
|
|
706
704
|
.alert-header {
|
|
707
705
|
display: flex;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement as g, css as u, html as i } from "lit";
|
|
2
|
-
import { createClient as
|
|
3
|
-
const
|
|
2
|
+
import { createClient as v } from "@wral/sdk-alerts/v1";
|
|
3
|
+
const b = {
|
|
4
4
|
lg: 1366
|
|
5
5
|
}, y = "https://api.wral.com/alerts/v1/active/alerts", x = "https://assets.wral.com/a1cc0e86-adab-48e9-bd80-703cd2c56aff?w=1200&h=630", $ = (e) => String(e || "Alert").replace(/[^\p{L}\p{N}]/gu, " ").replace(/\s+/g, " ").trim() || "Alert", I = (e) => {
|
|
6
6
|
if (!e) return null;
|
|
@@ -48,7 +48,7 @@ class _ extends g {
|
|
|
48
48
|
color: #000b27;
|
|
49
49
|
}
|
|
50
50
|
.wrapper {
|
|
51
|
-
max-width: ${
|
|
51
|
+
max-width: ${b.lg}px;
|
|
52
52
|
margin: 0 auto;
|
|
53
53
|
padding: 1rem 1.25rem 1.5rem;
|
|
54
54
|
}
|
|
@@ -101,13 +101,11 @@ class _ extends g {
|
|
|
101
101
|
text-decoration: underline;
|
|
102
102
|
}
|
|
103
103
|
.alert-card:focus-visible {
|
|
104
|
-
outline:
|
|
104
|
+
outline: 1px solid var(--color-secondary);
|
|
105
105
|
outline-offset: 2px;
|
|
106
106
|
}
|
|
107
107
|
.thumb {
|
|
108
108
|
overflow: hidden;
|
|
109
|
-
background: #f3f3f3;
|
|
110
|
-
border: 1px solid #ececec;
|
|
111
109
|
aspect-ratio: 16 / 9;
|
|
112
110
|
}
|
|
113
111
|
.thumb img {
|
|
@@ -120,7 +118,7 @@ class _ extends g {
|
|
|
120
118
|
.alert-body {
|
|
121
119
|
display: flex;
|
|
122
120
|
flex-direction: column;
|
|
123
|
-
gap:
|
|
121
|
+
gap: 1rem;
|
|
124
122
|
}
|
|
125
123
|
.alert-header {
|
|
126
124
|
display: flex;
|
|
@@ -195,7 +193,7 @@ class _ extends g {
|
|
|
195
193
|
t.has("api") && t.get("api") !== this.api && this.load(), t.has("refreshInterval") && this._setupInterval();
|
|
196
194
|
}
|
|
197
195
|
async fetchActiveAlerts() {
|
|
198
|
-
return
|
|
196
|
+
return v({
|
|
199
197
|
baseUrl: this.api.replace(/v1\/.*$/, "")
|
|
200
198
|
}).listActiveAlerts();
|
|
201
199
|
}
|