@trunkjs/browser-utils 1.0.52 → 1.0.54

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.0.54 (2026-09-07)
2
+
3
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
4
+
5
+ ## 1.0.53 (2026-09-01)
6
+
7
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
8
+
1
9
  ## 1.0.52 (2026-08-29)
2
10
 
3
11
  ### 🩹 Fixes
@@ -10,6 +18,8 @@
10
18
 
11
19
  ## Unreleased
12
20
 
21
+ - Treat named value elements as opaque controls so nested object values are not collected twice.
22
+
13
23
  ## 1.0.51 (2026-08-29)
14
24
 
15
25
  ### ✨ Features
package/index.js CHANGED
@@ -1,37 +1,37 @@
1
- var O = Object.defineProperty;
2
- var S = (n) => {
1
+ var j = Object.defineProperty;
2
+ var I = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var j = (n, t, e) => t in n ? O(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
- var f = (n, t, e) => j(n, typeof t != "symbol" ? t + "" : t, e), T = (n, t, e) => t.has(n) || S("Cannot " + e);
7
- var l = (n, t, e) => (T(n, t, "read from private field"), e ? e.call(n) : t.get(n)), m = (n, t, e) => t.has(n) ? S("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), y = (n, t, e, i) => (T(n, t, "write to private field"), i ? i.call(n, e) : t.set(n, e), e), w = (n, t, e) => (T(n, t, "access private method"), e);
8
- const E = [
5
+ var F = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
+ var f = (n, t, e) => F(n, typeof t != "symbol" ? t + "" : t, e), L = (n, t, e) => t.has(n) || I("Cannot " + e);
7
+ var c = (n, t, e) => (L(n, t, "read from private field"), e ? e.call(n) : t.get(n)), m = (n, t, e) => t.has(n) ? I("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), p = (n, t, e, i) => (L(n, t, "write to private field"), i ? i.call(n, e) : t.set(n, e), e), g = (n, t, e) => (L(n, t, "access private method"), e);
8
+ const k = [
9
9
  { name: "xs", minWidth: 0 },
10
10
  { name: "sm", minWidth: 576 },
11
11
  { name: "md", minWidth: 768 },
12
12
  { name: "lg", minWidth: 992 },
13
13
  { name: "xl", minWidth: 1200 },
14
14
  { name: "xxl", minWidth: 1400 }
15
- ], _ = E.reduce(
15
+ ], W = k.reduce(
16
16
  (n, t) => (n[t.name] = t.minWidth, n),
17
17
  {}
18
18
  );
19
- function p(n) {
20
- if (!(n in _))
19
+ function E(n) {
20
+ if (!(n in W))
21
21
  throw new Error(`Unknown breakpoint: ${n}`);
22
- return _[n];
22
+ return W[n];
23
23
  }
24
- function F() {
24
+ function H() {
25
25
  return window.visualViewport ? window.visualViewport.width : window.innerWidth;
26
26
  }
27
27
  function U(n) {
28
- n === void 0 && (n = F());
29
- for (let t = E.length - 1; t >= 0; t--)
30
- if (n >= E[t].minWidth)
31
- return E[t].name;
28
+ n === void 0 && (n = H());
29
+ for (let t = k.length - 1; t >= 0; t--)
30
+ if (n >= k[t].minWidth)
31
+ return k[t].name;
32
32
  return "xs";
33
33
  }
34
- function nt(n, t = {}, e = []) {
34
+ function it(n, t = {}, e = []) {
35
35
  Array.isArray(e) || (e = [e]);
36
36
  const i = document.createElement(n);
37
37
  for (const r in t)
@@ -40,7 +40,7 @@ function nt(n, t = {}, e = []) {
40
40
  i.append(typeof r == "string" ? document.createTextNode(r) : r);
41
41
  return i;
42
42
  }
43
- class C {
43
+ class N {
44
44
  /**
45
45
  *
46
46
  * @param delay Debounce delay in milliseconds
@@ -75,27 +75,27 @@ class C {
75
75
  }
76
76
  }
77
77
  }
78
- function it(n, t = !1) {
78
+ function rt(n, t = !1) {
79
79
  const e = /* @__PURE__ */ new WeakMap();
80
80
  return function(i, r) {
81
81
  if (r.kind !== "method") return i;
82
82
  const s = r.name;
83
- return function(...a) {
84
- let o = e.get(this);
85
- o || (o = /* @__PURE__ */ new Map(), e.set(this, o));
86
- let u = o.get(s);
87
- u || (u = new C(n, t), o.set(s, u)), u.debounce(() => i.apply(this, a));
83
+ return function(...o) {
84
+ let a = e.get(this);
85
+ a || (a = /* @__PURE__ */ new Map(), e.set(this, a));
86
+ let d = a.get(s);
87
+ d || (d = new N(n, t), a.set(s, d)), d.debounce(() => i.apply(this, o));
88
88
  };
89
89
  };
90
90
  }
91
- const H = /* @__PURE__ */ new Set(["button", "image", "reset", "submit"]);
92
- function z(n) {
91
+ const z = /* @__PURE__ */ new Set(["button", "image", "reset", "submit"]);
92
+ function G(n) {
93
93
  return n.endsWith("[]") ? n.slice(0, -2) : n;
94
94
  }
95
- function L(n) {
95
+ function A(n) {
96
96
  return n instanceof HTMLInputElement ? n.type.toLowerCase() : "";
97
97
  }
98
- function G(n) {
98
+ function K(n) {
99
99
  if (n instanceof HTMLSelectElement && n.multiple)
100
100
  return Array.from(n.selectedOptions, (t) => t.value);
101
101
  if (n instanceof HTMLInputElement) {
@@ -108,7 +108,7 @@ function G(n) {
108
108
  }
109
109
  return n.value;
110
110
  }
111
- function K(n, t) {
111
+ function q(n, t) {
112
112
  if (n instanceof HTMLSelectElement && n.multiple) {
113
113
  const e = new Set(Array.isArray(t) ? t.map(String) : t == null ? [] : [String(t)]);
114
114
  for (const i of Array.from(n.options))
@@ -131,14 +131,14 @@ function K(n, t) {
131
131
  }
132
132
  n.value = t;
133
133
  }
134
- function A(n, t, e) {
134
+ function x(n, t, e) {
135
135
  if (!(e == null || e === !1)) {
136
136
  if (e instanceof FormData) {
137
137
  e.forEach((i, r) => n.append(r, i));
138
138
  return;
139
139
  }
140
140
  if (Array.isArray(e)) {
141
- e.forEach((i) => A(n, t, i));
141
+ e.forEach((i) => x(n, t, i));
142
142
  return;
143
143
  }
144
144
  if (e instanceof Blob) {
@@ -148,7 +148,7 @@ function A(n, t, e) {
148
148
  n.append(t, String(e));
149
149
  }
150
150
  }
151
- class rt {
151
+ class st {
152
152
  constructor(t) {
153
153
  this.root = t;
154
154
  }
@@ -156,14 +156,14 @@ class rt {
156
156
  const t = [];
157
157
  for (const e of Array.from(this.root.querySelectorAll("[name]"))) {
158
158
  const i = this.getName(e);
159
- !i || !this.isValueElement(e) || t.push({
159
+ !i || !this.isValueElement(e) || this.hasValueElementParent(e) || t.push({
160
160
  name: i,
161
161
  element: e,
162
162
  get value() {
163
- return G(e);
163
+ return K(e);
164
164
  },
165
165
  set value(r) {
166
- K(e, r);
166
+ q(e, r);
167
167
  }
168
168
  });
169
169
  }
@@ -186,20 +186,20 @@ class rt {
186
186
  for (const e of this.entries) {
187
187
  if (this.isDisabled(e.element))
188
188
  continue;
189
- const i = L(e.element);
189
+ const i = A(e.element);
190
190
  if (i === "checkbox" || i === "radio") {
191
191
  const r = e.element;
192
- r.checked && A(t, e.name, r.value);
192
+ r.checked && x(t, e.name, r.value);
193
193
  continue;
194
194
  }
195
- A(t, e.name, e.value);
195
+ x(t, e.name, e.value);
196
196
  }
197
197
  return t;
198
198
  }
199
199
  get groupedEntries() {
200
200
  const t = /* @__PURE__ */ new Map();
201
201
  for (const e of this.entries) {
202
- const i = z(e.name), r = t.get(i) ?? [];
202
+ const i = G(e.name), r = t.get(i) ?? [];
203
203
  r.push(e), t.set(i, r);
204
204
  }
205
205
  return t;
@@ -210,25 +210,35 @@ class rt {
210
210
  return (e == null ? void 0 : e.trim()) || ((i = t.getAttribute("name")) == null ? void 0 : i.trim()) || null;
211
211
  }
212
212
  isValueElement(t) {
213
- return !("value" in t) || t instanceof HTMLButtonElement ? !1 : !(t instanceof HTMLInputElement && H.has(t.type.toLowerCase()));
213
+ return !("value" in t) || t instanceof HTMLButtonElement ? !1 : !(t instanceof HTMLInputElement && z.has(t.type.toLowerCase()));
214
+ }
215
+ /** A named value element owns its value, so its descendants are not collected twice. */
216
+ hasValueElementParent(t) {
217
+ let e = t.parentElement;
218
+ for (; e && e !== this.root; ) {
219
+ if (this.getName(e) && this.isValueElement(e))
220
+ return !0;
221
+ e = e.parentElement;
222
+ }
223
+ return !1;
214
224
  }
215
225
  isDisabled(t) {
216
226
  return !!t.disabled || t.hasAttribute("disabled") || t.matches(":disabled");
217
227
  }
218
228
  readGroup(t) {
219
229
  var r;
220
- const e = new Set(t.map((s) => L(s.element))), i = t.some((s) => s.name.endsWith("[]"));
230
+ const e = new Set(t.map((s) => A(s.element))), i = t.some((s) => s.name.endsWith("[]"));
221
231
  return e.size === 1 && e.has("radio") ? (r = t.find((s) => s.element.checked)) == null ? void 0 : r.element.value : e.size === 1 && e.has("checkbox") ? t.length === 1 && !i ? t[0].element.checked : t.filter((s) => s.element.checked).map((s) => s.element.value) : i ? t.flatMap((s) => {
222
- const a = s.value;
223
- return a === void 0 ? [] : Array.isArray(a) ? a : [a];
232
+ const o = s.value;
233
+ return o === void 0 ? [] : Array.isArray(o) ? o : [o];
224
234
  }) : t.length === 1 ? t[0].value : t.map((s) => s.value).at(-1);
225
235
  }
226
236
  writeGroup(t, e) {
227
- const i = new Set(t.map((s) => L(s.element))), r = t.some((s) => s.name.endsWith("[]"));
237
+ const i = new Set(t.map((s) => A(s.element))), r = t.some((s) => s.name.endsWith("[]"));
228
238
  if (i.size === 1 && i.has("radio")) {
229
239
  t.forEach((s) => {
230
- const a = s.element;
231
- a.checked = a.value === String(e);
240
+ const o = s.element;
241
+ o.checked = o.value === String(e);
232
242
  });
233
243
  return;
234
244
  }
@@ -238,15 +248,15 @@ class rt {
238
248
  return;
239
249
  }
240
250
  const s = new Set((Array.isArray(e) ? e : e == null ? [] : [e]).map(String));
241
- t.forEach((a) => {
242
- const o = a.element;
243
- o.checked = s.has(o.value);
251
+ t.forEach((o) => {
252
+ const a = o.element;
253
+ a.checked = s.has(a.value);
244
254
  });
245
255
  return;
246
256
  }
247
257
  if (r && Array.isArray(e) && t.length > 1) {
248
- t.forEach((s, a) => {
249
- s.value = e[a];
258
+ t.forEach((s, o) => {
259
+ s.value = e[o];
250
260
  });
251
261
  return;
252
262
  }
@@ -255,7 +265,7 @@ class rt {
255
265
  });
256
266
  }
257
267
  }
258
- function st(n) {
268
+ function ot(n) {
259
269
  if (typeof n.lineNumber == "number")
260
270
  return {
261
271
  file: n.fileName || n.sourceURL,
@@ -277,7 +287,7 @@ function st(n) {
277
287
  }
278
288
  return { file: n.fileName || n.sourceURL };
279
289
  }
280
- class q {
290
+ class J {
281
291
  constructor(t, e, i, r = "main") {
282
292
  this._debug = t, this.myTag = e, this.myElementId = i, this.instanceId = r;
283
293
  }
@@ -298,7 +308,7 @@ class q {
298
308
  throw this.error(...t), new Error(e);
299
309
  }
300
310
  }
301
- class ot {
311
+ class at {
302
312
  constructor(t, e = !0) {
303
313
  f(this, "label");
304
314
  f(this, "last");
@@ -328,10 +338,10 @@ class ot {
328
338
  return this.running;
329
339
  }
330
340
  }
331
- function J(n) {
341
+ function X(n) {
332
342
  return typeof n == "object" && n !== null && !Array.isArray(n);
333
343
  }
334
- function X(n) {
344
+ function Q(n) {
335
345
  if (n != null)
336
346
  try {
337
347
  return JSON.parse(n);
@@ -339,28 +349,28 @@ function X(n) {
339
349
  return;
340
350
  }
341
351
  }
342
- function P(n) {
352
+ function $(n) {
343
353
  const t = JSON.stringify(n);
344
354
  return t === void 0 ? "null" : t;
345
355
  }
346
- function Q(n, t) {
356
+ function Y(n, t) {
347
357
  const e = { ...t };
348
- if (J(n))
358
+ if (X(n))
349
359
  for (const i of Object.keys(t))
350
360
  i in n && (e[i] = n[i]);
351
361
  return e;
352
362
  }
353
- class I {
363
+ class D {
354
364
  constructor(t, e, i) {
355
365
  f(this, "cache");
356
366
  this.backend = t, this.storageKey = e, this.initialValue = i;
357
367
  }
358
368
  read() {
359
369
  if (this.cache) return this.cache;
360
- const t = this.backend ? X(this.backend.getItem(this.storageKey)) : void 0, e = Q(t, this.initialValue);
370
+ const t = this.backend ? Q(this.backend.getItem(this.storageKey)) : void 0, e = Y(t, this.initialValue);
361
371
  if (this.backend && this.backend.getItem(this.storageKey) == null)
362
372
  try {
363
- this.backend.setItem(this.storageKey, P(e));
373
+ this.backend.setItem(this.storageKey, $(e));
364
374
  } catch {
365
375
  }
366
376
  return this.cache = e, e;
@@ -368,7 +378,7 @@ class I {
368
378
  write(t) {
369
379
  if (this.cache = t, !!this.backend)
370
380
  try {
371
- this.backend.setItem(this.storageKey, P(t));
381
+ this.backend.setItem(this.storageKey, $(t));
372
382
  } catch {
373
383
  }
374
384
  }
@@ -382,8 +392,8 @@ class I {
382
392
  },
383
393
  set: (e, i, r) => {
384
394
  if (typeof i != "string") return !1;
385
- const a = { ...this.read() };
386
- return a[i] = r, this.write(a), !0;
395
+ const o = { ...this.read() };
396
+ return o[i] = r, this.write(o), !0;
387
397
  },
388
398
  deleteProperty: (e, i) => {
389
399
  if (typeof i != "string") return !1;
@@ -416,47 +426,47 @@ class I {
416
426
  return new Proxy({}, t);
417
427
  }
418
428
  }
419
- function W(n) {
429
+ function B(n) {
420
430
  const t = globalThis.window;
421
431
  return (n === "session" ? t == null ? void 0 : t.sessionStorage : t == null ? void 0 : t.localStorage) ?? void 0;
422
432
  }
423
- function at(n, t) {
424
- return new I(W("session"), n, t).asProxy();
425
- }
426
433
  function ut(n, t) {
427
- return new I(W("local"), n, t).asProxy();
434
+ return new D(B("session"), n, t).asProxy();
428
435
  }
429
- function x(n, t, e) {
436
+ function ct(n, t) {
437
+ return new D(B("local"), n, t).asProxy();
438
+ }
439
+ function _(n, t, e) {
430
440
  return new Promise((i, r) => {
431
- const s = (a) => {
432
- n.removeEventListener(t, s, e), i(a);
441
+ const s = (o) => {
442
+ n.removeEventListener(t, s, e), i(o);
433
443
  };
434
444
  n.addEventListener(t, s, e);
435
445
  });
436
446
  }
437
- function Y() {
447
+ function Z() {
438
448
  return document.readyState === "loading" ? new Promise((n) => {
439
449
  document.addEventListener("DOMContentLoaded", () => n());
440
450
  }) : Promise.resolve();
441
451
  }
442
- function ct() {
443
- return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() : x(window, "loader:ready") : M();
444
- }
445
452
  function dt() {
446
- return window.tj_loader_state ? window.tj_loader_state === "pre-visual" || window.tj_loader_state === "visual" ? Promise.resolve() : x(window, "loader:pre-visual") : M();
453
+ return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() : _(window, "loader:ready") : C();
447
454
  }
448
455
  function lt() {
449
- return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() : x(window, "loader:visual") : M();
456
+ return window.tj_loader_state ? window.tj_loader_state === "pre-visual" || window.tj_loader_state === "visual" ? Promise.resolve() : _(window, "loader:pre-visual") : C();
457
+ }
458
+ function ht() {
459
+ return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() : _(window, "loader:visual") : C();
450
460
  }
451
- function M(n = window) {
461
+ function C(n = window) {
452
462
  return n || (n = window), n === window ? document.readyState === "complete" ? Promise.resolve() : new Promise((t) => window.addEventListener("load", () => t(), { once: !0 })) : n instanceof HTMLImageElement ? n.complete && n.naturalWidth !== 0 ? Promise.resolve() : new Promise((t, e) => {
453
463
  n.addEventListener("load", () => t(), { once: !0 }), n.addEventListener("error", () => e(new Error("image error")), { once: !0 });
454
464
  }) : n instanceof HTMLMediaElement ? n.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA ? Promise.resolve() : new Promise((t) => n.addEventListener("loadeddata", () => t(), { once: !0 })) : new Promise((t) => n.addEventListener("load", () => t(), { once: !0 }));
455
465
  }
456
- function ht(n) {
466
+ function ft(n) {
457
467
  return new Promise((t) => setTimeout(t, n));
458
468
  }
459
- function ft(n) {
469
+ function mt(n) {
460
470
  return new Promise((t) => {
461
471
  const e = (i) => {
462
472
  n.removeEventListener("animationend", e), t(i);
@@ -464,99 +474,99 @@ function ft(n) {
464
474
  n.addEventListener("animationend", e);
465
475
  });
466
476
  }
467
- function mt(n) {
477
+ function gt(n) {
468
478
  var e, i;
469
479
  class t extends n {
470
480
  constructor() {
471
481
  super(...arguments);
472
- m(this, e, new C(200, 5e3));
482
+ m(this, e, new N(200, 5e3));
473
483
  f(this, "currentBreakPoint", null);
474
484
  m(this, i, async () => {
475
- var b;
476
- await l(this, e).wait(), await Y();
477
- const a = this, o = window.innerWidth;
478
- let u = getComputedStyle(a).getPropertyValue("--breakpoint");
479
- if (!u || u === "")
485
+ var h;
486
+ await c(this, e).wait(), await Z();
487
+ const o = this, a = window.innerWidth;
488
+ let d = getComputedStyle(o).getPropertyValue("--breakpoint");
489
+ if (!d || d === "")
480
490
  return;
481
- u = u.trim().replace(/^['"]|['"]$/g, "");
482
- const c = u.split(","), d = c[0].trim(), h = ((b = c[1]) == null ? void 0 : b.trim()) ?? d, g = U(o);
483
- this.currentBreakPoint !== g && (p(h) <= p(g) ? a.setAttribute("mode", "desktop") : p(d) > p(g) ? a.setAttribute("mode", "mobile") : a.setAttribute("mode", "tablet"));
491
+ d = d.trim().replace(/^['"]|['"]$/g, "");
492
+ const w = d.split(","), y = w[0].trim(), u = ((h = w[1]) == null ? void 0 : h.trim()) ?? y, l = U(a);
493
+ this.currentBreakPoint !== l && (E(u) <= E(l) ? o.setAttribute("mode", "desktop") : E(y) > E(l) ? o.setAttribute("mode", "mobile") : o.setAttribute("mode", "tablet"));
484
494
  });
485
495
  }
486
496
  connectedCallback() {
487
497
  super.connectedCallback();
488
498
  try {
489
- l(this, i).call(this), window.addEventListener("resize", l(this, i)), l(this, i).call(this);
490
- } catch (a) {
491
- throw console.error("Error in BreakPointMixin:", a, "in element", this), a;
499
+ c(this, i).call(this), window.addEventListener("resize", c(this, i)), c(this, i).call(this);
500
+ } catch (o) {
501
+ throw console.error("Error in BreakPointMixin:", o, "in element", this), o;
492
502
  }
493
503
  }
494
504
  disconnectedCallback() {
495
- super.disconnectedCallback(), window.removeEventListener("resize", l(this, i));
505
+ super.disconnectedCallback(), window.removeEventListener("resize", c(this, i));
496
506
  }
497
507
  }
498
508
  return e = new WeakMap(), i = new WeakMap(), t;
499
509
  }
500
- const k = Symbol("listenerDefs"), $ = Symbol("withEventBindings");
501
- function gt(n, t) {
510
+ const v = Symbol("listenerDefs"), V = Symbol("withEventBindings");
511
+ function wt(n, t) {
502
512
  const e = Array.isArray(n) ? n : [n];
503
513
  return function(i, r) {
504
514
  if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
505
515
  return r.addInitializer(function() {
506
516
  const s = this;
507
- (s[k] || (s[k] = [])).push({
517
+ (s[v] || (s[v] = [])).push({
508
518
  method: r.name,
509
519
  events: [...e],
510
520
  opts: t
511
521
  });
512
522
  }), function(...s) {
513
- if (!this[$])
523
+ if (!this[V])
514
524
  throw new Error("[EventBindings] @Listen - decorator requires EventBindingMixin.");
515
525
  return i.apply(this, s);
516
526
  };
517
527
  };
518
528
  }
519
- function Z(n, t) {
529
+ function tt(n, t) {
520
530
  var e;
521
531
  return !t || t === "host" ? n : t === "document" ? n.ownerDocument ?? document : t === "window" ? ((e = n.ownerDocument) == null ? void 0 : e.defaultView) ?? window : t === "shadowRoot" ? n.shadowRoot ?? n : typeof t == "function" ? t(n) : t;
522
532
  }
523
- function wt(n) {
524
- var e, i, N;
533
+ function yt(n) {
534
+ var e, i, R;
525
535
  class t extends n {
526
- constructor(...o) {
527
- super(...o);
536
+ constructor(...a) {
537
+ super(...a);
528
538
  m(this, i);
529
539
  m(this, e);
530
- this[$] = !0;
540
+ this[V] = !0;
531
541
  }
532
542
  connectedCallback() {
533
- var o;
534
- (o = super.connectedCallback) == null || o.call(this), w(this, i, N).call(this);
543
+ var a;
544
+ (a = super.connectedCallback) == null || a.call(this), g(this, i, R).call(this);
535
545
  }
536
546
  disconnectedCallback() {
537
- var o, u;
538
- (o = l(this, e)) == null || o.abort(), (u = super.disconnectedCallback) == null || u.call(this);
547
+ var a, d;
548
+ (a = c(this, e)) == null || a.abort(), (d = super.disconnectedCallback) == null || d.call(this);
539
549
  }
540
550
  }
541
- return e = new WeakMap(), i = new WeakSet(), N = function() {
542
- var u, c, d;
543
- (u = l(this, e)) == null || u.abort(), y(this, e, new AbortController());
544
- const o = this[k] || [];
545
- for (const h of o) {
546
- const g = Z(this, (c = h.opts) == null ? void 0 : c.target), b = ((d = h.opts) == null ? void 0 : d.options) ?? {}, R = this[h.method].bind(this);
547
- for (const V of h.events)
548
- g.addEventListener(V, R, { ...b, signal: l(this, e).signal });
551
+ return e = new WeakMap(), i = new WeakSet(), R = function() {
552
+ var d, w, y;
553
+ (d = c(this, e)) == null || d.abort(), p(this, e, new AbortController());
554
+ const a = this[v] || [];
555
+ for (const u of a) {
556
+ const l = tt(this, (w = u.opts) == null ? void 0 : w.target), h = ((y = u.opts) == null ? void 0 : y.options) ?? {}, b = this[u.method].bind(this);
557
+ for (const T of u.events)
558
+ l.addEventListener(T, b, { ...h, signal: c(this, e).signal });
549
559
  }
550
560
  }, t;
551
561
  }
552
- let tt = 1;
553
- function yt(n) {
562
+ let et = 1;
563
+ function pt(n) {
554
564
  var e, i, r;
555
565
  class t extends n {
556
566
  constructor() {
557
567
  super(...arguments);
558
568
  m(this, e, null);
559
- m(this, i, tt++);
569
+ m(this, i, et++);
560
570
  m(this, r, null);
561
571
  }
562
572
  /**
@@ -564,33 +574,33 @@ function yt(n) {
564
574
  * on the next log/warn/error call.
565
575
  */
566
576
  invalidateDebugCache() {
567
- y(this, e, null);
577
+ p(this, e, null);
568
578
  }
569
579
  get _debug() {
570
- return l(this, e) !== null ? l(this, e) : (this instanceof HTMLElement && y(this, e, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), l(this, e) === !0 && console.info(
580
+ return c(this, e) !== null ? c(this, e) : (this instanceof HTMLElement && p(this, e, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), c(this, e) === !0 && console.info(
571
581
  // @ts-expect-error - it says tagName is not defined -whatever
572
- `[DEBUG][ID:${l(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`,
582
+ `[DEBUG][ID:${c(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`,
573
583
  this
574
- ), l(this, e) ?? !1);
584
+ ), c(this, e) ?? !1);
575
585
  }
576
- getLogger(o = "main") {
577
- const u = "<" + (this.tagName || this.constructor.name || "UnknownElement") + ">";
578
- return l(this, r) || y(this, r, new q(this._debug, u, `${l(this, i)}`, o)), l(this, r);
586
+ getLogger(a = "main") {
587
+ const d = "<" + (this.tagName || this.constructor.name || "UnknownElement") + ">";
588
+ return c(this, r) || p(this, r, new J(this._debug, d, `${c(this, i)}`, a)), c(this, r);
579
589
  }
580
- debug(...o) {
581
- this.getLogger().debug(...o);
590
+ debug(...a) {
591
+ this.getLogger().debug(...a);
582
592
  }
583
- log(...o) {
584
- this.getLogger().log(...o);
593
+ log(...a) {
594
+ this.getLogger().log(...a);
585
595
  }
586
- warn(...o) {
587
- this.getLogger().warn(...o);
596
+ warn(...a) {
597
+ this.getLogger().warn(...a);
588
598
  }
589
- error(...o) {
590
- this.getLogger().error(...o);
599
+ error(...a) {
600
+ this.getLogger().error(...a);
591
601
  }
592
- throwError(...o) {
593
- return this.getLogger().throwError(...o);
602
+ throwError(...a) {
603
+ return this.getLogger().throwError(...a);
594
604
  }
595
605
  }
596
606
  return e = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
@@ -637,61 +647,72 @@ function bt(n) {
637
647
  }
638
648
  return t;
639
649
  }
640
- function pt(n) {
641
- var e, D, r, v, B;
650
+ function Et(n) {
651
+ var e, i, M, S, o, P, O;
642
652
  class t extends n {
643
653
  constructor() {
644
654
  super(...arguments);
645
- m(this, e);
646
- m(this, r, (c) => {
647
- const d = c.target, h = w(this, e, v).call(this, d.assignedNodes({ flatten: !0 })), g = w(this, e, v).call(this, d.childNodes);
648
- h || g ? d.classList.remove("slot-empty") : d.classList.add("slot-empty");
655
+ m(this, i);
656
+ // Slots können bei Lit-Updates neu entstehen; die WeakMap verhindert doppelte Listener auf bestehenden Slots.
657
+ m(this, e, /* @__PURE__ */ new WeakMap());
658
+ m(this, o, (u) => {
659
+ g(this, i, S).call(this, u.target);
649
660
  });
650
661
  }
651
- firstUpdated(c) {
652
- var d;
653
- (d = super.firstUpdated) == null || d.call(this, c), w(this, e, D).call(this);
662
+ firstUpdated(u) {
663
+ var l;
664
+ (l = super.firstUpdated) == null || l.call(this, u), g(this, i, M).call(this);
665
+ }
666
+ updated(u) {
667
+ var l;
668
+ (l = super.updated) == null || l.call(this, u), g(this, i, M).call(this);
654
669
  }
655
670
  }
656
- return e = new WeakSet(), D = function() {
657
- var d;
658
- const c = (d = this.shadowRoot) == null ? void 0 : d.querySelectorAll("slot");
659
- c == null || c.forEach((h) => {
660
- w(this, e, v).call(this, h.childNodes) || h.classList.add("slot-empty"), h.addEventListener("slotchange", (g) => l(this, r).call(this, g));
671
+ return e = new WeakMap(), i = new WeakSet(), M = function() {
672
+ var l;
673
+ const u = (l = this.shadowRoot) == null ? void 0 : l.querySelectorAll("slot");
674
+ u == null || u.forEach((h) => {
675
+ if (g(this, i, S).call(this, h), !c(this, e).has(h)) {
676
+ const b = (T) => c(this, o).call(this, T);
677
+ c(this, e).set(h, b), h.addEventListener("slotchange", b);
678
+ }
661
679
  });
662
- }, r = new WeakMap(), v = function(c) {
663
- return Array.from(c).some((d) => w(this, e, B).call(this, d));
664
- }, B = function(c) {
665
- return c.nodeType === Node.TEXT_NODE ? (c.textContent || "").trim().length > 0 : c.nodeType === Node.ELEMENT_NODE;
680
+ }, S = function(u) {
681
+ const l = g(this, i, P).call(this, u.assignedNodes({ flatten: !0 })), h = g(this, i, P).call(this, u.childNodes);
682
+ l || h ? u.classList.remove("slot-empty") : u.classList.add("slot-empty");
683
+ }, o = new WeakMap(), P = function(u) {
684
+ return Array.from(u).some((l) => g(this, i, O).call(this, l));
685
+ }, O = function(u) {
686
+ return u.nodeType === Node.TEXT_NODE ? (u.textContent || "").trim().length > 0 : u.nodeType === Node.ELEMENT_NODE;
666
687
  }, t;
667
688
  }
668
689
  export {
669
- mt as BreakPointMixin,
670
- C as Debouncer,
671
- wt as EventBindingsMixin,
672
- rt as FormDataAccessor,
673
- gt as Listen,
690
+ gt as BreakPointMixin,
691
+ N as Debouncer,
692
+ yt as EventBindingsMixin,
693
+ st as FormDataAccessor,
694
+ wt as Listen,
674
695
  bt as LoaderMixin,
675
- q as Logger,
676
- yt as LoggingMixin,
677
- pt as SlotVisibilityMixin,
678
- ot as Stopwatch,
679
- _ as breakpointMap,
680
- E as breakpoints,
681
- nt as create_element,
682
- it as debounce,
683
- p as getBreakpointMinWidth,
696
+ J as Logger,
697
+ pt as LoggingMixin,
698
+ Et as SlotVisibilityMixin,
699
+ at as Stopwatch,
700
+ W as breakpointMap,
701
+ k as breakpoints,
702
+ it as create_element,
703
+ rt as debounce,
704
+ E as getBreakpointMinWidth,
684
705
  U as getCurrentBreakpoint,
685
- st as getErrorLocation,
686
- F as getViewportWidth,
687
- ut as local_storage,
688
- at as session_storage,
689
- ht as sleep,
690
- x as waitFor,
691
- ft as waitForAnimationEnd,
692
- Y as waitForDomContentLoaded,
693
- M as waitForLoad,
694
- dt as waitForPreVisual,
695
- ct as waitForReady,
696
- lt as waitForVisual
706
+ ot as getErrorLocation,
707
+ H as getViewportWidth,
708
+ ct as local_storage,
709
+ ut as session_storage,
710
+ ft as sleep,
711
+ _ as waitFor,
712
+ mt as waitForAnimationEnd,
713
+ Z as waitForDomContentLoaded,
714
+ C as waitForLoad,
715
+ lt as waitForPreVisual,
716
+ dt as waitForReady,
717
+ ht as waitForVisual
697
718
  };
@@ -20,6 +20,8 @@ export declare class FormDataAccessor {
20
20
  private get groupedEntries();
21
21
  private getName;
22
22
  private isValueElement;
23
+ /** A named value element owns its value, so its descendants are not collected twice. */
24
+ private hasValueElementParent;
23
25
  private isDisabled;
24
26
  private readGroup;
25
27
  private writeGroup;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@trunkjs/browser-utils",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "main": "./index.js",
5
5
  "repository": {
6
6
  "directory": "packages/browser-utils",
7
7
  "type": "git",
8
- "url": "https://github.com/trunkjs/trunkjs-monorepo"
8
+ "url": "git+https://github.com/trunkjs/trunkjs-monorepo.git"
9
9
  },
10
10
  "dependencies": {},
11
11
  "type": "module",
@@ -21,6 +21,9 @@ The root may be an `HTMLElement`, `Document`, or `DocumentFragment`. Controls ar
21
21
  access. A control needs a non-empty `name` and a readable/writable `value` property. Native inputs, textareas, selects,
22
22
  and compatible custom elements such as `nte-input` follow this contract.
23
23
 
24
+ A named value element owns its complete value. Named descendants below it are not returned as additional entries. This
25
+ allows object-valued controls such as a named nested `tj-form` to form a data tree without duplicate flat fields.
26
+
24
27
  ## Data behavior
25
28
 
26
29
  - `name[]` becomes an array under the name without `[]` in `data`.