@trunkjs/browser-utils 1.0.35 → 1.0.38
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 +295 -188
- package/lib/storage.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 1.0.38 (2026-02-12)
|
|
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.37 (2026-02-08)
|
|
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.36 (2026-02-08)
|
|
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.35 (2026-02-07)
|
|
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
|
@@ -4,6 +4,7 @@ export * from './lib/Debouncer';
|
|
|
4
4
|
export * from './lib/get-error-location';
|
|
5
5
|
export * from './lib/Logger';
|
|
6
6
|
export * from './lib/Stopwatch';
|
|
7
|
+
export * from './lib/storage';
|
|
7
8
|
export * from './lib/wait-for';
|
|
8
9
|
export * from './mixins/BreakPointMixin';
|
|
9
10
|
export * from './mixins/EventBindingsMixin';
|
package/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var T = (e) => {
|
|
3
|
+
throw TypeError(e);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var u = (
|
|
8
|
-
const
|
|
5
|
+
var N = (e, t, n) => t in e ? $(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
|
+
var l = (e, t, n) => N(e, typeof t != "symbol" ? t + "" : t, n), L = (e, t, n) => t.has(e) || T("Cannot " + n);
|
|
7
|
+
var u = (e, t, n) => (L(e, t, "read from private field"), n ? n.call(e) : t.get(e)), h = (e, t, n) => t.has(e) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), w = (e, t, n, i) => (L(e, t, "write to private field"), i ? i.call(e, n) : t.set(e, n), n), y = (e, t, n) => (L(e, t, "access private method"), n);
|
|
8
|
+
const k = [
|
|
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
|
+
], x = k.reduce(
|
|
16
|
+
(e, t) => (e[t.name] = t.minWidth, e),
|
|
17
17
|
{}
|
|
18
18
|
);
|
|
19
|
-
function
|
|
20
|
-
if (!(
|
|
21
|
-
throw new Error(`Unknown breakpoint: ${
|
|
22
|
-
return
|
|
19
|
+
function E(e) {
|
|
20
|
+
if (!(e in x))
|
|
21
|
+
throw new Error(`Unknown breakpoint: ${e}`);
|
|
22
|
+
return x[e];
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
for (let
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
24
|
+
function B(e) {
|
|
25
|
+
e === void 0 && (e = window.innerWidth);
|
|
26
|
+
for (let t = k.length - 1; t >= 0; t--)
|
|
27
|
+
if (e >= k[t].minWidth)
|
|
28
|
+
return k[t].name;
|
|
29
29
|
return "xs";
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function H(e, t = {}, 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(e);
|
|
34
|
+
for (const r in t)
|
|
35
|
+
t[r] !== null && t[r] !== void 0 && i.setAttribute(r, t[r] !== !0 ? t[r] : "");
|
|
36
|
+
for (const r of n)
|
|
37
|
+
i.append(typeof r == "string" ? document.createTextNode(r) : r);
|
|
38
38
|
return i;
|
|
39
39
|
}
|
|
40
40
|
class M {
|
|
@@ -43,97 +43,97 @@ class M {
|
|
|
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
|
-
|
|
50
|
-
this.delay =
|
|
46
|
+
constructor(t, n = !1) {
|
|
47
|
+
l(this, "timeout", null);
|
|
48
|
+
l(this, "startTimeWithMs", 0);
|
|
49
|
+
l(this, "maxTimeout", null);
|
|
50
|
+
this.delay = t, 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((t) => {
|
|
54
54
|
this.timeout = setTimeout(() => {
|
|
55
|
-
this.startTimeWithMs = 0,
|
|
55
|
+
this.startTimeWithMs = 0, t(!0);
|
|
56
56
|
}, this.delay);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
debounce(
|
|
59
|
+
debounce(t) {
|
|
60
60
|
const n = Date.now();
|
|
61
61
|
this.startTimeWithMs === 0 && (this.startTimeWithMs = n);
|
|
62
62
|
const i = () => {
|
|
63
|
-
this.timeout && (clearTimeout(this.timeout), this.timeout = null), this.maxTimeout && (clearTimeout(this.maxTimeout), this.maxTimeout = null), this.startTimeWithMs = 0,
|
|
63
|
+
this.timeout && (clearTimeout(this.timeout), this.timeout = null), this.maxTimeout && (clearTimeout(this.maxTimeout), this.maxTimeout = null), this.startTimeWithMs = 0, t();
|
|
64
64
|
};
|
|
65
65
|
if (this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(i, this.delay), this.max_delay !== !1 && !this.maxTimeout) {
|
|
66
|
-
const
|
|
66
|
+
const r = n - this.startTimeWithMs, a = Math.max(0, this.max_delay - r);
|
|
67
67
|
this.maxTimeout = setTimeout(i, a);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function G(e, t = !1) {
|
|
72
72
|
const n = /* @__PURE__ */ new WeakMap();
|
|
73
|
-
return function(i,
|
|
74
|
-
if (
|
|
75
|
-
const a =
|
|
76
|
-
return function(...
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
-
let o =
|
|
80
|
-
o || (o = new M(
|
|
73
|
+
return function(i, r) {
|
|
74
|
+
if (r.kind !== "method") return i;
|
|
75
|
+
const a = r.name;
|
|
76
|
+
return function(...c) {
|
|
77
|
+
let s = n.get(this);
|
|
78
|
+
s || (s = /* @__PURE__ */ new Map(), n.set(this, s));
|
|
79
|
+
let o = s.get(a);
|
|
80
|
+
o || (o = new M(e, t), s.set(a, o)), o.debounce(() => i.apply(this, c));
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
if (typeof
|
|
84
|
+
function J(e) {
|
|
85
|
+
if (typeof e.lineNumber == "number")
|
|
86
86
|
return {
|
|
87
|
-
file:
|
|
88
|
-
line:
|
|
89
|
-
column:
|
|
87
|
+
file: e.fileName || e.sourceURL,
|
|
88
|
+
line: e.lineNumber,
|
|
89
|
+
column: e.columnNumber ?? void 0
|
|
90
90
|
};
|
|
91
|
-
if (typeof
|
|
91
|
+
if (typeof e.line == "number")
|
|
92
92
|
return {
|
|
93
|
-
file:
|
|
94
|
-
line:
|
|
95
|
-
column:
|
|
93
|
+
file: e.sourceURL,
|
|
94
|
+
line: e.line,
|
|
95
|
+
column: e.column
|
|
96
96
|
};
|
|
97
|
-
const n = String(
|
|
97
|
+
const n = String(e.stack || e.message || "").split(`
|
|
98
98
|
`), i = /(.*?)(?:\(|@)?(.*?):(\d+):(\d+)\)?$/;
|
|
99
|
-
for (const
|
|
100
|
-
const a =
|
|
99
|
+
for (const r of n) {
|
|
100
|
+
const a = r.match(i);
|
|
101
101
|
if (a)
|
|
102
102
|
return { file: a[2], line: +a[3], column: +a[4] };
|
|
103
103
|
}
|
|
104
|
-
return { file:
|
|
104
|
+
return { file: e.fileName || e.sourceURL };
|
|
105
105
|
}
|
|
106
|
-
class
|
|
107
|
-
constructor(
|
|
108
|
-
this._debug =
|
|
106
|
+
class R {
|
|
107
|
+
constructor(t, n, i = "main") {
|
|
108
|
+
this._debug = t, this.myElementId = n, this.instanceId = i;
|
|
109
109
|
}
|
|
110
|
-
log(...
|
|
111
|
-
this._debug && console.log(`[LOG][ID:${this.myElementId}:${this.instanceId}]`, ...
|
|
110
|
+
log(...t) {
|
|
111
|
+
this._debug && console.log(`[LOG][ID:${this.myElementId}:${this.instanceId}]`, ...t);
|
|
112
112
|
}
|
|
113
|
-
warn(...
|
|
114
|
-
console.warn(`[WARN][ID:${this.myElementId}:${this.instanceId}]`, ...
|
|
113
|
+
warn(...t) {
|
|
114
|
+
console.warn(`[WARN][ID:${this.myElementId}:${this.instanceId}]`, ...t);
|
|
115
115
|
}
|
|
116
|
-
error(...
|
|
117
|
-
console.error(`[ERROR][ID:${this.myElementId}:${this.instanceId}]`, ...
|
|
116
|
+
error(...t) {
|
|
117
|
+
console.error(`[ERROR][ID:${this.myElementId}:${this.instanceId}]`, ...t);
|
|
118
118
|
}
|
|
119
|
-
throwError(...
|
|
120
|
-
const n = `[ERROR][ID:${this.myElementId}:${this.instanceId}] ${
|
|
121
|
-
throw this.error(...
|
|
119
|
+
throwError(...t) {
|
|
120
|
+
const n = `[ERROR][ID:${this.myElementId}:${this.instanceId}] ${t.join(" ")}`;
|
|
121
|
+
throw this.error(...t), new Error(n);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
125
|
-
constructor(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.label =
|
|
124
|
+
class q {
|
|
125
|
+
constructor(t, 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 = t, this.enabled = n, this.startTime = this.last = performance.now(), this.running = !0;
|
|
132
132
|
}
|
|
133
|
-
lap(
|
|
133
|
+
lap(t = "") {
|
|
134
134
|
if (!this.enabled) return;
|
|
135
135
|
const n = performance.now(), i = (n - this.last) / 1e3;
|
|
136
|
-
this.last = n, console.debug(`[${this.label}] ${
|
|
136
|
+
this.last = n, console.debug(`[${this.label}] ${t} +${i.toFixed(3)}s`);
|
|
137
137
|
}
|
|
138
138
|
elapsed() {
|
|
139
139
|
return performance.now() - this.startTime;
|
|
@@ -151,122 +151,227 @@ class V {
|
|
|
151
151
|
return this.running;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
function O(e) {
|
|
155
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
156
|
+
}
|
|
157
|
+
function U(e) {
|
|
158
|
+
if (e != null)
|
|
159
|
+
try {
|
|
160
|
+
return JSON.parse(e);
|
|
161
|
+
} catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function p(e) {
|
|
166
|
+
const t = JSON.stringify(e);
|
|
167
|
+
return t === void 0 ? "null" : t;
|
|
168
|
+
}
|
|
169
|
+
function K(e, t) {
|
|
170
|
+
const n = { ...t };
|
|
171
|
+
if (O(e))
|
|
172
|
+
for (const i of Object.keys(t))
|
|
173
|
+
i in e && (n[i] = e[i]);
|
|
174
|
+
return n;
|
|
175
|
+
}
|
|
176
|
+
class P {
|
|
177
|
+
constructor(t, n, i) {
|
|
178
|
+
l(this, "cache");
|
|
179
|
+
this.backend = t, this.storageKey = n, this.initialValue = i;
|
|
180
|
+
}
|
|
181
|
+
read() {
|
|
182
|
+
if (this.cache) return this.cache;
|
|
183
|
+
const t = this.backend ? U(this.backend.getItem(this.storageKey)) : void 0, n = K(t, this.initialValue);
|
|
184
|
+
if (this.backend && this.backend.getItem(this.storageKey) == null)
|
|
185
|
+
try {
|
|
186
|
+
this.backend.setItem(this.storageKey, p(n));
|
|
187
|
+
} catch {
|
|
188
|
+
}
|
|
189
|
+
return this.cache = n, n;
|
|
190
|
+
}
|
|
191
|
+
write(t) {
|
|
192
|
+
if (this.cache = t, !!this.backend)
|
|
193
|
+
try {
|
|
194
|
+
this.backend.setItem(this.storageKey, p(t));
|
|
195
|
+
} catch {
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
asProxy() {
|
|
199
|
+
const t = {
|
|
200
|
+
get: (n, i) => {
|
|
201
|
+
if (typeof i == "symbol")
|
|
202
|
+
return i === Symbol.toStringTag ? "Storage" : void 0;
|
|
203
|
+
const r = this.read();
|
|
204
|
+
return i === "toJSON" ? () => ({ ...r }) : r[i];
|
|
205
|
+
},
|
|
206
|
+
set: (n, i, r) => {
|
|
207
|
+
if (typeof i != "string") return !1;
|
|
208
|
+
const c = { ...this.read() };
|
|
209
|
+
return c[i] = r, this.write(c), !0;
|
|
210
|
+
},
|
|
211
|
+
deleteProperty: (n, i) => {
|
|
212
|
+
if (typeof i != "string") return !1;
|
|
213
|
+
const r = this.read();
|
|
214
|
+
if (!(i in r)) return !0;
|
|
215
|
+
const a = { ...r };
|
|
216
|
+
return delete a[i], this.write(a), !0;
|
|
217
|
+
},
|
|
218
|
+
has: (n, i) => {
|
|
219
|
+
if (typeof i != "string") return !1;
|
|
220
|
+
const r = this.read();
|
|
221
|
+
return i in r;
|
|
222
|
+
},
|
|
223
|
+
ownKeys: () => {
|
|
224
|
+
const n = this.read();
|
|
225
|
+
return Reflect.ownKeys(n);
|
|
226
|
+
},
|
|
227
|
+
getOwnPropertyDescriptor: (n, i) => {
|
|
228
|
+
if (typeof i != "string") return;
|
|
229
|
+
const r = this.read();
|
|
230
|
+
if (i in r)
|
|
231
|
+
return {
|
|
232
|
+
enumerable: !0,
|
|
233
|
+
configurable: !0,
|
|
234
|
+
writable: !0,
|
|
235
|
+
value: r[i]
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
return new Proxy({}, t);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function I(e) {
|
|
243
|
+
const t = globalThis.window;
|
|
244
|
+
return (e === "session" ? t == null ? void 0 : t.sessionStorage : t == null ? void 0 : t.localStorage) ?? void 0;
|
|
245
|
+
}
|
|
246
|
+
function X(e, t) {
|
|
247
|
+
return new P(I("session"), e, t).asProxy();
|
|
248
|
+
}
|
|
249
|
+
function Q(e, t) {
|
|
250
|
+
return new P(I("local"), e, t).asProxy();
|
|
251
|
+
}
|
|
252
|
+
function Y(e, t, n) {
|
|
253
|
+
return new Promise((i, r) => {
|
|
254
|
+
const a = (c) => {
|
|
255
|
+
e.removeEventListener(t, a, n), i(c);
|
|
158
256
|
};
|
|
159
|
-
|
|
257
|
+
e.addEventListener(t, a, n);
|
|
160
258
|
});
|
|
161
259
|
}
|
|
162
|
-
function
|
|
163
|
-
return document.readyState === "loading" ? new Promise((
|
|
164
|
-
document.addEventListener("DOMContentLoaded", () =>
|
|
260
|
+
function z() {
|
|
261
|
+
return document.readyState === "loading" ? new Promise((e) => {
|
|
262
|
+
document.addEventListener("DOMContentLoaded", () => e());
|
|
165
263
|
}) : Promise.resolve();
|
|
166
264
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
}) :
|
|
265
|
+
function Z(e = window) {
|
|
266
|
+
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) => {
|
|
267
|
+
e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => n(new Error("image error")), { once: !0 });
|
|
268
|
+
}) : 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 }));
|
|
171
269
|
}
|
|
172
|
-
function
|
|
173
|
-
return new Promise((
|
|
270
|
+
function tt(e) {
|
|
271
|
+
return new Promise((t) => setTimeout(t, e));
|
|
174
272
|
}
|
|
175
|
-
function
|
|
176
|
-
return new Promise((
|
|
273
|
+
function et(e) {
|
|
274
|
+
return new Promise((t) => {
|
|
177
275
|
const n = (i) => {
|
|
178
|
-
|
|
276
|
+
e.removeEventListener("animationend", n), t(i);
|
|
179
277
|
};
|
|
180
|
-
|
|
278
|
+
e.addEventListener("animationend", n);
|
|
181
279
|
});
|
|
182
280
|
}
|
|
183
|
-
function
|
|
281
|
+
function nt(e) {
|
|
184
282
|
var n, i;
|
|
185
|
-
class
|
|
283
|
+
class t extends e {
|
|
186
284
|
constructor() {
|
|
187
285
|
super(...arguments);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
286
|
+
h(this, n, new M(200, 5e3));
|
|
287
|
+
l(this, "currentBreakPoint", null);
|
|
288
|
+
h(this, i, async () => {
|
|
191
289
|
var b;
|
|
192
|
-
await u(this, n).wait(), await
|
|
193
|
-
const
|
|
290
|
+
await u(this, n).wait(), await z();
|
|
291
|
+
const c = this, s = window.innerWidth;
|
|
292
|
+
let o = getComputedStyle(c).getPropertyValue("--breakpoint");
|
|
194
293
|
if (!o || o === "")
|
|
195
294
|
return;
|
|
196
|
-
|
|
197
|
-
|
|
295
|
+
o = o.trim().replace(/^['"]|['"]$/g, "");
|
|
296
|
+
const d = o.split(","), m = d[0].trim(), f = ((b = d[1]) == null ? void 0 : b.trim()) ?? m, g = B(s);
|
|
297
|
+
this.currentBreakPoint !== g && (E(f) <= E(g) ? c.setAttribute("mode", "desktop") : E(m) > E(g) ? c.setAttribute("mode", "mobile") : c.setAttribute("mode", "tablet"));
|
|
198
298
|
});
|
|
199
299
|
}
|
|
200
300
|
connectedCallback() {
|
|
201
|
-
super.connectedCallback()
|
|
301
|
+
super.connectedCallback();
|
|
302
|
+
try {
|
|
303
|
+
u(this, i).call(this), window.addEventListener("resize", u(this, i)), u(this, i).call(this);
|
|
304
|
+
} catch (c) {
|
|
305
|
+
throw console.error("Error in BreakPointMixin:", c, "in element", this), c;
|
|
306
|
+
}
|
|
202
307
|
}
|
|
203
308
|
disconnectedCallback() {
|
|
204
309
|
super.disconnectedCallback(), window.removeEventListener("resize", u(this, i));
|
|
205
310
|
}
|
|
206
311
|
}
|
|
207
|
-
return n = new WeakMap(), i = new WeakMap(),
|
|
312
|
+
return n = new WeakMap(), i = new WeakMap(), t;
|
|
208
313
|
}
|
|
209
|
-
const
|
|
210
|
-
function
|
|
211
|
-
const n = Array.isArray(
|
|
212
|
-
return function(i,
|
|
213
|
-
if (
|
|
214
|
-
return
|
|
314
|
+
const v = Symbol("listenerDefs"), A = Symbol("withEventBindings");
|
|
315
|
+
function it(e, t) {
|
|
316
|
+
const n = Array.isArray(e) ? e : [e];
|
|
317
|
+
return function(i, r) {
|
|
318
|
+
if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
|
|
319
|
+
return r.addInitializer(function() {
|
|
215
320
|
const a = this.constructor;
|
|
216
|
-
(a[
|
|
217
|
-
method:
|
|
321
|
+
(a[v] || (a[v] = [])).push({
|
|
322
|
+
method: r.name,
|
|
218
323
|
events: n,
|
|
219
|
-
opts:
|
|
324
|
+
opts: t
|
|
220
325
|
});
|
|
221
326
|
}), function(...a) {
|
|
222
|
-
if (!this[
|
|
327
|
+
if (!this[A])
|
|
223
328
|
throw new Error("[EventBindings] @Listen - decorator requires EventBindingMixin.");
|
|
224
329
|
return i.apply(this, a);
|
|
225
330
|
};
|
|
226
331
|
};
|
|
227
332
|
}
|
|
228
|
-
function
|
|
333
|
+
function F(e, t) {
|
|
229
334
|
var n;
|
|
230
|
-
return !
|
|
335
|
+
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;
|
|
231
336
|
}
|
|
232
|
-
function
|
|
233
|
-
var n, i,
|
|
234
|
-
class
|
|
235
|
-
constructor(...
|
|
236
|
-
super(...
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
this[
|
|
337
|
+
function rt(e) {
|
|
338
|
+
var n, i, W;
|
|
339
|
+
class t extends e {
|
|
340
|
+
constructor(...s) {
|
|
341
|
+
super(...s);
|
|
342
|
+
h(this, i);
|
|
343
|
+
h(this, n);
|
|
344
|
+
this[A] = !0;
|
|
240
345
|
}
|
|
241
346
|
connectedCallback() {
|
|
242
|
-
var
|
|
243
|
-
(
|
|
347
|
+
var s;
|
|
348
|
+
(s = super.connectedCallback) == null || s.call(this), y(this, i, W).call(this);
|
|
244
349
|
}
|
|
245
350
|
disconnectedCallback() {
|
|
246
|
-
var
|
|
247
|
-
(
|
|
351
|
+
var s, o;
|
|
352
|
+
(s = u(this, n)) == null || s.abort(), (o = super.disconnectedCallback) == null || o.call(this);
|
|
248
353
|
}
|
|
249
354
|
}
|
|
250
|
-
return n = new WeakMap(), i = new WeakSet(),
|
|
251
|
-
var o, d,
|
|
355
|
+
return n = new WeakMap(), i = new WeakSet(), W = function() {
|
|
356
|
+
var o, d, m;
|
|
252
357
|
(o = u(this, n)) == null || o.abort(), w(this, n, new AbortController());
|
|
253
|
-
const
|
|
254
|
-
for (const f of
|
|
255
|
-
const g =
|
|
256
|
-
for (const
|
|
257
|
-
g.addEventListener(
|
|
358
|
+
const s = this.constructor[v] || [];
|
|
359
|
+
for (const f of s) {
|
|
360
|
+
const g = F(this, (d = f.opts) == null ? void 0 : d.target), b = ((m = f.opts) == null ? void 0 : m.options) ?? {}, C = this[f.method].bind(this);
|
|
361
|
+
for (const D of f.events)
|
|
362
|
+
g.addEventListener(D, C, { ...b, signal: u(this, n).signal });
|
|
258
363
|
}
|
|
259
|
-
},
|
|
364
|
+
}, t;
|
|
260
365
|
}
|
|
261
|
-
let
|
|
262
|
-
function
|
|
263
|
-
var n, i,
|
|
264
|
-
class
|
|
366
|
+
let V = 1;
|
|
367
|
+
function st(e) {
|
|
368
|
+
var n, i, r;
|
|
369
|
+
class t extends e {
|
|
265
370
|
constructor() {
|
|
266
371
|
super(...arguments);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
372
|
+
h(this, n, null);
|
|
373
|
+
h(this, i, V++);
|
|
374
|
+
h(this, r, null);
|
|
270
375
|
}
|
|
271
376
|
/**
|
|
272
377
|
* Clears the cached debug flag so the attribute will be checked again
|
|
@@ -278,69 +383,71 @@ function Q(t) {
|
|
|
278
383
|
get _debug() {
|
|
279
384
|
return u(this, n) !== null ? u(this, n) : (this instanceof HTMLElement && w(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);
|
|
280
385
|
}
|
|
281
|
-
getLogger(
|
|
282
|
-
return u(this,
|
|
386
|
+
getLogger(s = "main") {
|
|
387
|
+
return u(this, r) || w(this, r, new R(this._debug, `${u(this, i)}`, s)), u(this, r);
|
|
283
388
|
}
|
|
284
|
-
log(...
|
|
285
|
-
this.getLogger().log(...
|
|
389
|
+
log(...s) {
|
|
390
|
+
this.getLogger().log(...s);
|
|
286
391
|
}
|
|
287
|
-
warn(...
|
|
288
|
-
this.getLogger().warn(...
|
|
392
|
+
warn(...s) {
|
|
393
|
+
this.getLogger().warn(...s);
|
|
289
394
|
}
|
|
290
|
-
error(...
|
|
291
|
-
this.getLogger().error(...
|
|
395
|
+
error(...s) {
|
|
396
|
+
this.getLogger().error(...s);
|
|
292
397
|
}
|
|
293
|
-
throwError(...
|
|
294
|
-
return this.getLogger().throwError(...
|
|
398
|
+
throwError(...s) {
|
|
399
|
+
return this.getLogger().throwError(...s);
|
|
295
400
|
}
|
|
296
401
|
}
|
|
297
|
-
return n = new WeakMap(), i = new WeakMap(),
|
|
402
|
+
return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
|
|
298
403
|
}
|
|
299
|
-
function
|
|
300
|
-
var n,
|
|
301
|
-
class
|
|
404
|
+
function ot(e) {
|
|
405
|
+
var n, S, r, _;
|
|
406
|
+
class t extends e {
|
|
302
407
|
constructor() {
|
|
303
408
|
super(...arguments);
|
|
304
|
-
|
|
305
|
-
|
|
409
|
+
h(this, n);
|
|
410
|
+
h(this, r, (o) => {
|
|
306
411
|
const d = o.target;
|
|
307
|
-
d.assignedNodes({ flatten: !0 }).filter((g) =>
|
|
412
|
+
d.assignedNodes({ flatten: !0 }).filter((g) => y(this, n, _).call(this, g)).length > 0 && d.classList.remove("slot-empty");
|
|
308
413
|
});
|
|
309
414
|
}
|
|
310
415
|
firstUpdated(o) {
|
|
311
416
|
var d;
|
|
312
|
-
(d = super.firstUpdated) == null || d.call(this, o),
|
|
417
|
+
(d = super.firstUpdated) == null || d.call(this, o), y(this, n, S).call(this);
|
|
313
418
|
}
|
|
314
419
|
}
|
|
315
|
-
return n = new WeakSet(),
|
|
420
|
+
return n = new WeakSet(), S = function() {
|
|
316
421
|
var d;
|
|
317
422
|
const o = (d = this.shadowRoot) == null ? void 0 : d.querySelectorAll("slot");
|
|
318
|
-
o == null || o.forEach((
|
|
319
|
-
|
|
423
|
+
o == null || o.forEach((m) => {
|
|
424
|
+
m.classList.add("slot-empty"), m.addEventListener("slotchange", (f) => u(this, r).call(this, f));
|
|
320
425
|
});
|
|
321
|
-
},
|
|
426
|
+
}, r = new WeakMap(), _ = function(o) {
|
|
322
427
|
return o.nodeType === Node.TEXT_NODE ? (o.textContent || "").trim().length > 0 : o.nodeType === Node.ELEMENT_NODE;
|
|
323
|
-
},
|
|
428
|
+
}, t;
|
|
324
429
|
}
|
|
325
430
|
export {
|
|
326
|
-
|
|
431
|
+
nt as BreakPointMixin,
|
|
327
432
|
M as Debouncer,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
433
|
+
rt as EventBindingsMixin,
|
|
434
|
+
it as Listen,
|
|
435
|
+
R as Logger,
|
|
436
|
+
st as LoggingMixin,
|
|
437
|
+
ot as SlotVisibilityMixin,
|
|
438
|
+
q as Stopwatch,
|
|
439
|
+
x as breakpointMap,
|
|
440
|
+
k as breakpoints,
|
|
441
|
+
H as create_element,
|
|
442
|
+
G as debounce,
|
|
443
|
+
E as getBreakpointMinWidth,
|
|
444
|
+
B as getCurrentBreakpoint,
|
|
445
|
+
J as getErrorLocation,
|
|
446
|
+
Q as local_storage,
|
|
447
|
+
X as session_storage,
|
|
448
|
+
tt as sleep,
|
|
449
|
+
Y as waitFor,
|
|
450
|
+
et as waitForAnimationEnd,
|
|
451
|
+
z as waitForDomContentLoaded,
|
|
452
|
+
Z as waitForLoad
|
|
346
453
|
};
|
package/lib/storage.d.ts
ADDED