@viewfly/core 1.2.0 → 1.2.1
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.d.ts +4 -1
- package/bundles/index.esm.js +9 -3
- package/bundles/index.js +9 -3
- package/package.json +2 -2
package/bundles/index.d.ts
CHANGED
|
@@ -491,7 +491,10 @@ declare function Context(props: ContextProps): () => ViewFlyNode<string | Compon
|
|
|
491
491
|
|
|
492
492
|
declare function withMemo<T extends Props = Props>(canUseMemo: ComponentInstance<T>['$useMemo'], render: () => JSXNode): ComponentInstance<T>;
|
|
493
493
|
|
|
494
|
-
declare const ElementNamespaceMap:
|
|
494
|
+
declare const ElementNamespaceMap: {
|
|
495
|
+
readonly svg: "svg";
|
|
496
|
+
readonly math: "mathml";
|
|
497
|
+
};
|
|
495
498
|
declare function createRenderer(component: Component, nativeRenderer: NativeRenderer, namespace: ElementNamespace): (host: NativeNode) => void;
|
|
496
499
|
|
|
497
500
|
/**
|
package/bundles/index.esm.js
CHANGED
|
@@ -1693,6 +1693,12 @@ function insertNode(nativeRenderer, atom, context) {
|
|
|
1693
1693
|
nativeRenderer.insertAfter(atom.nativeNode, context.host, atom.namespace);
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
1696
|
+
function createElementChildren(type, children, namespace) {
|
|
1697
|
+
if (type === 'foreignObject' && namespace === ElementNamespaceMap.svg) {
|
|
1698
|
+
return createChildChain(children, void 0);
|
|
1699
|
+
}
|
|
1700
|
+
return createChildChain(children, namespace);
|
|
1701
|
+
}
|
|
1696
1702
|
function createElement(nativeRenderer, atom, parentComponent, context) {
|
|
1697
1703
|
const { namespace, jsxNode } = atom;
|
|
1698
1704
|
const nativeNode = nativeRenderer.createElement(jsxNode.type, namespace);
|
|
@@ -1700,7 +1706,7 @@ function createElement(nativeRenderer, atom, parentComponent, context) {
|
|
|
1700
1706
|
let bindingRefs;
|
|
1701
1707
|
for (const key in props) {
|
|
1702
1708
|
if (key === 'children') {
|
|
1703
|
-
atom.child =
|
|
1709
|
+
atom.child = createElementChildren(jsxNode.type, props.children, namespace);
|
|
1704
1710
|
continue;
|
|
1705
1711
|
}
|
|
1706
1712
|
if (key === 'class') {
|
|
@@ -1797,7 +1803,7 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1797
1803
|
const [key, newValue, oldValue] = changes.replace[i];
|
|
1798
1804
|
if (key === 'children') {
|
|
1799
1805
|
updatedChildren = true;
|
|
1800
|
-
newAtom.child =
|
|
1806
|
+
newAtom.child = createElementChildren(newVNode.type, newValue, isSvg);
|
|
1801
1807
|
if (!newAtom.child) {
|
|
1802
1808
|
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1803
1809
|
}
|
|
@@ -1844,7 +1850,7 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1844
1850
|
const [key, value] = changes.add[i];
|
|
1845
1851
|
if (key === 'children') {
|
|
1846
1852
|
updatedChildren = true;
|
|
1847
|
-
newAtom.child =
|
|
1853
|
+
newAtom.child = createElementChildren(newVNode.type, value, isSvg);
|
|
1848
1854
|
buildElementChildren(newAtom, nativeRenderer, parentComponent, context);
|
|
1849
1855
|
continue;
|
|
1850
1856
|
}
|
package/bundles/index.js
CHANGED
|
@@ -1695,6 +1695,12 @@ function insertNode(nativeRenderer, atom, context) {
|
|
|
1695
1695
|
nativeRenderer.insertAfter(atom.nativeNode, context.host, atom.namespace);
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
|
+
function createElementChildren(type, children, namespace) {
|
|
1699
|
+
if (type === 'foreignObject' && namespace === ElementNamespaceMap.svg) {
|
|
1700
|
+
return createChildChain(children, void 0);
|
|
1701
|
+
}
|
|
1702
|
+
return createChildChain(children, namespace);
|
|
1703
|
+
}
|
|
1698
1704
|
function createElement(nativeRenderer, atom, parentComponent, context) {
|
|
1699
1705
|
const { namespace, jsxNode } = atom;
|
|
1700
1706
|
const nativeNode = nativeRenderer.createElement(jsxNode.type, namespace);
|
|
@@ -1702,7 +1708,7 @@ function createElement(nativeRenderer, atom, parentComponent, context) {
|
|
|
1702
1708
|
let bindingRefs;
|
|
1703
1709
|
for (const key in props) {
|
|
1704
1710
|
if (key === 'children') {
|
|
1705
|
-
atom.child =
|
|
1711
|
+
atom.child = createElementChildren(jsxNode.type, props.children, namespace);
|
|
1706
1712
|
continue;
|
|
1707
1713
|
}
|
|
1708
1714
|
if (key === 'class') {
|
|
@@ -1799,7 +1805,7 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1799
1805
|
const [key, newValue, oldValue] = changes.replace[i];
|
|
1800
1806
|
if (key === 'children') {
|
|
1801
1807
|
updatedChildren = true;
|
|
1802
|
-
newAtom.child =
|
|
1808
|
+
newAtom.child = createElementChildren(newVNode.type, newValue, isSvg);
|
|
1803
1809
|
if (!newAtom.child) {
|
|
1804
1810
|
cleanElementChildren(oldAtom, nativeRenderer);
|
|
1805
1811
|
}
|
|
@@ -1846,7 +1852,7 @@ function updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComp
|
|
|
1846
1852
|
const [key, value] = changes.add[i];
|
|
1847
1853
|
if (key === 'children') {
|
|
1848
1854
|
updatedChildren = true;
|
|
1849
|
-
newAtom.child =
|
|
1855
|
+
newAtom.child = createElementChildren(newVNode.type, value, isSvg);
|
|
1850
1856
|
buildElementChildren(newAtom, nativeRenderer, parentComponent, context);
|
|
1851
1857
|
continue;
|
|
1852
1858
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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": "8b79b4e067238c81c61d62581b9f6d2c64f60677",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
}
|