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