@reactive-web-components/rwc 2.51.13 → 2.52.0

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