my-framework-almaz 2.0.5 → 2.0.6
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.
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
function addEventListener$1(eventName, handler, el) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
el.addEventListener(eventName, boundHandler);
|
|
6
|
-
return boundHandler
|
|
2
|
+
el.addEventListener(eventName, handler);
|
|
3
|
+
return handler
|
|
7
4
|
}
|
|
8
5
|
function addEventListeners(listeners = {}, el) {
|
|
9
6
|
const addedListeners = {};
|
|
@@ -182,14 +179,14 @@ function mapTextNodes(children) {
|
|
|
182
179
|
typeof child === 'string' ? hString(child) : child
|
|
183
180
|
)
|
|
184
181
|
}
|
|
185
|
-
function
|
|
182
|
+
function extractChildren(vdom) {
|
|
186
183
|
if (vdom.children == null) {
|
|
187
184
|
return []
|
|
188
185
|
}
|
|
189
186
|
const children = [];
|
|
190
187
|
for (const child of vdom.children) {
|
|
191
188
|
if (child.type === DOM_TYPES.FRAGMENT) {
|
|
192
|
-
children.push(...
|
|
189
|
+
children.push(...extractChildren(child));
|
|
193
190
|
} else {
|
|
194
191
|
children.push(child);
|
|
195
192
|
}
|
|
@@ -513,8 +510,8 @@ function toClassList(classes = '') {
|
|
|
513
510
|
: classes.split(/(\s+)/).filter(isNotBlankOrEmptyString)
|
|
514
511
|
}
|
|
515
512
|
function patchChildren(oldVdom, newVdom) {
|
|
516
|
-
const oldChildren =
|
|
517
|
-
const newChildren =
|
|
513
|
+
const oldChildren = extractChildren(oldVdom);
|
|
514
|
+
const newChildren = extractChildren(newVdom);
|
|
518
515
|
const parentEl = oldVdom.el;
|
|
519
516
|
const diffSeq = arraysDiffSequence(
|
|
520
517
|
oldChildren,
|
|
@@ -566,6 +563,7 @@ function createApp({ state, view, reducers = {} }) {
|
|
|
566
563
|
}
|
|
567
564
|
function renderApp() {
|
|
568
565
|
const newVdom = view(state, emit);
|
|
566
|
+
console.log(newVdom);
|
|
569
567
|
vdom = patchDOM(vdom, newVdom, parentEl);
|
|
570
568
|
}
|
|
571
569
|
return {
|