@reactive-web-components/rwc 2.51.7 → 2.51.9

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.
Files changed (37) hide show
  1. package/package.json +32 -5
  2. package/main.d.ts +0 -0
  3. package/reactive-web-component.C6ivwJzW.js +0 -916
  4. package/reactive-web-component.D9B4LRRS.umd.cjs +0 -2
  5. package/shared/constants/constants.d.ts +0 -2
  6. package/shared/index.d.ts +0 -2
  7. package/shared/types/base-element.d.ts +0 -1
  8. package/shared/types/element.d.ts +0 -191
  9. package/shared/types/index.d.ts +0 -3
  10. package/shared/types/list.type.d.ts +0 -7
  11. package/shared/utils/helpers.d.ts +0 -7
  12. package/shared/utils/html-decorators/html-property.d.ts +0 -6
  13. package/shared/utils/html-decorators/index.d.ts +0 -1
  14. package/shared/utils/html-elements/__tests__/element.test.d.ts +0 -1
  15. package/shared/utils/html-elements/base-element.d.ts +0 -33
  16. package/shared/utils/html-elements/custom-element.d.ts +0 -11
  17. package/shared/utils/html-elements/element-helper.d.ts +0 -21
  18. package/shared/utils/html-elements/element.d.ts +0 -84
  19. package/shared/utils/html-elements/index.d.ts +0 -4
  20. package/shared/utils/html-fabric/custom-fabric.d.ts +0 -3
  21. package/shared/utils/html-fabric/fabric.d.ts +0 -67
  22. package/shared/utils/html-fabric/fn-component.d.ts +0 -5
  23. package/shared/utils/html-fabric/index.d.ts +0 -3
  24. package/shared/utils/index.d.ts +0 -5
  25. package/shared/utils/routing/router.d.ts +0 -10
  26. package/shared/utils/signal/helpers.types.d.ts +0 -3
  27. package/shared/utils/signal/index.d.ts +0 -3
  28. package/shared/utils/signal/signal.d.ts +0 -18
  29. package/shared/utils/signal/signal.type.d.ts +0 -18
  30. package/shared/utils/signal/utils.d.ts +0 -10
  31. package/test-components/examples/button/button.d.ts +0 -12
  32. package/test-components/examples/counter.d.ts +0 -15
  33. package/test-components/examples/test-list/dynamic-items-test.d.ts +0 -17
  34. package/test-components/examples/test-list/example.list.d.ts +0 -26
  35. package/test-components/examples/useCustomComponent.d.ts +0 -21
  36. package/test-components/examples/when.d.ts +0 -6
  37. package/test-components/tab-bar.d.ts +0 -23
