@reactive-web-components/rwc 2.56.0 → 2.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactive-web-components/rwc",
|
|
3
|
-
"version": "2.56.
|
|
3
|
+
"version": "2.56.1",
|
|
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.
|
|
10
|
-
"require": "./reactive-web-component.
|
|
9
|
+
"import": "./reactive-web-component.BCR_pqgk.js",
|
|
10
|
+
"require": "./reactive-web-component.hsKnlQSe.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.
|
|
38
|
-
"main": "./reactive-web-component.
|
|
37
|
+
"module": "./reactive-web-component.BCR_pqgk.js",
|
|
38
|
+
"main": "./reactive-web-component.hsKnlQSe.umd.cjs"
|
|
39
39
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (t, e, s) =>
|
|
4
|
-
const
|
|
1
|
+
var rt = Object.defineProperty;
|
|
2
|
+
var ot = (t, e, s) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var p = (t, e, s) => ot(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
const I = (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),
|
|
6
|
+
)) && !("hostElement" in t), it = (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, q = (t, e, ...s) => {
|
|
7
7
|
e && e.apply(t, s);
|
|
8
8
|
};
|
|
9
9
|
let B = !0;
|
|
@@ -12,7 +12,7 @@ const m = (...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
|
-
}, W = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`),
|
|
15
|
+
}, W = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`), at = (t) => t.replace(/-(\w)/gm, (e, s) => s.toUpperCase()), O = (t, ...e) => {
|
|
16
16
|
if (!B) return;
|
|
17
17
|
const s = {
|
|
18
18
|
r: "color: #ff0000",
|
|
@@ -40,26 +40,26 @@ const m = (...t) => {
|
|
|
40
40
|
const l = new RegExp(`\\${i}([^\\s,]+)`, "g");
|
|
41
41
|
o = o.replace(l, "%c$1");
|
|
42
42
|
}), console.log(o, ...r, ...e);
|
|
43
|
-
},
|
|
43
|
+
}, xt = () => {
|
|
44
44
|
B = !0;
|
|
45
|
-
},
|
|
45
|
+
}, lt = () => {
|
|
46
46
|
B = !1;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
lt();
|
|
49
49
|
const v = [];
|
|
50
50
|
let D = !1;
|
|
51
|
-
const
|
|
51
|
+
const kt = (t) => {
|
|
52
52
|
D = t;
|
|
53
|
-
}, Q = /* @__PURE__ */ new Map(),
|
|
54
|
-
function
|
|
53
|
+
}, Q = /* @__PURE__ */ new Map(), j = [], F = [], w = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap();
|
|
54
|
+
function R(t, e) {
|
|
55
55
|
let s = (e == null ? void 0 : e.signalCompareFn) || (() => !0);
|
|
56
56
|
function n() {
|
|
57
57
|
var i, l, d, c;
|
|
58
58
|
const o = F[F.length - 1];
|
|
59
|
-
return o && !("fake" in o && o.fake) && (y.has(n) || y.set(n, /* @__PURE__ */ new Set()), (i = y.get(n)) == null || i.add(o),
|
|
59
|
+
return o && !("fake" in o && o.fake) && (y.has(n) || y.set(n, /* @__PURE__ */ new Set()), (i = y.get(n)) == null || i.add(o), k.has(o) || k.set(o, /* @__PURE__ */ new Set()), (l = k.get(o)) == null || l.add(() => {
|
|
60
60
|
var h;
|
|
61
61
|
(h = y.get(n)) == null || h.delete(o);
|
|
62
|
-
}),
|
|
62
|
+
}), x.has(o) || x.set(o, /* @__PURE__ */ new Set()), (d = x.get(o)) == null || d.add(n), D && ((c = Q.get(o.effectId)) == null || c.signals.push(n))), t;
|
|
63
63
|
}
|
|
64
64
|
let r = "";
|
|
65
65
|
return Object.defineProperty(n, "signalId", {
|
|
@@ -86,7 +86,7 @@ function O(t, e) {
|
|
|
86
86
|
h();
|
|
87
87
|
}), (c = w.get(l)) == null || c.clear(), Promise.resolve().then(() => {
|
|
88
88
|
const h = N.get(l);
|
|
89
|
-
h && v.push(h),
|
|
89
|
+
h && v.push(h), j.push(l), l(), j.pop(), h && v.pop();
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
}, n.set = function(o, i = s) {
|
|
@@ -94,7 +94,7 @@ function O(t, e) {
|
|
|
94
94
|
}, n.update = function(o) {
|
|
95
95
|
n.set(o(t));
|
|
96
96
|
}, n.pipe = (o, i) => {
|
|
97
|
-
const l =
|
|
97
|
+
const l = R(null);
|
|
98
98
|
return C(() => {
|
|
99
99
|
const d = n();
|
|
100
100
|
C(() => {
|
|
@@ -108,25 +108,25 @@ function C(t, e) {
|
|
|
108
108
|
var i, l;
|
|
109
109
|
const s = "fake" in t && t.fake, n = `${(e == null ? void 0 : e.name) || ""}_${Math.random().toString(36).substring(2, 15)}`;
|
|
110
110
|
m("current effect", `%c${n}%c`), t.effectId = n;
|
|
111
|
-
const r =
|
|
111
|
+
const r = j[j.length - 1];
|
|
112
112
|
D && Q.set(n, {
|
|
113
113
|
signals: [],
|
|
114
114
|
// parent: (parentCb as any)?.effectId || null,
|
|
115
115
|
parent: null
|
|
116
|
-
}), s ||
|
|
116
|
+
}), s || j.push(t), F.push(t);
|
|
117
117
|
const o = v[v.length - 1];
|
|
118
|
-
o && !s && (
|
|
118
|
+
o && !s && (T.has(o) || T.set(o, /* @__PURE__ */ new Set()), (i = T.get(o)) == null || i.add(t), N.set(t, o)), t(), F.pop(), s || j.pop(), r && !s && (w.has(r) || w.set(r, /* @__PURE__ */ new Set()), (l = w.get(r)) == null || l.add(() => {
|
|
119
119
|
var c, h;
|
|
120
|
-
const d =
|
|
120
|
+
const d = x.get(t);
|
|
121
121
|
d == null || d.forEach((b) => {
|
|
122
|
-
var
|
|
123
|
-
(
|
|
124
|
-
}), (c = w.get(t)) == null || c.forEach((b) => b()), (h = w.get(t)) == null || h.clear(), w.delete(t),
|
|
122
|
+
var u;
|
|
123
|
+
(u = y.get(b)) == null || u.delete(t);
|
|
124
|
+
}), (c = w.get(t)) == null || c.forEach((b) => b()), (h = w.get(t)) == null || h.clear(), w.delete(t), x.delete(t);
|
|
125
125
|
}));
|
|
126
126
|
}
|
|
127
127
|
const S = (t) => !!t && ["object", "function"].includes(typeof t) && "set" in t && "update" in t && "forceSet" in t;
|
|
128
|
-
function
|
|
129
|
-
const s =
|
|
128
|
+
function Tt(t, ...e) {
|
|
129
|
+
const s = R("");
|
|
130
130
|
return C(() => {
|
|
131
131
|
const n = e.map(
|
|
132
132
|
(o) => S(o) ? String(o()) : String(o)
|
|
@@ -136,23 +136,23 @@ function kt(t, ...e) {
|
|
|
136
136
|
}), s.set(r.join(""));
|
|
137
137
|
}), s;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
const s =
|
|
139
|
+
function $t(t, e) {
|
|
140
|
+
const s = R(e ?? null), n = (r) => s.set(r);
|
|
141
141
|
return t instanceof Promise ? t.then(n) : typeof t == "function" && C(() => {
|
|
142
142
|
const r = t();
|
|
143
143
|
r instanceof Promise ? r.then(n) : S(r) ? C(() => n(r())) : n(r);
|
|
144
144
|
}), s;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function It(t, e) {
|
|
147
147
|
let s = t(), n = e();
|
|
148
148
|
C(() => {
|
|
149
149
|
const r = t(), o = e();
|
|
150
150
|
r !== o && (r !== s ? e.set(r) : o !== n && t.set(o)), s = r, n = o;
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Pt(...t) {
|
|
154
154
|
let e = t.map((n) => n());
|
|
155
|
-
const s =
|
|
155
|
+
const s = R(e);
|
|
156
156
|
return t.forEach((n, r) => {
|
|
157
157
|
C(() => {
|
|
158
158
|
const o = () => e.filter((i) => i !== void 0).length;
|
|
@@ -160,18 +160,18 @@ function It(...t) {
|
|
|
160
160
|
});
|
|
161
161
|
}), s;
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
const e =
|
|
163
|
+
const Wt = (...t) => {
|
|
164
|
+
const e = R([]);
|
|
165
165
|
return C(() => {
|
|
166
166
|
e.set(t.map((s) => s()));
|
|
167
167
|
}), e;
|
|
168
|
-
}, H = "eventProps", _ = "EVENT_CONFIG",
|
|
169
|
-
Reflect.get(t,
|
|
168
|
+
}, H = "eventProps", _ = "EVENT_CONFIG", $ = "observedAttributes", Ht = () => (t, e) => {
|
|
169
|
+
Reflect.get(t, $) || Reflect.defineProperty(t, $, {
|
|
170
170
|
value: []
|
|
171
|
-
}), Reflect.get(t,
|
|
171
|
+
}), Reflect.get(t, $).push(
|
|
172
172
|
W(e)
|
|
173
173
|
);
|
|
174
|
-
},
|
|
174
|
+
}, _t = (t) => (e, s) => {
|
|
175
175
|
Reflect.get(e, H) || Reflect.defineProperty(e, H, {
|
|
176
176
|
value: []
|
|
177
177
|
}), Reflect.get(e, _) || Reflect.defineProperty(e, _, {
|
|
@@ -184,7 +184,7 @@ const Pt = (...t) => {
|
|
|
184
184
|
m(
|
|
185
185
|
t,
|
|
186
186
|
"start register static attr",
|
|
187
|
-
s.prototype[
|
|
187
|
+
s.prototype[$]
|
|
188
188
|
);
|
|
189
189
|
const n = [];
|
|
190
190
|
if (s.styles) {
|
|
@@ -202,7 +202,7 @@ const Pt = (...t) => {
|
|
|
202
202
|
// }
|
|
203
203
|
// effects = new Set<Set<() => void>>();
|
|
204
204
|
constructor(...i) {
|
|
205
|
-
m("constructor", `%c${t}%c`), super(e, ...i),
|
|
205
|
+
m("constructor", `%c${t}%c`), super(e, ...i), O("@osheet", n), n.length > 0 && this.shadow.adoptedStyleSheets.push(...n);
|
|
206
206
|
}
|
|
207
207
|
render() {
|
|
208
208
|
return m("rwc: render from new class"), s.prototype.render.call(this);
|
|
@@ -218,7 +218,7 @@ const Pt = (...t) => {
|
|
|
218
218
|
d = JSON.parse(d);
|
|
219
219
|
} catch {
|
|
220
220
|
}
|
|
221
|
-
const c =
|
|
221
|
+
const c = at(i);
|
|
222
222
|
if (c in this && S(this[c])) {
|
|
223
223
|
const h = this[c];
|
|
224
224
|
d === null ? (h.set(h.initValue), this.removeAttribute(i)) : h.set(d);
|
|
@@ -238,29 +238,29 @@ const Pt = (...t) => {
|
|
|
238
238
|
m("rwc: connectedCallback"), m("connectedCallback", `%c${t}%c`, this), this.providers && Object.keys(this.providers).length > 0 && (m("WRAPPER for providers", t), Object.entries(this.providers).forEach(
|
|
239
239
|
([c, h]) => {
|
|
240
240
|
m("register provider", c, h()), this.addEventListener(c, (b) => {
|
|
241
|
-
var
|
|
241
|
+
var f;
|
|
242
242
|
m("send provider", c, h());
|
|
243
|
-
const
|
|
244
|
-
((
|
|
243
|
+
const u = b;
|
|
244
|
+
((f = u.detail) == null ? void 0 : f.context) === c && (u.stopPropagation(), u.detail.callback(h));
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
)), this.checkInjects(), (d = s.prototype[H]) == null || d.forEach(
|
|
248
248
|
(c) => {
|
|
249
249
|
this[c] = (h) => {
|
|
250
|
-
const b = s.prototype[_][c], { bubbles:
|
|
250
|
+
const b = s.prototype[_][c], { bubbles: u, composed: f } = b;
|
|
251
251
|
S(h) ? C(() => {
|
|
252
|
-
|
|
252
|
+
O("@oemit reactive value", h()), this.dispatchEvent(
|
|
253
253
|
new CustomEvent(c, {
|
|
254
254
|
detail: h(),
|
|
255
|
-
bubbles:
|
|
256
|
-
composed:
|
|
255
|
+
bubbles: u,
|
|
256
|
+
composed: f
|
|
257
257
|
})
|
|
258
258
|
);
|
|
259
|
-
}) : (
|
|
259
|
+
}) : (O("@oemit value", h), this.dispatchEvent(
|
|
260
260
|
new CustomEvent(c, {
|
|
261
261
|
detail: h,
|
|
262
|
-
bubbles:
|
|
263
|
-
composed:
|
|
262
|
+
bubbles: u,
|
|
263
|
+
composed: f
|
|
264
264
|
})
|
|
265
265
|
));
|
|
266
266
|
};
|
|
@@ -272,18 +272,18 @@ const Pt = (...t) => {
|
|
|
272
272
|
this.shadow.appendChild(c.hostElement), q(this, s.prototype.connectedCallback), this.appendSlotContent();
|
|
273
273
|
};
|
|
274
274
|
if (this.rootStyle && !s.styles) {
|
|
275
|
-
const c = (
|
|
276
|
-
const
|
|
277
|
-
|
|
275
|
+
const c = (u) => u instanceof Promise || Array.isArray(u) && u.every((f) => f instanceof Promise), h = this.rootStyle, b = (u) => {
|
|
276
|
+
const f = new CSSStyleSheet();
|
|
277
|
+
f.replaceSync(u), this.shadow.adoptedStyleSheets.push(f);
|
|
278
278
|
const E = new CSSStyleSheet();
|
|
279
|
-
E.replaceSync(
|
|
279
|
+
E.replaceSync(u.slice(u.indexOf("@property"))), document.adoptedStyleSheets.push(E);
|
|
280
280
|
};
|
|
281
281
|
if (c(h)) {
|
|
282
|
-
const
|
|
283
|
-
Array.isArray(h) ?
|
|
282
|
+
const u = [];
|
|
283
|
+
Array.isArray(h) ? u.push(...h) : u.push(h), Promise.all(u).then((f) => f.forEach((E) => b(E.default))).then(() => l());
|
|
284
284
|
} else {
|
|
285
|
-
const
|
|
286
|
-
Array.isArray(h) ?
|
|
285
|
+
const u = [];
|
|
286
|
+
Array.isArray(h) ? u.push(...h) : u.push(h), u.forEach((f) => b(f)), l();
|
|
287
287
|
}
|
|
288
288
|
} else
|
|
289
289
|
l();
|
|
@@ -291,14 +291,14 @@ const Pt = (...t) => {
|
|
|
291
291
|
m(
|
|
292
292
|
this.slotContext,
|
|
293
293
|
this.slotContext && this.slotContext[c.name]
|
|
294
|
-
),
|
|
294
|
+
), O(
|
|
295
295
|
"@bslot element",
|
|
296
296
|
c,
|
|
297
297
|
`name:${c.name};`,
|
|
298
298
|
c.assignedElements()
|
|
299
299
|
), c.assignedElements().forEach((h) => {
|
|
300
300
|
const b = this.slotContext[c.name];
|
|
301
|
-
this.slotContext && S(b) && (
|
|
301
|
+
this.slotContext && S(b) && (O(
|
|
302
302
|
"@oslot element",
|
|
303
303
|
c,
|
|
304
304
|
`name:${c.name};`,
|
|
@@ -317,13 +317,13 @@ const Pt = (...t) => {
|
|
|
317
317
|
}
|
|
318
318
|
disconnectedCallback() {
|
|
319
319
|
var i;
|
|
320
|
-
this.shadow.replaceChildren(), this.replaceChildren(), (i =
|
|
320
|
+
this.shadow.replaceChildren(), this.replaceChildren(), (i = T.get(this)) == null || i.forEach((l) => {
|
|
321
321
|
var d;
|
|
322
|
-
(d =
|
|
323
|
-
}),
|
|
322
|
+
(d = k.get(l)) == null || d.forEach((c) => c()), k.delete(l), N.delete(l);
|
|
323
|
+
}), T.delete(this), q(this, s.prototype.disconnectedCallback);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
return p(r, "observedAttributes", s.prototype[
|
|
326
|
+
return p(r, "observedAttributes", s.prototype[$] ?? []), p(r, "renderTagName", t), r.toString = () => t, customElements.get(t) ? console.error(
|
|
327
327
|
`название тега ${t} повторяется, компонент ${s.name} не зарегистрирован`
|
|
328
328
|
) : customElements.define(t, r), s.renderTagName = t, s;
|
|
329
329
|
};
|
|
@@ -359,7 +359,7 @@ class A extends HTMLElement {
|
|
|
359
359
|
(s = this.appendAllSlotContent) == null || s.call(this);
|
|
360
360
|
}
|
|
361
361
|
inject(s) {
|
|
362
|
-
return m("%cinject%c", s), this.injects[s] || (this.injects[s] =
|
|
362
|
+
return m("%cinject%c", s), this.injects[s] || (this.injects[s] = R(null)), this.injects[s];
|
|
363
363
|
}
|
|
364
364
|
checkInjects() {
|
|
365
365
|
Object.entries(this.injects).forEach(([s, n]) => {
|
|
@@ -386,10 +386,10 @@ class A extends HTMLElement {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
p(A, "observedAttributes", []), p(A, "renderTagName", ""), p(A, "styles");
|
|
389
|
-
const
|
|
389
|
+
const Ft = (t) => "render" in t && "setReactiveValue" in t, ct = "handleSlotContext", V = "onConnected", K = (t) => typeof t == "string" ? t : JSON.stringify(t), ht = (t) => {
|
|
390
390
|
const e = document.createElement("span");
|
|
391
391
|
return e.textContent = K(t), e;
|
|
392
|
-
}, tt = (t, e) => (t.appendChild(
|
|
392
|
+
}, tt = (t, e) => (t.appendChild(ht(e)), t), pt = (t, e) => (t.replaceChildren(), tt(t, e)), U = (t) => {
|
|
393
393
|
const e = document.createElement("span");
|
|
394
394
|
return C(() => {
|
|
395
395
|
const s = t();
|
|
@@ -423,7 +423,7 @@ class et {
|
|
|
423
423
|
) && this.wrapper.removeChild(s.hostElement);
|
|
424
424
|
}), this));
|
|
425
425
|
p(this, "addHtmlContent", (e) => (tt(this.wrapper, e), this));
|
|
426
|
-
p(this, "setHtmlContent", (e) => (
|
|
426
|
+
p(this, "setHtmlContent", (e) => (pt(this.wrapper, e), this));
|
|
427
427
|
p(this, "setAttribute", (e, s) => {
|
|
428
428
|
let n;
|
|
429
429
|
if (typeof s == "boolean" && !(this.wrapper instanceof A))
|
|
@@ -496,7 +496,7 @@ class et {
|
|
|
496
496
|
return this.wrapper.addEventListener(e, (r) => s(r, this, this.wrapper), n), this;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
class
|
|
499
|
+
class dt extends et {
|
|
500
500
|
constructor() {
|
|
501
501
|
super(...arguments);
|
|
502
502
|
p(this, "setReactiveValue", (s) => (this.wrapper instanceof A && this.wrapper.setReactiveValue(s), this));
|
|
@@ -508,10 +508,10 @@ class ut extends et {
|
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
const
|
|
512
|
-
}, ft = (t) => new
|
|
511
|
+
const Bt = () => () => {
|
|
512
|
+
}, ft = (t) => new dt(t), ut = (t) => new et(t), mt = (t, ...e) => ({
|
|
513
513
|
classList: [...t.map((s) => s.trim()).filter(Boolean), ...e]
|
|
514
|
-
}),
|
|
514
|
+
}), Jt = (t, ...e) => mt(t, ...e), st = (t, e) => {
|
|
515
515
|
if (!e) return t;
|
|
516
516
|
const s = Object.keys(e || {}).filter(
|
|
517
517
|
(n) => n.startsWith(".") || n.startsWith("@") || n.startsWith("$")
|
|
@@ -524,19 +524,19 @@ const Ft = () => () => {
|
|
|
524
524
|
e.listeners[r] = e[n];
|
|
525
525
|
}), s.filter((n) => n.startsWith("$")).forEach((n) => {
|
|
526
526
|
e != null && e.effects || (e.effects = []), e.effects.push(e[n]);
|
|
527
|
-
}),
|
|
527
|
+
}), St(t, e.classList), wt(t, e.style), vt(t, e.attributes), yt(t, e.reactiveClassList), bt(t, e.customAttributes), Et(t, e.children), Ct(t, e.effects), X(t, e.listeners), X(t, e.customListeners), t;
|
|
528
528
|
}, X = (t, e) => {
|
|
529
529
|
e && Object.entries(e).forEach(([s, n]) => {
|
|
530
530
|
typeof n == "function" && t.addEventlistener(s, n);
|
|
531
531
|
});
|
|
532
|
-
},
|
|
532
|
+
}, Ct = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)), Et = (t, e) => J(t, ...e || []), bt = (t, e) => {
|
|
533
533
|
const s = e;
|
|
534
534
|
s && Object.keys(s).forEach((n) => {
|
|
535
535
|
S(s[n]) ? t.setReactiveCustomAttribute(n, s[n]) : typeof s[n] == "function" ? t.addEffect(() => {
|
|
536
536
|
t.setCustomAttribute(n, s[n]());
|
|
537
537
|
}) : t.setCustomAttribute(n, s[n]);
|
|
538
538
|
});
|
|
539
|
-
},
|
|
539
|
+
}, St = (t, e) => t.addClass(...e || []), yt = (t, e) => t.addReactiveClass(e || {}), wt = (t, e) => t.addStyle(e || {}), vt = (t, e) => {
|
|
540
540
|
const s = e, n = (r, o) => {
|
|
541
541
|
o && (S(o) ? t.setReactiveAttribute(r, o) : typeof o == "function" ? t.addEffect(() => {
|
|
542
542
|
t.setAttribute(r, o());
|
|
@@ -548,19 +548,19 @@ const Ft = () => () => {
|
|
|
548
548
|
}, J = (t, ...e) => (e.forEach((s) => {
|
|
549
549
|
typeof s == "string" ? s.trim().length > 0 && t.addHtmlContent(s) : S(s) ? t.addReactiveContent(s) : t.append(s);
|
|
550
550
|
}), t), P = (t, e) => {
|
|
551
|
-
const s = document.createElement(t), n =
|
|
551
|
+
const s = document.createElement(t), n = ut(s);
|
|
552
552
|
return st(n, e);
|
|
553
553
|
}, z = (t, e) => {
|
|
554
554
|
const [s, ...n] = t.split(" ").map((o) => o.trim()), r = P(s, e);
|
|
555
555
|
return n.length > 0 && r.addClass(...n), (...o) => J(
|
|
556
556
|
r,
|
|
557
557
|
...o.filter(Boolean).flat().flatMap(
|
|
558
|
-
(i) => typeof i == "function" && !S(i) ?
|
|
558
|
+
(i) => typeof i == "function" && !S(i) ? L(() => i(r)) : i
|
|
559
559
|
)
|
|
560
560
|
);
|
|
561
|
-
},
|
|
561
|
+
}, L = (t) => P("div").addStyle({ display: "contents" }).addEffect((e) => {
|
|
562
562
|
e.clear(), J(e, ...[t()].flat());
|
|
563
|
-
}),
|
|
563
|
+
}), qt = (t, e, s) => {
|
|
564
564
|
const n = P("div").addStyle({ display: "contents" }), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
565
565
|
let i = [];
|
|
566
566
|
const l = /* @__PURE__ */ new Set();
|
|
@@ -570,51 +570,51 @@ const Ft = () => () => {
|
|
|
570
570
|
};
|
|
571
571
|
return C(() => {
|
|
572
572
|
const h = t();
|
|
573
|
-
i = h.map(e).map((
|
|
573
|
+
i = h.map(e).map((f) => typeof f == "string" ? f : f.toString());
|
|
574
574
|
const b = Array.from(n.hostElement.children);
|
|
575
|
-
m("containerChildren", b, i), b.forEach((
|
|
576
|
-
const E =
|
|
577
|
-
i.includes(E) || (m("remove element", E,
|
|
578
|
-
}), i.forEach((
|
|
579
|
-
var
|
|
580
|
-
const E = h[i.indexOf(
|
|
581
|
-
r.has(
|
|
582
|
-
|
|
583
|
-
() => s(E, i.indexOf(
|
|
575
|
+
m("containerChildren", b, i), b.forEach((f) => {
|
|
576
|
+
const E = f.dataset.key;
|
|
577
|
+
i.includes(E) || (m("remove element", E, f), f.remove(), c(E));
|
|
578
|
+
}), i.forEach((f) => {
|
|
579
|
+
var M, g;
|
|
580
|
+
const E = h[i.indexOf(f)];
|
|
581
|
+
r.has(f) ? JSON.stringify(E) !== JSON.stringify(d[i.indexOf(f)]) && ((M = n.hostElement.querySelector(`[data-key="${f}"]`)) == null || M.remove(), (g = r.get(f)) == null || g.set(Math.random().toString(36).substring(2, 15)), o.set(
|
|
582
|
+
f,
|
|
583
|
+
() => s(E, i.indexOf(f), h).setCustomAttribute(
|
|
584
584
|
"data-key",
|
|
585
|
-
|
|
585
|
+
f
|
|
586
586
|
)
|
|
587
|
-
)) : (m("create new element",
|
|
588
|
-
|
|
589
|
-
|
|
587
|
+
)) : (m("create new element", f, E), r.set(
|
|
588
|
+
f,
|
|
589
|
+
R(Math.random().toString(36).substring(2, 15))
|
|
590
590
|
), o.set(
|
|
591
|
-
|
|
592
|
-
() => s(E, i.indexOf(
|
|
591
|
+
f,
|
|
592
|
+
() => s(E, i.indexOf(f), h).setCustomAttribute(
|
|
593
593
|
"data-key",
|
|
594
|
-
|
|
594
|
+
f
|
|
595
595
|
)
|
|
596
596
|
));
|
|
597
|
-
}), d = [...h.map((
|
|
598
|
-
const
|
|
599
|
-
r.forEach((
|
|
597
|
+
}), d = [...h.map((f) => ({ ...f }))];
|
|
598
|
+
const u = () => {
|
|
599
|
+
r.forEach((f, E) => {
|
|
600
600
|
m("key from setTimeout foreach currItemSignalMap", E), l.has(E) || (l.add(E), C(() => {
|
|
601
601
|
var G;
|
|
602
|
-
|
|
603
|
-
const
|
|
602
|
+
f();
|
|
603
|
+
const M = i.indexOf(E), g = (G = o.get(E)) == null ? void 0 : G();
|
|
604
604
|
g && (m(
|
|
605
605
|
"call effect from setTimeout",
|
|
606
606
|
E,
|
|
607
607
|
g.hostElement
|
|
608
|
-
),
|
|
608
|
+
), M <= n.hostElement.children.length - 1 ? n.hostElement.insertBefore(
|
|
609
609
|
g.hostElement,
|
|
610
|
-
n.hostElement.children[
|
|
610
|
+
n.hostElement.children[M]
|
|
611
611
|
) : n.hostElement.append(g.hostElement));
|
|
612
612
|
}));
|
|
613
613
|
});
|
|
614
614
|
};
|
|
615
|
-
Promise.resolve().then(() =>
|
|
615
|
+
Promise.resolve().then(() => u());
|
|
616
616
|
}), n;
|
|
617
|
-
},
|
|
617
|
+
}, Dt = (t) => {
|
|
618
618
|
let e = [P("div")], s = !1;
|
|
619
619
|
return C(() => {
|
|
620
620
|
var o, i;
|
|
@@ -638,37 +638,37 @@ const Ft = () => () => {
|
|
|
638
638
|
console.error(l);
|
|
639
639
|
}
|
|
640
640
|
}), s ? e : e[0];
|
|
641
|
-
},
|
|
641
|
+
}, Nt = (t) => ct in t, zt = (t) => {
|
|
642
642
|
const e = z("div")().addStyle({ display: "contents" }), s = (n) => (e.hostElement.innerHTML = n, e);
|
|
643
643
|
return typeof t == "string" ? s(t) : e.addEffect(() => {
|
|
644
644
|
s(t());
|
|
645
645
|
}), e;
|
|
646
|
-
}, nt = (t, e, s) => t ?
|
|
647
|
-
const s =
|
|
646
|
+
}, nt = (t, e, s) => t ? L(e) : s ? L(s) : z("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), gt = (t, e, s) => L(() => nt(!!t(), e, s)), Gt = (t, e, s) => typeof t == "boolean" ? nt(t, e, s) : gt(t, e, s), Z = (t, e) => {
|
|
647
|
+
const s = L(e);
|
|
648
648
|
return typeof t == "boolean" ? [s].flat().forEach((n) => n.hostElement.style.display = t ? "block" : "none") : C(() => {
|
|
649
649
|
const n = t() ? "block" : "none";
|
|
650
650
|
[s].flat().forEach((r) => r.hostElement.style.display = n);
|
|
651
651
|
}), s;
|
|
652
|
-
},
|
|
652
|
+
}, Vt = (t, e, s) => {
|
|
653
653
|
const n = [Z(t, e)].flat();
|
|
654
654
|
return s && n.push(
|
|
655
655
|
...[Z(
|
|
656
656
|
() => typeof t == "boolean" ? !t : !t(),
|
|
657
657
|
s
|
|
658
658
|
)].flat()
|
|
659
|
-
),
|
|
660
|
-
},
|
|
659
|
+
), L(() => n);
|
|
660
|
+
}, At = (t, e) => {
|
|
661
661
|
m("createCustomElement", t);
|
|
662
662
|
const s = document.createElement(t), n = ft(s);
|
|
663
663
|
return st(n, e);
|
|
664
|
-
},
|
|
665
|
-
const s = t.split(" ").slice(1).map((r) => r.trim()), n =
|
|
664
|
+
}, Lt = (t, e) => {
|
|
665
|
+
const s = t.split(" ").slice(1).map((r) => r.trim()), n = At(t.split(" ")[0], e);
|
|
666
666
|
return Array.isArray(s) && s.length > 0 && n.addClass(...s), (...r) => {
|
|
667
|
-
|
|
667
|
+
O("@rcreateCustomEl content", t, r);
|
|
668
668
|
const o = r.filter(Boolean).flat().flatMap(
|
|
669
|
-
(i) => typeof i == "function" && !S(i) ?
|
|
669
|
+
(i) => typeof i == "function" && !S(i) ? L(() => i(n)) : i
|
|
670
670
|
);
|
|
671
|
-
return n.hostElement.allSlotContent = o, n.hostElement.slotContent = o.filter(
|
|
671
|
+
return n.hostElement.allSlotContent = o, n.hostElement.slotContent = o.filter(it).reduce(
|
|
672
672
|
(i, l) => {
|
|
673
673
|
const d = l.hostElement.getAttribute("slot") || "default";
|
|
674
674
|
return i[d] || (i[d] = []), i[d].push(l), i;
|
|
@@ -676,26 +676,25 @@ const Ft = () => () => {
|
|
|
676
676
|
{}
|
|
677
677
|
), n.hostElement.appendAllSlotContent = () => J(n, ...o), n;
|
|
678
678
|
};
|
|
679
|
-
},
|
|
679
|
+
}, Rt = (t, e, s) => Lt(
|
|
680
680
|
`${t.renderTagName}${e && typeof e == "string" ? " " + e : ""}`,
|
|
681
|
-
|
|
682
|
-
),
|
|
681
|
+
I(e) ? e : e && typeof e == "string" ? s : void 0
|
|
682
|
+
), Ut = () => {
|
|
683
683
|
const t = () => {
|
|
684
684
|
};
|
|
685
685
|
return t.oldValue = null, t;
|
|
686
|
-
},
|
|
686
|
+
}, Xt = () => ({}), Ot = (t, e, s) => {
|
|
687
687
|
const n = e ? Y(e, s)(t) : t;
|
|
688
688
|
return (r, ...o) => {
|
|
689
689
|
const i = [...o];
|
|
690
|
-
return r && !
|
|
690
|
+
return r && !I(r) && i.unshift(r), Rt(n, I(r) ? r : {})(...i);
|
|
691
691
|
};
|
|
692
692
|
}, Zt = (t) => [
|
|
693
|
-
(
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
], a = {}, Ot = [
|
|
693
|
+
Ot(t),
|
|
694
|
+
(e, s) => {
|
|
695
|
+
Y(e, s)(t);
|
|
696
|
+
}
|
|
697
|
+
], a = {}, jt = [
|
|
699
698
|
"div",
|
|
700
699
|
"span",
|
|
701
700
|
"section",
|
|
@@ -757,27 +756,27 @@ const Ft = () => () => {
|
|
|
757
756
|
"canvas",
|
|
758
757
|
"slot"
|
|
759
758
|
];
|
|
760
|
-
|
|
759
|
+
jt.forEach((t) => {
|
|
761
760
|
a[t] = (e, ...s) => {
|
|
762
761
|
let n = [...s];
|
|
763
|
-
return e && !
|
|
762
|
+
return e && !I(e) && (n = [e].concat(n)), z(t, I(e) ? e : {})(...n);
|
|
764
763
|
};
|
|
765
764
|
});
|
|
766
|
-
const Qt = a.div, Yt = a.span, Kt = a.section, te = a.input, ee = a.button, se = a.table, ne = a.tr, re = a.td, oe = a.th, ie = a.ul, ae = a.li, le = a.ol, ce = a.form, he = a.label, pe = a.select, de = a.option,
|
|
765
|
+
const Qt = a.div, Yt = a.span, Kt = a.section, te = a.input, ee = a.button, se = a.table, ne = a.tr, re = a.td, oe = a.th, ie = a.ul, ae = a.li, le = a.ol, ce = a.form, he = a.label, pe = a.select, de = a.option, fe = a.textarea, ue = a.img, me = a.a, Ce = a.p, Ee = a.h1, be = a.h2, Se = a.h3, ye = a.h4, we = a.h5, ve = a.h6, ge = a.br, Ae = a.hr, Le = a.pre, Re = a.code, Oe = a.nav, je = a.header, Me = a.footer, xe = a.main, ke = a.aside, Te = a.article, $e = a.figure, Ie = a.figcaption, Pe = a.blockquote, We = a.cite, He = a.small, _e = a.strong, Fe = a.em, Be = a.b, Je = a.i, qe = a.u, De = a.s, Ne = a.sub, ze = a.sup, Ge = a.mark, Ve = a.del, Ue = a.ins, Xe = a.details, Ze = a.summary, Qe = a.progress, Ye = a.meter, Ke = a.audio, ts = a.video, es = a.canvas, ss = a.slot, ns = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {});
|
|
767
766
|
export {
|
|
768
767
|
A as BaseElement,
|
|
769
768
|
me as a,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
769
|
+
vt as addAttributeList,
|
|
770
|
+
St as addClassList,
|
|
771
|
+
bt as addCustomAttributes,
|
|
772
|
+
yt as addReactiveClassList,
|
|
773
|
+
wt as addStyleList,
|
|
775
774
|
J as appendContentItem,
|
|
776
775
|
Te as article,
|
|
777
776
|
ke as aside,
|
|
778
777
|
Ke as audio,
|
|
779
778
|
Be as b,
|
|
780
|
-
|
|
779
|
+
It as bindReactiveSignals,
|
|
781
780
|
Pe as blockquote,
|
|
782
781
|
ge as br,
|
|
783
782
|
ee as button,
|
|
@@ -785,43 +784,43 @@ export {
|
|
|
785
784
|
es as canvas,
|
|
786
785
|
q as checkCall,
|
|
787
786
|
We as cite,
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
mt as classList,
|
|
788
|
+
Jt as cls,
|
|
790
789
|
Re as code,
|
|
791
|
-
|
|
792
|
-
|
|
790
|
+
O as colorLog,
|
|
791
|
+
Wt as combineLatest,
|
|
793
792
|
Y as component,
|
|
794
|
-
|
|
793
|
+
T as componentEffectMap,
|
|
795
794
|
Zt as configCustomComponent,
|
|
796
795
|
ns as createComponent,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
796
|
+
Rt as createCustom,
|
|
797
|
+
Lt as createCustomEl,
|
|
798
|
+
At as createCustomElement,
|
|
800
799
|
z as createEl,
|
|
801
800
|
P as createElement,
|
|
802
|
-
|
|
801
|
+
$t as createSignal,
|
|
803
802
|
ft as customElementHelpers,
|
|
804
|
-
|
|
803
|
+
Xt as defineSlotTemplate,
|
|
805
804
|
Ve as del,
|
|
806
805
|
Xe as details,
|
|
807
|
-
|
|
806
|
+
lt as disableLogs,
|
|
808
807
|
Qt as div,
|
|
809
808
|
C as effect,
|
|
810
|
-
|
|
809
|
+
k as effectCleanup,
|
|
811
810
|
N as effectComponentMap,
|
|
812
811
|
Q as effectMap,
|
|
813
|
-
|
|
812
|
+
ut as elementHelpers,
|
|
814
813
|
Fe as em,
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
814
|
+
xt as enableLogs,
|
|
815
|
+
_t as event,
|
|
816
|
+
Bt as eventEmitter,
|
|
818
817
|
Ie as figcaption,
|
|
819
818
|
$e as figure,
|
|
820
819
|
Me as footer,
|
|
821
|
-
|
|
820
|
+
Pt as forkJoin,
|
|
822
821
|
ce as form,
|
|
823
|
-
|
|
824
|
-
|
|
822
|
+
qt as getList,
|
|
823
|
+
L as getSignalContent,
|
|
825
824
|
Ee as h1,
|
|
826
825
|
be as h2,
|
|
827
826
|
Se as h3,
|
|
@@ -831,44 +830,44 @@ export {
|
|
|
831
830
|
je as header,
|
|
832
831
|
Ae as hr,
|
|
833
832
|
Je as i,
|
|
834
|
-
|
|
833
|
+
ue as img,
|
|
835
834
|
st as initComponent,
|
|
836
835
|
te as input,
|
|
837
836
|
Ue as ins,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
837
|
+
Ft as isBaseElement,
|
|
838
|
+
it as isComponentConfig,
|
|
839
|
+
I as isComponentInitConfig,
|
|
841
840
|
S as isReactiveSignal,
|
|
842
|
-
|
|
843
|
-
|
|
841
|
+
Nt as isSlotTemplate,
|
|
842
|
+
at as kebabToCamel,
|
|
844
843
|
he as label,
|
|
845
844
|
ae as li,
|
|
846
845
|
xe as main,
|
|
847
846
|
Ge as mark,
|
|
848
847
|
Ye as meter,
|
|
849
848
|
Oe as nav,
|
|
850
|
-
|
|
849
|
+
Ut as newEventEmitter,
|
|
851
850
|
le as ol,
|
|
852
851
|
de as option,
|
|
853
852
|
Ce as p,
|
|
854
853
|
Le as pre,
|
|
855
854
|
Qe as progress,
|
|
856
855
|
m as projectLog,
|
|
857
|
-
|
|
856
|
+
Ht as property,
|
|
858
857
|
nt as renderIf,
|
|
859
|
-
|
|
860
|
-
|
|
858
|
+
Tt as rs,
|
|
859
|
+
gt as rxRenderIf,
|
|
861
860
|
De as s,
|
|
862
861
|
Kt as section,
|
|
863
862
|
pe as select,
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
863
|
+
Et as setChildren,
|
|
864
|
+
kt as setEffectDebugEnabled,
|
|
865
|
+
Ct as setEffects,
|
|
867
866
|
X as setListeners,
|
|
868
|
-
|
|
867
|
+
Vt as show,
|
|
869
868
|
Z as showIf,
|
|
870
|
-
|
|
871
|
-
|
|
869
|
+
R as signal,
|
|
870
|
+
Dt as signalComponent,
|
|
872
871
|
ss as slot,
|
|
873
872
|
He as small,
|
|
874
873
|
Yt as span,
|
|
@@ -878,13 +877,13 @@ export {
|
|
|
878
877
|
ze as sup,
|
|
879
878
|
se as table,
|
|
880
879
|
re as td,
|
|
881
|
-
|
|
880
|
+
fe as textarea,
|
|
882
881
|
oe as th,
|
|
883
882
|
ne as tr,
|
|
884
883
|
qe as u,
|
|
885
884
|
ie as ul,
|
|
886
|
-
|
|
887
|
-
|
|
885
|
+
zt as unsafeHtml,
|
|
886
|
+
Ot as useCustomComponent,
|
|
888
887
|
ts as video,
|
|
889
|
-
|
|
888
|
+
Gt as when
|
|
890
889
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(o=typeof globalThis<"u"?globalThis:o||self,E(o.ReactiveComponent={}))})(this,function(o){"use strict";var en=Object.defineProperty;var nn=(o,E,O)=>E in o?en(o,E,{enumerable:!0,configurable:!0,writable:!0,value:O}):o[E]=O;var f=(o,E,O)=>nn(o,typeof E!="symbol"?E+"":E,O);const E=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),O=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,J=(t,e,...n)=>{e&&e.apply(t,n)};let q=!0;const C=(...t)=>{q&&console.debug(["[rwc]",...t].join(" | "),...Array.from(t.join("").matchAll(/%c/gm)).map((e,n)=>n%2===0?"color:red":"color:inherit"))},W=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),et=t=>t.replace(/-(\w)/gm,(e,n)=>n.toUpperCase()),M=(t,...e)=>{if(!q)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)||[],r=s.map(a=>{const c=a.slice(1);return n[c]||"color: inherit"});let i=t;s.forEach(a=>{const c=new RegExp(`\\${a}([^\\s,]+)`,"g");i=i.replace(c,"%c$1")}),console.log(i,...r,...e)},vt=()=>{q=!0},nt=()=>{q=!1};nt();const v=[];let U=!1;const gt=t=>{U=t},X=new Map,k=[],D=[],g=new WeakMap,A=new WeakMap,H=new WeakMap,I=new WeakMap,$=new WeakMap,N=new WeakMap;function L(t,e){let n=(e==null?void 0:e.signalCompareFn)||(()=>!0);function s(){var a,c,u,h;const i=D[D.length-1];return i&&!("fake"in i&&i.fake)&&(A.has(s)||A.set(s,new Set),(a=A.get(s))==null||a.add(i),I.has(i)||I.set(i,new Set),(c=I.get(i))==null||c.add(()=>{var d;(d=A.get(s))==null||d.delete(i)}),H.has(i)||H.set(i,new Set),(u=H.get(i))==null||u.add(s),U&&((h=X.get(i.effectId))==null||h.signals.push(s))),t}let r="";return Object.defineProperty(s,"signalId",{get:()=>r,set:i=>{r=i}}),s.signalId=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`,s.setName=function(i){return s.signalId=`${i}_${Math.random().toString(36).substring(2,15)}`,s},s.setCompareFn=function(i){return n=i,s},s.clearSubscribers=function(){var i;(i=A.get(s))==null||i.clear()},s.getSubscribers=function(){return A.get(s)},s.peek=function(){return Object.freeze(t)},s.initValue=Object.freeze(t),s.forceSet=function(i){var a;t=i,(a=A.get(s))==null||a.forEach(c=>{var u,h;(u=g.get(c))==null||u.forEach(d=>{d()}),(h=g.get(c))==null||h.clear(),Promise.resolve().then(()=>{const d=N.get(c);d&&v.push(d),k.push(c),c(),k.pop(),d&&v.pop()})})},s.set=function(i,a=n){t!==i&&a(t,i)&&s.forceSet(i)},s.update=function(i){s.set(i(t))},s.pipe=(i,a)=>{const c=L(null);return b(()=>{const u=s();b(()=>{const h=i(u);h instanceof Promise?h.then(d=>c.set(d)):w(h)?b(()=>c.set(h())):c.set(h)},a)}),c},s}function b(t,e){var a,c;const n="fake"in t&&t.fake,s=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`;C("current effect",`%c${s}%c`),t.effectId=s;const r=k[k.length-1];U&&X.set(s,{signals:[],parent:null}),n||k.push(t),D.push(t);const i=v[v.length-1];i&&!n&&($.has(i)||$.set(i,new Set),(a=$.get(i))==null||a.add(t),N.set(t,i)),t(),D.pop(),n||k.pop(),r&&!n&&(g.has(r)||g.set(r,new Set),(c=g.get(r))==null||c.add(()=>{var h,d;const u=H.get(t);u==null||u.forEach(y=>{var m;(m=A.get(y))==null||m.delete(t)}),(h=g.get(t))==null||h.forEach(y=>y()),(d=g.get(t))==null||d.clear(),g.delete(t),H.delete(t)}))}const w=t=>!!t&&["object","function"].includes(typeof t)&&"set"in t&&"update"in t&&"forceSet"in t;function At(t,...e){const n=L("");return b(()=>{const s=e.map(i=>w(i)?String(i()):String(i)),r=[t[0]];s.forEach((i,a)=>{r.push(i,t[a+1])}),n.set(r.join(""))}),n}function Lt(t,e){const n=L(e??null),s=r=>n.set(r);return t instanceof Promise?t.then(s):typeof t=="function"&&b(()=>{const r=t();r instanceof Promise?r.then(s):w(r)?b(()=>s(r())):s(r)}),n}function Rt(t,e){let n=t(),s=e();b(()=>{const r=t(),i=e();r!==i&&(r!==n?e.set(r):i!==s&&t.set(i)),n=r,s=i})}function jt(...t){let e=t.map(s=>s());const n=L(e);return t.forEach((s,r)=>{b(()=>{const i=()=>e.filter(a=>a!==void 0).length;i()===t.length&&(e=Array.from(e).fill(void 0)),e[r]=s(),i()===t.length&&n.set([...e])})}),n}const Ot=(...t)=>{const e=L([]);return b(()=>{e.set(t.map(n=>n()))}),e},z="eventProps",G="EVENT_CONFIG",_="observedAttributes",Mt=()=>(t,e)=>{Reflect.get(t,_)||Reflect.defineProperty(t,_,{value:[]}),Reflect.get(t,_).push(W(e))},Tt=t=>(e,n)=>{Reflect.get(e,z)||Reflect.defineProperty(e,z,{value:[]}),Reflect.get(e,G)||Reflect.defineProperty(e,G,{value:{}}),Reflect.get(e,G)[n]={bubbles:(t==null?void 0:t.bubbles)??!1,composed:(t==null?void 0:t.composed)??!1},Reflect.get(e,z).push(n)},Z=(t,e=!1)=>n=>{C(t,"start register static attr",n.prototype[_]);const s=[];if(n.styles){const i=n.styles,a=[];Array.isArray(i)?a.push(...i):a.push(i),a.forEach(c=>{const u=new CSSStyleSheet;u.replaceSync(c),s.push(u);const h=new CSSStyleSheet;h.replaceSync(c.slice(c.indexOf("@property"))),document.adoptedStyleSheets.push(h)})}class r extends n{constructor(...a){C("constructor",`%c${t}%c`),super(e,...a),M("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){return C("rwc: render from new class"),n.prototype.render.call(this)}attributeChangedCallback(a,c,u){C("%cAttribute has changed.%c",`%c${a}%c`,`oldValue: ${c}, newValue: ${u}`,`%c${t}%c`);try{u=JSON.parse(u)}catch{}const h=et(a);if(h in this&&w(this[h])){const d=this[h];u===null?(d.set(d.initValue),this.removeAttribute(a)):d.set(u)}J(this,n.prototype.attributeChangedCallback,a,c,u)}connectedCallback(){v.push(this);const a=()=>{var u;C("rwc: connectedCallback"),C("connectedCallback",`%c${t}%c`,this),this.providers&&Object.keys(this.providers).length>0&&(C("WRAPPER for providers",t),Object.entries(this.providers).forEach(([h,d])=>{C("register provider",h,d()),this.addEventListener(h,y=>{var p;C("send provider",h,d());const m=y;((p=m.detail)==null?void 0:p.context)===h&&(m.stopPropagation(),m.detail.callback(d))})})),this.checkInjects(),(u=n.prototype[z])==null||u.forEach(h=>{this[h]=d=>{const y=n.prototype[G][h],{bubbles:m,composed:p}=y;w(d)?b(()=>{M("@oemit reactive value",d()),this.dispatchEvent(new CustomEvent(h,{detail:d(),bubbles:m,composed:p}))}):(M("@oemit value",d),this.dispatchEvent(new CustomEvent(h,{detail:d,bubbles:m,composed:p})))}}),C("start render",`%c${t}%c`,t);const c=()=>{C("rwc: insertRenderTemplate");const h=this.render();this.shadow.appendChild(h.hostElement),J(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const h=m=>m instanceof Promise||Array.isArray(m)&&m.every(p=>p instanceof Promise),d=this.rootStyle,y=m=>{const p=new CSSStyleSheet;p.replaceSync(m),this.shadow.adoptedStyleSheets.push(p);const S=new CSSStyleSheet;S.replaceSync(m.slice(m.indexOf("@property"))),document.adoptedStyleSheets.push(S)};if(h(d)){const m=[];Array.isArray(d)?m.push(...d):m.push(d),Promise.all(m).then(p=>p.forEach(S=>y(S.default))).then(()=>c())}else{const m=[];Array.isArray(d)?m.push(...d):m.push(d),m.forEach(p=>y(p)),c()}}else c();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(h=>{C(this.slotContext,this.slotContext&&this.slotContext[h.name]),M("@bslot element",h,`name:${h.name};`,h.assignedElements()),h.assignedElements().forEach(d=>{const y=this.slotContext[h.name];this.slotContext&&w(y)&&(M("@oslot element",h,`name:${h.name};`,h.assignedElements()),b(()=>{d.dispatchEvent(new CustomEvent("handleSlotContext",{detail:y()}))}))})})};a.fake=!0,b(a),v.pop()}disconnectedCallback(){var a;this.shadow.replaceChildren(),this.replaceChildren(),(a=$.get(this))==null||a.forEach(c=>{var u;(u=I.get(c))==null||u.forEach(h=>h()),I.delete(c),N.delete(c)}),$.delete(this),J(this,n.prototype.disconnectedCallback)}}return f(r,"observedAttributes",n.prototype[_]??[]),f(r,"renderTagName",t),r.toString=()=>t,customElements.get(t)?console.error(`название тега ${t} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(t,r),n.renderTagName=t,n};class R extends HTMLElement{constructor(n=!1){super();f(this,"isSlotLazyLoading",!1);f(this,"slotTemplate");f(this,"slotContext");f(this,"rootStyle");f(this,"modelValue");f(this,"providers");f(this,"appendAllSlotContent");f(this,"allSlotContent",[]);f(this,"slotContent",{});f(this,"htmlSlotContent",{});f(this,"shadow");f(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var r;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const i=n.slot||"default";this.htmlSlotContent[i]||(this.htmlSlotContent[i]=[]),(r=this.htmlSlotContent[i])==null||r.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return C("%cinject%c",n),this.injects[n]||(this.injects[n]=L(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{C("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:r=>b(()=>{s.set(r())})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}f(R,"observedAttributes",[]),f(R,"renderTagName",""),f(R,"styles");const kt=t=>"render"in t&&"setReactiveValue"in t,It="handleSlotContext",st="onConnected",ot=t=>typeof t=="string"?t:JSON.stringify(t),$t=t=>{const e=document.createElement("span");return e.textContent=ot(t),e},rt=(t,e)=>(t.appendChild($t(e)),t),Pt=(t,e)=>(t.replaceChildren(),rt(t,e)),it=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=ot(n)}),e};class at{constructor(e){f(this,"wrapper");f(this,"hostElement");f(this,"append",(...e)=>(e.forEach(n=>{this.wrapper.appendChild(n.hostElement),st in n.hostElement&&setTimeout(()=>{var s,r;(r=(s=n.hostElement).onConnected)==null||r.call(s,n,n.hostElement)})}),this));f(this,"set",(...e)=>{this.clear();const n=document.createDocumentFragment();return e.forEach(s=>{n.appendChild(s.hostElement)}),this.wrapper.appendChild(n),this});f(this,"removeChild",(...e)=>(e.forEach(n=>{Array.from(this.wrapper.childNodes.values()).some(s=>s===n.hostElement)&&this.wrapper.removeChild(n.hostElement)}),this));f(this,"addHtmlContent",e=>(rt(this.wrapper,e),this));f(this,"setHtmlContent",e=>(Pt(this.wrapper,e),this));f(this,"setAttribute",(e,n)=>{let s;if(typeof n=="boolean"&&!(this.wrapper instanceof R))if(n)s="";else{this.removeAttribute(e);const r=e.toLowerCase();return r in this.wrapper&&(this.wrapper[r]=null),this}else typeof n!="string"?s=JSON.stringify(n):s=n;if(this.wrapper.setAttribute(W(e),s),!(this.wrapper instanceof R)){const r=e.toLowerCase();r in this.wrapper&&(this.wrapper[r]=n)}return this});f(this,"setCustomAttribute",(e,n)=>{let s;return typeof n!="string"?s=JSON.stringify(n):s=n,this.wrapper.setAttribute(W(e),s),this});f(this,"setReactiveAttribute",(e,n)=>{const s=this.wrapper instanceof R;return s&&v.push(this.wrapper),b(()=>this.setAttribute(e,n())),s&&v.pop(),this});f(this,"setReactiveCustomAttribute",(e,n)=>(b(()=>this.setCustomAttribute(e,n())),this));f(this,"removeAttribute",e=>(this.wrapper.removeAttribute(W(e)),this));f(this,"addStyle",e=>(Object.entries(e).forEach(([n,s])=>{const r=n.startsWith("--");typeof s=="function"?this.addEffect(()=>{if(r){const i=String(s()||"");this.wrapper.style.setProperty(n,i)}else this.wrapper.style[n]=s()}):typeof s=="string"&&(r?this.wrapper.style.setProperty(n,s):this.wrapper.style[n]=s)}),this));f(this,"onConnected",e=>(Reflect.defineProperty(this.wrapper,st,{get(){return e}}),this));f(this,"addClass",(...e)=>(e.forEach(n=>{typeof n=="string"?this.wrapper.classList.add(...n.split(" ").flatMap(s=>s.split(`
|
|
2
|
-
`)).map(s=>s.trim()).filter(Boolean)):(()=>{let s=null;this.addEffect(()=>{const r=n();r.length>0&&(s?this.replaceClass(s,r):this.addClass(r),s=r)})})()}),this));f(this,"setClass",(...e)=>(this.wrapper.classList.remove(...this.wrapper.classList),this.wrapper.classList.add(...e),this));f(this,"addReactiveClass",e=>(Object.keys(e).forEach(n=>{b(()=>{e[n]()?this.addClass(n):this.removeClass(n)})}),this));f(this,"removeClass",(...e)=>(this.wrapper.classList.remove(...e),this));f(this,"replaceClass",(e,n)=>(this.wrapper.classList.replace(e,n),this));f(this,"addEffect",e=>(b(()=>e(this,this.hostElement)),this));f(this,"addReactiveContent",e=>(this.wrapper.appendChild(
|
|
1
|
+
(function(o,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(o=typeof globalThis<"u"?globalThis:o||self,S(o.ReactiveComponent={}))})(this,function(o){"use strict";var en=Object.defineProperty;var nn=(o,S,O)=>S in o?en(o,S,{enumerable:!0,configurable:!0,writable:!0,value:O}):o[S]=O;var f=(o,S,O)=>nn(o,typeof S!="symbol"?S+"":S,O);const S=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),O=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,J=(t,e,...n)=>{e&&e.apply(t,n)};let q=!0;const C=(...t)=>{q&&console.debug(["[rwc]",...t].join(" | "),...Array.from(t.join("").matchAll(/%c/gm)).map((e,n)=>n%2===0?"color:red":"color:inherit"))},W=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),tt=t=>t.replace(/-(\w)/gm,(e,n)=>n.toUpperCase()),M=(t,...e)=>{if(!q)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)||[],r=s.map(a=>{const c=a.slice(1);return n[c]||"color: inherit"});let i=t;s.forEach(a=>{const c=new RegExp(`\\${a}([^\\s,]+)`,"g");i=i.replace(c,"%c$1")}),console.log(i,...r,...e)},vt=()=>{q=!0},et=()=>{q=!1};et();const g=[];let U=!1;const At=t=>{U=t},X=new Map,k=[],D=[],v=new WeakMap,A=new WeakMap,H=new WeakMap,I=new WeakMap,$=new WeakMap,N=new WeakMap;function L(t,e){let n=(e==null?void 0:e.signalCompareFn)||(()=>!0);function s(){var a,c,u,h;const i=D[D.length-1];return i&&!("fake"in i&&i.fake)&&(A.has(s)||A.set(s,new Set),(a=A.get(s))==null||a.add(i),I.has(i)||I.set(i,new Set),(c=I.get(i))==null||c.add(()=>{var d;(d=A.get(s))==null||d.delete(i)}),H.has(i)||H.set(i,new Set),(u=H.get(i))==null||u.add(s),U&&((h=X.get(i.effectId))==null||h.signals.push(s))),t}let r="";return Object.defineProperty(s,"signalId",{get:()=>r,set:i=>{r=i}}),s.signalId=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`,s.setName=function(i){return s.signalId=`${i}_${Math.random().toString(36).substring(2,15)}`,s},s.setCompareFn=function(i){return n=i,s},s.clearSubscribers=function(){var i;(i=A.get(s))==null||i.clear()},s.getSubscribers=function(){return A.get(s)},s.peek=function(){return Object.freeze(t)},s.initValue=Object.freeze(t),s.forceSet=function(i){var a;t=i,(a=A.get(s))==null||a.forEach(c=>{var u,h;(u=v.get(c))==null||u.forEach(d=>{d()}),(h=v.get(c))==null||h.clear(),Promise.resolve().then(()=>{const d=N.get(c);d&&g.push(d),k.push(c),c(),k.pop(),d&&g.pop()})})},s.set=function(i,a=n){t!==i&&a(t,i)&&s.forceSet(i)},s.update=function(i){s.set(i(t))},s.pipe=(i,a)=>{const c=L(null);return b(()=>{const u=s();b(()=>{const h=i(u);h instanceof Promise?h.then(d=>c.set(d)):w(h)?b(()=>c.set(h())):c.set(h)},a)}),c},s}function b(t,e){var a,c;const n="fake"in t&&t.fake,s=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`;C("current effect",`%c${s}%c`),t.effectId=s;const r=k[k.length-1];U&&X.set(s,{signals:[],parent:null}),n||k.push(t),D.push(t);const i=g[g.length-1];i&&!n&&($.has(i)||$.set(i,new Set),(a=$.get(i))==null||a.add(t),N.set(t,i)),t(),D.pop(),n||k.pop(),r&&!n&&(v.has(r)||v.set(r,new Set),(c=v.get(r))==null||c.add(()=>{var h,d;const u=H.get(t);u==null||u.forEach(y=>{var m;(m=A.get(y))==null||m.delete(t)}),(h=v.get(t))==null||h.forEach(y=>y()),(d=v.get(t))==null||d.clear(),v.delete(t),H.delete(t)}))}const w=t=>!!t&&["object","function"].includes(typeof t)&&"set"in t&&"update"in t&&"forceSet"in t;function Lt(t,...e){const n=L("");return b(()=>{const s=e.map(i=>w(i)?String(i()):String(i)),r=[t[0]];s.forEach((i,a)=>{r.push(i,t[a+1])}),n.set(r.join(""))}),n}function Rt(t,e){const n=L(e??null),s=r=>n.set(r);return t instanceof Promise?t.then(s):typeof t=="function"&&b(()=>{const r=t();r instanceof Promise?r.then(s):w(r)?b(()=>s(r())):s(r)}),n}function jt(t,e){let n=t(),s=e();b(()=>{const r=t(),i=e();r!==i&&(r!==n?e.set(r):i!==s&&t.set(i)),n=r,s=i})}function Ot(...t){let e=t.map(s=>s());const n=L(e);return t.forEach((s,r)=>{b(()=>{const i=()=>e.filter(a=>a!==void 0).length;i()===t.length&&(e=Array.from(e).fill(void 0)),e[r]=s(),i()===t.length&&n.set([...e])})}),n}const Mt=(...t)=>{const e=L([]);return b(()=>{e.set(t.map(n=>n()))}),e},z="eventProps",G="EVENT_CONFIG",_="observedAttributes",Tt=()=>(t,e)=>{Reflect.get(t,_)||Reflect.defineProperty(t,_,{value:[]}),Reflect.get(t,_).push(W(e))},kt=t=>(e,n)=>{Reflect.get(e,z)||Reflect.defineProperty(e,z,{value:[]}),Reflect.get(e,G)||Reflect.defineProperty(e,G,{value:{}}),Reflect.get(e,G)[n]={bubbles:(t==null?void 0:t.bubbles)??!1,composed:(t==null?void 0:t.composed)??!1},Reflect.get(e,z).push(n)},Z=(t,e=!1)=>n=>{C(t,"start register static attr",n.prototype[_]);const s=[];if(n.styles){const i=n.styles,a=[];Array.isArray(i)?a.push(...i):a.push(i),a.forEach(c=>{const u=new CSSStyleSheet;u.replaceSync(c),s.push(u);const h=new CSSStyleSheet;h.replaceSync(c.slice(c.indexOf("@property"))),document.adoptedStyleSheets.push(h)})}class r extends n{constructor(...a){C("constructor",`%c${t}%c`),super(e,...a),M("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){return C("rwc: render from new class"),n.prototype.render.call(this)}attributeChangedCallback(a,c,u){C("%cAttribute has changed.%c",`%c${a}%c`,`oldValue: ${c}, newValue: ${u}`,`%c${t}%c`);try{u=JSON.parse(u)}catch{}const h=tt(a);if(h in this&&w(this[h])){const d=this[h];u===null?(d.set(d.initValue),this.removeAttribute(a)):d.set(u)}J(this,n.prototype.attributeChangedCallback,a,c,u)}connectedCallback(){g.push(this);const a=()=>{var u;C("rwc: connectedCallback"),C("connectedCallback",`%c${t}%c`,this),this.providers&&Object.keys(this.providers).length>0&&(C("WRAPPER for providers",t),Object.entries(this.providers).forEach(([h,d])=>{C("register provider",h,d()),this.addEventListener(h,y=>{var p;C("send provider",h,d());const m=y;((p=m.detail)==null?void 0:p.context)===h&&(m.stopPropagation(),m.detail.callback(d))})})),this.checkInjects(),(u=n.prototype[z])==null||u.forEach(h=>{this[h]=d=>{const y=n.prototype[G][h],{bubbles:m,composed:p}=y;w(d)?b(()=>{M("@oemit reactive value",d()),this.dispatchEvent(new CustomEvent(h,{detail:d(),bubbles:m,composed:p}))}):(M("@oemit value",d),this.dispatchEvent(new CustomEvent(h,{detail:d,bubbles:m,composed:p})))}}),C("start render",`%c${t}%c`,t);const c=()=>{C("rwc: insertRenderTemplate");const h=this.render();this.shadow.appendChild(h.hostElement),J(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const h=m=>m instanceof Promise||Array.isArray(m)&&m.every(p=>p instanceof Promise),d=this.rootStyle,y=m=>{const p=new CSSStyleSheet;p.replaceSync(m),this.shadow.adoptedStyleSheets.push(p);const E=new CSSStyleSheet;E.replaceSync(m.slice(m.indexOf("@property"))),document.adoptedStyleSheets.push(E)};if(h(d)){const m=[];Array.isArray(d)?m.push(...d):m.push(d),Promise.all(m).then(p=>p.forEach(E=>y(E.default))).then(()=>c())}else{const m=[];Array.isArray(d)?m.push(...d):m.push(d),m.forEach(p=>y(p)),c()}}else c();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(h=>{C(this.slotContext,this.slotContext&&this.slotContext[h.name]),M("@bslot element",h,`name:${h.name};`,h.assignedElements()),h.assignedElements().forEach(d=>{const y=this.slotContext[h.name];this.slotContext&&w(y)&&(M("@oslot element",h,`name:${h.name};`,h.assignedElements()),b(()=>{d.dispatchEvent(new CustomEvent("handleSlotContext",{detail:y()}))}))})})};a.fake=!0,b(a),g.pop()}disconnectedCallback(){var a;this.shadow.replaceChildren(),this.replaceChildren(),(a=$.get(this))==null||a.forEach(c=>{var u;(u=I.get(c))==null||u.forEach(h=>h()),I.delete(c),N.delete(c)}),$.delete(this),J(this,n.prototype.disconnectedCallback)}}return f(r,"observedAttributes",n.prototype[_]??[]),f(r,"renderTagName",t),r.toString=()=>t,customElements.get(t)?console.error(`название тега ${t} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(t,r),n.renderTagName=t,n};class R extends HTMLElement{constructor(n=!1){super();f(this,"isSlotLazyLoading",!1);f(this,"slotTemplate");f(this,"slotContext");f(this,"rootStyle");f(this,"modelValue");f(this,"providers");f(this,"appendAllSlotContent");f(this,"allSlotContent",[]);f(this,"slotContent",{});f(this,"htmlSlotContent",{});f(this,"shadow");f(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var r;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const i=n.slot||"default";this.htmlSlotContent[i]||(this.htmlSlotContent[i]=[]),(r=this.htmlSlotContent[i])==null||r.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return C("%cinject%c",n),this.injects[n]||(this.injects[n]=L(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{C("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:r=>b(()=>{s.set(r())})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}f(R,"observedAttributes",[]),f(R,"renderTagName",""),f(R,"styles");const It=t=>"render"in t&&"setReactiveValue"in t,$t="handleSlotContext",nt="onConnected",st=t=>typeof t=="string"?t:JSON.stringify(t),Pt=t=>{const e=document.createElement("span");return e.textContent=st(t),e},ot=(t,e)=>(t.appendChild(Pt(e)),t),Wt=(t,e)=>(t.replaceChildren(),ot(t,e)),rt=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=st(n)}),e};class it{constructor(e){f(this,"wrapper");f(this,"hostElement");f(this,"append",(...e)=>(e.forEach(n=>{this.wrapper.appendChild(n.hostElement),nt in n.hostElement&&setTimeout(()=>{var s,r;(r=(s=n.hostElement).onConnected)==null||r.call(s,n,n.hostElement)})}),this));f(this,"set",(...e)=>{this.clear();const n=document.createDocumentFragment();return e.forEach(s=>{n.appendChild(s.hostElement)}),this.wrapper.appendChild(n),this});f(this,"removeChild",(...e)=>(e.forEach(n=>{Array.from(this.wrapper.childNodes.values()).some(s=>s===n.hostElement)&&this.wrapper.removeChild(n.hostElement)}),this));f(this,"addHtmlContent",e=>(ot(this.wrapper,e),this));f(this,"setHtmlContent",e=>(Wt(this.wrapper,e),this));f(this,"setAttribute",(e,n)=>{let s;if(typeof n=="boolean"&&!(this.wrapper instanceof R))if(n)s="";else{this.removeAttribute(e);const r=e.toLowerCase();return r in this.wrapper&&(this.wrapper[r]=null),this}else typeof n!="string"?s=JSON.stringify(n):s=n;if(this.wrapper.setAttribute(W(e),s),!(this.wrapper instanceof R)){const r=e.toLowerCase();r in this.wrapper&&(this.wrapper[r]=n)}return this});f(this,"setCustomAttribute",(e,n)=>{let s;return typeof n!="string"?s=JSON.stringify(n):s=n,this.wrapper.setAttribute(W(e),s),this});f(this,"setReactiveAttribute",(e,n)=>{const s=this.wrapper instanceof R;return s&&g.push(this.wrapper),b(()=>this.setAttribute(e,n())),s&&g.pop(),this});f(this,"setReactiveCustomAttribute",(e,n)=>(b(()=>this.setCustomAttribute(e,n())),this));f(this,"removeAttribute",e=>(this.wrapper.removeAttribute(W(e)),this));f(this,"addStyle",e=>(Object.entries(e).forEach(([n,s])=>{const r=n.startsWith("--");typeof s=="function"?this.addEffect(()=>{if(r){const i=String(s()||"");this.wrapper.style.setProperty(n,i)}else this.wrapper.style[n]=s()}):typeof s=="string"&&(r?this.wrapper.style.setProperty(n,s):this.wrapper.style[n]=s)}),this));f(this,"onConnected",e=>(Reflect.defineProperty(this.wrapper,nt,{get(){return e}}),this));f(this,"addClass",(...e)=>(e.forEach(n=>{typeof n=="string"?this.wrapper.classList.add(...n.split(" ").flatMap(s=>s.split(`
|
|
2
|
+
`)).map(s=>s.trim()).filter(Boolean)):(()=>{let s=null;this.addEffect(()=>{const r=n();r.length>0&&(s?this.replaceClass(s,r):this.addClass(r),s=r)})})()}),this));f(this,"setClass",(...e)=>(this.wrapper.classList.remove(...this.wrapper.classList),this.wrapper.classList.add(...e),this));f(this,"addReactiveClass",e=>(Object.keys(e).forEach(n=>{b(()=>{e[n]()?this.addClass(n):this.removeClass(n)})}),this));f(this,"removeClass",(...e)=>(this.wrapper.classList.remove(...e),this));f(this,"replaceClass",(e,n)=>(this.wrapper.classList.replace(e,n),this));f(this,"addEffect",e=>(b(()=>e(this,this.hostElement)),this));f(this,"addReactiveContent",e=>(this.wrapper.appendChild(rt(e)),this));f(this,"setReactiveContent",e=>(this.clear(),this.wrapper.appendChild(rt(e)),this));f(this,"clear",()=>(this.wrapper.replaceChildren(),this));this.wrapper=e,this.hostElement=e}addEventlistener(e,n,s=!1){return this.wrapper.addEventListener(e,r=>n(r,this,this.wrapper),s),this}}class Ht extends it{constructor(){super(...arguments);f(this,"setReactiveValue",n=>(this.wrapper instanceof R&&this.wrapper.setReactiveValue(n),this));f(this,"setSlotTemplate",n=>{const s=this.wrapper.slotTemplate;return s&&Object.entries(n).forEach(([r,i])=>{s[r]=i}),this})}}const _t=()=>()=>{},at=t=>new Ht(t),lt=t=>new it(t),ct=(t,...e)=>({classList:[...t.map(n=>n.trim()).filter(Boolean),...e]}),Ft=(t,...e)=>ct(t,...e),Q=(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 r=s.slice(1);e.listeners[r]=e[s]}),n.filter(s=>s.startsWith("$")).forEach(s=>{e!=null&&e.effects||(e.effects=[]),e.effects.push(e[s])}),ut(t,e.classList),mt(t,e.style),Ct(t,e.attributes),pt(t,e.reactiveClassList),ft(t,e.customAttributes),dt(t,e.children),ht(t,e.effects),Y(t,e.listeners),Y(t,e.customListeners),t},Y=(t,e)=>{e&&Object.entries(e).forEach(([n,s])=>{typeof s=="function"&&t.addEventlistener(n,s)})},ht=(t,e)=>e==null?void 0:e.forEach(n=>t.addEffect(n)),dt=(t,e)=>F(t,...e||[]),ft=(t,e)=>{const n=e;n&&Object.keys(n).forEach(s=>{w(n[s])?t.setReactiveCustomAttribute(s,n[s]):typeof n[s]=="function"?t.addEffect(()=>{t.setCustomAttribute(s,n[s]())}):t.setCustomAttribute(s,n[s])})},ut=(t,e)=>t.addClass(...e||[]),pt=(t,e)=>t.addReactiveClass(e||{}),mt=(t,e)=>t.addStyle(e||{}),Ct=(t,e)=>{const n=e,s=(r,i)=>{i&&(w(i)?t.setReactiveAttribute(r,i):typeof i=="function"?t.addEffect(()=>{t.setAttribute(r,i())}):t.setAttribute(r,i))};n&&Object.keys(n).forEach(r=>{s(r,n[r])})},F=(t,...e)=>(e.forEach(n=>{typeof n=="string"?n.trim().length>0&&t.addHtmlContent(n):w(n)?t.addReactiveContent(n):t.append(n)}),t),P=(t,e)=>{const n=document.createElement(t),s=lt(n);return Q(s,e)},V=(t,e)=>{const[n,...s]=t.split(" ").map(i=>i.trim()),r=P(n,e);return s.length>0&&r.addClass(...s),(...i)=>F(r,...i.filter(Boolean).flat().flatMap(a=>typeof a=="function"&&!w(a)?j(()=>a(r)):a))},j=t=>P("div").addStyle({display:"contents"}).addEffect(e=>{e.clear(),F(e,...[t()].flat())}),Bt=(t,e,n)=>{const s=P("div").addStyle({display:"contents"}),r=new Map,i=new Map;let a=[];const c=new Set;let u=t.peek();const h=d=>{c.delete(d),r.delete(d),i.delete(d)};return b(()=>{const d=t();a=d.map(e).map(p=>typeof p=="string"?p:p.toString());const y=Array.from(s.hostElement.children);C("containerChildren",y,a),y.forEach(p=>{const E=p.dataset.key;a.includes(E)||(C("remove element",E,p),p.remove(),h(E))}),a.forEach(p=>{var B,T;const E=d[a.indexOf(p)];r.has(p)?JSON.stringify(E)!==JSON.stringify(u[a.indexOf(p)])&&((B=s.hostElement.querySelector(`[data-key="${p}"]`))==null||B.remove(),(T=r.get(p))==null||T.set(Math.random().toString(36).substring(2,15)),i.set(p,()=>n(E,a.indexOf(p),d).setCustomAttribute("data-key",p))):(C("create new element",p,E),r.set(p,L(Math.random().toString(36).substring(2,15))),i.set(p,()=>n(E,a.indexOf(p),d).setCustomAttribute("data-key",p)))}),u=[...d.map(p=>({...p}))];const m=()=>{r.forEach((p,E)=>{C("key from setTimeout foreach currItemSignalMap",E),c.has(E)||(c.add(E),b(()=>{var gt;p();const B=a.indexOf(E),T=(gt=i.get(E))==null?void 0:gt();T&&(C("call effect from setTimeout",E,T.hostElement),B<=s.hostElement.children.length-1?s.hostElement.insertBefore(T.hostElement,s.hostElement.children[B]):s.hostElement.append(T.hostElement))}))})};Promise.resolve().then(()=>m())}),s},Jt=t=>{let e=[P("div")],n=!1;return b(()=>{var i,a;const s=t();n=Array.isArray(s);const r=[];r.push(...[s].flat()),r.length===0&&r.push(P("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{C("newReactiveComponent.map",r.map(c=>{var u;return C("newReactiveComponent hostElement",c.hostElement),(u=c.hostElement)==null?void 0:u.id})),C("currComponent[0].hostElement?.id",(i=e[0].hostElement)==null?void 0:i.id,e),(a=e[0].hostElement)==null||a.replaceWith(...r.map(c=>c.hostElement)),e.slice(1).forEach(c=>{var u;return(u=c.hostElement)==null?void 0:u.remove()}),e=r}catch(c){console.error(c)}}),n?e:e[0]},qt=t=>$t in t,Dt=t=>{const e=V("div")().addStyle({display:"contents"}),n=s=>(e.hostElement.innerHTML=s,e);return typeof t=="string"?n(t):e.addEffect(()=>{n(t())}),e},K=(t,e,n)=>t?j(e):n?j(n):V("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),bt=(t,e,n)=>j(()=>K(!!t(),e,n)),Nt=(t,e,n)=>typeof t=="boolean"?K(t,e,n):bt(t,e,n),x=(t,e)=>{const n=j(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(r=>r.hostElement.style.display=s)}),n},zt=(t,e,n)=>{const s=[x(t,e)].flat();return n&&s.push(...[x(()=>typeof t=="boolean"?!t:!t(),n)].flat()),j(()=>s)},Et=(t,e)=>{C("createCustomElement",t);const n=document.createElement(t),s=at(n);return Q(s,e)},St=(t,e)=>{const n=t.split(" ").slice(1).map(r=>r.trim()),s=Et(t.split(" ")[0],e);return Array.isArray(n)&&n.length>0&&s.addClass(...n),(...r)=>{M("@rcreateCustomEl content",t,r);const i=r.filter(Boolean).flat().flatMap(a=>typeof a=="function"&&!w(a)?j(()=>a(s)):a);return s.hostElement.allSlotContent=i,s.hostElement.slotContent=i.filter(O).reduce((a,c)=>{const u=c.hostElement.getAttribute("slot")||"default";return a[u]||(a[u]=[]),a[u].push(c),a},{}),s.hostElement.appendAllSlotContent=()=>F(s,...i),s}},yt=(t,e,n)=>St(`${t.renderTagName}${e&&typeof e=="string"?" "+e:""}`,S(e)?e:e&&typeof e=="string"?n:void 0),Gt=()=>{const t=()=>{};return t.oldValue=null,t},Vt=()=>({}),wt=(t,e,n)=>{const s=e?Z(e,n)(t):t;return(r,...i)=>{const a=[...i];return r&&!S(r)&&a.unshift(r),yt(s,S(r)?r:{})(...a)}},Ut=t=>[wt(t),(e,n)=>{Z(e,n)(t)}],l={};["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=>{l[t]=(e,...n)=>{let s=[...n];return e&&!S(e)&&(s=[e].concat(s)),V(t,S(e)?e:{})(...s)}});const Xt=l.div,Zt=l.span,Qt=l.section,Yt=l.input,Kt=l.button,xt=l.table,te=l.tr,ee=l.td,ne=l.th,se=l.ul,oe=l.li,re=l.ol,ie=l.form,ae=l.label,le=l.select,ce=l.option,he=l.textarea,de=l.img,fe=l.a,ue=l.p,pe=l.h1,me=l.h2,Ce=l.h3,be=l.h4,Ee=l.h5,Se=l.h6,ye=l.br,we=l.hr,ge=l.pre,ve=l.code,Ae=l.nav,Le=l.header,Re=l.footer,je=l.main,Oe=l.aside,Me=l.article,Te=l.figure,ke=l.figcaption,Ie=l.blockquote,$e=l.cite,Pe=l.small,We=l.strong,He=l.em,_e=l.b,Fe=l.i,Be=l.u,Je=l.s,qe=l.sub,De=l.sup,Ne=l.mark,ze=l.del,Ge=l.ins,Ve=l.details,Ue=l.summary,Xe=l.progress,Ze=l.meter,Qe=l.audio,Ye=l.video,Ke=l.canvas,xe=l.slot,tn=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{});o.BaseElement=R,o.a=fe,o.addAttributeList=Ct,o.addClassList=ut,o.addCustomAttributes=ft,o.addReactiveClassList=pt,o.addStyleList=mt,o.appendContentItem=F,o.article=Me,o.aside=Oe,o.audio=Qe,o.b=_e,o.bindReactiveSignals=jt,o.blockquote=Ie,o.br=ye,o.button=Kt,o.camelToKebab=W,o.canvas=Ke,o.checkCall=J,o.cite=$e,o.classList=ct,o.cls=Ft,o.code=ve,o.colorLog=M,o.combineLatest=Mt,o.component=Z,o.componentEffectMap=$,o.configCustomComponent=Ut,o.createComponent=tn,o.createCustom=yt,o.createCustomEl=St,o.createCustomElement=Et,o.createEl=V,o.createElement=P,o.createSignal=Rt,o.customElementHelpers=at,o.defineSlotTemplate=Vt,o.del=ze,o.details=Ve,o.disableLogs=et,o.div=Xt,o.effect=b,o.effectCleanup=I,o.effectComponentMap=N,o.effectMap=X,o.elementHelpers=lt,o.em=He,o.enableLogs=vt,o.event=kt,o.eventEmitter=_t,o.figcaption=ke,o.figure=Te,o.footer=Re,o.forkJoin=Ot,o.form=ie,o.getList=Bt,o.getSignalContent=j,o.h1=pe,o.h2=me,o.h3=Ce,o.h4=be,o.h5=Ee,o.h6=Se,o.header=Le,o.hr=we,o.i=Fe,o.img=de,o.initComponent=Q,o.input=Yt,o.ins=Ge,o.isBaseElement=It,o.isComponentConfig=O,o.isComponentInitConfig=S,o.isReactiveSignal=w,o.isSlotTemplate=qt,o.kebabToCamel=tt,o.label=ae,o.li=oe,o.main=je,o.mark=Ne,o.meter=Ze,o.nav=Ae,o.newEventEmitter=Gt,o.ol=re,o.option=ce,o.p=ue,o.pre=ge,o.progress=Xe,o.projectLog=C,o.property=Tt,o.renderIf=K,o.rs=Lt,o.rxRenderIf=bt,o.s=Je,o.section=Qt,o.select=le,o.setChildren=dt,o.setEffectDebugEnabled=At,o.setEffects=ht,o.setListeners=Y,o.show=zt,o.showIf=x,o.signal=L,o.signalComponent=Jt,o.slot=xe,o.small=Pe,o.span=Zt,o.strong=We,o.sub=qe,o.summary=Ue,o.sup=De,o.table=xt,o.td=ee,o.textarea=he,o.th=ne,o.tr=te,o.u=Be,o.ul=se,o.unsafeHtml=Dt,o.useCustomComponent=wt,o.video=Ye,o.when=Nt,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ChildrenContent, ComponentInitConfig } from '../../types';
|
|
2
2
|
import { BaseElementConstructor } from '../html-elements';
|
|
3
3
|
export declare const useCustomComponent: <B extends BaseElementConstructor>(comp: B, selector?: `${string}-${string}`, isClosed?: boolean) => (config?: ComponentInitConfig<InstanceType<B>> | ChildrenContent<InstanceType<B>>, ...content: ChildrenContent<InstanceType<B>>[]) => import('../../types').CustomComponentConfig<InstanceType<B>>;
|
|
4
|
-
export declare const configCustomComponent: <B extends BaseElementConstructor>(comp: B) =>
|
|
4
|
+
export declare const configCustomComponent: <B extends BaseElementConstructor>(comp: B) => [ReturnType<typeof useCustomComponent<B>>, (selector: `${string}-${string}`, isClosed?: boolean) => void];
|