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