@trunkjs/browser-utils 1.0.21 → 1.0.24

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,15 @@
1
+ ## 1.0.24 (2025-12-23)
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.23 (2025-12-23)
6
+
7
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
8
+
9
+ ## 1.0.22 (2025-12-11)
10
+
11
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
12
+
1
13
  ## 1.0.21 (2025-12-11)
2
14
 
3
15
  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;
2
- var L = (e) => {
3
- throw TypeError(e);
1
+ var A = Object.defineProperty;
2
+ var p = (t) => {
3
+ throw TypeError(t);
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);
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";
5
+ var C = (t, e, n) => e in t ? A(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
+ var d = (t, e, n) => C(t, typeof e != "symbol" ? e + "" : e, n), w = (t, e, n) => e.has(t) || p("Cannot " + n);
7
+ var a = (t, e, n) => (w(t, e, "read from private field"), n ? n.call(t) : e.get(t)), m = (t, e, n) => e.has(t) ? p("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), c = (t, e, n, i) => (w(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n), L = (t, e, n) => (w(t, e, "access private method"), n);
9
8
  const f = [
10
9
  { name: "xs", minWidth: 0 },
11
10
  { name: "sm", minWidth: 576 },
@@ -13,108 +12,128 @@ const f = [
13
12
  { name: "lg", minWidth: 992 },
14
13
  { name: "xl", minWidth: 1200 },
15
14
  { name: "xxl", minWidth: 1400 }
16
- ], v = f.reduce(
17
- (e, t) => (e[t.name] = t.minWidth, e),
15
+ ], y = f.reduce(
16
+ (t, e) => (t[e.name] = e.minWidth, t),
18
17
  {}
19
18
  );
20
- function y(e) {
21
- if (!(e in v))
22
- throw new Error(`Unknown breakpoint: ${e}`);
23
- return v[e];
19
+ function v(t) {
20
+ if (!(t in y))
21
+ throw new Error(`Unknown breakpoint: ${t}`);
22
+ return y[t];
24
23
  }
25
- function A(e) {
26
- e === void 0 && (e = window.innerWidth);
27
- for (let t = f.length - 1; t >= 0; t--)
28
- if (e >= f[t].minWidth)
29
- return f[t].name;
24
+ function D(t) {
25
+ t === void 0 && (t = window.innerWidth);
26
+ for (let e = f.length - 1; e >= 0; e--)
27
+ if (t >= f[e].minWidth)
28
+ return f[e].name;
30
29
  return "xs";
31
30
  }
32
- function U(e, t = {}, n = []) {
31
+ function S(t, e = {}, n = []) {
33
32
  Array.isArray(n) || (n = [n]);
34
- const i = document.createElement(e);
35
- for (const r in t)
36
- t[r] !== null && t[r] !== void 0 && i.setAttribute(r, t[r] !== !0 ? t[r] : "");
33
+ const i = document.createElement(t);
34
+ for (const r in e)
35
+ e[r] !== null && e[r] !== void 0 && i.setAttribute(r, e[r] !== !0 ? e[r] : "");
37
36
  for (const r of n)
38
37
  i.append(typeof r == "string" ? document.createTextNode(r) : r);
39
38
  return i;
40
39
  }
41
- class F {
40
+ class T {
42
41
  /**
43
42
  *
44
43
  * @param delay Debounce delay in milliseconds
45
44
  * @param max_delay Maximum delay in milliseconds, if false then no maximum delay is applied
46
45
  */
47
- constructor(t, n = !1) {
48
- u(this, "timeout", null);
49
- u(this, "startTimeWithMs", 0);
50
- this.delay = t, this.max_delay = n;
46
+ constructor(e, n = !1) {
47
+ d(this, "timeout", null);
48
+ d(this, "startTimeWithMs", 0);
49
+ d(this, "maxTimeout", null);
50
+ this.delay = e, this.max_delay = n;
51
51
  }
52
52
  async wait() {
53
- return this.startTimeWithMs === 0 && (this.startTimeWithMs = Date.now()), this.timeout && (this.max_delay === !1 || this.startTimeWithMs + this.max_delay > Date.now()) && clearTimeout(this.timeout), new Promise((t) => {
53
+ return this.startTimeWithMs === 0 && (this.startTimeWithMs = Date.now()), this.timeout && (this.max_delay === !1 || this.startTimeWithMs + this.max_delay > Date.now()) && clearTimeout(this.timeout), new Promise((e) => {
54
54
  this.timeout = setTimeout(() => {
55
- this.startTimeWithMs = 0, t(!0);
55
+ this.startTimeWithMs = 0, e(!0);
56
56
  }, this.delay);
57
57
  });
58
58
  }
59
- debounce(t) {
60
- this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(() => {
61
- t();
62
- }, this.delay);
59
+ debounce(e) {
60
+ const n = Date.now();
61
+ this.startTimeWithMs === 0 && (this.startTimeWithMs = n);
62
+ const i = () => {
63
+ this.timeout && (clearTimeout(this.timeout), this.timeout = null), this.maxTimeout && (clearTimeout(this.maxTimeout), this.maxTimeout = null), this.startTimeWithMs = 0, e();
64
+ };
65
+ if (this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(i, this.delay), this.max_delay !== !1 && !this.maxTimeout) {
66
+ const r = n - this.startTimeWithMs, o = Math.max(0, this.max_delay - r);
67
+ this.maxTimeout = setTimeout(i, o);
68
+ }
63
69
  }
64
70
  }
65
- function H(e) {
66
- if (typeof e.lineNumber == "number")
71
+ function U(t, e = !1) {
72
+ const n = /* @__PURE__ */ new WeakMap();
73
+ return function(i, r) {
74
+ if (r.kind !== "method") return i;
75
+ const o = r.name;
76
+ return function(...l) {
77
+ let s = n.get(this);
78
+ s || (s = /* @__PURE__ */ new Map(), n.set(this, s));
79
+ let u = s.get(o);
80
+ u || (u = new T(t, e), s.set(o, u)), u.debounce(() => i.apply(this, l));
81
+ };
82
+ };
83
+ }
84
+ function F(t) {
85
+ if (typeof t.lineNumber == "number")
67
86
  return {
68
- file: e.fileName || e.sourceURL,
69
- line: e.lineNumber,
70
- column: e.columnNumber ?? void 0
87
+ file: t.fileName || t.sourceURL,
88
+ line: t.lineNumber,
89
+ column: t.columnNumber ?? void 0
71
90
  };
72
- if (typeof e.line == "number")
91
+ if (typeof t.line == "number")
73
92
  return {
74
- file: e.sourceURL,
75
- line: e.line,
76
- column: e.column
93
+ file: t.sourceURL,
94
+ line: t.line,
95
+ column: t.column
77
96
  };
78
- const n = String(e.stack || e.message || "").split(`
97
+ const n = String(t.stack || t.message || "").split(`
79
98
  `), i = /(.*?)(?:\(|@)?(.*?):(\d+):(\d+)\)?$/;
80
99
  for (const r of n) {
81
- const s = r.match(i);
82
- if (s)
83
- return { file: s[2], line: +s[3], column: +s[4] };
100
+ const o = r.match(i);
101
+ if (o)
102
+ return { file: o[2], line: +o[3], column: +o[4] };
84
103
  }
85
- return { file: e.fileName || e.sourceURL };
104
+ return { file: t.fileName || t.sourceURL };
86
105
  }
87
- class C {
88
- constructor(t, n, i = "main") {
89
- this._debug = t, this.myElementId = n, this.instanceId = i;
106
+ class $ {
107
+ constructor(e, n, i = "main") {
108
+ this._debug = e, this.myElementId = n, this.instanceId = i;
90
109
  }
91
- log(...t) {
92
- this._debug && console.log(`[LOG][ID:${this.myElementId}:${this.instanceId}]`, ...t);
110
+ log(...e) {
111
+ this._debug && console.log(`[LOG][ID:${this.myElementId}:${this.instanceId}]`, ...e);
93
112
  }
94
- warn(...t) {
95
- console.warn(`[WARN][ID:${this.myElementId}:${this.instanceId}]`, ...t);
113
+ warn(...e) {
114
+ console.warn(`[WARN][ID:${this.myElementId}:${this.instanceId}]`, ...e);
96
115
  }
97
- error(...t) {
98
- console.error(`[ERROR][ID:${this.myElementId}:${this.instanceId}]`, ...t);
116
+ error(...e) {
117
+ console.error(`[ERROR][ID:${this.myElementId}:${this.instanceId}]`, ...e);
99
118
  }
100
- throwError(...t) {
101
- const n = `[ERROR][ID:${this.myElementId}:${this.instanceId}] ${t.join(" ")}`;
102
- throw this.error(...t), new Error(n);
119
+ throwError(...e) {
120
+ const n = `[ERROR][ID:${this.myElementId}:${this.instanceId}] ${e.join(" ")}`;
121
+ throw this.error(...e), new Error(n);
103
122
  }
104
123
  }
105
- class O {
106
- constructor(t, n = !0) {
107
- u(this, "label");
108
- u(this, "last");
109
- u(this, "startTime");
110
- u(this, "running", !1);
111
- u(this, "enabled");
112
- this.label = t, this.enabled = n, this.startTime = this.last = performance.now(), this.running = !0;
124
+ class H {
125
+ constructor(e, n = !0) {
126
+ d(this, "label");
127
+ d(this, "last");
128
+ d(this, "startTime");
129
+ d(this, "running", !1);
130
+ d(this, "enabled");
131
+ this.label = e, this.enabled = n, this.startTime = this.last = performance.now(), this.running = !0;
113
132
  }
114
- lap(t = "") {
133
+ lap(e = "") {
115
134
  if (!this.enabled) return;
116
135
  const n = performance.now(), i = (n - this.last) / 1e3;
117
- this.last = n, console.debug(`[${this.label}] ${t} +${i.toFixed(3)}s`);
136
+ this.last = n, console.debug(`[${this.label}] ${e} +${i.toFixed(3)}s`);
118
137
  }
119
138
  elapsed() {
120
139
  return performance.now() - this.startTime;
@@ -132,49 +151,49 @@ class O {
132
151
  return this.running;
133
152
  }
134
153
  }
135
- function V(e, t, n) {
154
+ function O(t, e, n) {
136
155
  return new Promise((i, r) => {
137
- const s = (l) => {
138
- e.removeEventListener(t, s, n), i(l);
156
+ const o = (l) => {
157
+ t.removeEventListener(e, o, n), i(l);
139
158
  };
140
- e.addEventListener(t, s, n);
159
+ t.addEventListener(e, o, n);
141
160
  });
142
161
  }
143
162
  function B() {
144
- return document.readyState === "loading" ? new Promise((e) => {
145
- document.addEventListener("DOMContentLoaded", () => e());
163
+ return document.readyState === "loading" ? new Promise((t) => {
164
+ document.addEventListener("DOMContentLoaded", () => t());
146
165
  }) : Promise.resolve();
147
166
  }
148
- function z(e = window) {
149
- 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
- e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => n(new Error("image error")), { once: !0 });
151
- }) : 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 }));
167
+ function V(t = window) {
168
+ return t || (t = window), t === window ? document.readyState === "complete" ? Promise.resolve() : new Promise((e) => window.addEventListener("load", () => e(), { once: !0 })) : t instanceof HTMLImageElement ? t.complete && t.naturalWidth !== 0 ? Promise.resolve() : new Promise((e, n) => {
169
+ t.addEventListener("load", () => e(), { once: !0 }), t.addEventListener("error", () => n(new Error("image error")), { once: !0 });
170
+ }) : t instanceof HTMLMediaElement ? t.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA ? Promise.resolve() : new Promise((e) => t.addEventListener("loadeddata", () => e(), { once: !0 })) : new Promise((e) => t.addEventListener("load", () => e(), { once: !0 }));
152
171
  }
153
- function G(e) {
154
- return new Promise((t) => setTimeout(t, e));
172
+ function z(t) {
173
+ return new Promise((e) => setTimeout(e, t));
155
174
  }
156
- function j(e) {
157
- return new Promise((t) => {
175
+ function G(t) {
176
+ return new Promise((e) => {
158
177
  const n = (i) => {
159
- e.removeEventListener("animationend", n), t(i);
178
+ t.removeEventListener("animationend", n), e(i);
160
179
  };
161
- e.addEventListener("animationend", n);
180
+ t.addEventListener("animationend", n);
162
181
  });
163
182
  }
164
- function q(e) {
183
+ function j(t) {
165
184
  var i;
166
- const t = new x(200, 5e3);
167
- class n extends e {
185
+ const e = new T(200, 5e3);
186
+ class n extends t {
168
187
  constructor() {
169
188
  super(...arguments);
170
- u(this, "currentBreakPoint", null);
171
- c(this, i, async () => {
172
- await t.debounce(), await B();
189
+ d(this, "currentBreakPoint", null);
190
+ m(this, i, async () => {
191
+ await e.wait(), await B();
173
192
  const l = window.innerWidth;
174
- let o = getComputedStyle(this).getPropertyValue("--breakpoint");
175
- o || (this.style.setProperty("--breakpoint", "md"), o = getComputedStyle(this).getPropertyValue("--breakpoint"));
176
- const d = A(l);
177
- this.currentBreakPoint !== d && (y(o) < y(d) ? this.setAttribute("mode", "desktop") : this.setAttribute("mode", "mobile"));
193
+ let s = getComputedStyle(this).getPropertyValue("--breakpoint");
194
+ s || (this.style.setProperty("--breakpoint", "md"), s = getComputedStyle(this).getPropertyValue("--breakpoint"));
195
+ const u = D(l);
196
+ this.currentBreakPoint !== u && (v(s) < v(u) ? this.setAttribute("mode", "desktop") : this.setAttribute("mode", "mobile"));
178
197
  });
179
198
  }
180
199
  connectedCallback() {
@@ -187,112 +206,113 @@ function q(e) {
187
206
  return i = new WeakMap(), n;
188
207
  }
189
208
  const g = Symbol("listenerDefs"), k = Symbol("withEventBindings");
190
- function X(e, t) {
191
- const n = Array.isArray(e) ? e : [e];
209
+ function q(t, e) {
210
+ const n = Array.isArray(t) ? t : [t];
192
211
  return function(i, r) {
193
212
  if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
194
213
  return r.addInitializer(function() {
195
- const s = this.constructor;
196
- (s[g] || (s[g] = [])).push({
214
+ const o = this.constructor;
215
+ (o[g] || (o[g] = [])).push({
197
216
  method: r.name,
198
217
  events: n,
199
- opts: t
218
+ opts: e
200
219
  });
201
- }), function(...s) {
220
+ }), function(...o) {
202
221
  if (!this[k])
203
222
  throw new Error("[EventBindings] @Listen - decorator requires EventBindingMixin.");
204
- return i.apply(this, s);
223
+ return i.apply(this, o);
205
224
  };
206
225
  };
207
226
  }
208
- function R(e, t) {
227
+ function R(t, e) {
209
228
  var n;
210
- 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;
229
+ return !e || e === "host" ? t : e === "document" ? t.ownerDocument ?? document : e === "window" ? ((n = t.ownerDocument) == null ? void 0 : n.defaultView) ?? window : e === "shadowRoot" ? t.shadowRoot ?? t : typeof e == "function" ? e(t) : e;
211
230
  }
212
- function J(e) {
213
- var n, i, P;
214
- class t extends e {
215
- constructor(...o) {
216
- super(...o);
217
- c(this, i);
218
- c(this, n);
231
+ function X(t) {
232
+ var n, i, M;
233
+ class e extends t {
234
+ constructor(...s) {
235
+ super(...s);
236
+ m(this, i);
237
+ m(this, n);
219
238
  this[k] = !0;
220
239
  }
221
240
  connectedCallback() {
222
- var o;
223
- (o = super.connectedCallback) == null || o.call(this), p(this, i, P).call(this);
241
+ var s;
242
+ (s = super.connectedCallback) == null || s.call(this), L(this, i, M).call(this);
224
243
  }
225
244
  disconnectedCallback() {
226
- var o, d;
227
- (o = a(this, n)) == null || o.abort(), (d = super.disconnectedCallback) == null || d.call(this);
245
+ var s, u;
246
+ (s = a(this, n)) == null || s.abort(), (u = super.disconnectedCallback) == null || u.call(this);
228
247
  }
229
248
  }
230
- return n = new WeakMap(), i = new WeakSet(), P = function() {
231
- var d, b, E;
232
- (d = a(this, n)) == null || d.abort(), m(this, n, new AbortController());
233
- const o = this.constructor[g] || [];
234
- for (const h of o) {
235
- 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 });
249
+ return n = new WeakMap(), i = new WeakSet(), M = function() {
250
+ var u, b, E;
251
+ (u = a(this, n)) == null || u.abort(), c(this, n, new AbortController());
252
+ const s = this.constructor[g] || [];
253
+ for (const h of s) {
254
+ const x = R(this, (b = h.opts) == null ? void 0 : b.target), W = ((E = h.opts) == null ? void 0 : E.options) ?? {}, P = this[h.method].bind(this);
255
+ for (const I of h.events)
256
+ x.addEventListener(I, P, { ...W, signal: a(this, n).signal });
238
257
  }
239
- }, t;
258
+ }, e;
240
259
  }
241
260
  let _ = 1;
242
- function K(e) {
261
+ function J(t) {
243
262
  var n, i, r;
244
- class t extends e {
263
+ class e extends t {
245
264
  constructor() {
246
265
  super(...arguments);
247
- c(this, n, null);
248
- c(this, i, _++);
249
- c(this, r, null);
266
+ m(this, n, null);
267
+ m(this, i, _++);
268
+ m(this, r, null);
250
269
  }
251
270
  /**
252
271
  * Clears the cached debug flag so the attribute will be checked again
253
272
  * on the next log/warn/error call.
254
273
  */
255
274
  invalidateDebugCache() {
256
- m(this, n, null);
275
+ c(this, n, null);
257
276
  }
258
277
  get _debug() {
259
- 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);
278
+ return a(this, n) !== null ? a(this, n) : (this instanceof HTMLElement && c(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
279
  }
261
- getLogger(o = "main") {
262
- return a(this, r) || m(this, r, new C(this._debug, `${a(this, i)}`, o)), a(this, r);
280
+ getLogger(s = "main") {
281
+ return a(this, r) || c(this, r, new $(this._debug, `${a(this, i)}`, s)), a(this, r);
263
282
  }
264
- log(...o) {
265
- this.getLogger().log(...o);
283
+ log(...s) {
284
+ this.getLogger().log(...s);
266
285
  }
267
- warn(...o) {
268
- this.getLogger().warn(...o);
286
+ warn(...s) {
287
+ this.getLogger().warn(...s);
269
288
  }
270
- error(...o) {
271
- this.getLogger().error(...o);
289
+ error(...s) {
290
+ this.getLogger().error(...s);
272
291
  }
273
- throwError(...o) {
274
- return this.getLogger().throwError(...o);
292
+ throwError(...s) {
293
+ return this.getLogger().throwError(...s);
275
294
  }
276
295
  }
277
- return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
296
+ return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), e;
278
297
  }
279
298
  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,
287
- v as breakpointMap,
299
+ j as BreakPointMixin,
300
+ T as Debouncer,
301
+ X as EventBindingsMixin,
302
+ q as Listen,
303
+ $ as Logger,
304
+ J as LoggingMixin,
305
+ H as Stopwatch,
306
+ y as breakpointMap,
288
307
  f as breakpoints,
289
- U as create_element,
290
- y as getBreakpointMinWidth,
291
- A as getCurrentBreakpoint,
292
- H as getErrorLocation,
293
- G as sleep,
294
- V as waitFor,
295
- j as waitForAnimationEnd,
308
+ S as create_element,
309
+ U as debounce,
310
+ v as getBreakpointMinWidth,
311
+ D as getCurrentBreakpoint,
312
+ F as getErrorLocation,
313
+ z as sleep,
314
+ O as waitFor,
315
+ G as waitForAnimationEnd,
296
316
  B as waitForDomContentLoaded,
297
- z as waitForLoad
317
+ V as waitForLoad
298
318
  };
@@ -3,6 +3,7 @@ export declare class Debouncer {
3
3
  private max_delay;
4
4
  private timeout;
5
5
  private startTimeWithMs;
6
+ private maxTimeout;
6
7
  /**
7
8
  *
8
9
  * @param delay Debounce delay in milliseconds
@@ -12,3 +13,22 @@ export declare class Debouncer {
12
13
  wait(): Promise<unknown>;
13
14
  debounce(callback: () => void): void;
14
15
  }
16
+ type MethodCtx = {
17
+ kind: 'method';
18
+ name: string | symbol;
19
+ };
20
+ /**
21
+ * Decorator to debounce method calls
22
+ *
23
+ * <example>
24
+ * @debounce(200, 1000)
25
+ * onResize() {
26
+ * // This method will be debounced with a delay of 200ms and a maximum delay of 1000ms
27
+ * }
28
+ * </example>
29
+ *
30
+ * @param delay
31
+ * @param maxDelay
32
+ */
33
+ export declare function debounce(delay: number, maxDelay?: number | false): <This, Args extends any[], Ret>(value: (this: This, ...args: Args) => Ret, context: MethodCtx) => (this: This, ...args: Args) => Ret;
34
+ export {};
@@ -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
+ "__#2763@#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
+ "__#2764@#ac"?: AbortController;
13
13
  connectedCallback(): void;
14
14
  disconnectedCallback(): void;
15
- "__#2664@#bindEventListeners"(): void;
15
+ "__#2764@#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
+ "__#2765@#debugCached": boolean | null;
30
+ "__#2765@#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
+ "__#2765@#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.24",
4
4
  "main": "./index.js",
5
5
  "dependencies": {},
6
6
  "type": "module",