@reactive-web-components/rwc 2.58.1 → 2.60.0

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