@trunkjs/browser-utils 1.0.14 → 1.0.15

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.15 (2025-08-24)
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.14 (2025-08-24)
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,11 @@
1
- var f = Object.defineProperty;
2
- var h = (t) => {
1
+ var g = Object.defineProperty;
2
+ var c = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var g = (t, e, n) => e in t ? f(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var a = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n), d = (t, e, n) => e.has(t) || h("Cannot " + n);
7
- var o = (t, e, n) => (d(t, e, "read from private field"), n ? n.call(t) : e.get(t)), u = (t, e, n) => e.has(t) ? h("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), m = (t, e, n, i) => (d(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n);
8
- function y(t, e = {}, n = []) {
5
+ var f = (t, e, n) => e in t ? g(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
+ var l = (t, e, n) => f(t, typeof e != "symbol" ? e + "" : e, n), d = (t, e, n) => e.has(t) || c("Cannot " + n);
7
+ var r = (t, e, n) => (d(t, e, "read from private field"), n ? n.call(t) : e.get(t)), u = (t, e, n) => e.has(t) ? c("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), m = (t, e, n, i) => (d(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n);
8
+ function E(t, e = {}, n = []) {
9
9
  Array.isArray(n) || (n = [n]);
10
10
  const i = document.createElement(t);
11
11
  for (const s in e)
@@ -14,15 +14,15 @@ function y(t, e = {}, n = []) {
14
14
  i.append(typeof s == "string" ? document.createTextNode(s) : s);
15
15
  return i;
16
16
  }
17
- class E {
17
+ class y {
18
18
  /**
19
19
  *
20
20
  * @param delay Debounce delay in milliseconds
21
21
  * @param max_delay Maximum delay in milliseconds, if false then no maximum delay is applied
22
22
  */
23
23
  constructor(e, n = !1) {
24
- a(this, "timeout", null);
25
- a(this, "startTimeWithMs", 0);
24
+ l(this, "timeout", null);
25
+ l(this, "startTimeWithMs", 0);
26
26
  this.delay = e, this.max_delay = n;
27
27
  }
28
28
  async wait() {
@@ -54,9 +54,9 @@ function I(t) {
54
54
  const n = String(t.stack || t.message || "").split(`
55
55
  `), i = /(.*?)(?:\(|@)?(.*?):(\d+):(\d+)\)?$/;
56
56
  for (const s of n) {
57
- const r = s.match(i);
58
- if (r)
59
- return { file: r[2], line: +r[3], column: +r[4] };
57
+ const a = s.match(i);
58
+ if (a)
59
+ return { file: a[2], line: +a[3], column: +a[4] };
60
60
  }
61
61
  return { file: t.fileName || t.sourceURL };
62
62
  }
@@ -80,11 +80,11 @@ class w {
80
80
  }
81
81
  class p {
82
82
  constructor(e, n = !0) {
83
- a(this, "label");
84
- a(this, "last");
85
- a(this, "startTime");
86
- a(this, "running", !1);
87
- a(this, "enabled");
83
+ l(this, "label");
84
+ l(this, "last");
85
+ l(this, "startTime");
86
+ l(this, "running", !1);
87
+ l(this, "enabled");
88
88
  this.label = e, this.enabled = n, this.startTime = this.last = performance.now(), this.running = !0;
89
89
  }
90
90
  lap(e = "") {
@@ -110,10 +110,10 @@ class p {
110
110
  }
111
111
  function T(t, e, n) {
112
112
  return new Promise((i, s) => {
113
- const r = (c) => {
114
- t.removeEventListener(e, r, n), i(c);
113
+ const a = (h) => {
114
+ t.removeEventListener(e, a, n), i(h);
115
115
  };
116
- t.addEventListener(e, r, n);
116
+ t.addEventListener(e, a, n);
117
117
  });
118
118
  }
119
119
  function $() {
@@ -155,29 +155,32 @@ function x(t) {
155
155
  m(this, n, null);
156
156
  }
157
157
  get _debug() {
158
- return o(this, n) !== null ? o(this, n) : (this instanceof HTMLElement && m(this, n, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), o(this, n) === !0 && console.log(`[DEBUG][ID:${o(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`, this), o(this, n) ?? !1);
158
+ return r(this, n) !== null ? r(this, n) : (this instanceof HTMLElement && m(this, n, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), r(this, n) === !0 && console.log(`[DEBUG][ID:${r(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`, this), r(this, n) ?? !1);
159
159
  }
160
- getLogger(l = "main") {
161
- return o(this, s) || m(this, s, new w(this._debug, `${o(this, i)}`, l)), o(this, s);
160
+ getLogger(o = "main") {
161
+ return r(this, s) || m(this, s, new w(this._debug, `${r(this, i)}`, o)), r(this, s);
162
162
  }
163
- log(...l) {
164
- this.getLogger().log(...l);
163
+ log(...o) {
164
+ this.getLogger().log(...o);
165
165
  }
166
- warn(...l) {
167
- this.getLogger().warn(...l);
166
+ warn(...o) {
167
+ this.getLogger().warn(...o);
168
168
  }
169
- error(...l) {
170
- this.getLogger().error(...l);
169
+ error(...o) {
170
+ this.getLogger().error(...o);
171
+ }
172
+ throwError(...o) {
173
+ return this.getLogger().throwError(...o);
171
174
  }
172
175
  }
173
176
  return n = new WeakMap(), i = new WeakMap(), s = new WeakMap(), e;
174
177
  }
175
178
  export {
176
- E as Debouncer,
179
+ y as Debouncer,
177
180
  w as Logger,
178
181
  x as LoggingMixin,
179
182
  p as Stopwatch,
180
- y as create_element,
183
+ E as create_element,
181
184
  I as getErrorLocation,
182
185
  v as sleep,
183
186
  T as waitFor,
@@ -26,18 +26,19 @@ 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
- "__#1726@#debugCached": boolean | null;
30
- "__#1726@#myElementId": number;
29
+ "__#1729@#debugCached": boolean | null;
30
+ "__#1729@#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
- "__#1726@#myLoggerInstance": Logger | null;
36
+ "__#1729@#myLoggerInstance": Logger | null;
37
37
  readonly _debug: boolean;
38
38
  getLogger(instanceId?: string): Logger;
39
39
  log(...args: any[]): void;
40
40
  warn(...args: any[]): void;
41
41
  error(...args: any[]): void;
42
+ throwError(...args: any[]): never;
42
43
  }) & TBase;
43
44
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trunkjs/browser-utils",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "main": "./index.js",
5
5
  "dependencies": {},
6
6
  "type": "module",