@@ -1,916 +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 E = (t, e, s) => Z(t, typeof e != "symbol" ? e + "" : e, s);
4
- const $ = (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, W = (t, e, ...s) => {
7
- e && e.apply(t, s);
8
- };
9
- let P = !0;
10
- const b = (...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
- }, w = (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((i) => {
35
- const a = i.slice(1);
36
- return s[a] || "color: inherit";
37
- });
38
- let r = t;
39
- n.forEach((i) => {
40
- const a = new RegExp(`\\${i}([^\\s,]+)`, "g");
41
- r = r.replace(a, "%c$1");
42
- }), console.log(r, ...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 r = M[M.length - 1];
55
- if (r && !("fake" in r && r.fake)) {
56
- const i = L.get(r), a = i == null ? void 0 : i.parent;
57
- if (a) {
58
- const u = L.get(a);
59
- u == null || u.cleanupFns.add(() => {
60
- s.delete(r);
61
- });
62
- }
63
- s.add(r);
64
- }
65
- return t;
66
- }
67
- return o.getSubscribers = () => [...s], o.setCompareFn = function(r) {
68
- return n = r, 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(r) {
74
- o.oldValue = Object.freeze(t), t = r, s.forEach((i) => Promise.resolve(i).then((a) => {
75
- const u = L.get(a);
76
- u && u.cleanupFns.size > 0 && (u.cleanupFns.forEach((l) => l()), u.cleanupFns.clear()), g.push(a), a(), g.pop();
77
- }));
78
- }, o.set = function(r, i = n) {
79
- t !== r && i(t, r) && o.forceSet(r);
80
- }, o.update = function(r) {
81
- o.set(r(t));
82
- }, o.pipe = (r) => {
83
- const i = j(null);
84
- return C(() => {
85
- const a = r(o());
86
- a instanceof Promise ? a.then((u) => i.set(u)) : y(a) ? C(() => i.set(a())) : i.set(a);
87
- }), i;
88
- }, o;
89
- }
90
- function C(t) {
91
- const e = Date.now();
92
- b("current effect", `%c${e}%c`);
93
- const s = t;
94
- t = () => (b("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 C(() => {
104
- const n = e.map(
105
- (r) => y(r) ? String(r()) : String(r)
106
- ), o = [t[0]];
107
- n.forEach((r, i) => {
108
- o.push(r, t[i + 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" && C(() => {
115
- const o = t();
116
- o instanceof Promise ? o.then(n) : y(o) ? C(() => n(o())) : n(o);
117
- }), s;
118
- }
119
- function At(t, e) {
120
- let s = t(), n = e();
121
- C(() => {
122
- const o = t(), r = e();
123
- o !== r && (o !== s ? e.set(o) : r !== n && t.set(r)), s = o, n = r;
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
- C(() => {
131
- const r = () => e.filter((i) => i !== void 0).length;
132
- r() === t.length && (e = Array.from(e).fill(void 0)), e[o] = n(), r() === t.length && s.set([...e]);
133
- });
134
- }), s;
135
- }
136
- class O extends HTMLElement {
137
- constructor(s = !1) {
138
- super();
139
- E(this, "isSlotLazyLoading", !1);
140
- E(this, "slotTemplate");
141
- E(this, "slotContext");
142
- E(this, "rootStyle");
143
- E(this, "modelValue");
144
- E(this, "providers");
145
- E(this, "appendAllSlotContent");
146
- E(this, "allSlotContent", []);
147
- E(this, "slotContent", {});
148
- E(this, "htmlSlotContent", {});
149
- E(this, "shadow");
150
- E(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 r = s.slot || "default";
159
- this.htmlSlotContent[r] || (this.htmlSlotContent[r] = []), (o = this.htmlSlotContent[r]) == 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 b("%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
- b(
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) => C(() => {
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
- E(O, "observedAttributes", []), E(O, "renderTagName", ""), E(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
- }, D = (t, e) => (t.innerHTML = "", z(t, e)), B = (t) => {
202
- const e = document.createElement("div");
203
- return e.style.display = "contents", C(() => {
204
- const s = t();
205
- D(e, s);
206
- }), e;
207
- }, N = (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 D(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(w(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(w(e), n), this;
263
- },
264
- setReactiveAttribute(e, s) {
265
- return C(() => this.setAttribute(e, s())), this;
266
- },
267
- setReactiveCustomAttribute(e, s) {
268
- return C(() => this.setCustomAttribute(e, s())), this;
269
- },
270
- removeAttribute(e) {
271
- return t.removeAttribute(w(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 r = String(n() || "");
279
- t.style.setProperty(s, r);
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
- C(() => {
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 C(() => 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), ct(t, e.style), lt(t, e.attributes), it(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) => F(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 || []), it = (t, e) => t.addReactiveClass(e || {}), ct = (t, e) => t.addStyle(e || {}), lt = (t, e) => {
363
- const s = e, n = (o, r) => {
364
- r && (y(r) ? t.setReactiveAttribute(o, r) : typeof r == "function" ? t.addEffect(() => {
365
- t.setAttribute(o, r());
366
- }) : t.setAttribute(o, r));
367
- };
368
- s && Object.keys(s).forEach((o) => {
369
- n(o, s[o]);
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), R = (t, e) => {
374
- const s = document.createElement(t), n = {
375
- ...N(s)
376
- };
377
- return G(n, e);
378
- }, at = (t, e) => {
379
- const [s, ...n] = t.split(" ").map((r) => r.trim()), o = R(s, e);
380
- return n.length > 0 && o.addClass(...n), (...r) => F(
381
- o,
382
- ...r.filter(Boolean).map(
383
- (i) => typeof i == "function" && !y(i) ? S(() => i(o)) : i
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(), F(e, ...n);
392
- }), jt = (t, e, s) => {
393
- const n = R("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
394
- let i = [];
395
- const a = /* @__PURE__ */ new Set();
396
- let u = t.peek();
397
- const l = (h) => {
398
- a.delete(h), o.delete(h), r.delete(h);
399
- };
400
- return C(() => {
401
- const h = t();
402
- i = h.map(e).map((d) => typeof d == "string" ? d : d.toString());
403
- const p = Array.from(n.hostElement.children);
404
- b("containerChildren", p, i), p.forEach((d) => {
405
- const m = d.dataset.key;
406
- i.includes(m) || (b("remove element", m, d), d.remove(), l(m));
407
- }), i.forEach((d) => {
408
- var T, v;
409
- const m = h[i.indexOf(d)];
410
- o.has(d) ? JSON.stringify(m) !== JSON.stringify(u[i.indexOf(d)]) && ((T = n.hostElement.querySelector(`[data-key="${d}"]`)) == null || T.remove(), (v = o.get(d)) == null || v.set(Math.random().toString(36).substring(2, 15)), r.set(
411
- d,
412
- () => s(m, i.indexOf(d), h).setCustomAttribute(
413
- "data-key",
414
- d
415
- )
416
- )) : (b("create new element", d, m), o.set(
417
- d,
418
- j(Math.random().toString(36).substring(2, 15))
419
- ), r.set(
420
- d,
421
- () => s(m, i.indexOf(d), h).setCustomAttribute(
422
- "data-key",
423
- d
424
- )
425
- ));
426
- }), u = h;
427
- const f = () => {
428
- o.forEach((d, m) => {
429
- b("key from setTimeout foreach currItemSignalMap", m), a.has(m) || (a.add(m), C(() => {
430
- var H;
431
- d();
432
- const T = i.indexOf(m), v = (H = r.get(m)) == null ? void 0 : H();
433
- v && (b(
434
- "call effect from setTimeout",
435
- m,
436
- v.hostElement
437
- ), T <= n.hostElement.children.length - 1 ? n.hostElement.insertBefore(
438
- v.hostElement,
439
- n.hostElement.children[T]
440
- ) : n.hostElement.append(v.hostElement));
441
- }));
442
- });
443
- };
444
- Promise.resolve().then(() => f());
445
- }), n;
446
- }, Tt = (t, e, s) => {
447
- const n = R("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map();
448
- return C(() => {
449
- let r = Array.from(n.hostElement.children).map(
450
- (l) => l.dataset.key
451
- );
452
- const i = t(), a = i.map(e).map((l) => l.toString()), u = /* @__PURE__ */ new Map();
453
- i.forEach((l, h) => u.set(a[h], l)), r.filter((l) => !a.includes(l)).forEach(
454
- (l) => {
455
- var h;
456
- return (h = n.hostElement.querySelector(`[data-key="${l}"]`)) == null ? void 0 : h.remove();
457
- }
458
- ), r = r.filter(
459
- (l) => a.includes(l)
460
- ), a.forEach((l, h) => {
461
- if (r.includes(l)) {
462
- if (JSON.stringify(o.get(l)) !== JSON.stringify(u.get(l))) {
463
- const p = s(i[h], h, i).setCustomAttribute(
464
- "data-key",
465
- l
466
- ).hostElement;
467
- n.hostElement.querySelector(
468
- `[data-key="${l}"]`
469
- ).replaceWith(p);
470
- const f = n.hostElement.children;
471
- h > f.length - 2 ? n.hostElement.append(p) : n.hostElement.insertBefore(p, f[h + 1]);
472
- }
473
- } else {
474
- const p = s(i[h], h, i).setCustomAttribute(
475
- "data-key",
476
- l
477
- ), f = n.hostElement.children;
478
- h > f.length - 1 ? n.hostElement.append(p.hostElement) : n.hostElement.insertBefore(
479
- p.hostElement,
480
- f[h]
481
- );
482
- }
483
- }), i.forEach((l, h) => o.set(a[h], l));
484
- }), n;
485
- }, xt = (t) => {
486
- let e = [R("div")], s = !1;
487
- return C(() => {
488
- var r;
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
- (r = e[0].hostElement) == null || r.replaceWith(
495
- ...o.map((i) => i.hostElement)
496
- ), e.forEach((i) => {
497
- var a;
498
- return (a = i.hostElement) == null ? void 0 : a.remove();
499
- }), e = o;
500
- } catch (i) {
501
- console.error(i);
502
- }
503
- }), s ? e : e[0];
504
- }, $t = (t) => tt in t, wt = (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)), kt = (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
- b("createCustomElement", t);
524
- const s = document.createElement(t), n = {
525
- ...N(s),
526
- setReactiveValue(o) {
527
- return s instanceof O && s.setReactiveValue(o), this;
528
- },
529
- setSlotTemplate(o) {
530
- const r = s.slotTemplate;
531
- return r && Object.entries(o).forEach(([i, a]) => {
532
- r[i] = a;
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 r = o.filter(Boolean).map(
542
- (i) => typeof i == "function" && !y(i) ? S(() => i(n)) : i
543
- );
544
- return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(Q).reduce(
545
- (i, a) => {
546
- const u = a.hostElement.getAttribute("slot") || "default";
547
- return i[u] || (i[u] = []), i[u].push(a), i;
548
- },
549
- {}
550
- ), n.hostElement.appendAllSlotContent = () => F(n, ...r), n;
551
- };
552
- }, ft = (t, e, s) => ut(
553
- `${t.renderTagName}${e && typeof e == "string" ? " " + e : ""}`,
554
- $(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 = () => ({}), Ft = (t, e, s) => {
563
- const n = e ? Et(e, s)(t) : t;
564
- return (o, ...r) => {
565
- const i = [...r];
566
- return o && !$(o) && i.unshift(o), pt(n, $(o) ? o : {})(...i);
567
- };
568
- }, c = {}, 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
- c[t] = (e, ...s) => {
632
- let n = [...s];
633
- return e && !$(e) && (n = [e].concat(n)), V(t, $(e) ? e : {})(...n);
634
- };
635
- });
636
- const Ct = c.div, Wt = c.span, Ht = c.section, _t = c.input, Bt = c.button, Jt = c.table, qt = c.tr, zt = c.td, Dt = c.th, Nt = c.ul, Gt = c.li, Vt = c.ol, Ut = c.form, Xt = c.label, Zt = c.select, Qt = c.option, Yt = c.textarea, Kt = c.img, te = c.a, ee = c.p, se = c.h1, ne = c.h2, oe = c.h3, re = c.h4, ie = c.h5, ce = c.h6, le = c.br, ae = c.hr, he = c.pre, de = c.code, ue = c.nav, fe = c.header, pe = c.footer, me = c.main, Ce = c.aside, Ee = c.article, be = c.figure, ye = c.figcaption, Se = c.blockquote, ve = c.cite, Ae = c.small, ge = c.strong, Le = c.em, Oe = c.b, Re = c.i, je = c.u, Te = c.s, xe = c.sub, $e = c.sup, we = c.mark, ke = c.del, Ie = c.ins, Me = c.details, Pe = c.summary, Fe = c.progress, We = c.meter, He = c.audio, _e = c.video, Be = c.canvas, Je = c.slot, qe = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", I = "EVENT_CONFIG", x = "observedAttributes", ze = () => (t, e) => {
637
- Reflect.get(t, x) || Reflect.defineProperty(t, x, {
638
- value: []
639
- }), Reflect.get(t, x).push(
640
- w(e)
641
- );
642
- }, De = (t) => (e, s) => {
643
- Reflect.get(e, k) || Reflect.defineProperty(e, k, {
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, k).push(s);
651
- }, Et = (t, e = !1) => (s) => {
652
- b(
653
- t,
654
- "start register static attr",
655
- s.prototype[x]
656
- );
657
- const n = [];
658
- if (s.styles) {
659
- const r = s.styles, i = [];
660
- Array.isArray(r) ? i.push(...r) : i.push(r), i.forEach((a) => {
661
- const u = new CSSStyleSheet();
662
- u.replaceSync(a), n.push(u);
663
- const l = new CSSStyleSheet();
664
- l.replaceSync(a.slice(a.indexOf("@property"))), document.adoptedStyleSheets.push(l);
665
- });
666
- }
667
- class o extends s {
668
- constructor(...a) {
669
- b("constructor", `%c${t}%c`);
670
- super(e, ...a);
671
- E(this, "isFirstRender", !0);
672
- A("@osheet", n), n.length > 0 && this.shadow.adoptedStyleSheets.push(...n);
673
- }
674
- render() {
675
- let a = Ct();
676
- const u = () => {
677
- a = s.prototype.render.call(this);
678
- };
679
- return u.fake = !0, C(u), a;
680
- }
681
- attributeChangedCallback(a, u, l) {
682
- b(
683
- "%cAttribute has changed.%c",
684
- `%c${a}%c`,
685
- `oldValue: ${u}, newValue: ${l}`,
686
- `%c${t}%c`
687
- );
688
- try {
689
- l = JSON.parse(l);
690
- } catch {
691
- }
692
- const h = Y(a);
693
- if (h in this && y(this[h])) {
694
- const p = this[h];
695
- l === null ? (p.set(p.initValue), this.removeAttribute(a)) : p.set(l);
696
- }
697
- W(
698
- this,
699
- s.prototype.attributeChangedCallback,
700
- a,
701
- u,
702
- l
703
- );
704
- }
705
- connectedCallback() {
706
- var u;
707
- b("connectedCallback", `%c${t}%c`, this), this.providers && Object.keys(this.providers).length > 0 && (b("WRAPPER for providers", t), Object.entries(this.providers).forEach(
708
- ([l, h]) => {
709
- b("register provider", l, h()), this.addEventListener(l, (p) => {
710
- var d;
711
- b("send provider", l, h());
712
- const f = p;
713
- ((d = f.detail) == null ? void 0 : d.context) === l && (f.stopPropagation(), f.detail.callback(h));
714
- });
715
- }
716
- )), this.checkInjects(), (u = s.prototype[k]) == null || u.forEach(
717
- (l) => {
718
- this[l] = (h) => {
719
- const p = s.prototype[I][l], { bubbles: f, composed: d } = p;
720
- y(h) ? C(() => {
721
- A("@oemit reactive value", h()), this.dispatchEvent(
722
- new CustomEvent(l, {
723
- detail: h(),
724
- bubbles: f,
725
- composed: d
726
- })
727
- );
728
- }) : (A("@oemit value", h), this.dispatchEvent(
729
- new CustomEvent(l, {
730
- detail: h,
731
- bubbles: f,
732
- composed: d
733
- })
734
- ));
735
- };
736
- }
737
- ), b("start render", `%c${t}%c`, t);
738
- const a = () => {
739
- if (setTimeout(() => {
740
- W(this, s.prototype.connectedCallback);
741
- }), !this.isFirstRender) return;
742
- const l = this.render();
743
- this.shadow.appendChild(l.hostElement), this.appendSlotContent(), this.isFirstRender = !1;
744
- };
745
- if (this.rootStyle && !s.styles) {
746
- const l = (f) => f instanceof Promise || Array.isArray(f) && f.every((d) => d instanceof Promise), h = this.rootStyle, p = (f) => {
747
- const d = new CSSStyleSheet();
748
- d.replaceSync(f), this.shadow.adoptedStyleSheets.push(d);
749
- const m = new CSSStyleSheet();
750
- m.replaceSync(f.slice(f.indexOf("@property"))), document.adoptedStyleSheets.push(m);
751
- };
752
- if (l(h)) {
753
- const f = [];
754
- Array.isArray(h) ? f.push(...h) : f.push(h), Promise.all(f).then((d) => d.forEach((m) => p(m.default))).then(() => a());
755
- } else {
756
- const f = [];
757
- Array.isArray(h) ? f.push(...h) : f.push(h), f.forEach((d) => p(d)), a();
758
- }
759
- } else
760
- a();
761
- this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((l) => {
762
- b(
763
- this.slotContext,
764
- this.slotContext && this.slotContext[l.name]
765
- ), A(
766
- "@bslot element",
767
- l,
768
- `name:${l.name};`,
769
- l.assignedElements()
770
- ), l.assignedElements().forEach((h) => {
771
- const p = this.slotContext[l.name];
772
- this.slotContext && y(p) && (A(
773
- "@oslot element",
774
- l,
775
- `name:${l.name};`,
776
- l.assignedElements()
777
- ), C(() => {
778
- h.dispatchEvent(
779
- new CustomEvent("handleSlotContext", {
780
- detail: p()
781
- })
782
- );
783
- }));
784
- });
785
- });
786
- }
787
- disconnectedCallback() {
788
- W(this, s.prototype.disconnectedCallback);
789
- }
790
- }
791
- return E(o, "observedAttributes", s.prototype[x] ?? []), E(o, "renderTagName", t), o.toString = () => t, customElements.get(t) ? console.error(
792
- `название тега ${t} повторяется, компонент ${s.name} не зарегистрирован`
793
- ) : customElements.define(t, o), o;
794
- };
795
- export {
796
- O as BaseElement,
797
- te as a,
798
- lt as addAttributeList,
799
- rt as addClassList,
800
- ot as addCustomAttributes,
801
- z as addHtmlContent,
802
- it as addReactiveClassList,
803
- ct as addStyleList,
804
- F as appendContentItem,
805
- Ee as article,
806
- Ce as aside,
807
- He as audio,
808
- Oe as b,
809
- At as bindReactiveSignals,
810
- Se as blockquote,
811
- le as br,
812
- Bt as button,
813
- w as camelToKebab,
814
- Be as canvas,
815
- W as checkCall,
816
- ve as cite,
817
- et as classList,
818
- Rt as cls,
819
- de as code,
820
- A as colorLog,
821
- Et as component,
822
- qe as createComponent,
823
- ft as createCustom,
824
- ut as createCustomEl,
825
- dt as createCustomElement,
826
- at as createEl,
827
- R as createElement,
828
- vt as createSignal,
829
- pt as customEl,
830
- Pt as defineSlotTemplate,
831
- ke as del,
832
- Me as details,
833
- K as disableLogs,
834
- Ct as div,
835
- C as effect,
836
- V as el,
837
- N as elementHelpers,
838
- Le as em,
839
- yt as enableLogs,
840
- De as event,
841
- Ot as eventEmitter,
842
- ye as figcaption,
843
- be as figure,
844
- pe as footer,
845
- gt as forkJoin,
846
- Ut as form,
847
- jt as getList,
848
- S as getSignalContent,
849
- se as h1,
850
- ne as h2,
851
- oe as h3,
852
- re as h4,
853
- ie as h5,
854
- ce as h6,
855
- fe as header,
856
- ae as hr,
857
- B as htmlEffectWrapper,
858
- Re as i,
859
- Kt as img,
860
- G as initComponent,
861
- _t as input,
862
- Ie as ins,
863
- Lt as isBaseElement,
864
- Q as isComponentConfig,
865
- $ as isComponentInitConfig,
866
- y as isReactiveSignal,
867
- $t as isSlotTemplate,
868
- Y as kebabToCamel,
869
- Xt as label,
870
- Gt as li,
871
- me as main,
872
- we as mark,
873
- We as meter,
874
- ue as nav,
875
- Mt as newEventEmitter,
876
- Vt as ol,
877
- Tt as oldGetList,
878
- Qt as option,
879
- ee as p,
880
- he as pre,
881
- Fe as progress,
882
- b as projectLog,
883
- ze as property,
884
- U as renderIf,
885
- St as rs,
886
- ht as rxRenderIf,
887
- Te as s,
888
- Ht as section,
889
- Zt as select,
890
- nt as setChildren,
891
- st as setEffects,
892
- D as setHtmlContent,
893
- J as setListeners,
894
- It as show,
895
- q as showIf,
896
- j as signal,
897
- xt as signalComponent,
898
- Je as slot,
899
- Ae as small,
900
- Wt as span,
901
- ge as strong,
902
- xe as sub,
903
- Pe as summary,
904
- $e as sup,
905
- Jt as table,
906
- zt as td,
907
- Yt as textarea,
908
- Dt as th,
909
- qt as tr,
910
- je as u,
911
- Nt as ul,
912
- wt as unsafeHtml,
913
- Ft as useCustomComponent,
914
- _e as video,
915
- kt as when
916
- };