@trunkjs/browser-utils 1.0.50 → 1.0.52
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 +3 -2
- package/CHANGELOG.md +26 -0
- package/README.md +20 -0
- package/index.d.ts +1 -0
- package/index.js +413 -245
- package/lib/FormDataAccessor.d.ts +26 -0
- package/package.json +1 -1
- package/skills/browser-utils-usage/SKILL.md +35 -0
- package/skills/browser-utils-usage/references/custom-elements-and-mixins.md +175 -0
- package/skills/browser-utils-usage/references/helpers-and-storage.md +159 -0
- package/skills/form-data-accessor-usage/SKILL.md +50 -0
package/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var S = (n) => {
|
|
3
|
+
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var l = (
|
|
8
|
-
const
|
|
5
|
+
var j = (n, t, e) => t in n ? O(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
6
|
+
var f = (n, t, e) => j(n, typeof t != "symbol" ? t + "" : t, e), T = (n, t, e) => t.has(n) || S("Cannot " + e);
|
|
7
|
+
var l = (n, t, e) => (T(n, t, "read from private field"), e ? e.call(n) : t.get(n)), m = (n, t, e) => t.has(n) ? S("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), y = (n, t, e, i) => (T(n, t, "write to private field"), i ? i.call(n, e) : t.set(n, e), e), w = (n, t, e) => (T(n, t, "access private method"), e);
|
|
8
|
+
const E = [
|
|
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
|
+
], _ = E.reduce(
|
|
16
|
+
(n, t) => (n[t.name] = t.minWidth, n),
|
|
17
17
|
{}
|
|
18
18
|
);
|
|
19
|
-
function
|
|
20
|
-
if (!(
|
|
21
|
-
throw new Error(`Unknown breakpoint: ${
|
|
22
|
-
return
|
|
19
|
+
function p(n) {
|
|
20
|
+
if (!(n in _))
|
|
21
|
+
throw new Error(`Unknown breakpoint: ${n}`);
|
|
22
|
+
return _[n];
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function F() {
|
|
25
25
|
return window.visualViewport ? window.visualViewport.width : window.innerWidth;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
for (let t =
|
|
30
|
-
if (
|
|
31
|
-
return
|
|
27
|
+
function U(n) {
|
|
28
|
+
n === void 0 && (n = F());
|
|
29
|
+
for (let t = E.length - 1; t >= 0; t--)
|
|
30
|
+
if (n >= E[t].minWidth)
|
|
31
|
+
return E[t].name;
|
|
32
32
|
return "xs";
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
Array.isArray(
|
|
36
|
-
const i = document.createElement(
|
|
34
|
+
function nt(n, t = {}, e = []) {
|
|
35
|
+
Array.isArray(e) || (e = [e]);
|
|
36
|
+
const i = document.createElement(n);
|
|
37
37
|
for (const r in t)
|
|
38
38
|
t[r] !== null && t[r] !== void 0 && i.setAttribute(r, t[r] !== !0 ? t[r] : "");
|
|
39
|
-
for (const r of
|
|
39
|
+
for (const r of e)
|
|
40
40
|
i.append(typeof r == "string" ? document.createTextNode(r) : r);
|
|
41
41
|
return i;
|
|
42
42
|
}
|
|
@@ -46,11 +46,11 @@ class C {
|
|
|
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
|
-
constructor(t,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.delay = t, this.max_delay =
|
|
49
|
+
constructor(t, e = !1) {
|
|
50
|
+
f(this, "timeout", null);
|
|
51
|
+
f(this, "startTimeWithMs", 0);
|
|
52
|
+
f(this, "maxTimeout", null);
|
|
53
|
+
this.delay = t, this.max_delay = e;
|
|
54
54
|
}
|
|
55
55
|
async wait() {
|
|
56
56
|
return this.startTimeWithMs === 0 && (this.startTimeWithMs = Date.now()), this.timeout && (this.max_delay === !1 || this.startTimeWithMs + this.max_delay > Date.now()) && (clearTimeout(this.timeout), this.timeout = null), new Promise((t) => {
|
|
@@ -64,55 +64,222 @@ class C {
|
|
|
64
64
|
* @param callback
|
|
65
65
|
*/
|
|
66
66
|
debounce(t) {
|
|
67
|
-
const
|
|
68
|
-
this.startTimeWithMs === 0 && (this.startTimeWithMs =
|
|
67
|
+
const e = Date.now();
|
|
68
|
+
this.startTimeWithMs === 0 && (this.startTimeWithMs = e);
|
|
69
69
|
const i = () => {
|
|
70
70
|
this.timeout && (clearTimeout(this.timeout), this.timeout = null), this.maxTimeout && (clearTimeout(this.maxTimeout), this.maxTimeout = null), this.startTimeWithMs = 0, t();
|
|
71
71
|
};
|
|
72
72
|
if (this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(i, this.delay), this.max_delay !== !1 && !this.maxTimeout) {
|
|
73
|
-
const r =
|
|
74
|
-
this.maxTimeout = setTimeout(i,
|
|
73
|
+
const r = e - this.startTimeWithMs, s = Math.max(0, this.max_delay - r);
|
|
74
|
+
this.maxTimeout = setTimeout(i, s);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
78
|
+
function it(n, t = !1) {
|
|
79
|
+
const e = /* @__PURE__ */ new WeakMap();
|
|
80
80
|
return function(i, r) {
|
|
81
81
|
if (r.kind !== "method") return i;
|
|
82
|
-
const
|
|
83
|
-
return function(...
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
let
|
|
87
|
-
|
|
82
|
+
const s = r.name;
|
|
83
|
+
return function(...a) {
|
|
84
|
+
let o = e.get(this);
|
|
85
|
+
o || (o = /* @__PURE__ */ new Map(), e.set(this, o));
|
|
86
|
+
let u = o.get(s);
|
|
87
|
+
u || (u = new C(n, t), o.set(s, u)), u.debounce(() => i.apply(this, a));
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const H = /* @__PURE__ */ new Set(["button", "image", "reset", "submit"]);
|
|
92
|
+
function z(n) {
|
|
93
|
+
return n.endsWith("[]") ? n.slice(0, -2) : n;
|
|
94
|
+
}
|
|
95
|
+
function L(n) {
|
|
96
|
+
return n instanceof HTMLInputElement ? n.type.toLowerCase() : "";
|
|
97
|
+
}
|
|
98
|
+
function G(n) {
|
|
99
|
+
if (n instanceof HTMLSelectElement && n.multiple)
|
|
100
|
+
return Array.from(n.selectedOptions, (t) => t.value);
|
|
101
|
+
if (n instanceof HTMLInputElement) {
|
|
102
|
+
if (n.type === "file")
|
|
103
|
+
return Array.from(n.files ?? []);
|
|
104
|
+
if (n.type === "checkbox")
|
|
105
|
+
return n.checked;
|
|
106
|
+
if (n.type === "radio")
|
|
107
|
+
return n.checked ? n.value : void 0;
|
|
108
|
+
}
|
|
109
|
+
return n.value;
|
|
110
|
+
}
|
|
111
|
+
function K(n, t) {
|
|
112
|
+
if (n instanceof HTMLSelectElement && n.multiple) {
|
|
113
|
+
const e = new Set(Array.isArray(t) ? t.map(String) : t == null ? [] : [String(t)]);
|
|
114
|
+
for (const i of Array.from(n.options))
|
|
115
|
+
i.selected = e.has(i.value);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (n instanceof HTMLInputElement) {
|
|
119
|
+
if (n.type === "file") {
|
|
120
|
+
(t == null || Array.isArray(t) && t.length === 0) && (n.value = "");
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (n.type === "checkbox") {
|
|
124
|
+
n.checked = !!t;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (n.type === "radio") {
|
|
128
|
+
n.checked = typeof t == "boolean" ? t : n.value === String(t);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
n.value = t;
|
|
133
|
+
}
|
|
134
|
+
function A(n, t, e) {
|
|
135
|
+
if (!(e == null || e === !1)) {
|
|
136
|
+
if (e instanceof FormData) {
|
|
137
|
+
e.forEach((i, r) => n.append(r, i));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(e)) {
|
|
141
|
+
e.forEach((i) => A(n, t, i));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (e instanceof Blob) {
|
|
145
|
+
n.append(t, e);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
n.append(t, String(e));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
class rt {
|
|
152
|
+
constructor(t) {
|
|
153
|
+
this.root = t;
|
|
154
|
+
}
|
|
155
|
+
get entries() {
|
|
156
|
+
const t = [];
|
|
157
|
+
for (const e of Array.from(this.root.querySelectorAll("[name]"))) {
|
|
158
|
+
const i = this.getName(e);
|
|
159
|
+
!i || !this.isValueElement(e) || t.push({
|
|
160
|
+
name: i,
|
|
161
|
+
element: e,
|
|
162
|
+
get value() {
|
|
163
|
+
return G(e);
|
|
164
|
+
},
|
|
165
|
+
set value(r) {
|
|
166
|
+
K(e, r);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return t;
|
|
171
|
+
}
|
|
172
|
+
get data() {
|
|
173
|
+
const t = {};
|
|
174
|
+
for (const [e, i] of this.groupedEntries) {
|
|
175
|
+
const r = this.readGroup(i);
|
|
176
|
+
r !== void 0 && (t[e] = r);
|
|
177
|
+
}
|
|
178
|
+
return t;
|
|
179
|
+
}
|
|
180
|
+
set data(t) {
|
|
181
|
+
for (const [e, i] of this.groupedEntries)
|
|
182
|
+
Object.prototype.hasOwnProperty.call(t, e) && this.writeGroup(i, t[e]);
|
|
183
|
+
}
|
|
184
|
+
get formData() {
|
|
185
|
+
const t = new FormData();
|
|
186
|
+
for (const e of this.entries) {
|
|
187
|
+
if (this.isDisabled(e.element))
|
|
188
|
+
continue;
|
|
189
|
+
const i = L(e.element);
|
|
190
|
+
if (i === "checkbox" || i === "radio") {
|
|
191
|
+
const r = e.element;
|
|
192
|
+
r.checked && A(t, e.name, r.value);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
A(t, e.name, e.value);
|
|
196
|
+
}
|
|
197
|
+
return t;
|
|
198
|
+
}
|
|
199
|
+
get groupedEntries() {
|
|
200
|
+
const t = /* @__PURE__ */ new Map();
|
|
201
|
+
for (const e of this.entries) {
|
|
202
|
+
const i = z(e.name), r = t.get(i) ?? [];
|
|
203
|
+
r.push(e), t.set(i, r);
|
|
204
|
+
}
|
|
205
|
+
return t;
|
|
206
|
+
}
|
|
207
|
+
getName(t) {
|
|
208
|
+
var i;
|
|
209
|
+
const e = "name" in t && typeof t.name == "string" ? t.name : null;
|
|
210
|
+
return (e == null ? void 0 : e.trim()) || ((i = t.getAttribute("name")) == null ? void 0 : i.trim()) || null;
|
|
211
|
+
}
|
|
212
|
+
isValueElement(t) {
|
|
213
|
+
return !("value" in t) || t instanceof HTMLButtonElement ? !1 : !(t instanceof HTMLInputElement && H.has(t.type.toLowerCase()));
|
|
214
|
+
}
|
|
215
|
+
isDisabled(t) {
|
|
216
|
+
return !!t.disabled || t.hasAttribute("disabled") || t.matches(":disabled");
|
|
217
|
+
}
|
|
218
|
+
readGroup(t) {
|
|
219
|
+
var r;
|
|
220
|
+
const e = new Set(t.map((s) => L(s.element))), i = t.some((s) => s.name.endsWith("[]"));
|
|
221
|
+
return e.size === 1 && e.has("radio") ? (r = t.find((s) => s.element.checked)) == null ? void 0 : r.element.value : e.size === 1 && e.has("checkbox") ? t.length === 1 && !i ? t[0].element.checked : t.filter((s) => s.element.checked).map((s) => s.element.value) : i ? t.flatMap((s) => {
|
|
222
|
+
const a = s.value;
|
|
223
|
+
return a === void 0 ? [] : Array.isArray(a) ? a : [a];
|
|
224
|
+
}) : t.length === 1 ? t[0].value : t.map((s) => s.value).at(-1);
|
|
225
|
+
}
|
|
226
|
+
writeGroup(t, e) {
|
|
227
|
+
const i = new Set(t.map((s) => L(s.element))), r = t.some((s) => s.name.endsWith("[]"));
|
|
228
|
+
if (i.size === 1 && i.has("radio")) {
|
|
229
|
+
t.forEach((s) => {
|
|
230
|
+
const a = s.element;
|
|
231
|
+
a.checked = a.value === String(e);
|
|
232
|
+
});
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (i.size === 1 && i.has("checkbox")) {
|
|
236
|
+
if (t.length === 1 && !r && typeof e == "boolean") {
|
|
237
|
+
t[0].element.checked = e;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const s = new Set((Array.isArray(e) ? e : e == null ? [] : [e]).map(String));
|
|
241
|
+
t.forEach((a) => {
|
|
242
|
+
const o = a.element;
|
|
243
|
+
o.checked = s.has(o.value);
|
|
244
|
+
});
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (r && Array.isArray(e) && t.length > 1) {
|
|
248
|
+
t.forEach((s, a) => {
|
|
249
|
+
s.value = e[a];
|
|
250
|
+
});
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
t.forEach((s) => {
|
|
254
|
+
s.value = e;
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function st(n) {
|
|
259
|
+
if (typeof n.lineNumber == "number")
|
|
93
260
|
return {
|
|
94
|
-
file:
|
|
95
|
-
line:
|
|
96
|
-
column:
|
|
261
|
+
file: n.fileName || n.sourceURL,
|
|
262
|
+
line: n.lineNumber,
|
|
263
|
+
column: n.columnNumber ?? void 0
|
|
97
264
|
};
|
|
98
|
-
if (typeof
|
|
265
|
+
if (typeof n.line == "number")
|
|
99
266
|
return {
|
|
100
|
-
file:
|
|
101
|
-
line:
|
|
102
|
-
column:
|
|
267
|
+
file: n.sourceURL,
|
|
268
|
+
line: n.line,
|
|
269
|
+
column: n.column
|
|
103
270
|
};
|
|
104
|
-
const
|
|
271
|
+
const e = String(n.stack || n.message || "").split(`
|
|
105
272
|
`), i = /(.*?)(?:\(|@)?(.*?):(\d+):(\d+)\)?$/;
|
|
106
|
-
for (const r of
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
return { file:
|
|
273
|
+
for (const r of e) {
|
|
274
|
+
const s = r.match(i);
|
|
275
|
+
if (s)
|
|
276
|
+
return { file: s[2], line: +s[3], column: +s[4] };
|
|
110
277
|
}
|
|
111
|
-
return { file:
|
|
278
|
+
return { file: n.fileName || n.sourceURL };
|
|
112
279
|
}
|
|
113
|
-
class
|
|
114
|
-
constructor(t,
|
|
115
|
-
this._debug = t, this.myTag =
|
|
280
|
+
class q {
|
|
281
|
+
constructor(t, e, i, r = "main") {
|
|
282
|
+
this._debug = t, this.myTag = e, this.myElementId = i, this.instanceId = r;
|
|
116
283
|
}
|
|
117
284
|
debug(...t) {
|
|
118
285
|
this._debug && console.debug(`[DEBUG][${this.myTag}:${this.myElementId}:${this.instanceId}]`, ...t);
|
|
@@ -127,23 +294,23 @@ class V {
|
|
|
127
294
|
console.error(`[ERROR][${this.myTag}:${this.myElementId}:${this.instanceId}]`, ...t);
|
|
128
295
|
}
|
|
129
296
|
throwError(...t) {
|
|
130
|
-
const
|
|
131
|
-
throw this.error(...t), new Error(
|
|
297
|
+
const e = `[ERROR][${this.myTag}:${this.myElementId}:${this.instanceId}] ${t.join(" ")}`;
|
|
298
|
+
throw this.error(...t), new Error(e);
|
|
132
299
|
}
|
|
133
300
|
}
|
|
134
|
-
class
|
|
135
|
-
constructor(t,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.label = t, this.enabled =
|
|
301
|
+
class ot {
|
|
302
|
+
constructor(t, e = !0) {
|
|
303
|
+
f(this, "label");
|
|
304
|
+
f(this, "last");
|
|
305
|
+
f(this, "startTime");
|
|
306
|
+
f(this, "running", !1);
|
|
307
|
+
f(this, "enabled");
|
|
308
|
+
this.label = t, this.enabled = e, this.startTime = this.last = performance.now(), this.running = !0;
|
|
142
309
|
}
|
|
143
310
|
lap(t = "") {
|
|
144
311
|
if (!this.enabled) return;
|
|
145
|
-
const
|
|
146
|
-
this.last =
|
|
312
|
+
const e = performance.now(), i = (e - this.last) / 1e3;
|
|
313
|
+
this.last = e, console.debug(`[${this.label}] ${t} +${i.toFixed(3)}s`);
|
|
147
314
|
}
|
|
148
315
|
elapsed() {
|
|
149
316
|
return performance.now() - this.startTime;
|
|
@@ -161,42 +328,42 @@ class Z {
|
|
|
161
328
|
return this.running;
|
|
162
329
|
}
|
|
163
330
|
}
|
|
164
|
-
function
|
|
165
|
-
return typeof
|
|
331
|
+
function J(n) {
|
|
332
|
+
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
166
333
|
}
|
|
167
|
-
function
|
|
168
|
-
if (
|
|
334
|
+
function X(n) {
|
|
335
|
+
if (n != null)
|
|
169
336
|
try {
|
|
170
|
-
return JSON.parse(
|
|
337
|
+
return JSON.parse(n);
|
|
171
338
|
} catch {
|
|
172
339
|
return;
|
|
173
340
|
}
|
|
174
341
|
}
|
|
175
|
-
function P(
|
|
176
|
-
const t = JSON.stringify(
|
|
342
|
+
function P(n) {
|
|
343
|
+
const t = JSON.stringify(n);
|
|
177
344
|
return t === void 0 ? "null" : t;
|
|
178
345
|
}
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
346
|
+
function Q(n, t) {
|
|
347
|
+
const e = { ...t };
|
|
348
|
+
if (J(n))
|
|
182
349
|
for (const i of Object.keys(t))
|
|
183
|
-
i in
|
|
184
|
-
return
|
|
350
|
+
i in n && (e[i] = n[i]);
|
|
351
|
+
return e;
|
|
185
352
|
}
|
|
186
|
-
class
|
|
187
|
-
constructor(t,
|
|
188
|
-
|
|
189
|
-
this.backend = t, this.storageKey =
|
|
353
|
+
class I {
|
|
354
|
+
constructor(t, e, i) {
|
|
355
|
+
f(this, "cache");
|
|
356
|
+
this.backend = t, this.storageKey = e, this.initialValue = i;
|
|
190
357
|
}
|
|
191
358
|
read() {
|
|
192
359
|
if (this.cache) return this.cache;
|
|
193
|
-
const t = this.backend ?
|
|
360
|
+
const t = this.backend ? X(this.backend.getItem(this.storageKey)) : void 0, e = Q(t, this.initialValue);
|
|
194
361
|
if (this.backend && this.backend.getItem(this.storageKey) == null)
|
|
195
362
|
try {
|
|
196
|
-
this.backend.setItem(this.storageKey, P(
|
|
363
|
+
this.backend.setItem(this.storageKey, P(e));
|
|
197
364
|
} catch {
|
|
198
365
|
}
|
|
199
|
-
return this.cache =
|
|
366
|
+
return this.cache = e, e;
|
|
200
367
|
}
|
|
201
368
|
write(t) {
|
|
202
369
|
if (this.cache = t, !!this.backend)
|
|
@@ -207,34 +374,34 @@ class A {
|
|
|
207
374
|
}
|
|
208
375
|
asProxy() {
|
|
209
376
|
const t = {
|
|
210
|
-
get: (
|
|
377
|
+
get: (e, i) => {
|
|
211
378
|
if (typeof i == "symbol")
|
|
212
379
|
return i === Symbol.toStringTag ? "Storage" : void 0;
|
|
213
380
|
const r = this.read();
|
|
214
381
|
return i === "toJSON" ? () => ({ ...r }) : r[i];
|
|
215
382
|
},
|
|
216
|
-
set: (
|
|
383
|
+
set: (e, i, r) => {
|
|
217
384
|
if (typeof i != "string") return !1;
|
|
218
|
-
const
|
|
219
|
-
return
|
|
385
|
+
const a = { ...this.read() };
|
|
386
|
+
return a[i] = r, this.write(a), !0;
|
|
220
387
|
},
|
|
221
|
-
deleteProperty: (
|
|
388
|
+
deleteProperty: (e, i) => {
|
|
222
389
|
if (typeof i != "string") return !1;
|
|
223
390
|
const r = this.read();
|
|
224
391
|
if (!(i in r)) return !0;
|
|
225
|
-
const
|
|
226
|
-
return delete
|
|
392
|
+
const s = { ...r };
|
|
393
|
+
return delete s[i], this.write(s), !0;
|
|
227
394
|
},
|
|
228
|
-
has: (
|
|
395
|
+
has: (e, i) => {
|
|
229
396
|
if (typeof i != "string") return !1;
|
|
230
397
|
const r = this.read();
|
|
231
398
|
return i in r;
|
|
232
399
|
},
|
|
233
400
|
ownKeys: () => {
|
|
234
|
-
const
|
|
235
|
-
return Reflect.ownKeys(
|
|
401
|
+
const e = this.read();
|
|
402
|
+
return Reflect.ownKeys(e);
|
|
236
403
|
},
|
|
237
|
-
getOwnPropertyDescriptor: (
|
|
404
|
+
getOwnPropertyDescriptor: (e, i) => {
|
|
238
405
|
if (typeof i != "string") return;
|
|
239
406
|
const r = this.read();
|
|
240
407
|
if (i in r)
|
|
@@ -249,187 +416,187 @@ class A {
|
|
|
249
416
|
return new Proxy({}, t);
|
|
250
417
|
}
|
|
251
418
|
}
|
|
252
|
-
function W(
|
|
419
|
+
function W(n) {
|
|
253
420
|
const t = globalThis.window;
|
|
254
|
-
return (
|
|
421
|
+
return (n === "session" ? t == null ? void 0 : t.sessionStorage : t == null ? void 0 : t.localStorage) ?? void 0;
|
|
255
422
|
}
|
|
256
|
-
function
|
|
257
|
-
return new
|
|
423
|
+
function at(n, t) {
|
|
424
|
+
return new I(W("session"), n, t).asProxy();
|
|
258
425
|
}
|
|
259
|
-
function
|
|
260
|
-
return new
|
|
426
|
+
function ut(n, t) {
|
|
427
|
+
return new I(W("local"), n, t).asProxy();
|
|
261
428
|
}
|
|
262
|
-
function
|
|
429
|
+
function x(n, t, e) {
|
|
263
430
|
return new Promise((i, r) => {
|
|
264
|
-
const
|
|
265
|
-
|
|
431
|
+
const s = (a) => {
|
|
432
|
+
n.removeEventListener(t, s, e), i(a);
|
|
266
433
|
};
|
|
267
|
-
|
|
434
|
+
n.addEventListener(t, s, e);
|
|
268
435
|
});
|
|
269
436
|
}
|
|
270
|
-
function
|
|
271
|
-
return document.readyState === "loading" ? new Promise((
|
|
272
|
-
document.addEventListener("DOMContentLoaded", () =>
|
|
437
|
+
function Y() {
|
|
438
|
+
return document.readyState === "loading" ? new Promise((n) => {
|
|
439
|
+
document.addEventListener("DOMContentLoaded", () => n());
|
|
273
440
|
}) : Promise.resolve();
|
|
274
441
|
}
|
|
275
|
-
function
|
|
276
|
-
return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() :
|
|
442
|
+
function ct() {
|
|
443
|
+
return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() : x(window, "loader:ready") : M();
|
|
277
444
|
}
|
|
278
|
-
function
|
|
279
|
-
return window.tj_loader_state ? window.tj_loader_state === "pre-visual" || window.tj_loader_state === "visual" ? Promise.resolve() :
|
|
445
|
+
function dt() {
|
|
446
|
+
return window.tj_loader_state ? window.tj_loader_state === "pre-visual" || window.tj_loader_state === "visual" ? Promise.resolve() : x(window, "loader:pre-visual") : M();
|
|
280
447
|
}
|
|
281
|
-
function
|
|
282
|
-
return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() :
|
|
448
|
+
function lt() {
|
|
449
|
+
return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() : x(window, "loader:visual") : M();
|
|
283
450
|
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
}) :
|
|
451
|
+
function M(n = window) {
|
|
452
|
+
return n || (n = window), n === window ? document.readyState === "complete" ? Promise.resolve() : new Promise((t) => window.addEventListener("load", () => t(), { once: !0 })) : n instanceof HTMLImageElement ? n.complete && n.naturalWidth !== 0 ? Promise.resolve() : new Promise((t, e) => {
|
|
453
|
+
n.addEventListener("load", () => t(), { once: !0 }), n.addEventListener("error", () => e(new Error("image error")), { once: !0 });
|
|
454
|
+
}) : n instanceof HTMLMediaElement ? n.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA ? Promise.resolve() : new Promise((t) => n.addEventListener("loadeddata", () => t(), { once: !0 })) : new Promise((t) => n.addEventListener("load", () => t(), { once: !0 }));
|
|
288
455
|
}
|
|
289
|
-
function
|
|
290
|
-
return new Promise((t) => setTimeout(t,
|
|
456
|
+
function ht(n) {
|
|
457
|
+
return new Promise((t) => setTimeout(t, n));
|
|
291
458
|
}
|
|
292
|
-
function
|
|
459
|
+
function ft(n) {
|
|
293
460
|
return new Promise((t) => {
|
|
294
|
-
const
|
|
295
|
-
|
|
461
|
+
const e = (i) => {
|
|
462
|
+
n.removeEventListener("animationend", e), t(i);
|
|
296
463
|
};
|
|
297
|
-
|
|
464
|
+
n.addEventListener("animationend", e);
|
|
298
465
|
});
|
|
299
466
|
}
|
|
300
|
-
function
|
|
301
|
-
var
|
|
302
|
-
class t extends
|
|
467
|
+
function mt(n) {
|
|
468
|
+
var e, i;
|
|
469
|
+
class t extends n {
|
|
303
470
|
constructor() {
|
|
304
471
|
super(...arguments);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
var
|
|
309
|
-
await l(this,
|
|
310
|
-
const
|
|
311
|
-
let
|
|
312
|
-
if (!
|
|
472
|
+
m(this, e, new C(200, 5e3));
|
|
473
|
+
f(this, "currentBreakPoint", null);
|
|
474
|
+
m(this, i, async () => {
|
|
475
|
+
var b;
|
|
476
|
+
await l(this, e).wait(), await Y();
|
|
477
|
+
const a = this, o = window.innerWidth;
|
|
478
|
+
let u = getComputedStyle(a).getPropertyValue("--breakpoint");
|
|
479
|
+
if (!u || u === "")
|
|
313
480
|
return;
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
this.currentBreakPoint !== g && (
|
|
481
|
+
u = u.trim().replace(/^['"]|['"]$/g, "");
|
|
482
|
+
const c = u.split(","), d = c[0].trim(), h = ((b = c[1]) == null ? void 0 : b.trim()) ?? d, g = U(o);
|
|
483
|
+
this.currentBreakPoint !== g && (p(h) <= p(g) ? a.setAttribute("mode", "desktop") : p(d) > p(g) ? a.setAttribute("mode", "mobile") : a.setAttribute("mode", "tablet"));
|
|
317
484
|
});
|
|
318
485
|
}
|
|
319
486
|
connectedCallback() {
|
|
320
487
|
super.connectedCallback();
|
|
321
488
|
try {
|
|
322
489
|
l(this, i).call(this), window.addEventListener("resize", l(this, i)), l(this, i).call(this);
|
|
323
|
-
} catch (
|
|
324
|
-
throw console.error("Error in BreakPointMixin:",
|
|
490
|
+
} catch (a) {
|
|
491
|
+
throw console.error("Error in BreakPointMixin:", a, "in element", this), a;
|
|
325
492
|
}
|
|
326
493
|
}
|
|
327
494
|
disconnectedCallback() {
|
|
328
495
|
super.disconnectedCallback(), window.removeEventListener("resize", l(this, i));
|
|
329
496
|
}
|
|
330
497
|
}
|
|
331
|
-
return
|
|
498
|
+
return e = new WeakMap(), i = new WeakMap(), t;
|
|
332
499
|
}
|
|
333
|
-
const
|
|
334
|
-
function
|
|
335
|
-
const
|
|
500
|
+
const k = Symbol("listenerDefs"), $ = Symbol("withEventBindings");
|
|
501
|
+
function gt(n, t) {
|
|
502
|
+
const e = Array.isArray(n) ? n : [n];
|
|
336
503
|
return function(i, r) {
|
|
337
504
|
if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
|
|
338
505
|
return r.addInitializer(function() {
|
|
339
|
-
const
|
|
340
|
-
(
|
|
506
|
+
const s = this;
|
|
507
|
+
(s[k] || (s[k] = [])).push({
|
|
341
508
|
method: r.name,
|
|
342
|
-
events: [...
|
|
509
|
+
events: [...e],
|
|
343
510
|
opts: t
|
|
344
511
|
});
|
|
345
|
-
}), function(...
|
|
512
|
+
}), function(...s) {
|
|
346
513
|
if (!this[$])
|
|
347
514
|
throw new Error("[EventBindings] @Listen - decorator requires EventBindingMixin.");
|
|
348
|
-
return i.apply(this,
|
|
515
|
+
return i.apply(this, s);
|
|
349
516
|
};
|
|
350
517
|
};
|
|
351
518
|
}
|
|
352
|
-
function
|
|
353
|
-
var
|
|
354
|
-
return !t || t === "host" ?
|
|
355
|
-
}
|
|
356
|
-
function
|
|
357
|
-
var
|
|
358
|
-
class t extends
|
|
359
|
-
constructor(...
|
|
360
|
-
super(...
|
|
361
|
-
|
|
362
|
-
|
|
519
|
+
function Z(n, t) {
|
|
520
|
+
var e;
|
|
521
|
+
return !t || t === "host" ? n : t === "document" ? n.ownerDocument ?? document : t === "window" ? ((e = n.ownerDocument) == null ? void 0 : e.defaultView) ?? window : t === "shadowRoot" ? n.shadowRoot ?? n : typeof t == "function" ? t(n) : t;
|
|
522
|
+
}
|
|
523
|
+
function wt(n) {
|
|
524
|
+
var e, i, N;
|
|
525
|
+
class t extends n {
|
|
526
|
+
constructor(...o) {
|
|
527
|
+
super(...o);
|
|
528
|
+
m(this, i);
|
|
529
|
+
m(this, e);
|
|
363
530
|
this[$] = !0;
|
|
364
531
|
}
|
|
365
532
|
connectedCallback() {
|
|
366
|
-
var
|
|
367
|
-
(
|
|
533
|
+
var o;
|
|
534
|
+
(o = super.connectedCallback) == null || o.call(this), w(this, i, N).call(this);
|
|
368
535
|
}
|
|
369
536
|
disconnectedCallback() {
|
|
370
|
-
var
|
|
371
|
-
(
|
|
537
|
+
var o, u;
|
|
538
|
+
(o = l(this, e)) == null || o.abort(), (u = super.disconnectedCallback) == null || u.call(this);
|
|
372
539
|
}
|
|
373
540
|
}
|
|
374
|
-
return
|
|
375
|
-
var
|
|
376
|
-
(
|
|
377
|
-
const
|
|
378
|
-
for (const h of
|
|
379
|
-
const g =
|
|
380
|
-
for (const
|
|
381
|
-
g.addEventListener(
|
|
541
|
+
return e = new WeakMap(), i = new WeakSet(), N = function() {
|
|
542
|
+
var u, c, d;
|
|
543
|
+
(u = l(this, e)) == null || u.abort(), y(this, e, new AbortController());
|
|
544
|
+
const o = this[k] || [];
|
|
545
|
+
for (const h of o) {
|
|
546
|
+
const g = Z(this, (c = h.opts) == null ? void 0 : c.target), b = ((d = h.opts) == null ? void 0 : d.options) ?? {}, R = this[h.method].bind(this);
|
|
547
|
+
for (const V of h.events)
|
|
548
|
+
g.addEventListener(V, R, { ...b, signal: l(this, e).signal });
|
|
382
549
|
}
|
|
383
550
|
}, t;
|
|
384
551
|
}
|
|
385
|
-
let
|
|
386
|
-
function
|
|
387
|
-
var
|
|
388
|
-
class t extends
|
|
552
|
+
let tt = 1;
|
|
553
|
+
function yt(n) {
|
|
554
|
+
var e, i, r;
|
|
555
|
+
class t extends n {
|
|
389
556
|
constructor() {
|
|
390
557
|
super(...arguments);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
558
|
+
m(this, e, null);
|
|
559
|
+
m(this, i, tt++);
|
|
560
|
+
m(this, r, null);
|
|
394
561
|
}
|
|
395
562
|
/**
|
|
396
563
|
* Clears the cached debug flag so the attribute will be checked again
|
|
397
564
|
* on the next log/warn/error call.
|
|
398
565
|
*/
|
|
399
566
|
invalidateDebugCache() {
|
|
400
|
-
|
|
567
|
+
y(this, e, null);
|
|
401
568
|
}
|
|
402
569
|
get _debug() {
|
|
403
|
-
return l(this,
|
|
570
|
+
return l(this, e) !== null ? l(this, e) : (this instanceof HTMLElement && y(this, e, this.hasAttribute("debug") && !["false", "0", "off", "no"].includes(this.getAttribute("debug") || "")), l(this, e) === !0 && console.info(
|
|
404
571
|
// @ts-expect-error - it says tagName is not defined -whatever
|
|
405
572
|
`[DEBUG][ID:${l(this, i)}] LoggingMixin: Debug mode is enabled for <${this.tagName}>`,
|
|
406
573
|
this
|
|
407
|
-
), l(this,
|
|
574
|
+
), l(this, e) ?? !1);
|
|
408
575
|
}
|
|
409
|
-
getLogger(
|
|
410
|
-
const
|
|
411
|
-
return l(this, r) ||
|
|
576
|
+
getLogger(o = "main") {
|
|
577
|
+
const u = "<" + (this.tagName || this.constructor.name || "UnknownElement") + ">";
|
|
578
|
+
return l(this, r) || y(this, r, new q(this._debug, u, `${l(this, i)}`, o)), l(this, r);
|
|
412
579
|
}
|
|
413
|
-
debug(...
|
|
414
|
-
this.getLogger().debug(...
|
|
580
|
+
debug(...o) {
|
|
581
|
+
this.getLogger().debug(...o);
|
|
415
582
|
}
|
|
416
|
-
log(...
|
|
417
|
-
this.getLogger().log(...
|
|
583
|
+
log(...o) {
|
|
584
|
+
this.getLogger().log(...o);
|
|
418
585
|
}
|
|
419
|
-
warn(...
|
|
420
|
-
this.getLogger().warn(...
|
|
586
|
+
warn(...o) {
|
|
587
|
+
this.getLogger().warn(...o);
|
|
421
588
|
}
|
|
422
|
-
error(...
|
|
423
|
-
this.getLogger().error(...
|
|
589
|
+
error(...o) {
|
|
590
|
+
this.getLogger().error(...o);
|
|
424
591
|
}
|
|
425
|
-
throwError(...
|
|
426
|
-
return this.getLogger().throwError(...
|
|
592
|
+
throwError(...o) {
|
|
593
|
+
return this.getLogger().throwError(...o);
|
|
427
594
|
}
|
|
428
595
|
}
|
|
429
|
-
return
|
|
596
|
+
return e = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
|
|
430
597
|
}
|
|
431
|
-
function
|
|
432
|
-
class t extends
|
|
598
|
+
function bt(n) {
|
|
599
|
+
class t extends n {
|
|
433
600
|
connectedCallback() {
|
|
434
601
|
this.dispatchEvent(
|
|
435
602
|
new CustomEvent("init:child-waitreq", {
|
|
@@ -470,60 +637,61 @@ function ct(e) {
|
|
|
470
637
|
}
|
|
471
638
|
return t;
|
|
472
639
|
}
|
|
473
|
-
function
|
|
474
|
-
var
|
|
475
|
-
class t extends
|
|
640
|
+
function pt(n) {
|
|
641
|
+
var e, D, r, v, B;
|
|
642
|
+
class t extends n {
|
|
476
643
|
constructor() {
|
|
477
644
|
super(...arguments);
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const d =
|
|
645
|
+
m(this, e);
|
|
646
|
+
m(this, r, (c) => {
|
|
647
|
+
const d = c.target, h = w(this, e, v).call(this, d.assignedNodes({ flatten: !0 })), g = w(this, e, v).call(this, d.childNodes);
|
|
481
648
|
h || g ? d.classList.remove("slot-empty") : d.classList.add("slot-empty");
|
|
482
649
|
});
|
|
483
650
|
}
|
|
484
|
-
firstUpdated(
|
|
651
|
+
firstUpdated(c) {
|
|
485
652
|
var d;
|
|
486
|
-
(d = super.firstUpdated) == null || d.call(this,
|
|
653
|
+
(d = super.firstUpdated) == null || d.call(this, c), w(this, e, D).call(this);
|
|
487
654
|
}
|
|
488
655
|
}
|
|
489
|
-
return
|
|
656
|
+
return e = new WeakSet(), D = function() {
|
|
490
657
|
var d;
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
w(this,
|
|
658
|
+
const c = (d = this.shadowRoot) == null ? void 0 : d.querySelectorAll("slot");
|
|
659
|
+
c == null || c.forEach((h) => {
|
|
660
|
+
w(this, e, v).call(this, h.childNodes) || h.classList.add("slot-empty"), h.addEventListener("slotchange", (g) => l(this, r).call(this, g));
|
|
494
661
|
});
|
|
495
|
-
}, r = new WeakMap(),
|
|
496
|
-
return Array.from(
|
|
497
|
-
},
|
|
498
|
-
return
|
|
662
|
+
}, r = new WeakMap(), v = function(c) {
|
|
663
|
+
return Array.from(c).some((d) => w(this, e, B).call(this, d));
|
|
664
|
+
}, B = function(c) {
|
|
665
|
+
return c.nodeType === Node.TEXT_NODE ? (c.textContent || "").trim().length > 0 : c.nodeType === Node.ELEMENT_NODE;
|
|
499
666
|
}, t;
|
|
500
667
|
}
|
|
501
668
|
export {
|
|
502
|
-
|
|
669
|
+
mt as BreakPointMixin,
|
|
503
670
|
C as Debouncer,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
671
|
+
wt as EventBindingsMixin,
|
|
672
|
+
rt as FormDataAccessor,
|
|
673
|
+
gt as Listen,
|
|
674
|
+
bt as LoaderMixin,
|
|
675
|
+
q as Logger,
|
|
676
|
+
yt as LoggingMixin,
|
|
677
|
+
pt as SlotVisibilityMixin,
|
|
678
|
+
ot as Stopwatch,
|
|
679
|
+
_ as breakpointMap,
|
|
680
|
+
E as breakpoints,
|
|
681
|
+
nt as create_element,
|
|
682
|
+
it as debounce,
|
|
683
|
+
p as getBreakpointMinWidth,
|
|
684
|
+
U as getCurrentBreakpoint,
|
|
685
|
+
st as getErrorLocation,
|
|
686
|
+
F as getViewportWidth,
|
|
687
|
+
ut as local_storage,
|
|
688
|
+
at as session_storage,
|
|
689
|
+
ht as sleep,
|
|
690
|
+
x as waitFor,
|
|
691
|
+
ft as waitForAnimationEnd,
|
|
692
|
+
Y as waitForDomContentLoaded,
|
|
693
|
+
M as waitForLoad,
|
|
694
|
+
dt as waitForPreVisual,
|
|
695
|
+
ct as waitForReady,
|
|
696
|
+
lt as waitForVisual
|
|
529
697
|
};
|