@viewfly/core 1.0.0-alpha.18 → 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.
@@ -1679,11 +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
1682
  for (const [key, value] of changes.remove) {
1684
1683
  if (key === 'children') {
1685
- cleanElementChildren(oldAtom, nativeRenderer);
1686
- newAtom.child = null;
1687
1684
  continue;
1688
1685
  }
1689
1686
  if (key === 'class') {
@@ -1710,17 +1707,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
1710
1707
  }
1711
1708
  for (const [key, newValue, oldValue] of changes.replace) {
1712
1709
  if (key === 'children') {
1713
- newAtom.child = createChildChain(newValue, isSvg);
1714
- if (!newAtom.child) {
1715
- cleanElementChildren(oldAtom, nativeRenderer);
1716
- }
1717
- else {
1718
- diff(nativeRenderer, parentComponent, newAtom.child, oldAtom.child, {
1719
- host: newAtom.nativeNode,
1720
- isParent: true,
1721
- rootHost: context.rootHost
1722
- });
1723
- }
1724
1710
  continue;
1725
1711
  }
1726
1712
  if (key === 'class') {
@@ -1755,8 +1741,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
1755
1741
  }
1756
1742
  for (const [key, value] of changes.add) {
1757
1743
  if (key === 'children') {
1758
- newAtom.child = createChildChain(value, isSvg);
1759
- buildElementChildren(newAtom, nativeRenderer, parentComponent, context);
1760
1744
  continue;
1761
1745
  }
1762
1746
  if (key === 'class') {
@@ -1782,6 +1766,31 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
1782
1766
  }
1783
1767
  nativeRenderer.setProperty(nativeNode, key, value, isSvg);
1784
1768
  }
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
+ });
1793
+ }
1785
1794
  applyRefs(unBindRefs, nativeNode, false);
1786
1795
  applyRefs(bindRefs, nativeNode, true);
1787
1796
  }
package/bundles/index.js CHANGED
@@ -1681,11 +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
1684
  for (const [key, value] of changes.remove) {
1686
1685
  if (key === 'children') {
1687
- cleanElementChildren(oldAtom, nativeRenderer);
1688
- newAtom.child = null;
1689
1686
  continue;
1690
1687
  }
1691
1688
  if (key === 'class') {
@@ -1712,17 +1709,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
1712
1709
  }
1713
1710
  for (const [key, newValue, oldValue] of changes.replace) {
1714
1711
  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
1712
  continue;
1727
1713
  }
1728
1714
  if (key === 'class') {
@@ -1757,8 +1743,6 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
1757
1743
  }
1758
1744
  for (const [key, value] of changes.add) {
1759
1745
  if (key === 'children') {
1760
- newAtom.child = createChildChain(value, isSvg);
1761
- buildElementChildren(newAtom, nativeRenderer, parentComponent, context);
1762
1746
  continue;
1763
1747
  }
1764
1748
  if (key === 'class') {
@@ -1784,6 +1768,31 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
1784
1768
  }
1785
1769
  nativeRenderer.setProperty(nativeNode, key, value, isSvg);
1786
1770
  }
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
+ });
1795
+ }
1787
1796
  applyRefs(unBindRefs, nativeNode, false);
1788
1797
  applyRefs(bindRefs, nativeNode, true);
1789
1798
  }
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rimraf@3.0.2/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rimraf@3.0.2/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules:$NODE_PATH"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
15
+ else
16
+ exec node "$basedir/../rimraf/bin.js" "$@"
17
+ fi
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/bin/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/bin/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/rollup@3.29.4/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules:$NODE_PATH"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../rollup/dist/bin/rollup" "$@"
15
+ else
16
+ exec node "$basedir/../rollup/dist/bin/rollup" "$@"
17
+ fi
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules:$NODE_PATH"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/tsc" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/tsc" "$@"
17
+ fi
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/typescript@5.4.5/node_modules:/Users/tanbo/Documents/lib/viewfly/node_modules/.pnpm/node_modules:$NODE_PATH"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/tsserver" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/bin/tsserver" "$@"
17
+ fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewfly/core",
3
- "version": "1.0.0-alpha.18",
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": "b66ca589f7662cd518fc2e5955b3e3ff9de83f94",
53
+ "gitHead": "447225f74fc666916194372ba5f710a94c297541",
54
54
  "dependencies": {
55
55
  "reflect-metadata": "^0.2.2"
56
56
  }