@reactive-web-components/rwc 2.60.3 → 2.61.6

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