Comparing version 2.0.0-8 to 2.0.0-9
@@ -14,23 +14,2 @@ "use strict"; | ||
const applyProps = (node, props) => { | ||
for (const [key, value] of Object.entries(props)) { | ||
if (key === 'children') { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
// Text node must be wrapped in another node, so that text can be aligned within container | ||
const textElement = (0, _dom.createNode)('span'); | ||
textElement.textContent = value; | ||
(0, _dom.appendChildNode)(node, textElement); | ||
} | ||
} else if (key === 'style') { | ||
Object.assign(node.style, value); | ||
} else if (key === 'unstable__transformChildren') { | ||
node.unstable__transformChildren = value; // eslint-disable-line camelcase | ||
} else if (key === 'static') { | ||
node.static = true; | ||
} else { | ||
(0, _dom.setAttribute)(node, key, value); | ||
} | ||
} | ||
}; | ||
var _default = onRender => { | ||
@@ -50,3 +29,22 @@ const rootHostContext = {}; | ||
const node = (0, _dom.createNode)(type); | ||
applyProps(node, newProps); | ||
for (const [key, value] of Object.entries(newProps)) { | ||
if (key === 'children') { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
// Text node must be wrapped in another node, so that text can be aligned within container | ||
const textElement = (0, _dom.createNode)('span'); | ||
textElement.textContent = value; | ||
(0, _dom.appendChildNode)(node, textElement); | ||
} | ||
} else if (key === 'style') { | ||
Object.assign(node.style, value); | ||
} else if (key === 'unstable__transformChildren') { | ||
node.unstable__transformChildren = value; // eslint-disable-line camelcase | ||
} else if (key === 'static') { | ||
node.static = true; | ||
} else { | ||
(0, _dom.setAttribute)(node, key, value); | ||
} | ||
} | ||
return node; | ||
@@ -83,3 +81,18 @@ }, | ||
commitUpdate: (node, updatePayload, type, oldProps, newProps) => { | ||
applyProps(node, newProps); | ||
for (const [key, value] of Object.entries(newProps)) { | ||
if (key === 'children') { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
node.childNodes[0].textContent = value; | ||
} | ||
} else if (key === 'style') { | ||
Object.assign(node.style, value); | ||
} else if (key === 'unstable__transformChildren') { | ||
node.unstable__transformChildren = value; // eslint-disable-line camelcase | ||
} else if (key === 'static') { | ||
node.static = true; | ||
} else { | ||
(0, _dom.setAttribute)(node, key, value); | ||
} | ||
} | ||
onRender(); | ||
@@ -86,0 +99,0 @@ }, |
{ | ||
"name": "ink", | ||
"version": "2.0.0-8", | ||
"version": "2.0.0-9", | ||
"description": "React for CLI", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57292
1020