ddd-react 1.1.0 → 1.3.0
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/index.d.ts +3 -1
- package/dist/index.mjs +253 -218
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,7 @@ import { createRef } from './ref';
|
|
|
6
6
|
import type { Ref } from './ref';
|
|
7
7
|
import type { ComponentType } from './types/types';
|
|
8
8
|
import { createPortal } from './portal';
|
|
9
|
+
import { jsx } from "./jsx/jsx-runtime";
|
|
10
|
+
import { jsxDEV } from "./jsx/jsx-dev-runtime";
|
|
9
11
|
export type { ComponentType, Ref };
|
|
10
|
-
export { Component, createContext, createRef, h, hFragment, hString, render, createPortal };
|
|
12
|
+
export { Component, createContext, createRef, h, hFragment, hString, render, createPortal, jsx, jsxDEV };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function O(e, t) {
|
|
2
2
|
if (e === null || t === null || e === void 0 || t === void 0)
|
|
3
3
|
return e === t;
|
|
4
4
|
if (typeof e != typeof t)
|
|
@@ -12,7 +12,7 @@ function v(e, t) {
|
|
|
12
12
|
if (e.length !== t.length)
|
|
13
13
|
return !1;
|
|
14
14
|
for (let r = 0; r < e.length; ++r)
|
|
15
|
-
if (!
|
|
15
|
+
if (!O(e[r], t[r]))
|
|
16
16
|
return !1;
|
|
17
17
|
return !0;
|
|
18
18
|
}
|
|
@@ -30,7 +30,7 @@ function v(e, t) {
|
|
|
30
30
|
return !1;
|
|
31
31
|
for (let r = 0; r < n.length; ++r) {
|
|
32
32
|
const s = n[r];
|
|
33
|
-
if (!(s === "_owner" && e.$$typeof) && !
|
|
33
|
+
if (!(s === "_owner" && e.$$typeof) && !O(e[s], t[s]))
|
|
34
34
|
return !1;
|
|
35
35
|
}
|
|
36
36
|
return !0;
|
|
@@ -38,24 +38,24 @@ function v(e, t) {
|
|
|
38
38
|
return !1;
|
|
39
39
|
}
|
|
40
40
|
function R(e, t, n, r = null) {
|
|
41
|
-
function s(
|
|
42
|
-
const
|
|
43
|
-
r ? t.call(r,
|
|
41
|
+
function s(o) {
|
|
42
|
+
const i = o;
|
|
43
|
+
r ? t.call(r, i) : t(i);
|
|
44
44
|
}
|
|
45
45
|
return n.addEventListener(e, s), s;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function W(e = {}, t, n = null) {
|
|
48
48
|
const r = {};
|
|
49
|
-
return Object.entries(e).forEach(([s,
|
|
49
|
+
return Object.entries(e).forEach(([s, o]) => {
|
|
50
50
|
r[s] = R(
|
|
51
51
|
s,
|
|
52
|
-
|
|
52
|
+
o,
|
|
53
53
|
t,
|
|
54
54
|
n
|
|
55
55
|
);
|
|
56
56
|
}), r;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function $(e = {}, t) {
|
|
59
59
|
Object.entries(e).forEach(([n, r]) => {
|
|
60
60
|
t.removeEventListener(n, r);
|
|
61
61
|
});
|
|
@@ -65,7 +65,7 @@ const h = {
|
|
|
65
65
|
REMOVE: "remove",
|
|
66
66
|
MOVE: "move",
|
|
67
67
|
NOOP: "noop"
|
|
68
|
-
},
|
|
68
|
+
}, f = {
|
|
69
69
|
TEXT: "text",
|
|
70
70
|
ELEMENT: "element",
|
|
71
71
|
FRAGMENT: "fragment",
|
|
@@ -75,24 +75,24 @@ const h = {
|
|
|
75
75
|
function d(e) {
|
|
76
76
|
const { type: t } = e;
|
|
77
77
|
switch (t) {
|
|
78
|
-
case
|
|
79
|
-
|
|
78
|
+
case f.TEXT: {
|
|
79
|
+
B(e);
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
|
-
case
|
|
83
|
-
|
|
82
|
+
case f.ELEMENT: {
|
|
83
|
+
X(e);
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
|
-
case
|
|
87
|
-
|
|
86
|
+
case f.FRAGMENT: {
|
|
87
|
+
_(e);
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
|
-
case
|
|
90
|
+
case f.COMPONENT: {
|
|
91
91
|
e.component?.unmount();
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
|
-
case
|
|
95
|
-
|
|
94
|
+
case f.PORTAL: {
|
|
95
|
+
z(e);
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
default:
|
|
@@ -100,32 +100,32 @@ function d(e) {
|
|
|
100
100
|
}
|
|
101
101
|
delete e.el;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function B(e) {
|
|
104
104
|
const { el: t } = e;
|
|
105
105
|
t && t.remove();
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function X(e) {
|
|
108
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 && (
|
|
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
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function _(e) {
|
|
112
112
|
const { children: t } = e;
|
|
113
113
|
t && t.forEach(d);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function z(e) {
|
|
116
116
|
const { children: t } = e;
|
|
117
117
|
t && t.forEach(d);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function T(e) {
|
|
120
120
|
return e.filter((t) => t != null);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function J(e, t) {
|
|
123
123
|
return {
|
|
124
124
|
added: t.filter((n) => !e.includes(n)),
|
|
125
125
|
removed: e.filter((n) => !t.includes(n))
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class K {
|
|
129
129
|
#t = [];
|
|
130
130
|
#e = [];
|
|
131
131
|
#n;
|
|
@@ -146,7 +146,7 @@ class _ {
|
|
|
146
146
|
return !1;
|
|
147
147
|
const r = this.#t[t];
|
|
148
148
|
return n.findIndex(
|
|
149
|
-
(
|
|
149
|
+
(o) => this.#n(r, o)
|
|
150
150
|
) === -1;
|
|
151
151
|
}
|
|
152
152
|
findIndexFrom(t, n) {
|
|
@@ -195,115 +195,115 @@ class _ {
|
|
|
195
195
|
from: r,
|
|
196
196
|
index: n,
|
|
197
197
|
item: this.#t[r]
|
|
198
|
-
}, [
|
|
199
|
-
this.#t.splice(n, 0,
|
|
200
|
-
const [
|
|
201
|
-
return this.#e.splice(n, 0,
|
|
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
202
|
}
|
|
203
203
|
get length() {
|
|
204
204
|
return this.#t.length;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
const r = [], s = new
|
|
209
|
-
for (let
|
|
210
|
-
if (s.isRemoval(
|
|
211
|
-
r.push(s.removeItem(
|
|
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
212
|
continue;
|
|
213
213
|
}
|
|
214
|
-
if (s.isNoop(
|
|
215
|
-
r.push(s.noopItem(
|
|
214
|
+
if (s.isNoop(o, t)) {
|
|
215
|
+
r.push(s.noopItem(o));
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
if (s.isAddition(
|
|
220
|
-
r.push(s.addItem(
|
|
218
|
+
const i = t[o];
|
|
219
|
+
if (s.isAddition(i, o)) {
|
|
220
|
+
r.push(s.addItem(i, o));
|
|
221
221
|
continue;
|
|
222
222
|
}
|
|
223
|
-
r.push(s.moveItem(
|
|
223
|
+
r.push(s.moveItem(i, o));
|
|
224
224
|
}
|
|
225
225
|
return r.push(...s.removeItemsAfter(t.length)), r;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
const r = typeof e == "string" ?
|
|
227
|
+
function w(e, t = {}, n = []) {
|
|
228
|
+
const r = typeof e == "string" ? f.ELEMENT : f.COMPONENT;
|
|
229
229
|
return {
|
|
230
230
|
tag: e,
|
|
231
231
|
props: t,
|
|
232
232
|
type: r,
|
|
233
|
-
children: T(
|
|
233
|
+
children: A(T(n))
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function S(e) {
|
|
237
237
|
return {
|
|
238
|
-
type:
|
|
238
|
+
type: f.TEXT,
|
|
239
239
|
value: e,
|
|
240
240
|
props: {}
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function D(e) {
|
|
244
244
|
return {
|
|
245
|
-
type:
|
|
246
|
-
children: T(
|
|
245
|
+
type: f.FRAGMENT,
|
|
246
|
+
children: A(T(e)),
|
|
247
247
|
props: {}
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function H(e, t) {
|
|
251
251
|
return {
|
|
252
|
-
type:
|
|
253
|
-
children: T(
|
|
252
|
+
type: f.PORTAL,
|
|
253
|
+
children: A(T(e)),
|
|
254
254
|
props: {},
|
|
255
255
|
container: t
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
return e.map((t) => typeof t == "string" ?
|
|
258
|
+
function A(e) {
|
|
259
|
+
return e.map((t) => typeof t == "string" ? S(t) : t);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function y(e) {
|
|
262
262
|
if (!e.children)
|
|
263
263
|
return [];
|
|
264
264
|
const t = [];
|
|
265
265
|
for (const n of e.children)
|
|
266
|
-
n.type ===
|
|
266
|
+
n.type === f.FRAGMENT ? t.push(...y(n)) : t.push(n);
|
|
267
267
|
return t;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function x(e, t, n) {
|
|
270
270
|
e.style[t] = n.toString();
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Q(e, t) {
|
|
273
273
|
e.style[t] = null;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Z(e, t) {
|
|
276
276
|
const { class: n, style: r, ...s } = t;
|
|
277
|
-
n &&
|
|
278
|
-
|
|
277
|
+
n && V(e, n), r && Object.entries(r).forEach(([o, i]) => {
|
|
278
|
+
x(e, o, i);
|
|
279
279
|
});
|
|
280
|
-
for (const [
|
|
281
|
-
|
|
280
|
+
for (const [o, i] of Object.entries(s))
|
|
281
|
+
F(e, o, i);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function V(e, t) {
|
|
284
284
|
if (e instanceof SVGElement) {
|
|
285
285
|
e.removeAttribute("class"), typeof t == "string" ? e.setAttribute("class", t) : Array.isArray(t) && e.classList.add(...t);
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
288
|
e.className = "", typeof t == "string" ? e.className = t : Array.isArray(t) && e.classList.add(...t);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
n == null ?
|
|
290
|
+
function F(e, t, n) {
|
|
291
|
+
n == null ? k(e, t) : e.setAttribute(t, String(n));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function k(e, t) {
|
|
294
294
|
e[t] = null, e.removeAttribute(t);
|
|
295
295
|
}
|
|
296
|
-
let
|
|
297
|
-
const
|
|
298
|
-
function
|
|
299
|
-
|
|
296
|
+
let v = !1;
|
|
297
|
+
const N = [];
|
|
298
|
+
function E(e) {
|
|
299
|
+
N.push(e), tt();
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
|
|
301
|
+
function tt() {
|
|
302
|
+
v || (v = !0, queueMicrotask(et));
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
for (;
|
|
306
|
-
const e =
|
|
304
|
+
function et() {
|
|
305
|
+
for (; N.length > 0; ) {
|
|
306
|
+
const e = N.shift();
|
|
307
307
|
let t;
|
|
308
308
|
try {
|
|
309
309
|
t = e();
|
|
@@ -319,65 +319,65 @@ function V() {
|
|
|
319
319
|
}
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
|
-
|
|
322
|
+
v = !1;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function M(e) {
|
|
325
325
|
const { on: t = {}, ...n } = e.props;
|
|
326
326
|
return delete n.key, { props: n, events: t };
|
|
327
327
|
}
|
|
328
328
|
function p(e, t, n = null, r = null) {
|
|
329
329
|
switch (e.type) {
|
|
330
|
-
case
|
|
331
|
-
|
|
330
|
+
case f.TEXT: {
|
|
331
|
+
nt(e, t, n);
|
|
332
332
|
break;
|
|
333
333
|
}
|
|
334
|
-
case
|
|
335
|
-
|
|
334
|
+
case f.ELEMENT: {
|
|
335
|
+
st(e, t, n, r);
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
|
-
case
|
|
339
|
-
|
|
338
|
+
case f.FRAGMENT: {
|
|
339
|
+
rt(e, t, n, r);
|
|
340
340
|
break;
|
|
341
341
|
}
|
|
342
|
-
case
|
|
343
|
-
|
|
342
|
+
case f.COMPONENT: {
|
|
343
|
+
ot(e, t, n, r);
|
|
344
344
|
const s = e.component;
|
|
345
|
-
s &&
|
|
345
|
+
s && E(() => s.onMount());
|
|
346
346
|
break;
|
|
347
347
|
}
|
|
348
|
-
case
|
|
349
|
-
|
|
348
|
+
case f.PORTAL: {
|
|
349
|
+
ct(e, r);
|
|
350
350
|
break;
|
|
351
351
|
}
|
|
352
352
|
default:
|
|
353
353
|
throw new Error(`Can't mount DOM of type: ${e.type}`);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function nt(e, t, n) {
|
|
357
357
|
const { value: r } = e, s = document.createTextNode(r);
|
|
358
|
-
e.el = s,
|
|
358
|
+
e.el = s, U(s, t, n);
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function rt(e, t, n, r) {
|
|
361
361
|
const { children: s } = e;
|
|
362
|
-
e.el = t, s?.forEach((
|
|
363
|
-
p(
|
|
362
|
+
e.el = t, s?.forEach((o, i) => {
|
|
363
|
+
p(o, t, n != null ? n + i : null, r);
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
const { tag: s, children:
|
|
368
|
-
|
|
369
|
-
p(l,
|
|
370
|
-
}),
|
|
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
371
|
}
|
|
372
|
-
function
|
|
373
|
-
const { props: r, events: s } =
|
|
374
|
-
r.ref && typeof r.ref == "object" && "current" in r.ref && (r.ref.current = e, delete r.ref), t.listeners =
|
|
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
375
|
}
|
|
376
|
-
function
|
|
377
|
-
const s = e.tag, { props:
|
|
378
|
-
|
|
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
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function U(e, t, n) {
|
|
381
381
|
if (n == null) {
|
|
382
382
|
t.append(e);
|
|
383
383
|
return;
|
|
@@ -387,75 +387,75 @@ function j(e, t, n) {
|
|
|
387
387
|
const r = t.childNodes;
|
|
388
388
|
n >= r.length ? t.append(e) : t.insertBefore(e, r[n]);
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function ct(e, t) {
|
|
391
391
|
const { children: n, container: r } = e;
|
|
392
392
|
n?.forEach((s) => {
|
|
393
393
|
p(s, r, null, t);
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function G(e, t) {
|
|
397
397
|
if (e.type !== t.type)
|
|
398
398
|
return !1;
|
|
399
|
-
if (e.type ===
|
|
399
|
+
if (e.type === f.ELEMENT) {
|
|
400
400
|
const n = e, r = t, {
|
|
401
401
|
tag: s,
|
|
402
|
-
props: { key:
|
|
402
|
+
props: { key: o }
|
|
403
403
|
} = n, {
|
|
404
|
-
tag:
|
|
405
|
-
props: { key:
|
|
404
|
+
tag: i,
|
|
405
|
+
props: { key: c }
|
|
406
406
|
} = r;
|
|
407
|
-
return s ===
|
|
407
|
+
return s === i && o === c;
|
|
408
408
|
}
|
|
409
|
-
if (e.type ===
|
|
410
|
-
const n = e, r = t, { tag: s } = n, { tag:
|
|
411
|
-
return s ===
|
|
409
|
+
if (e.type === f.COMPONENT) {
|
|
410
|
+
const n = e, r = t, { tag: s } = n, { tag: o } = r;
|
|
411
|
+
return s === o;
|
|
412
412
|
}
|
|
413
|
-
if (e.type ===
|
|
413
|
+
if (e.type === f.PORTAL) {
|
|
414
414
|
const n = e, r = t;
|
|
415
415
|
return n.container === r.container;
|
|
416
416
|
}
|
|
417
417
|
return !0;
|
|
418
418
|
}
|
|
419
|
-
function
|
|
420
|
-
const n = Object.keys(e), r = Object.keys(t), s = [],
|
|
421
|
-
for (const
|
|
422
|
-
|
|
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
423
|
return {
|
|
424
424
|
added: s,
|
|
425
|
-
removed: n.filter((
|
|
426
|
-
updated:
|
|
425
|
+
removed: n.filter((i) => !(i in t)),
|
|
426
|
+
updated: o
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function ft(e) {
|
|
430
430
|
return e !== "";
|
|
431
431
|
}
|
|
432
|
-
function
|
|
433
|
-
return
|
|
432
|
+
function C(e) {
|
|
433
|
+
return ft(e.trim());
|
|
434
434
|
}
|
|
435
435
|
function P(e, t, n, r = null) {
|
|
436
|
-
if (!
|
|
437
|
-
const s =
|
|
436
|
+
if (!G(e, t)) {
|
|
437
|
+
const s = lt(n, e.el);
|
|
438
438
|
return d(e), p(t, n, s, r), t;
|
|
439
439
|
}
|
|
440
440
|
switch (t.el = e.el, t.type) {
|
|
441
|
-
case
|
|
441
|
+
case f.TEXT:
|
|
442
442
|
return ut(e, t), t;
|
|
443
|
-
case
|
|
444
|
-
|
|
443
|
+
case f.ELEMENT: {
|
|
444
|
+
at(e, t, r);
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
|
-
case
|
|
448
|
-
|
|
447
|
+
case f.COMPONENT: {
|
|
448
|
+
Et(e, t);
|
|
449
449
|
break;
|
|
450
450
|
}
|
|
451
|
-
case
|
|
452
|
-
|
|
451
|
+
case f.PORTAL: {
|
|
452
|
+
yt(e, t, r);
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
return
|
|
456
|
+
return q(e, t, r), t;
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function lt(e, t) {
|
|
459
459
|
if (!t) return null;
|
|
460
460
|
const n = Array.from(e.childNodes).indexOf(t);
|
|
461
461
|
return n < 0 ? null : n;
|
|
@@ -464,63 +464,63 @@ function ut(e, t) {
|
|
|
464
464
|
const n = e.el, { value: r } = e, { value: s } = t;
|
|
465
465
|
r !== s && n && (n.nodeValue = s);
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function at(e, t, n) {
|
|
468
468
|
const r = e.el, {
|
|
469
469
|
class: s,
|
|
470
|
-
style:
|
|
471
|
-
on:
|
|
472
|
-
...
|
|
470
|
+
style: o,
|
|
471
|
+
on: i,
|
|
472
|
+
...c
|
|
473
473
|
} = e.props ?? {}, {
|
|
474
474
|
class: l,
|
|
475
475
|
style: u,
|
|
476
476
|
on: a,
|
|
477
|
-
...
|
|
478
|
-
} = t.props ?? {}, { listeners:
|
|
479
|
-
|
|
477
|
+
...m
|
|
478
|
+
} = t.props ?? {}, { listeners: b } = e;
|
|
479
|
+
ht(r, c, m), pt(r, s, l), dt(
|
|
480
480
|
r,
|
|
481
|
-
|
|
481
|
+
o,
|
|
482
482
|
u
|
|
483
|
-
), t.listeners =
|
|
483
|
+
), t.listeners = mt(
|
|
484
484
|
r,
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
b,
|
|
486
|
+
i ?? {},
|
|
487
487
|
a ?? {},
|
|
488
488
|
n
|
|
489
489
|
);
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function ht(e, t = {}, n = {}) {
|
|
492
492
|
const r = t.ref, s = n.ref;
|
|
493
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
|
|
495
|
-
delete
|
|
496
|
-
const { added:
|
|
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
497
|
for (const a of l)
|
|
498
|
-
|
|
499
|
-
for (const a of
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
function
|
|
503
|
-
const r =
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
function
|
|
507
|
-
return Array.isArray(e) ? e.filter(
|
|
508
|
-
}
|
|
509
|
-
function
|
|
510
|
-
const { added: r, removed: s, updated:
|
|
511
|
-
for (const
|
|
512
|
-
|
|
513
|
-
for (const
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
function
|
|
517
|
-
const { removed:
|
|
518
|
-
for (const u of
|
|
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
519
|
const a = t?.[u];
|
|
520
520
|
a && e.removeEventListener(u, a);
|
|
521
521
|
}
|
|
522
522
|
const l = {};
|
|
523
|
-
for (const u of
|
|
523
|
+
for (const u of i.concat(c))
|
|
524
524
|
l[u] = R(
|
|
525
525
|
u,
|
|
526
526
|
r[u],
|
|
@@ -529,18 +529,18 @@ function pt(e, t = {}, n = {}, r = {}, s = null) {
|
|
|
529
529
|
);
|
|
530
530
|
return l;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
const r =
|
|
534
|
-
for (const l of
|
|
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
535
|
if (l.op === h.NOOP) {
|
|
536
536
|
const { originalIndex: u, index: a } = l;
|
|
537
|
-
P(r[u], s[a],
|
|
537
|
+
P(r[u], s[a], o, n);
|
|
538
538
|
}
|
|
539
|
-
for (const l of
|
|
539
|
+
for (const l of i)
|
|
540
540
|
switch (l.op) {
|
|
541
541
|
case h.MOVE: {
|
|
542
|
-
const { from: u, index: a } = l,
|
|
543
|
-
|
|
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
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
case h.REMOVE: {
|
|
@@ -550,24 +550,24 @@ function x(e, t, n) {
|
|
|
550
550
|
}
|
|
551
551
|
case h.ADD: {
|
|
552
552
|
const { index: u, item: a } = l;
|
|
553
|
-
p(a,
|
|
553
|
+
p(a, o, u + c, n);
|
|
554
554
|
break;
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
function
|
|
559
|
-
const { component: n } = e, { props: r } =
|
|
558
|
+
function Et(e, t) {
|
|
559
|
+
const { component: n } = e, { props: r } = M(t);
|
|
560
560
|
n.updateProps(r), t.component = n, t.el = n.firstElement;
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function yt(e, t, n) {
|
|
563
563
|
if (e.container !== t.container) {
|
|
564
564
|
d(e), p(t, document.body, null, n);
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
q(e, t, n);
|
|
568
568
|
}
|
|
569
|
-
const
|
|
570
|
-
class
|
|
569
|
+
const bt = (e) => e.constructor.name.includes("Provider"), gt = (e) => e.constructor.name.includes("Consumer");
|
|
570
|
+
class j {
|
|
571
571
|
constructor(t = {}, n) {
|
|
572
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
573
|
}
|
|
@@ -596,19 +596,19 @@ class L {
|
|
|
596
596
|
return Promise.resolve();
|
|
597
597
|
}
|
|
598
598
|
get elements() {
|
|
599
|
-
return this.vdom == null ? [] : this.vdom.type ===
|
|
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
600
|
}
|
|
601
601
|
get firstElement() {
|
|
602
602
|
return this.elements[0];
|
|
603
603
|
}
|
|
604
604
|
get offset() {
|
|
605
|
-
return this.vdom?.type ===
|
|
605
|
+
return this.vdom?.type === f.FRAGMENT && this.hostEl && this.firstElement ? Array.from(this.hostEl.children).indexOf(this.firstElement) : 0;
|
|
606
606
|
}
|
|
607
607
|
updateProps(t) {
|
|
608
608
|
const n = { ...this.props, ...t }, r = this.props;
|
|
609
609
|
this.props = n;
|
|
610
610
|
let s = this.updateContext();
|
|
611
|
-
|
|
611
|
+
O(r, n) && !s || (bt(this) && this.notify(), this.patch());
|
|
612
612
|
}
|
|
613
613
|
setState(t) {
|
|
614
614
|
typeof t == "function" ? this.state = {
|
|
@@ -622,15 +622,15 @@ class L {
|
|
|
622
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
623
|
}
|
|
624
624
|
unmount() {
|
|
625
|
-
this.isMounted && (
|
|
625
|
+
this.isMounted && (E(() => this.onWillUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: t }) => {
|
|
626
626
|
t.subscribedProvider = null;
|
|
627
|
-
}), this.dependencies = [], this.vdom && d(this.vdom),
|
|
627
|
+
}), this.dependencies = [], this.vdom && d(this.vdom), E(() => this.onUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
|
|
628
628
|
}
|
|
629
629
|
patch() {
|
|
630
630
|
if (!this.isMounted || !this.hostEl || !this.vdom)
|
|
631
631
|
return;
|
|
632
632
|
const t = this.render();
|
|
633
|
-
this.vdom = P(this.vdom, t, this.hostEl, this),
|
|
633
|
+
this.vdom = P(this.vdom, t, this.hostEl, this), E(() => this.onUpdate());
|
|
634
634
|
}
|
|
635
635
|
updateContext() {
|
|
636
636
|
const t = Object.getPrototypeOf(this).constructor.contextType;
|
|
@@ -660,25 +660,25 @@ class L {
|
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
function vt(e) {
|
|
663
|
-
class t extends
|
|
663
|
+
class t extends j {
|
|
664
664
|
render() {
|
|
665
|
-
let
|
|
666
|
-
return Array.isArray(this.props.children) ?
|
|
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
667
|
}
|
|
668
668
|
}
|
|
669
|
-
const r = class r extends
|
|
669
|
+
const r = class r extends j {
|
|
670
670
|
render() {
|
|
671
|
-
let
|
|
672
|
-
if (Array.isArray(
|
|
673
|
-
if (
|
|
674
|
-
|
|
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
675
|
else
|
|
676
676
|
throw new Error(
|
|
677
677
|
"Consumer: expected single function child, got array"
|
|
678
678
|
);
|
|
679
|
-
if (typeof
|
|
679
|
+
if (typeof o != "function")
|
|
680
680
|
throw new Error("Consumer: children is not a function");
|
|
681
|
-
return
|
|
681
|
+
return o(this.context);
|
|
682
682
|
}
|
|
683
683
|
};
|
|
684
684
|
r.contextType = {
|
|
@@ -692,27 +692,62 @@ function vt(e) {
|
|
|
692
692
|
defaultValue: e
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function Nt(e, t) {
|
|
696
696
|
if (!t)
|
|
697
697
|
throw new Error("Container element is not provided for rendering.");
|
|
698
698
|
p(e, t);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function Pt(e = null) {
|
|
701
701
|
return {
|
|
702
702
|
current: e
|
|
703
703
|
};
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function Tt(e, t) {
|
|
706
706
|
const n = Array.isArray(e) ? e : [e];
|
|
707
|
-
return
|
|
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);
|
|
708
741
|
}
|
|
709
742
|
export {
|
|
710
|
-
|
|
743
|
+
j as Component,
|
|
711
744
|
vt as createContext,
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
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
|
|
718
753
|
};
|