@trunkjs/browser-utils 1.0.37 → 1.0.39

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 (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/index.js +21 -14
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.0.39 (2026-03-06)
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.38 (2026-02-12)
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.37 (2026-02-08)
2
10
 
3
11
  This was a version bump only for browser-utils to align it with other projects, there were no code changes.
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
- var N = Object.defineProperty;
1
+ var $ = Object.defineProperty;
2
2
  var T = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var $ = (e, t, n) => t in e ? N(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
- var l = (e, t, n) => $(e, typeof t != "symbol" ? t + "" : t, n), L = (e, t, n) => t.has(e) || T("Cannot " + n);
5
+ var N = (e, t, n) => t in e ? $(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var l = (e, t, n) => N(e, typeof t != "symbol" ? t + "" : t, n), L = (e, t, n) => t.has(e) || T("Cannot " + n);
7
7
  var u = (e, t, n) => (L(e, t, "read from private field"), n ? n.call(e) : t.get(e)), h = (e, t, n) => t.has(e) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), w = (e, t, n, i) => (L(e, t, "write to private field"), i ? i.call(e, n) : t.set(e, n), n), y = (e, t, n) => (L(e, t, "access private method"), n);
8
8
  const k = [
9
9
  { name: "xs", minWidth: 0 },
@@ -21,7 +21,7 @@ function E(e) {
21
21
  throw new Error(`Unknown breakpoint: ${e}`);
22
22
  return x[e];
23
23
  }
24
- function R(e) {
24
+ function B(e) {
25
25
  e === void 0 && (e = window.innerWidth);
26
26
  for (let t = k.length - 1; t >= 0; t--)
27
27
  if (e >= k[t].minWidth)
@@ -103,7 +103,7 @@ function J(e) {
103
103
  }
104
104
  return { file: e.fileName || e.sourceURL };
105
105
  }
106
- class B {
106
+ class R {
107
107
  constructor(t, n, i = "main") {
108
108
  this._debug = t, this.myElementId = n, this.instanceId = i;
109
109
  }
@@ -288,15 +288,22 @@ function nt(e) {
288
288
  h(this, i, async () => {
289
289
  var b;
290
290
  await u(this, n).wait(), await z();
291
- const c = this, s = window.innerWidth, o = getComputedStyle(c).getPropertyValue("--breakpoint");
291
+ const c = this, s = window.innerWidth;
292
+ let o = getComputedStyle(c).getPropertyValue("--breakpoint");
292
293
  if (!o || o === "")
293
294
  return;
294
- const d = o.split(","), m = d[0].trim(), f = ((b = d[1]) == null ? void 0 : b.trim()) ?? m, g = R(s);
295
+ o = o.trim().replace(/^['"]|['"]$/g, "");
296
+ const d = o.split(","), m = d[0].trim(), f = ((b = d[1]) == null ? void 0 : b.trim()) ?? m, g = B(s);
295
297
  this.currentBreakPoint !== g && (E(f) <= E(g) ? c.setAttribute("mode", "desktop") : E(m) > E(g) ? c.setAttribute("mode", "mobile") : c.setAttribute("mode", "tablet"));
296
298
  });
297
299
  }
298
300
  connectedCallback() {
299
- super.connectedCallback(), u(this, i).call(this), window.addEventListener("resize", u(this, i)), u(this, i).call(this);
301
+ super.connectedCallback();
302
+ try {
303
+ u(this, i).call(this), window.addEventListener("resize", u(this, i)), u(this, i).call(this);
304
+ } catch (c) {
305
+ throw console.error("Error in BreakPointMixin:", c, "in element", this), c;
306
+ }
300
307
  }
301
308
  disconnectedCallback() {
302
309
  super.disconnectedCallback(), window.removeEventListener("resize", u(this, i));
@@ -310,10 +317,10 @@ function it(e, t) {
310
317
  return function(i, r) {
311
318
  if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
312
319
  return r.addInitializer(function() {
313
- const a = this.constructor;
320
+ const a = this;
314
321
  (a[v] || (a[v] = [])).push({
315
322
  method: r.name,
316
- events: n,
323
+ events: [...n],
317
324
  opts: t
318
325
  });
319
326
  }), function(...a) {
@@ -348,7 +355,7 @@ function rt(e) {
348
355
  return n = new WeakMap(), i = new WeakSet(), W = function() {
349
356
  var o, d, m;
350
357
  (o = u(this, n)) == null || o.abort(), w(this, n, new AbortController());
351
- const s = this.constructor[v] || [];
358
+ const s = this[v] || [];
352
359
  for (const f of s) {
353
360
  const g = F(this, (d = f.opts) == null ? void 0 : d.target), b = ((m = f.opts) == null ? void 0 : m.options) ?? {}, C = this[f.method].bind(this);
354
361
  for (const D of f.events)
@@ -377,7 +384,7 @@ function st(e) {
377
384
  return u(this, n) !== null ? u(this, n) : (this instanceof HTMLElement && w(this, n, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), u(this, n) === !0 && console.log(`[DEBUG][ID:${u(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`, this), u(this, n) ?? !1);
378
385
  }
379
386
  getLogger(s = "main") {
380
- return u(this, r) || w(this, r, new B(this._debug, `${u(this, i)}`, s)), u(this, r);
387
+ return u(this, r) || w(this, r, new R(this._debug, `${u(this, i)}`, s)), u(this, r);
381
388
  }
382
389
  log(...s) {
383
390
  this.getLogger().log(...s);
@@ -425,7 +432,7 @@ export {
425
432
  M as Debouncer,
426
433
  rt as EventBindingsMixin,
427
434
  it as Listen,
428
- B as Logger,
435
+ R as Logger,
429
436
  st as LoggingMixin,
430
437
  ot as SlotVisibilityMixin,
431
438
  q as Stopwatch,
@@ -434,7 +441,7 @@ export {
434
441
  H as create_element,
435
442
  G as debounce,
436
443
  E as getBreakpointMinWidth,
437
- R as getCurrentBreakpoint,
444
+ B as getCurrentBreakpoint,
438
445
  J as getErrorLocation,
439
446
  Q as local_storage,
440
447
  X as session_storage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trunkjs/browser-utils",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "main": "./index.js",
5
5
  "dependencies": {},
6
6
  "type": "module",