hyoo_sync_client 0.0.461 → 0.0.463
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/node.test.js +26 -4
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +26 -4
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -7460,13 +7460,13 @@ var $;
|
|
|
7460
7460
|
function $mol_reconcile({ prev, from, to, next, equal, drop, insert, update, }) {
|
|
7461
7461
|
if (!update)
|
|
7462
7462
|
update = (next, prev, lead) => insert(next, drop(prev, lead));
|
|
7463
|
+
if (to > prev.length)
|
|
7464
|
+
to = prev.length;
|
|
7465
|
+
if (from > to)
|
|
7466
|
+
from = to;
|
|
7463
7467
|
let p = from;
|
|
7464
7468
|
let n = 0;
|
|
7465
7469
|
let lead = p ? prev[p - 1] : null;
|
|
7466
|
-
if (to > prev.length)
|
|
7467
|
-
$mol_fail(new RangeError(`To(${to}) greater then length(${prev.length})`));
|
|
7468
|
-
if (from > to)
|
|
7469
|
-
$mol_fail(new RangeError(`From(${to}) greater then to(${to})`));
|
|
7470
7470
|
while (p < to || n < next.length) {
|
|
7471
7471
|
if (p < to && n < next.length && equal(next[n], prev[p])) {
|
|
7472
7472
|
lead = prev[p];
|
|
@@ -7548,6 +7548,28 @@ var $;
|
|
|
7548
7548
|
$mol_jsx("p", { "data-rev": "old" }, "c"),
|
|
7549
7549
|
$mol_jsx("p", { "data-rev": "old" }, "d")));
|
|
7550
7550
|
},
|
|
7551
|
+
'append items'() {
|
|
7552
|
+
const list = $mol_jsx("body", null,
|
|
7553
|
+
$mol_jsx("p", { "data-rev": "old" }, "a"));
|
|
7554
|
+
$mol_reconcile({
|
|
7555
|
+
prev: [...list.children],
|
|
7556
|
+
from: 2,
|
|
7557
|
+
to: 3,
|
|
7558
|
+
next: 'bc',
|
|
7559
|
+
equal: (next, prev) => prev.textContent === next,
|
|
7560
|
+
drop: (prev, lead) => list.removeChild(prev),
|
|
7561
|
+
insert: (next, lead) => list.insertBefore($mol_jsx("p", { "data-rev": "new" }, next), lead ? lead.nextSibling : list.firstChild),
|
|
7562
|
+
update: (next, prev, lead) => {
|
|
7563
|
+
prev.textContent = next;
|
|
7564
|
+
prev.setAttribute('data-rev', 'up');
|
|
7565
|
+
return prev;
|
|
7566
|
+
},
|
|
7567
|
+
});
|
|
7568
|
+
$mol_assert_equal(list, $mol_jsx("body", null,
|
|
7569
|
+
$mol_jsx("p", { "data-rev": "old" }, "a"),
|
|
7570
|
+
$mol_jsx("p", { "data-rev": "new" }, "b"),
|
|
7571
|
+
$mol_jsx("p", { "data-rev": "new" }, "c")));
|
|
7572
|
+
},
|
|
7551
7573
|
'split item'() {
|
|
7552
7574
|
const list = $mol_jsx("body", null,
|
|
7553
7575
|
$mol_jsx("p", { "data-rev": "old" }, "a"),
|