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