hyoo_sync_client 0.0.462 → 0.0.464
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/package.json
CHANGED
package/web.test.js
CHANGED
|
@@ -2296,13 +2296,13 @@ var $;
|
|
|
2296
2296
|
function $mol_reconcile({ prev, from, to, next, equal, drop, insert, update, }) {
|
|
2297
2297
|
if (!update)
|
|
2298
2298
|
update = (next, prev, lead) => insert(next, drop(prev, lead));
|
|
2299
|
+
if (to > prev.length)
|
|
2300
|
+
to = prev.length;
|
|
2301
|
+
if (from > to)
|
|
2302
|
+
from = to;
|
|
2299
2303
|
let p = from;
|
|
2300
2304
|
let n = 0;
|
|
2301
2305
|
let lead = p ? prev[p - 1] : null;
|
|
2302
|
-
if (to > prev.length)
|
|
2303
|
-
$mol_fail(new RangeError(`To(${to}) greater then length(${prev.length})`));
|
|
2304
|
-
if (from > to)
|
|
2305
|
-
$mol_fail(new RangeError(`From(${to}) greater then to(${to})`));
|
|
2306
2306
|
while (p < to || n < next.length) {
|
|
2307
2307
|
if (p < to && n < next.length && equal(next[n], prev[p])) {
|
|
2308
2308
|
lead = prev[p];
|
|
@@ -2384,6 +2384,28 @@ var $;
|
|
|
2384
2384
|
$mol_jsx("p", { "data-rev": "old" }, "c"),
|
|
2385
2385
|
$mol_jsx("p", { "data-rev": "old" }, "d")));
|
|
2386
2386
|
},
|
|
2387
|
+
'append items'() {
|
|
2388
|
+
const list = $mol_jsx("body", null,
|
|
2389
|
+
$mol_jsx("p", { "data-rev": "old" }, "a"));
|
|
2390
|
+
$mol_reconcile({
|
|
2391
|
+
prev: [...list.children],
|
|
2392
|
+
from: 2,
|
|
2393
|
+
to: 3,
|
|
2394
|
+
next: 'bc',
|
|
2395
|
+
equal: (next, prev) => prev.textContent === next,
|
|
2396
|
+
drop: (prev, lead) => list.removeChild(prev),
|
|
2397
|
+
insert: (next, lead) => list.insertBefore($mol_jsx("p", { "data-rev": "new" }, next), lead ? lead.nextSibling : list.firstChild),
|
|
2398
|
+
update: (next, prev, lead) => {
|
|
2399
|
+
prev.textContent = next;
|
|
2400
|
+
prev.setAttribute('data-rev', 'up');
|
|
2401
|
+
return prev;
|
|
2402
|
+
},
|
|
2403
|
+
});
|
|
2404
|
+
$mol_assert_equal(list, $mol_jsx("body", null,
|
|
2405
|
+
$mol_jsx("p", { "data-rev": "old" }, "a"),
|
|
2406
|
+
$mol_jsx("p", { "data-rev": "new" }, "b"),
|
|
2407
|
+
$mol_jsx("p", { "data-rev": "new" }, "c")));
|
|
2408
|
+
},
|
|
2387
2409
|
'split item'() {
|
|
2388
2410
|
const list = $mol_jsx("body", null,
|
|
2389
2411
|
$mol_jsx("p", { "data-rev": "old" }, "a"),
|