@reactive-web-components/rwc 2.51.14 → 2.52.1

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