ddd-react 1.3.0 → 1.3.2
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/dist/h-BbaMkkC7.mjs +173 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +558 -0
- package/dist/jsx-dev-runtime.d.ts +1 -0
- package/dist/jsx-dev-runtime.js +5 -0
- package/dist/jsx-runtime.d.ts +1 -0
- package/dist/jsx-runtime.js +38 -0
- package/package.json +15 -1
- package/dist/index.mjs +0 -753
package/dist/index.mjs
DELETED
|
@@ -1,753 +0,0 @@
|
|
|
1
|
-
function O(e, t) {
|
|
2
|
-
if (e === null || t === null || e === void 0 || t === void 0)
|
|
3
|
-
return e === t;
|
|
4
|
-
if (typeof e != typeof t)
|
|
5
|
-
return !1;
|
|
6
|
-
if (Object.is(e, t))
|
|
7
|
-
return !0;
|
|
8
|
-
if (typeof e == "object") {
|
|
9
|
-
if (e.constructor !== t.constructor)
|
|
10
|
-
return !1;
|
|
11
|
-
if (Array.isArray(e)) {
|
|
12
|
-
if (e.length !== t.length)
|
|
13
|
-
return !1;
|
|
14
|
-
for (let r = 0; r < e.length; ++r)
|
|
15
|
-
if (!O(e[r], t[r]))
|
|
16
|
-
return !1;
|
|
17
|
-
return !0;
|
|
18
|
-
}
|
|
19
|
-
if (e.constructor === RegExp)
|
|
20
|
-
return e.source === t.source && e.flags === t.flags;
|
|
21
|
-
if (e.valueOf !== Object.prototype.valueOf)
|
|
22
|
-
return e.valueOf() === t.valueOf();
|
|
23
|
-
if (e.toString !== Object.prototype.toString)
|
|
24
|
-
return e.toString() === t.toString();
|
|
25
|
-
const n = Object.keys(e);
|
|
26
|
-
if (n.length !== Object.keys(t).length)
|
|
27
|
-
return !1;
|
|
28
|
-
for (let r = 0; r < n.length; ++r)
|
|
29
|
-
if (!Object.prototype.hasOwnProperty.call(t, n[r]))
|
|
30
|
-
return !1;
|
|
31
|
-
for (let r = 0; r < n.length; ++r) {
|
|
32
|
-
const s = n[r];
|
|
33
|
-
if (!(s === "_owner" && e.$$typeof) && !O(e[s], t[s]))
|
|
34
|
-
return !1;
|
|
35
|
-
}
|
|
36
|
-
return !0;
|
|
37
|
-
}
|
|
38
|
-
return !1;
|
|
39
|
-
}
|
|
40
|
-
function R(e, t, n, r = null) {
|
|
41
|
-
function s(o) {
|
|
42
|
-
const i = o;
|
|
43
|
-
r ? t.call(r, i) : t(i);
|
|
44
|
-
}
|
|
45
|
-
return n.addEventListener(e, s), s;
|
|
46
|
-
}
|
|
47
|
-
function W(e = {}, t, n = null) {
|
|
48
|
-
const r = {};
|
|
49
|
-
return Object.entries(e).forEach(([s, o]) => {
|
|
50
|
-
r[s] = R(
|
|
51
|
-
s,
|
|
52
|
-
o,
|
|
53
|
-
t,
|
|
54
|
-
n
|
|
55
|
-
);
|
|
56
|
-
}), r;
|
|
57
|
-
}
|
|
58
|
-
function $(e = {}, t) {
|
|
59
|
-
Object.entries(e).forEach(([n, r]) => {
|
|
60
|
-
t.removeEventListener(n, r);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const h = {
|
|
64
|
-
ADD: "add",
|
|
65
|
-
REMOVE: "remove",
|
|
66
|
-
MOVE: "move",
|
|
67
|
-
NOOP: "noop"
|
|
68
|
-
}, f = {
|
|
69
|
-
TEXT: "text",
|
|
70
|
-
ELEMENT: "element",
|
|
71
|
-
FRAGMENT: "fragment",
|
|
72
|
-
COMPONENT: "component",
|
|
73
|
-
PORTAL: "portal"
|
|
74
|
-
};
|
|
75
|
-
function d(e) {
|
|
76
|
-
const { type: t } = e;
|
|
77
|
-
switch (t) {
|
|
78
|
-
case f.TEXT: {
|
|
79
|
-
B(e);
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
case f.ELEMENT: {
|
|
83
|
-
X(e);
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
case f.FRAGMENT: {
|
|
87
|
-
_(e);
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
case f.COMPONENT: {
|
|
91
|
-
e.component?.unmount();
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case f.PORTAL: {
|
|
95
|
-
z(e);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
default:
|
|
99
|
-
throw new Error(`Can't destroy DOM of type: ${t}`);
|
|
100
|
-
}
|
|
101
|
-
delete e.el;
|
|
102
|
-
}
|
|
103
|
-
function B(e) {
|
|
104
|
-
const { el: t } = e;
|
|
105
|
-
t && t.remove();
|
|
106
|
-
}
|
|
107
|
-
function X(e) {
|
|
108
|
-
const { el: t, children: n, listeners: r, props: s } = e;
|
|
109
|
-
s?.ref && typeof s.ref == "object" && "current" in s.ref && (s.ref.current = null), t && t.remove(), n && n.forEach(d), r && t && ($(r, t), delete e.listeners);
|
|
110
|
-
}
|
|
111
|
-
function _(e) {
|
|
112
|
-
const { children: t } = e;
|
|
113
|
-
t && t.forEach(d);
|
|
114
|
-
}
|
|
115
|
-
function z(e) {
|
|
116
|
-
const { children: t } = e;
|
|
117
|
-
t && t.forEach(d);
|
|
118
|
-
}
|
|
119
|
-
function T(e) {
|
|
120
|
-
return e.filter((t) => t != null);
|
|
121
|
-
}
|
|
122
|
-
function J(e, t) {
|
|
123
|
-
return {
|
|
124
|
-
added: t.filter((n) => !e.includes(n)),
|
|
125
|
-
removed: e.filter((n) => !t.includes(n))
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
class K {
|
|
129
|
-
#t = [];
|
|
130
|
-
#e = [];
|
|
131
|
-
#n;
|
|
132
|
-
constructor(t, n) {
|
|
133
|
-
this.#t = [...t], this.#e = t.map((r, s) => s), this.#n = n;
|
|
134
|
-
}
|
|
135
|
-
isAddition(t, n) {
|
|
136
|
-
return this.findIndexFrom(t, n) === -1;
|
|
137
|
-
}
|
|
138
|
-
isNoop(t, n) {
|
|
139
|
-
if (t >= this.length)
|
|
140
|
-
return !1;
|
|
141
|
-
const r = this.#t[t], s = n[t];
|
|
142
|
-
return this.#n(r, s);
|
|
143
|
-
}
|
|
144
|
-
isRemoval(t, n) {
|
|
145
|
-
if (t >= this.length)
|
|
146
|
-
return !1;
|
|
147
|
-
const r = this.#t[t];
|
|
148
|
-
return n.findIndex(
|
|
149
|
-
(o) => this.#n(r, o)
|
|
150
|
-
) === -1;
|
|
151
|
-
}
|
|
152
|
-
findIndexFrom(t, n) {
|
|
153
|
-
for (let r = n; r < this.length; r++)
|
|
154
|
-
if (this.#n(t, this.#t[r]))
|
|
155
|
-
return r;
|
|
156
|
-
return -1;
|
|
157
|
-
}
|
|
158
|
-
originalIndexAt(t) {
|
|
159
|
-
return this.#e[t];
|
|
160
|
-
}
|
|
161
|
-
noopItem(t) {
|
|
162
|
-
return {
|
|
163
|
-
op: h.NOOP,
|
|
164
|
-
originalIndex: this.originalIndexAt(t),
|
|
165
|
-
index: t,
|
|
166
|
-
item: this.#t[t]
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
removeItemsAfter(t) {
|
|
170
|
-
const n = [];
|
|
171
|
-
for (; this.length > t; )
|
|
172
|
-
n.push(this.removeItem(t));
|
|
173
|
-
return n;
|
|
174
|
-
}
|
|
175
|
-
removeItem(t) {
|
|
176
|
-
const n = {
|
|
177
|
-
op: h.REMOVE,
|
|
178
|
-
index: t,
|
|
179
|
-
item: this.#t[t]
|
|
180
|
-
};
|
|
181
|
-
return this.#t.splice(t, 1), this.#e.splice(t, 1), n;
|
|
182
|
-
}
|
|
183
|
-
addItem(t, n) {
|
|
184
|
-
const r = {
|
|
185
|
-
op: h.ADD,
|
|
186
|
-
index: n,
|
|
187
|
-
item: t
|
|
188
|
-
};
|
|
189
|
-
return this.#t.splice(n, 0, t), this.#e.splice(n, 0, -1), r;
|
|
190
|
-
}
|
|
191
|
-
moveItem(t, n) {
|
|
192
|
-
const r = this.findIndexFrom(t, n), s = {
|
|
193
|
-
op: h.MOVE,
|
|
194
|
-
originalIndex: this.originalIndexAt(r),
|
|
195
|
-
from: r,
|
|
196
|
-
index: n,
|
|
197
|
-
item: this.#t[r]
|
|
198
|
-
}, [o] = this.#t.splice(r, 1);
|
|
199
|
-
this.#t.splice(n, 0, o);
|
|
200
|
-
const [i] = this.#e.splice(r, 1);
|
|
201
|
-
return this.#e.splice(n, 0, i), s;
|
|
202
|
-
}
|
|
203
|
-
get length() {
|
|
204
|
-
return this.#t.length;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function Y(e, t, n = (r, s) => r === s) {
|
|
208
|
-
const r = [], s = new K(e, n);
|
|
209
|
-
for (let o = 0; o < t.length; o++) {
|
|
210
|
-
if (s.isRemoval(o, t)) {
|
|
211
|
-
r.push(s.removeItem(o)), o--;
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
if (s.isNoop(o, t)) {
|
|
215
|
-
r.push(s.noopItem(o));
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
const i = t[o];
|
|
219
|
-
if (s.isAddition(i, o)) {
|
|
220
|
-
r.push(s.addItem(i, o));
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
r.push(s.moveItem(i, o));
|
|
224
|
-
}
|
|
225
|
-
return r.push(...s.removeItemsAfter(t.length)), r;
|
|
226
|
-
}
|
|
227
|
-
function w(e, t = {}, n = []) {
|
|
228
|
-
const r = typeof e == "string" ? f.ELEMENT : f.COMPONENT;
|
|
229
|
-
return {
|
|
230
|
-
tag: e,
|
|
231
|
-
props: t,
|
|
232
|
-
type: r,
|
|
233
|
-
children: A(T(n))
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function S(e) {
|
|
237
|
-
return {
|
|
238
|
-
type: f.TEXT,
|
|
239
|
-
value: e,
|
|
240
|
-
props: {}
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
function D(e) {
|
|
244
|
-
return {
|
|
245
|
-
type: f.FRAGMENT,
|
|
246
|
-
children: A(T(e)),
|
|
247
|
-
props: {}
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function H(e, t) {
|
|
251
|
-
return {
|
|
252
|
-
type: f.PORTAL,
|
|
253
|
-
children: A(T(e)),
|
|
254
|
-
props: {},
|
|
255
|
-
container: t
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
function A(e) {
|
|
259
|
-
return e.map((t) => typeof t == "string" ? S(t) : t);
|
|
260
|
-
}
|
|
261
|
-
function y(e) {
|
|
262
|
-
if (!e.children)
|
|
263
|
-
return [];
|
|
264
|
-
const t = [];
|
|
265
|
-
for (const n of e.children)
|
|
266
|
-
n.type === f.FRAGMENT ? t.push(...y(n)) : t.push(n);
|
|
267
|
-
return t;
|
|
268
|
-
}
|
|
269
|
-
function x(e, t, n) {
|
|
270
|
-
e.style[t] = n.toString();
|
|
271
|
-
}
|
|
272
|
-
function Q(e, t) {
|
|
273
|
-
e.style[t] = null;
|
|
274
|
-
}
|
|
275
|
-
function Z(e, t) {
|
|
276
|
-
const { class: n, style: r, ...s } = t;
|
|
277
|
-
n && V(e, n), r && Object.entries(r).forEach(([o, i]) => {
|
|
278
|
-
x(e, o, i);
|
|
279
|
-
});
|
|
280
|
-
for (const [o, i] of Object.entries(s))
|
|
281
|
-
F(e, o, i);
|
|
282
|
-
}
|
|
283
|
-
function V(e, t) {
|
|
284
|
-
if (e instanceof SVGElement) {
|
|
285
|
-
e.removeAttribute("class"), typeof t == "string" ? e.setAttribute("class", t) : Array.isArray(t) && e.classList.add(...t);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
e.className = "", typeof t == "string" ? e.className = t : Array.isArray(t) && e.classList.add(...t);
|
|
289
|
-
}
|
|
290
|
-
function F(e, t, n) {
|
|
291
|
-
n == null ? k(e, t) : e.setAttribute(t, String(n));
|
|
292
|
-
}
|
|
293
|
-
function k(e, t) {
|
|
294
|
-
e[t] = null, e.removeAttribute(t);
|
|
295
|
-
}
|
|
296
|
-
let v = !1;
|
|
297
|
-
const N = [];
|
|
298
|
-
function E(e) {
|
|
299
|
-
N.push(e), tt();
|
|
300
|
-
}
|
|
301
|
-
function tt() {
|
|
302
|
-
v || (v = !0, queueMicrotask(et));
|
|
303
|
-
}
|
|
304
|
-
function et() {
|
|
305
|
-
for (; N.length > 0; ) {
|
|
306
|
-
const e = N.shift();
|
|
307
|
-
let t;
|
|
308
|
-
try {
|
|
309
|
-
t = e();
|
|
310
|
-
} catch (n) {
|
|
311
|
-
console.error(`[scheduler]: ${n}`);
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
Promise.resolve(t).then(
|
|
315
|
-
() => {
|
|
316
|
-
},
|
|
317
|
-
(n) => {
|
|
318
|
-
console.error(`[scheduler]: ${n}`);
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
v = !1;
|
|
323
|
-
}
|
|
324
|
-
function M(e) {
|
|
325
|
-
const { on: t = {}, ...n } = e.props;
|
|
326
|
-
return delete n.key, { props: n, events: t };
|
|
327
|
-
}
|
|
328
|
-
function p(e, t, n = null, r = null) {
|
|
329
|
-
switch (e.type) {
|
|
330
|
-
case f.TEXT: {
|
|
331
|
-
nt(e, t, n);
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
case f.ELEMENT: {
|
|
335
|
-
st(e, t, n, r);
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
case f.FRAGMENT: {
|
|
339
|
-
rt(e, t, n, r);
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
case f.COMPONENT: {
|
|
343
|
-
ot(e, t, n, r);
|
|
344
|
-
const s = e.component;
|
|
345
|
-
s && E(() => s.onMount());
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
case f.PORTAL: {
|
|
349
|
-
ct(e, r);
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
default:
|
|
353
|
-
throw new Error(`Can't mount DOM of type: ${e.type}`);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
function nt(e, t, n) {
|
|
357
|
-
const { value: r } = e, s = document.createTextNode(r);
|
|
358
|
-
e.el = s, U(s, t, n);
|
|
359
|
-
}
|
|
360
|
-
function rt(e, t, n, r) {
|
|
361
|
-
const { children: s } = e;
|
|
362
|
-
e.el = t, s?.forEach((o, i) => {
|
|
363
|
-
p(o, t, n != null ? n + i : null, r);
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
function st(e, t, n, r) {
|
|
367
|
-
const { tag: s, children: o } = e, c = s === "svg" || t instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
|
|
368
|
-
it(c, e, r), e.el = c, o?.forEach((l) => {
|
|
369
|
-
p(l, c, null, r);
|
|
370
|
-
}), U(c, t, n);
|
|
371
|
-
}
|
|
372
|
-
function it(e, t, n) {
|
|
373
|
-
const { props: r, events: s } = M(t);
|
|
374
|
-
r.ref && typeof r.ref == "object" && "current" in r.ref && (r.ref.current = e, delete r.ref), t.listeners = W(s, e, n), Z(e, r);
|
|
375
|
-
}
|
|
376
|
-
function ot(e, t, n, r) {
|
|
377
|
-
const s = e.tag, { props: o } = M(e), i = new s(o, r);
|
|
378
|
-
i.mount(t, n), e.component = i, e.el = i.firstElement || null;
|
|
379
|
-
}
|
|
380
|
-
function U(e, t, n) {
|
|
381
|
-
if (n == null) {
|
|
382
|
-
t.append(e);
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
if (n < 0)
|
|
386
|
-
throw new Error(`Index must be a positive integer, got ${n}`);
|
|
387
|
-
const r = t.childNodes;
|
|
388
|
-
n >= r.length ? t.append(e) : t.insertBefore(e, r[n]);
|
|
389
|
-
}
|
|
390
|
-
function ct(e, t) {
|
|
391
|
-
const { children: n, container: r } = e;
|
|
392
|
-
n?.forEach((s) => {
|
|
393
|
-
p(s, r, null, t);
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
function G(e, t) {
|
|
397
|
-
if (e.type !== t.type)
|
|
398
|
-
return !1;
|
|
399
|
-
if (e.type === f.ELEMENT) {
|
|
400
|
-
const n = e, r = t, {
|
|
401
|
-
tag: s,
|
|
402
|
-
props: { key: o }
|
|
403
|
-
} = n, {
|
|
404
|
-
tag: i,
|
|
405
|
-
props: { key: c }
|
|
406
|
-
} = r;
|
|
407
|
-
return s === i && o === c;
|
|
408
|
-
}
|
|
409
|
-
if (e.type === f.COMPONENT) {
|
|
410
|
-
const n = e, r = t, { tag: s } = n, { tag: o } = r;
|
|
411
|
-
return s === o;
|
|
412
|
-
}
|
|
413
|
-
if (e.type === f.PORTAL) {
|
|
414
|
-
const n = e, r = t;
|
|
415
|
-
return n.container === r.container;
|
|
416
|
-
}
|
|
417
|
-
return !0;
|
|
418
|
-
}
|
|
419
|
-
function I(e, t) {
|
|
420
|
-
const n = Object.keys(e), r = Object.keys(t), s = [], o = [];
|
|
421
|
-
for (const i of r)
|
|
422
|
-
i in e ? e[i] !== t[i] && o.push(i) : s.push(i);
|
|
423
|
-
return {
|
|
424
|
-
added: s,
|
|
425
|
-
removed: n.filter((i) => !(i in t)),
|
|
426
|
-
updated: o
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
function ft(e) {
|
|
430
|
-
return e !== "";
|
|
431
|
-
}
|
|
432
|
-
function C(e) {
|
|
433
|
-
return ft(e.trim());
|
|
434
|
-
}
|
|
435
|
-
function P(e, t, n, r = null) {
|
|
436
|
-
if (!G(e, t)) {
|
|
437
|
-
const s = lt(n, e.el);
|
|
438
|
-
return d(e), p(t, n, s, r), t;
|
|
439
|
-
}
|
|
440
|
-
switch (t.el = e.el, t.type) {
|
|
441
|
-
case f.TEXT:
|
|
442
|
-
return ut(e, t), t;
|
|
443
|
-
case f.ELEMENT: {
|
|
444
|
-
at(e, t, r);
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
case f.COMPONENT: {
|
|
448
|
-
Et(e, t);
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
case f.PORTAL: {
|
|
452
|
-
yt(e, t, r);
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
return q(e, t, r), t;
|
|
457
|
-
}
|
|
458
|
-
function lt(e, t) {
|
|
459
|
-
if (!t) return null;
|
|
460
|
-
const n = Array.from(e.childNodes).indexOf(t);
|
|
461
|
-
return n < 0 ? null : n;
|
|
462
|
-
}
|
|
463
|
-
function ut(e, t) {
|
|
464
|
-
const n = e.el, { value: r } = e, { value: s } = t;
|
|
465
|
-
r !== s && n && (n.nodeValue = s);
|
|
466
|
-
}
|
|
467
|
-
function at(e, t, n) {
|
|
468
|
-
const r = e.el, {
|
|
469
|
-
class: s,
|
|
470
|
-
style: o,
|
|
471
|
-
on: i,
|
|
472
|
-
...c
|
|
473
|
-
} = e.props ?? {}, {
|
|
474
|
-
class: l,
|
|
475
|
-
style: u,
|
|
476
|
-
on: a,
|
|
477
|
-
...m
|
|
478
|
-
} = t.props ?? {}, { listeners: b } = e;
|
|
479
|
-
ht(r, c, m), pt(r, s, l), dt(
|
|
480
|
-
r,
|
|
481
|
-
o,
|
|
482
|
-
u
|
|
483
|
-
), t.listeners = mt(
|
|
484
|
-
r,
|
|
485
|
-
b,
|
|
486
|
-
i ?? {},
|
|
487
|
-
a ?? {},
|
|
488
|
-
n
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
function ht(e, t = {}, n = {}) {
|
|
492
|
-
const r = t.ref, s = n.ref;
|
|
493
|
-
r !== s && (r && typeof r == "object" && "current" in r && (r.current = null), s && typeof s == "object" && "current" in s && (s.current = e));
|
|
494
|
-
const o = { ...t }, i = { ...n };
|
|
495
|
-
delete o.ref, delete i.ref;
|
|
496
|
-
const { added: c, removed: l, updated: u } = I(o, i);
|
|
497
|
-
for (const a of l)
|
|
498
|
-
k(e, a);
|
|
499
|
-
for (const a of c.concat(u))
|
|
500
|
-
F(e, a, i[a]);
|
|
501
|
-
}
|
|
502
|
-
function pt(e, t, n) {
|
|
503
|
-
const r = L(t), s = L(n), { added: o, removed: i } = J(r, s);
|
|
504
|
-
i.length > 0 && e.classList.remove(...i), o.length > 0 && e.classList.add(...o);
|
|
505
|
-
}
|
|
506
|
-
function L(e = "") {
|
|
507
|
-
return Array.isArray(e) ? e.filter(C) : String(e).split(/(\s+)/).filter(C);
|
|
508
|
-
}
|
|
509
|
-
function dt(e, t = {}, n = {}) {
|
|
510
|
-
const { added: r, removed: s, updated: o } = I(t, n);
|
|
511
|
-
for (const i of s)
|
|
512
|
-
Q(e, i);
|
|
513
|
-
for (const i of r.concat(o))
|
|
514
|
-
x(e, i, n[i]);
|
|
515
|
-
}
|
|
516
|
-
function mt(e, t = {}, n = {}, r = {}, s = null) {
|
|
517
|
-
const { removed: o, added: i, updated: c } = I(n, r);
|
|
518
|
-
for (const u of o.concat(c)) {
|
|
519
|
-
const a = t?.[u];
|
|
520
|
-
a && e.removeEventListener(u, a);
|
|
521
|
-
}
|
|
522
|
-
const l = {};
|
|
523
|
-
for (const u of i.concat(c))
|
|
524
|
-
l[u] = R(
|
|
525
|
-
u,
|
|
526
|
-
r[u],
|
|
527
|
-
e,
|
|
528
|
-
s
|
|
529
|
-
);
|
|
530
|
-
return l;
|
|
531
|
-
}
|
|
532
|
-
function q(e, t, n) {
|
|
533
|
-
const r = y(e), s = y(t), o = e.el, i = Y(r, s, G), c = n?.offset ?? 0;
|
|
534
|
-
for (const l of i)
|
|
535
|
-
if (l.op === h.NOOP) {
|
|
536
|
-
const { originalIndex: u, index: a } = l;
|
|
537
|
-
P(r[u], s[a], o, n);
|
|
538
|
-
}
|
|
539
|
-
for (const l of i)
|
|
540
|
-
switch (l.op) {
|
|
541
|
-
case h.MOVE: {
|
|
542
|
-
const { from: u, index: a } = l, m = r[u].el, b = o.childNodes[a + c];
|
|
543
|
-
m && (o.insertBefore(m, b), P(r[u], s[a], o, n));
|
|
544
|
-
break;
|
|
545
|
-
}
|
|
546
|
-
case h.REMOVE: {
|
|
547
|
-
const { item: u } = l;
|
|
548
|
-
d(u);
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
case h.ADD: {
|
|
552
|
-
const { index: u, item: a } = l;
|
|
553
|
-
p(a, o, u + c, n);
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
function Et(e, t) {
|
|
559
|
-
const { component: n } = e, { props: r } = M(t);
|
|
560
|
-
n.updateProps(r), t.component = n, t.el = n.firstElement;
|
|
561
|
-
}
|
|
562
|
-
function yt(e, t, n) {
|
|
563
|
-
if (e.container !== t.container) {
|
|
564
|
-
d(e), p(t, document.body, null, n);
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
q(e, t, n);
|
|
568
|
-
}
|
|
569
|
-
const bt = (e) => e.constructor.name.includes("Provider"), gt = (e) => e.constructor.name.includes("Consumer");
|
|
570
|
-
class j {
|
|
571
|
-
constructor(t = {}, n) {
|
|
572
|
-
this.isMounted = !1, this.vdom = null, this.hostEl = null, this.parent = null, this.state = {}, this.context = null, this.dependencies = [], this.subscribedProvider = null, this.props = t, this.parent = n;
|
|
573
|
-
}
|
|
574
|
-
addDependency({ consumer: t }) {
|
|
575
|
-
this.dependencies.some((n) => n.consumer === t) || (this.dependencies.push({ consumer: t }), t.subscribedProvider = this);
|
|
576
|
-
}
|
|
577
|
-
removeDependency({ consumer: t }) {
|
|
578
|
-
const n = this.dependencies.findIndex((r) => r.consumer === t);
|
|
579
|
-
n !== -1 && (this.dependencies.splice(n, 1), t.subscribedProvider = null);
|
|
580
|
-
}
|
|
581
|
-
notify() {
|
|
582
|
-
this.dependencies.forEach(({ consumer: t }) => {
|
|
583
|
-
t.isMounted && t.updateContext() && t.patch();
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
onMount() {
|
|
587
|
-
return Promise.resolve();
|
|
588
|
-
}
|
|
589
|
-
onUnmount() {
|
|
590
|
-
return Promise.resolve();
|
|
591
|
-
}
|
|
592
|
-
onUpdate() {
|
|
593
|
-
return Promise.resolve();
|
|
594
|
-
}
|
|
595
|
-
onWillUnmount() {
|
|
596
|
-
return Promise.resolve();
|
|
597
|
-
}
|
|
598
|
-
get elements() {
|
|
599
|
-
return this.vdom == null ? [] : this.vdom.type === f.FRAGMENT ? y(this.vdom).flatMap((t) => t.type === f.COMPONENT && t.component ? t.component.elements : t.el ? [t.el] : []) : this.vdom.el ? [this.vdom.el] : [];
|
|
600
|
-
}
|
|
601
|
-
get firstElement() {
|
|
602
|
-
return this.elements[0];
|
|
603
|
-
}
|
|
604
|
-
get offset() {
|
|
605
|
-
return this.vdom?.type === f.FRAGMENT && this.hostEl && this.firstElement ? Array.from(this.hostEl.children).indexOf(this.firstElement) : 0;
|
|
606
|
-
}
|
|
607
|
-
updateProps(t) {
|
|
608
|
-
const n = { ...this.props, ...t }, r = this.props;
|
|
609
|
-
this.props = n;
|
|
610
|
-
let s = this.updateContext();
|
|
611
|
-
O(r, n) && !s || (bt(this) && this.notify(), this.patch());
|
|
612
|
-
}
|
|
613
|
-
setState(t) {
|
|
614
|
-
typeof t == "function" ? this.state = {
|
|
615
|
-
...this.state,
|
|
616
|
-
...t(this.state, this.props)
|
|
617
|
-
} : this.state = { ...this.state, ...t }, this.patch();
|
|
618
|
-
}
|
|
619
|
-
mount(t, n = null) {
|
|
620
|
-
if (this.isMounted)
|
|
621
|
-
throw new Error("Component is already mounted");
|
|
622
|
-
gt(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext(), this.vdom = this.render(), p(this.vdom, t, n, this), this.hostEl = t, this.isMounted = !0;
|
|
623
|
-
}
|
|
624
|
-
unmount() {
|
|
625
|
-
this.isMounted && (E(() => this.onWillUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: t }) => {
|
|
626
|
-
t.subscribedProvider = null;
|
|
627
|
-
}), this.dependencies = [], this.vdom && d(this.vdom), E(() => this.onUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
|
|
628
|
-
}
|
|
629
|
-
patch() {
|
|
630
|
-
if (!this.isMounted || !this.hostEl || !this.vdom)
|
|
631
|
-
return;
|
|
632
|
-
const t = this.render();
|
|
633
|
-
this.vdom = P(this.vdom, t, this.hostEl, this), E(() => this.onUpdate());
|
|
634
|
-
}
|
|
635
|
-
updateContext() {
|
|
636
|
-
const t = Object.getPrototypeOf(this).constructor.contextType;
|
|
637
|
-
let n = this.parent;
|
|
638
|
-
if (t != null) {
|
|
639
|
-
for (; n; ) {
|
|
640
|
-
if (Object.getPrototypeOf(n).constructor === t.Provider)
|
|
641
|
-
return this.context = n.props.value, !0;
|
|
642
|
-
n = n.parent;
|
|
643
|
-
}
|
|
644
|
-
n == null && (this.context = t.defaultValue);
|
|
645
|
-
}
|
|
646
|
-
return !1;
|
|
647
|
-
}
|
|
648
|
-
subscribeToProvider() {
|
|
649
|
-
const t = Object.getPrototypeOf(this).constructor.contextType;
|
|
650
|
-
if (!t)
|
|
651
|
-
return;
|
|
652
|
-
let n = this.parent;
|
|
653
|
-
for (; n; ) {
|
|
654
|
-
if (Object.getPrototypeOf(n).constructor === t.Provider) {
|
|
655
|
-
n.addDependency({ consumer: this });
|
|
656
|
-
break;
|
|
657
|
-
}
|
|
658
|
-
n = n.parent;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
function vt(e) {
|
|
663
|
-
class t extends j {
|
|
664
|
-
render() {
|
|
665
|
-
let o = [];
|
|
666
|
-
return Array.isArray(this.props.children) ? o = this.props.children : this.props.children ? o = [this.props.children] : o = [], D(o);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
const r = class r extends j {
|
|
670
|
-
render() {
|
|
671
|
-
let o = this.props.children;
|
|
672
|
-
if (Array.isArray(o))
|
|
673
|
-
if (o.length === 1 && typeof o[0] == "function")
|
|
674
|
-
o = o[0];
|
|
675
|
-
else
|
|
676
|
-
throw new Error(
|
|
677
|
-
"Consumer: expected single function child, got array"
|
|
678
|
-
);
|
|
679
|
-
if (typeof o != "function")
|
|
680
|
-
throw new Error("Consumer: children is not a function");
|
|
681
|
-
return o(this.context);
|
|
682
|
-
}
|
|
683
|
-
};
|
|
684
|
-
r.contextType = {
|
|
685
|
-
Provider: t,
|
|
686
|
-
defaultValue: e
|
|
687
|
-
};
|
|
688
|
-
let n = r;
|
|
689
|
-
return {
|
|
690
|
-
Provider: t,
|
|
691
|
-
Consumer: n,
|
|
692
|
-
defaultValue: e
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
function Nt(e, t) {
|
|
696
|
-
if (!t)
|
|
697
|
-
throw new Error("Container element is not provided for rendering.");
|
|
698
|
-
p(e, t);
|
|
699
|
-
}
|
|
700
|
-
function Pt(e = null) {
|
|
701
|
-
return {
|
|
702
|
-
current: e
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
function Tt(e, t) {
|
|
706
|
-
const n = Array.isArray(e) ? e : [e];
|
|
707
|
-
return H(n, t);
|
|
708
|
-
}
|
|
709
|
-
const Ot = /* @__PURE__ */ Symbol("Fragment");
|
|
710
|
-
function g(e) {
|
|
711
|
-
return e == null || e === !1 ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? S(String(e)) : e;
|
|
712
|
-
}
|
|
713
|
-
function At(e, t, ...n) {
|
|
714
|
-
if (e === Ot) {
|
|
715
|
-
const i = n.flat().map(g).filter((c) => c != null);
|
|
716
|
-
return D(i);
|
|
717
|
-
}
|
|
718
|
-
let r = {}, s = {};
|
|
719
|
-
if (t && Object.entries(t).forEach(([i, c]) => {
|
|
720
|
-
if (i.startsWith("on") && typeof c == "function") {
|
|
721
|
-
const l = i.slice(2).toLowerCase();
|
|
722
|
-
r[l] = c;
|
|
723
|
-
} else i === "ref" ? s.ref = c : i === "className" ? s.class = c : i === "style" && typeof c == "object" ? s.style = c : i === "colorInterpolationFilters" ? s["color-interpolation-filters"] = c : i === "viewbox" ? s.viewBox = c : i !== "children" && i !== "key" && (s[i] = c);
|
|
724
|
-
}), typeof e == "function")
|
|
725
|
-
try {
|
|
726
|
-
return e({ ...s, on: r });
|
|
727
|
-
} catch {
|
|
728
|
-
}
|
|
729
|
-
if (typeof e == "function" || typeof e == "object" && e != null && "render" in e) {
|
|
730
|
-
const i = { ...t ?? {} };
|
|
731
|
-
return n.length > 0 && (i.children = n.flat().map(g).filter((c) => c != null)), w(e, i);
|
|
732
|
-
}
|
|
733
|
-
r = {}, s = {}, t && Object.entries(t).forEach(([i, c]) => {
|
|
734
|
-
if (i.startsWith("on") && typeof c == "function") {
|
|
735
|
-
const l = i.slice(2).toLowerCase();
|
|
736
|
-
r[l] = c;
|
|
737
|
-
} else i === "ref" ? s.ref = c : i === "className" ? s.class = c : i === "style" && typeof c == "object" ? s.style = c : i === "colorInterpolationFilters" ? s["color-interpolation-filters"] = c : i === "filterUnits" ? s.filterUnits = c : i === "clipPath" ? s["clip-path"] = c : i === "floodOpacity" ? s["flood-opacity"] = c : i === "stdDeviation" ? s.stdDeviation = c : i === "viewbox" ? s.viewBox = c : i !== "children" && i !== "key" && (s[i] = c);
|
|
738
|
-
});
|
|
739
|
-
const o = n.flat().map(g).filter((i) => i != null);
|
|
740
|
-
return w(e, { ...s, on: r }, o);
|
|
741
|
-
}
|
|
742
|
-
export {
|
|
743
|
-
j as Component,
|
|
744
|
-
vt as createContext,
|
|
745
|
-
Tt as createPortal,
|
|
746
|
-
Pt as createRef,
|
|
747
|
-
w as h,
|
|
748
|
-
D as hFragment,
|
|
749
|
-
S as hString,
|
|
750
|
-
At as jsx,
|
|
751
|
-
At as jsxDEV,
|
|
752
|
-
Nt as render
|
|
753
|
-
};
|