vega-scenegraph
Advanced tools
Comparing version 4.9.2 to 4.9.3
{ | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Vega scenegraph", | ||
@@ -7,40 +7,40 @@ "description": "Vega scenegraph model.", | ||
{ | ||
"$ref": "#/refs/mark" | ||
"$ref": "#/definitions/mark" | ||
} | ||
], | ||
"refs": { | ||
"definitions": { | ||
"mark": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/refs/mark-group" | ||
"$ref": "#/definitions/mark-group" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-arc" | ||
"$ref": "#/definitions/mark-arc" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-area" | ||
"$ref": "#/definitions/mark-area" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-image" | ||
"$ref": "#/definitions/mark-image" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-line" | ||
"$ref": "#/definitions/mark-line" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-path" | ||
"$ref": "#/definitions/mark-path" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-rect" | ||
"$ref": "#/definitions/mark-rect" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-rule" | ||
"$ref": "#/definitions/mark-rule" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-symbol" | ||
"$ref": "#/definitions/mark-symbol" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-text" | ||
"$ref": "#/definitions/mark-text" | ||
}, | ||
{ | ||
"$ref": "#/refs/mark-trail" | ||
"$ref": "#/definitions/mark-trail" | ||
} | ||
@@ -56,9 +56,9 @@ ] | ||
{ | ||
"$ref": "#/refs/color" | ||
"$ref": "#/definitions/color" | ||
}, | ||
{ | ||
"$ref": "#/refs/linearGradient" | ||
"$ref": "#/definitions/linearGradient" | ||
}, | ||
{ | ||
"$ref": "#/refs/radialGradient" | ||
"$ref": "#/definitions/radialGradient" | ||
} | ||
@@ -98,3 +98,3 @@ ] | ||
"color": { | ||
"$ref": "#/refs/color" | ||
"$ref": "#/definitions/color" | ||
} | ||
@@ -133,3 +133,3 @@ }, | ||
"items": { | ||
"$ref": "#/refs/gradientStop" | ||
"$ref": "#/definitions/gradientStop" | ||
} | ||
@@ -176,3 +176,3 @@ } | ||
"items": { | ||
"$ref": "#/refs/gradientStop" | ||
"$ref": "#/definitions/gradientStop" | ||
} | ||
@@ -214,3 +214,3 @@ } | ||
"items": { | ||
"$ref": "#/refs/item-group" | ||
"$ref": "#/definitions/item-group" | ||
} | ||
@@ -268,3 +268,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -276,3 +276,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -360,3 +360,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/mark" | ||
"$ref": "#/definitions/mark" | ||
} | ||
@@ -400,3 +400,3 @@ }, | ||
"items": { | ||
"$ref": "#/refs/item-arc" | ||
"$ref": "#/definitions/item-arc" | ||
} | ||
@@ -454,3 +454,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -462,3 +462,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -573,3 +573,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-area" | ||
"$ref": "#/definitions/item-area" | ||
} | ||
@@ -627,3 +627,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -635,3 +635,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -753,3 +753,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-image" | ||
"$ref": "#/definitions/item-image" | ||
} | ||
@@ -807,3 +807,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -815,3 +815,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -936,3 +936,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-line" | ||
"$ref": "#/definitions/item-line" | ||
} | ||
@@ -990,3 +990,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -998,3 +998,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1127,3 +1127,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-path" | ||
"$ref": "#/definitions/item-path" | ||
} | ||
@@ -1181,3 +1181,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1189,3 +1189,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1256,3 +1256,3 @@ "strokeOpacity": { | ||
"path": { | ||
"$ref": "#/refs/path" | ||
"$ref": "#/definitions/path" | ||
}, | ||
@@ -1295,3 +1295,3 @@ "scaleX": { | ||
"items": { | ||
"$ref": "#/refs/item-rect" | ||
"$ref": "#/definitions/item-rect" | ||
} | ||
@@ -1349,3 +1349,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1357,3 +1357,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1465,3 +1465,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-rule" | ||
"$ref": "#/definitions/item-rule" | ||
} | ||
@@ -1519,3 +1519,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1527,3 +1527,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1626,3 +1626,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-symbol" | ||
"$ref": "#/definitions/item-symbol" | ||
} | ||
@@ -1680,3 +1680,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1688,3 +1688,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1792,3 +1792,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-text" | ||
"$ref": "#/definitions/item-text" | ||
} | ||
@@ -1846,3 +1846,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -1854,3 +1854,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -2054,3 +2054,3 @@ "strokeOpacity": { | ||
"items": { | ||
"$ref": "#/refs/item-trail" | ||
"$ref": "#/definitions/item-trail" | ||
} | ||
@@ -2108,3 +2108,3 @@ }, | ||
"fill": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -2116,3 +2116,3 @@ "fillOpacity": { | ||
"stroke": { | ||
"$ref": "#/refs/paint" | ||
"$ref": "#/definitions/paint" | ||
}, | ||
@@ -2119,0 +2119,0 @@ "strokeOpacity": { |
{ | ||
"name": "vega-scenegraph", | ||
"version": "4.9.2", | ||
"version": "4.9.3", | ||
"description": "Vega scenegraph and renderers.", | ||
@@ -29,3 +29,3 @@ "license": "BSD-3-Clause", | ||
}, | ||
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0" | ||
"gitHead": "b88cd747158cb91dbbe0c55141604eb6e4fedae4" | ||
} |
@@ -16,3 +16,3 @@ function duplicate(_) { | ||
for (const type in MARKS) { | ||
buildMark(type, schema.refs, strict); | ||
buildMark(type, schema.definitions, strict); | ||
} | ||
@@ -22,3 +22,3 @@ return schema; | ||
function buildMark(type, refs, strict) { | ||
function buildMark(type, defs, strict) { | ||
const mark = duplicate(MARK_BASE); | ||
@@ -33,5 +33,5 @@ mark.properties.marktype.enum = [ type ]; | ||
refs.mark.oneOf.push({$ref: '#/refs/mark-' + type}); | ||
refs['mark-'+type] = mark; | ||
refs['item-'+type] = item; | ||
defs.mark.oneOf.push({$ref: '#/definitions/mark-' + type}); | ||
defs['mark-'+type] = mark; | ||
defs['item-'+type] = item; | ||
} | ||
@@ -76,7 +76,7 @@ | ||
const BASE = { | ||
'$schema': 'http://json-schema.org/draft-06/schema#', | ||
'$schema': 'http://json-schema.org/draft-07/schema#', | ||
'title': 'Vega scenegraph', | ||
'description': 'Vega scenegraph model.', | ||
'oneOf': [ { '$ref': '#/refs/mark' } ], | ||
'refs': { | ||
'oneOf': [ { '$ref': '#/definitions/mark' } ], | ||
'definitions': { | ||
'mark': { 'oneOf': [] }, | ||
@@ -89,5 +89,5 @@ 'path': { | ||
'oneOf': [ | ||
{ '$ref': '#/refs/color' }, | ||
{ '$ref': '#/refs/linearGradient' }, | ||
{ '$ref': '#/refs/radialGradient' } | ||
{ '$ref': '#/definitions/color' }, | ||
{ '$ref': '#/definitions/linearGradient' }, | ||
{ '$ref': '#/definitions/radialGradient' } | ||
] | ||
@@ -123,3 +123,3 @@ }, | ||
'offset': { 'type': 'number' }, | ||
'color': { '$ref': '#/refs/color' } | ||
'color': { '$ref': '#/definitions/color' } | ||
}, | ||
@@ -139,3 +139,3 @@ 'required': ['offset', 'color'] | ||
'type': 'array', | ||
'items': { '$ref': '#/refs/gradientStop' } | ||
'items': { '$ref': '#/definitions/gradientStop' } | ||
} | ||
@@ -159,3 +159,3 @@ }, | ||
'type': 'array', | ||
'items': { '$ref': '#/refs/gradientStop' } | ||
'items': { '$ref': '#/definitions/gradientStop' } | ||
} | ||
@@ -180,3 +180,3 @@ }, | ||
'type': 'array', | ||
'items': { '$ref': '#/refs/item-' } | ||
'items': { '$ref': '#/definitions/item-' } | ||
}, | ||
@@ -216,5 +216,5 @@ 'zindex': { 'type': 'number' } | ||
'opacity': { 'type': 'number', 'default': 1 }, | ||
'fill': { '$ref': '#/refs/paint' }, | ||
'fill': { '$ref': '#/definitions/paint' }, | ||
'fillOpacity': { 'type': 'number', 'default': 1 }, | ||
'stroke': { '$ref': '#/refs/paint' }, | ||
'stroke': { '$ref': '#/definitions/paint' }, | ||
'strokeOpacity': { 'type': 'number', 'default': 1 }, | ||
@@ -304,3 +304,3 @@ 'strokeWidth': { 'type': 'number', 'default': 1 }, | ||
'cornerRadiusBottomLeft': { 'type': 'number' }, | ||
'items': { 'type': 'array', 'items': { '$ref': '#/refs/mark' } }, | ||
'items': { 'type': 'array', 'items': { '$ref': '#/definitions/mark' } }, | ||
'strokeForeground': { 'type': 'boolean' }, | ||
@@ -355,3 +355,3 @@ 'strokeOffset': { 'type': 'number' } | ||
'angle': { 'type': 'number' }, | ||
'path': { '$ref': '#/refs/path' }, | ||
'path': { '$ref': '#/definitions/path' }, | ||
'scaleX': { 'type': 'number' }, | ||
@@ -358,0 +358,0 @@ 'scaleY': { 'type': 'number' } |
@@ -15,3 +15,4 @@ import Renderer from './Renderer'; | ||
const RootIndex = 0, | ||
ns = metadata.xmlns; | ||
xmlns = 'http://www.w3.org/2000/xmlns/', | ||
svgns = metadata.xmlns; | ||
@@ -47,4 +48,6 @@ export default function SVGRenderer(loader) { | ||
if (el) { | ||
this._svg = domChild(el, 0, 'svg', ns); | ||
setAttributes(this._svg, metadata); | ||
this._svg = domChild(el, 0, 'svg', svgns); | ||
this._svg.setAttributeNS(xmlns, 'xmlns', svgns); | ||
this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']); | ||
this._svg.setAttribute('version', metadata['version']); | ||
this._svg.setAttribute('class', 'marks'); | ||
@@ -54,3 +57,3 @@ domClear(el, 1); | ||
// set the svg root group | ||
this._root = domChild(this._svg, RootIndex, 'g', ns); | ||
this._root = domChild(this._svg, RootIndex, 'g', svgns); | ||
setAttributes(this._root, rootAttributes); | ||
@@ -126,3 +129,3 @@ | ||
svg.removeAttribute('style'); | ||
node = domChild(svg, RootIndex, 'rect', ns); | ||
node = domChild(svg, RootIndex, 'rect', svgns); | ||
setAttributes(node, {width: this._width, height: this._height, fill: bg}); | ||
@@ -364,3 +367,3 @@ } | ||
for (const id in defs.gradient) { | ||
if (!el) defs.el = (el = domChild(svg, RootIndex + 1, 'defs', ns)); | ||
if (!el) defs.el = (el = domChild(svg, RootIndex + 1, 'defs', svgns)); | ||
index = updateGradient(el, defs.gradient[id], index); | ||
@@ -370,3 +373,3 @@ } | ||
for (const id in defs.clipping) { | ||
if (!el) defs.el = (el = domChild(svg, RootIndex + 1, 'defs', ns)); | ||
if (!el) defs.el = (el = domChild(svg, RootIndex + 1, 'defs', svgns)); | ||
index = updateClipping(el, defs.clipping[id], index); | ||
@@ -412,3 +415,3 @@ } | ||
// maintain a circular gradient that matches what canvas provides. | ||
let pt = domChild(el, index++, 'pattern', ns); | ||
let pt = domChild(el, index++, 'pattern', svgns); | ||
setAttributes(pt, { | ||
@@ -422,3 +425,3 @@ id: patternPrefix + grad.id, | ||
pt = domChild(pt, 0, 'rect', ns); | ||
pt = domChild(pt, 0, 'rect', svgns); | ||
setAttributes(pt, { | ||
@@ -430,3 +433,3 @@ width: 1, | ||
el = domChild(el, index++, 'radialGradient', ns); | ||
el = domChild(el, index++, 'radialGradient', svgns); | ||
setAttributes(el, { | ||
@@ -442,3 +445,3 @@ id: grad.id, | ||
} else { | ||
el = domChild(el, index++, 'linearGradient', ns); | ||
el = domChild(el, index++, 'linearGradient', svgns); | ||
setAttributes(el, { | ||
@@ -454,3 +457,3 @@ id: grad.id, | ||
for (i=0, n=grad.stops.length; i<n; ++i) { | ||
stop = domChild(el, i, 'stop', ns); | ||
stop = domChild(el, i, 'stop', svgns); | ||
stop.setAttribute('offset', grad.stops[i].offset); | ||
@@ -468,10 +471,10 @@ stop.setAttribute('stop-color', grad.stops[i].color); | ||
el = domChild(el, index, 'clipPath', ns); | ||
el = domChild(el, index, 'clipPath', svgns); | ||
el.setAttribute('id', clip.id); | ||
if (clip.path) { | ||
mask = domChild(el, 0, 'path', ns); | ||
mask = domChild(el, 0, 'path', svgns); | ||
mask.setAttribute('d', clip.path); | ||
} else { | ||
mask = domChild(el, 0, 'rect', ns); | ||
mask = domChild(el, 0, 'rect', svgns); | ||
setAttributes(mask, {x: 0, y: 0, width: clip.width, height: clip.height}); | ||
@@ -506,3 +509,3 @@ } | ||
doc = el.ownerDocument; | ||
node = domCreate(doc, tag, ns); | ||
node = domCreate(doc, tag, svgns); | ||
item._svg = node; | ||
@@ -516,11 +519,11 @@ | ||
if (tag === 'g') { | ||
const bg = domCreate(doc, 'path', ns); | ||
const bg = domCreate(doc, 'path', svgns); | ||
node.appendChild(bg); | ||
bg.__data__ = item; | ||
const cg = domCreate(doc, 'g', ns); | ||
const cg = domCreate(doc, 'g', svgns); | ||
node.appendChild(cg); | ||
cg.__data__ = item; | ||
const fg = domCreate(doc, 'path', ns); | ||
const fg = domCreate(doc, 'path', svgns); | ||
node.appendChild(fg); | ||
@@ -617,3 +620,3 @@ fg.__data__ = item; | ||
value.forEach((t, i) => { | ||
const ts = domCreate(doc, 'tspan', ns); | ||
const ts = domCreate(doc, 'tspan', svgns); | ||
ts.__data__ = item; // data binding | ||
@@ -620,0 +623,0 @@ ts.textContent = t; |
@@ -21,3 +21,3 @@ import {context} from './canvas/context'; | ||
// make dumb, simple estimate if no canvas is available | ||
// make simple estimate if no canvas is available | ||
function estimateWidth(item, text) { | ||
@@ -24,0 +24,0 @@ return _estimateWidth(textValue(item, text), fontSize(item)); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
914772
16645
2