@trunkjs/browser-utils 1.0.21 → 1.0.22

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,7 @@
1
+ ## 1.0.22 (2025-12-11)
2
+
3
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
4
+
1
5
  ## 1.0.21 (2025-12-11)
2
6
 
3
7
  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,11 +1,10 @@
1
- var W = Object.defineProperty;
1
+ var x = Object.defineProperty;
2
2
  var L = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var $ = (e, t, n) => t in e ? W(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
- var u = (e, t, n) => $(e, typeof t != "symbol" ? t + "" : t, n), w = (e, t, n) => t.has(e) || L("Cannot " + n);
5
+ var A = (e, t, n) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var u = (e, t, n) => A(e, typeof t != "symbol" ? t + "" : t, n), w = (e, t, n) => t.has(e) || L("Cannot " + n);
7
7
  var a = (e, t, n) => (w(e, t, "read from private field"), n ? n.call(e) : t.get(e)), c = (e, t, n) => t.has(e) ? L("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), m = (e, t, n, i) => (w(e, t, "write to private field"), i ? i.call(e, n) : t.set(e, n), n), p = (e, t, n) => (w(e, t, "access private method"), n);
8
- import { Debouncer as x } from "@kasimirjs/core";
9
8
  const f = [
10
9
  { name: "xs", minWidth: 0 },
11
10
  { name: "sm", minWidth: 576 },
@@ -22,14 +21,14 @@ function y(e) {
22
21
  throw new Error(`Unknown breakpoint: ${e}`);
23
22
  return v[e];
24
23
  }
25
- function A(e) {
24
+ function C(e) {
26
25
  e === void 0 && (e = window.innerWidth);
27
26
  for (let t = f.length - 1; t >= 0; t--)
28
27
  if (e >= f[t].minWidth)
29
28
  return f[t].name;
30
29
  return "xs";
31
30
  }
32
- function U(e, t = {}, n = []) {
31
+ function S(e, t = {}, n = []) {
33
32
  Array.isArray(n) || (n = [n]);
34
33
  const i = document.createElement(e);
35
34
  for (const r in t)
@@ -38,7 +37,7 @@ function U(e, t = {}, n = []) {
38
37
  i.append(typeof r == "string" ? document.createTextNode(r) : r);
39
38
  return i;
40
39
  }
41
- class F {
40
+ class $ {
42
41
  /**
43
42
  *
44
43
  * @param delay Debounce delay in milliseconds
@@ -62,7 +61,7 @@ class F {
62
61
  }, this.delay);
63
62
  }
64
63
  }
65
- function H(e) {
64
+ function U(e) {
66
65
  if (typeof e.lineNumber == "number")
67
66
  return {
68
67
  file: e.fileName || e.sourceURL,
@@ -84,7 +83,7 @@ function H(e) {
84
83
  }
85
84
  return { file: e.fileName || e.sourceURL };
86
85
  }
87
- class C {
86
+ class D {
88
87
  constructor(t, n, i = "main") {
89
88
  this._debug = t, this.myElementId = n, this.instanceId = i;
90
89
  }
@@ -102,7 +101,7 @@ class C {
102
101
  throw this.error(...t), new Error(n);
103
102
  }
104
103
  }
105
- class O {
104
+ class F {
106
105
  constructor(t, n = !0) {
107
106
  u(this, "label");
108
107
  u(this, "last");
@@ -132,7 +131,7 @@ class O {
132
131
  return this.running;
133
132
  }
134
133
  }
135
- function V(e, t, n) {
134
+ function H(e, t, n) {
136
135
  return new Promise((i, r) => {
137
136
  const s = (l) => {
138
137
  e.removeEventListener(t, s, n), i(l);
@@ -145,15 +144,15 @@ function B() {
145
144
  document.addEventListener("DOMContentLoaded", () => e());
146
145
  }) : Promise.resolve();
147
146
  }
148
- function z(e = window) {
147
+ function O(e = window) {
149
148
  return e || (e = window), e === window ? document.readyState === "complete" ? Promise.resolve() : new Promise((t) => window.addEventListener("load", () => t(), { once: !0 })) : e instanceof HTMLImageElement ? e.complete && e.naturalWidth !== 0 ? Promise.resolve() : new Promise((t, n) => {
150
149
  e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => n(new Error("image error")), { once: !0 });
151
150
  }) : e instanceof HTMLMediaElement ? e.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA ? Promise.resolve() : new Promise((t) => e.addEventListener("loadeddata", () => t(), { once: !0 })) : new Promise((t) => e.addEventListener("load", () => t(), { once: !0 }));
152
151
  }
153
- function G(e) {
152
+ function V(e) {
154
153
  return new Promise((t) => setTimeout(t, e));
155
154
  }
156
- function j(e) {
155
+ function z(e) {
157
156
  return new Promise((t) => {
158
157
  const n = (i) => {
159
158
  e.removeEventListener("animationend", n), t(i);
@@ -161,19 +160,19 @@ function j(e) {
161
160
  e.addEventListener("animationend", n);
162
161
  });
163
162
  }
164
- function q(e) {
163
+ function G(e) {
165
164
  var i;
166
- const t = new x(200, 5e3);
165
+ const t = new $(200, 5e3);
167
166
  class n extends e {
168
167
  constructor() {
169
168
  super(...arguments);
170
169
  u(this, "currentBreakPoint", null);
171
170
  c(this, i, async () => {
172
- await t.debounce(), await B();
171
+ await t.wait(), await B();
173
172
  const l = window.innerWidth;
174
173
  let o = getComputedStyle(this).getPropertyValue("--breakpoint");
175
174
  o || (this.style.setProperty("--breakpoint", "md"), o = getComputedStyle(this).getPropertyValue("--breakpoint"));
176
- const d = A(l);
175
+ const d = C(l);
177
176
  this.currentBreakPoint !== d && (y(o) < y(d) ? this.setAttribute("mode", "desktop") : this.setAttribute("mode", "mobile"));
178
177
  });
179
178
  }
@@ -187,7 +186,7 @@ function q(e) {
187
186
  return i = new WeakMap(), n;
188
187
  }
189
188
  const g = Symbol("listenerDefs"), k = Symbol("withEventBindings");
190
- function X(e, t) {
189
+ function j(e, t) {
191
190
  const n = Array.isArray(e) ? e : [e];
192
191
  return function(i, r) {
193
192
  if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
@@ -209,7 +208,7 @@ function R(e, t) {
209
208
  var n;
210
209
  return !t || t === "host" ? e : t === "document" ? e.ownerDocument ?? document : t === "window" ? ((n = e.ownerDocument) == null ? void 0 : n.defaultView) ?? window : t === "shadowRoot" ? e.shadowRoot ?? e : typeof t == "function" ? t(e) : t;
211
210
  }
212
- function J(e) {
211
+ function q(e) {
213
212
  var n, i, P;
214
213
  class t extends e {
215
214
  constructor(...o) {
@@ -233,13 +232,13 @@ function J(e) {
233
232
  const o = this.constructor[g] || [];
234
233
  for (const h of o) {
235
234
  const I = R(this, (b = h.opts) == null ? void 0 : b.target), M = ((E = h.opts) == null ? void 0 : E.options) ?? {}, T = this[h.method].bind(this);
236
- for (const D of h.events)
237
- I.addEventListener(D, T, { ...M, signal: a(this, n).signal });
235
+ for (const W of h.events)
236
+ I.addEventListener(W, T, { ...M, signal: a(this, n).signal });
238
237
  }
239
238
  }, t;
240
239
  }
241
240
  let _ = 1;
242
- function K(e) {
241
+ function X(e) {
243
242
  var n, i, r;
244
243
  class t extends e {
245
244
  constructor() {
@@ -259,7 +258,7 @@ function K(e) {
259
258
  return a(this, n) !== null ? a(this, n) : (this instanceof HTMLElement && m(this, n, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), a(this, n) === !0 && console.log(`[DEBUG][ID:${a(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`, this), a(this, n) ?? !1);
260
259
  }
261
260
  getLogger(o = "main") {
262
- return a(this, r) || m(this, r, new C(this._debug, `${a(this, i)}`, o)), a(this, r);
261
+ return a(this, r) || m(this, r, new D(this._debug, `${a(this, i)}`, o)), a(this, r);
263
262
  }
264
263
  log(...o) {
265
264
  this.getLogger().log(...o);
@@ -277,22 +276,22 @@ function K(e) {
277
276
  return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
278
277
  }
279
278
  export {
280
- q as BreakPointMixin,
281
- F as Debouncer,
282
- J as EventBindingsMixin,
283
- X as Listen,
284
- C as Logger,
285
- K as LoggingMixin,
286
- O as Stopwatch,
279
+ G as BreakPointMixin,
280
+ $ as Debouncer,
281
+ q as EventBindingsMixin,
282
+ j as Listen,
283
+ D as Logger,
284
+ X as LoggingMixin,
285
+ F as Stopwatch,
287
286
  v as breakpointMap,
288
287
  f as breakpoints,
289
- U as create_element,
288
+ S as create_element,
290
289
  y as getBreakpointMinWidth,
291
- A as getCurrentBreakpoint,
292
- H as getErrorLocation,
293
- G as sleep,
294
- V as waitFor,
295
- j as waitForAnimationEnd,
290
+ C as getCurrentBreakpoint,
291
+ U as getErrorLocation,
292
+ V as sleep,
293
+ H as waitFor,
294
+ z as waitForAnimationEnd,
296
295
  B as waitForDomContentLoaded,
297
- z as waitForLoad
296
+ O as waitForLoad
298
297
  };
@@ -1,7 +1,7 @@
1
1
  type Constructor<T = object> = abstract new (...args: any[]) => T;
2
2
  export declare function BreakPointMixin<TBase extends Constructor<HTMLElement>>(Base: TBase): (abstract new (...args: any[]) => {
3
3
  currentBreakPoint: string | null;
4
- "__#2663@#updateBreakPoint": () => Promise<void>;
4
+ "__#2659@#updateBreakPoint": () => Promise<void>;
5
5
  connectedCallback(): void;
6
6
  disconnectedCallback(): void;
7
7
  accessKey: string;
@@ -9,9 +9,9 @@ type OneOrMany<N extends EventName> = N | readonly N[];
9
9
  type EventFromInput<I extends OneOrMany<EventName>> = I extends readonly (infer K)[] ? K extends EventName ? DocumentEventMap[K] : never : I extends EventName ? DocumentEventMap[I] : never;
10
10
  export declare function Listen<I extends OneOrMany<EventName>>(type: I, opts?: ListenOpts): <This, Fn extends (this: This, ev: EventFromInput<I>, ...args: any[]) => any>(value: Fn, context: ClassMethodDecoratorContext<This, Fn>) => Fn;
11
11
  export declare function EventBindingsMixin<TBase extends Ctor<object>>(Base: TBase): (abstract new (...a: any[]) => {
12
- "__#2664@#ac"?: AbortController;
12
+ "__#2660@#ac"?: AbortController;
13
13
  connectedCallback(): void;
14
14
  disconnectedCallback(): void;
15
- "__#2664@#bindEventListeners"(): void;
15
+ "__#2660@#bindEventListeners"(): void;
16
16
  }) & TBase;
17
17
  export {};
@@ -26,14 +26,14 @@ type Constructor<T = object> = abstract new (...args: any[]) => T;
26
26
  * <my-element debug></my-element> // enables debug logging
27
27
  */
28
28
  export declare function LoggingMixin<TBase extends Constructor<object>>(Base: TBase): (abstract new (...args: any[]) => {
29
- "__#2665@#debugCached": boolean | null;
30
- "__#2665@#myElementId": number;
29
+ "__#2661@#debugCached": boolean | null;
30
+ "__#2661@#myElementId": number;
31
31
  /**
32
32
  * Clears the cached debug flag so the attribute will be checked again
33
33
  * on the next log/warn/error call.
34
34
  */
35
35
  invalidateDebugCache(): void;
36
- "__#2665@#myLoggerInstance": Logger | null;
36
+ "__#2661@#myLoggerInstance": Logger | null;
37
37
  readonly _debug: boolean;
38
38
  getLogger(instanceId?: string): Logger;
39
39
  log(...args: any[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trunkjs/browser-utils",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "main": "./index.js",
5
5
  "dependencies": {},
6
6
  "type": "module",