@reactive-web-components/rwc 2.60.1 → 2.61.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,973 +0,0 @@
1
- var K = Object.defineProperty;
2
- var tt = (e, t, s) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var h = (e, t, s) => tt(e, typeof t != "symbol" ? t + "" : t, s);
4
- const $ = (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), et = (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, P = (e, t, ...s) => {
7
- t && t.apply(e, s);
8
- };
9
- let g = !0;
10
- const m = (...e) => {
11
- g && 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
- }, k = (e) => e.replace(/([A-Z])/gm, (t) => `-${t.toLowerCase()}`), st = (e) => e.replace(/-(\w)/gm, (t, s) => s.toUpperCase()), W = (e, ...t) => {
16
- if (!g) 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 l = c.slice(1);
36
- return s[l] || "color: inherit";
37
- });
38
- let r = e;
39
- n.forEach((c) => {
40
- const l = new RegExp(`\\${c}([^\\s,]+)`, "g");
41
- r = r.replace(l, "%c$1");
42
- }), console.log(r, ...o, ...t);
43
- }, Lt = () => {
44
- g = !0;
45
- }, nt = () => {
46
- g = !1;
47
- };
48
- nt();
49
- const Ot = (e, t) => {
50
- e.every(Boolean) && t(e);
51
- }, v = [], F = (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 R(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 = v[v.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
- F(c), Promise.resolve().then(() => {
79
- v.push(c), c(), v.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 l = R(null);
89
- return C(() => {
90
- const f = o();
91
- C(() => {
92
- const a = r(f);
93
- a instanceof Promise ? a.then((S) => l.set(S)) : y(a) ? C(() => l.set(a()), { name: "pipe_effect_inner" }) : l.set(a);
94
- }, { name: "pipe_effect" });
95
- }, { name: (c == null ? void 0 : c.name) || `pipe_${o.signalId}` }), l;
96
- }, o;
97
- }
98
- function C(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 = v[v.length - 1];
105
- o && ((r = o.children) == null || r.add(n), n.parent = new WeakRef(o), n.destroy = () => {
106
- var c;
107
- F(n), (c = o.children) == null || c.delete(n), n.destroy = void 0, n.status = "inactive";
108
- }), n.cleanupSet = /* @__PURE__ */ new Set(), v.push(n), n(), v.pop();
109
- }
110
- const y = (e) => !!e && ["object", "function"].includes(typeof e) && "set" in e && "update" in e && "forceSet" in e && "signalId" in e;
111
- function jt(e, ...t) {
112
- const s = R("");
113
- return C(() => {
114
- const n = t.map(
115
- (r) => y(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 It(e, t) {
123
- const s = R(t ?? null), n = (o) => s.set(o);
124
- return e instanceof Promise ? e.then(n) : typeof e == "function" && C(() => {
125
- const o = e();
126
- o instanceof Promise ? o.then(n) : y(o) ? C(() => n(o())) : n(o);
127
- }), s;
128
- }
129
- function $t(e, t) {
130
- let s = e(), n = t();
131
- C(() => {
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 xt(...e) {
137
- let t = e.map((n) => n());
138
- const s = R(t);
139
- return e.forEach((n, o) => {
140
- C(() => {
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 Tt = (...e) => {
147
- const t = R([]);
148
- return C(() => {
149
- t.set(e.map((s) => s()));
150
- }), t;
151
- }, M = "eventProps", _ = "EVENT_CONFIG", I = "observedAttributes", Wt = () => (e, t) => {
152
- Reflect.get(e, I) || Reflect.defineProperty(e, I, {
153
- value: []
154
- }), Reflect.get(e, I).push(
155
- k(t)
156
- );
157
- }, kt = (e) => (t, s) => {
158
- Reflect.get(t, M) || Reflect.defineProperty(t, M, {
159
- value: []
160
- }), Reflect.get(t, _) || Reflect.defineProperty(t, _, {
161
- value: {}
162
- }), Reflect.get(t, _)[s] = {
163
- bubbles: (e == null ? void 0 : e.bubbles) ?? !1,
164
- composed: (e == null ? void 0 : e.composed) ?? !1
165
- }, Reflect.get(t, M).push(s);
166
- }, G = (e, t = !1) => (s) => {
167
- m(
168
- e,
169
- "start register static attr",
170
- s.prototype[I]
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((l) => {
176
- const f = new CSSStyleSheet();
177
- f.replaceSync(l), n.push(f);
178
- const b = new CSSStyleSheet();
179
- b.replaceSync(l.slice(l.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, l, f) {
190
- m(
191
- "%cAttribute has changed.%c",
192
- `%c${c}%c`,
193
- `oldValue: ${l}, newValue: ${f}`,
194
- `%c${e}%c`
195
- );
196
- try {
197
- f = JSON.parse(f);
198
- } catch {
199
- }
200
- const b = st(c);
201
- if (b in this && y(this[b])) {
202
- const a = this[b];
203
- a.setName(c), f === null ? (a.set(a.initValue), this.removeAttribute(c)) : a.set(f);
204
- }
205
- P(
206
- this,
207
- s.prototype.attributeChangedCallback,
208
- c,
209
- l,
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
- ([a, u]) => {
218
- m("register provider", a, u()), this.addEventListener(a, (S) => {
219
- var d;
220
- m("send provider", a, u());
221
- const p = S;
222
- ((d = p.detail) == null ? void 0 : d.context) === a && (p.stopPropagation(), p.detail.callback(u));
223
- });
224
- }
225
- )), this.checkInjects(), (b = s.prototype[M]) == null || b.forEach(
226
- (a) => {
227
- this[a] = (u) => {
228
- const S = s.prototype[_][a], { bubbles: p, composed: d } = S;
229
- y(u) ? C(() => {
230
- W("@oemit reactive value", u()), this.dispatchEvent(
231
- new CustomEvent(a, {
232
- detail: u(),
233
- bubbles: p,
234
- composed: d
235
- })
236
- );
237
- }) : (W("@oemit value", u), this.dispatchEvent(
238
- new CustomEvent(a, {
239
- detail: u,
240
- bubbles: p,
241
- composed: d
242
- })
243
- ));
244
- };
245
- }
246
- ), m("start render", `%c${e}%c`, e);
247
- const l = () => {
248
- m("rwc: insertRenderTemplate");
249
- const u = this.render().hostElement;
250
- u && this.shadow.appendChild(u), P(this, s.prototype.connectedCallback), this.appendSlotContent();
251
- };
252
- if (this.rootStyle && !s.styles) {
253
- const a = (p) => p instanceof Promise || Array.isArray(p) && p.every((d) => d instanceof Promise), u = this.rootStyle, S = (p) => {
254
- const d = new CSSStyleSheet();
255
- d.replaceSync(p), this.shadow.adoptedStyleSheets.push(d);
256
- const E = new CSSStyleSheet();
257
- E.replaceSync(p.slice(p.indexOf("@property"))), document.adoptedStyleSheets.push(E);
258
- };
259
- if (a(u)) {
260
- const p = [];
261
- Array.isArray(u) ? p.push(...u) : p.push(u), Promise.all(p).then((d) => d.forEach((E) => S(E.default))).then(() => l());
262
- } else {
263
- const p = [];
264
- Array.isArray(u) ? p.push(...u) : p.push(u), p.forEach((d) => S(d)), l();
265
- }
266
- } else
267
- l();
268
- this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((a) => {
269
- m(
270
- this.slotContext,
271
- this.slotContext && this.slotContext[a.name]
272
- ), W(
273
- "@bslot element",
274
- a,
275
- `name:${a.name};`,
276
- a.assignedElements()
277
- ), a.assignedElements().forEach((u) => {
278
- const S = this.slotContext[a.name];
279
- this.slotContext && y(S) && (W(
280
- "@oslot element",
281
- a,
282
- `name:${a.name};`,
283
- a.assignedElements()
284
- ), C(() => {
285
- u.dispatchEvent(
286
- new CustomEvent("handleSlotContext", {
287
- detail: S()
288
- })
289
- );
290
- }));
291
- });
292
- });
293
- };
294
- c.fake = !0, c.component = new WeakRef(this), this.effectSet.add(new WeakRef(c)), C(c, { name: "FAKE_wrapperEffect" });
295
- }
296
- disconnectedCallback() {
297
- this.allSlotContent = [], this.slotContent = {}, this.htmlSlotContent = {}, this.effectSet.forEach((c) => {
298
- var l, f;
299
- return (f = (l = c.deref()) == null ? void 0 : l.destroy) == null ? void 0 : f.call(l);
300
- }), this.effectSet.clear(), this.shadow.replaceChildren(), this.replaceChildren(), P(this, s.prototype.disconnectedCallback);
301
- }
302
- }
303
- return h(o, "observedAttributes", s.prototype[I] ?? []), h(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 O extends HTMLElement {
308
- constructor(s = !1) {
309
- super();
310
- h(this, "init");
311
- h(this, "isSlotLazyLoading", !1);
312
- h(this, "slotTemplate");
313
- h(this, "slotContext");
314
- h(this, "rootStyle");
315
- h(this, "modelValue");
316
- h(this, "providers");
317
- h(this, "effectSet", /* @__PURE__ */ new Set());
318
- h(this, "appendAllSlotContent");
319
- h(this, "allSlotContent", []);
320
- h(this, "slotContent", {});
321
- h(this, "htmlSlotContent", {});
322
- h(this, "shadow");
323
- h(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] = R(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) => C(() => {
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
- h(O, "observedAttributes", []), h(O, "renderTagName", ""), h(O, "styles");
368
- const Mt = (e) => "render" in e && "setReactiveValue" in e, ot = "handleSlotContext", J = "onConnected", U = (e) => typeof e == "string" ? e : JSON.stringify(e), rt = (e) => {
369
- const t = document.createElement("span");
370
- return t.textContent = U(e), t;
371
- }, X = (e, t) => (e.appendChild(rt(t)), e), ct = (e, t) => (e.replaceChildren(), X(e, t)), q = (e) => {
372
- const t = document.createElement("span");
373
- return C(() => {
374
- const s = e();
375
- t.textContent = U(s);
376
- }), t;
377
- };
378
- class Z {
379
- constructor(t) {
380
- h(this, "wrapper");
381
- h(this, "keyedEffects", /* @__PURE__ */ new Map());
382
- h(this, "append", (...t) => (t.forEach((s) => {
383
- var o;
384
- const n = s.hostElement;
385
- n && ((o = this.hostElement) == null || o.appendChild(n), J in n && setTimeout(() => {
386
- var r;
387
- (r = n.onConnected) == null || r.call(
388
- n,
389
- s,
390
- n
391
- );
392
- }));
393
- }), this));
394
- h(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
- h(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
- h(this, "addHtmlContent", (t) => {
413
- const s = this.hostElement;
414
- return s ? (X(s, t), this) : this;
415
- });
416
- h(this, "setHtmlContent", (t) => {
417
- const s = this.hostElement;
418
- return s ? (ct(s, t), this) : this;
419
- });
420
- h(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 O))
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(k(t), o), !(n instanceof O)) {
435
- const c = t.toLowerCase();
436
- c in n && (n[c] = s);
437
- }
438
- return this;
439
- });
440
- h(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(k(t), n), this;
444
- });
445
- h(this, "setReactiveAttribute", (t, s) => (this.addEffect((n) => {
446
- n.setAttribute(t, s());
447
- }, t), this));
448
- h(this, "setReactiveCustomAttribute", (t, s) => (this.addEffect((n) => {
449
- n.setCustomAttribute(t, s());
450
- }), this));
451
- h(this, "removeAttribute", (t) => {
452
- var s;
453
- return (s = this.hostElement) == null || s.removeAttribute(k(t)), this;
454
- });
455
- h(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
- h(this, "onConnected", (t) => this.hostElement ? (Reflect.defineProperty(this.hostElement, J, {
469
- get() {
470
- return t;
471
- }
472
- }), this) : this);
473
- h(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
- h(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
- h(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
- h(this, "removeClass", (...t) => {
496
- var s;
497
- return (s = this.hostElement) == null || s.classList.remove(...t), this;
498
- });
499
- h(this, "replaceClass", (t, s) => {
500
- var n;
501
- return (n = this.hostElement) == null || n.classList.replace(t, s), this;
502
- });
503
- h(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 l = (r = this.keyedEffects.get(s)) == null ? void 0 : r.deref();
510
- l && F(l);
511
- }
512
- return (c = n.effectSet) == null || c.add(new WeakRef(o)), o.component = this.wrapper, C(o, { name: (s == null ? void 0 : s.toString()) || n.tagName }), this;
513
- });
514
- h(this, "addReactiveContent", (t) => {
515
- var s;
516
- return (s = this.hostElement) == null || s.appendChild(q(t)), this;
517
- });
518
- h(this, "setReactiveContent", (t) => {
519
- var s;
520
- return this.clear(), (s = this.hostElement) == null || s.appendChild(q(t)), this;
521
- });
522
- h(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 it extends Z {
539
- constructor() {
540
- super(...arguments);
541
- h(this, "setReactiveValue", (s) => (this.hostElement instanceof O && this.hostElement.setReactiveValue(s), this));
542
- h(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 _t = () => () => {
552
- }, lt = (e) => new it(new WeakRef(e)), at = (e) => new Z(new WeakRef(e)), ht = (e, ...t) => ({
553
- classList: [...e.map((s) => s.trim()).filter(Boolean), ...t]
554
- }), gt = (e, ...t) => ht(e, ...t), Q = (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 pt(n, t.classList), Et(n, t.style), Ct(n, t.attributes), mt(n, t.reactiveClassList), ut(n, t.customAttributes), ft(n, t.children), dt(n, t.effects), z(n, t.listeners), z(n, t.customListeners), n;
571
- }, z = (e, t) => {
572
- t && Object.entries(t).forEach(([s, n]) => {
573
- typeof n == "function" && e.addEventlistener(s, n);
574
- });
575
- }, dt = (e, t) => t == null ? void 0 : t.forEach((s) => e.addEffect(s)), ft = (e, t) => H(new WeakRef(e), ...t || []) ?? e, ut = (e, t) => {
576
- const s = t;
577
- s && Object.keys(s).forEach((n) => {
578
- y(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
- }, pt = (e, t) => e.addClass(...t || []), mt = (e, t) => e.addReactiveClass(t || {}), Et = (e, t) => e.addStyle(t || {}), Ct = (e, t) => {
583
- const s = t, n = (o, r) => {
584
- r && (y(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
- }, H = (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) : y(n) ? s.addReactiveContent(n) : s.append(n);
596
- }), s;
597
- }, x = (e, t) => {
598
- const s = document.createElement(e), n = at(s);
599
- return Q(new WeakRef(n), t) ?? n;
600
- }, V = (e, t) => {
601
- const [s, ...n] = e.split(" ").map((r) => r.trim()), o = x(s, t);
602
- return n.length > 0 && o.addClass(...n), (...r) => H(
603
- new WeakRef(o),
604
- ...r.filter(Boolean).flat().flatMap(
605
- (c) => typeof c == "function" && !y(c) ? A(() => c(o)) : c
606
- )
607
- ) ?? o;
608
- }, A = (e) => {
609
- const t = `getSignalContent_${Math.random().toString(36).substring(2, 15)}`;
610
- return x("div").addStyle({ display: "contents" }).addEffect((s) => {
611
- s.clear(), H(new WeakRef(s), ...[e()].flat());
612
- }, t);
613
- }, Ht = (e, t, s) => {
614
- const n = x("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
615
- let c = [];
616
- const l = /* @__PURE__ */ new Set();
617
- let f = e.peek();
618
- const b = (a) => {
619
- l.delete(a), o.delete(a), r.delete(a);
620
- };
621
- return C(() => {
622
- var p;
623
- const a = e();
624
- c = a.map(t).map((d) => typeof d == "string" ? d : d.toString());
625
- const u = Array.from(
626
- ((p = n.hostElement) == null ? void 0 : p.children) || []
627
- );
628
- m("containerChildren", u, c), u.forEach((d) => {
629
- const E = d.dataset.key;
630
- c.includes(E) || (m("remove element", E, d), d.remove(), b(E));
631
- }), c.forEach((d) => {
632
- var j, L, w;
633
- const E = a[c.indexOf(d)];
634
- o.has(d) ? JSON.stringify(E) !== JSON.stringify(f[c.indexOf(d)]) && ((L = (j = n.hostElement) == null ? void 0 : j.querySelector(`[data-key="${d}"]`)) == null || L.remove(), (w = o.get(d)) == null || w.set(Math.random().toString(36).substring(2, 15)), r.set(
635
- d,
636
- () => s(
637
- E,
638
- c.indexOf(d),
639
- a
640
- ).setCustomAttribute("data-key", d)
641
- )) : (m("create new element", d, E), o.set(
642
- d,
643
- R(Math.random().toString(36).substring(2, 15))
644
- ), r.set(
645
- d,
646
- () => s(
647
- E,
648
- c.indexOf(d),
649
- a
650
- ).setCustomAttribute("data-key", d)
651
- ));
652
- }), f = [...a.map((d) => ({ ...d }))];
653
- const S = () => {
654
- o.forEach((d, E) => {
655
- m(
656
- "key from setTimeout foreach currItemSignalMap",
657
- E
658
- ), l.has(E) || (l.add(E), C(() => {
659
- var B, N;
660
- d();
661
- const j = c.indexOf(E), L = (B = r.get(E)) == null ? void 0 : B();
662
- if (!L) return;
663
- m(
664
- "call effect from setTimeout",
665
- E,
666
- L.hostElement
667
- );
668
- const w = n.hostElement, T = L.hostElement;
669
- w && T && j <= w.children.length - 1 ? w.insertBefore(
670
- T,
671
- w.children[j]
672
- ) : T && ((N = n.hostElement) == null || N.append(
673
- T
674
- ));
675
- }));
676
- });
677
- };
678
- Promise.resolve().then(() => S());
679
- }), n;
680
- }, Pt = (e) => {
681
- let t = [x("div")], s = !1;
682
- return C(() => {
683
- var r, c;
684
- const n = e();
685
- s = Array.isArray(n);
686
- const o = [];
687
- o.push(...[n].flat()), o.length === 0 && o.push(
688
- x("div").addStyle({ display: "none" }).setAttribute("id", "empty_template")
689
- );
690
- try {
691
- m(
692
- "newReactiveComponent.map",
693
- o.map((l) => {
694
- var f;
695
- return m(
696
- "newReactiveComponent hostElement",
697
- l.hostElement
698
- ), (f = l.hostElement) == null ? void 0 : f.id;
699
- })
700
- ), m(
701
- "currComponent[0].hostElement?.id",
702
- (r = t[0].hostElement) == null ? void 0 : r.id,
703
- t
704
- ), (c = t[0].hostElement) == null || c.replaceWith(
705
- ...o.map((l) => l.hostElement).filter(Boolean)
706
- ), t.slice(1).forEach((l) => {
707
- var f;
708
- return (f = l.hostElement) == null ? void 0 : f.remove();
709
- }), t = o;
710
- } catch (l) {
711
- console.error(l);
712
- }
713
- }), s ? t : t[0];
714
- }, Ft = (e) => ot in e, Vt = (e) => {
715
- const t = V("div")().addStyle({ display: "contents" }), s = (n) => {
716
- const o = t.hostElement;
717
- return o && (o.innerHTML = n), t;
718
- };
719
- return typeof e == "string" ? s(e) : t.addEffect(() => {
720
- s(e());
721
- }), t;
722
- }, Y = (e, t, s) => e ? A(t) : s ? A(s) : V("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), bt = (e, t, s) => A(
723
- () => Y(!!e(), t, s)
724
- ), Bt = (e, t, s) => typeof e == "boolean" ? Y(e, t, s) : bt(e, t, s), D = (e, t) => A(t).addEffect((s, n) => {
725
- if (typeof e == "boolean")
726
- n.style.display = e ? "block" : "none";
727
- else {
728
- const o = e() ? "block" : "none";
729
- n.style.display = o;
730
- }
731
- }), Nt = (e, t, s) => {
732
- const n = [
733
- D(e, t)
734
- ].flat();
735
- return s && n.push(
736
- ...[
737
- D(
738
- () => typeof e == "boolean" ? !e : !e(),
739
- s
740
- )
741
- ].flat()
742
- ), A(() => n);
743
- }, St = (e, t) => {
744
- m("createCustomElement", e);
745
- const s = document.createElement(e), n = lt(s);
746
- return s.init = () => {
747
- Q(new WeakRef(n), t);
748
- }, n;
749
- }, yt = (e, t) => {
750
- const s = e.split(" ").slice(1).map((o) => o.trim()), n = St(e.split(" ")[0], t);
751
- return Array.isArray(s) && s.length > 0 && n.addClass(...s), (...o) => {
752
- const r = o.filter(Boolean).flat().flatMap(
753
- (l) => typeof l == "function" && !y(l) ? A(() => l(n)) : l
754
- ), c = n.hostElement;
755
- return c && (c.allSlotContent = r, c.slotContent = r.filter(et).reduce(
756
- (l, f) => {
757
- var a;
758
- const b = ((a = f.hostElement) == null ? void 0 : a.getAttribute("slot")) || "default";
759
- return l[b] || (l[b] = []), l[b].push(f), l;
760
- },
761
- {}
762
- ), c.appendAllSlotContent = () => {
763
- H(new WeakRef(n), ...r);
764
- }), n;
765
- };
766
- }, vt = (e, t, s) => yt(
767
- `${e.renderTagName}${t && typeof t == "string" ? " " + t : ""}`,
768
- $(t) ? t : t && typeof t == "string" ? s : void 0
769
- ), Jt = () => {
770
- const e = () => {
771
- };
772
- return e.oldValue = null, e;
773
- }, qt = () => ({}), wt = (e, t, s) => {
774
- const n = t ? G(t, s)(e) : e;
775
- return (o, ...r) => {
776
- const c = [...r];
777
- return o && !$(o) && c.unshift(o), vt(n, $(o) ? o : {})(...c);
778
- };
779
- }, zt = (e) => [
780
- wt(e),
781
- (t, s) => {
782
- G(t, s)(e);
783
- }
784
- ], i = {}, At = [
785
- "div",
786
- "span",
787
- "section",
788
- "input",
789
- "button",
790
- "table",
791
- "tr",
792
- "td",
793
- "th",
794
- "ul",
795
- "li",
796
- "ol",
797
- "form",
798
- "label",
799
- "select",
800
- "option",
801
- "textarea",
802
- "img",
803
- "a",
804
- "p",
805
- "h1",
806
- "h2",
807
- "h3",
808
- "h4",
809
- "h5",
810
- "h6",
811
- "br",
812
- "hr",
813
- "pre",
814
- "code",
815
- "nav",
816
- "header",
817
- "footer",
818
- "main",
819
- "aside",
820
- "article",
821
- "figure",
822
- "figcaption",
823
- "blockquote",
824
- "cite",
825
- "small",
826
- "strong",
827
- "em",
828
- "b",
829
- "i",
830
- "u",
831
- "s",
832
- "sub",
833
- "sup",
834
- "mark",
835
- "del",
836
- "ins",
837
- "details",
838
- "summary",
839
- "progress",
840
- "meter",
841
- "audio",
842
- "video",
843
- "canvas",
844
- "slot"
845
- ];
846
- At.forEach((e) => {
847
- i[e] = (t, ...s) => {
848
- let n = [...s];
849
- return t && !$(t) && (n = [t].concat(n)), V(e, $(t) ? t : {})(...n);
850
- };
851
- });
852
- const Dt = i.div, Gt = i.span, Ut = i.section, Xt = i.input, Zt = i.button, Qt = i.table, Yt = i.tr, Kt = i.td, te = i.th, ee = i.ul, se = i.li, ne = i.ol, oe = i.form, re = i.label, ce = i.select, ie = i.option, le = i.textarea, ae = i.img, he = i.a, de = i.p, fe = i.h1, ue = i.h2, pe = i.h3, me = i.h4, Ee = i.h5, Ce = i.h6, be = i.br, Se = i.hr, ye = i.pre, ve = i.code, we = i.nav, Ae = i.header, Re = i.footer, Le = i.main, Oe = i.aside, je = i.article, Ie = i.figure, $e = i.figcaption, xe = i.blockquote, Te = i.cite, We = i.small, ke = i.strong, Me = i.em, _e = i.b, ge = i.i, He = i.u, Pe = i.s, Fe = i.sub, Ve = i.sup, Be = i.mark, Ne = i.del, Je = i.ins, qe = i.details, ze = i.summary, De = i.progress, Ge = i.meter, Ue = i.audio, Xe = i.video, Ze = i.canvas, Qe = i.slot, Ye = (e) => (t) => e(t).addClass(...t.classList ?? []).addReactiveClass(t.reactiveClassList ?? {});
853
- export {
854
- O as BaseElement,
855
- he as a,
856
- Ct as addAttributeList,
857
- pt as addClassList,
858
- ut as addCustomAttributes,
859
- mt as addReactiveClassList,
860
- Et as addStyleList,
861
- H as appendContentItem,
862
- je as article,
863
- Oe as aside,
864
- Ue as audio,
865
- _e as b,
866
- $t as bindReactiveSignals,
867
- xe as blockquote,
868
- be as br,
869
- Zt as button,
870
- k as camelToKebab,
871
- Ze as canvas,
872
- P as checkCall,
873
- Ot as checkRef,
874
- Te as cite,
875
- ht as classList,
876
- gt as cls,
877
- ve as code,
878
- W as colorLog,
879
- Tt as combineLatest,
880
- G as component,
881
- zt as configCustomComponent,
882
- Ye as createComponent,
883
- vt as createCustom,
884
- yt as createCustomEl,
885
- St as createCustomElement,
886
- V as createEl,
887
- x as createElement,
888
- It as createSignal,
889
- lt as customElementHelpers,
890
- qt as defineSlotTemplate,
891
- Ne as del,
892
- qe as details,
893
- nt as disableLogs,
894
- Dt as div,
895
- C as effect,
896
- at as elementHelpers,
897
- Me as em,
898
- Lt as enableLogs,
899
- kt as event,
900
- _t as eventEmitter,
901
- $e as figcaption,
902
- Ie as figure,
903
- Re as footer,
904
- xt as forkJoin,
905
- oe as form,
906
- Ht as getList,
907
- A as getSignalContent,
908
- fe as h1,
909
- ue as h2,
910
- pe as h3,
911
- me as h4,
912
- Ee as h5,
913
- Ce as h6,
914
- Ae as header,
915
- Se as hr,
916
- ge as i,
917
- ae as img,
918
- Q as initComponent,
919
- Xt as input,
920
- Je as ins,
921
- Mt as isBaseElement,
922
- et as isComponentConfig,
923
- $ as isComponentInitConfig,
924
- y as isReactiveSignal,
925
- Ft as isSlotTemplate,
926
- st as kebabToCamel,
927
- re as label,
928
- se as li,
929
- Le as main,
930
- Be as mark,
931
- Ge as meter,
932
- we as nav,
933
- Jt as newEventEmitter,
934
- ne as ol,
935
- ie as option,
936
- de as p,
937
- ye as pre,
938
- De as progress,
939
- m as projectLog,
940
- Wt as property,
941
- F as removeEffect,
942
- Y as renderIf,
943
- jt as rs,
944
- bt as rxRenderIf,
945
- Pe as s,
946
- Ut as section,
947
- ce as select,
948
- ft as setChildren,
949
- dt as setEffects,
950
- z as setListeners,
951
- Nt as show,
952
- D as showIf,
953
- R as signal,
954
- Pt as signalComponent,
955
- Qe as slot,
956
- We as small,
957
- Gt as span,
958
- ke as strong,
959
- Fe as sub,
960
- ze as summary,
961
- Ve as sup,
962
- Qt as table,
963
- Kt as td,
964
- le as textarea,
965
- te as th,
966
- Yt as tr,
967
- He as u,
968
- ee as ul,
969
- Vt as unsafeHtml,
970
- wt as useCustomComponent,
971
- Xe as video,
972
- Bt as when
973
- };