@reactive-web-components/rwc 2.54.3 → 2.55.1

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.
@@ -1,898 +0,0 @@
1
- var Y = Object.defineProperty;
2
- var K = (t, e, s) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var C = (t, e, s) => K(t, typeof e != "symbol" ? e + "" : e, s);
4
- const x = (t) => t && typeof t == "object" && ("classList" in t || "attributes" in t || "customAttributes" in t || "reactiveClassList" in t || "listeners" in t || "customListeners" in t || "children" in t || "effects" in t || "style" in t || Object.keys(t).some(
5
- (e) => e.startsWith(".") || e.startsWith("@") || e.startsWith("$")
6
- )) && !("hostElement" in t), tt = (t) => t && typeof t == "object" && "hostElement" in t && "append" in t && "set" in t && "addStyle" in t && "setAttribute" in t && "addClass" in t && "addEffect" in t && "addReactiveContent" in t && "setReactiveContent" in t && "clear" in t, _ = (t, e, ...s) => {
7
- e && e.apply(t, s);
8
- };
9
- let F = !0;
10
- const u = (...t) => {
11
- F && console.debug(
12
- ["[rwc]", ...t].join(" | "),
13
- ...Array.from(t.join("").matchAll(/%c/gm)).map((e, s) => s % 2 === 0 ? "color:red" : "color:inherit")
14
- );
15
- }, $ = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`), et = (t) => t.replace(/-(\w)/gm, (e, s) => s.toUpperCase()), g = (t, ...e) => {
16
- if (!F) return;
17
- const s = {
18
- r: "color: #ff0000",
19
- // red
20
- g: "color: #00ff00",
21
- // green
22
- b: "color: #0000ff",
23
- // blue
24
- y: "color: #ffff00",
25
- // yellow
26
- p: "color: #800080",
27
- // purple
28
- c: "color: #00ffff",
29
- // cyan
30
- o: "color: #ffa500",
31
- // orange
32
- w: "color: #808080"
33
- // gray (w for white/gray)
34
- }, n = t.match(/@[rgbpycow]/g) || [], o = n.map((l) => {
35
- const a = l.slice(1);
36
- return s[a] || "color: inherit";
37
- });
38
- let r = t;
39
- n.forEach((l) => {
40
- const a = new RegExp(`\\${l}([^\\s,]+)`, "g");
41
- r = r.replace(a, "%c$1");
42
- }), console.log(r, ...o, ...e);
43
- }, At = () => {
44
- F = !0;
45
- }, st = () => {
46
- F = !1;
47
- };
48
- st();
49
- let B = !1;
50
- const gt = (t) => {
51
- B = t;
52
- }, V = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), I = [], L = [];
53
- function A(t, e) {
54
- const s = /* @__PURE__ */ new Set();
55
- let n = (e == null ? void 0 : e.signalCompareFn) || (() => !0);
56
- function o() {
57
- var l;
58
- const r = I[I.length - 1];
59
- if (r && !("fake" in r && r.fake)) {
60
- const a = R.get(r), c = a == null ? void 0 : a.parent;
61
- if (c) {
62
- const d = R.get(c);
63
- d == null || d.cleanupFns.add(() => {
64
- s.delete(r);
65
- });
66
- }
67
- s.add(r), B && ((l = V.get(r.effectId)) == null || l.signals.push(o));
68
- }
69
- return t;
70
- }
71
- return o.signalId = `${(e == null ? void 0 : e.name) || ""}_${Math.random().toString(36).substring(2, 15)}`, o.getSubscribers = () => [...s], o.setCompareFn = function(r) {
72
- return n = r, o;
73
- }, o.clearSubscribers = function() {
74
- s.clear();
75
- }, o.peek = function() {
76
- return Object.freeze(t);
77
- }, o.initValue = Object.freeze(t), o.oldValue = Object.freeze(t), o.forceSet = function(r) {
78
- o.oldValue = Object.freeze(t), t = r, s.forEach(
79
- (l) => Promise.resolve(l).then((a) => {
80
- const c = R.get(a);
81
- c && c.cleanupFns.size > 0 && (c.cleanupFns.forEach((d) => d()), c.cleanupFns.clear()), L.push(a), a(), L.pop();
82
- })
83
- );
84
- }, o.set = function(r, l = n) {
85
- t !== r && l(t, r) && o.forceSet(r);
86
- }, o.update = function(r) {
87
- o.set(r(t));
88
- }, o.pipe = (r, l) => {
89
- const a = A(null);
90
- return m(() => {
91
- const c = o();
92
- m(() => {
93
- const d = r(c);
94
- d instanceof Promise ? d.then((f) => a.set(f)) : y(d) ? m(() => a.set(d())) : a.set(d);
95
- }, l);
96
- }), a;
97
- }, o;
98
- }
99
- function m(t, e) {
100
- const s = `${(e == null ? void 0 : e.name) || ""}_${Math.random().toString(36).substring(2, 15)}`;
101
- u("current effect", `%c${s}%c`);
102
- const n = t;
103
- t = () => (u("current effect callback", `%c${s}%c`), n()), "fake" in n && n.fake && (t.fake = !0), t.effectId = s;
104
- const o = L[L.length - 1];
105
- B && V.set(s, {
106
- signals: [],
107
- parent: (o == null ? void 0 : o.effectId) || null
108
- }), R.has(t) || R.set(t, { cleanupFns: /* @__PURE__ */ new Set() });
109
- const r = R.get(t);
110
- o ? r.parent = o : delete r.parent, L.push(t), I.push(t), t(), I.pop(), L.pop();
111
- }
112
- const y = (t) => !!t && ["object", "function"].includes(typeof t) && "set" in t && "oldValue" in t && "update" in t && "forceSet" in t;
113
- function Lt(t, ...e) {
114
- const s = A("");
115
- return m(() => {
116
- const n = e.map(
117
- (r) => y(r) ? String(r()) : String(r)
118
- ), o = [t[0]];
119
- n.forEach((r, l) => {
120
- o.push(r, t[l + 1]);
121
- }), s.set(o.join(""));
122
- }), s;
123
- }
124
- function Rt(t, e) {
125
- const s = A(e ?? null), n = (o) => s.set(o);
126
- return t instanceof Promise ? t.then(n) : typeof t == "function" && m(() => {
127
- const o = t();
128
- o instanceof Promise ? o.then(n) : y(o) ? m(() => n(o())) : n(o);
129
- }), s;
130
- }
131
- function Ot(t, e) {
132
- let s = t(), n = e();
133
- m(() => {
134
- const o = t(), r = e();
135
- o !== r && (o !== s ? e.set(o) : r !== n && t.set(r)), s = o, n = r;
136
- });
137
- }
138
- function jt(...t) {
139
- let e = t.map((n) => n());
140
- const s = A(e);
141
- return t.forEach((n, o) => {
142
- m(() => {
143
- const r = () => e.filter((l) => l !== void 0).length;
144
- r() === t.length && (e = Array.from(e).fill(void 0)), e[o] = n(), r() === t.length && s.set([...e]);
145
- });
146
- }), s;
147
- }
148
- const Tt = (...t) => {
149
- const e = A([]);
150
- return m(() => {
151
- e.set(t.map((s) => s()));
152
- }), e;
153
- };
154
- class O extends HTMLElement {
155
- constructor(s = !1) {
156
- super();
157
- C(this, "isSlotLazyLoading", !1);
158
- C(this, "slotTemplate");
159
- C(this, "slotContext");
160
- C(this, "rootStyle");
161
- C(this, "modelValue");
162
- C(this, "providers");
163
- C(this, "appendAllSlotContent");
164
- C(this, "allSlotContent", []);
165
- C(this, "slotContent", {});
166
- C(this, "htmlSlotContent", {});
167
- C(this, "shadow");
168
- C(this, "injects", {});
169
- this.shadow = this.attachShadow({ mode: s ? "closed" : "open" });
170
- }
171
- // @ts-expect-error - appendChild is not defined in the HTMLElement interface
172
- appendChild(s, n = !0) {
173
- var o;
174
- if (this.isSlotLazyLoading && n) {
175
- if (s instanceof HTMLElement) {
176
- const r = s.slot || "default";
177
- this.htmlSlotContent[r] || (this.htmlSlotContent[r] = []), (o = this.htmlSlotContent[r]) == null || o.push(s);
178
- }
179
- } else return super.appendChild(s);
180
- }
181
- appendSlotContent() {
182
- var s;
183
- (s = this.appendAllSlotContent) == null || s.call(this);
184
- }
185
- inject(s) {
186
- return u("%cinject%c", s), this.injects[s] || (this.injects[s] = A(null)), this.injects[s];
187
- }
188
- checkInjects() {
189
- Object.entries(this.injects).forEach(([s, n]) => {
190
- u(
191
- "%cinject%c",
192
- `%c${s}%c`,
193
- "from BaseElement (dispatch event)"
194
- ), this.shadow.dispatchEvent(
195
- new CustomEvent(s, {
196
- detail: {
197
- context: s,
198
- callback: (o) => m(() => {
199
- n.set(o());
200
- })
201
- },
202
- bubbles: !0,
203
- composed: !0
204
- })
205
- );
206
- });
207
- }
208
- setReactiveValue(s) {
209
- this.modelValue = s;
210
- }
211
- }
212
- C(O, "observedAttributes", []), C(O, "renderTagName", ""), C(O, "styles");
213
- const xt = (t) => "render" in t && "setReactiveValue" in t, nt = "handleSlotContext", q = "onConnected", wt = () => () => {
214
- }, G = (t) => typeof t == "string" ? t : JSON.stringify(t), U = (t) => {
215
- const e = document.createElement("span");
216
- return e.textContent = G(t), e;
217
- }, X = (t, e) => (t.appendChild(U(e)), t), ot = (t, e) => (t.innerHTML = "", X(t, e)), z = (t) => {
218
- const e = document.createElement("span");
219
- return m(() => {
220
- const s = t();
221
- e.textContent = G(s);
222
- }), e;
223
- }, P = (t) => ({
224
- append(...e) {
225
- return e.forEach((s) => {
226
- t.appendChild(s.hostElement), q in s.hostElement && setTimeout(() => {
227
- var n, o;
228
- (o = (n = s.hostElement).onConnected) == null || o.call(
229
- n,
230
- s,
231
- s.hostElement
232
- );
233
- });
234
- }), this;
235
- },
236
- set(...e) {
237
- this.clear();
238
- const s = document.createDocumentFragment();
239
- return e.forEach((n) => {
240
- s.appendChild(n.hostElement);
241
- }), t.appendChild(s), this;
242
- },
243
- removeChild(...e) {
244
- return e.forEach((s) => {
245
- Array.from(t.childNodes.values()).some(
246
- (n) => n === s.hostElement
247
- ) && t.removeChild(s.hostElement);
248
- }), this;
249
- },
250
- addHtmlContent(e) {
251
- return X(t, e), this;
252
- },
253
- setHtmlContent(e) {
254
- return ot(t, e), this;
255
- },
256
- addEventlistener(e, s, n = !1) {
257
- return t.addEventListener(e, (o) => s(o, this, t), n), this;
258
- },
259
- setAttribute(e, s) {
260
- let n;
261
- if (typeof s == "boolean" && !(t instanceof O))
262
- if (s)
263
- n = "";
264
- else {
265
- this.removeAttribute(e);
266
- const o = e.toLowerCase();
267
- return o in t && (t[o] = null), this;
268
- }
269
- else typeof s != "string" ? n = JSON.stringify(s) : n = s;
270
- if (t.setAttribute($(e), n), !(t instanceof O)) {
271
- const o = e.toLowerCase();
272
- o in t && (t[o] = s);
273
- }
274
- return this;
275
- },
276
- setCustomAttribute(e, s) {
277
- let n;
278
- return typeof s != "string" ? n = JSON.stringify(s) : n = s, t.setAttribute($(e), n), this;
279
- },
280
- setReactiveAttribute(e, s) {
281
- return m(() => this.setAttribute(e, s())), this;
282
- },
283
- setReactiveCustomAttribute(e, s) {
284
- return m(() => this.setCustomAttribute(e, s())), this;
285
- },
286
- removeAttribute(e) {
287
- return t.removeAttribute($(e)), this;
288
- },
289
- addStyle(e) {
290
- return Object.entries(e).forEach(([s, n]) => {
291
- const o = s.startsWith("--");
292
- typeof n == "function" ? this.addEffect(() => {
293
- if (o) {
294
- const r = String(n() || "");
295
- t.style.setProperty(s, r);
296
- } else
297
- t.style[s] = n();
298
- }) : typeof n == "string" && (o ? t.style.setProperty(s, n) : t.style[s] = n);
299
- }), this;
300
- },
301
- onConnected(e) {
302
- return Reflect.defineProperty(t, q, {
303
- get() {
304
- return e;
305
- }
306
- }), this;
307
- },
308
- addClass(...e) {
309
- return e.forEach((s) => {
310
- typeof s == "string" ? t.classList.add(
311
- ...s.split(" ").flatMap((n) => n.split(`
312
- `)).map((n) => n.trim()).filter(Boolean)
313
- ) : (() => {
314
- let n = null;
315
- this.addEffect(() => {
316
- const o = s();
317
- o.length > 0 && (n ? this.replaceClass(n, o) : this.addClass(o), n = o);
318
- });
319
- })();
320
- }), this;
321
- },
322
- setClass(...e) {
323
- return t.classList.remove(...t.classList), t.classList.add(...e), this;
324
- },
325
- addReactiveClass(e) {
326
- return Object.keys(e).forEach((s) => {
327
- m(() => {
328
- e[s]() ? this.addClass(s) : this.removeClass(s);
329
- });
330
- }), this;
331
- },
332
- removeClass(...e) {
333
- return t.classList.remove(...e), this;
334
- },
335
- replaceClass(e, s) {
336
- return t.classList.replace(e, s), this;
337
- },
338
- addEffect(e) {
339
- return m(() => e(this, this.hostElement)), this;
340
- },
341
- addReactiveContent(e) {
342
- return t.appendChild(z(e)), this;
343
- },
344
- setReactiveContent(e) {
345
- return this.clear(), t.appendChild(z(e)), this;
346
- },
347
- clear() {
348
- return t.innerHTML = "", this;
349
- },
350
- hostElement: t
351
- }), rt = (t, ...e) => ({
352
- classList: [...t.map((s) => s.trim()).filter(Boolean), ...e]
353
- }), $t = (t, ...e) => rt(t, ...e), Z = (t, e) => {
354
- if (!e) return t;
355
- const s = Object.keys(e || {}).filter(
356
- (n) => n.startsWith(".") || n.startsWith("@") || n.startsWith("$")
357
- );
358
- return s.filter((n) => n.startsWith(".")).forEach((n) => {
359
- e != null && e.attributes || (e.attributes = {}), e.attributes[n.slice(1)] = e[n];
360
- }), s.filter((n) => n.startsWith("@")).forEach((n) => {
361
- e != null && e.listeners || (e.listeners = {});
362
- const o = n.slice(1);
363
- e.listeners[o] = e[n];
364
- }), s.filter((n) => n.startsWith("$")).forEach((n) => {
365
- e != null && e.effects || (e.effects = []), e.effects.push(e[n]);
366
- }), at(t, e.classList), ht(t, e.style), ut(t, e.attributes), dt(t, e.reactiveClassList), ct(t, e.customAttributes), it(t, e.children), lt(t, e.effects), D(t, e.listeners), D(t, e.customListeners), t;
367
- }, D = (t, e) => {
368
- e && Object.entries(e).forEach(([s, n]) => {
369
- typeof n == "function" && t.addEventlistener(s, n);
370
- });
371
- }, lt = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)), it = (t, e) => W(t, ...e || []), ct = (t, e) => {
372
- const s = e;
373
- s && Object.keys(s).forEach((n) => {
374
- y(s[n]) ? t.setReactiveCustomAttribute(n, s[n]) : typeof s[n] == "function" ? t.addEffect(() => {
375
- t.setCustomAttribute(n, s[n]());
376
- }) : t.setCustomAttribute(n, s[n]);
377
- });
378
- }, at = (t, e) => t.addClass(...e || []), dt = (t, e) => t.addReactiveClass(e || {}), ht = (t, e) => t.addStyle(e || {}), ut = (t, e) => {
379
- const s = e, n = (o, r) => {
380
- r && (y(r) ? t.setReactiveAttribute(o, r) : typeof r == "function" ? t.addEffect(() => {
381
- t.setAttribute(o, r());
382
- }) : t.setAttribute(o, r));
383
- };
384
- s && Object.keys(s).forEach((o) => {
385
- n(o, s[o]);
386
- });
387
- }, W = (t, ...e) => (e.forEach((s) => {
388
- typeof s == "string" ? s.trim().length > 0 && t.addHtmlContent(s) : y(s) ? t.addReactiveContent(s) : t.append(s);
389
- }), t), w = (t, e) => {
390
- const s = document.createElement(t), n = {
391
- ...P(s)
392
- };
393
- return Z(n, e);
394
- }, H = (t, e) => {
395
- const [s, ...n] = t.split(" ").map((r) => r.trim()), o = w(s, e);
396
- return n.length > 0 && o.addClass(...n), (...r) => W(
397
- o,
398
- ...r.filter(Boolean).flat().flatMap(
399
- (l) => typeof l == "function" && !y(l) ? v(() => l(o)) : l
400
- )
401
- );
402
- }, v = (t) => w("div").addStyle({ display: "contents" }).addEffect((e) => {
403
- const s = t(), n = [];
404
- Array.isArray(s) ? n.push(...s) : n.push(s), e.clear(), W(e, ...n);
405
- }), kt = (t) => {
406
- const e = (n) => typeof n == "string" ? n.trim().length > 0 ? P(U(n)) : H("div")() : y(n) ? P(z(n)) : n;
407
- return ft(() => {
408
- const n = t();
409
- return n instanceof Array && Array.isArray(n) ? n.map(e) : e(n);
410
- });
411
- }, Mt = (t, e, s) => {
412
- const n = w("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
413
- let l = [];
414
- const a = /* @__PURE__ */ new Set();
415
- let c = t.peek();
416
- const d = (f) => {
417
- a.delete(f), o.delete(f), r.delete(f);
418
- };
419
- return m(() => {
420
- const f = t();
421
- l = f.map(e).map((h) => typeof h == "string" ? h : h.toString());
422
- const p = Array.from(n.hostElement.children);
423
- u("containerChildren", p, l), p.forEach((h) => {
424
- const E = h.dataset.key;
425
- l.includes(E) || (u("remove element", E, h), h.remove(), d(E));
426
- }), l.forEach((h) => {
427
- var j, S;
428
- const E = f[l.indexOf(h)];
429
- o.has(h) ? JSON.stringify(E) !== JSON.stringify(c[l.indexOf(h)]) && ((j = n.hostElement.querySelector(`[data-key="${h}"]`)) == null || j.remove(), (S = o.get(h)) == null || S.set(Math.random().toString(36).substring(2, 15)), r.set(
430
- h,
431
- () => s(E, l.indexOf(h), f).setCustomAttribute(
432
- "data-key",
433
- h
434
- )
435
- )) : (u("create new element", h, E), o.set(
436
- h,
437
- A(Math.random().toString(36).substring(2, 15))
438
- ), r.set(
439
- h,
440
- () => s(E, l.indexOf(h), f).setCustomAttribute(
441
- "data-key",
442
- h
443
- )
444
- ));
445
- }), c = [...f.map((h) => ({ ...h }))];
446
- const b = () => {
447
- o.forEach((h, E) => {
448
- u("key from setTimeout foreach currItemSignalMap", E), a.has(E) || (a.add(E), m(() => {
449
- var J;
450
- h();
451
- const j = l.indexOf(E), S = (J = r.get(E)) == null ? void 0 : J();
452
- S && (u(
453
- "call effect from setTimeout",
454
- E,
455
- S.hostElement
456
- ), j <= n.hostElement.children.length - 1 ? n.hostElement.insertBefore(
457
- S.hostElement,
458
- n.hostElement.children[j]
459
- ) : n.hostElement.append(S.hostElement));
460
- }));
461
- });
462
- };
463
- Promise.resolve().then(() => b());
464
- }), n;
465
- }, ft = (t) => {
466
- let e = [w("div")], s = !1;
467
- return m(() => {
468
- var r, l;
469
- const n = t();
470
- s = Array.isArray(n);
471
- const o = [];
472
- o.push(...[n].flat()), o.length === 0 && o.push(
473
- w("div").addStyle({ display: "none" }).setAttribute("id", "empty_template")
474
- );
475
- try {
476
- u("newReactiveComponent.map", o.map((a) => {
477
- var c;
478
- return u("newReactiveComponent hostElement", a.hostElement), (c = a.hostElement) == null ? void 0 : c.id;
479
- })), u("currComponent[0].hostElement?.id", (r = e[0].hostElement) == null ? void 0 : r.id, e), (l = e[0].hostElement) == null || l.replaceWith(
480
- ...o.map((a) => a.hostElement)
481
- ), e.slice(1).forEach((a) => {
482
- var c;
483
- return (c = a.hostElement) == null ? void 0 : c.remove();
484
- }), e = o;
485
- } catch (a) {
486
- console.error(a);
487
- }
488
- }), s ? e : e[0];
489
- }, It = (t) => nt in t, Pt = (t) => {
490
- const e = H("div")().addStyle({ display: "contents" }), s = (n) => (e.hostElement.innerHTML = n, e);
491
- return typeof t == "string" ? s(t) : e.addEffect(() => {
492
- s(t());
493
- }), e;
494
- }, Q = (t, e, s) => t ? v(e) : s ? v(s) : H("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), pt = (t, e, s) => v(() => Q(!!t(), e, s)), Ft = (t, e, s) => typeof t == "boolean" ? Q(t, e, s) : pt(t, e, s), N = (t, e) => {
495
- const s = v(e);
496
- return typeof t == "boolean" ? [s].flat().forEach((n) => n.hostElement.style.display = t ? "block" : "none") : m(() => {
497
- const n = t() ? "block" : "none";
498
- [s].flat().forEach((o) => o.hostElement.style.display = n);
499
- }), s;
500
- }, Wt = (t, e, s) => {
501
- const n = [N(t, e)].flat();
502
- return s && n.push(
503
- ...[N(
504
- () => typeof t == "boolean" ? !t : !t(),
505
- s
506
- )].flat()
507
- ), v(() => n);
508
- }, mt = (t, e) => {
509
- u("createCustomElement", t);
510
- const s = document.createElement(t), n = {
511
- ...P(s),
512
- setReactiveValue(o) {
513
- return s instanceof O && s.setReactiveValue(o), this;
514
- },
515
- setSlotTemplate(o) {
516
- const r = s.slotTemplate;
517
- return r && Object.entries(o).forEach(([l, a]) => {
518
- r[l] = a;
519
- }), this;
520
- }
521
- };
522
- return Z(n, e);
523
- }, Ct = (t, e) => {
524
- const s = t.split(" ").slice(1).map((o) => o.trim()), n = mt(t.split(" ")[0], e);
525
- return Array.isArray(s) && s.length > 0 && n.addClass(...s), (...o) => {
526
- g("@rcreateCustomEl content", t, o);
527
- const r = o.filter(Boolean).flat().flatMap(
528
- (l) => typeof l == "function" && !y(l) ? v(() => l(n)) : l
529
- );
530
- return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(tt).reduce(
531
- (l, a) => {
532
- const c = a.hostElement.getAttribute("slot") || "default";
533
- return l[c] || (l[c] = []), l[c].push(a), l;
534
- },
535
- {}
536
- ), n.hostElement.appendAllSlotContent = () => W(n, ...r), n;
537
- };
538
- }, bt = (t, e, s) => Ct(
539
- `${t.renderTagName}${e && typeof e == "string" ? " " + e : ""}`,
540
- x(e) ? e : e && typeof e == "string" ? s : void 0
541
- ), Ht = () => {
542
- const t = () => {
543
- };
544
- return t.oldValue = null, t;
545
- }, _t = () => ({}), zt = (t, e, s) => {
546
- const n = e ? St(e, s)(t) : t;
547
- return (o, ...r) => {
548
- const l = [...r];
549
- return o && !x(o) && l.unshift(o), bt(n, x(o) ? o : {})(...l);
550
- };
551
- }, i = {}, Et = [
552
- "div",
553
- "span",
554
- "section",
555
- "input",
556
- "button",
557
- "table",
558
- "tr",
559
- "td",
560
- "th",
561
- "ul",
562
- "li",
563
- "ol",
564
- "form",
565
- "label",
566
- "select",
567
- "option",
568
- "textarea",
569
- "img",
570
- "a",
571
- "p",
572
- "h1",
573
- "h2",
574
- "h3",
575
- "h4",
576
- "h5",
577
- "h6",
578
- "br",
579
- "hr",
580
- "pre",
581
- "code",
582
- "nav",
583
- "header",
584
- "footer",
585
- "main",
586
- "aside",
587
- "article",
588
- "figure",
589
- "figcaption",
590
- "blockquote",
591
- "cite",
592
- "small",
593
- "strong",
594
- "em",
595
- "b",
596
- "i",
597
- "u",
598
- "s",
599
- "sub",
600
- "sup",
601
- "mark",
602
- "del",
603
- "ins",
604
- "details",
605
- "summary",
606
- "progress",
607
- "meter",
608
- "audio",
609
- "video",
610
- "canvas",
611
- "slot"
612
- ];
613
- Et.forEach((t) => {
614
- i[t] = (e, ...s) => {
615
- let n = [...s];
616
- return e && !x(e) && (n = [e].concat(n)), H(t, x(e) ? e : {})(...n);
617
- };
618
- });
619
- const yt = i.div, Bt = i.span, Jt = i.section, qt = i.input, Dt = i.button, Nt = i.table, Vt = i.tr, Gt = i.td, Ut = i.th, Xt = i.ul, Zt = i.li, Qt = i.ol, Yt = i.form, Kt = i.label, te = i.select, ee = i.option, se = i.textarea, ne = i.img, oe = i.a, re = i.p, le = i.h1, ie = i.h2, ce = i.h3, ae = i.h4, de = i.h5, he = i.h6, ue = i.br, fe = i.hr, pe = i.pre, me = i.code, Ce = i.nav, be = i.header, Ee = i.footer, ye = i.main, Se = i.aside, ve = i.article, Ae = i.figure, ge = i.figcaption, Le = i.blockquote, Re = i.cite, Oe = i.small, je = i.strong, Te = i.em, xe = i.b, we = i.i, $e = i.u, ke = i.s, Me = i.sub, Ie = i.sup, Pe = i.mark, Fe = i.del, We = i.ins, He = i.details, _e = i.summary, ze = i.progress, Be = i.meter, Je = i.audio, qe = i.video, De = i.canvas, Ne = i.slot, Ve = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", M = "EVENT_CONFIG", T = "observedAttributes", Ge = () => (t, e) => {
620
- Reflect.get(t, T) || Reflect.defineProperty(t, T, {
621
- value: []
622
- }), Reflect.get(t, T).push(
623
- $(e)
624
- );
625
- }, Ue = (t) => (e, s) => {
626
- Reflect.get(e, k) || Reflect.defineProperty(e, k, {
627
- value: []
628
- }), Reflect.get(e, M) || Reflect.defineProperty(e, M, {
629
- value: {}
630
- }), Reflect.get(e, M)[s] = {
631
- bubbles: (t == null ? void 0 : t.bubbles) ?? !1,
632
- composed: (t == null ? void 0 : t.composed) ?? !1
633
- }, Reflect.get(e, k).push(s);
634
- }, St = (t, e = !1) => (s) => {
635
- u(
636
- t,
637
- "start register static attr",
638
- s.prototype[T]
639
- );
640
- const n = [];
641
- if (s.styles) {
642
- const r = s.styles, l = [];
643
- Array.isArray(r) ? l.push(...r) : l.push(r), l.forEach((a) => {
644
- const c = new CSSStyleSheet();
645
- c.replaceSync(a), n.push(c);
646
- const d = new CSSStyleSheet();
647
- d.replaceSync(a.slice(a.indexOf("@property"))), document.adoptedStyleSheets.push(d);
648
- });
649
- }
650
- class o extends s {
651
- constructor(...l) {
652
- u("constructor", `%c${t}%c`), super(e, ...l), g("@osheet", n), n.length > 0 && this.shadow.adoptedStyleSheets.push(...n);
653
- }
654
- render() {
655
- u("rwc: render from new class");
656
- let l = yt();
657
- const a = () => {
658
- u("wrapperEffectCallback"), l = s.prototype.render.call(this);
659
- };
660
- return a.fake = !0, m(a), l;
661
- }
662
- attributeChangedCallback(l, a, c) {
663
- u(
664
- "%cAttribute has changed.%c",
665
- `%c${l}%c`,
666
- `oldValue: ${a}, newValue: ${c}`,
667
- `%c${t}%c`
668
- );
669
- try {
670
- c = JSON.parse(c);
671
- } catch {
672
- }
673
- const d = et(l);
674
- if (d in this && y(this[d])) {
675
- const f = this[d];
676
- c === null ? (f.set(f.initValue), this.removeAttribute(l)) : f.set(c);
677
- }
678
- _(
679
- this,
680
- s.prototype.attributeChangedCallback,
681
- l,
682
- a,
683
- c
684
- );
685
- }
686
- connectedCallback() {
687
- var a;
688
- u("rwc: connectedCallback"), u("connectedCallback", `%c${t}%c`, this), this.providers && Object.keys(this.providers).length > 0 && (u("WRAPPER for providers", t), Object.entries(this.providers).forEach(
689
- ([c, d]) => {
690
- u("register provider", c, d()), this.addEventListener(c, (f) => {
691
- var b;
692
- u("send provider", c, d());
693
- const p = f;
694
- ((b = p.detail) == null ? void 0 : b.context) === c && (p.stopPropagation(), p.detail.callback(d));
695
- });
696
- }
697
- )), this.checkInjects(), (a = s.prototype[k]) == null || a.forEach(
698
- (c) => {
699
- this[c] = (d) => {
700
- const f = s.prototype[M][c], { bubbles: p, composed: b } = f;
701
- y(d) ? m(() => {
702
- g("@oemit reactive value", d()), this.dispatchEvent(
703
- new CustomEvent(c, {
704
- detail: d(),
705
- bubbles: p,
706
- composed: b
707
- })
708
- );
709
- }) : (g("@oemit value", d), this.dispatchEvent(
710
- new CustomEvent(c, {
711
- detail: d,
712
- bubbles: p,
713
- composed: b
714
- })
715
- ));
716
- };
717
- }
718
- ), u("start render", `%c${t}%c`, t);
719
- const l = () => {
720
- u("rwc: insertRenderTemplate");
721
- const c = this.render();
722
- this.shadow.appendChild(c.hostElement), _(this, s.prototype.connectedCallback), this.appendSlotContent();
723
- };
724
- if (this.rootStyle && !s.styles) {
725
- const c = (p) => p instanceof Promise || Array.isArray(p) && p.every((b) => b instanceof Promise), d = this.rootStyle, f = (p) => {
726
- const b = new CSSStyleSheet();
727
- b.replaceSync(p), this.shadow.adoptedStyleSheets.push(b);
728
- const h = new CSSStyleSheet();
729
- h.replaceSync(p.slice(p.indexOf("@property"))), document.adoptedStyleSheets.push(h);
730
- };
731
- if (c(d)) {
732
- const p = [];
733
- Array.isArray(d) ? p.push(...d) : p.push(d), Promise.all(p).then((b) => b.forEach((h) => f(h.default))).then(() => l());
734
- } else {
735
- const p = [];
736
- Array.isArray(d) ? p.push(...d) : p.push(d), p.forEach((b) => f(b)), l();
737
- }
738
- } else
739
- l();
740
- this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((c) => {
741
- u(
742
- this.slotContext,
743
- this.slotContext && this.slotContext[c.name]
744
- ), g(
745
- "@bslot element",
746
- c,
747
- `name:${c.name};`,
748
- c.assignedElements()
749
- ), c.assignedElements().forEach((d) => {
750
- const f = this.slotContext[c.name];
751
- this.slotContext && y(f) && (g(
752
- "@oslot element",
753
- c,
754
- `name:${c.name};`,
755
- c.assignedElements()
756
- ), m(() => {
757
- d.dispatchEvent(
758
- new CustomEvent("handleSlotContext", {
759
- detail: f()
760
- })
761
- );
762
- }));
763
- });
764
- });
765
- }
766
- disconnectedCallback() {
767
- this.shadow.replaceChildren(), this.replaceChildren(), _(this, s.prototype.disconnectedCallback);
768
- }
769
- }
770
- return C(o, "observedAttributes", s.prototype[T] ?? []), C(o, "renderTagName", t), o.toString = () => t, customElements.get(t) ? console.error(
771
- `название тега ${t} повторяется, компонент ${s.name} не зарегистрирован`
772
- ) : customElements.define(t, o), s.renderTagName = t, s;
773
- };
774
- export {
775
- O as BaseElement,
776
- oe as a,
777
- ut as addAttributeList,
778
- at as addClassList,
779
- ct as addCustomAttributes,
780
- X as addHtmlContent,
781
- dt as addReactiveClassList,
782
- ht as addStyleList,
783
- W as appendContentItem,
784
- ve as article,
785
- Se as aside,
786
- Je as audio,
787
- xe as b,
788
- Ot as bindReactiveSignals,
789
- Le as blockquote,
790
- ue as br,
791
- Dt as button,
792
- $ as camelToKebab,
793
- De as canvas,
794
- _ as checkCall,
795
- Re as cite,
796
- rt as classList,
797
- $t as cls,
798
- me as code,
799
- g as colorLog,
800
- Tt as combineLatest,
801
- St as component,
802
- Ve as createComponent,
803
- bt as createCustom,
804
- Ct as createCustomEl,
805
- mt as createCustomElement,
806
- H as createEl,
807
- w as createElement,
808
- Rt as createSignal,
809
- _t as defineSlotTemplate,
810
- Fe as del,
811
- He as details,
812
- st as disableLogs,
813
- yt as div,
814
- m as effect,
815
- V as effectMap,
816
- P as elementHelpers,
817
- Te as em,
818
- At as enableLogs,
819
- Ue as event,
820
- wt as eventEmitter,
821
- ge as figcaption,
822
- Ae as figure,
823
- Ee as footer,
824
- jt as forkJoin,
825
- Yt as form,
826
- Mt as getList,
827
- kt as getReactiveTemplate,
828
- v as getSignalContent,
829
- G as getTextContent,
830
- le as h1,
831
- ie as h2,
832
- ce as h3,
833
- ae as h4,
834
- de as h5,
835
- he as h6,
836
- be as header,
837
- fe as hr,
838
- z as htmlEffectWrapper,
839
- we as i,
840
- ne as img,
841
- Z as initComponent,
842
- qt as input,
843
- We as ins,
844
- xt as isBaseElement,
845
- tt as isComponentConfig,
846
- x as isComponentInitConfig,
847
- y as isReactiveSignal,
848
- It as isSlotTemplate,
849
- et as kebabToCamel,
850
- Kt as label,
851
- Zt as li,
852
- ye as main,
853
- Pe as mark,
854
- Be as meter,
855
- Ce as nav,
856
- Ht as newEventEmitter,
857
- Qt as ol,
858
- ee as option,
859
- re as p,
860
- pe as pre,
861
- ze as progress,
862
- u as projectLog,
863
- Ge as property,
864
- Q as renderIf,
865
- Lt as rs,
866
- pt as rxRenderIf,
867
- ke as s,
868
- Jt as section,
869
- te as select,
870
- it as setChildren,
871
- gt as setEffectDebugEnabled,
872
- lt as setEffects,
873
- ot as setHtmlContent,
874
- D as setListeners,
875
- Wt as show,
876
- N as showIf,
877
- A as signal,
878
- ft as signalComponent,
879
- Ne as slot,
880
- Oe as small,
881
- Bt as span,
882
- je as strong,
883
- Me as sub,
884
- _e as summary,
885
- Ie as sup,
886
- Nt as table,
887
- Gt as td,
888
- U as textContentWrapper,
889
- se as textarea,
890
- Ut as th,
891
- Vt as tr,
892
- $e as u,
893
- Xt as ul,
894
- Pt as unsafeHtml,
895
- zt as useCustomComponent,
896
- qe as video,
897
- Ft as when
898
- };