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