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