wrec 0.21.0 → 0.21.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.
Files changed (2) hide show
  1. package/dist/wrec.es.js +354 -352
  2. package/package.json +3 -3
package/dist/wrec.es.js CHANGED
@@ -1,67 +1,68 @@
1
- var W = (n) => {
2
- throw TypeError(n);
1
+ var K = (r) => {
2
+ throw TypeError(r);
3
3
  };
4
- var L = (n, t, e) => t.has(n) || W("Cannot " + e);
5
- var u = (n, t, e) => (L(n, t, "read from private field"), e ? e.call(n) : t.get(n)), b = (n, t, e) => t.has(n) ? W("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), w = (n, t, e, s) => (L(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), B = (n, t, e) => (L(n, t, "access private method"), e);
6
- import J from "dompurify";
7
- function K(n, t, e = "") {
4
+ var D = (r, t, e) => t.has(r) || K("Cannot " + e);
5
+ var p = (r, t, e) => (D(r, t, "read from private field"), e ? e.call(r) : t.get(r)), E = (r, t, e) => t.has(r) ? K("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), M = (r, t, e, s) => (D(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), Z = (r, t, e) => (D(r, t, "access private method"), e);
6
+ import { HTMLElement as nt, NodeType as F, parse as rt, TextNode as ct } from "node-html-parser";
7
+ import X from "xss";
8
+ function G(r, t, e = "") {
8
9
  const s = /* @__PURE__ */ new WeakMap(), o = {
9
10
  // Intercept property reads.
10
11
  // This creates nested proxies lazily.
11
- get(i, r) {
12
- const c = Reflect.get(i, r);
12
+ get(i, n) {
13
+ const c = Reflect.get(i, n);
13
14
  if (c === null || typeof c != "object") return c;
14
- const f = s.get(c);
15
- if (f) return f;
16
- const a = e ? `${e}.${r}` : r, l = K(c, t, a);
15
+ const a = s.get(c);
16
+ if (a) return a;
17
+ const f = e ? `${e}.${n}` : n, l = G(c, t, f);
17
18
  return s.set(c, l), l;
18
19
  },
19
20
  // Intercept property writes.
20
- set(i, r, c) {
21
- const f = Reflect.get(i, r);
22
- if (f !== c) {
23
- Reflect.set(i, r, c);
24
- const a = e ? `${e}.${r}` : r;
25
- t(a, f, c);
21
+ set(i, n, c) {
22
+ const a = Reflect.get(i, n);
23
+ if (a !== c) {
24
+ Reflect.set(i, n, c);
25
+ const f = e ? `${e}.${n}` : n;
26
+ t(f, a, c);
26
27
  }
27
28
  return !0;
28
29
  }
29
30
  };
30
- return new Proxy(n, o);
31
+ return new Proxy(r, o);
31
32
  }
32
- function U(n) {
33
+ function Q(r) {
33
34
  const t = {};
34
- for (const [e, s] of Object.entries(n)) {
35
+ for (const [e, s] of Object.entries(r)) {
35
36
  const o = typeof s == "object" && s !== null;
36
- t[e] = o ? U(s) : s;
37
+ t[e] = o ? Q(s) : s;
37
38
  }
38
39
  return t;
39
40
  }
40
- const N = typeof window < "u" && typeof window.document < "u";
41
- let q = class extends Error {
41
+ const O = typeof window < "u" && typeof window.document < "u";
42
+ let U = class extends Error {
42
43
  };
43
- var g, R, p, v, C, y, O, Z;
44
- const E = class E {
44
+ var T, H, m, N, $, w, _, tt;
45
+ const A = class A {
45
46
  constructor(t, e, s) {
46
- b(this, O);
47
- b(this, R, /* @__PURE__ */ Symbol("objectId"));
47
+ E(this, _);
48
+ E(this, H, /* @__PURE__ */ Symbol("objectId"));
48
49
  // This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
49
50
  // because there is no way to iterate over the keys of a WeakMap.
50
- b(this, p, []);
51
- b(this, v);
52
- b(this, C);
53
- b(this, y);
54
- if (!t) throw new q("name cannot be empty");
55
- if (u(E, g).has(t))
56
- throw new q(`WrecState with name "${t}" already exists`);
57
- if (w(this, v, t), w(this, C, e), w(this, y, K({}, B(this, O, Z).bind(this))), e && N) {
51
+ E(this, m, []);
52
+ E(this, N);
53
+ E(this, $);
54
+ E(this, w);
55
+ if (!t) throw new U("name cannot be empty");
56
+ if (p(A, T).has(t))
57
+ throw new U(`WrecState with name "${t}" already exists`);
58
+ if (M(this, N, t), M(this, $, e), M(this, w, G({}, Z(this, _, tt).bind(this))), e && O) {
58
59
  const o = sessionStorage.getItem("wrec-state-" + t), i = o ? JSON.parse(o) : void 0;
59
60
  i && (s = i);
60
61
  }
61
62
  if (s)
62
63
  for (const [o, i] of Object.entries(s))
63
64
  this.addProperty(o, i);
64
- u(E, g).set(t, this);
65
+ p(A, T).set(t, this);
65
66
  }
66
67
  // This static method is useful for accessing a specific WrecState object
67
68
  // from the DevTools console. For example:
@@ -74,22 +75,22 @@ const E = class E {
74
75
  // state.color = 'blue';
75
76
  // state.team.leader.name = 'Mark';
76
77
  static get(t) {
77
- return u(this, g).get(t);
78
+ return p(this, T).get(t);
78
79
  }
79
80
  /**
80
81
  * @param listener - object that has a "changed" method
81
82
  * @param map - map from state property paths to component properties
82
83
  */
83
84
  addListener(t, e = {}) {
84
- const s = u(this, p).find(
85
+ const s = p(this, m).find(
85
86
  (o) => o.listenerRef.deref() === t
86
87
  );
87
88
  if (s) {
88
89
  const { propertyMap: o } = s;
89
- for (const [i, r] of Object.entries(e))
90
- o[i] = r;
90
+ for (const [i, n] of Object.entries(e))
91
+ o[i] = n;
91
92
  } else
92
- u(this, p).push({
93
+ p(this, m).push({
93
94
  listenerRef: new WeakRef(t),
94
95
  propertyMap: e
95
96
  });
@@ -98,38 +99,38 @@ const E = class E {
98
99
  Object.defineProperty(this, t, {
99
100
  enumerable: !0,
100
101
  get() {
101
- return u(this, y)[t];
102
+ return p(this, w)[t];
102
103
  },
103
104
  set(s) {
104
- u(this, y)[t] = s;
105
+ p(this, w)[t] = s;
105
106
  }
106
- }), u(this, y)[t] = e;
107
+ }), p(this, w)[t] = e;
107
108
  }
108
109
  get id() {
109
- return u(this, R);
110
+ return p(this, H);
110
111
  }
111
112
  // This is useful for debugging from the DevTools console.
112
113
  // For example: state.log()
113
114
  log() {
114
- console.log("WrecState:", u(this, v));
115
- for (const [t, e] of Object.entries(u(this, y)))
115
+ console.log("WrecState:", p(this, N));
116
+ for (const [t, e] of Object.entries(p(this, w)))
116
117
  console.log(` ${t} = ${JSON.stringify(e)}`);
117
118
  }
118
119
  removeListener(t) {
119
- w(this, p, u(this, p).filter((e) => e.listenerRef.deref() !== t));
120
+ M(this, m, p(this, m).filter((e) => e.listenerRef.deref() !== t));
120
121
  }
121
122
  };
122
- g = new WeakMap(), R = new WeakMap(), p = new WeakMap(), v = new WeakMap(), C = new WeakMap(), y = new WeakMap(), O = new WeakSet(), Z = function(t, e, s) {
123
+ T = new WeakMap(), H = new WeakMap(), m = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), w = new WeakMap(), _ = new WeakSet(), tt = function(t, e, s) {
123
124
  const o = /* @__PURE__ */ new Set();
124
- for (const i of u(this, p)) {
125
- const r = i.listenerRef.deref();
126
- if (!r)
125
+ for (const i of p(this, m)) {
126
+ const n = i.listenerRef.deref();
127
+ if (!n)
127
128
  o.add(i);
128
- else if (N && r instanceof HTMLElement && !r.isConnected)
129
+ else if (O && n instanceof HTMLElement && !n.isConnected)
129
130
  o.add(i);
130
131
  else {
131
- const { propertyMap: c } = i, f = Object.keys(c);
132
- (f.length === 0 || f.includes(t)) && r.changed(
132
+ const { propertyMap: c } = i, a = Object.keys(c);
133
+ (a.length === 0 || a.includes(t)) && n.changed(
133
134
  t,
134
135
  c[t],
135
136
  s,
@@ -138,32 +139,59 @@ g = new WeakMap(), R = new WeakMap(), p = new WeakMap(), v = new WeakMap(), C =
138
139
  );
139
140
  }
140
141
  }
141
- w(this, p, u(this, p).filter(
142
+ M(this, m, p(this, m).filter(
142
143
  (i) => !o.has(i)
143
144
  ));
144
- }, b(E, g, /* @__PURE__ */ new Map()), N && window.addEventListener("beforeunload", () => {
145
- for (const [t, e] of u(E, g).entries())
146
- if (u(e, C)) {
147
- const s = U(e);
145
+ }, E(A, T, /* @__PURE__ */ new Map()), O && window.addEventListener("beforeunload", () => {
146
+ for (const [t, e] of p(A, T).entries())
147
+ if (p(e, $)) {
148
+ const s = Q(e);
148
149
  sessionStorage.setItem("wrec-state-" + t, JSON.stringify(s));
149
150
  }
150
151
  });
151
- let D = E;
152
- N && process.env.NODE_ENV === "development" && (window.WrecState = D);
153
- function z(n, t) {
154
- let e = n;
152
+ let z = A;
153
+ O && process.env.NODE_ENV === "development" && (window.WrecState = z);
154
+ function Y(r, t) {
155
+ let e = r;
155
156
  for (const s of t.split("."))
156
157
  e = e[s];
157
158
  return e;
158
159
  }
159
- function et(n, t, e) {
160
+ function at(r, t, e) {
160
161
  const s = t.split("."), o = s.length - 1;
161
- let i = n;
162
- s.forEach((r, c) => {
163
- c === o ? i[r] = e : i = i[r];
162
+ let i = r;
163
+ s.forEach((n, c) => {
164
+ c === o ? i[n] = e : i = i[n];
164
165
  });
165
166
  }
166
- const st = /* @__PURE__ */ new Set([
167
+ const ft = /* @__PURE__ */ new Set(["input", "label", "option", "th"]);
168
+ function lt(r) {
169
+ const t = {
170
+ allowCommentTag: !0,
171
+ onTag: (o, i) => {
172
+ if (ft.has(o)) return i;
173
+ },
174
+ onTagAttr(o, i, n) {
175
+ if (i.startsWith("on")) return "";
176
+ },
177
+ safeAttrValue(o, i, n) {
178
+ return i === "class" || o === "a" && i === "href" && !n.startsWith("javascript") || o === "img" && i === "src" ? n : "";
179
+ },
180
+ stripIgnoreTagBody: ["script", "style", "iframe"],
181
+ whiteList: {
182
+ ...X.getDefaultWhiteList(),
183
+ label: ["class", "for"],
184
+ span: ["class"]
185
+ }
186
+ }, e = [];
187
+ r = r.replace(/<!--[\s\S]*?-->/g, (o) => {
188
+ const i = `__COMMENT_${e.length}__`;
189
+ return e.push(o), i;
190
+ });
191
+ let s = X(r, t);
192
+ return s = s.replace(/__COMMENT_(\d+)__/g, (o, i) => e[i]), s;
193
+ }
194
+ const ht = /* @__PURE__ */ new Set([
167
195
  "class",
168
196
  "disabled",
169
197
  "hidden",
@@ -171,131 +199,95 @@ const st = /* @__PURE__ */ new Set([
171
199
  "tabindex",
172
200
  "title"
173
201
  ]);
174
- let G = (n, t) => ({});
175
- if (typeof window > "u") {
176
- const { parseHTML: n } = await import("linkedom"), { HTMLElement: t } = n("<!DOCTYPE html>");
177
- G = n, global.HTMLElement = t, global.customElements = {
178
- get: (e) => {
179
- },
180
- getName: () => "",
181
- define: () => {
182
- },
183
- upgrade: () => {
184
- },
185
- whenDefined: () => Promise.reject()
186
- };
187
- } else {
188
- const n = /* @__PURE__ */ new Set([
189
- "onblur",
190
- "onchange",
191
- "onclick",
192
- "onfocus",
193
- "oninput",
194
- "onkeydown",
195
- "onreset",
196
- "onsubmit"
197
- ]);
198
- J.addHook(
199
- "uponSanitizeAttribute",
200
- (t, e) => {
201
- const { attrName: s } = e, o = s.toLowerCase();
202
- n.has(o) && (e.forceKeepAttr = !0);
203
- }
204
- );
205
- }
206
- class A extends Error {
202
+ typeof window > "u" && (global.HTMLElement = nt, global.customElements = {
203
+ get: (r) => {
204
+ },
205
+ getName: () => "",
206
+ define: () => {
207
+ },
208
+ upgrade: () => {
209
+ },
210
+ whenDefined: () => Promise.reject()
211
+ });
212
+ class x extends Error {
207
213
  }
208
- const ot = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, X = "a-zA-Z_$", it = X + "0-9", S = `[${X}][${it}]*`, nt = /<!--\s*(.*?)\s*-->/, rt = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, j = new RegExp(`^this\\.${S}$`), H = new RegExp(`this\\.${S}(\\.${S})*`, "g"), P = new RegExp(`this\\.${S}(\\.${S})*`), ct = 5;
209
- function at(n) {
210
- return n instanceof HTMLButtonElement || n instanceof HTMLFieldSetElement || n instanceof HTMLInputElement || n instanceof HTMLSelectElement || n instanceof HTMLTextAreaElement || n instanceof d;
214
+ const ut = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, et = "a-zA-Z_$", pt = et + "0-9", P = `[${et}][${pt}]*`, dt = /<!--\s*(.*?)\s*-->/, mt = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, V = new RegExp(`^this\\.${P}$`), I = new RegExp(`this\\.${P}(\\.${P})*`, "g"), L = new RegExp(`this\\.${P}(\\.${P})*`), bt = 5;
215
+ function gt(r) {
216
+ return r instanceof HTMLButtonElement || r instanceof HTMLFieldSetElement || r instanceof HTMLInputElement || r instanceof HTMLSelectElement || r instanceof HTMLTextAreaElement || r instanceof b;
211
217
  }
212
- function bt(n, t, e) {
213
- const s = document.createElement(n);
218
+ function St(r, t, e) {
219
+ const s = document.createElement(r);
214
220
  if (t)
215
221
  for (const [o, i] of Object.entries(t))
216
222
  s.setAttribute(o, i);
217
223
  return e && (s.innerHTML = e), s;
218
224
  }
219
- const ft = (n) => n === String ? "" : n === Number ? 0 : n === Boolean ? !1 : n === Array ? [] : n === Object ? {} : void 0;
220
- function $(n) {
225
+ const yt = (r) => r === String ? "" : r === Number ? 0 : r === Boolean ? !1 : r === Array ? [] : r === Object ? {} : void 0;
226
+ function j(r) {
221
227
  const t = [];
222
- let e = n.firstElementChild;
228
+ let e = r.firstElementChild;
223
229
  for (; e; )
224
- t.push(e), e.shadowRoot && t.push(...$(e.shadowRoot)), e.firstElementChild && t.push(...$(e)), e = e.nextElementSibling;
230
+ t.push(e), e.shadowRoot && t.push(...j(e.shadowRoot)), e.firstElementChild && t.push(...j(e)), e = e.nextElementSibling;
225
231
  return t;
226
232
  }
227
- const T = (n) => n.substring(ct).split(".")[0];
228
- function Y(n, t) {
229
- let e = n[0];
233
+ const S = (r) => r.substring(bt).split(".")[0];
234
+ function st(r, t) {
235
+ let e = r[0];
230
236
  return t.forEach((s, o) => {
231
- e += s + n[o + 1];
237
+ e += s + r[o + 1];
232
238
  }), e;
233
239
  }
234
- function F(n) {
235
- const t = typeof n;
240
+ function q(r) {
241
+ const t = typeof r;
236
242
  return t === "string" || t === "number" || t === "boolean";
237
243
  }
238
- function M(n) {
239
- return n.localName === "textarea";
244
+ function C(r) {
245
+ return r.localName === "textarea";
240
246
  }
241
- function I(n) {
242
- const { localName: t } = n;
247
+ function J(r) {
248
+ const { localName: t } = r;
243
249
  return t === "input" || t === "select";
244
250
  }
245
- const lt = (n) => n.replace(/<!--[\s\S]*?-->/g, "");
246
- function Q(n, t, e, s) {
247
- return n.slice(0, t) + s + n.slice(t + e);
248
- }
249
- function ht(n) {
250
- let t = n.trim(), e = null;
251
- /^\s*<tr[\s>]/i.test(t) ? (t = `<table><tbody>${t}</tbody></table>`, e = "tbody") : /^\s*<(td|th)[\s>]/i.test(t) ? (t = `<table><tbody><tr>${t}</tr></tbody></table>`, e = "tr") : /^\s*<option[\s>]/i.test(t) ? (t = `<select>${t}</select>`, e = "select") : /^\s*<col[\s>]/i.test(t) && (t = `<table><colgroup>${t}</colgroup></table>`, e = "colgroup");
252
- const s = J.sanitize(t, {
253
- ADD_TAGS: ["#comment"],
254
- ALLOW_UNKNOWN_PROTOCOLS: !0,
255
- RETURN_DOM_FRAGMENT: !0
256
- });
257
- if (e) {
258
- const o = s.querySelector(e);
259
- if (o) return o.childNodes;
260
- }
261
- return s.childNodes;
251
+ const Et = (r) => r.replace(/<!--[\s\S]*?-->/g, "");
252
+ function ot(r, t, e, s) {
253
+ return r.slice(0, t) + s + r.slice(t + e);
262
254
  }
263
- function k(n) {
264
- const t = Number(n);
265
- if (isNaN(t)) throw new A(`can't convert "${n}" to a number`);
255
+ function W(r) {
256
+ const t = Number(r);
257
+ if (isNaN(t)) throw new x(`can't convert "${r}" to a number`);
266
258
  return t;
267
259
  }
268
- function tt(n, t, e) {
260
+ function it(r, t, e) {
269
261
  const [s, o] = t.split(":");
270
- if (F(e))
262
+ if (q(e))
271
263
  if (typeof e == "boolean") {
272
- e ? n.setAttribute(s, s) : n.removeAttribute(s);
273
- const i = d.getPropName(s);
274
- n[i] = e;
264
+ e ? r.setAttribute(s, s) : r.removeAttribute(s);
265
+ const i = b.getPropName(s);
266
+ r[i] = e;
275
267
  } else {
276
- const i = n.getAttribute(t), r = String(e);
277
- i !== r && (n.setAttribute(s, r), s === "value" && I(n) && (n.value = r));
268
+ const i = r.getAttribute(t), n = String(e);
269
+ i !== n && (r.setAttribute(s, n), s === "value" && J(r) && (r.value = n));
278
270
  }
279
271
  else {
280
- const i = d.getPropName(t);
281
- n[i] = e;
272
+ const i = b.getPropName(t);
273
+ r[i] = e;
282
274
  }
283
275
  }
284
- function _(n, t, e) {
276
+ function B(r, t, e) {
285
277
  const [s, o] = t.split(":");
286
- n instanceof CSSStyleRule ? n.style.setProperty(s, e) : (tt(n, s, e), s === "value" && I(n) && (n.value = e));
278
+ r instanceof CSSStyleRule ? r.style.setProperty(s, e) : (it(r, s, e), s === "value" && J(r) && (r.value = e));
287
279
  }
288
- async function ut(n) {
280
+ async function wt(r) {
289
281
  const t = /* @__PURE__ */ new Set();
290
- for (const s of $(n.content)) {
282
+ for (const s of j(r.content)) {
291
283
  const { localName: o } = s;
292
284
  o.includes("-") && t.add(o);
293
285
  }
294
286
  function e(s) {
295
287
  return new Promise((o, i) => {
296
288
  setTimeout(() => {
297
- const r = `custom element <${s}> not defined`;
298
- i(new Error(r));
289
+ const n = `custom element <${s}> not defined`;
290
+ i(new Error(n));
299
291
  }, 1e3);
300
292
  });
301
293
  }
@@ -305,7 +297,7 @@ async function ut(n) {
305
297
  )
306
298
  );
307
299
  }
308
- class d extends HTMLElement {
300
+ class b extends HTMLElement {
309
301
  // There is one instance of `attrToPropMap`, `properties`, `propToAttrMap`,
310
302
  // `propToComputedMap`, and `propToExprsMap` per Wrec subclass,
311
303
  // not one for only the Wrec class.
@@ -372,7 +364,7 @@ class d extends HTMLElement {
372
364
  #u = /* @__PURE__ */ new Map();
373
365
  static define(t) {
374
366
  if (this.elementName = t, customElements.get(t))
375
- throw new A(`custom element ${t} is already defined`);
367
+ throw new x(`custom element ${t} is already defined`);
376
368
  customElements.define(t, this);
377
369
  }
378
370
  constructor() {
@@ -382,12 +374,12 @@ class d extends HTMLElement {
382
374
  }
383
375
  attributeChangedCallback(t, e, s) {
384
376
  t === "disabled" && this.#m();
385
- const o = d.getPropName(t);
377
+ const o = b.getPropName(t);
386
378
  if (this.#n(o)) {
387
379
  const i = this.#M(o, String(s));
388
380
  this[o] = i;
389
- const r = this.#f[o];
390
- r && this.setFormValue(r, String(i)), this.propertyChangedCallback(o, e, s);
381
+ const n = this.#f[o];
382
+ n && this.setFormValue(n, String(i)), this.propertyChangedCallback(o, e, s);
391
383
  }
392
384
  }
393
385
  // This applies multiple property changes and only updates
@@ -395,39 +387,39 @@ class d extends HTMLElement {
395
387
  batchSet(t) {
396
388
  this.#a = !0;
397
389
  const e = this.#t.propToExprsMap, s = /* @__PURE__ */ new Set();
398
- for (const [c, f] of Object.entries(t)) {
399
- this[c] = f;
400
- const a = e.get(c) ?? [];
401
- for (const l of a)
390
+ for (const [c, a] of Object.entries(t)) {
391
+ this[c] = a;
392
+ const f = e.get(c) ?? [];
393
+ for (const l of f)
402
394
  s.add(l);
403
395
  }
404
- const o = this.#t.propToComputedMap, i = /* @__PURE__ */ new Set(), r = {};
396
+ const o = this.#t.propToComputedMap, i = /* @__PURE__ */ new Set(), n = {};
405
397
  for (const c of Object.keys(t)) {
406
- const f = o.get(c) || [];
407
- for (const [a, l] of f)
408
- i.add(a), r[a] = l;
398
+ const a = o.get(c) || [];
399
+ for (const [f, l] of a)
400
+ i.add(f), n[f] = l;
409
401
  }
410
402
  for (const c of i) {
411
- const f = r[c];
412
- this[c] = this.#s(f);
413
- const a = e.get(c) ?? [];
414
- for (const l of a)
403
+ const a = n[c];
404
+ this[c] = this.#s(a);
405
+ const f = e.get(c) ?? [];
406
+ for (const l of f)
415
407
  s.add(l);
416
408
  }
417
409
  for (; ; ) {
418
410
  let c = !1;
419
- for (const f of i) {
420
- const a = r[f], l = this.#s(a), h = this[f];
421
- JSON.stringify(l) !== JSON.stringify(h) && (this[f] = l, c = !0);
411
+ for (const a of i) {
412
+ const f = n[a], l = this.#s(f), u = this[a];
413
+ JSON.stringify(l) !== JSON.stringify(u) && (this[a] = l, c = !0);
422
414
  }
423
415
  if (!c) break;
424
416
  }
425
417
  this.#b([...s]), this.#a = !1;
426
418
  }
427
- async #v() {
419
+ async #S() {
428
420
  const t = this.#t;
429
421
  let { template: e } = t;
430
- e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await ut(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
422
+ e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await wt(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
431
423
  }
432
424
  static buildHTML() {
433
425
  let t = `<style>
@@ -435,15 +427,15 @@ class d extends HTMLElement {
435
427
  this.css && (t += this.css), t += `</style>
436
428
  `;
437
429
  let e = this.html.trim();
438
- if (!e) throw new A("static property html must be set");
430
+ if (!e) throw new x("static property html must be set");
439
431
  return e.startsWith("<") || (e = `<span><!--${e}--></span>`), t + e;
440
432
  }
441
433
  changed(t, e, s) {
442
434
  this[e] = s;
443
435
  }
444
436
  connectedCallback() {
445
- this.#H(), this.#x(), this.#v().then(() => {
446
- this.hasAttribute("disabled") && this.#m(), this.#S(this.shadowRoot), this.#y(this.shadowRoot), this.#C();
437
+ this.#H(), this.#x(), this.#S().then(() => {
438
+ this.hasAttribute("disabled") && this.#m(), this.#v(this.shadowRoot), this.#g(this.shadowRoot), this.#C();
447
439
  });
448
440
  }
449
441
  #C() {
@@ -460,38 +452,38 @@ class d extends HTMLElement {
460
452
  }
461
453
  #d(t, e, s) {
462
454
  if (t === "class" || t === "style")
463
- throw new A(`"${t}" is a reserved property`);
464
- const o = d.getAttrName(t), i = this.hasAttribute(o);
455
+ throw new x(`"${t}" is a reserved property`);
456
+ const o = b.getAttrName(t), i = this.hasAttribute(o);
465
457
  e.required && !i && this.#e(this, o, "is a required attribute");
466
- let r = e.value;
467
- this.hasOwnProperty(t) && (r = this[t], delete this[t]);
468
- const { type: c } = e, f = c === Boolean ? r || i : s.includes(o) && i ? this.#T(t, o) : r || ft(c), a = "#" + t;
469
- this[a] = f, e.computed && this.#R(t, e), Object.defineProperty(this, t, {
458
+ let n = e.value;
459
+ this.hasOwnProperty(t) && (n = this[t], delete this[t]);
460
+ const { type: c } = e, a = c === Boolean ? n || i : s.includes(o) && i ? this.#T(t, o) : n || yt(c), f = "#" + t;
461
+ this[f] = a, e.computed && this.#R(t, e), Object.defineProperty(this, t, {
470
462
  enumerable: !0,
471
463
  get() {
472
- return this[a];
464
+ return this[f];
473
465
  },
474
466
  set(l) {
475
- c === Number && typeof l == "string" && (l = k(l));
476
- const h = this[a];
477
- if (l === h) return;
478
- this.#_(t, c, l), this[a] = l;
479
- const { state: m, stateProp: x } = this.#t.properties[t];
480
- x && et(m, x, l), this.#O(t, c, l, o), this.#a || (this.#L(t), this.#E(t)), this.#j(t, l);
481
- const V = this.#f[t];
482
- V && this.setFormValue(V, String(l)), this.propertyChangedCallback(t, h, l), e.dispatch && this.dispatch("change", {
467
+ c === Number && typeof l == "string" && (l = W(l));
468
+ const u = this[f];
469
+ if (l === u) return;
470
+ this.#k(t, c, l), this[f] = l;
471
+ const { state: h, stateProp: d } = this.#t.properties[t];
472
+ d && at(h, d, l), this.#O(t, c, l, o), this.#a || (this.#L(t), this.#w(t)), this.#j(t, l);
473
+ const g = this.#f[t];
474
+ g && this.setFormValue(g, String(l)), this.propertyChangedCallback(t, u, l), e.dispatch && this.dispatch("change", {
483
475
  tagName: this.localName,
484
476
  property: t,
485
- oldValue: h,
477
+ oldValue: u,
486
478
  value: l
487
479
  });
488
480
  }
489
481
  });
490
482
  }
491
483
  #m() {
492
- const t = this.hasAttribute("disabled"), e = $(this.shadowRoot);
484
+ const t = this.hasAttribute("disabled"), e = j(this.shadowRoot);
493
485
  for (const s of e)
494
- at(s) && (s.disabled = t);
486
+ gt(s) && (s.disabled = t);
495
487
  }
496
488
  disconnectedCallback() {
497
489
  this.#o.clear(), this.#l.clear(), this.#u.clear();
@@ -510,16 +502,16 @@ class d extends HTMLElement {
510
502
  displayIfSet(t, e = "block") {
511
503
  return `display: ${t ? e : "none"}`;
512
504
  }
513
- #N(t) {
514
- const e = t instanceof d;
505
+ #P(t) {
506
+ const e = t instanceof b;
515
507
  for (const s of t.getAttributeNames()) {
516
- const o = t.getAttribute(s), i = this.#w(t, o);
508
+ const o = t.getAttribute(s), i = this.#E(t, o);
517
509
  if (i) {
518
- const r = this[i];
519
- r === void 0 && this.#c(t, s, i), t[i] = r;
520
- let [c, f] = s.split(":");
521
- c === "value" && (f ? (t["on" + f] === void 0 && this.#e(t, s, "refers to an unsupported event name"), t.setAttribute(c, this[i])) : f = "change"), e && t.#u.set(
522
- d.getPropName(c),
510
+ const n = this[i];
511
+ n === void 0 && this.#c(t, s, i), t[i] = n;
512
+ let [c, a] = s.split(":");
513
+ c === "value" && (a ? (t["on" + a] === void 0 && this.#e(t, s, "refers to an unsupported event name"), t.setAttribute(c, this[i])) : a = "change"), e && t.#u.set(
514
+ b.getPropName(c),
523
515
  i
524
516
  );
525
517
  }
@@ -533,8 +525,8 @@ class d extends HTMLElement {
533
525
  if (i instanceof HTMLElement)
534
526
  this.#A(i, s);
535
527
  else if (!(i instanceof CSSStyleRule)) {
536
- const { element: r, attrName: c } = i;
537
- r instanceof CSSStyleRule ? r.style.setProperty(c, s) : _(r, c, s);
528
+ const { element: n, attrName: c } = i;
529
+ n instanceof CSSStyleRule ? n.style.setProperty(c, s) : B(n, c, s);
538
530
  }
539
531
  }
540
532
  }
@@ -545,34 +537,34 @@ class d extends HTMLElement {
545
537
  `const {${Object.keys(e).join(",")}} = context; return ${t};`
546
538
  ).call(this, e);
547
539
  }
548
- #P(t) {
540
+ #N(t) {
549
541
  const { localName: e } = t;
550
542
  if (e === "style") {
551
543
  const { sheet: s } = t, o = s?.cssRules ?? [], i = Array.from(o);
552
- for (const r of i)
553
- if (r.constructor === CSSStyleRule) {
554
- const c = Array.from(r.style);
555
- for (const f of c)
556
- if (f.startsWith("--")) {
557
- const a = r.style.getPropertyValue(f);
558
- this.#r(a, r, f);
544
+ for (const n of i)
545
+ if (n.constructor === CSSStyleRule) {
546
+ const c = Array.from(n.style);
547
+ for (const a of c)
548
+ if (a.startsWith("--")) {
549
+ const f = n.style.getPropertyValue(a);
550
+ this.#r(f, n, a);
559
551
  }
560
552
  }
561
553
  } else {
562
554
  let s = "";
563
- if (M(t)) {
555
+ if (C(t)) {
564
556
  this.#r(t.textContent, t);
565
- const o = t.textContent?.match(nt);
557
+ const o = t.textContent?.match(dt);
566
558
  o && (s = o[1]);
567
559
  } else {
568
560
  const o = Array.from(t.childNodes).find(
569
- (i) => i.nodeType === Node.COMMENT_NODE
561
+ (i) => i.nodeType === F.COMMENT_NODE
570
562
  );
571
563
  o && (s = o.textContent?.trim() ?? "");
572
564
  }
573
565
  if (s) {
574
- const o = this.#w(t, s);
575
- o && M(t) ? t.textContent = this[o] : this.#r(s, t);
566
+ const o = this.#E(t, s);
567
+ o && C(t) ? t.textContent = this[o] : this.#r(s, t);
576
568
  }
577
569
  }
578
570
  }
@@ -583,30 +575,30 @@ class d extends HTMLElement {
583
575
  formAssociatedCallback() {
584
576
  let t = this.getAttribute("form-assoc");
585
577
  if (!t) {
586
- const r = this.getAttribute("name");
587
- if (r)
578
+ const n = this.getAttribute("name");
579
+ if (n)
588
580
  if (this.#n("value"))
589
- t = `value:${r}`;
581
+ t = `value:${n}`;
590
582
  else
591
583
  return;
592
584
  else
593
585
  return;
594
586
  }
595
587
  const e = {}, s = t.split(",");
596
- for (const r of s) {
597
- const [c, f] = r.split(":");
598
- e[c.trim()] = f.trim();
588
+ for (const n of s) {
589
+ const [c, a] = n.split(":");
590
+ e[c.trim()] = a.trim();
599
591
  }
600
592
  this.#f = e, this.#i = new FormData(), this.#h = this.attachInternals(), this.#h.setFormValue(this.#i);
601
593
  const o = Object.keys(this.#t.properties), i = this.#l;
602
- for (const r of o)
603
- i[r] = this[r];
594
+ for (const n of o)
595
+ i[n] = this[n];
604
596
  }
605
597
  formResetCallback() {
606
598
  const t = this.#l;
607
599
  for (const e of Object.keys(t)) {
608
600
  let s = t[e];
609
- j.test(s) && (s = this.#s(s)), this[e] = s;
601
+ V.test(s) && (s = this.#s(s)), this[e] = s;
610
602
  }
611
603
  }
612
604
  static getAttrName(t) {
@@ -620,29 +612,29 @@ class d extends HTMLElement {
620
612
  #$(t, e, s) {
621
613
  if (s.length !== 1) return;
622
614
  const [o] = s;
623
- if (!j.test(o)) return;
624
- const i = I(t) || M(t);
625
- let [r, c] = (e ?? "").split(":");
626
- if (!(i && r === "value" || M(t))) return;
615
+ if (!V.test(o)) return;
616
+ const i = J(t) || C(t);
617
+ let [n, c] = (e ?? "").split(":");
618
+ if (!(i && n === "value" || C(t))) return;
627
619
  c ? t["on" + c] === void 0 && this.#e(t, e, "refers to an unsupported event name") : c = "change";
628
- const a = T(o);
620
+ const f = S(o);
629
621
  t.addEventListener(c, (l) => {
630
- const { target: h } = l;
631
- if (!h) return;
632
- const m = h.value, { type: x } = this.#t.properties[a];
633
- this[a] = x === Number ? k(m) : m, this.#E(a);
622
+ const { target: u } = l;
623
+ if (!u) return;
624
+ const h = u.value, { type: d } = this.#t.properties[f];
625
+ this[f] = d === Number ? W(h) : h, this.#w(f);
634
626
  });
635
627
  }
636
628
  #n(t) {
637
629
  return !!this.#t.properties[t];
638
630
  }
639
- #y(t) {
631
+ #g(t) {
640
632
  const e = Array.from(t.querySelectorAll("*"));
641
633
  for (const s of e)
642
- this.#N(s), s.firstElementChild || this.#P(s);
634
+ this.#P(s), s.firstElementChild || this.#N(s);
643
635
  }
644
636
  // formAssociated is only needed when the component is inside a form.
645
- #g() {
637
+ #y() {
646
638
  if (this.#t.formAssociated || this.closest("form") === null) return;
647
639
  const t = this.#t.name;
648
640
  this.#e(
@@ -653,36 +645,36 @@ class d extends HTMLElement {
653
645
  }
654
646
  static get observedAttributes() {
655
647
  const t = Object.keys(this.properties || {}).map(
656
- (e) => d.getAttrName(e)
648
+ (e) => b.getAttrName(e)
657
649
  );
658
650
  return t.includes("disabled") || t.push("disabled"), t;
659
651
  }
660
652
  // Subclasses can override this to add functionality.
661
653
  propertyChangedCallback(t, e, s) {
662
654
  }
663
- #w(t, e) {
664
- if (!e || !j.test(e)) return;
665
- const s = T(e);
655
+ #E(t, e) {
656
+ if (!e || !V.test(e)) return;
657
+ const s = S(e);
666
658
  return this[s] === void 0 && this.#c(t, "", s), s;
667
659
  }
668
- #E(t) {
660
+ #w(t) {
669
661
  const e = this.#t.propToExprsMap.get(t) || [];
670
662
  this.#b(e);
671
663
  }
672
664
  #R(t, e) {
673
665
  const { computed: s, uses: o } = e, i = this.#t.propToComputedMap;
674
- function r(f, a) {
675
- let l = i.get(f);
676
- l || (l = [], i.set(f, l)), l.push([t, a]);
666
+ function n(a, f) {
667
+ let l = i.get(a);
668
+ l || (l = [], i.set(a, l)), l.push([t, f]);
677
669
  }
678
- const c = s.match(H) || [];
679
- for (const f of c) {
680
- const a = T(f);
681
- this[a] === void 0 && this.#c(null, t, a), typeof this[a] != "function" && r(a, s);
670
+ const c = s.match(I) || [];
671
+ for (const a of c) {
672
+ const f = S(a);
673
+ this[f] === void 0 && this.#c(null, t, f), typeof this[f] != "function" && n(f, s);
682
674
  }
683
675
  if (o)
684
- for (const f of o.split(","))
685
- r(f.trim(), s);
676
+ for (const a of o.split(","))
677
+ n(a.trim(), s);
686
678
  }
687
679
  // WARNING: Do not place untrusted JavaScript expressions
688
680
  // in attribute values or the text content of elements!
@@ -690,30 +682,30 @@ class d extends HTMLElement {
690
682
  if (!t) return;
691
683
  const o = this.#p(e, s, t);
692
684
  if (!o) {
693
- const f = t.replaceAll("this..", "this.");
694
- s ? _(e, s, f) : "textContent" in e && (e.textContent = f);
685
+ const a = t.replaceAll("this..", "this.");
686
+ s ? B(e, s, a) : "textContent" in e && (e.textContent = a);
695
687
  return;
696
688
  }
697
689
  const i = this.#t;
698
- o.forEach((f) => {
699
- const a = T(f);
700
- if (typeof this[a] == "function") return;
690
+ o.forEach((a) => {
691
+ const f = S(a);
692
+ if (typeof this[f] == "function") return;
701
693
  const l = i.propToExprsMap;
702
- let h = l.get(a);
703
- h || (h = [], l.set(a, h)), h.includes(t) || h.push(t);
694
+ let u = l.get(f);
695
+ u || (u = [], l.set(f, u)), u.includes(t) || u.push(t);
704
696
  });
705
- for (const [f, a] of this.#o.entries())
706
- for (const l of a) {
707
- const h = l instanceof HTMLElement || l instanceof CSSStyleRule ? l : l.element;
708
- h instanceof CSSStyleRule || h.isConnected || this.#o.set(
709
- f,
710
- a.filter((m) => m !== l)
697
+ for (const [a, f] of this.#o.entries())
698
+ for (const l of f) {
699
+ const u = l instanceof HTMLElement || l instanceof CSSStyleRule ? l : l.element;
700
+ u instanceof CSSStyleRule || u.isConnected || this.#o.set(
701
+ a,
702
+ f.filter((h) => h !== l)
711
703
  );
712
704
  }
713
- let r = this.#o.get(t);
714
- r || (r = [], this.#o.set(t, r)), r.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement && this.#$(e, s, o);
705
+ let n = this.#o.get(t);
706
+ n || (n = [], this.#o.set(t, n)), n.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement && this.#$(e, s, o);
715
707
  const c = this.#s(t);
716
- s ? _(e, s, c) : this.#A(e, c);
708
+ s ? B(e, s, c) : this.#A(e, c);
717
709
  }
718
710
  // This follows the best practice
719
711
  // "Do not override author-set, global attributes."
@@ -721,50 +713,60 @@ class d extends HTMLElement {
721
713
  this.hasAttribute(t) || this.setAttribute(t, e);
722
714
  }
723
715
  setFormValue(t, e) {
724
- !this.#i || !F(e) || (this.#i.set(t, e), this.#h?.setFormValue(this.#i));
716
+ !this.#i || !q(e) || (this.#i.set(t, e), this.#h?.setFormValue(this.#i));
725
717
  }
726
718
  static ssr(t = {}) {
727
- for (const [a, l] of Object.entries(this.properties))
728
- if (t[a] === void 0) {
729
- const { value: h } = l;
730
- h !== void 0 && (t[a] = h);
731
- }
732
- function e(a) {
733
- return new Function("return " + a).call(t);
734
- }
735
- let s = "";
736
- for (const [a, l] of Object.entries(t)) {
737
- const h = this.getAttrName(a);
738
- s += ` ${h}="${l}"`;
719
+ let e = "";
720
+ const s = Object.keys(t);
721
+ s.sort();
722
+ for (const h of s) {
723
+ const d = this.getAttrName(h);
724
+ e += ` ${d}="${t[h]}"`;
739
725
  }
740
- const o = this.buildHTML(), { document: i } = G(o), r = i.querySelectorAll("*");
741
- for (const a of r) {
742
- for (const l of a.attributes) {
743
- const { value: h } = l;
744
- P.test(h) && (l.value = e(h));
726
+ const o = this.properties;
727
+ for (const [h, d] of Object.entries(o))
728
+ if (t[h] === void 0) {
729
+ const { value: g } = d;
730
+ g !== void 0 && (t[h] = g);
745
731
  }
746
- for (const l of a.childNodes)
747
- if (l.nodeType === 8) {
748
- const h = l.textContent ?? "";
749
- if (P.test(h)) {
750
- const m = i.createTextNode(e(h));
751
- a.replaceChild(m, l);
732
+ function i(h) {
733
+ return new Function("return " + h).call(t);
734
+ }
735
+ function n(h) {
736
+ const { attributes: d } = h;
737
+ for (const [y, R] of Object.entries(d))
738
+ if (L.test(R)) {
739
+ const v = i(R), k = o[y].value;
740
+ v === k ? h.removeAttribute(y) : h.setAttribute(y, v);
741
+ }
742
+ const { childNodes: g } = h;
743
+ g.forEach((y, R) => {
744
+ if (y.nodeType === F.ELEMENT_NODE)
745
+ n(y);
746
+ else if (y.nodeType === F.COMMENT_NODE) {
747
+ const v = y.textContent ?? "";
748
+ if (L.test(v)) {
749
+ const k = i(v);
750
+ g[R] = new ct(k);
752
751
  }
753
752
  }
753
+ });
754
754
  }
755
- const c = [...i.children].map((a) => a.outerHTML).join(`
756
- `), { elementName: f } = this;
755
+ const c = this.buildHTML(), a = rt(c, { comment: !0 }), { children: f } = a;
756
+ f.forEach(n);
757
+ const l = f.map((h) => h.outerHTML).join(`
758
+ `), { elementName: u } = this;
757
759
  return `
758
- <${f}${s}>
760
+ <${u}${e}>
759
761
  <template shadowrootmode="open">
760
- ${c}
762
+ ${l}
761
763
  </template>
762
- </${f}>
764
+ </${u}>
763
765
  `;
764
766
  }
765
767
  #e(t, e, s) {
766
768
  const o = t instanceof HTMLElement ? t.localName : "CSS rule";
767
- throw new A(
769
+ throw new x(
768
770
  `component ${this.#t.elementName}` + (t ? `, element "${o}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${s}`
769
771
  );
770
772
  }
@@ -775,10 +777,10 @@ class d extends HTMLElement {
775
777
  return this.#M(t, this.getAttribute(e));
776
778
  }
777
779
  #M(t, e) {
778
- if (e?.match(H)) return e;
780
+ if (e?.match(I)) return e;
779
781
  const s = this.#t, { type: o } = s.properties[t];
780
782
  if (o || this.#e(null, t, "does not specify its type"), o === String) return e;
781
- if (o === Number) return k(e);
783
+ if (o === Number) return W(e);
782
784
  if (o === Boolean)
783
785
  return e === "true" ? !0 : e === "false" || e === "null" ? !1 : (e && e !== t && this.#e(
784
786
  null,
@@ -789,9 +791,9 @@ class d extends HTMLElement {
789
791
  // Updates the matching attribute for a property.
790
792
  // VS Code thinks this is never called, but it is called by #defineProp.
791
793
  #O(t, e, s, o) {
792
- if (F(s)) {
794
+ if (q(s)) {
793
795
  const i = e === Boolean ? this.hasAttribute(o) : this.#T(t, o);
794
- s !== i && tt(this, o || t, s);
796
+ s !== i && it(this, o || t, s);
795
797
  }
796
798
  }
797
799
  // Updates all computed properties that reference this property.
@@ -812,11 +814,11 @@ class d extends HTMLElement {
812
814
  " computed content is not a string or number"
813
815
  );
814
816
  const i = String(e);
815
- if (t instanceof HTMLElement && M(t))
817
+ if (t instanceof HTMLElement && C(t))
816
818
  t.value = i;
817
819
  else if (s && o === "string" && i.trim().startsWith("<")) {
818
- const r = ht(i);
819
- t.replaceChildren(...r), this.#S(t), this.#y(t);
820
+ const n = lt(i);
821
+ t.innerHTML = n, this.#v(t), this.#g(t);
820
822
  } else s && (t.textContent = i);
821
823
  }
822
824
  // Update corresponding parent web component property if bound to one.
@@ -828,8 +830,8 @@ class d extends HTMLElement {
828
830
  if (!(o instanceof ShadowRoot)) return;
829
831
  const { host: i } = o;
830
832
  if (!i) return;
831
- const r = i;
832
- r[s] = e;
833
+ const n = i;
834
+ n[s] = e;
833
835
  }
834
836
  /**
835
837
  * @param state - WrecState object
@@ -842,27 +844,27 @@ class d extends HTMLElement {
842
844
  for (const s of Object.keys(t))
843
845
  e[s] = s;
844
846
  }
845
- this.#k(t, e);
847
+ this.#_(t, e);
846
848
  for (const [s, o] of Object.entries(e))
847
849
  if (this.#n(o)) {
848
- const i = z(t, s);
850
+ const i = Y(t, s);
849
851
  i !== void 0 && (this[o] = i);
850
- const r = this.#t.properties[o];
851
- r.state = t, r.stateProp = s;
852
+ const n = this.#t.properties[o];
853
+ n.state = t, n.stateProp = s;
852
854
  }
853
855
  t.addListener(this, e);
854
856
  }
855
857
  #H() {
856
858
  const t = new Set(Object.keys(this.#t.properties));
857
859
  for (const e of this.getAttributeNames())
858
- if (!st.has(e) && !e.startsWith("on")) {
860
+ if (!ht.has(e) && !e.startsWith("on")) {
859
861
  if (e === "form-assoc") {
860
- this.#g();
862
+ this.#y();
861
863
  continue;
862
864
  }
863
- if (!t.has(d.getPropName(e))) {
865
+ if (!t.has(b.getPropName(e))) {
864
866
  if (e === "name") {
865
- this.#g();
867
+ this.#y();
866
868
  continue;
867
869
  }
868
870
  this.#e(null, e, "is not a supported attribute");
@@ -870,16 +872,16 @@ class d extends HTMLElement {
870
872
  }
871
873
  }
872
874
  #p(t, e, s) {
873
- const o = s.match(H);
875
+ const o = s.match(I);
874
876
  if (o)
875
877
  return o.forEach((i) => {
876
- const r = T(i);
877
- this[r] === void 0 && this.#c(t, e, r);
878
+ const n = S(i);
879
+ this[n] === void 0 && this.#c(t, e, n);
878
880
  }), o;
879
881
  }
880
- #k(t, e) {
882
+ #_(t, e) {
881
883
  for (const [s, o] of Object.entries(e)) {
882
- let i = z(t, s);
884
+ let i = Y(t, s);
883
885
  i === void 0 && this.#e(this, void 0, `invalid state path "${s}"`), i = this[o], this.#n(o) || this.#e(
884
886
  null,
885
887
  o,
@@ -889,7 +891,7 @@ class d extends HTMLElement {
889
891
  }
890
892
  // When type is an array, this can't validate the type of the array elements.
891
893
  // This is called by #defineProp.
892
- #_(t, e, s) {
894
+ #k(t, e, s) {
893
895
  if (s instanceof e) return;
894
896
  let o = typeof s;
895
897
  if (o === "object") {
@@ -906,19 +908,19 @@ class d extends HTMLElement {
906
908
  `was set to a ${o}, but must be a ${e.name}`
907
909
  );
908
910
  }
909
- #S(t) {
911
+ #v(t) {
910
912
  const e = Array.from(t.querySelectorAll("*"));
911
913
  for (const s of e) {
912
914
  const o = [];
913
915
  for (const i of Array.from(s.attributes)) {
914
- const r = i.name;
915
- if (r.startsWith("on")) {
916
- let c = r.slice(2);
916
+ const n = i.name;
917
+ if (n.startsWith("on")) {
918
+ let c = n.slice(2);
917
919
  c = c[0].toLowerCase() + c.slice(1).toLowerCase();
918
- const f = i.value;
919
- this.#p(s, r, f);
920
- let a;
921
- typeof this[f] == "function" ? a = (l) => this[f](l) : (this.#p(s, r, f), a = () => this.#s(f)), s.addEventListener(c, a), o.push(r);
920
+ const a = i.value;
921
+ this.#p(s, n, a);
922
+ let f;
923
+ typeof this[a] == "function" ? f = (l) => this[a](l) : (this.#p(s, n, a), f = () => this.#s(a)), s.addEventListener(c, f), o.push(n);
922
924
  }
923
925
  }
924
926
  for (const i of o)
@@ -926,40 +928,40 @@ class d extends HTMLElement {
926
928
  }
927
929
  }
928
930
  }
929
- function yt(n, ...t) {
930
- let e = Y(n, t);
931
+ function Ct(r, ...t) {
932
+ let e = st(r, t);
931
933
  for (; ; ) {
932
- const s = ot.exec(e);
934
+ const s = ut.exec(e);
933
935
  if (!s) break;
934
936
  const o = s[2];
935
- if (P.test(o)) {
937
+ if (L.test(o)) {
936
938
  const i = s[1];
937
939
  if (!i.startsWith("--")) {
938
- const r = `--${i}: ${o};
940
+ const n = `--${i}: ${o};
939
941
  ${i}: var(--${i})`;
940
- e = Q(e, s.index, s[0].length, r);
942
+ e = ot(e, s.index, s[0].length, n);
941
943
  }
942
944
  }
943
945
  }
944
946
  return e;
945
947
  }
946
- function gt(n, ...t) {
947
- let e = Y(n, t);
948
+ function xt(r, ...t) {
949
+ let e = st(r, t);
948
950
  for (; ; ) {
949
- const s = rt.exec(e);
951
+ const s = mt.exec(e);
950
952
  if (!s || s[1] === "style") break;
951
- const o = lt(s[2]);
952
- if (P.test(o)) {
953
- const i = `<!-- ${o.trim()} -->`, r = s.index + s[0].indexOf(">") + 1;
954
- e = Q(e, r, o.length, i);
953
+ const o = Et(s[2]);
954
+ if (L.test(o)) {
955
+ const i = `<!-- ${o.trim()} -->`, n = s.index + s[0].indexOf(">") + 1;
956
+ e = ot(e, n, o.length, i);
955
957
  }
956
958
  }
957
959
  return e;
958
960
  }
959
961
  export {
960
- d as Wrec,
961
- D as WrecState,
962
- bt as createElement,
963
- yt as css,
964
- gt as html
962
+ b as Wrec,
963
+ z as WrecState,
964
+ St as createElement,
965
+ Ct as css,
966
+ xt as html
965
967
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "wrec",
3
3
  "description": "a small library that greatly simplifies building web components",
4
4
  "author": "R. Mark Volkmann",
5
- "version": "0.21.0",
5
+ "version": "0.21.2",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  "vite-plugin-dts": "^4.5.4"
47
47
  },
48
48
  "dependencies": {
49
- "dompurify": "^3.3.2",
50
- "linkedom": "^0.18.12"
49
+ "node-html-parser": "^7.1.0",
50
+ "xss": "^1.0.15"
51
51
  }
52
52
  }