@reactive-web-components/rwc 2.55.3 → 2.56.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,875 +0,0 @@
1
- var et = Object.defineProperty;
2
- var st = (t, e, s) => e in t ? et(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var p = (t, e, s) => st(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), nt = (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()}`), rt = (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
- }, Ot = () => {
44
- F = !0;
45
- }, ot = () => {
46
- F = !1;
47
- };
48
- ot();
49
- const O = [];
50
- let q = !1;
51
- const jt = (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 xt(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 Tt(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 Mt(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 $t(...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 It = (...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", kt = () => (t, e) => {
166
- Reflect.get(t, T) || Reflect.defineProperty(t, T, {
167
- value: []
168
- }), Reflect.get(t, T).push(
169
- I(e)
170
- );
171
- }, Pt = (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
- }, it = (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 = rt(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 Ht = (t) => "render" in t && "setReactiveValue" in t, at = "handleSlotContext", z = "onConnected", Z = (t) => typeof t == "string" ? t : JSON.stringify(t), lt = (t) => {
387
- const e = document.createElement("span");
388
- return e.textContent = Z(t), e;
389
- }, Q = (t, e) => (t.appendChild(lt(e)), t), ct = (t, e) => (t.innerHTML = "", Q(t, e)), G = (t) => {
390
- const e = document.createElement("span");
391
- return E(() => {
392
- const s = t();
393
- e.textContent = Z(s);
394
- }), e;
395
- };
396
- class Y {
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) => (Q(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 Y {
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 Wt = () => () => {
506
- }, pt = (t) => new ht(t), dt = (t) => new Y(t), ft = (t, ...e) => ({
507
- classList: [...t.map((s) => s.trim()).filter(Boolean), ...e]
508
- }), _t = (t, ...e) => ft(t, ...e), K = (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 K(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
- }), Ft = (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
- }, Bt = (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
- }, Jt = (t) => at in t, qt = (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
- }, tt = (t, e, s) => t ? g(e) : s ? g(s) : D("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), wt = (t, e, s) => g(() => tt(!!t(), e, s)), Dt = (t, e, s) => typeof t == "boolean" ? tt(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
- }, Nt = (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 K(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(nt).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
- ), zt = () => {
678
- const t = () => {
679
- };
680
- return t.oldValue = null, t;
681
- }, Gt = () => ({}), Vt = (t, e, s) => {
682
- const n = e ? it(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
- }, i = {}, Lt = [
688
- "div",
689
- "span",
690
- "section",
691
- "input",
692
- "button",
693
- "table",
694
- "tr",
695
- "td",
696
- "th",
697
- "ul",
698
- "li",
699
- "ol",
700
- "form",
701
- "label",
702
- "select",
703
- "option",
704
- "textarea",
705
- "img",
706
- "a",
707
- "p",
708
- "h1",
709
- "h2",
710
- "h3",
711
- "h4",
712
- "h5",
713
- "h6",
714
- "br",
715
- "hr",
716
- "pre",
717
- "code",
718
- "nav",
719
- "header",
720
- "footer",
721
- "main",
722
- "aside",
723
- "article",
724
- "figure",
725
- "figcaption",
726
- "blockquote",
727
- "cite",
728
- "small",
729
- "strong",
730
- "em",
731
- "b",
732
- "i",
733
- "u",
734
- "s",
735
- "sub",
736
- "sup",
737
- "mark",
738
- "del",
739
- "ins",
740
- "details",
741
- "summary",
742
- "progress",
743
- "meter",
744
- "audio",
745
- "video",
746
- "canvas",
747
- "slot"
748
- ];
749
- Lt.forEach((t) => {
750
- i[t] = (e, ...s) => {
751
- let n = [...s];
752
- return e && !M(e) && (n = [e].concat(n)), D(t, M(e) ? e : {})(...n);
753
- };
754
- });
755
- const Ut = i.div, Xt = i.span, Zt = i.section, Qt = i.input, Yt = i.button, Kt = i.table, te = i.tr, ee = i.td, se = i.th, ne = i.ul, re = i.li, oe = i.ol, ie = i.form, ae = i.label, le = i.select, ce = i.option, he = i.textarea, pe = i.img, de = i.a, fe = i.p, ue = i.h1, me = i.h2, Ce = i.h3, Ee = i.h4, be = i.h5, Se = i.h6, ye = i.br, we = i.hr, ve = i.pre, Ae = i.code, ge = i.nav, Le = i.header, Re = i.footer, Oe = i.main, je = i.aside, xe = i.article, Te = i.figure, Me = i.figcaption, $e = i.blockquote, Ie = i.cite, ke = i.small, Pe = i.strong, He = i.em, We = i.b, _e = i.i, Fe = i.u, Be = i.s, Je = i.sub, qe = i.sup, De = i.mark, Ne = i.del, ze = i.ins, Ge = i.details, Ve = i.summary, Ue = i.progress, Xe = i.meter, Ze = i.audio, Qe = i.video, Ye = i.canvas, Ke = i.slot, ts = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {});
756
- export {
757
- x as BaseElement,
758
- de as a,
759
- yt as addAttributeList,
760
- Et as addClassList,
761
- Ct as addCustomAttributes,
762
- bt as addReactiveClassList,
763
- St as addStyleList,
764
- B as appendContentItem,
765
- xe as article,
766
- je as aside,
767
- Ze as audio,
768
- We as b,
769
- Mt as bindReactiveSignals,
770
- $e as blockquote,
771
- ye as br,
772
- Yt as button,
773
- I as camelToKebab,
774
- Ye as canvas,
775
- J as checkCall,
776
- Ie as cite,
777
- ft as classList,
778
- _t as cls,
779
- Ae as code,
780
- R as colorLog,
781
- It as combineLatest,
782
- it as component,
783
- ts as createComponent,
784
- gt as createCustom,
785
- At as createCustomEl,
786
- vt as createCustomElement,
787
- D as createEl,
788
- $ as createElement,
789
- Tt as createSignal,
790
- pt as customElementHelpers,
791
- Gt as defineSlotTemplate,
792
- Ne as del,
793
- Ge as details,
794
- ot as disableLogs,
795
- Ut as div,
796
- E as effect,
797
- X as effectMap,
798
- dt as elementHelpers,
799
- He as em,
800
- Ot as enableLogs,
801
- Pt as event,
802
- Wt as eventEmitter,
803
- Me as figcaption,
804
- Te as figure,
805
- Re as footer,
806
- $t as forkJoin,
807
- ie as form,
808
- Ft as getList,
809
- g as getSignalContent,
810
- ue as h1,
811
- me as h2,
812
- Ce as h3,
813
- Ee as h4,
814
- be as h5,
815
- Se as h6,
816
- Le as header,
817
- we as hr,
818
- _e as i,
819
- pe as img,
820
- K as initComponent,
821
- Qt as input,
822
- ze as ins,
823
- Ht as isBaseElement,
824
- nt as isComponentConfig,
825
- M as isComponentInitConfig,
826
- S as isReactiveSignal,
827
- Jt as isSlotTemplate,
828
- rt as kebabToCamel,
829
- ae as label,
830
- re as li,
831
- Oe as main,
832
- De as mark,
833
- Xe as meter,
834
- ge as nav,
835
- zt as newEventEmitter,
836
- oe as ol,
837
- ce as option,
838
- fe as p,
839
- ve as pre,
840
- Ue as progress,
841
- C as projectLog,
842
- kt as property,
843
- tt as renderIf,
844
- xt as rs,
845
- wt as rxRenderIf,
846
- Be as s,
847
- Zt as section,
848
- le as select,
849
- mt as setChildren,
850
- jt as setEffectDebugEnabled,
851
- ut as setEffects,
852
- V as setListeners,
853
- Nt as show,
854
- U as showIf,
855
- L as signal,
856
- Bt as signalComponent,
857
- Ke as slot,
858
- ke as small,
859
- Xt as span,
860
- Pe as strong,
861
- Je as sub,
862
- Ve as summary,
863
- qe as sup,
864
- Kt as table,
865
- ee as td,
866
- he as textarea,
867
- se as th,
868
- te as tr,
869
- Fe as u,
870
- ne as ul,
871
- qt as unsafeHtml,
872
- Vt as useCustomComponent,
873
- Qe as video,
874
- Dt as when
875
- };