@reactive-web-components/rwc 2.60.1 → 2.61.4

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