neo.mjs 4.0.37 → 4.0.38
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo.mjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.38",
|
|
4
4
|
"description": "The webworkers driven UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"autoprefixer": "^10.4.7",
|
|
41
41
|
"chalk": "^5.0.1",
|
|
42
42
|
"clean-webpack-plugin": "^4.0.0",
|
|
43
|
-
"commander": "^9.
|
|
44
|
-
"cssnano": "^5.1.
|
|
43
|
+
"commander": "^9.3.0",
|
|
44
|
+
"cssnano": "^5.1.10",
|
|
45
45
|
"envinfo": "^7.8.1",
|
|
46
46
|
"fs-extra": "^10.1.0",
|
|
47
47
|
"highlightjs-line-numbers.js": "^2.8.0",
|
package/src/vdom/Helper.mjs
CHANGED
|
@@ -243,6 +243,9 @@ class Helper extends Base {
|
|
|
243
243
|
oldVnodeRoot,
|
|
244
244
|
parentId: movedNode.parentNode.id
|
|
245
245
|
});
|
|
246
|
+
|
|
247
|
+
// see: https://github.com/neomjs/neo/issues/3116
|
|
248
|
+
movedOldNode.parentNode.childNodes.splice(index, 0, movedOldNode);
|
|
246
249
|
} else if (!movedNode && movedOldNode) {
|
|
247
250
|
if (newVnode.id === movedOldNode.vnode.id) {
|
|
248
251
|
indexDelta = 0;
|
|
@@ -43,8 +43,7 @@ StartTest(t => {
|
|
|
43
43
|
|
|
44
44
|
t.isDeeplyStrict(deltas, [
|
|
45
45
|
{action: 'moveNode', id: 'neo-event-2', index: 0, parentId: 'neo-column-1'},
|
|
46
|
-
{innerHTML: '06:00', id: 'neo-event-2__time'}
|
|
47
|
-
{action: 'moveNode', id: 'neo-event-1', index: 1, parentId: 'neo-column-1'} // todo: does not hurt, but not needed
|
|
46
|
+
{innerHTML: '06:00', id: 'neo-event-2__time'}
|
|
48
47
|
], 'deltas got created successfully');
|
|
49
48
|
|
|
50
49
|
t.diag("Revert operation");
|
|
@@ -67,7 +66,6 @@ StartTest(t => {
|
|
|
67
66
|
|
|
68
67
|
t.isDeeplyStrict(deltas, [
|
|
69
68
|
{action: 'moveNode', id: 'neo-event-1', index: 0, parentId: 'neo-column-1'},
|
|
70
|
-
{action: 'moveNode', id: 'neo-event-2', index: 1, parentId: 'neo-column-1'}, // todo: does not hurt, but not needed
|
|
71
69
|
{innerHTML: '10:00', id: 'neo-event-2__time'}
|
|
72
70
|
], 'deltas got created successfully');
|
|
73
71
|
});
|
|
@@ -306,8 +306,8 @@ StartTest(t => {
|
|
|
306
306
|
}, 'vnode got updated successfully');
|
|
307
307
|
|
|
308
308
|
t.isDeeplyStrict(deltas, [
|
|
309
|
-
{action: 'moveNode', id: 'neo-vnode-3',
|
|
310
|
-
{action: 'moveNode', id: 'neo-
|
|
309
|
+
{action: 'moveNode', id: 'neo-vnode-3', index: 0, parentId: 'neo-vnode-1'},
|
|
310
|
+
{action: 'moveNode', id: 'neo-button-1', index: 1, parentId: 'neo-vnode-1'}
|
|
311
311
|
], 'deltas got created successfully');
|
|
312
312
|
|
|
313
313
|
vdom.cn.push(vdom.cn.shift()); // left shift
|
|
@@ -333,8 +333,7 @@ StartTest(t => {
|
|
|
333
333
|
|
|
334
334
|
t.isDeeplyStrict(deltas, [
|
|
335
335
|
{action: 'moveNode', id: 'neo-button-1', index: 0, parentId: 'neo-vnode-1'},
|
|
336
|
-
{action: 'moveNode', id: 'neo-vnode-2', index: 1, parentId: 'neo-vnode-1'}
|
|
337
|
-
{action: 'moveNode', id: 'neo-vnode-3', index: 2, parentId: 'neo-vnode-1'}
|
|
336
|
+
{action: 'moveNode', id: 'neo-vnode-2', index: 1, parentId: 'neo-vnode-1'}
|
|
338
337
|
], 'deltas got created successfully');
|
|
339
338
|
|
|
340
339
|
vdom.cn.unshift(vdom.cn.pop()); // right shift
|
|
@@ -359,9 +358,7 @@ StartTest(t => {
|
|
|
359
358
|
}, 'vnode got updated successfully');
|
|
360
359
|
|
|
361
360
|
t.isDeeplyStrict(deltas, [
|
|
362
|
-
{action: 'moveNode', id: 'neo-vnode-3',
|
|
363
|
-
{action: 'moveNode', id: 'neo-button-1', index: 1, parentId: 'neo-vnode-1'},
|
|
364
|
-
{action: 'moveNode', id: 'neo-vnode-2', index: 2, parentId: 'neo-vnode-1'}
|
|
361
|
+
{action: 'moveNode', id: 'neo-vnode-3', index: 0, parentId: 'neo-vnode-1'}
|
|
365
362
|
], 'deltas got created successfully');
|
|
366
363
|
});
|
|
367
364
|
|
|
@@ -548,7 +545,89 @@ StartTest(t => {
|
|
|
548
545
|
{attributes: {tabIndex: '-1'}, childNodes: [], className: ['neo-list-item'], id: 'neo-list-1__rwaters', innerHTML: 'Rich', nodeName: 'li', style: {}, vtype: 'vnode'},
|
|
549
546
|
{attributes: {tabIndex: '-1'}, childNodes: [], className: ['neo-list-item'], id: 'neo-list-1__tobiu', innerHTML: 'Tobias', nodeName: 'li', style: {}, vtype: 'vnode'}
|
|
550
547
|
], 'vnode got updated successfully');
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
t.it('Sorting', t => {
|
|
551
|
+
t.diag("Creating a sorted array");
|
|
552
|
+
|
|
553
|
+
vdom =
|
|
554
|
+
{id: 'root', cn: [
|
|
555
|
+
{id: '0', html: 'g'},
|
|
556
|
+
{id: '1', html: 'g'},
|
|
557
|
+
{id: '2', html: 'g'},
|
|
558
|
+
{id: '3', html: 'g'},
|
|
559
|
+
{id: '4', html: 'm'},
|
|
560
|
+
{id: '5', html: 'm'},
|
|
561
|
+
{id: '6', html: 'w'},
|
|
562
|
+
{id: '7', html: 'w'},
|
|
563
|
+
{id: '8', html: 'w'},
|
|
564
|
+
{id: '9', html: 'w'}
|
|
565
|
+
]};
|
|
566
|
+
|
|
567
|
+
vnode = VdomHelper.create(vdom);
|
|
568
|
+
|
|
569
|
+
t.isDeeplyStrict(vnode, {
|
|
570
|
+
attributes: {},
|
|
571
|
+
className : [],
|
|
572
|
+
id : 'root',
|
|
573
|
+
innerHTML : undefined,
|
|
574
|
+
nodeName : 'div',
|
|
575
|
+
outerHTML : t.any(String),
|
|
576
|
+
style : {},
|
|
577
|
+
vtype : 'vnode',
|
|
578
|
+
|
|
579
|
+
childNodes: [
|
|
580
|
+
{attributes: {}, childNodes: [], className: [], id: '0', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
581
|
+
{attributes: {}, childNodes: [], className: [], id: '1', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
582
|
+
{attributes: {}, childNodes: [], className: [], id: '2', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
583
|
+
{attributes: {}, childNodes: [], className: [], id: '3', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
584
|
+
{attributes: {}, childNodes: [], className: [], id: '4', innerHTML: 'm', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
585
|
+
{attributes: {}, childNodes: [], className: [], id: '5', innerHTML: 'm', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
586
|
+
{attributes: {}, childNodes: [], className: [], id: '6', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
587
|
+
{attributes: {}, childNodes: [], className: [], id: '7', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
588
|
+
{attributes: {}, childNodes: [], className: [], id: '8', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
589
|
+
{attributes: {}, childNodes: [], className: [], id: '9', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'}
|
|
590
|
+
]
|
|
591
|
+
}, 'vnode got created successfully');
|
|
592
|
+
|
|
593
|
+
vdom.cn = [
|
|
594
|
+
{id: '9', html: 'w'},
|
|
595
|
+
{id: '8', html: 'w'},
|
|
596
|
+
{id: '7', html: 'w'},
|
|
597
|
+
{id: '6', html: 'w'},
|
|
598
|
+
{id: '4', html: 'm'},
|
|
599
|
+
{id: '5', html: 'm'},
|
|
600
|
+
{id: '3', html: 'g'},
|
|
601
|
+
{id: '2', html: 'g'},
|
|
602
|
+
{id: '1', html: 'g'},
|
|
603
|
+
{id: '0', html: 'g'}
|
|
604
|
+
];
|
|
605
|
+
|
|
606
|
+
output = VdomHelper.update({vdom: vdom, vnode: vnode}); deltas = output.deltas; vnode = output.vnode;
|
|
607
|
+
|
|
608
|
+
t.isDeeplyStrict(vnode, {
|
|
609
|
+
attributes: {},
|
|
610
|
+
className : [],
|
|
611
|
+
id : 'root',
|
|
612
|
+
innerHTML : undefined,
|
|
613
|
+
nodeName : 'div',
|
|
614
|
+
style : {},
|
|
615
|
+
vtype : 'vnode',
|
|
616
|
+
|
|
617
|
+
childNodes: [
|
|
618
|
+
{attributes: {}, childNodes: [], className: [], id: '9', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
619
|
+
{attributes: {}, childNodes: [], className: [], id: '8', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
620
|
+
{attributes: {}, childNodes: [], className: [], id: '7', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
621
|
+
{attributes: {}, childNodes: [], className: [], id: '6', innerHTML: 'w', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
622
|
+
{attributes: {}, childNodes: [], className: [], id: '4', innerHTML: 'm', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
623
|
+
{attributes: {}, childNodes: [], className: [], id: '5', innerHTML: 'm', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
624
|
+
{attributes: {}, childNodes: [], className: [], id: '3', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
625
|
+
{attributes: {}, childNodes: [], className: [], id: '2', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
626
|
+
{attributes: {}, childNodes: [], className: [], id: '1', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'},
|
|
627
|
+
{attributes: {}, childNodes: [], className: [], id: '0', innerHTML: 'g', nodeName: 'div', style: {}, vtype: 'vnode'}
|
|
628
|
+
]
|
|
629
|
+
}, 'vnode got updated successfully');
|
|
551
630
|
|
|
552
|
-
|
|
631
|
+
console.log(deltas);
|
|
553
632
|
});
|
|
554
633
|
});
|