@reactive-web-components/rwc 2.54.0 → 2.54.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.
package/README.md CHANGED
@@ -215,6 +215,34 @@ city.set('SPB'); // userData updates to ['Jane', 30, 'SPB']
215
215
  - Creating composite objects from multiple sources
216
216
  - Waiting for all dependencies to update before executing actions
217
217
 
218
+ #### combineLatest
219
+
220
+ Combines multiple signals into one that updates whenever any of the source signals receives a new value. Unlike `forkJoin`, which waits for all signals to update, `combineLatest` immediately updates when any signal changes.
221
+
222
+ ```typescript
223
+ import { combineLatest, signal } from '@shared/utils';
224
+
225
+ const name = signal('John');
226
+ const age = signal(25);
227
+ const city = signal('Moscow');
228
+
229
+ const userData = combineLatest(name, age, city);
230
+ // userData() returns ['John', 25, 'Moscow']
231
+
232
+ name.set('Jane'); // userData immediately updates to ['Jane', 25, 'Moscow']
233
+ age.set(30); // userData immediately updates to ['Jane', 30, 'Moscow']
234
+ city.set('SPB'); // userData immediately updates to ['Jane', 30, 'SPB']
235
+ ```
236
+
237
+ **Application:**
238
+ - Real-time synchronization of multiple data sources
239
+ - Creating reactive computed values from multiple signals
240
+ - Updating UI immediately when any dependency changes
241
+
242
+ **Differences between `forkJoin` and `combineLatest`:**
243
+ - **`forkJoin`** — waits for all signals to update before emitting a new value. Useful when you need all values to be updated together.
244
+ - **`combineLatest`** — emits a new value immediately when any signal changes. Useful for real-time updates and reactive computations.
245
+
218
246
  ### Function as Child Content (recommended style for dynamic lists and conditional render)
219
247
 
220
248
  Functions passed as child content to `el` or `customEl` are automatically converted to reactive content. This allows convenient creation of dynamic content that will update when dependent signals change. The content function receives context (a reference to its component) as the first argument.
@@ -1227,18 +1255,25 @@ const MyCounter = Counter({
1227
1255
 
1228
1256
  #### Example: Working with Signal Utilities
1229
1257
  ```typescript
1230
- import { bindReactiveSignals, forkJoin, signal } from '@shared/utils';
1258
+ import { bindReactiveSignals, forkJoin, combineLatest, signal } from '@shared/utils';
1231
1259
 
1232
1260
  // Two-way binding
1233
1261
  const inputValue = signal('');
1234
1262
  const displayValue = signal('');
1235
1263
  bindReactiveSignals(inputValue, displayValue);
1236
1264
 
1237
- // Combining signals
1265
+ // Combining signals with forkJoin (waits for all to update)
1238
1266
  const name = signal('John');
1239
1267
  const age = signal(25);
1240
1268
  const userInfo = forkJoin(name, age);
1241
1269
  // userInfo() returns ['John', 25] only when both signals update
1270
+
1271
+ // Combining signals with combineLatest (updates on any change)
1272
+ const firstName = signal('John');
1273
+ const lastName = signal('Doe');
1274
+ const fullName = combineLatest(firstName, lastName);
1275
+ // fullName() returns ['John', 'Doe'] and updates immediately when either signal changes
1276
+ firstName.set('Jane'); // fullName() immediately becomes ['Jane', 'Doe']
1242
1277
  ```
1243
1278
 
1244
1279
  #### Example: Event Handling
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reactive-web-components/rwc",
3
- "version": "2.54.0",
3
+ "version": "2.54.3",
4
4
  "type": "module",
5
5
  "types": "./shared/index.d.ts",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./shared/index.d.ts",
9
- "import": "./reactive-web-component.T3Qg0HMS.js",
10
- "require": "./reactive-web-component.BDKz51Vi.umd.cjs"
9
+ "import": "./reactive-web-component.D0Ecujpb.js",
10
+ "require": "./reactive-web-component.Do5weOHn.umd.cjs"
11
11
  }
12
12
  },
13
13
  "author": "tamazyanarsen",
@@ -34,6 +34,6 @@
34
34
  "ui",
35
35
  "frontend"
36
36
  ],
37
- "module": "./reactive-web-component.T3Qg0HMS.js",
38
- "main": "./reactive-web-component.BDKz51Vi.umd.cjs"
37
+ "module": "./reactive-web-component.D0Ecujpb.js",
38
+ "main": "./reactive-web-component.Do5weOHn.umd.cjs"
39
39
  }
@@ -1,9 +1,9 @@
1
- var Q = Object.defineProperty;
2
- var Y = (t, e, s) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var C = (t, e, s) => Y(t, typeof e != "symbol" ? e + "" : e, s);
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 C = (t, e, s) => K(t, typeof e != "symbol" ? e + "" : e, s);
4
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
5
  (e) => e.startsWith(".") || e.startsWith("@") || e.startsWith("$")
6
- )) && !("hostElement" in t), K = (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, _ = (t, e, ...s) => {
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, _ = (t, e, ...s) => {
7
7
  e && e.apply(t, s);
8
8
  };
9
9
  let F = !0;
@@ -12,7 +12,7 @@ const u = (...t) => {
12
12
  ["[rwc]", ...t].join(" | "),
13
13
  ...Array.from(t.join("").matchAll(/%c/gm)).map((e, s) => s % 2 === 0 ? "color:red" : "color:inherit")
14
14
  );
15
- }, $ = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`), tt = (t) => t.replace(/-(\w)/gm, (e, s) => s.toUpperCase()), L = (t, ...e) => {
15
+ }, $ = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`), et = (t) => t.replace(/-(\w)/gm, (e, s) => s.toUpperCase()), g = (t, ...e) => {
16
16
  if (!F) return;
17
17
  const s = {
18
18
  r: "color: #ff0000",
@@ -31,27 +31,30 @@ const u = (...t) => {
31
31
  // orange
32
32
  w: "color: #808080"
33
33
  // gray (w for white/gray)
34
- }, n = t.match(/@[rgbpycow]/g) || [], o = n.map((i) => {
35
- const a = i.slice(1);
34
+ }, n = t.match(/@[rgbpycow]/g) || [], o = n.map((l) => {
35
+ const a = l.slice(1);
36
36
  return s[a] || "color: inherit";
37
37
  });
38
38
  let r = t;
39
- n.forEach((i) => {
40
- const a = new RegExp(`\\${i}([^\\s,]+)`, "g");
39
+ n.forEach((l) => {
40
+ const a = new RegExp(`\\${l}([^\\s,]+)`, "g");
41
41
  r = r.replace(a, "%c$1");
42
42
  }), console.log(r, ...o, ...e);
43
- }, vt = () => {
43
+ }, At = () => {
44
44
  F = !0;
45
- }, et = () => {
45
+ }, st = () => {
46
46
  F = !1;
47
47
  };
48
- et();
49
- const V = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), I = [], g = [];
48
+ st();
49
+ let B = !1;
50
+ const gt = (t) => {
51
+ B = t;
52
+ }, V = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), I = [], L = [];
50
53
  function A(t, e) {
51
54
  const s = /* @__PURE__ */ new Set();
52
55
  let n = (e == null ? void 0 : e.signalCompareFn) || (() => !0);
53
56
  function o() {
54
- var i;
57
+ var l;
55
58
  const r = I[I.length - 1];
56
59
  if (r && !("fake" in r && r.fake)) {
57
60
  const a = R.get(r), c = a == null ? void 0 : a.parent;
@@ -61,7 +64,7 @@ function A(t, e) {
61
64
  s.delete(r);
62
65
  });
63
66
  }
64
- s.add(r), (i = V.get(r.effectId)) == null || i.signals.push(o);
67
+ s.add(r), B && ((l = V.get(r.effectId)) == null || l.signals.push(o));
65
68
  }
66
69
  return t;
67
70
  }
@@ -72,22 +75,24 @@ function A(t, e) {
72
75
  }, o.peek = function() {
73
76
  return Object.freeze(t);
74
77
  }, o.initValue = Object.freeze(t), o.oldValue = Object.freeze(t), o.forceSet = function(r) {
75
- o.oldValue = Object.freeze(t), t = r, s.forEach((i) => Promise.resolve(i).then((a) => {
76
- const c = R.get(a);
77
- c && c.cleanupFns.size > 0 && (c.cleanupFns.forEach((d) => d()), c.cleanupFns.clear()), g.push(a), a(), g.pop();
78
- }));
79
- }, o.set = function(r, i = n) {
80
- t !== r && i(t, r) && o.forceSet(r);
78
+ o.oldValue = Object.freeze(t), t = r, s.forEach(
79
+ (l) => Promise.resolve(l).then((a) => {
80
+ const c = R.get(a);
81
+ c && c.cleanupFns.size > 0 && (c.cleanupFns.forEach((d) => d()), c.cleanupFns.clear()), L.push(a), a(), L.pop();
82
+ })
83
+ );
84
+ }, o.set = function(r, l = n) {
85
+ t !== r && l(t, r) && o.forceSet(r);
81
86
  }, o.update = function(r) {
82
87
  o.set(r(t));
83
- }, o.pipe = (r, i) => {
88
+ }, o.pipe = (r, l) => {
84
89
  const a = A(null);
85
90
  return m(() => {
86
91
  const c = o();
87
92
  m(() => {
88
93
  const d = r(c);
89
94
  d instanceof Promise ? d.then((f) => a.set(f)) : y(d) ? m(() => a.set(d())) : a.set(d);
90
- }, i);
95
+ }, l);
91
96
  }), a;
92
97
  }, o;
93
98
  }
@@ -96,48 +101,51 @@ function m(t, e) {
96
101
  u("current effect", `%c${s}%c`);
97
102
  const n = t;
98
103
  t = () => (u("current effect callback", `%c${s}%c`), n()), "fake" in n && n.fake && (t.fake = !0), t.effectId = s;
99
- const o = g[g.length - 1];
100
- V.set(s, { signals: [], parent: (o == null ? void 0 : o.effectId) || null }), R.has(t) || R.set(t, { cleanupFns: /* @__PURE__ */ new Set() });
104
+ const o = L[L.length - 1];
105
+ B && V.set(s, {
106
+ signals: [],
107
+ parent: (o == null ? void 0 : o.effectId) || null
108
+ }), R.has(t) || R.set(t, { cleanupFns: /* @__PURE__ */ new Set() });
101
109
  const r = R.get(t);
102
- o ? r.parent = o : delete r.parent, g.push(t), I.push(t), t(), I.pop(), g.pop();
110
+ o ? r.parent = o : delete r.parent, L.push(t), I.push(t), t(), I.pop(), L.pop();
103
111
  }
104
112
  const y = (t) => !!t && ["object", "function"].includes(typeof t) && "set" in t && "oldValue" in t && "update" in t && "forceSet" in t;
