@reactive-web-components/rwc 2.57.0 → 2.58.1

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