abstract-image
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -70,3 +70,3 @@ "use strict"; | ||
// tslint:disable-next-line:no-any | ||
(c, i) => _visit(i.toString(), c), component.children))) | ||
(c, i) => _visit(i.toString(), c), component.children))), | ||
]; | ||
@@ -78,4 +78,4 @@ case "binaryimage": | ||
React.createElement("g", { key: key, id: makeIdAttr(component.id), dangerouslySetInnerHTML: { | ||
__html: component.data.reduce((a, b) => a + String.fromCharCode(b), "") | ||
} }) | ||
__html: component.data.reduce((a, b) => a + String.fromCharCode(b), ""), | ||
} }), | ||
]; | ||
@@ -87,3 +87,3 @@ default: | ||
return [ | ||
React.createElement("line", { id: makeIdAttr(component.id), key: key, x1: component.start.x, y1: component.start.y, x2: component.end.x, y2: component.end.y, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor) }) | ||
React.createElement("line", { id: makeIdAttr(component.id), key: key, x1: component.start.x, y1: component.start.y, x2: component.end.x, y2: component.end.y, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor) }), | ||
]; | ||
@@ -101,3 +101,3 @@ case "text": | ||
stroke: colorToRgb(component.strokeColor), | ||
strokeWidth: component.strokeThickness | ||
strokeWidth: component.strokeThickness, | ||
}; | ||
@@ -109,3 +109,3 @@ const style = { | ||
fontFamily: component.fontFamily, | ||
fill: colorToRgb(component.textColor) | ||
fill: colorToRgb(component.textColor), | ||
}; | ||
@@ -121,3 +121,3 @@ const dy = getBaselineAdjustment(component.verticalGrowthDirection); | ||
const lines = component.text !== null ? component.text.split("\n") : []; | ||
const tSpans = lines.map(t => renderLine(t, component.position.x, component.position.y + (lines.indexOf(t) + dy) * lineHeight, component.fontSize, lineHeight)); | ||
const tSpans = lines.map((t) => renderLine(t, component.position.x, component.position.y + (lines.indexOf(t) + dy) * lineHeight, component.fontSize, lineHeight)); | ||
let cs = []; | ||
@@ -135,21 +135,17 @@ if (component.strokeThickness > 0 && component.strokeColor) { | ||
return [ | ||
React.createElement("ellipse", { id: makeIdAttr(component.id), key: key, cx: cx, cy: cy, rx: rx, ry: ry, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) }) | ||
React.createElement("ellipse", { id: makeIdAttr(component.id), key: key, cx: cx, cy: cy, rx: rx, ry: ry, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) }), | ||
]; | ||
case "polyline": | ||
let linePoints = component.points | ||
.map(p => p.x.toString() + "," + p.y.toString()) | ||
.join(" "); | ||
let linePoints = component.points.map((p) => p.x.toString() + "," + p.y.toString()).join(" "); | ||
return [ | ||
React.createElement("polyline", { id: makeIdAttr(component.id), key: key, points: linePoints, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fill: "none" }) | ||
React.createElement("polyline", { id: makeIdAttr(component.id), key: key, points: linePoints, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fill: "none" }), | ||
]; | ||
case "polygon": | ||
let points = component.points | ||
.map(p => p.x.toString() + "," + p.y.toString()) | ||
.join(" "); | ||
let points = component.points.map((p) => p.x.toString() + "," + p.y.toString()).join(" "); | ||
return [ | ||
React.createElement("polygon", { id: makeIdAttr(component.id), key: key, points: points, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) }) | ||
React.createElement("polygon", { id: makeIdAttr(component.id), key: key, points: points, stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) }), | ||
]; | ||
case "rectangle": | ||
return [ | ||
React.createElement("rect", { id: makeIdAttr(component.id), key: key, x: component.topLeft.x, y: component.topLeft.y, width: Math.abs(component.bottomRight.x - component.topLeft.x), height: Math.abs(component.bottomRight.y - component.topLeft.y), stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) }) | ||
React.createElement("rect", { id: makeIdAttr(component.id), key: key, x: component.topLeft.x, y: component.topLeft.y, width: Math.abs(component.bottomRight.x - component.topLeft.x), height: Math.abs(component.bottomRight.y - component.topLeft.y), stroke: colorToRgb(component.strokeColor), strokeWidth: component.strokeThickness, strokeOpacity: colorToOpacity(component.strokeColor), fillOpacity: colorToOpacity(component.fillColor), fill: colorToRgb(component.fillColor) }), | ||
]; | ||
@@ -161,3 +157,3 @@ default: | ||
function renderLine(text, x, y, fontSize, lineHeight) { | ||
const split = R.unnest(text.split("<sub>").map(t => t.split("</sub>"))); | ||
const split = R.unnest(text.split("<sub>").map((t) => t.split("</sub>"))); | ||
let inside = false; | ||
@@ -202,9 +198,3 @@ const tags = []; | ||
function colorToRgb(color) { | ||
return ("rgb(" + | ||
color.r.toString() + | ||
"," + | ||
color.g.toString() + | ||
"," + | ||
color.b.toString() + | ||
")"); | ||
return "rgb(" + color.r.toString() + "," + color.g.toString() + "," + color.b.toString() + ")"; | ||
} | ||
@@ -211,0 +201,0 @@ function colorToOpacity(color) { |
{ | ||
"name": "abstract-image", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Dynamically create images using code or JSX and render to any format", | ||
@@ -22,6 +22,6 @@ "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-image", | ||
"devDependencies": { | ||
"@types/react": "^15.0.34", | ||
"@types/react-dom": "^15.5.1" | ||
"@types/react": "^16.9.0", | ||
"@types/react-dom": "^16.9.0" | ||
}, | ||
"gitHead": "eb933700e3c4dcfc42c17ecac358f6d9007605cd" | ||
"gitHead": "71b7c32a8054abdd0a30c5662067b6e1dd41dbac" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
161376
85
2808
0