105
- function At(t, ...e) {
113
+ function Lt(t, ...e) {
106
114
  const s = A("");
107
115
  return m(() => {
108
116
  const n = e.map(
109
117
  (r) => y(r) ? String(r()) : String(r)
110
118
  ), o = [t[0]];
111
- n.forEach((r, i) => {
112
- o.push(r, t[i + 1]);
119
+ n.forEach((r, l) => {
120
+ o.push(r, t[l + 1]);
113
121
  }), s.set(o.join(""));
114
122
  }), s;
115
123
  }
116
- function Lt(t, e) {
124
+ function Rt(t, e) {
117
125
  const s = A(e ?? null), n = (o) => s.set(o);
118
126
  return t instanceof Promise ? t.then(n) : typeof t == "function" && m(() => {
119
127
  const o = t();
120
128
  o instanceof Promise ? o.then(n) : y(o) ? m(() => n(o())) : n(o);
121
129
  }), s;
122
130
  }
123
- function gt(t, e) {
131
+ function Ot(t, e) {
124
132
  let s = t(), n = e();
125
133
  m(() => {
126
134
  const o = t(), r = e();
127
135
  o !== r && (o !== s ? e.set(o) : r !== n && t.set(r)), s = o, n = r;
128
136
  });
129
137
  }
130
- function Rt(...t) {
138
+ function jt(...t) {
131
139
  let e = t.map((n) => n());
132
140
  const s = A(e);
133
141
  return t.forEach((n, o) => {
134
142
  m(() => {
135
- const r = () => e.filter((i) => i !== void 0).length;
143
+ const r = () => e.filter((l) => l !== void 0).length;
136
144
  r() === t.length && (e = Array.from(e).fill(void 0)), e[o] = n(), r() === t.length && s.set([...e]);
137
145
  });
138
146
  }), s;
139
147
  }
140
- const Ot = (...t) => {
148
+ const Tt = (...t) => {
141
149
  const e = A([]);
142
150
  return m(() => {
143
151
  e.set(t.map((s) => s()));
@@ -202,20 +210,20 @@ class O extends HTMLElement {
202
210
  }
203
211
  }
204
212
  C(O, "observedAttributes", []), C(O, "renderTagName", ""), C(O, "styles");
205
- const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotContext", J = "onConnected", Tt = () => () => {
206
- }, D = (t) => typeof t == "string" ? t : JSON.stringify(t), G = (t) => {
213
+ const xt = (t) => "render" in t && "setReactiveValue" in t, nt = "handleSlotContext", q = "onConnected", wt = () => () => {
214
+ }, G = (t) => typeof t == "string" ? t : JSON.stringify(t), U = (t) => {
207
215
  const e = document.createElement("span");
208
- return e.textContent = D(t), e;
209
- }, U = (t, e) => (t.appendChild(G(e)), t), nt = (t, e) => (t.innerHTML = "", U(t, e)), z = (t) => {
216
+ return e.textContent = G(t), e;
217
+ }, X = (t, e) => (t.appendChild(U(e)), t), ot = (t, e) => (t.innerHTML = "", X(t, e)), z = (t) => {
210
218
  const e = document.createElement("span");
211
219
  return m(() => {
212
220
  const s = t();
213
- e.textContent = D(s);
221
+ e.textContent = G(s);
214
222
  }), e;
215
223
  }, P = (t) => ({
216
224
  append(...e) {
217
225
  return e.forEach((s) => {
218
- t.appendChild(s.hostElement), J in s.hostElement && setTimeout(() => {
226
+ t.appendChild(s.hostElement), q in s.hostElement && setTimeout(() => {
219
227
  var n, o;
220
228
  (o = (n = s.hostElement).onConnected) == null || o.call(
221
229
  n,
@@ -240,10 +248,10 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
240
248
  }), this;
241
249
  },
242
250
  addHtmlContent(e) {
243
- return U(t, e), this;
251
+ return X(t, e), this;
244
252
  },
245
253
  setHtmlContent(e) {
246
- return nt(t, e), this;
254
+ return ot(t, e), this;
247
255
  },
248
256
  addEventlistener(e, s, n = !1) {
249
257
  return t.addEventListener(e, (o) => s(o, this, t), n), this;
@@ -291,7 +299,7 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
291
299
  }), this;
292
300
  },
293
301
  onConnected(e) {
294
- return Reflect.defineProperty(t, J, {
302
+ return Reflect.defineProperty(t, q, {
295
303
  get() {
296
304
  return e;
297
305
  }
@@ -340,9 +348,9 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
340
348
  return t.innerHTML = "", this;
341
349
  },
342
350
  hostElement: t
343
- }), ot = (t, ...e) => ({
351
+ }), rt = (t, ...e) => ({
344
352
  classList: [...t.map((s) => s.trim()).filter(Boolean), ...e]
345
- }), xt = (t, ...e) => ot(t, ...e), X = (t, e) => {
353
+ }), $t = (t, ...e) => rt(t, ...e), Z = (t, e) => {
346
354
  if (!e) return t;
347
355
  const s = Object.keys(e || {}).filter(
348
356
  (n) => n.startsWith(".") || n.startsWith("@") || n.startsWith("$")
@@ -355,19 +363,19 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
355
363
  e.listeners[o] = e[n];
356
364
  }), s.filter((n) => n.startsWith("$")).forEach((n) => {
357
365
  e != null && e.effects || (e.effects = []), e.effects.push(e[n]);
358
- }), ct(t, e.classList), dt(t, e.style), ht(t, e.attributes), at(t, e.reactiveClassList), lt(t, e.customAttributes), it(t, e.children), rt(t, e.effects), q(t, e.listeners), q(t, e.customListeners), t;
359
- }, q = (t, e) => {
366
+ }), at(t, e.classList), ht(t, e.style), ut(t, e.attributes), dt(t, e.reactiveClassList), ct(t, e.customAttributes), it(t, e.children), lt(t, e.effects), D(t, e.listeners), D(t, e.customListeners), t;
367
+ }, D = (t, e) => {
360
368
  e && Object.entries(e).forEach(([s, n]) => {
361
369
  typeof n == "function" && t.addEventlistener(s, n);
362
370
  });
363
- }, rt = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)), it = (t, e) => W(t, ...e || []), lt = (t, e) => {
371
+ }, lt = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)), it = (t, e) => W(t, ...e || []), ct = (t, e) => {
364
372
  const s = e;
365
373
  s && Object.keys(s).forEach((n) => {
366
374
  y(s[n]) ? t.setReactiveCustomAttribute(n, s[n]) : typeof s[n] == "function" ? t.addEffect(() => {
367
375
  t.setCustomAttribute(n, s[n]());
368
376
  }) : t.setCustomAttribute(n, s[n]);
369
377
  });
370
- }, ct = (t, e) => t.addClass(...e || []), at = (t, e) => t.addReactiveClass(e || {}), dt = (t, e) => t.addStyle(e || {}), ht = (t, e) => {
378
+ }, at = (t, e) => t.addClass(...e || []), dt = (t, e) => t.addReactiveClass(e || {}), ht = (t, e) => t.addStyle(e || {}), ut = (t, e) => {
371
379
  const s = e, n = (o, r) => {
372
380
  r && (y(r) ? t.setReactiveAttribute(o, r) : typeof r == "function" ? t.addEffect(() => {
373
381
  t.setAttribute(o, r());
@@ -382,27 +390,27 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
382
390
  const s = document.createElement(t), n = {
383
391
  ...P(s)
384
392
  };
385
- return X(n, e);
393
+ return Z(n, e);
386
394
  }, H = (t, e) => {
387
395
  const [s, ...n] = t.split(" ").map((r) => r.trim()), o = w(s, e);
388
396
  return n.length > 0 && o.addClass(...n), (...r) => W(
389
397
  o,
390
398
  ...r.filter(Boolean).flat().flatMap(
391
- (i) => typeof i == "function" && !y(i) ? v(() => i(o)) : i
399
+ (l) => typeof l == "function" && !y(l) ? v(() => l(o)) : l
392
400
  )
393
401
  );
394
402
  }, v = (t) => w("div").addStyle({ display: "contents" }).addEffect((e) => {
395
403
  const s = t(), n = [];
396
404
  Array.isArray(s) ? n.push(...s) : n.push(s), e.clear(), W(e, ...n);
397
- }), wt = (t) => {
398
- const e = (n) => typeof n == "string" ? n.trim().length > 0 ? P(G(n)) : H("div")() : y(n) ? P(z(n)) : n;
399
- return ut(() => {
405
+ }), kt = (t) => {
406
+ const e = (n) => typeof n == "string" ? n.trim().length > 0 ? P(U(n)) : H("div")() : y(n) ? P(z(n)) : n;
407
+ return ft(() => {
400
408
  const n = t();
401
409
  return n instanceof Array && Array.isArray(n) ? n.map(e) : e(n);
402
410
  });
403
- }, $t = (t, e, s) => {
411
+ }, Mt = (t, e, s) => {
404
412
  const n = w("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
405
- let i = [];
413
+ let l = [];
406
414
  const a = /* @__PURE__ */ new Set();
407
415
  let c = t.peek();
408
416
  const d = (f) => {
@@ -410,17 +418,17 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
410
418
  };
411
419
  return m(() => {
412
420
  const f = t();
413
- i = f.map(e).map((h) => typeof h == "string" ? h : h.toString());
421
+ l = f.map(e).map((h) => typeof h == "string" ? h : h.toString());
414
422
  const p = Array.from(n.hostElement.children);
415
- u("containerChildren", p, i), p.forEach((h) => {
423
+ u("containerChildren", p, l), p.forEach((h) => {
416
424
  const E = h.dataset.key;
417
- i.includes(E) || (u("remove element", E, h), h.remove(), d(E));
418
- }), i.forEach((h) => {
425
+ l.includes(E) || (u("remove element", E, h), h.remove(), d(E));
426
+ }), l.forEach((h) => {
419
427
  var j, S;
420
- const E = f[i.indexOf(h)];
421
- o.has(h) ? JSON.stringify(E) !== JSON.stringify(c[i.indexOf(h)]) && ((j = n.hostElement.querySelector(`[data-key="${h}"]`)) == null || j.remove(), (S = o.get(h)) == null || S.set(Math.random().toString(36).substring(2, 15)), r.set(
428
+ const E = f[l.indexOf(h)];
429
+ o.has(h) ? JSON.stringify(E) !== JSON.stringify(c[l.indexOf(h)]) && ((j = n.hostElement.querySelector(`[data-key="${h}"]`)) == null || j.remove(), (S = o.get(h)) == null || S.set(Math.random().toString(36).substring(2, 15)), r.set(
422
430
  h,
423
- () => s(E, i.indexOf(h), f).setCustomAttribute(
431
+ () => s(E, l.indexOf(h), f).setCustomAttribute(
424
432
  "data-key",
425
433
  h
426
434
  )
@@ -429,18 +437,18 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
429
437
  A(Math.random().toString(36).substring(2, 15))
430
438
  ), r.set(
431
439
  h,
432
- () => s(E, i.indexOf(h), f).setCustomAttribute(
440
+ () => s(E, l.indexOf(h), f).setCustomAttribute(
433
441
  "data-key",
434
442
  h
435
443
  )
436
444
  ));
437
- }), c = f;
445
+ }), c = [...f.map((h) => ({ ...h }))];
438
446
  const b = () => {
439
447
  o.forEach((h, E) => {
440
448
  u("key from setTimeout foreach currItemSignalMap", E), a.has(E) || (a.add(E), m(() => {
441
- var B;
449
+ var J;
442
450
  h();
443
- const j = i.indexOf(E), S = (B = r.get(E)) == null ? void 0 : B();
451
+ const j = l.indexOf(E), S = (J = r.get(E)) == null ? void 0 : J();
444
452
  S && (u(
445
453
  "call effect from setTimeout",
446
454
  E,
@@ -454,10 +462,10 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
454
462
  };
455
463
  Promise.resolve().then(() => b());
456
464
  }), n;
457
- }, ut = (t) => {
465
+ }, ft = (t) => {
458
466
  let e = [w("div")], s = !1;
459
467
  return m(() => {
460
- var r, i;
468
+ var r, l;
461
469
  const n = t();
462
470
  s = Array.isArray(n);
463
471
  const o = [];
@@ -468,7 +476,7 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
468
476
  u("newReactiveComponent.map", o.map((a) => {
469
477
  var c;
470
478
  return u("newReactiveComponent hostElement", a.hostElement), (c = a.hostElement) == null ? void 0 : c.id;
471
- })), u("currComponent[0].hostElement?.id", (r = e[0].hostElement) == null ? void 0 : r.id, e), (i = e[0].hostElement) == null || i.replaceWith(
479
+ })), u("currComponent[0].hostElement?.id", (r = e[0].hostElement) == null ? void 0 : r.id, e), (l = e[0].hostElement) == null || l.replaceWith(
472
480
  ...o.map((a) => a.hostElement)
473
481
  ), e.slice(1).forEach((a) => {
474
482
  var c;
@@ -478,18 +486,18 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
478
486
  console.error(a);
479
487
  }
480
488
  }), s ? e : e[0];
481
- }, kt = (t) => st in t, Mt = (t) => {
489
+ }, It = (t) => nt in t, Pt = (t) => {
482
490
  const e = H("div")().addStyle({ display: "contents" }), s = (n) => (e.hostElement.innerHTML = n, e);
483
491
  return typeof t == "string" ? s(t) : e.addEffect(() => {
484
492
  s(t());
485
493
  }), e;
486
- }, Z = (t, e, s) => t ? v(e) : s ? v(s) : H("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), ft = (t, e, s) => v(() => Z(!!t(), e, s)), It = (t, e, s) => typeof t == "boolean" ? Z(t, e, s) : ft(t, e, s), N = (t, e) => {
494
+ }, Q = (t, e, s) => t ? v(e) : s ? v(s) : H("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), pt = (t, e, s) => v(() => Q(!!t(), e, s)), Ft = (t, e, s) => typeof t == "boolean" ? Q(t, e, s) : pt(t, e, s), N = (t, e) => {
487
495
  const s = v(e);
488
496
  return typeof t == "boolean" ? [s].flat().forEach((n) => n.hostElement.style.display = t ? "block" : "none") : m(() => {
489
497
  const n = t() ? "block" : "none";
490
498
  [s].flat().forEach((o) => o.hostElement.style.display = n);
491
499
  }), s;
492
- }, Pt = (t, e, s) => {
500
+ }, Wt = (t, e, s) => {
493
501
  const n = [N(t, e)].flat();
494
502
  return s && n.push(
495
503
  ...[N(
@@ -497,7 +505,7 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
497
505
  s
498
506
  )].flat()
499
507
  ), v(() => n);
500
- }, pt = (t, e) => {
508
+ }, mt = (t, e) => {
501
509
  u("createCustomElement", t);
502
510
  const s = document.createElement(t), n = {
503
511
  ...P(s),
@@ -506,41 +514,41 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
506
514
  },
507
515
  setSlotTemplate(o) {
508
516
  const r = s.slotTemplate;
509
- return r && Object.entries(o).forEach(([i, a]) => {
510
- r[i] = a;
517
+ return r && Object.entries(o).forEach(([l, a]) => {
518
+ r[l] = a;
511
519
  }), this;
512
520
  }
513
521
  };
514
- return X(n, e);
515
- }, mt = (t, e) => {
516
- const s = t.split(" ").slice(1).map((o) => o.trim()), n = pt(t.split(" ")[0], e);
522
+ return Z(n, e);
523
+ }, Ct = (t, e) => {
524
+ const s = t.split(" ").slice(1).map((o) => o.trim()), n = mt(t.split(" ")[0], e);
517
525
  return Array.isArray(s) && s.length > 0 && n.addClass(...s), (...o) => {
518
- L("@rcreateCustomEl content", t, o);
526
+ g("@rcreateCustomEl content", t, o);
519
527
  const r = o.filter(Boolean).flat().flatMap(
520
- (i) => typeof i == "function" && !y(i) ? v(() => i(n)) : i
528
+ (l) => typeof l == "function" && !y(l) ? v(() => l(n)) : l
521
529
  );
522
- return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(K).reduce(
523
- (i, a) => {
530
+ return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(tt).reduce(
531
+ (l, a) => {
524
532
  const c = a.hostElement.getAttribute("slot") || "default";
525
- return i[c] || (i[c] = []), i[c].push(a), i;
533
+ return l[c] || (l[c] = []), l[c].push(a), l;
526
534
  },
527
535
  {}
528
536
  ), n.hostElement.appendAllSlotContent = () => W(n, ...r), n;
529
537
  };
530
- }, Ct = (t, e, s) => mt(
538
+ }, bt = (t, e, s) => Ct(
531
539
  `${t.renderTagName}${e && typeof e == "string" ? " " + e : ""}`,
532
540
  x(e) ? e : e && typeof e == "string" ? s : void 0
533
- ), Ft = () => {
541
+ ), Ht = () => {
534
542
  const t = () => {
535
543
  };
536
544
  return t.oldValue = null, t;
537
- }, Wt = () => ({}), Ht = (t, e, s) => {
538
- const n = e ? yt(e, s)(t) : t;
545
+ }, _t = () => ({}), zt = (t, e, s) => {
546
+ const n = e ? St(e, s)(t) : t;
539
547
  return (o, ...r) => {
540
- const i = [...r];
541
- return o && !x(o) && i.unshift(o), Ct(n, x(o) ? o : {})(...i);
548
+ const l = [...r];
549
+ return o && !x(o) && l.unshift(o), bt(n, x(o) ? o : {})(...l);
542
550
  };
543
- }, l = {}, bt = [
551
+ }, i = {}, Et = [
544
552
  "div",
545
553
  "span",
546
554
  "section",
@@ -602,19 +610,19 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
602
610
  "canvas",
603
611
  "slot"
604
612
  ];
605
- bt.forEach((t) => {
606
- l[t] = (e, ...s) => {
613
+ Et.forEach((t) => {
614
+ i[t] = (e, ...s) => {
607
615
  let n = [...s];
608
616
  return e && !x(e) && (n = [e].concat(n)), H(t, x(e) ? e : {})(...n);
609
617
  };
610
618
  });
611
- const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt = l.table, Nt = l.tr, Vt = l.td, Dt = l.th, Gt = l.ul, Ut = l.li, Xt = l.ol, Zt = l.form, Qt = l.label, Yt = l.select, Kt = l.option, te = l.textarea, ee = l.img, se = l.a, ne = l.p, oe = l.h1, re = l.h2, ie = l.h3, le = l.h4, ce = l.h5, ae = l.h6, de = l.br, he = l.hr, ue = l.pre, fe = l.code, pe = l.nav, me = l.header, Ce = l.footer, be = l.main, Ee = l.aside, ye = l.article, Se = l.figure, ve = l.figcaption, Ae = l.blockquote, Le = l.cite, ge = l.small, Re = l.strong, Oe = l.em, je = l.b, Te = l.i, xe = l.u, we = l.s, $e = l.sub, ke = l.sup, Me = l.mark, Ie = l.del, Pe = l.ins, Fe = l.details, We = l.summary, He = l.progress, _e = l.meter, ze = l.audio, Be = l.video, Je = l.canvas, qe = l.slot, Ne = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", M = "EVENT_CONFIG", T = "observedAttributes", Ve = () => (t, e) => {
619
+ const yt = i.div, Bt = i.span, Jt = i.section, qt = i.input, Dt = i.button, Nt = i.table, Vt = i.tr, Gt = i.td, Ut = i.th, Xt = i.ul, Zt = i.li, Qt = i.ol, Yt = i.form, Kt = i.label, te = i.select, ee = i.option, se = i.textarea, ne = i.img, oe = i.a, re = i.p, le = i.h1, ie = i.h2, ce = i.h3, ae = i.h4, de = i.h5, he = i.h6, ue = i.br, fe = i.hr, pe = i.pre, me = i.code, Ce = i.nav, be = i.header, Ee = i.footer, ye = i.main, Se = i.aside, ve = i.article, Ae = i.figure, ge = i.figcaption, Le = i.blockquote, Re = i.cite, Oe = i.small, je = i.strong, Te = i.em, xe = i.b, we = i.i, $e = i.u, ke = i.s, Me = i.sub, Ie = i.sup, Pe = i.mark, Fe = i.del, We = i.ins, He = i.details, _e = i.summary, ze = i.progress, Be = i.meter, Je = i.audio, qe = i.video, De = i.canvas, Ne = i.slot, Ve = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", M = "EVENT_CONFIG", T = "observedAttributes", Ge = () => (t, e) => {
612
620
  Reflect.get(t, T) || Reflect.defineProperty(t, T, {
613
621
  value: []
614
622
  }), Reflect.get(t, T).push(
615
623
  $(e)
616
624
  );
617
- }, De = (t) => (e, s) => {
625
+ }, Ue = (t) => (e, s) => {
618
626
  Reflect.get(e, k) || Reflect.defineProperty(e, k, {
619
627
  value: []
620
628
  }), Reflect.get(e, M) || Reflect.defineProperty(e, M, {
@@ -623,7 +631,7 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
623
631
  bubbles: (t == null ? void 0 : t.bubbles) ?? !1,
624
632
  composed: (t == null ? void 0 : t.composed) ?? !1
625
633
  }, Reflect.get(e, k).push(s);
626
- }, yt = (t, e = !1) => (s) => {
634
+ }, St = (t, e = !1) => (s) => {
627
635
  u(
628
636
  t,
629
637
  "start register static attr",
@@ -631,8 +639,8 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
631
639
  );
632
640
  const n = [];
633
641
  if (s.styles) {
634
- const r = s.styles, i = [];
635
- Array.isArray(r) ? i.push(...r) : i.push(r), i.forEach((a) => {
642
+ const r = s.styles, l = [];
643
+ Array.isArray(r) ? l.push(...r) : l.push(r), l.forEach((a) => {
636
644
  const c = new CSSStyleSheet();
637
645
  c.replaceSync(a), n.push(c);
638
646
  const d = new CSSStyleSheet();
@@ -640,21 +648,21 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
640
648
  });
641
649
  }
642
650
  class o extends s {
643
- constructor(...i) {
644
- u("constructor", `%c${t}%c`), super(e, ...i), L("@osheet", n), n.length > 0 && this.shadow.adoptedStyleSheets.push(...n);
651
+ constructor(...l) {
652
+ u("constructor", `%c${t}%c`), super(e, ...l), g("@osheet", n), n.length > 0 && this.shadow.adoptedStyleSheets.push(...n);
645
653
  }
646
654
  render() {
647
655
  u("rwc: render from new class");
648
- let i = Et();
656
+ let l = yt();
649
657
  const a = () => {
650
- u("wrapperEffectCallback"), i = s.prototype.render.call(this);
658
+ u("wrapperEffectCallback"), l = s.prototype.render.call(this);
651
659
  };
652
- return a.fake = !0, m(a), i;
660
+ return a.fake = !0, m(a), l;
653
661
  }
654
- attributeChangedCallback(i, a, c) {
662
+ attributeChangedCallback(l, a, c) {
655
663
  u(
656
664
  "%cAttribute has changed.%c",
657
- `%c${i}%c`,
665
+ `%c${l}%c`,
658
666
  `oldValue: ${a}, newValue: ${c}`,
659
667
  `%c${t}%c`
660
668
  );
@@ -662,15 +670,15 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
662
670
  c = JSON.parse(c);
663
671
  } catch {
664
672
  }
665
- const d = tt(i);
673
+ const d = et(l);
666
674
  if (d in this && y(this[d])) {
667
675
  const f = this[d];
668
- c === null ? (f.set(f.initValue), this.removeAttribute(i)) : f.set(c);
676
+ c === null ? (f.set(f.initValue), this.removeAttribute(l)) : f.set(c);
669
677
  }
670
678
  _(
671
679
  this,
672
680
  s.prototype.attributeChangedCallback,
673
- i,
681
+ l,
674
682
  a,
675
683
  c
676
684
  );
@@ -691,14 +699,14 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
691
699
  this[c] = (d) => {
692
700
  const f = s.prototype[M][c], { bubbles: p, composed: b } = f;
693
701
  y(d) ? m(() => {
694
- L("@oemit reactive value", d()), this.dispatchEvent(
702
+ g("@oemit reactive value", d()), this.dispatchEvent(
695
703
  new CustomEvent(c, {
696
704
  detail: d(),
697
705
  bubbles: p,
698
706
  composed: b
699
707
  })
700
708
  );
701
- }) : (L("@oemit value", d), this.dispatchEvent(
709
+ }) : (g("@oemit value", d), this.dispatchEvent(
702
710
  new CustomEvent(c, {
703
711
  detail: d,
704
712
  bubbles: p,
@@ -708,7 +716,7 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
708
716
  };
709
717
  }
710
718
  ), u("start render", `%c${t}%c`, t);
711
- const i = () => {
719
+ const l = () => {
712
720
  u("rwc: insertRenderTemplate");
713
721
  const c = this.render();
714
722
  this.shadow.appendChild(c.hostElement), _(this, s.prototype.connectedCallback), this.appendSlotContent();
@@ -722,25 +730,25 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
722
730
  };
723
731
  if (c(d)) {
724
732
  const p = [];
725
- Array.isArray(d) ? p.push(...d) : p.push(d), Promise.all(p).then((b) => b.forEach((h) => f(h.default))).then(() => i());
733
+ Array.isArray(d) ? p.push(...d) : p.push(d), Promise.all(p).then((b) => b.forEach((h) => f(h.default))).then(() => l());
726
734
  } else {
727
735
  const p = [];
728
- Array.isArray(d) ? p.push(...d) : p.push(d), p.forEach((b) => f(b)), i();
736
+ Array.isArray(d) ? p.push(...d) : p.push(d), p.forEach((b) => f(b)), l();
729
737
  }
730
738
  } else
731
- i();
739
+ l();
732
740
  this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((c) => {
733
741
  u(
734
742
  this.slotContext,
735
743
  this.slotContext && this.slotContext[c.name]
736
- ), L(
744
+ ), g(
737
745
  "@bslot element",
738
746
  c,
739
747
  `name:${c.name};`,
740
748
  c.assignedElements()
741
749
  ), c.assignedElements().forEach((d) => {
742
750
  const f = this.slotContext[c.name];
743
- this.slotContext && y(f) && (L(
751
+ this.slotContext && y(f) && (g(
744
752
  "@oslot element",
745
753
  c,
746
754
  `name:${c.name};`,
@@ -765,125 +773,126 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
765
773
  };
766
774
  export {
767
775
  O as BaseElement,
768
- se as a,
769
- ht as addAttributeList,
770
- ct as addClassList,
771
- lt as addCustomAttributes,
772
- U as addHtmlContent,
773
- at as addReactiveClassList,
774
- dt as addStyleList,
776
+ oe as a,
777
+ ut as addAttributeList,
778
+ at as addClassList,
779
+ ct as addCustomAttributes,
780
+ X as addHtmlContent,
781
+ dt as addReactiveClassList,
782
+ ht as addStyleList,
775
783
  W as appendContentItem,
776
- ye as article,
777
- Ee as aside,
778
- ze as audio,
779
- je as b,
780
- gt as bindReactiveSignals,
781
- Ae as blockquote,
782
- de as br,
783
- Jt as button,
784
+ ve as article,
785
+ Se as aside,
786
+ Je as audio,
787
+ xe as b,
788
+ Ot as bindReactiveSignals,
789
+ Le as blockquote,
790
+ ue as br,
791
+ Dt as button,
784
792
  $ as camelToKebab,
785
- Je as canvas,
793
+ De as canvas,
786
794
  _ as checkCall,
787
- Le as cite,
788
- ot as classList,
789
- xt as cls,
790
- fe as code,
791
- L as colorLog,
792
- Ot as combineLatest,
793
- yt as component,
794
- Ne as createComponent,
795
- Ct as createCustom,
796
- mt as createCustomEl,
797
- pt as createCustomElement,
795
+ Re as cite,
796
+ rt as classList,
797
+ $t as cls,
798
+ me as code,
799
+ g as colorLog,
800
+ Tt as combineLatest,
801
+ St as component,
802
+ Ve as createComponent,
803
+ bt as createCustom,
804
+ Ct as createCustomEl,
805
+ mt as createCustomElement,
798
806
  H as createEl,
799
807
  w as createElement,
800
- Lt as createSignal,
801
- Wt as defineSlotTemplate,
802
- Ie as del,
803
- Fe as details,
804
- et as disableLogs,
805
- Et as div,
808
+ Rt as createSignal,
809
+ _t as defineSlotTemplate,
810
+ Fe as del,
811
+ He as details,
812
+ st as disableLogs,
813
+ yt as div,
806
814
  m as effect,
807
815
  V as effectMap,
808
816
  P as elementHelpers,
809
- Oe as em,
810
- vt as enableLogs,
811
- De as event,
812
- Tt as eventEmitter,
813
- ve as figcaption,
814
- Se as figure,
815
- Ce as footer,
816
- Rt as forkJoin,
817
- Zt as form,
818
- $t as getList,
819
- wt as getReactiveTemplate,
817
+ Te as em,
818
+ At as enableLogs,
819
+ Ue as event,
820
+ wt as eventEmitter,
821
+ ge as figcaption,
822
+ Ae as figure,
823
+ Ee as footer,
824
+ jt as forkJoin,
825
+ Yt as form,
826
+ Mt as getList,
827
+ kt as getReactiveTemplate,
820
828
  v as getSignalContent,
821
- D as getTextContent,
822
- oe as h1,
823
- re as h2,
824
- ie as h3,
825
- le as h4,
826
- ce as h5,
827
- ae as h6,
828
- me as header,
829
- he as hr,
829
+ G as getTextContent,
830
+ le as h1,
831
+ ie as h2,
832
+ ce as h3,
833
+ ae as h4,
834
+ de as h5,
835
+ he as h6,
836
+ be as header,
837
+ fe as hr,
830
838
  z as htmlEffectWrapper,
831
- Te as i,
832
- ee as img,
833
- X as initComponent,
834
- Bt as input,
835
- Pe as ins,
836
- jt as isBaseElement,
837
- K as isComponentConfig,
839
+ we as i,
840
+ ne as img,
841
+ Z as initComponent,
842
+ qt as input,
843
+ We as ins,
844
+ xt as isBaseElement,
845
+ tt as isComponentConfig,
838
846
  x as isComponentInitConfig,
839
847
  y as isReactiveSignal,
840
- kt as isSlotTemplate,
841
- tt as kebabToCamel,
842
- Qt as label,
843
- Ut as li,
844
- be as main,
845
- Me as mark,
846
- _e as meter,
847
- pe as nav,
848
- Ft as newEventEmitter,
849
- Xt as ol,
850
- Kt as option,
851
- ne as p,
852
- ue as pre,
853
- He as progress,
848
+ It as isSlotTemplate,
849
+ et as kebabToCamel,
850
+ Kt as label,
851
+ Zt as li,
852
+ ye as main,
853
+ Pe as mark,
854
+ Be as meter,
855
+ Ce as nav,
856
+ Ht as newEventEmitter,
857
+ Qt as ol,
858
+ ee as option,
859
+ re as p,
860
+ pe as pre,
861
+ ze as progress,
854
862
  u as projectLog,
855
- Ve as property,
856
- Z as renderIf,
857
- At as rs,
858
- ft as rxRenderIf,
859
- we as s,
860
- zt as section,
861
- Yt as select,
863
+ Ge as property,
864
+ Q as renderIf,
865
+ Lt as rs,
866
+ pt as rxRenderIf,
867
+ ke as s,
868
+ Jt as section,
869
+ te as select,
862
870
  it as setChildren,
863
- rt as setEffects,
864
- nt as setHtmlContent,
865
- q as setListeners,
866
- Pt as show,
871
+ gt as setEffectDebugEnabled,
872
+ lt as setEffects,
873
+ ot as setHtmlContent,
874
+ D as setListeners,
875
+ Wt as show,
867
876
  N as showIf,
868
877
  A as signal,
869
- ut as signalComponent,
870
- qe as slot,
871
- ge as small,
872
- _t as span,
873
- Re as strong,
874
- $e as sub,
875
- We as summary,
876
- ke as sup,
877
- qt as table,
878
- Vt as td,
879
- G as textContentWrapper,
880
- te as textarea,
881
- Dt as th,
882
- Nt as tr,
883
- xe as u,
884
- Gt as ul,
885
- Mt as unsafeHtml,
886
- Ht as useCustomComponent,
887
- Be as video,
888
- It as when
878
+ ft as signalComponent,
879
+ Ne as slot,
880
+ Oe as small,
881
+ Bt as span,
882
+ je as strong,
883
+ Me as sub,
884
+ _e as summary,
885
+ Ie as sup,
886
+ Nt as table,
887
+ Gt as td,
888
+ U as textContentWrapper,
889
+ se as textarea,
890
+ Ut as th,
891
+ Vt as tr,
892
+ $e as u,
893
+ Xt as ul,
894
+ Pt as unsafeHtml,
895
+ zt as useCustomComponent,
896
+ qe as video,
897
+ Ft as when
889
898
  };
@@ -0,0 +1,2 @@
1
+ (function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o.ReactiveComponent={}))})(this,function(o){"use strict";var Ve=Object.defineProperty;var Ue=(o,p,L)=>p in o?Ve(o,p,{enumerable:!0,configurable:!0,writable:!0,value:L}):o[p]=L;var E=(o,p,L)=>Ue(o,typeof p!="symbol"?p+"":p,L);const p=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(e=>e.startsWith(".")||e.startsWith("@")||e.startsWith("$")))&&!("hostElement"in t),L=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,...n)=>{e&&e.apply(t,n)};let _=!0;const f=(...t)=>{_&&console.debug(["[rwc]",...t].join(" | "),...Array.from(t.join("").matchAll(/%c/gm)).map((e,n)=>n%2===0?"color:red":"color:inherit"))},I=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),K=t=>t.replace(/-(\w)/gm,(e,n)=>n.toUpperCase()),R=(t,...e)=>{if(!_)return;const n={r:"color: #ff0000",g:"color: #00ff00",b:"color: #0000ff",y:"color: #ffff00",p:"color: #800080",c:"color: #00ffff",o:"color: #ffa500",w:"color: #808080"},s=t.match(/@[rgbpycow]/g)||[],i=s.map(c=>{const d=c.slice(1);return n[d]||"color: inherit"});let l=t;s.forEach(c=>{const d=new RegExp(`\\${c}([^\\s,]+)`,"g");l=l.replace(d,"%c$1")}),console.log(l,...i,...e)},Et=()=>{_=!0},x=()=>{_=!1};x();let D=!1;const yt=t=>{D=t},G=new Map,O=new WeakMap,B=[],w=[];function g(t,e){const n=new Set;let s=(e==null?void 0:e.signalCompareFn)||(()=>!0);function i(){var c;const l=B[B.length-1];if(l&&!("fake"in l&&l.fake)){const d=O.get(l),r=d==null?void 0:d.parent;if(r){const h=O.get(r);h==null||h.cleanupFns.add(()=>{n.delete(l)})}n.add(l),D&&((c=G.get(l.effectId))==null||c.signals.push(i))}return t}return i.signalId=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`,i.getSubscribers=()=>[...n],i.setCompareFn=function(l){return s=l,i},i.clearSubscribers=function(){n.clear()},i.peek=function(){return Object.freeze(t)},i.initValue=Object.freeze(t),i.oldValue=Object.freeze(t),i.forceSet=function(l){i.oldValue=Object.freeze(t),t=l,n.forEach(c=>Promise.resolve(c).then(d=>{const r=O.get(d);r&&r.cleanupFns.size>0&&(r.cleanupFns.forEach(h=>h()),r.cleanupFns.clear()),w.push(d),d(),w.pop()}))},i.set=function(l,c=s){t!==l&&c(t,l)&&i.forceSet(l)},i.update=function(l){i.set(l(t))},i.pipe=(l,c)=>{const d=g(null);return b(()=>{const r=i();b(()=>{const h=l(r);h instanceof Promise?h.then(m=>d.set(m)):v(h)?b(()=>d.set(h())):d.set(h)},c)}),d},i}function b(t,e){const n=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`;f("current effect",`%c${n}%c`);const s=t;t=()=>(f("current effect callback",`%c${n}%c`),s()),"fake"in s&&s.fake&&(t.fake=!0),t.effectId=n;const i=w[w.length-1];D&&G.set(n,{signals:[],parent:(i==null?void 0:i.effectId)||null}),O.has(t)||O.set(t,{cleanupFns:new Set});const l=O.get(t);i?l.parent=i:delete l.parent,w.push(t),B.push(t),t(),B.pop(),w.pop()}const v=t=>!!t&&["object","function"].includes(typeof t)&&"set"in t&&"oldValue"in t&&"update"in t&&"forceSet"in t;function St(t,...e){const n=g("");return b(()=>{const s=e.map(l=>v(l)?String(l()):String(l)),i=[t[0]];s.forEach((l,c)=>{i.push(l,t[c+1])}),n.set(i.join(""))}),n}function vt(t,e){const n=g(e??null),s=i=>n.set(i);return t instanceof Promise?t.then(s):typeof t=="function"&&b(()=>{const i=t();i instanceof Promise?i.then(s):v(i)?b(()=>s(i())):s(i)}),n}function gt(t,e){let n=t(),s=e();b(()=>{const i=t(),l=e();i!==l&&(i!==n?e.set(i):l!==s&&t.set(l)),n=i,s=l})}function At(...t){let e=t.map(s=>s());const n=g(e);return t.forEach((s,i)=>{b(()=>{const l=()=>e.filter(c=>c!==void 0).length;l()===t.length&&(e=Array.from(e).fill(void 0)),e[i]=s(),l()===t.length&&n.set([...e])})}),n}const Lt=(...t)=>{const e=g([]);return b(()=>{e.set(t.map(n=>n()))}),e};class T extends HTMLElement{constructor(n=!1){super();E(this,"isSlotLazyLoading",!1);E(this,"slotTemplate");E(this,"slotContext");E(this,"rootStyle");E(this,"modelValue");E(this,"providers");E(this,"appendAllSlotContent");E(this,"allSlotContent",[]);E(this,"slotContent",{});E(this,"htmlSlotContent",{});E(this,"shadow");E(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var i;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const l=n.slot||"default";this.htmlSlotContent[l]||(this.htmlSlotContent[l]=[]),(i=this.htmlSlotContent[l])==null||i.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return f("%cinject%c",n),this.injects[n]||(this.injects[n]=g(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{f("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:i=>b(()=>{s.set(i())})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}E(T,"observedAttributes",[]),E(T,"renderTagName",""),E(T,"styles");const Rt=t=>"render"in t&&"setReactiveValue"in t,Tt="handleSlotContext",tt="onConnected",jt=()=>()=>{},N=t=>typeof t=="string"?t:JSON.stringify(t),V=t=>{const e=document.createElement("span");return e.textContent=N(t),e},U=(t,e)=>(t.appendChild(V(e)),t),et=(t,e)=>(t.innerHTML="",U(t,e)),J=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=N(n)}),e},M=t=>({append(...e){return e.forEach(n=>{t.appendChild(n.hostElement),tt in n.hostElement&&setTimeout(()=>{var s,i;(i=(s=n.hostElement).onConnected)==null||i.call(s,n,n.hostElement)})}),this},set(...e){this.clear();const n=document.createDocumentFragment();return e.forEach(s=>{n.appendChild(s.hostElement)}),t.appendChild(n),this},removeChild(...e){return e.forEach(n=>{Array.from(t.childNodes.values()).some(s=>s===n.hostElement)&&t.removeChild(n.hostElement)}),this},addHtmlContent(e){return U(t,e),this},setHtmlContent(e){return et(t,e),this},addEventlistener(e,n,s=!1){return t.addEventListener(e,i=>n(i,this,t),s),this},setAttribute(e,n){let s;if(typeof n=="boolean"&&!(t instanceof T))if(n)s="";else{this.removeAttribute(e);const i=e.toLowerCase();return i in t&&(t[i]=null),this}else typeof n!="string"?s=JSON.stringify(n):s=n;if(t.setAttribute(I(e),s),!(t instanceof T)){const i=e.toLowerCase();i in t&&(t[i]=n)}return this},setCustomAttribute(e,n){let s;return typeof n!="string"?s=JSON.stringify(n):s=n,t.setAttribute(I(e),s),this},setReactiveAttribute(e,n){return b(()=>this.setAttribute(e,n())),this},setReactiveCustomAttribute(e,n){return b(()=>this.setCustomAttribute(e,n())),this},removeAttribute(e){return t.removeAttribute(I(e)),this},addStyle(e){return Object.entries(e).forEach(([n,s])=>{const i=n.startsWith("--");typeof s=="function"?this.addEffect(()=>{if(i){const l=String(s()||"");t.style.setProperty(n,l)}else t.style[n]=s()}):typeof s=="string"&&(i?t.style.setProperty(n,s):t.style[n]=s)}),this},onConnected(e){return Reflect.defineProperty(t,tt,{get(){return e}}),this},addClass(...e){return e.forEach(n=>{typeof n=="string"?t.classList.add(...n.split(" ").flatMap(s=>s.split(`
2
+ `)).map(s=>s.trim()).filter(Boolean)):(()=>{let s=null;this.addEffect(()=>{const i=n();i.length>0&&(s?this.replaceClass(s,i):this.addClass(i),s=i)})})()}),this},setClass(...e){return t.classList.remove(...t.classList),t.classList.add(...e),this},addReactiveClass(e){return Object.keys(e).forEach(n=>{b(()=>{e[n]()?this.addClass(n):this.removeClass(n)})}),this},removeClass(...e){return t.classList.remove(...e),this},replaceClass(e,n){return t.classList.replace(e,n),this},addEffect(e){return b(()=>e(this,this.hostElement)),this},addReactiveContent(e){return t.appendChild(J(e)),this},setReactiveContent(e){return this.clear(),t.appendChild(J(e)),this},clear(){return t.innerHTML="",this},hostElement:t}),nt=(t,...e)=>({classList:[...t.map(n=>n.trim()).filter(Boolean),...e]}),Ot=(t,...e)=>nt(t,...e),X=(t,e)=>{if(!e)return t;const n=Object.keys(e||{}).filter(s=>s.startsWith(".")||s.startsWith("@")||s.startsWith("$"));return n.filter(s=>s.startsWith(".")).forEach(s=>{e!=null&&e.attributes||(e.attributes={}),e.attributes[s.slice(1)]=e[s]}),n.filter(s=>s.startsWith("@")).forEach(s=>{e!=null&&e.listeners||(e.listeners={});const i=s.slice(1);e.listeners[i]=e[s]}),n.filter(s=>s.startsWith("$")).forEach(s=>{e!=null&&e.effects||(e.effects=[]),e.effects.push(e[s])}),lt(t,e.classList),at(t,e.style),rt(t,e.attributes),ct(t,e.reactiveClassList),it(t,e.customAttributes),ot(t,e.children),st(t,e.effects),Z(t,e.listeners),Z(t,e.customListeners),t},Z=(t,e)=>{e&&Object.entries(e).forEach(([n,s])=>{typeof s=="function"&&t.addEventlistener(n,s)})},st=(t,e)=>e==null?void 0:e.forEach(n=>t.addEffect(n)),ot=(t,e)=>$(t,...e||[]),it=(t,e)=>{const n=e;n&&Object.keys(n).forEach(s=>{v(n[s])?t.setReactiveCustomAttribute(s,n[s]):typeof n[s]=="function"?t.addEffect(()=>{t.setCustomAttribute(s,n[s]())}):t.setCustomAttribute(s,n[s])})},lt=(t,e)=>t.addClass(...e||[]),ct=(t,e)=>t.addReactiveClass(e||{}),at=(t,e)=>t.addStyle(e||{}),rt=(t,e)=>{const n=e,s=(i,l)=>{l&&(v(l)?t.setReactiveAttribute(i,l):typeof l=="function"?t.addEffect(()=>{t.setAttribute(i,l())}):t.setAttribute(i,l))};n&&Object.keys(n).forEach(i=>{s(i,n[i])})},$=(t,...e)=>(e.forEach(n=>{typeof n=="string"?n.trim().length>0&&t.addHtmlContent(n):v(n)?t.addReactiveContent(n):t.append(n)}),t),k=(t,e)=>{const n=document.createElement(t),s={...M(n)};return X(s,e)},P=(t,e)=>{const[n,...s]=t.split(" ").map(l=>l.trim()),i=k(n,e);return s.length>0&&i.addClass(...s),(...l)=>$(i,...l.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?A(()=>c(i)):c))},A=t=>k("div").addStyle({display:"contents"}).addEffect(e=>{const n=t(),s=[];Array.isArray(n)?s.push(...n):s.push(n),e.clear(),$(e,...s)}),wt=t=>{const e=s=>typeof s=="string"?s.trim().length>0?M(V(s)):P("div")():v(s)?M(J(s)):s;return dt(()=>{const s=t();return s instanceof Array&&Array.isArray(s)?s.map(e):e(s)})},kt=(t,e,n)=>{const s=k("div").addStyle({display:"contents"}),i=new Map,l=new Map;let c=[];const d=new Set;let r=t.peek();const h=m=>{d.delete(m),i.delete(m),l.delete(m)};return b(()=>{const m=t();c=m.map(e).map(u=>typeof u=="string"?u:u.toString());const C=Array.from(s.hostElement.children);f("containerChildren",C,c),C.forEach(u=>{const S=u.dataset.key;c.includes(S)||(f("remove element",S,u),u.remove(),h(S))}),c.forEach(u=>{var H,j;const S=m[c.indexOf(u)];i.has(u)?JSON.stringify(S)!==JSON.stringify(r[c.indexOf(u)])&&((H=s.hostElement.querySelector(`[data-key="${u}"]`))==null||H.remove(),(j=i.get(u))==null||j.set(Math.random().toString(36).substring(2,15)),l.set(u,()=>n(S,c.indexOf(u),m).setCustomAttribute("data-key",u))):(f("create new element",u,S),i.set(u,g(Math.random().toString(36).substring(2,15))),l.set(u,()=>n(S,c.indexOf(u),m).setCustomAttribute("data-key",u)))}),r=[...m.map(u=>({...u}))];const y=()=>{i.forEach((u,S)=>{f("key from setTimeout foreach currItemSignalMap",S),d.has(S)||(d.add(S),b(()=>{var pt;u();const H=c.indexOf(S),j=(pt=l.get(S))==null?void 0:pt();j&&(f("call effect from setTimeout",S,j.hostElement),H<=s.hostElement.children.length-1?s.hostElement.insertBefore(j.hostElement,s.hostElement.children[H]):s.hostElement.append(j.hostElement))}))})};Promise.resolve().then(()=>y())}),s},dt=t=>{let e=[k("div")],n=!1;return b(()=>{var l,c;const s=t();n=Array.isArray(s);const i=[];i.push(...[s].flat()),i.length===0&&i.push(k("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{f("newReactiveComponent.map",i.map(d=>{var r;return f("newReactiveComponent hostElement",d.hostElement),(r=d.hostElement)==null?void 0:r.id})),f("currComponent[0].hostElement?.id",(l=e[0].hostElement)==null?void 0:l.id,e),(c=e[0].hostElement)==null||c.replaceWith(...i.map(d=>d.hostElement)),e.slice(1).forEach(d=>{var r;return(r=d.hostElement)==null?void 0:r.remove()}),e=i}catch(d){console.error(d)}}),n?e:e[0]},It=t=>Tt in t,Mt=t=>{const e=P("div")().addStyle({display:"contents"}),n=s=>(e.hostElement.innerHTML=s,e);return typeof t=="string"?n(t):e.addEffect(()=>{n(t())}),e},Q=(t,e,n)=>t?A(e):n?A(n):P("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),ht=(t,e,n)=>A(()=>Q(!!t(),e,n)),$t=(t,e,n)=>typeof t=="boolean"?Q(t,e,n):ht(t,e,n),Y=(t,e)=>{const n=A(e);return typeof t=="boolean"?[n].flat().forEach(s=>s.hostElement.style.display=t?"block":"none"):b(()=>{const s=t()?"block":"none";[n].flat().forEach(i=>i.hostElement.style.display=s)}),n},Pt=(t,e,n)=>{const s=[Y(t,e)].flat();return n&&s.push(...[Y(()=>typeof t=="boolean"?!t:!t(),n)].flat()),A(()=>s)},ut=(t,e)=>{f("createCustomElement",t);const n=document.createElement(t),s={...M(n),setReactiveValue(i){return n instanceof T&&n.setReactiveValue(i),this},setSlotTemplate(i){const l=n.slotTemplate;return l&&Object.entries(i).forEach(([c,d])=>{l[c]=d}),this}};return X(s,e)},ft=(t,e)=>{const n=t.split(" ").slice(1).map(i=>i.trim()),s=ut(t.split(" ")[0],e);return Array.isArray(n)&&n.length>0&&s.addClass(...n),(...i)=>{R("@rcreateCustomEl content",t,i);const l=i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?A(()=>c(s)):c);return s.hostElement.allSlotContent=l,s.hostElement.slotContent=l.filter(L).reduce((c,d)=>{const r=d.hostElement.getAttribute("slot")||"default";return c[r]||(c[r]=[]),c[r].push(d),c},{}),s.hostElement.appendAllSlotContent=()=>$(s,...l),s}},mt=(t,e,n)=>ft(`${t.renderTagName}${e&&typeof e=="string"?" "+e:""}`,p(e)?e:e&&typeof e=="string"?n:void 0),Ft=()=>{const t=()=>{};return t.oldValue=null,t},Ht=()=>({}),Wt=(t,e,n)=>{const s=e?bt(e,n)(t):t;return(i,...l)=>{const c=[...l];return i&&!p(i)&&c.unshift(i),mt(s,p(i)?i:{})(...c)}},a={};["div","span","section","input","button","table","tr","td","th","ul","li","ol","form","label","select","option","textarea","img","a","p","h1","h2","h3","h4","h5","h6","br","hr","pre","code","nav","header","footer","main","aside","article","figure","figcaption","blockquote","cite","small","strong","em","b","i","u","s","sub","sup","mark","del","ins","details","summary","progress","meter","audio","video","canvas","slot"].forEach(t=>{a[t]=(e,...n)=>{let s=[...n];return e&&!p(e)&&(s=[e].concat(s)),P(t,p(e)?e:{})(...s)}});const Ct=a.div,_t=a.span,Bt=a.section,Jt=a.input,zt=a.button,qt=a.table,Dt=a.tr,Gt=a.td,Nt=a.th,Vt=a.ul,Ut=a.li,Xt=a.ol,Zt=a.form,Qt=a.label,Yt=a.select,Kt=a.option,xt=a.textarea,te=a.img,ee=a.a,ne=a.p,se=a.h1,oe=a.h2,ie=a.h3,le=a.h4,ce=a.h5,ae=a.h6,re=a.br,de=a.hr,he=a.pre,ue=a.code,fe=a.nav,me=a.header,Ce=a.footer,be=a.main,pe=a.aside,Ee=a.article,ye=a.figure,Se=a.figcaption,ve=a.blockquote,ge=a.cite,Ae=a.small,Le=a.strong,Re=a.em,Te=a.b,je=a.i,Oe=a.u,we=a.s,ke=a.sub,Ie=a.sup,Me=a.mark,$e=a.del,Pe=a.ins,Fe=a.details,He=a.summary,We=a.progress,_e=a.meter,Be=a.audio,Je=a.video,ze=a.canvas,qe=a.slot,De=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{}),z="eventProps",q="EVENT_CONFIG",F="observedAttributes",Ge=()=>(t,e)=>{Reflect.get(t,F)||Reflect.defineProperty(t,F,{value:[]}),Reflect.get(t,F).push(I(e))},Ne=t=>(e,n)=>{Reflect.get(e,z)||Reflect.defineProperty(e,z,{value:[]}),Reflect.get(e,q)||Reflect.defineProperty(e,q,{value:{}}),Reflect.get(e,q)[n]={bubbles:(t==null?void 0:t.bubbles)??!1,composed:(t==null?void 0:t.composed)??!1},Reflect.get(e,z).push(n)},bt=(t,e=!1)=>n=>{f(t,"start register static attr",n.prototype[F]);const s=[];if(n.styles){const l=n.styles,c=[];Array.isArray(l)?c.push(...l):c.push(l),c.forEach(d=>{const r=new CSSStyleSheet;r.replaceSync(d),s.push(r);const h=new CSSStyleSheet;h.replaceSync(d.slice(d.indexOf("@property"))),document.adoptedStyleSheets.push(h)})}class i extends n{constructor(...c){f("constructor",`%c${t}%c`),super(e,...c),R("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){f("rwc: render from new class");let c=Ct();const d=()=>{f("wrapperEffectCallback"),c=n.prototype.render.call(this)};return d.fake=!0,b(d),c}attributeChangedCallback(c,d,r){f("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${d}, newValue: ${r}`,`%c${t}%c`);try{r=JSON.parse(r)}catch{}const h=K(c);if(h in this&&v(this[h])){const m=this[h];r===null?(m.set(m.initValue),this.removeAttribute(c)):m.set(r)}W(this,n.prototype.attributeChangedCallback,c,d,r)}connectedCallback(){var d;f("rwc: connectedCallback"),f("connectedCallback",`%c${t}%c`,this),this.providers&&Object.keys(this.providers).length>0&&(f("WRAPPER for providers",t),Object.entries(this.providers).forEach(([r,h])=>{f("register provider",r,h()),this.addEventListener(r,m=>{var y;f("send provider",r,h());const C=m;((y=C.detail)==null?void 0:y.context)===r&&(C.stopPropagation(),C.detail.callback(h))})})),this.checkInjects(),(d=n.prototype[z])==null||d.forEach(r=>{this[r]=h=>{const m=n.prototype[q][r],{bubbles:C,composed:y}=m;v(h)?b(()=>{R("@oemit reactive value",h()),this.dispatchEvent(new CustomEvent(r,{detail:h(),bubbles:C,composed:y}))}):(R("@oemit value",h),this.dispatchEvent(new CustomEvent(r,{detail:h,bubbles:C,composed:y})))}}),f("start render",`%c${t}%c`,t);const c=()=>{f("rwc: insertRenderTemplate");const r=this.render();this.shadow.appendChild(r.hostElement),W(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const r=C=>C instanceof Promise||Array.isArray(C)&&C.every(y=>y instanceof Promise),h=this.rootStyle,m=C=>{const y=new CSSStyleSheet;y.replaceSync(C),this.shadow.adoptedStyleSheets.push(y);const u=new CSSStyleSheet;u.replaceSync(C.slice(C.indexOf("@property"))),document.adoptedStyleSheets.push(u)};if(r(h)){const C=[];Array.isArray(h)?C.push(...h):C.push(h),Promise.all(C).then(y=>y.forEach(u=>m(u.default))).then(()=>c())}else{const C=[];Array.isArray(h)?C.push(...h):C.push(h),C.forEach(y=>m(y)),c()}}else c();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(r=>{f(this.slotContext,this.slotContext&&this.slotContext[r.name]),R("@bslot element",r,`name:${r.name};`,r.assignedElements()),r.assignedElements().forEach(h=>{const m=this.slotContext[r.name];this.slotContext&&v(m)&&(R("@oslot element",r,`name:${r.name};`,r.assignedElements()),b(()=>{h.dispatchEvent(new CustomEvent("handleSlotContext",{detail:m()}))}))})})}disconnectedCallback(){this.shadow.replaceChildren(),this.replaceChildren(),W(this,n.prototype.disconnectedCallback)}}return E(i,"observedAttributes",n.prototype[F]??[]),E(i,"renderTagName",t),i.toString=()=>t,customElements.get(t)?console.error(`название тега ${t} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(t,i),n.renderTagName=t,n};o.BaseElement=T,o.a=ee,o.addAttributeList=rt,o.addClassList=lt,o.addCustomAttributes=it,o.addHtmlContent=U,o.addReactiveClassList=ct,o.addStyleList=at,o.appendContentItem=$,o.article=Ee,o.aside=pe,o.audio=Be,o.b=Te,o.bindReactiveSignals=gt,o.blockquote=ve,o.br=re,o.button=zt,o.camelToKebab=I,o.canvas=ze,o.checkCall=W,o.cite=ge,o.classList=nt,o.cls=Ot,o.code=ue,o.colorLog=R,o.combineLatest=Lt,o.component=bt,o.createComponent=De,o.createCustom=mt,o.createCustomEl=ft,o.createCustomElement=ut,o.createEl=P,o.createElement=k,o.createSignal=vt,o.defineSlotTemplate=Ht,o.del=$e,o.details=Fe,o.disableLogs=x,o.div=Ct,o.effect=b,o.effectMap=G,o.elementHelpers=M,o.em=Re,o.enableLogs=Et,o.event=Ne,o.eventEmitter=jt,o.figcaption=Se,o.figure=ye,o.footer=Ce,o.forkJoin=At,o.form=Zt,o.getList=kt,o.getReactiveTemplate=wt,o.getSignalContent=A,o.getTextContent=N,o.h1=se,o.h2=oe,o.h3=ie,o.h4=le,o.h5=ce,o.h6=ae,o.header=me,o.hr=de,o.htmlEffectWrapper=J,o.i=je,o.img=te,o.initComponent=X,o.input=Jt,o.ins=Pe,o.isBaseElement=Rt,o.isComponentConfig=L,o.isComponentInitConfig=p,o.isReactiveSignal=v,o.isSlotTemplate=It,o.kebabToCamel=K,o.label=Qt,o.li=Ut,o.main=be,o.mark=Me,o.meter=_e,o.nav=fe,o.newEventEmitter=Ft,o.ol=Xt,o.option=Kt,o.p=ne,o.pre=he,o.progress=We,o.projectLog=f,o.property=Ge,o.renderIf=Q,o.rs=St,o.rxRenderIf=ht,o.s=we,o.section=Bt,o.select=Yt,o.setChildren=ot,o.setEffectDebugEnabled=yt,o.setEffects=st,o.setHtmlContent=et,o.setListeners=Z,o.show=Pt,o.showIf=Y,o.signal=g,o.signalComponent=dt,o.slot=qe,o.small=Ae,o.span=_t,o.strong=Le,o.sub=ke,o.summary=He,o.sup=Ie,o.table=qt,o.td=Gt,o.textContentWrapper=V,o.textarea=xt,o.th=Nt,o.tr=Dt,o.u=Oe,o.ul=Vt,o.unsafeHtml=Mt,o.useCustomComponent=Wt,o.video=Je,o.when=$t,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,6 @@
1
1
  import { IsPromise, IsPromiseFunction, UnwrapPromise } from './helpers.types';
2
2
  import { CompareFn, ReactiveSignal, UnwrapSignal } from './signal.type';
3
+ export declare const setEffectDebugEnabled: (enabled: boolean) => void;
3
4
  export declare const effectMap: Map<string, {
4
5
  signals: Array<ReactiveSignal<any>>;
5
6
  parent: string | null;
@@ -24,4 +25,4 @@ export declare const isReactiveSignal: <R extends ReactiveSignal<any>>(v: R | an
24
25
  * // log: "abc-test"
25
26
  */
26
27
  export declare function rs<T extends ReactiveSignal<any> | any>(strings: TemplateStringsArray, ...values: T[]): ReactiveSignal<string>;
27
- export declare function createSignal<T extends Promise<any> | (() => any), I extends UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T> | undefined>(cb: T, initializeValue?: I): I extends undefined ? (IsPromise<T> extends true ? ReactiveSignal<UnwrapPromise<T> | null> : (IsPromiseFunction<T> extends true ? ReactiveSignal<UnwrapPromise<T extends () => infer R ? R : never> | null> : ReactiveSignal<UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : never>>)) : ReactiveSignal<UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T>>;
28
+ export declare function createSignal<T extends Promise<any> | (() => any), I extends UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T> | undefined>(cb: T, initializeValue?: I): I extends undefined ? IsPromise<T> extends true ? ReactiveSignal<UnwrapPromise<T> | null> : IsPromiseFunction<T> extends true ? ReactiveSignal<UnwrapPromise<T extends () => infer R ? R : never> | null> : ReactiveSignal<UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : never>> : ReactiveSignal<UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T>>;
@@ -1,2 +0,0 @@
1
- (function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o.ReactiveComponent={}))})(this,function(o){"use strict";var Ne=Object.defineProperty;var Ve=(o,p,L)=>p in o?Ne(o,p,{enumerable:!0,configurable:!0,writable:!0,value:L}):o[p]=L;var E=(o,p,L)=>Ve(o,typeof p!="symbol"?p+"":p,L);const p=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(e=>e.startsWith(".")||e.startsWith("@")||e.startsWith("$")))&&!("hostElement"in t),L=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,...n)=>{e&&e.apply(t,n)};let _=!0;const f=(...t)=>{_&&console.debug(["[rwc]",...t].join(" | "),...Array.from(t.join("").matchAll(/%c/gm)).map((e,n)=>n%2===0?"color:red":"color:inherit"))},I=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),Y=t=>t.replace(/-(\w)/gm,(e,n)=>n.toUpperCase()),R=(t,...e)=>{if(!_)return;const n={r:"color: #ff0000",g:"color: #00ff00",b:"color: #0000ff",y:"color: #ffff00",p:"color: #800080",c:"color: #00ffff",o:"color: #ffa500",w:"color: #808080"},s=t.match(/@[rgbpycow]/g)||[],i=s.map(c=>{const d=c.slice(1);return n[d]||"color: inherit"});let l=t;s.forEach(c=>{const d=new RegExp(`\\${c}([^\\s,]+)`,"g");l=l.replace(d,"%c$1")}),console.log(l,...i,...e)},pt=()=>{_=!0},K=()=>{_=!1};K();const G=new Map,O=new WeakMap,B=[],w=[];function A(t,e){const n=new Set;let s=(e==null?void 0:e.signalCompareFn)||(()=>!0);function i(){var c;const l=B[B.length-1];if(l&&!("fake"in l&&l.fake)){const d=O.get(l),a=d==null?void 0:d.parent;if(a){const h=O.get(a);h==null||h.cleanupFns.add(()=>{n.delete(l)})}n.add(l),(c=G.get(l.effectId))==null||c.signals.push(i)}return t}return i.signalId=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`,i.getSubscribers=()=>[...n],i.setCompareFn=function(l){return s=l,i},i.clearSubscribers=function(){n.clear()},i.peek=function(){return Object.freeze(t)},i.initValue=Object.freeze(t),i.oldValue=Object.freeze(t),i.forceSet=function(l){i.oldValue=Object.freeze(t),t=l,n.forEach(c=>Promise.resolve(c).then(d=>{const a=O.get(d);a&&a.cleanupFns.size>0&&(a.cleanupFns.forEach(h=>h()),a.cleanupFns.clear()),w.push(d),d(),w.pop()}))},i.set=function(l,c=s){t!==l&&c(t,l)&&i.forceSet(l)},i.update=function(l){i.set(l(t))},i.pipe=(l,c)=>{const d=A(null);return b(()=>{const a=i();b(()=>{const h=l(a);h instanceof Promise?h.then(m=>d.set(m)):v(h)?b(()=>d.set(h())):d.set(h)},c)}),d},i}function b(t,e){const n=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`;f("current effect",`%c${n}%c`);const s=t;t=()=>(f("current effect callback",`%c${n}%c`),s()),"fake"in s&&s.fake&&(t.fake=!0),t.effectId=n;const i=w[w.length-1];G.set(n,{signals:[],parent:(i==null?void 0:i.effectId)||null}),O.has(t)||O.set(t,{cleanupFns:new Set});const l=O.get(t);i?l.parent=i:delete l.parent,w.push(t),B.push(t),t(),B.pop(),w.pop()}const v=t=>!!t&&["object","function"].includes(typeof t)&&"set"in t&&"oldValue"in t&&"update"in t&&"forceSet"in t;function Et(t,...e){const n=A("");return b(()=>{const s=e.map(l=>v(l)?String(l()):String(l)),i=[t[0]];s.forEach((l,c)=>{i.push(l,t[c+1])}),n.set(i.join(""))}),n}function yt(t,e){const n=A(e??null),s=i=>n.set(i);return t instanceof Promise?t.then(s):typeof t=="function"&&b(()=>{const i=t();i instanceof Promise?i.then(s):v(i)?b(()=>s(i())):s(i)}),n}function St(t,e){let n=t(),s=e();b(()=>{const i=t(),l=e();i!==l&&(i!==n?e.set(i):l!==s&&t.set(l)),n=i,s=l})}function vt(...t){let e=t.map(s=>s());const n=A(e);return t.forEach((s,i)=>{b(()=>{const l=()=>e.filter(c=>c!==void 0).length;l()===t.length&&(e=Array.from(e).fill(void 0)),e[i]=s(),l()===t.length&&n.set([...e])})}),n}const At=(...t)=>{const e=A([]);return b(()=>{e.set(t.map(n=>n()))}),e};class T extends HTMLElement{constructor(n=!1){super();E(this,"isSlotLazyLoading",!1);E(this,"slotTemplate");E(this,"slotContext");E(this,"rootStyle");E(this,"modelValue");E(this,"providers");E(this,"appendAllSlotContent");E(this,"allSlotContent",[]);E(this,"slotContent",{});E(this,"htmlSlotContent",{});E(this,"shadow");E(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var i;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const l=n.slot||"default";this.htmlSlotContent[l]||(this.htmlSlotContent[l]=[]),(i=this.htmlSlotContent[l])==null||i.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return f("%cinject%c",n),this.injects[n]||(this.injects[n]=A(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{f("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:i=>b(()=>{s.set(i())})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}E(T,"observedAttributes",[]),E(T,"renderTagName",""),E(T,"styles");const gt=t=>"render"in t&&"setReactiveValue"in t,Lt="handleSlotContext",x="onConnected",Rt=()=>()=>{},N=t=>typeof t=="string"?t:JSON.stringify(t),V=t=>{const e=document.createElement("span");return e.textContent=N(t),e},D=(t,e)=>(t.appendChild(V(e)),t),tt=(t,e)=>(t.innerHTML="",D(t,e)),J=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=N(n)}),e},M=t=>({append(...e){return e.forEach(n=>{t.appendChild(n.hostElement),x in n.hostElement&&setTimeout(()=>{var s,i;(i=(s=n.hostElement).onConnected)==null||i.call(s,n,n.hostElement)})}),this},set(...e){this.clear();const n=document.createDocumentFragment();return e.forEach(s=>{n.appendChild(s.hostElement)}),t.appendChild(n),this},removeChild(...e){return e.forEach(n=>{Array.from(t.childNodes.values()).some(s=>s===n.hostElement)&&t.removeChild(n.hostElement)}),this},addHtmlContent(e){return D(t,e),this},setHtmlContent(e){return tt(t,e),this},addEventlistener(e,n,s=!1){return t.addEventListener(e,i=>n(i,this,t),s),this},setAttribute(e,n){let s;if(typeof n=="boolean"&&!(t instanceof T))if(n)s="";else{this.removeAttribute(e);const i=e.toLowerCase();return i in t&&(t[i]=null),this}else typeof n!="string"?s=JSON.stringify(n):s=n;if(t.setAttribute(I(e),s),!(t instanceof T)){const i=e.toLowerCase();i in t&&(t[i]=n)}return this},setCustomAttribute(e,n){let s;return typeof n!="string"?s=JSON.stringify(n):s=n,t.setAttribute(I(e),s),this},setReactiveAttribute(e,n){return b(()=>this.setAttribute(e,n())),this},setReactiveCustomAttribute(e,n){return b(()=>this.setCustomAttribute(e,n())),this},removeAttribute(e){return t.removeAttribute(I(e)),this},addStyle(e){return Object.entries(e).forEach(([n,s])=>{const i=n.startsWith("--");typeof s=="function"?this.addEffect(()=>{if(i){const l=String(s()||"");t.style.setProperty(n,l)}else t.style[n]=s()}):typeof s=="string"&&(i?t.style.setProperty(n,s):t.style[n]=s)}),this},onConnected(e){return Reflect.defineProperty(t,x,{get(){return e}}),this},addClass(...e){return e.forEach(n=>{typeof n=="string"?t.classList.add(...n.split(" ").flatMap(s=>s.split(`
2
- `)).map(s=>s.trim()).filter(Boolean)):(()=>{let s=null;this.addEffect(()=>{const i=n();i.length>0&&(s?this.replaceClass(s,i):this.addClass(i),s=i)})})()}),this},setClass(...e){return t.classList.remove(...t.classList),t.classList.add(...e),this},addReactiveClass(e){return Object.keys(e).forEach(n=>{b(()=>{e[n]()?this.addClass(n):this.removeClass(n)})}),this},removeClass(...e){return t.classList.remove(...e),this},replaceClass(e,n){return t.classList.replace(e,n),this},addEffect(e){return b(()=>e(this,this.hostElement)),this},addReactiveContent(e){return t.appendChild(J(e)),this},setReactiveContent(e){return this.clear(),t.appendChild(J(e)),this},clear(){return t.innerHTML="",this},hostElement:t}),et=(t,...e)=>({classList:[...t.map(n=>n.trim()).filter(Boolean),...e]}),Tt=(t,...e)=>et(t,...e),U=(t,e)=>{if(!e)return t;const n=Object.keys(e||{}).filter(s=>s.startsWith(".")||s.startsWith("@")||s.startsWith("$"));return n.filter(s=>s.startsWith(".")).forEach(s=>{e!=null&&e.attributes||(e.attributes={}),e.attributes[s.slice(1)]=e[s]}),n.filter(s=>s.startsWith("@")).forEach(s=>{e!=null&&e.listeners||(e.listeners={});const i=s.slice(1);e.listeners[i]=e[s]}),n.filter(s=>s.startsWith("$")).forEach(s=>{e!=null&&e.effects||(e.effects=[]),e.effects.push(e[s])}),it(t,e.classList),ct(t,e.style),rt(t,e.attributes),lt(t,e.reactiveClassList),ot(t,e.customAttributes),st(t,e.children),nt(t,e.effects),X(t,e.listeners),X(t,e.customListeners),t},X=(t,e)=>{e&&Object.entries(e).forEach(([n,s])=>{typeof s=="function"&&t.addEventlistener(n,s)})},nt=(t,e)=>e==null?void 0:e.forEach(n=>t.addEffect(n)),st=(t,e)=>$(t,...e||[]),ot=(t,e)=>{const n=e;n&&Object.keys(n).forEach(s=>{v(n[s])?t.setReactiveCustomAttribute(s,n[s]):typeof n[s]=="function"?t.addEffect(()=>{t.setCustomAttribute(s,n[s]())}):t.setCustomAttribute(s,n[s])})},it=(t,e)=>t.addClass(...e||[]),lt=(t,e)=>t.addReactiveClass(e||{}),ct=(t,e)=>t.addStyle(e||{}),rt=(t,e)=>{const n=e,s=(i,l)=>{l&&(v(l)?t.setReactiveAttribute(i,l):typeof l=="function"?t.addEffect(()=>{t.setAttribute(i,l())}):t.setAttribute(i,l))};n&&Object.keys(n).forEach(i=>{s(i,n[i])})},$=(t,...e)=>(e.forEach(n=>{typeof n=="string"?n.trim().length>0&&t.addHtmlContent(n):v(n)?t.addReactiveContent(n):t.append(n)}),t),k=(t,e)=>{const n=document.createElement(t),s={...M(n)};return U(s,e)},P=(t,e)=>{const[n,...s]=t.split(" ").map(l=>l.trim()),i=k(n,e);return s.length>0&&i.addClass(...s),(...l)=>$(i,...l.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?g(()=>c(i)):c))},g=t=>k("div").addStyle({display:"contents"}).addEffect(e=>{const n=t(),s=[];Array.isArray(n)?s.push(...n):s.push(n),e.clear(),$(e,...s)}),jt=t=>{const e=s=>typeof s=="string"?s.trim().length>0?M(V(s)):P("div")():v(s)?M(J(s)):s;return at(()=>{const s=t();return s instanceof Array&&Array.isArray(s)?s.map(e):e(s)})},Ot=(t,e,n)=>{const s=k("div").addStyle({display:"contents"}),i=new Map,l=new Map;let c=[];const d=new Set;let a=t.peek();const h=m=>{d.delete(m),i.delete(m),l.delete(m)};return b(()=>{const m=t();c=m.map(e).map(u=>typeof u=="string"?u:u.toString());const C=Array.from(s.hostElement.children);f("containerChildren",C,c),C.forEach(u=>{const S=u.dataset.key;c.includes(S)||(f("remove element",S,u),u.remove(),h(S))}),c.forEach(u=>{var H,j;const S=m[c.indexOf(u)];i.has(u)?JSON.stringify(S)!==JSON.stringify(a[c.indexOf(u)])&&((H=s.hostElement.querySelector(`[data-key="${u}"]`))==null||H.remove(),(j=i.get(u))==null||j.set(Math.random().toString(36).substring(2,15)),l.set(u,()=>n(S,c.indexOf(u),m).setCustomAttribute("data-key",u))):(f("create new element",u,S),i.set(u,A(Math.random().toString(36).substring(2,15))),l.set(u,()=>n(S,c.indexOf(u),m).setCustomAttribute("data-key",u)))}),a=m;const y=()=>{i.forEach((u,S)=>{f("key from setTimeout foreach currItemSignalMap",S),d.has(S)||(d.add(S),b(()=>{var bt;u();const H=c.indexOf(S),j=(bt=l.get(S))==null?void 0:bt();j&&(f("call effect from setTimeout",S,j.hostElement),H<=s.hostElement.children.length-1?s.hostElement.insertBefore(j.hostElement,s.hostElement.children[H]):s.hostElement.append(j.hostElement))}))})};Promise.resolve().then(()=>y())}),s},at=t=>{let e=[k("div")],n=!1;return b(()=>{var l,c;const s=t();n=Array.isArray(s);const i=[];i.push(...[s].flat()),i.length===0&&i.push(k("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{f("newReactiveComponent.map",i.map(d=>{var a;return f("newReactiveComponent hostElement",d.hostElement),(a=d.hostElement)==null?void 0:a.id})),f("currComponent[0].hostElement?.id",(l=e[0].hostElement)==null?void 0:l.id,e),(c=e[0].hostElement)==null||c.replaceWith(...i.map(d=>d.hostElement)),e.slice(1).forEach(d=>{var a;return(a=d.hostElement)==null?void 0:a.remove()}),e=i}catch(d){console.error(d)}}),n?e:e[0]},wt=t=>Lt in t,kt=t=>{const e=P("div")().addStyle({display:"contents"}),n=s=>(e.hostElement.innerHTML=s,e);return typeof t=="string"?n(t):e.addEffect(()=>{n(t())}),e},Z=(t,e,n)=>t?g(e):n?g(n):P("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),dt=(t,e,n)=>g(()=>Z(!!t(),e,n)),It=(t,e,n)=>typeof t=="boolean"?Z(t,e,n):dt(t,e,n),Q=(t,e)=>{const n=g(e);return typeof t=="boolean"?[n].flat().forEach(s=>s.hostElement.style.display=t?"block":"none"):b(()=>{const s=t()?"block":"none";[n].flat().forEach(i=>i.hostElement.style.display=s)}),n},Mt=(t,e,n)=>{const s=[Q(t,e)].flat();return n&&s.push(...[Q(()=>typeof t=="boolean"?!t:!t(),n)].flat()),g(()=>s)},ht=(t,e)=>{f("createCustomElement",t);const n=document.createElement(t),s={...M(n),setReactiveValue(i){return n instanceof T&&n.setReactiveValue(i),this},setSlotTemplate(i){const l=n.slotTemplate;return l&&Object.entries(i).forEach(([c,d])=>{l[c]=d}),this}};return U(s,e)},ut=(t,e)=>{const n=t.split(" ").slice(1).map(i=>i.trim()),s=ht(t.split(" ")[0],e);return Array.isArray(n)&&n.length>0&&s.addClass(...n),(...i)=>{R("@rcreateCustomEl content",t,i);const l=i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?g(()=>c(s)):c);return s.hostElement.allSlotContent=l,s.hostElement.slotContent=l.filter(L).reduce((c,d)=>{const a=d.hostElement.getAttribute("slot")||"default";return c[a]||(c[a]=[]),c[a].push(d),c},{}),s.hostElement.appendAllSlotContent=()=>$(s,...l),s}},ft=(t,e,n)=>ut(`${t.renderTagName}${e&&typeof e=="string"?" "+e:""}`,p(e)?e:e&&typeof e=="string"?n:void 0),$t=()=>{const t=()=>{};return t.oldValue=null,t},Pt=()=>({}),Ft=(t,e,n)=>{const s=e?Ct(e,n)(t):t;return(i,...l)=>{const c=[...l];return i&&!p(i)&&c.unshift(i),ft(s,p(i)?i:{})(...c)}},r={};["div","span","section","input","button","table","tr","td","th","ul","li","ol","form","label","select","option","textarea","img","a","p","h1","h2","h3","h4","h5","h6","br","hr","pre","code","nav","header","footer","main","aside","article","figure","figcaption","blockquote","cite","small","strong","em","b","i","u","s","sub","sup","mark","del","ins","details","summary","progress","meter","audio","video","canvas","slot"].forEach(t=>{r[t]=(e,...n)=>{let s=[...n];return e&&!p(e)&&(s=[e].concat(s)),P(t,p(e)?e:{})(...s)}});const mt=r.div,Ht=r.span,Wt=r.section,_t=r.input,Bt=r.button,Jt=r.table,zt=r.tr,qt=r.td,Gt=r.th,Nt=r.ul,Vt=r.li,Dt=r.ol,Ut=r.form,Xt=r.label,Zt=r.select,Qt=r.option,Yt=r.textarea,Kt=r.img,xt=r.a,te=r.p,ee=r.h1,ne=r.h2,se=r.h3,oe=r.h4,ie=r.h5,le=r.h6,ce=r.br,re=r.hr,ae=r.pre,de=r.code,he=r.nav,ue=r.header,fe=r.footer,me=r.main,Ce=r.aside,be=r.article,pe=r.figure,Ee=r.figcaption,ye=r.blockquote,Se=r.cite,ve=r.small,Ae=r.strong,ge=r.em,Le=r.b,Re=r.i,Te=r.u,je=r.s,Oe=r.sub,we=r.sup,ke=r.mark,Ie=r.del,Me=r.ins,$e=r.details,Pe=r.summary,Fe=r.progress,He=r.meter,We=r.audio,_e=r.video,Be=r.canvas,Je=r.slot,ze=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{}),z="eventProps",q="EVENT_CONFIG",F="observedAttributes",qe=()=>(t,e)=>{Reflect.get(t,F)||Reflect.defineProperty(t,F,{value:[]}),Reflect.get(t,F).push(I(e))},Ge=t=>(e,n)=>{Reflect.get(e,z)||Reflect.defineProperty(e,z,{value:[]}),Reflect.get(e,q)||Reflect.defineProperty(e,q,{value:{}}),Reflect.get(e,q)[n]={bubbles:(t==null?void 0:t.bubbles)??!1,composed:(t==null?void 0:t.composed)??!1},Reflect.get(e,z).push(n)},Ct=(t,e=!1)=>n=>{f(t,"start register static attr",n.prototype[F]);const s=[];if(n.styles){const l=n.styles,c=[];Array.isArray(l)?c.push(...l):c.push(l),c.forEach(d=>{const a=new CSSStyleSheet;a.replaceSync(d),s.push(a);const h=new CSSStyleSheet;h.replaceSync(d.slice(d.indexOf("@property"))),document.adoptedStyleSheets.push(h)})}class i extends n{constructor(...c){f("constructor",`%c${t}%c`),super(e,...c),R("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){f("rwc: render from new class");let c=mt();const d=()=>{f("wrapperEffectCallback"),c=n.prototype.render.call(this)};return d.fake=!0,b(d),c}attributeChangedCallback(c,d,a){f("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${d}, newValue: ${a}`,`%c${t}%c`);try{a=JSON.parse(a)}catch{}const h=Y(c);if(h in this&&v(this[h])){const m=this[h];a===null?(m.set(m.initValue),this.removeAttribute(c)):m.set(a)}W(this,n.prototype.attributeChangedCallback,c,d,a)}connectedCallback(){var d;f("rwc: connectedCallback"),f("connectedCallback",`%c${t}%c`,this),this.providers&&Object.keys(this.providers).length>0&&(f("WRAPPER for providers",t),Object.entries(this.providers).forEach(([a,h])=>{f("register provider",a,h()),this.addEventListener(a,m=>{var y;f("send provider",a,h());const C=m;((y=C.detail)==null?void 0:y.context)===a&&(C.stopPropagation(),C.detail.callback(h))})})),this.checkInjects(),(d=n.prototype[z])==null||d.forEach(a=>{this[a]=h=>{const m=n.prototype[q][a],{bubbles:C,composed:y}=m;v(h)?b(()=>{R("@oemit reactive value",h()),this.dispatchEvent(new CustomEvent(a,{detail:h(),bubbles:C,composed:y}))}):(R("@oemit value",h),this.dispatchEvent(new CustomEvent(a,{detail:h,bubbles:C,composed:y})))}}),f("start render",`%c${t}%c`,t);const c=()=>{f("rwc: insertRenderTemplate");const a=this.render();this.shadow.appendChild(a.hostElement),W(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const a=C=>C instanceof Promise||Array.isArray(C)&&C.every(y=>y instanceof Promise),h=this.rootStyle,m=C=>{const y=new CSSStyleSheet;y.replaceSync(C),this.shadow.adoptedStyleSheets.push(y);const u=new CSSStyleSheet;u.replaceSync(C.slice(C.indexOf("@property"))),document.adoptedStyleSheets.push(u)};if(a(h)){const C=[];Array.isArray(h)?C.push(...h):C.push(h),Promise.all(C).then(y=>y.forEach(u=>m(u.default))).then(()=>c())}else{const C=[];Array.isArray(h)?C.push(...h):C.push(h),C.forEach(y=>m(y)),c()}}else c();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(a=>{f(this.slotContext,this.slotContext&&this.slotContext[a.name]),R("@bslot element",a,`name:${a.name};`,a.assignedElements()),a.assignedElements().forEach(h=>{const m=this.slotContext[a.name];this.slotContext&&v(m)&&(R("@oslot element",a,`name:${a.name};`,a.assignedElements()),b(()=>{h.dispatchEvent(new CustomEvent("handleSlotContext",{detail:m()}))}))})})}disconnectedCallback(){this.shadow.replaceChildren(),this.replaceChildren(),W(this,n.prototype.disconnectedCallback)}}return E(i,"observedAttributes",n.prototype[F]??[]),E(i,"renderTagName",t),i.toString=()=>t,customElements.get(t)?console.error(`название тега ${t} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(t,i),n.renderTagName=t,n};o.BaseElement=T,o.a=xt,o.addAttributeList=rt,o.addClassList=it,o.addCustomAttributes=ot,o.addHtmlContent=D,o.addReactiveClassList=lt,o.addStyleList=ct,o.appendContentItem=$,o.article=be,o.aside=Ce,o.audio=We,o.b=Le,o.bindReactiveSignals=St,o.blockquote=ye,o.br=ce,o.button=Bt,o.camelToKebab=I,o.canvas=Be,o.checkCall=W,o.cite=Se,o.classList=et,o.cls=Tt,o.code=de,o.colorLog=R,o.combineLatest=At,o.component=Ct,o.createComponent=ze,o.createCustom=ft,o.createCustomEl=ut,o.createCustomElement=ht,o.createEl=P,o.createElement=k,o.createSignal=yt,o.defineSlotTemplate=Pt,o.del=Ie,o.details=$e,o.disableLogs=K,o.div=mt,o.effect=b,o.effectMap=G,o.elementHelpers=M,o.em=ge,o.enableLogs=pt,o.event=Ge,o.eventEmitter=Rt,o.figcaption=Ee,o.figure=pe,o.footer=fe,o.forkJoin=vt,o.form=Ut,o.getList=Ot,o.getReactiveTemplate=jt,o.getSignalContent=g,o.getTextContent=N,o.h1=ee,o.h2=ne,o.h3=se,o.h4=oe,o.h5=ie,o.h6=le,o.header=ue,o.hr=re,o.htmlEffectWrapper=J,o.i=Re,o.img=Kt,o.initComponent=U,o.input=_t,o.ins=Me,o.isBaseElement=gt,o.isComponentConfig=L,o.isComponentInitConfig=p,o.isReactiveSignal=v,o.isSlotTemplate=wt,o.kebabToCamel=Y,o.label=Xt,o.li=Vt,o.main=me,o.mark=ke,o.meter=He,o.nav=he,o.newEventEmitter=$t,o.ol=Dt,o.option=Qt,o.p=te,o.pre=ae,o.progress=Fe,o.projectLog=f,o.property=qe,o.renderIf=Z,o.rs=Et,o.rxRenderIf=dt,o.s=je,o.section=Wt,o.select=Zt,o.setChildren=st,o.setEffects=nt,o.setHtmlContent=tt,o.setListeners=X,o.show=Mt,o.showIf=Q,o.signal=A,o.signalComponent=at,o.slot=Je,o.small=ve,o.span=Ht,o.strong=Ae,o.sub=Oe,o.summary=Pe,o.sup=we,o.table=Jt,o.td=qt,o.textContentWrapper=V,o.textarea=Yt,o.th=Gt,o.tr=zt,o.u=Te,o.ul=Nt,o.unsafeHtml=kt,o.useCustomComponent=Ft,o.video=_e,o.when=It,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});