@reactive-web-components/rwc 2.56.1 → 2.56.2

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