@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 +12 -0
- package/index.js +178 -158
- package/lib/Debouncer.d.ts +20 -0
- package/mixins/BreakPointMixin.d.ts +1 -1
- package/mixins/EventBindingsMixin.d.ts +2 -2
- package/mixins/LoggingMixin.d.ts +3 -3
- package/package.json +1 -1
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
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var p = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var a = (
|
|
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
|
-
],
|
|
17
|
-
(
|
|
15
|
+
], y = f.reduce(
|
|
16
|
+
(t, e) => (t[e.name] = e.minWidth, t),
|
|
18
17
|
{}
|
|
19
18
|
);
|
|
20
|
-
function
|
|
21
|
-
if (!(
|
|
22
|
-
throw new Error(`Unknown breakpoint: ${
|
|
23
|
-
return
|
|
19
|
+
function v(t) {
|
|
20
|
+
if (!(t in y))
|
|
21
|
+
throw new Error(`Unknown breakpoint: ${t}`);
|
|
22
|
+
return y[t];
|
|
24
23
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
for (let
|
|
28
|
-
if (
|
|
29
|
-
return f[
|
|
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
|
|
31
|
+
function S(t, e = {}, n = []) {
|
|
33
32
|
Array.isArray(n) || (n = [n]);
|
|
34
|
-
const i = document.createElement(
|
|
35
|
-
for (const r in
|
|
36
|
-
|
|
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
|
|
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(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this
|
|
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((
|
|
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,
|
|
55
|
+
this.startTimeWithMs = 0, e(!0);
|
|
56
56
|
}, this.delay);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
debounce(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
66
|
-
|
|
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:
|
|
69
|
-
line:
|
|
70
|
-
column:
|
|
87
|
+
file: t.fileName || t.sourceURL,
|
|
88
|
+
line: t.lineNumber,
|
|
89
|
+
column: t.columnNumber ?? void 0
|
|
71
90
|
};
|
|
72
|
-
if (typeof
|
|
91
|
+
if (typeof t.line == "number")
|
|
73
92
|
return {
|
|
74
|
-
file:
|
|
75
|
-
line:
|
|
76
|
-
column:
|
|
93
|
+
file: t.sourceURL,
|
|
94
|
+
line: t.line,
|
|
95
|
+
column: t.column
|
|
77
96
|
};
|
|
78
|
-
const n = String(
|
|
97
|
+
const n = String(t.stack || t.message || "").split(`
|
|
79
98
|
`), i = /(.*?)(?:\(|@)?(.*?):(\d+):(\d+)\)?$/;
|
|
80
99
|
for (const r of n) {
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
return { file:
|
|
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:
|
|
104
|
+
return { file: t.fileName || t.sourceURL };
|
|
86
105
|
}
|
|
87
|
-
class
|
|
88
|
-
constructor(
|
|
89
|
-
this._debug =
|
|
106
|
+
class $ {
|
|
107
|
+
constructor(e, n, i = "main") {
|
|
108
|
+
this._debug = e, this.myElementId = n, this.instanceId = i;
|
|
90
109
|
}
|
|
91
|
-
log(...
|
|
92
|
-
this._debug && console.log(`[LOG][ID:${this.myElementId}:${this.instanceId}]`, ...
|
|
110
|
+
log(...e) {
|
|
111
|
+
this._debug && console.log(`[LOG][ID:${this.myElementId}:${this.instanceId}]`, ...e);
|
|
93
112
|
}
|
|
94
|
-
warn(...
|
|
95
|
-
console.warn(`[WARN][ID:${this.myElementId}:${this.instanceId}]`, ...
|
|
113
|
+
warn(...e) {
|
|
114
|
+
console.warn(`[WARN][ID:${this.myElementId}:${this.instanceId}]`, ...e);
|
|
96
115
|
}
|
|
97
|
-
error(...
|
|
98
|
-
console.error(`[ERROR][ID:${this.myElementId}:${this.instanceId}]`, ...
|
|
116
|
+
error(...e) {
|
|
117
|
+
console.error(`[ERROR][ID:${this.myElementId}:${this.instanceId}]`, ...e);
|
|
99
118
|
}
|
|
100
|
-
throwError(...
|
|
101
|
-
const n = `[ERROR][ID:${this.myElementId}:${this.instanceId}] ${
|
|
102
|
-
throw this.error(...
|
|
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
|
|
106
|
-
constructor(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.label =
|
|
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(
|
|
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}] ${
|
|
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
|
|
154
|
+
function O(t, e, n) {
|
|
136
155
|
return new Promise((i, r) => {
|
|
137
|
-
const
|
|
138
|
-
|
|
156
|
+
const o = (l) => {
|
|
157
|
+
t.removeEventListener(e, o, n), i(l);
|
|
139
158
|
};
|
|
140
|
-
|
|
159
|
+
t.addEventListener(e, o, n);
|
|
141
160
|
});
|
|
142
161
|
}
|
|
143
162
|
function B() {
|
|
144
|
-
return document.readyState === "loading" ? new Promise((
|
|
145
|
-
document.addEventListener("DOMContentLoaded", () =>
|
|
163
|
+
return document.readyState === "loading" ? new Promise((t) => {
|
|
164
|
+
document.addEventListener("DOMContentLoaded", () => t());
|
|
146
165
|
}) : Promise.resolve();
|
|
147
166
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
}) :
|
|
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
|
|
154
|
-
return new Promise((
|
|
172
|
+
function z(t) {
|
|
173
|
+
return new Promise((e) => setTimeout(e, t));
|
|
155
174
|
}
|
|
156
|
-
function
|
|
157
|
-
return new Promise((
|
|
175
|
+
function G(t) {
|
|
176
|
+
return new Promise((e) => {
|
|
158
177
|
const n = (i) => {
|
|
159
|
-
|
|
178
|
+
t.removeEventListener("animationend", n), e(i);
|
|
160
179
|
};
|
|
161
|
-
|
|
180
|
+
t.addEventListener("animationend", n);
|
|
162
181
|
});
|
|
163
182
|
}
|
|
164
|
-
function
|
|
183
|
+
function j(t) {
|
|
165
184
|
var i;
|
|
166
|
-
const
|
|
167
|
-
class n extends
|
|
185
|
+
const e = new T(200, 5e3);
|
|
186
|
+
class n extends t {
|
|
168
187
|
constructor() {
|
|
169
188
|
super(...arguments);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
await
|
|
189
|
+
d(this, "currentBreakPoint", null);
|
|
190
|
+
m(this, i, async () => {
|
|
191
|
+
await e.wait(), await B();
|
|
173
192
|
const l = window.innerWidth;
|
|
174
|
-
let
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
this.currentBreakPoint !==
|
|
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
|
|
191
|
-
const n = Array.isArray(
|
|
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
|
|
196
|
-
(
|
|
214
|
+
const o = this.constructor;
|
|
215
|
+
(o[g] || (o[g] = [])).push({
|
|
197
216
|
method: r.name,
|
|
198
217
|
events: n,
|
|
199
|
-
opts:
|
|
218
|
+
opts: e
|
|
200
219
|
});
|
|
201
|
-
}), function(...
|
|
220
|
+
}), function(...o) {
|
|
202
221
|
if (!this[k])
|
|
203
222
|
throw new Error("[EventBindings] @Listen - decorator requires EventBindingMixin.");
|
|
204
|
-
return i.apply(this,
|
|
223
|
+
return i.apply(this, o);
|
|
205
224
|
};
|
|
206
225
|
};
|
|
207
226
|
}
|
|
208
|
-
function R(
|
|
227
|
+
function R(t, e) {
|
|
209
228
|
var n;
|
|
210
|
-
return !
|
|
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
|
|
213
|
-
var n, i,
|
|
214
|
-
class
|
|
215
|
-
constructor(...
|
|
216
|
-
super(...
|
|
217
|
-
|
|
218
|
-
|
|
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
|
|
223
|
-
(
|
|
241
|
+
var s;
|
|
242
|
+
(s = super.connectedCallback) == null || s.call(this), L(this, i, M).call(this);
|
|
224
243
|
}
|
|
225
244
|
disconnectedCallback() {
|
|
226
|
-
var
|
|
227
|
-
(
|
|
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(),
|
|
231
|
-
var
|
|
232
|
-
(
|
|
233
|
-
const
|
|
234
|
-
for (const h of
|
|
235
|
-
const
|
|
236
|
-
for (const
|
|
237
|
-
|
|
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
|
-
},
|
|
258
|
+
}, e;
|
|
240
259
|
}
|
|
241
260
|
let _ = 1;
|
|
242
|
-
function
|
|
261
|
+
function J(t) {
|
|
243
262
|
var n, i, r;
|
|
244
|
-
class
|
|
263
|
+
class e extends t {
|
|
245
264
|
constructor() {
|
|
246
265
|
super(...arguments);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
275
|
+
c(this, n, null);
|
|
257
276
|
}
|
|
258
277
|
get _debug() {
|
|
259
|
-
return a(this, n) !== null ? a(this, n) : (this instanceof HTMLElement &&
|
|
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(
|
|
262
|
-
return 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(...
|
|
265
|
-
this.getLogger().log(...
|
|
283
|
+
log(...s) {
|
|
284
|
+
this.getLogger().log(...s);
|
|
266
285
|
}
|
|
267
|
-
warn(...
|
|
268
|
-
this.getLogger().warn(...
|
|
286
|
+
warn(...s) {
|
|
287
|
+
this.getLogger().warn(...s);
|
|
269
288
|
}
|
|
270
|
-
error(...
|
|
271
|
-
this.getLogger().error(...
|
|
289
|
+
error(...s) {
|
|
290
|
+
this.getLogger().error(...s);
|
|
272
291
|
}
|
|
273
|
-
throwError(...
|
|
274
|
-
return this.getLogger().throwError(...
|
|
292
|
+
throwError(...s) {
|
|
293
|
+
return this.getLogger().throwError(...s);
|
|
275
294
|
}
|
|
276
295
|
}
|
|
277
|
-
return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(),
|
|
296
|
+
return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), e;
|
|
278
297
|
}
|
|
279
298
|
export {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
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
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
|
|
317
|
+
V as waitForLoad
|
|
298
318
|
};
|
package/lib/Debouncer.d.ts
CHANGED
|
@@ -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
|
-
"__#
|
|
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
|
-
"__#
|
|
12
|
+
"__#2764@#ac"?: AbortController;
|
|
13
13
|
connectedCallback(): void;
|
|
14
14
|
disconnectedCallback(): void;
|
|
15
|
-
"__#
|
|
15
|
+
"__#2764@#bindEventListeners"(): void;
|
|
16
16
|
}) & TBase;
|
|
17
17
|
export {};
|
package/mixins/LoggingMixin.d.ts
CHANGED
|
@@ -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
|
-
"__#
|
|
30
|
-
"__#
|
|
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
|
-
"__#
|
|
36
|
+
"__#2765@#myLoggerInstance": Logger | null;
|
|
37
37
|
readonly _debug: boolean;
|
|
38
38
|
getLogger(instanceId?: string): Logger;
|
|
39
39
|
log(...args: any[]): void;
|