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