j-templates 7.0.104 → 7.0.105
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/vNode.js +10 -23
- package/_not_used/array.js +2 -1
- package/package.json +1 -1
package/Node/vNode.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vNode = void 0;
|
|
4
|
+
const array_1 = require("../_not_used/array");
|
|
4
5
|
const Store_1 = require("../Store");
|
|
5
6
|
const observableScope_1 = require("../Store/Tree/observableScope");
|
|
6
7
|
const emitter_1 = require("../Utils/emitter");
|
|
@@ -204,32 +205,18 @@ function ToArray(result) {
|
|
|
204
205
|
return result;
|
|
205
206
|
return [result];
|
|
206
207
|
}
|
|
207
|
-
function
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
function FlattenFragmentsRecursive(children, startIndex, result) {
|
|
214
|
-
for (let x = startIndex; x < children.length; x++) {
|
|
215
|
-
const vnode = children[x];
|
|
216
|
-
switch (vnode.type) {
|
|
217
|
-
case vNode_types_1.FRAGMENT_NODE:
|
|
218
|
-
FlattenFragmentsRecursive(vnode.children, 0, result);
|
|
219
|
-
default:
|
|
220
|
-
if (vnode.node !== null)
|
|
221
|
-
result.push(vnode.node);
|
|
222
|
-
}
|
|
208
|
+
function MapNode(vnode) {
|
|
209
|
+
switch (vnode.type) {
|
|
210
|
+
case vNode_types_1.FRAGMENT_NODE:
|
|
211
|
+
return vnode.children.flatMap(MapNode);
|
|
212
|
+
default:
|
|
213
|
+
return vnode.node;
|
|
223
214
|
}
|
|
224
|
-
return result;
|
|
225
215
|
}
|
|
226
216
|
function CleanupChildrenArray(children) {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const result = children.slice(0, index).map(GetNode);
|
|
231
|
-
FlattenFragmentsRecursive(children, index, result);
|
|
232
|
-
return result;
|
|
217
|
+
const nodes = children.flatMap(MapNode);
|
|
218
|
+
(0, array_1.RemoveNulls)(nodes);
|
|
219
|
+
return nodes;
|
|
233
220
|
}
|
|
234
221
|
function UpdateChildren(vnode, init = false, skipInit = false) {
|
|
235
222
|
if (!vnode.children)
|
package/_not_used/array.js
CHANGED
|
@@ -33,7 +33,8 @@ function RemoveNulls(array, startIndex = 0) {
|
|
|
33
33
|
notNullIndex++;
|
|
34
34
|
for (; notNullIndex < array.length && array[notNullIndex] === null; notNullIndex++) { }
|
|
35
35
|
}
|
|
36
|
-
array.
|
|
36
|
+
if (nullIndex < array.length)
|
|
37
|
+
array.splice(nullIndex);
|
|
37
38
|
}
|
|
38
39
|
function ArrayDiff(source, target) {
|
|
39
40
|
if (source === target)
|