@viewfly/core 1.0.0-alpha.17 → 1.0.0-alpha.19
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/bundles/index.esm.js +23 -23
- package/bundles/index.js +23 -23
- package/package.json +2 -2
package/bundles/index.esm.js
CHANGED
|
@@ -1679,13 +1679,8 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1679
1679
|
const changes = getObjectChanges(newVNode.props, oldVNode.props);
|
|
1680
1680
|
let unBindRefs;
|
|
1681
1681
|
let bindRefs;
|
|
1682
|
-
newAtom.child = oldAtom.child;
|
|
1683
|
-
let updatedSubComponent = false;
|
|
1684
1682
|
for (const [key, value] of changes.remove) {
|
|
1685
1683
|
if (key === 'children') {
|
|
1686
|
-
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1687
|
-
newAtom.child = null;
|
|
1688
|
-
updatedSubComponent = true;
|
|
1689
1684
|
continue;
|
|
1690
1685
|
}
|
|
1691
1686
|
if (key === 'class') {
|
|
@@ -1712,18 +1707,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1712
1707
|
}
|
|
1713
1708
|
for (const [key, newValue, oldValue] of changes.replace) {
|
|
1714
1709
|
if (key === 'children') {
|
|
1715
|
-
newAtom.child = createChildChain(newValue, isSvg);
|
|
1716
|
-
if (!newAtom.child) {
|
|
1717
|
-
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1718
|
-
}
|
|
1719
|
-
else {
|
|
1720
|
-
diff(nativeRenderer, parentComponent, newAtom.child, oldAtom.child, {
|
|
1721
|
-
host: newAtom.nativeNode,
|
|
1722
|
-
isParent: true,
|
|
1723
|
-
rootHost: context.rootHost
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
updatedSubComponent = true;
|
|
1727
1710
|
continue;
|
|
1728
1711
|
}
|
|
1729
1712
|
if (key === 'class') {
|
|
@@ -1758,9 +1741,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1758
1741
|
}
|
|
1759
1742
|
for (const [key, value] of changes.add) {
|
|
1760
1743
|
if (key === 'children') {
|
|
1761
|
-
newAtom.child = createChildChain(value, isSvg);
|
|
1762
|
-
buildElementChildren(newAtom, nativeRenderer, parentComponent, context);
|
|
1763
|
-
updatedSubComponent = true;
|
|
1764
1744
|
continue;
|
|
1765
1745
|
}
|
|
1766
1746
|
if (key === 'class') {
|
|
@@ -1786,9 +1766,29 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1786
1766
|
}
|
|
1787
1767
|
nativeRenderer.setProperty(nativeNode, key, value, isSvg);
|
|
1788
1768
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1769
|
+
/**
|
|
1770
|
+
* 不能仅依赖 children 是否相等的判断来确定是否要继续向下 diff
|
|
1771
|
+
* 如:
|
|
1772
|
+
* ```tsx
|
|
1773
|
+
* <Comp>
|
|
1774
|
+
* <div>
|
|
1775
|
+
* {props.children}
|
|
1776
|
+
* </div>
|
|
1777
|
+
* </Comp>
|
|
1778
|
+
* ```
|
|
1779
|
+
* 其中当 Comp 产生变化时,children 来自父组件,这时 children 是相等的,
|
|
1780
|
+
* 但,children 内可能有子组件也发生了变化,如果不继续 diff,那么,子组件
|
|
1781
|
+
* 的视图更新将不会发生
|
|
1782
|
+
*/
|
|
1783
|
+
newAtom.child = createChildChain(newVNode.props.children, isSvg);
|
|
1784
|
+
if (!newAtom.child) {
|
|
1785
|
+
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1786
|
+
}
|
|
1787
|
+
else {
|
|
1788
|
+
diff(nativeRenderer, parentComponent, newAtom.child, oldAtom.child, {
|
|
1789
|
+
host: newAtom.nativeNode,
|
|
1790
|
+
isParent: true,
|
|
1791
|
+
rootHost: context.rootHost
|
|
1792
1792
|
});
|
|
1793
1793
|
}
|
|
1794
1794
|
applyRefs(unBindRefs, nativeNode, false);
|
package/bundles/index.js
CHANGED
|
@@ -1681,13 +1681,8 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1681
1681
|
const changes = getObjectChanges(newVNode.props, oldVNode.props);
|
|
1682
1682
|
let unBindRefs;
|
|
1683
1683
|
let bindRefs;
|
|
1684
|
-
newAtom.child = oldAtom.child;
|
|
1685
|
-
let updatedSubComponent = false;
|
|
1686
1684
|
for (const [key, value] of changes.remove) {
|
|
1687
1685
|
if (key === 'children') {
|
|
1688
|
-
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1689
|
-
newAtom.child = null;
|
|
1690
|
-
updatedSubComponent = true;
|
|
1691
1686
|
continue;
|
|
1692
1687
|
}
|
|
1693
1688
|
if (key === 'class') {
|
|
@@ -1714,18 +1709,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1714
1709
|
}
|
|
1715
1710
|
for (const [key, newValue, oldValue] of changes.replace) {
|
|
1716
1711
|
if (key === 'children') {
|
|
1717
|
-
newAtom.child = createChildChain(newValue, isSvg);
|
|
1718
|
-
if (!newAtom.child) {
|
|
1719
|
-
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1720
|
-
}
|
|
1721
|
-
else {
|
|
1722
|
-
diff(nativeRenderer, parentComponent, newAtom.child, oldAtom.child, {
|
|
1723
|
-
host: newAtom.nativeNode,
|
|
1724
|
-
isParent: true,
|
|
1725
|
-
rootHost: context.rootHost
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
updatedSubComponent = true;
|
|
1729
1712
|
continue;
|
|
1730
1713
|
}
|
|
1731
1714
|
if (key === 'class') {
|
|
@@ -1760,9 +1743,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1760
1743
|
}
|
|
1761
1744
|
for (const [key, value] of changes.add) {
|
|
1762
1745
|
if (key === 'children') {
|
|
1763
|
-
newAtom.child = createChildChain(value, isSvg);
|
|
1764
|
-
buildElementChildren(newAtom, nativeRenderer, parentComponent, context);
|
|
1765
|
-
updatedSubComponent = true;
|
|
1766
1746
|
continue;
|
|
1767
1747
|
}
|
|
1768
1748
|
if (key === 'class') {
|
|
@@ -1788,9 +1768,29 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1788
1768
|
}
|
|
1789
1769
|
nativeRenderer.setProperty(nativeNode, key, value, isSvg);
|
|
1790
1770
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1771
|
+
/**
|
|
1772
|
+
* 不能仅依赖 children 是否相等的判断来确定是否要继续向下 diff
|
|
1773
|
+
* 如:
|
|
1774
|
+
* ```tsx
|
|
1775
|
+
* <Comp>
|
|
1776
|
+
* <div>
|
|
1777
|
+
* {props.children}
|
|
1778
|
+
* </div>
|
|
1779
|
+
* </Comp>
|
|
1780
|
+
* ```
|
|
1781
|
+
* 其中当 Comp 产生变化时,children 来自父组件,这时 children 是相等的,
|
|
1782
|
+
* 但,children 内可能有子组件也发生了变化,如果不继续 diff,那么,子组件
|
|
1783
|
+
* 的视图更新将不会发生
|
|
1784
|
+
*/
|
|
1785
|
+
newAtom.child = createChildChain(newVNode.props.children, isSvg);
|
|
1786
|
+
if (!newAtom.child) {
|
|
1787
|
+
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
diff(nativeRenderer, parentComponent, newAtom.child, oldAtom.child, {
|
|
1791
|
+
host: newAtom.nativeNode,
|
|
1792
|
+
isParent: true,
|
|
1793
|
+
rootHost: context.rootHost
|
|
1794
1794
|
});
|
|
1795
1795
|
}
|
|
1796
1796
|
applyRefs(unBindRefs, nativeNode, false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.19",
|
|
4
4
|
"description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "447225f74fc666916194372ba5f710a94c297541",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
}
|