wrec 0.21.1 → 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 +331 -324
  2. package/package.json +2 -2
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 q from "xss";
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 Z(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 ? Z(s) : s;
37
+ t[e] = o ? Q(s) : s;
37
38
  }
38
39
  return t;
39
40
  }
40
- const P = typeof window < "u" && typeof window.document < "u";
41
- let z = class extends Error {
41
+ const O = typeof window < "u" && typeof window.document < "u";
42
+ let U = class extends Error {
42
43
  };
43
- var y, R, p, S, C, g, O, X;
44
- const T = class T {
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, S);
52
- b(this, C);
53
- b(this, g);
54
- if (!t) throw new z("name cannot be empty");
55
- if (u(T, y).has(t))
56
- throw new z(`WrecState with name "${t}" already exists`);
57
- if (w(this, S, t), w(this, C, e), w(this, g, K({}, B(this, O, X).bind(this))), e && P) {
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(T, y).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 T = class T {
74
75
  // state.color = 'blue';
75
76
  // state.team.leader.name = 'Mark';
76
77
  static get(t) {
77
- return u(this, y).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 T = class T {
98
99
  Object.defineProperty(this, t, {
99
100
  enumerable: !0,
100
101
  get() {
101
- return u(this, g)[t];
102
+ return p(this, w)[t];
102
103
  },
103
104
  set(s) {
104
- u(this, g)[t] = s;
105
+ p(this, w)[t] = s;
105
106
  }
106
- }), u(this, g)[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, S));
115
- for (const [t, e] of Object.entries(u(this, g)))
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
- y = new WeakMap(), R = new WeakMap(), p = new WeakMap(), S = new WeakMap(), C = new WeakMap(), g = new WeakMap(), O = new WeakSet(), X = 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 (P && 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,59 +139,59 @@ y = new WeakMap(), R = new WeakMap(), p = new WeakMap(), S = 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(T, y, /* @__PURE__ */ new Map()), P && window.addEventListener("beforeunload", () => {
145
- for (const [t, e] of u(T, y).entries())
146
- if (u(e, C)) {
147
- const s = Z(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 F = T;
152
- P && process.env.NODE_ENV === "development" && (window.WrecState = F);
153
- function J(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(["input", "label", "option", "th"]);
167
- function ot(n) {
167
+ const ft = /* @__PURE__ */ new Set(["input", "label", "option", "th"]);
168
+ function lt(r) {
168
169
  const t = {
169
170
  allowCommentTag: !0,
170
171
  onTag: (o, i) => {
171
- if (st.has(o)) return i;
172
+ if (ft.has(o)) return i;
172
173
  },
173
- onTagAttr(o, i, r) {
174
+ onTagAttr(o, i, n) {
174
175
  if (i.startsWith("on")) return "";
175
176
  },
176
- safeAttrValue(o, i, r) {
177
- return i === "class" || o === "a" && i === "href" && !r.startsWith("javascript") || o === "img" && i === "src" ? r : "";
177
+ safeAttrValue(o, i, n) {
178
+ return i === "class" || o === "a" && i === "href" && !n.startsWith("javascript") || o === "img" && i === "src" ? n : "";
178
179
  },
179
180
  stripIgnoreTagBody: ["script", "style", "iframe"],
180
181
  whiteList: {
181
- ...q.getDefaultWhiteList(),
182
+ ...X.getDefaultWhiteList(),
182
183
  label: ["class", "for"],
183
184
  span: ["class"]
184
185
  }
185
186
  }, e = [];
186
- n = n.replace(/<!--[\s\S]*?-->/g, (o) => {
187
+ r = r.replace(/<!--[\s\S]*?-->/g, (o) => {
187
188
  const i = `__COMMENT_${e.length}__`;
188
189
  return e.push(o), i;
189
190
  });
190
- let s = q(n, t);
191
+ let s = X(r, t);
191
192
  return s = s.replace(/__COMMENT_(\d+)__/g, (o, i) => e[i]), s;
192
193
  }
193
- const it = /* @__PURE__ */ new Set([
194
+ const ht = /* @__PURE__ */ new Set([
194
195
  "class",
195
196
  "disabled",
196
197
  "hidden",
@@ -198,99 +199,95 @@ const it = /* @__PURE__ */ new Set([
198
199
  "tabindex",
199
200
  "title"
200
201
  ]);
201
- let Y = (n, t) => ({});
202
- if (typeof window > "u") {
203
- const { parseHTML: n } = await import("linkedom"), { HTMLElement: t } = n("<!DOCTYPE html>");
204
- Y = n, global.HTMLElement = t, global.customElements = {
205
- get: (e) => {
206
- },
207
- getName: () => "",
208
- define: () => {
209
- },
210
- upgrade: () => {
211
- },
212
- whenDefined: () => Promise.reject()
213
- };
214
- }
215
- class v 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 {
216
213
  }
217
- const nt = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, U = "a-zA-Z_$", rt = U + "0-9", A = `[${U}][${rt}]*`, ct = /<!--\s*(.*?)\s*-->/, at = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, j = new RegExp(`^this\\.${A}$`), H = new RegExp(`this\\.${A}(\\.${A})*`, "g"), $ = new RegExp(`this\\.${A}(\\.${A})*`), ft = 5;
218
- function lt(n) {
219
- 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;
220
217
  }
221
- function gt(n, t, e) {
222
- const s = document.createElement(n);
218
+ function St(r, t, e) {
219
+ const s = document.createElement(r);
223
220
  if (t)
224
221
  for (const [o, i] of Object.entries(t))
225
222
  s.setAttribute(o, i);
226
223
  return e && (s.innerHTML = e), s;
227
224
  }
228
- const ht = (n) => n === String ? "" : n === Number ? 0 : n === Boolean ? !1 : n === Array ? [] : n === Object ? {} : void 0;
229
- function N(n) {
225
+ const yt = (r) => r === String ? "" : r === Number ? 0 : r === Boolean ? !1 : r === Array ? [] : r === Object ? {} : void 0;
226
+ function j(r) {
230
227
  const t = [];
231
- let e = n.firstElementChild;
228
+ let e = r.firstElementChild;
232
229
  for (; e; )
233
- t.push(e), e.shadowRoot && t.push(...N(e.shadowRoot)), e.firstElementChild && t.push(...N(e)), e = e.nextElementSibling;
230
+ t.push(e), e.shadowRoot && t.push(...j(e.shadowRoot)), e.firstElementChild && t.push(...j(e)), e = e.nextElementSibling;
234
231
  return t;
235
232
  }
236
- const E = (n) => n.substring(ft).split(".")[0];
237
- function G(n, t) {
238
- let e = n[0];
233
+ const S = (r) => r.substring(bt).split(".")[0];
234
+ function st(r, t) {
235
+ let e = r[0];
239
236
  return t.forEach((s, o) => {
240
- e += s + n[o + 1];
237
+ e += s + r[o + 1];
241
238
  }), e;
242
239
  }
243
- function D(n) {
244
- const t = typeof n;
240
+ function q(r) {
241
+ const t = typeof r;
245
242
  return t === "string" || t === "number" || t === "boolean";
246
243
  }
247
- function M(n) {
248
- return n.localName === "textarea";
244
+ function C(r) {
245
+ return r.localName === "textarea";
249
246
  }
250
- function I(n) {
251
- const { localName: t } = n;
247
+ function J(r) {
248
+ const { localName: t } = r;
252
249
  return t === "input" || t === "select";
253
250
  }
254
- const ut = (n) => n.replace(/<!--[\s\S]*?-->/g, "");
255
- function Q(n, t, e, s) {
256
- return n.slice(0, t) + s + n.slice(t + e);
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);
257
254
  }
258
- function _(n) {
259
- const t = Number(n);
260
- if (isNaN(t)) throw new v(`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`);
261
258
  return t;
262
259
  }
263
- function tt(n, t, e) {
260
+ function it(r, t, e) {
264
261
  const [s, o] = t.split(":");
265
- if (D(e))
262
+ if (q(e))
266
263
  if (typeof e == "boolean") {
267
- e ? n.setAttribute(s, s) : n.removeAttribute(s);
268
- const i = d.getPropName(s);
269
- n[i] = e;
264
+ e ? r.setAttribute(s, s) : r.removeAttribute(s);
265
+ const i = b.getPropName(s);
266
+ r[i] = e;
270
267
  } else {
271
- const i = n.getAttribute(t), r = String(e);
272
- 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));
273
270
  }
274
271
  else {
275
- const i = d.getPropName(t);
276
- n[i] = e;
272
+ const i = b.getPropName(t);
273
+ r[i] = e;
277
274
  }
278
275
  }
279
- function k(n, t, e) {
276
+ function B(r, t, e) {
280
277
  const [s, o] = t.split(":");
281
- 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));
282
279
  }
283
- async function pt(n) {
280
+ async function wt(r) {
284
281
  const t = /* @__PURE__ */ new Set();
285
- for (const s of N(n.content)) {
282
+ for (const s of j(r.content)) {
286
283
  const { localName: o } = s;
287
284
  o.includes("-") && t.add(o);
288
285
  }
289
286
  function e(s) {
290
287
  return new Promise((o, i) => {
291
288
  setTimeout(() => {
292
- const r = `custom element <${s}> not defined`;
293
- i(new Error(r));
289
+ const n = `custom element <${s}> not defined`;
290
+ i(new Error(n));
294
291
  }, 1e3);
295
292
  });
296
293
  }
@@ -300,7 +297,7 @@ async function pt(n) {
300
297
  )
301
298
  );
302
299
  }
303
- class d extends HTMLElement {
300
+ class b extends HTMLElement {
304
301
  // There is one instance of `attrToPropMap`, `properties`, `propToAttrMap`,
305
302
  // `propToComputedMap`, and `propToExprsMap` per Wrec subclass,
306
303
  // not one for only the Wrec class.
@@ -367,7 +364,7 @@ class d extends HTMLElement {
367
364
  #u = /* @__PURE__ */ new Map();
368
365
  static define(t) {
369
366
  if (this.elementName = t, customElements.get(t))
370
- throw new v(`custom element ${t} is already defined`);
367
+ throw new x(`custom element ${t} is already defined`);
371
368
  customElements.define(t, this);
372
369
  }
373
370
  constructor() {
@@ -377,12 +374,12 @@ class d extends HTMLElement {
377
374
  }
378
375
  attributeChangedCallback(t, e, s) {
379
376
  t === "disabled" && this.#m();
380
- const o = d.getPropName(t);
377
+ const o = b.getPropName(t);
381
378
  if (this.#n(o)) {
382
379
  const i = this.#M(o, String(s));
383
380
  this[o] = i;
384
- const r = this.#f[o];
385
- 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);
386
383
  }
387
384
  }
388
385
  // This applies multiple property changes and only updates
@@ -390,30 +387,30 @@ class d extends HTMLElement {
390
387
  batchSet(t) {
391
388
  this.#a = !0;
392
389
  const e = this.#t.propToExprsMap, s = /* @__PURE__ */ new Set();
393
- for (const [c, f] of Object.entries(t)) {
394
- this[c] = f;
395
- const a = e.get(c) ?? [];
396
- 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)
397
394
  s.add(l);
398
395
  }
399
- const o = this.#t.propToComputedMap, i = /* @__PURE__ */ new Set(), r = {};
396
+ const o = this.#t.propToComputedMap, i = /* @__PURE__ */ new Set(), n = {};
400
397
  for (const c of Object.keys(t)) {
401
- const f = o.get(c) || [];
402
- for (const [a, l] of f)
403
- 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;
404
401
  }
405
402
  for (const c of i) {
406
- const f = r[c];
407
- this[c] = this.#s(f);
408
- const a = e.get(c) ?? [];
409
- 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)
410
407
  s.add(l);
411
408
  }
412
409
  for (; ; ) {
413
410
  let c = !1;
414
- for (const f of i) {
415
- const a = r[f], l = this.#s(a), h = this[f];
416
- 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);
417
414
  }
418
415
  if (!c) break;
419
416
  }
@@ -422,7 +419,7 @@ class d extends HTMLElement {
422
419
  async #S() {
423
420
  const t = this.#t;
424
421
  let { template: e } = t;
425
- e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await pt(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));
426
423
  }
427
424
  static buildHTML() {
428
425
  let t = `<style>
@@ -430,7 +427,7 @@ class d extends HTMLElement {
430
427
  this.css && (t += this.css), t += `</style>
431
428
  `;
432
429
  let e = this.html.trim();
433
- if (!e) throw new v("static property html must be set");
430
+ if (!e) throw new x("static property html must be set");
434
431
  return e.startsWith("<") || (e = `<span><!--${e}--></span>`), t + e;
435
432
  }
436
433
  changed(t, e, s) {
@@ -438,7 +435,7 @@ class d extends HTMLElement {
438
435
  }
439
436
  connectedCallback() {
440
437
  this.#H(), this.#x(), this.#S().then(() => {
441
- this.hasAttribute("disabled") && this.#m(), this.#A(this.shadowRoot), this.#g(this.shadowRoot), this.#C();
438
+ this.hasAttribute("disabled") && this.#m(), this.#v(this.shadowRoot), this.#g(this.shadowRoot), this.#C();
442
439
  });
443
440
  }
444
441
  #C() {
@@ -455,38 +452,38 @@ class d extends HTMLElement {
455
452
  }
456
453
  #d(t, e, s) {
457
454
  if (t === "class" || t === "style")
458
- throw new v(`"${t}" is a reserved property`);
459
- 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);
460
457
  e.required && !i && this.#e(this, o, "is a required attribute");
461
- let r = e.value;
462
- this.hasOwnProperty(t) && (r = this[t], delete this[t]);
463
- const { type: c } = e, f = c === Boolean ? r || i : s.includes(o) && i ? this.#E(t, o) : r || ht(c), a = "#" + t;
464
- 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, {
465
462
  enumerable: !0,
466
463
  get() {
467
- return this[a];
464
+ return this[f];
468
465
  },
469
466
  set(l) {
470
- c === Number && typeof l == "string" && (l = _(l));
471
- const h = this[a];
472
- if (l === h) return;
473
- this.#k(t, c, l), this[a] = l;
474
- const { state: m, stateProp: x } = this.#t.properties[t];
475
- x && et(m, x, l), this.#O(t, c, l, o), this.#a || (this.#L(t), this.#T(t)), this.#j(t, l);
476
- const V = this.#f[t];
477
- 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", {
478
475
  tagName: this.localName,
479
476
  property: t,
480
- oldValue: h,
477
+ oldValue: u,
481
478
  value: l
482
479
  });
483
480
  }
484
481
  });
485
482
  }
486
483
  #m() {
487
- const t = this.hasAttribute("disabled"), e = N(this.shadowRoot);
484
+ const t = this.hasAttribute("disabled"), e = j(this.shadowRoot);
488
485
  for (const s of e)
489
- lt(s) && (s.disabled = t);
486
+ gt(s) && (s.disabled = t);
490
487
  }
491
488
  disconnectedCallback() {
492
489
  this.#o.clear(), this.#l.clear(), this.#u.clear();
@@ -506,15 +503,15 @@ class d extends HTMLElement {
506
503
  return `display: ${t ? e : "none"}`;
507
504
  }
508
505
  #P(t) {
509
- const e = t instanceof d;
506
+ const e = t instanceof b;
510
507
  for (const s of t.getAttributeNames()) {
511
- const o = t.getAttribute(s), i = this.#w(t, o);
508
+ const o = t.getAttribute(s), i = this.#E(t, o);
512
509
  if (i) {
513
- const r = this[i];
514
- r === void 0 && this.#c(t, s, i), t[i] = r;
515
- let [c, f] = s.split(":");
516
- 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(
517
- 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),
518
515
  i
519
516
  );
520
517
  }
@@ -526,10 +523,10 @@ class d extends HTMLElement {
526
523
  const s = this.#s(e), o = this.#o.get(e) ?? [];
527
524
  for (const i of o)
528
525
  if (i instanceof HTMLElement)
529
- this.#v(i, s);
526
+ this.#A(i, s);
530
527
  else if (!(i instanceof CSSStyleRule)) {
531
- const { element: r, attrName: c } = i;
532
- r instanceof CSSStyleRule ? r.style.setProperty(c, s) : k(r, c, s);
528
+ const { element: n, attrName: c } = i;
529
+ n instanceof CSSStyleRule ? n.style.setProperty(c, s) : B(n, c, s);
533
530
  }
534
531
  }
535
532
  }
@@ -540,34 +537,34 @@ class d extends HTMLElement {
540
537
  `const {${Object.keys(e).join(",")}} = context; return ${t};`
541
538
  ).call(this, e);
542
539
  }
543
- #$(t) {
540
+ #N(t) {
544
541
  const { localName: e } = t;
545
542
  if (e === "style") {
546
543
  const { sheet: s } = t, o = s?.cssRules ?? [], i = Array.from(o);
547
- for (const r of i)
548
- if (r.constructor === CSSStyleRule) {
549
- const c = Array.from(r.style);
550
- for (const f of c)
551
- if (f.startsWith("--")) {
552
- const a = r.style.getPropertyValue(f);
553
- 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);
554
551
  }
555
552
  }
556
553
  } else {
557
554
  let s = "";
558
- if (M(t)) {
555
+ if (C(t)) {
559
556
  this.#r(t.textContent, t);
560
- const o = t.textContent?.match(ct);
557
+ const o = t.textContent?.match(dt);
561
558
  o && (s = o[1]);
562
559
  } else {
563
560
  const o = Array.from(t.childNodes).find(
564
- (i) => i.nodeType === Node.COMMENT_NODE
561
+ (i) => i.nodeType === F.COMMENT_NODE
565
562
  );
566
563
  o && (s = o.textContent?.trim() ?? "");
567
564
  }
568
565
  if (s) {
569
- const o = this.#w(t, s);
570
- 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);
571
568
  }
572
569
  }
573
570
  }
@@ -578,30 +575,30 @@ class d extends HTMLElement {
578
575
  formAssociatedCallback() {
579
576
  let t = this.getAttribute("form-assoc");
580
577
  if (!t) {
581
- const r = this.getAttribute("name");
582
- if (r)
578
+ const n = this.getAttribute("name");
579
+ if (n)
583
580
  if (this.#n("value"))
584
- t = `value:${r}`;
581
+ t = `value:${n}`;
585
582
  else
586
583
  return;
587
584
  else
588
585
  return;
589
586
  }
590
587
  const e = {}, s = t.split(",");
591
- for (const r of s) {
592
- const [c, f] = r.split(":");
593
- e[c.trim()] = f.trim();
588
+ for (const n of s) {
589
+ const [c, a] = n.split(":");
590
+ e[c.trim()] = a.trim();
594
591
  }
595
592
  this.#f = e, this.#i = new FormData(), this.#h = this.attachInternals(), this.#h.setFormValue(this.#i);
596
593
  const o = Object.keys(this.#t.properties), i = this.#l;
597
- for (const r of o)
598
- i[r] = this[r];
594
+ for (const n of o)
595
+ i[n] = this[n];
599
596
  }
600
597
  formResetCallback() {
601
598
  const t = this.#l;
602
599
  for (const e of Object.keys(t)) {
603
600
  let s = t[e];
604
- j.test(s) && (s = this.#s(s)), this[e] = s;
601
+ V.test(s) && (s = this.#s(s)), this[e] = s;
605
602
  }
606
603
  }
607
604
  static getAttrName(t) {
@@ -612,20 +609,20 @@ class d extends HTMLElement {
612
609
  let e = this.attrToPropMap.get(t);
613
610
  return e || (e = t.replace(/-([a-z])/g, (s, o) => o.toUpperCase()), this.attrToPropMap.set(t, e)), e;
614
611
  }
615
- #N(t, e, s) {
612
+ #$(t, e, s) {
616
613
  if (s.length !== 1) return;
617
614
  const [o] = s;
618
- if (!j.test(o)) return;
619
- const i = I(t) || M(t);
620
- let [r, c] = (e ?? "").split(":");
621
- 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;
622
619
  c ? t["on" + c] === void 0 && this.#e(t, e, "refers to an unsupported event name") : c = "change";
623
- const a = E(o);
620
+ const f = S(o);
624
621
  t.addEventListener(c, (l) => {
625
- const { target: h } = l;
626
- if (!h) return;
627
- const m = h.value, { type: x } = this.#t.properties[a];
628
- this[a] = x === Number ? _(m) : m, this.#T(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);
629
626
  });
630
627
  }
631
628
  #n(t) {
@@ -634,7 +631,7 @@ class d extends HTMLElement {
634
631
  #g(t) {
635
632
  const e = Array.from(t.querySelectorAll("*"));
636
633
  for (const s of e)
637
- this.#P(s), s.firstElementChild || this.#$(s);
634
+ this.#P(s), s.firstElementChild || this.#N(s);
638
635
  }
639
636
  // formAssociated is only needed when the component is inside a form.
640
637
  #y() {
@@ -648,36 +645,36 @@ class d extends HTMLElement {
648
645
  }
649
646
  static get observedAttributes() {
650
647
  const t = Object.keys(this.properties || {}).map(
651
- (e) => d.getAttrName(e)
648
+ (e) => b.getAttrName(e)
652
649
  );
653
650
  return t.includes("disabled") || t.push("disabled"), t;
654
651
  }
655
652
  // Subclasses can override this to add functionality.
656
653
  propertyChangedCallback(t, e, s) {
657
654
  }
658
- #w(t, e) {
659
- if (!e || !j.test(e)) return;
660
- const s = E(e);
655
+ #E(t, e) {
656
+ if (!e || !V.test(e)) return;
657
+ const s = S(e);
661
658
  return this[s] === void 0 && this.#c(t, "", s), s;
662
659
  }
663
- #T(t) {
660
+ #w(t) {
664
661
  const e = this.#t.propToExprsMap.get(t) || [];
665
662
  this.#b(e);
666
663
  }
667
664
  #R(t, e) {
668
665
  const { computed: s, uses: o } = e, i = this.#t.propToComputedMap;
669
- function r(f, a) {
670
- let l = i.get(f);
671
- 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]);
672
669
  }
673
- const c = s.match(H) || [];
674
- for (const f of c) {
675
- const a = E(f);
676
- 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);
677
674
  }
678
675
  if (o)
679
- for (const f of o.split(","))
680
- r(f.trim(), s);
676
+ for (const a of o.split(","))
677
+ n(a.trim(), s);
681
678
  }
682
679
  // WARNING: Do not place untrusted JavaScript expressions
683
680
  // in attribute values or the text content of elements!
@@ -685,30 +682,30 @@ class d extends HTMLElement {
685
682
  if (!t) return;
686
683
  const o = this.#p(e, s, t);
687
684
  if (!o) {
688
- const f = t.replaceAll("this..", "this.");
689
- s ? k(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);
690
687
  return;
691
688
  }
692
689
  const i = this.#t;
693
- o.forEach((f) => {
694
- const a = E(f);
695
- if (typeof this[a] == "function") return;
690
+ o.forEach((a) => {
691
+ const f = S(a);
692
+ if (typeof this[f] == "function") return;
696
693
  const l = i.propToExprsMap;
697
- let h = l.get(a);
698
- 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);
699
696
  });
700
- for (const [f, a] of this.#o.entries())
701
- for (const l of a) {
702
- const h = l instanceof HTMLElement || l instanceof CSSStyleRule ? l : l.element;
703
- h instanceof CSSStyleRule || h.isConnected || this.#o.set(
704
- f,
705
- 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)
706
703
  );
707
704
  }
708
- let r = this.#o.get(t);
709
- r || (r = [], this.#o.set(t, r)), r.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement && this.#N(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);
710
707
  const c = this.#s(t);
711
- s ? k(e, s, c) : this.#v(e, c);
708
+ s ? B(e, s, c) : this.#A(e, c);
712
709
  }
713
710
  // This follows the best practice
714
711
  // "Do not override author-set, global attributes."
@@ -716,64 +713,74 @@ class d extends HTMLElement {
716
713
  this.hasAttribute(t) || this.setAttribute(t, e);
717
714
  }
718
715
  setFormValue(t, e) {
719
- !this.#i || !D(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));
720
717
  }
721
718
  static ssr(t = {}) {
722
- for (const [a, l] of Object.entries(this.properties))
723
- if (t[a] === void 0) {
724
- const { value: h } = l;
725
- h !== void 0 && (t[a] = h);
726
- }
727
- function e(a) {
728
- return new Function("return " + a).call(t);
729
- }
730
- let s = "";
731
- for (const [a, l] of Object.entries(t)) {
732
- const h = this.getAttrName(a);
733
- 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]}"`;
734
725
  }
735
- const o = this.buildHTML(), { document: i } = Y(o), r = i.querySelectorAll("*");
736
- for (const a of r) {
737
- for (const l of a.attributes) {
738
- const { value: h } = l;
739
- $.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);
740
731
  }
741
- for (const l of a.childNodes)
742
- if (l.nodeType === 8) {
743
- const h = l.textContent ?? "";
744
- if ($.test(h)) {
745
- const m = i.createTextNode(e(h));
746
- 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);
747
751
  }
748
752
  }
753
+ });
749
754
  }
750
- const c = [...i.children].map((a) => a.outerHTML).join(`
751
- `), { 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;
752
759
  return `
753
- <${f}${s}>
760
+ <${u}${e}>
754
761
  <template shadowrootmode="open">
755
- ${c}
762
+ ${l}
756
763
  </template>
757
- </${f}>
764
+ </${u}>
758
765
  `;
759
766
  }
760
767
  #e(t, e, s) {
761
768
  const o = t instanceof HTMLElement ? t.localName : "CSS rule";
762
- throw new v(
769
+ throw new x(
763
770
  `component ${this.#t.elementName}` + (t ? `, element "${o}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${s}`
764
771
  );
765
772
  }
766
773
  #c(t, e, s) {
767
774
  this.#e(t, e, `refers to missing property "${s}"`);
768
775
  }
769
- #E(t, e) {
776
+ #T(t, e) {
770
777
  return this.#M(t, this.getAttribute(e));
771
778
  }
772
779
  #M(t, e) {
773
- if (e?.match(H)) return e;
780
+ if (e?.match(I)) return e;
774
781
  const s = this.#t, { type: o } = s.properties[t];
775
782
  if (o || this.#e(null, t, "does not specify its type"), o === String) return e;
776
- if (o === Number) return _(e);
783
+ if (o === Number) return W(e);
777
784
  if (o === Boolean)
778
785
  return e === "true" ? !0 : e === "false" || e === "null" ? !1 : (e && e !== t && this.#e(
779
786
  null,
@@ -784,9 +791,9 @@ class d extends HTMLElement {
784
791
  // Updates the matching attribute for a property.
785
792
  // VS Code thinks this is never called, but it is called by #defineProp.
786
793
  #O(t, e, s, o) {
787
- if (D(s)) {
788
- const i = e === Boolean ? this.hasAttribute(o) : this.#E(t, o);
789
- s !== i && tt(this, o || t, s);
794
+ if (q(s)) {
795
+ const i = e === Boolean ? this.hasAttribute(o) : this.#T(t, o);
796
+ s !== i && it(this, o || t, s);
790
797
  }
791
798
  }
792
799
  // Updates all computed properties that reference this property.
@@ -796,7 +803,7 @@ class d extends HTMLElement {
796
803
  for (const [o, i] of s)
797
804
  this[o] = this.#s(i);
798
805
  }
799
- #v(t, e) {
806
+ #A(t, e) {
800
807
  if (e === void 0) return;
801
808
  const s = t instanceof HTMLElement;
802
809
  Array.isArray(e) && (e = e.join(""));
@@ -807,11 +814,11 @@ class d extends HTMLElement {
807
814
  " computed content is not a string or number"
808
815
  );
809
816
  const i = String(e);
810
- if (t instanceof HTMLElement && M(t))
817
+ if (t instanceof HTMLElement && C(t))
811
818
  t.value = i;
812
819
  else if (s && o === "string" && i.trim().startsWith("<")) {
813
- const r = ot(i);
814
- t.innerHTML = r, this.#A(t), this.#g(t);
820
+ const n = lt(i);
821
+ t.innerHTML = n, this.#v(t), this.#g(t);
815
822
  } else s && (t.textContent = i);
816
823
  }
817
824
  // Update corresponding parent web component property if bound to one.
@@ -823,8 +830,8 @@ class d extends HTMLElement {
823
830
  if (!(o instanceof ShadowRoot)) return;
824
831
  const { host: i } = o;
825
832
  if (!i) return;
826
- const r = i;
827
- r[s] = e;
833
+ const n = i;
834
+ n[s] = e;
828
835
  }
829
836
  /**
830
837
  * @param state - WrecState object
@@ -840,22 +847,22 @@ class d extends HTMLElement {
840
847
  this.#_(t, e);
841
848
  for (const [s, o] of Object.entries(e))
842
849
  if (this.#n(o)) {
843
- const i = J(t, s);
850
+ const i = Y(t, s);
844
851
  i !== void 0 && (this[o] = i);
845
- const r = this.#t.properties[o];
846
- r.state = t, r.stateProp = s;
852
+ const n = this.#t.properties[o];
853
+ n.state = t, n.stateProp = s;
847
854
  }
848
855
  t.addListener(this, e);
849
856
  }
850
857
  #H() {
851
858
  const t = new Set(Object.keys(this.#t.properties));
852
859
  for (const e of this.getAttributeNames())
853
- if (!it.has(e) && !e.startsWith("on")) {
860
+ if (!ht.has(e) && !e.startsWith("on")) {
854
861
  if (e === "form-assoc") {
855
862
  this.#y();
856
863
  continue;
857
864
  }
858
- if (!t.has(d.getPropName(e))) {
865
+ if (!t.has(b.getPropName(e))) {
859
866
  if (e === "name") {
860
867
  this.#y();
861
868
  continue;
@@ -865,16 +872,16 @@ class d extends HTMLElement {
865
872
  }
866
873
  }
867
874
  #p(t, e, s) {
868
- const o = s.match(H);
875
+ const o = s.match(I);
869
876
  if (o)
870
877
  return o.forEach((i) => {
871
- const r = E(i);
872
- this[r] === void 0 && this.#c(t, e, r);
878
+ const n = S(i);
879
+ this[n] === void 0 && this.#c(t, e, n);
873
880
  }), o;
874
881
  }
875
882
  #_(t, e) {
876
883
  for (const [s, o] of Object.entries(e)) {
877
- let i = J(t, s);
884
+ let i = Y(t, s);
878
885
  i === void 0 && this.#e(this, void 0, `invalid state path "${s}"`), i = this[o], this.#n(o) || this.#e(
879
886
  null,
880
887
  o,
@@ -901,19 +908,19 @@ class d extends HTMLElement {
901
908
  `was set to a ${o}, but must be a ${e.name}`
902
909
  );
903
910
  }
904
- #A(t) {
911
+ #v(t) {
905
912
  const e = Array.from(t.querySelectorAll("*"));
906
913
  for (const s of e) {
907
914
  const o = [];
908
915
  for (const i of Array.from(s.attributes)) {
909
- const r = i.name;
910
- if (r.startsWith("on")) {
911
- let c = r.slice(2);
916
+ const n = i.name;
917
+ if (n.startsWith("on")) {
918
+ let c = n.slice(2);
912
919
  c = c[0].toLowerCase() + c.slice(1).toLowerCase();
913
- const f = i.value;
914
- this.#p(s, r, f);
915
- let a;
916
- 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);
917
924
  }
918
925
  }
919
926
  for (const i of o)
@@ -921,40 +928,40 @@ class d extends HTMLElement {
921
928
  }
922
929
  }
923
930
  }
924
- function yt(n, ...t) {
925
- let e = G(n, t);
931
+ function Ct(r, ...t) {
932
+ let e = st(r, t);
926
933
  for (; ; ) {
927
- const s = nt.exec(e);
934
+ const s = ut.exec(e);
928
935
  if (!s) break;
929
936
  const o = s[2];
930
- if ($.test(o)) {
937
+ if (L.test(o)) {
931
938
  const i = s[1];
932
939
  if (!i.startsWith("--")) {
933
- const r = `--${i}: ${o};
940
+ const n = `--${i}: ${o};
934
941
  ${i}: var(--${i})`;
935
- e = Q(e, s.index, s[0].length, r);
942
+ e = ot(e, s.index, s[0].length, n);
936
943
  }
937
944
  }
938
945
  }
939
946
  return e;
940
947
  }
941
- function wt(n, ...t) {
942
- let e = G(n, t);
948
+ function xt(r, ...t) {
949
+ let e = st(r, t);
943
950
  for (; ; ) {
944
- const s = at.exec(e);
951
+ const s = mt.exec(e);
945
952
  if (!s || s[1] === "style") break;
946
- const o = ut(s[2]);
947
- if ($.test(o)) {
948
- const i = `<!-- ${o.trim()} -->`, r = s.index + s[0].indexOf(">") + 1;
949
- 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);
950
957
  }
951
958
  }
952
959
  return e;
953
960
  }
954
961
  export {
955
- d as Wrec,
956
- F as WrecState,
957
- gt as createElement,
958
- yt as css,
959
- wt as html
962
+ b as Wrec,
963
+ z as WrecState,
964
+ St as createElement,
965
+ Ct as css,
966
+ xt as html
960
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.1",
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
- "linkedom": "^0.18.12",
49
+ "node-html-parser": "^7.1.0",
50
50
  "xss": "^1.0.15"
51
51
  }
52
52
  }