@reactive-web-components/rwc 2.55.1 → 2.55.3

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