@trunkjs/browser-utils 1.0.48 → 1.0.50
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/.ai-usage-info.md +4 -0
- package/CHANGELOG.md +8 -0
- package/index.js +194 -182
- package/lib/Debouncer.d.ts +4 -0
- package/mixins/LoaderMixin.d.ts +2 -2
- package/package.json +1 -1
package/.ai-usage-info.md
CHANGED
|
@@ -153,6 +153,10 @@ Empty slots get the CSS class:
|
|
|
153
153
|
<slot class="slot-empty"></slot>
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
+
Notes:
|
|
157
|
+
- whitespace-only text nodes are treated as empty
|
|
158
|
+
- HTML comments are treated as empty as well (important for Lit comment markers)
|
|
159
|
+
|
|
156
160
|
## Other exports
|
|
157
161
|
|
|
158
162
|
```ts
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 1.0.50 (2026-05-19)
|
|
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.49 (2026-05-18)
|
|
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.48 (2026-05-15)
|
|
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,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var B = Object.defineProperty;
|
|
2
|
+
var _ = (e) => {
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var O = (e, t, n) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
|
+
var m = (e, t, n) => O(e, typeof t != "symbol" ? t + "" : t, n), T = (e, t, n) => t.has(e) || _("Cannot " + n);
|
|
7
|
+
var l = (e, t, n) => (T(e, t, "read from private field"), n ? n.call(e) : t.get(e)), f = (e, t, n) => t.has(e) ? _("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), b = (e, t, n, i) => (T(e, t, "write to private field"), i ? i.call(e, n) : t.set(e, n), n), w = (e, t, n) => (T(e, t, "access private method"), n);
|
|
8
8
|
const v = [
|
|
9
9
|
{ name: "xs", minWidth: 0 },
|
|
10
10
|
{ name: "sm", minWidth: 576 },
|
|
@@ -12,26 +12,26 @@ const v = [
|
|
|
12
12
|
{ name: "lg", minWidth: 992 },
|
|
13
13
|
{ name: "xl", minWidth: 1200 },
|
|
14
14
|
{ name: "xxl", minWidth: 1400 }
|
|
15
|
-
],
|
|
15
|
+
], M = v.reduce(
|
|
16
16
|
(e, t) => (e[t.name] = t.minWidth, e),
|
|
17
17
|
{}
|
|
18
18
|
);
|
|
19
19
|
function E(e) {
|
|
20
|
-
if (!(e in
|
|
20
|
+
if (!(e in M))
|
|
21
21
|
throw new Error(`Unknown breakpoint: ${e}`);
|
|
22
|
-
return
|
|
22
|
+
return M[e];
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function U() {
|
|
25
25
|
return window.visualViewport ? window.visualViewport.width : window.innerWidth;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
e === void 0 && (e =
|
|
27
|
+
function j(e) {
|
|
28
|
+
e === void 0 && (e = U());
|
|
29
29
|
for (let t = v.length - 1; t >= 0; t--)
|
|
30
30
|
if (e >= v[t].minWidth)
|
|
31
31
|
return v[t].name;
|
|
32
32
|
return "xs";
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function X(e, t = {}, n = []) {
|
|
35
35
|
Array.isArray(n) || (n = [n]);
|
|
36
36
|
const i = document.createElement(e);
|
|
37
37
|
for (const r in t)
|
|
@@ -40,16 +40,16 @@ function J(e, t = {}, n = []) {
|
|
|
40
40
|
i.append(typeof r == "string" ? document.createTextNode(r) : r);
|
|
41
41
|
return i;
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class C {
|
|
44
44
|
/**
|
|
45
45
|
*
|
|
46
46
|
* @param delay Debounce delay in milliseconds
|
|
47
47
|
* @param max_delay Maximum delay in milliseconds, if false then no maximum delay is applied
|
|
48
48
|
*/
|
|
49
49
|
constructor(t, n = !1) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
m(this, "timeout", null);
|
|
51
|
+
m(this, "startTimeWithMs", 0);
|
|
52
|
+
m(this, "maxTimeout", null);
|
|
53
53
|
this.delay = t, this.max_delay = n;
|
|
54
54
|
}
|
|
55
55
|
async wait() {
|
|
@@ -59,6 +59,10 @@ class P {
|
|
|
59
59
|
}, this.delay));
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use wait() instead and handle the callback logic in the caller function for better control and flexibility.
|
|
64
|
+
* @param callback
|
|
65
|
+
*/
|
|
62
66
|
debounce(t) {
|
|
63
67
|
const n = Date.now();
|
|
64
68
|
this.startTimeWithMs === 0 && (this.startTimeWithMs = n);
|
|
@@ -66,25 +70,25 @@ class P {
|
|
|
66
70
|
this.timeout && (clearTimeout(this.timeout), this.timeout = null), this.maxTimeout && (clearTimeout(this.maxTimeout), this.maxTimeout = null), this.startTimeWithMs = 0, t();
|
|
67
71
|
};
|
|
68
72
|
if (this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(i, this.delay), this.max_delay !== !1 && !this.maxTimeout) {
|
|
69
|
-
const r = n - this.startTimeWithMs,
|
|
70
|
-
this.maxTimeout = setTimeout(i,
|
|
73
|
+
const r = n - this.startTimeWithMs, o = Math.max(0, this.max_delay - r);
|
|
74
|
+
this.maxTimeout = setTimeout(i, o);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
|
-
function
|
|
78
|
+
function Q(e, t = !1) {
|
|
75
79
|
const n = /* @__PURE__ */ new WeakMap();
|
|
76
80
|
return function(i, r) {
|
|
77
81
|
if (r.kind !== "method") return i;
|
|
78
|
-
const
|
|
79
|
-
return function(...
|
|
82
|
+
const o = r.name;
|
|
83
|
+
return function(...c) {
|
|
80
84
|
let s = n.get(this);
|
|
81
85
|
s || (s = /* @__PURE__ */ new Map(), n.set(this, s));
|
|
82
|
-
let
|
|
83
|
-
|
|
86
|
+
let a = s.get(o);
|
|
87
|
+
a || (a = new C(e, t), s.set(o, a)), a.debounce(() => i.apply(this, c));
|
|
84
88
|
};
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
|
-
function
|
|
91
|
+
function Y(e) {
|
|
88
92
|
if (typeof e.lineNumber == "number")
|
|
89
93
|
return {
|
|
90
94
|
file: e.fileName || e.sourceURL,
|
|
@@ -100,13 +104,13 @@ function Q(e) {
|
|
|
100
104
|
const n = String(e.stack || e.message || "").split(`
|
|
101
105
|
`), i = /(.*?)(?:\(|@)?(.*?):(\d+):(\d+)\)?$/;
|
|
102
106
|
for (const r of n) {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
return { file:
|
|
107
|
+
const o = r.match(i);
|
|
108
|
+
if (o)
|
|
109
|
+
return { file: o[2], line: +o[3], column: +o[4] };
|
|
106
110
|
}
|
|
107
111
|
return { file: e.fileName || e.sourceURL };
|
|
108
112
|
}
|
|
109
|
-
class
|
|
113
|
+
class V {
|
|
110
114
|
constructor(t, n, i, r = "main") {
|
|
111
115
|
this._debug = t, this.myTag = n, this.myElementId = i, this.instanceId = r;
|
|
112
116
|
}
|
|
@@ -127,13 +131,13 @@ class j {
|
|
|
127
131
|
throw this.error(...t), new Error(n);
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
|
-
class
|
|
134
|
+
class Z {
|
|
131
135
|
constructor(t, n = !0) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
m(this, "label");
|
|
137
|
+
m(this, "last");
|
|
138
|
+
m(this, "startTime");
|
|
139
|
+
m(this, "running", !1);
|
|
140
|
+
m(this, "enabled");
|
|
137
141
|
this.label = t, this.enabled = n, this.startTime = this.last = performance.now(), this.running = !0;
|
|
138
142
|
}
|
|
139
143
|
lap(t = "") {
|
|
@@ -157,10 +161,10 @@ class Y {
|
|
|
157
161
|
return this.running;
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
|
-
function
|
|
164
|
+
function F(e) {
|
|
161
165
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
162
166
|
}
|
|
163
|
-
function
|
|
167
|
+
function K(e) {
|
|
164
168
|
if (e != null)
|
|
165
169
|
try {
|
|
166
170
|
return JSON.parse(e);
|
|
@@ -168,28 +172,28 @@ function F(e) {
|
|
|
168
172
|
return;
|
|
169
173
|
}
|
|
170
174
|
}
|
|
171
|
-
function
|
|
175
|
+
function P(e) {
|
|
172
176
|
const t = JSON.stringify(e);
|
|
173
177
|
return t === void 0 ? "null" : t;
|
|
174
178
|
}
|
|
175
|
-
function
|
|
179
|
+
function z(e, t) {
|
|
176
180
|
const n = { ...t };
|
|
177
|
-
if (
|
|
181
|
+
if (F(e))
|
|
178
182
|
for (const i of Object.keys(t))
|
|
179
183
|
i in e && (n[i] = e[i]);
|
|
180
184
|
return n;
|
|
181
185
|
}
|
|
182
|
-
class
|
|
186
|
+
class A {
|
|
183
187
|
constructor(t, n, i) {
|
|
184
|
-
|
|
188
|
+
m(this, "cache");
|
|
185
189
|
this.backend = t, this.storageKey = n, this.initialValue = i;
|
|
186
190
|
}
|
|
187
191
|
read() {
|
|
188
192
|
if (this.cache) return this.cache;
|
|
189
|
-
const t = this.backend ?
|
|
193
|
+
const t = this.backend ? K(this.backend.getItem(this.storageKey)) : void 0, n = z(t, this.initialValue);
|
|
190
194
|
if (this.backend && this.backend.getItem(this.storageKey) == null)
|
|
191
195
|
try {
|
|
192
|
-
this.backend.setItem(this.storageKey,
|
|
196
|
+
this.backend.setItem(this.storageKey, P(n));
|
|
193
197
|
} catch {
|
|
194
198
|
}
|
|
195
199
|
return this.cache = n, n;
|
|
@@ -197,7 +201,7 @@ class C {
|
|
|
197
201
|
write(t) {
|
|
198
202
|
if (this.cache = t, !!this.backend)
|
|
199
203
|
try {
|
|
200
|
-
this.backend.setItem(this.storageKey,
|
|
204
|
+
this.backend.setItem(this.storageKey, P(t));
|
|
201
205
|
} catch {
|
|
202
206
|
}
|
|
203
207
|
}
|
|
@@ -211,15 +215,15 @@ class C {
|
|
|
211
215
|
},
|
|
212
216
|
set: (n, i, r) => {
|
|
213
217
|
if (typeof i != "string") return !1;
|
|
214
|
-
const
|
|
215
|
-
return
|
|
218
|
+
const c = { ...this.read() };
|
|
219
|
+
return c[i] = r, this.write(c), !0;
|
|
216
220
|
},
|
|
217
221
|
deleteProperty: (n, i) => {
|
|
218
222
|
if (typeof i != "string") return !1;
|
|
219
223
|
const r = this.read();
|
|
220
224
|
if (!(i in r)) return !0;
|
|
221
|
-
const
|
|
222
|
-
return delete
|
|
225
|
+
const o = { ...r };
|
|
226
|
+
return delete o[i], this.write(o), !0;
|
|
223
227
|
},
|
|
224
228
|
has: (n, i) => {
|
|
225
229
|
if (typeof i != "string") return !1;
|
|
@@ -245,47 +249,47 @@ class C {
|
|
|
245
249
|
return new Proxy({}, t);
|
|
246
250
|
}
|
|
247
251
|
}
|
|
248
|
-
function
|
|
252
|
+
function W(e) {
|
|
249
253
|
const t = globalThis.window;
|
|
250
254
|
return (e === "session" ? t == null ? void 0 : t.sessionStorage : t == null ? void 0 : t.localStorage) ?? void 0;
|
|
251
255
|
}
|
|
252
|
-
function Z(e, t) {
|
|
253
|
-
return new C(A("session"), e, t).asProxy();
|
|
254
|
-
}
|
|
255
256
|
function tt(e, t) {
|
|
256
|
-
return new
|
|
257
|
+
return new A(W("session"), e, t).asProxy();
|
|
258
|
+
}
|
|
259
|
+
function et(e, t) {
|
|
260
|
+
return new A(W("local"), e, t).asProxy();
|
|
257
261
|
}
|
|
258
|
-
function
|
|
262
|
+
function L(e, t, n) {
|
|
259
263
|
return new Promise((i, r) => {
|
|
260
|
-
const
|
|
261
|
-
e.removeEventListener(t,
|
|
264
|
+
const o = (c) => {
|
|
265
|
+
e.removeEventListener(t, o, n), i(c);
|
|
262
266
|
};
|
|
263
|
-
e.addEventListener(t,
|
|
267
|
+
e.addEventListener(t, o, n);
|
|
264
268
|
});
|
|
265
269
|
}
|
|
266
|
-
function
|
|
270
|
+
function H() {
|
|
267
271
|
return document.readyState === "loading" ? new Promise((e) => {
|
|
268
272
|
document.addEventListener("DOMContentLoaded", () => e());
|
|
269
273
|
}) : Promise.resolve();
|
|
270
274
|
}
|
|
271
|
-
function et() {
|
|
272
|
-
return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() : T(window, "loader:ready") : L();
|
|
273
|
-
}
|
|
274
275
|
function nt() {
|
|
275
|
-
return window.tj_loader_state ? window.tj_loader_state
|
|
276
|
+
return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() : L(window, "loader:ready") : x();
|
|
276
277
|
}
|
|
277
278
|
function it() {
|
|
278
|
-
return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() :
|
|
279
|
+
return window.tj_loader_state ? window.tj_loader_state === "pre-visual" || window.tj_loader_state === "visual" ? Promise.resolve() : L(window, "loader:pre-visual") : x();
|
|
280
|
+
}
|
|
281
|
+
function rt() {
|
|
282
|
+
return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() : L(window, "loader:visual") : x();
|
|
279
283
|
}
|
|
280
|
-
function
|
|
284
|
+
function x(e = window) {
|
|
281
285
|
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) => {
|
|
282
286
|
e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => n(new Error("image error")), { once: !0 });
|
|
283
287
|
}) : 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 }));
|
|
284
288
|
}
|
|
285
|
-
function
|
|
289
|
+
function st(e) {
|
|
286
290
|
return new Promise((t) => setTimeout(t, e));
|
|
287
291
|
}
|
|
288
|
-
function
|
|
292
|
+
function ot(e) {
|
|
289
293
|
return new Promise((t) => {
|
|
290
294
|
const n = (i) => {
|
|
291
295
|
e.removeEventListener("animationend", n), t(i);
|
|
@@ -293,118 +297,118 @@ function st(e) {
|
|
|
293
297
|
e.addEventListener("animationend", n);
|
|
294
298
|
});
|
|
295
299
|
}
|
|
296
|
-
function
|
|
300
|
+
function at(e) {
|
|
297
301
|
var n, i;
|
|
298
302
|
class t extends e {
|
|
299
303
|
constructor() {
|
|
300
304
|
super(...arguments);
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
var
|
|
305
|
-
await
|
|
306
|
-
const
|
|
307
|
-
let
|
|
308
|
-
if (!
|
|
305
|
+
f(this, n, new C(200, 5e3));
|
|
306
|
+
m(this, "currentBreakPoint", null);
|
|
307
|
+
f(this, i, async () => {
|
|
308
|
+
var y;
|
|
309
|
+
await l(this, n).wait(), await H();
|
|
310
|
+
const c = this, s = window.innerWidth;
|
|
311
|
+
let a = getComputedStyle(c).getPropertyValue("--breakpoint");
|
|
312
|
+
if (!a || a === "")
|
|
309
313
|
return;
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
this.currentBreakPoint !== g && (E(
|
|
314
|
+
a = a.trim().replace(/^['"]|['"]$/g, "");
|
|
315
|
+
const u = a.split(","), d = u[0].trim(), h = ((y = u[1]) == null ? void 0 : y.trim()) ?? d, g = j(s);
|
|
316
|
+
this.currentBreakPoint !== g && (E(h) <= E(g) ? c.setAttribute("mode", "desktop") : E(d) > E(g) ? c.setAttribute("mode", "mobile") : c.setAttribute("mode", "tablet"));
|
|
313
317
|
});
|
|
314
318
|
}
|
|
315
319
|
connectedCallback() {
|
|
316
320
|
super.connectedCallback();
|
|
317
321
|
try {
|
|
318
|
-
|
|
319
|
-
} catch (
|
|
320
|
-
throw console.error("Error in BreakPointMixin:",
|
|
322
|
+
l(this, i).call(this), window.addEventListener("resize", l(this, i)), l(this, i).call(this);
|
|
323
|
+
} catch (c) {
|
|
324
|
+
throw console.error("Error in BreakPointMixin:", c, "in element", this), c;
|
|
321
325
|
}
|
|
322
326
|
}
|
|
323
327
|
disconnectedCallback() {
|
|
324
|
-
super.disconnectedCallback(), window.removeEventListener("resize",
|
|
328
|
+
super.disconnectedCallback(), window.removeEventListener("resize", l(this, i));
|
|
325
329
|
}
|
|
326
330
|
}
|
|
327
331
|
return n = new WeakMap(), i = new WeakMap(), t;
|
|
328
332
|
}
|
|
329
|
-
const p = Symbol("listenerDefs"),
|
|
330
|
-
function
|
|
333
|
+
const p = Symbol("listenerDefs"), $ = Symbol("withEventBindings");
|
|
334
|
+
function ut(e, t) {
|
|
331
335
|
const n = Array.isArray(e) ? e : [e];
|
|
332
336
|
return function(i, r) {
|
|
333
337
|
if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
|
|
334
338
|
return r.addInitializer(function() {
|
|
335
|
-
const
|
|
336
|
-
(
|
|
339
|
+
const o = this;
|
|
340
|
+
(o[p] || (o[p] = [])).push({
|
|
337
341
|
method: r.name,
|
|
338
342
|
events: [...n],
|
|
339
343
|
opts: t
|
|
340
344
|
});
|
|
341
|
-
}), function(...
|
|
342
|
-
if (!this[
|
|
345
|
+
}), function(...o) {
|
|
346
|
+
if (!this[$])
|
|
343
347
|
throw new Error("[EventBindings] @Listen - decorator requires EventBindingMixin.");
|
|
344
|
-
return i.apply(this,
|
|
348
|
+
return i.apply(this, o);
|
|
345
349
|
};
|
|
346
350
|
};
|
|
347
351
|
}
|
|
348
|
-
function
|
|
352
|
+
function G(e, t) {
|
|
349
353
|
var n;
|
|
350
354
|
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;
|
|
351
355
|
}
|
|
352
|
-
function
|
|
353
|
-
var n, i,
|
|
356
|
+
function dt(e) {
|
|
357
|
+
var n, i, I;
|
|
354
358
|
class t extends e {
|
|
355
359
|
constructor(...s) {
|
|
356
360
|
super(...s);
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
this[
|
|
361
|
+
f(this, i);
|
|
362
|
+
f(this, n);
|
|
363
|
+
this[$] = !0;
|
|
360
364
|
}
|
|
361
365
|
connectedCallback() {
|
|
362
366
|
var s;
|
|
363
|
-
(s = super.connectedCallback) == null || s.call(this),
|
|
367
|
+
(s = super.connectedCallback) == null || s.call(this), w(this, i, I).call(this);
|
|
364
368
|
}
|
|
365
369
|
disconnectedCallback() {
|
|
366
|
-
var s,
|
|
367
|
-
(s =
|
|
370
|
+
var s, a;
|
|
371
|
+
(s = l(this, n)) == null || s.abort(), (a = super.disconnectedCallback) == null || a.call(this);
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
|
-
return n = new WeakMap(), i = new WeakSet(),
|
|
371
|
-
var
|
|
372
|
-
(
|
|
374
|
+
return n = new WeakMap(), i = new WeakSet(), I = function() {
|
|
375
|
+
var a, u, d;
|
|
376
|
+
(a = l(this, n)) == null || a.abort(), b(this, n, new AbortController());
|
|
373
377
|
const s = this[p] || [];
|
|
374
|
-
for (const
|
|
375
|
-
const g =
|
|
376
|
-
for (const
|
|
377
|
-
g.addEventListener(
|
|
378
|
+
for (const h of s) {
|
|
379
|
+
const g = G(this, (u = h.opts) == null ? void 0 : u.target), y = ((d = h.opts) == null ? void 0 : d.options) ?? {}, D = this[h.method].bind(this);
|
|
380
|
+
for (const R of h.events)
|
|
381
|
+
g.addEventListener(R, D, { ...y, signal: l(this, n).signal });
|
|
378
382
|
}
|
|
379
383
|
}, t;
|
|
380
384
|
}
|
|
381
|
-
let
|
|
382
|
-
function
|
|
385
|
+
let q = 1;
|
|
386
|
+
function lt(e) {
|
|
383
387
|
var n, i, r;
|
|
384
388
|
class t extends e {
|
|
385
389
|
constructor() {
|
|
386
390
|
super(...arguments);
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
f(this, n, null);
|
|
392
|
+
f(this, i, q++);
|
|
393
|
+
f(this, r, null);
|
|
390
394
|
}
|
|
391
395
|
/**
|
|
392
396
|
* Clears the cached debug flag so the attribute will be checked again
|
|
393
397
|
* on the next log/warn/error call.
|
|
394
398
|
*/
|
|
395
399
|
invalidateDebugCache() {
|
|
396
|
-
|
|
400
|
+
b(this, n, null);
|
|
397
401
|
}
|
|
398
402
|
get _debug() {
|
|
399
|
-
return
|
|
403
|
+
return l(this, n) !== null ? l(this, n) : (this instanceof HTMLElement && b(this, n, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), l(this, n) === !0 && console.info(
|
|
400
404
|
// @ts-expect-error - it says tagName is not defined -whatever
|
|
401
|
-
`[DEBUG][ID:${
|
|
405
|
+
`[DEBUG][ID:${l(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`,
|
|
402
406
|
this
|
|
403
|
-
),
|
|
407
|
+
), l(this, n) ?? !1);
|
|
404
408
|
}
|
|
405
409
|
getLogger(s = "main") {
|
|
406
|
-
const
|
|
407
|
-
return
|
|
410
|
+
const a = "<" + (this.tagName || this.constructor.name || "UnknownElement") + ">";
|
|
411
|
+
return l(this, r) || b(this, r, new V(this._debug, a, `${l(this, i)}`, s)), l(this, r);
|
|
408
412
|
}
|
|
409
413
|
debug(...s) {
|
|
410
414
|
this.getLogger().debug(...s);
|
|
@@ -424,94 +428,102 @@ function dt(e) {
|
|
|
424
428
|
}
|
|
425
429
|
return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
|
|
426
430
|
}
|
|
427
|
-
function
|
|
431
|
+
function ct(e) {
|
|
428
432
|
class t extends e {
|
|
429
433
|
connectedCallback() {
|
|
430
|
-
this.dispatchEvent(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
434
|
+
this.dispatchEvent(
|
|
435
|
+
new CustomEvent("init:child-waitreq", {
|
|
436
|
+
detail: {
|
|
437
|
+
element: this,
|
|
438
|
+
state: "connected"
|
|
439
|
+
},
|
|
440
|
+
bubbles: !0,
|
|
441
|
+
composed: !0
|
|
442
|
+
})
|
|
443
|
+
), super.connectedCallback();
|
|
438
444
|
}
|
|
439
445
|
firstUpdated(i) {
|
|
440
446
|
var r;
|
|
441
|
-
(r = super.firstUpdated) == null || r.call(this, i), this.dispatchEvent(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
447
|
+
(r = super.firstUpdated) == null || r.call(this, i), this.dispatchEvent(
|
|
448
|
+
new CustomEvent("init:child-ready", {
|
|
449
|
+
detail: {
|
|
450
|
+
element: this,
|
|
451
|
+
state: "ready"
|
|
452
|
+
},
|
|
453
|
+
bubbles: !0,
|
|
454
|
+
composed: !0
|
|
455
|
+
})
|
|
456
|
+
);
|
|
449
457
|
}
|
|
450
458
|
disconnectedCallback() {
|
|
451
|
-
super.disconnectedCallback(), this.dispatchEvent(
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
+
super.disconnectedCallback(), this.dispatchEvent(
|
|
460
|
+
new CustomEvent("init:child-ready", {
|
|
461
|
+
detail: {
|
|
462
|
+
element: this,
|
|
463
|
+
state: "disconnected"
|
|
464
|
+
},
|
|
465
|
+
bubbles: !0,
|
|
466
|
+
composed: !0
|
|
467
|
+
})
|
|
468
|
+
);
|
|
459
469
|
}
|
|
460
470
|
}
|
|
461
471
|
return t;
|
|
462
472
|
}
|
|
463
|
-
function
|
|
464
|
-
var n,
|
|
473
|
+
function ht(e) {
|
|
474
|
+
var n, N, r, k, S;
|
|
465
475
|
class t extends e {
|
|
466
476
|
constructor() {
|
|
467
477
|
super(...arguments);
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
478
|
+
f(this, n);
|
|
479
|
+
f(this, r, (u) => {
|
|
480
|
+
const d = u.target, h = w(this, n, k).call(this, d.assignedNodes({ flatten: !0 })), g = w(this, n, k).call(this, d.childNodes);
|
|
481
|
+
h || g ? d.classList.remove("slot-empty") : d.classList.add("slot-empty");
|
|
472
482
|
});
|
|
473
483
|
}
|
|
474
|
-
firstUpdated(
|
|
475
|
-
var
|
|
476
|
-
(
|
|
484
|
+
firstUpdated(u) {
|
|
485
|
+
var d;
|
|
486
|
+
(d = super.firstUpdated) == null || d.call(this, u), w(this, n, N).call(this);
|
|
477
487
|
}
|
|
478
488
|
}
|
|
479
|
-
return n = new WeakSet(),
|
|
480
|
-
var
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
489
|
+
return n = new WeakSet(), N = function() {
|
|
490
|
+
var d;
|
|
491
|
+
const u = (d = this.shadowRoot) == null ? void 0 : d.querySelectorAll("slot");
|
|
492
|
+
u == null || u.forEach((h) => {
|
|
493
|
+
w(this, n, k).call(this, h.childNodes) || h.classList.add("slot-empty"), h.addEventListener("slotchange", (g) => l(this, r).call(this, g));
|
|
484
494
|
});
|
|
485
|
-
}, r = new WeakMap(),
|
|
486
|
-
return
|
|
495
|
+
}, r = new WeakMap(), k = function(u) {
|
|
496
|
+
return Array.from(u).some((d) => w(this, n, S).call(this, d));
|
|
497
|
+
}, S = function(u) {
|
|
498
|
+
return u.nodeType === Node.TEXT_NODE ? (u.textContent || "").trim().length > 0 : u.nodeType === Node.ELEMENT_NODE;
|
|
487
499
|
}, t;
|
|
488
500
|
}
|
|
489
501
|
export {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
502
|
+
at as BreakPointMixin,
|
|
503
|
+
C as Debouncer,
|
|
504
|
+
dt as EventBindingsMixin,
|
|
505
|
+
ut as Listen,
|
|
506
|
+
ct as LoaderMixin,
|
|
507
|
+
V as Logger,
|
|
508
|
+
lt as LoggingMixin,
|
|
509
|
+
ht as SlotVisibilityMixin,
|
|
510
|
+
Z as Stopwatch,
|
|
511
|
+
M as breakpointMap,
|
|
500
512
|
v as breakpoints,
|
|
501
|
-
|
|
502
|
-
|
|
513
|
+
X as create_element,
|
|
514
|
+
Q as debounce,
|
|
503
515
|
E as getBreakpointMinWidth,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
516
|
+
j as getCurrentBreakpoint,
|
|
517
|
+
Y as getErrorLocation,
|
|
518
|
+
U as getViewportWidth,
|
|
519
|
+
et as local_storage,
|
|
520
|
+
tt as session_storage,
|
|
521
|
+
st as sleep,
|
|
522
|
+
L as waitFor,
|
|
523
|
+
ot as waitForAnimationEnd,
|
|
524
|
+
H as waitForDomContentLoaded,
|
|
525
|
+
x as waitForLoad,
|
|
526
|
+
it as waitForPreVisual,
|
|
527
|
+
nt as waitForReady,
|
|
528
|
+
rt as waitForVisual
|
|
517
529
|
};
|
package/lib/Debouncer.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export declare class Debouncer {
|
|
|
11
11
|
*/
|
|
12
12
|
constructor(delay: number, max_delay?: number | false);
|
|
13
13
|
wait(): Promise<unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use wait() instead and handle the callback logic in the caller function for better control and flexibility.
|
|
16
|
+
* @param callback
|
|
17
|
+
*/
|
|
14
18
|
debounce(callback: () => void): void;
|
|
15
19
|
}
|
|
16
20
|
type MethodCtx = {
|
package/mixins/LoaderMixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactiveElement } from 'lit';
|
|
2
2
|
type Constructor<T = object> = abstract new (...args: any[]) => T;
|
|
3
3
|
export interface LoaderMixinInterface {
|
|
4
4
|
}
|
|
5
|
-
export declare function LoaderMixin<TBase extends Constructor<
|
|
5
|
+
export declare function LoaderMixin<TBase extends Constructor<ReactiveElement>>(Base: TBase): TBase & Constructor<LoaderMixinInterface>;
|
|
6
6
|
export {};
|