Socket
Socket
Sign inDemoInstall

vega-scenegraph

Package Overview
Dependencies
Maintainers
2
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-scenegraph - npm Package Compare versions

Comparing version 4.9.1 to 4.9.2

build/vega-scenegraph.min.js.map

27

package.json
{
"name": "vega-scenegraph",
"version": "4.9.1",
"version": "4.9.2",
"description": "Vega scenegraph and renderers.",

@@ -8,15 +8,14 @@ "license": "BSD-3-Clause",

"main": "build/vega-scenegraph.js",
"module": "index",
"module": "build/vega-scenegraph.module.js",
"unpkg": "build/vega-scenegraph.min.js",
"repository": "vega/vega",
"scripts": {
"rollup": "rollup -f umd -g d3-path:d3,d3-shape:d3,vega-canvas:vega,vega-loader:vega,vega-scale:vega,vega-util:vega -n vega -o build/vega-scenegraph.js -- index.js",
"schema": "node schema > build/vega-scenegraph-schema.json",
"prebuild": "rimraf build && mkdir build",
"build": "yarn rollup && yarn schema",
"postbuild": "terser build/vega-scenegraph.js -c -m -o build/vega-scenegraph.min.js",
"pretest": "yarn prebuild && yarn rollup && yarn schema",
"prebuild": "rimraf build",
"build": "rollup -c",
"postbuild": "yarn schema",
"pretest": "yarn build --config-test",
"test": "tape -r ./test/__init__ 'test/**/*-test.js' && yarn xmllint",
"xmllint": "xmllint --noout ./test/resources/svg/*.svg",
"prepublishOnly": "yarn test && yarn build",
"postpublish": "git push && git push --tags"
"prepublishOnly": "yarn test && yarn build"
},

@@ -26,8 +25,8 @@ "dependencies": {

"d3-shape": "^2.0.0",
"vega-canvas": "^1.2.4",
"vega-loader": "^4.3.2",
"vega-scale": "^7.1.0",
"vega-util": "^1.15.1"
"vega-canvas": "^1.2.5",
"vega-loader": "^4.3.3",
"vega-scale": "^7.1.1",
"vega-util": "^1.15.2"
},
"gitHead": "8d6793f4ca7eaaf2d22186764e9ce2dae687cf52"
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0"
}

@@ -1,2 +0,2 @@

var gradient_id = 0;
let gradient_id = 0;

@@ -3,0 +3,0 @@ export function resetSVGGradientId() {

@@ -118,5 +118,5 @@ import {domCreate} from './util/dom';

if (type) {
a.push.apply(a, h[this.eventName(type)]);
a.push(...h[this.eventName(type)]);
} else {
for (const k in h) { a.push.apply(a, h[k]); }
for (const k in h) { a.push(...h[k]); }
}

@@ -123,0 +123,0 @@ return a;

@@ -29,3 +29,3 @@ import boundStroke from '../bound/boundStroke';

var hit = hitPath(draw);
const hit = hitPath(draw);

@@ -32,0 +32,0 @@ function pick(context, scene, x, y, gx, gy) {

@@ -13,3 +13,3 @@ import Bounds from '../Bounds';

var textAlign = {
const textAlign = {
'left': 'start',

@@ -20,3 +20,3 @@ 'center': 'middle',

var tempBounds = new Bounds();
const tempBounds = new Bounds();

@@ -170,3 +170,3 @@ function anchorPoint(item) {

function intersectText(item, box) {
var p = bound(tempBounds, item, 2);
const p = bound(tempBounds, item, 2);
return intersectBoxLine(box, p[0], p[1], p[2], p[3])

@@ -173,0 +173,0 @@ || intersectBoxLine(box, p[0], p[1], p[4], p[5])

@@ -7,8 +7,8 @@ import CanvasHandler from './CanvasHandler';

var Canvas = 'canvas';
var PNG = 'png';
var SVG = 'svg';
var None = 'none';
const Canvas = 'canvas';
const PNG = 'png';
const SVG = 'svg';
const None = 'none';
export var RenderType = {
export const RenderType = {
Canvas: Canvas,

@@ -20,3 +20,3 @@ PNG: PNG,

var modules = {};
const modules = {};

@@ -23,0 +23,0 @@ modules[Canvas] = modules[PNG] = {

@@ -10,3 +10,3 @@ import {DegToRad, HalfPi, Tau} from '../util/constants';

export function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
var key = join.call(arguments);
const key = join.call(arguments);
if (segmentCache[key]) {

@@ -16,10 +16,10 @@ return segmentCache[key];

var th = rotateX * DegToRad;
var sin_th = Math.sin(th);
var cos_th = Math.cos(th);
const th = rotateX * DegToRad;
const sin_th = Math.sin(th);
const cos_th = Math.cos(th);
rx = Math.abs(rx);
ry = Math.abs(ry);
var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
var pl = (px*px) / (rx*rx) + (py*py) / (ry*ry);
const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
let pl = (px*px) / (rx*rx) + (py*py) / (ry*ry);
if (pl > 1) {

@@ -31,23 +31,23 @@ pl = Math.sqrt(pl);

var a00 = cos_th / rx;
var a01 = sin_th / rx;
var a10 = (-sin_th) / ry;
var a11 = (cos_th) / ry;
var x0 = a00 * ox + a01 * oy;
var y0 = a10 * ox + a11 * oy;
var x1 = a00 * x + a01 * y;
var y1 = a10 * x + a11 * y;
const a00 = cos_th / rx;
const a01 = sin_th / rx;
const a10 = (-sin_th) / ry;
const a11 = (cos_th) / ry;
const x0 = a00 * ox + a01 * oy;
const y0 = a10 * ox + a11 * oy;
const x1 = a00 * x + a01 * y;
const y1 = a10 * x + a11 * y;
var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0);
var sfactor_sq = 1 / d - 0.25;
const d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0);
let sfactor_sq = 1 / d - 0.25;
if (sfactor_sq < 0) sfactor_sq = 0;
var sfactor = Math.sqrt(sfactor_sq);
let sfactor = Math.sqrt(sfactor_sq);
if (sweep == large) sfactor = -sfactor;
var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0);
var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0);
const xc = 0.5 * (x0 + x1) - sfactor * (y1-y0);
const yc = 0.5 * (y0 + y1) + sfactor * (x1-x0);
var th0 = Math.atan2(y0-yc, x0-xc);
var th1 = Math.atan2(y1-yc, x1-xc);
const th0 = Math.atan2(y0-yc, x0-xc);
const th1 = Math.atan2(y1-yc, x1-xc);
var th_arc = th1-th0;
let th_arc = th1-th0;
if (th_arc < 0 && sweep === 1) {

@@ -59,7 +59,7 @@ th_arc += Tau;

var segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001)));
var result = [];
for (var i=0; i<segs; ++i) {
var th2 = th0 + i * th_arc / segs;
var th3 = th0 + (i+1) * th_arc / segs;
const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001)));
const result = [];
for (let i=0; i<segs; ++i) {
const th2 = th0 + i * th_arc / segs;
const th3 = th0 + (i+1) * th_arc / segs;
result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];

@@ -72,3 +72,3 @@ }

export function bezier(params) {
var key = join.call(params);
const key = join.call(params);
if (bezierCache[key]) {

@@ -87,21 +87,21 @@ return bezierCache[key];

var a00 = cos_th * rx;
var a01 = -sin_th * ry;
var a10 = sin_th * rx;
var a11 = cos_th * ry;
const a00 = cos_th * rx;
const a01 = -sin_th * ry;
const a10 = sin_th * rx;
const a11 = cos_th * ry;
var cos_th0 = Math.cos(th0);
var sin_th0 = Math.sin(th0);
var cos_th1 = Math.cos(th1);
var sin_th1 = Math.sin(th1);
const cos_th0 = Math.cos(th0);
const sin_th0 = Math.sin(th0);
const cos_th1 = Math.cos(th1);
const sin_th1 = Math.sin(th1);
var th_half = 0.5 * (th1 - th0);
var sin_th_h2 = Math.sin(th_half * 0.5);
var t = (8/3) * sin_th_h2 * sin_th_h2 / Math.sin(th_half);
var x1 = cx + cos_th0 - t * sin_th0;
var y1 = cy + sin_th0 + t * cos_th0;
var x3 = cx + cos_th1;
var y3 = cy + sin_th1;
var x2 = x3 + t * sin_th1;
var y2 = y3 - t * cos_th1;
const th_half = 0.5 * (th1 - th0);
const sin_th_h2 = Math.sin(th_half * 0.5);
const t = (8/3) * sin_th_h2 * sin_th_h2 / Math.sin(th_half);
const x1 = cx + cos_th0 - t * sin_th0;
const y1 = cy + sin_th0 + t * cos_th0;
const x3 = cx + cos_th1;
const y3 = cy + sin_th1;
const x2 = x3 + t * sin_th1;
const y2 = y3 - t * cos_th1;

@@ -108,0 +108,0 @@ return (bezierCache[key] = [

import {bezier, segments} from './arc';
var temp = ['l', 0, 0, 0, 0, 0, 0, 0];
const temp = ['l', 0, 0, 0, 0, 0, 0, 0];
function scale(current, sX, sY) {
var c = (temp[0] = current[0]);
const c = (temp[0] = current[0]);
if (c === 'a' || c === 'A') {

@@ -309,3 +309,3 @@ temp[1] = sX * current[1];

function drawArc(context, x, y, coords) {
var seg = segments(
const seg = segments(
coords[5], // end x

@@ -320,6 +320,6 @@ coords[6], // end y

);
for (var i=0; i<seg.length; ++i) {
var bez = bezier(seg[i]);
for (let i=0; i<seg.length; ++i) {
const bez = bezier(seg[i]);
context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
}
}

@@ -6,8 +6,8 @@ import pathParse from './parse';

var Tan30 = 0.5773502691896257;
const Tan30 = 0.5773502691896257;
var builtins = {
const builtins = {
'circle': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2;
const r = Math.sqrt(size) / 2;
context.moveTo(r, 0);

@@ -38,3 +38,3 @@ context.arc(0, 0, r, 0, Tau);

draw: function(context, size) {
var r = Math.sqrt(size) / 2;
const r = Math.sqrt(size) / 2;
context.moveTo(-r, 0);

@@ -135,3 +135,3 @@ context.lineTo(0, -r);

draw: function(context, size) {
var r = Math.sqrt(size) / 2;
const r = Math.sqrt(size) / 2;
context.moveTo(-r, 0);

@@ -151,3 +151,3 @@ context.lineTo(r, 0);

if (!hasOwnProperty(custom, path)) {
var parsed = pathParse(path);
const parsed = pathParse(path);
custom[path] = {

@@ -154,0 +154,0 @@ draw: function(context, size) {

@@ -13,3 +13,3 @@ import {Tau} from '../util/constants';

function point(x2, y2, w2) {
var r2 = w2 / 2;
const r2 = w2 / 2;

@@ -16,0 +16,0 @@ if (ready) {

@@ -96,3 +96,3 @@ import ResourceLoader from './ResourceLoader';

render(scene) {
var r = this;
const r = this;

@@ -131,3 +131,3 @@ // bind arguments into a render call, and cache it

renderAsync(scene) {
var r = this.render(scene);
const r = this.render(scene);
return this._ready

@@ -152,3 +152,3 @@ ? this._ready.then(() => r)

// re-render the scene when loading completes
var call = r._call;
const call = r._call;
r._ready = r._loader.ready()

@@ -155,0 +155,0 @@ .then(redraw => {

@@ -24,3 +24,3 @@ import {image} from 'vega-canvas';

sanitizeURL(uri) {
var loader = this;
const loader = this;
increment(loader);

@@ -71,3 +71,3 @@

ready() {
var loader = this;
const loader = this;
return new Promise(accept => {

@@ -74,0 +74,0 @@ function poll(value) {

@@ -25,3 +25,3 @@ import Bounds from './Bounds';

group = group || this.root.items[0];
var mark = createMark(markdef, group);
const mark = createMark(markdef, group);
group.items[index] = mark;

@@ -28,0 +28,0 @@ if (mark.zindex) mark.group.zdirty = true;

@@ -12,3 +12,3 @@ import {pickVisit} from '../visit';

return pickVisit(scene, item => {
var b = item.bounds;
const b = item.bounds;
// first hit test against bounding box

@@ -15,0 +15,0 @@ if ((b && !b.contains(gx, gy)) || !b) return;

import pathParse from '../path/parse';
import {isNumber, isObject} from 'vega-util';
var TOLERANCE = 1e-9;
const TOLERANCE = 1e-9;

@@ -6,0 +6,0 @@ export function sceneEqual(a, b, key) {

export default function(event, el) {
var rect = el.getBoundingClientRect();
const rect = el.getBoundingClientRect();
return [

@@ -4,0 +4,0 @@ event.clientX - rect.left - (el.clientLeft || 0),

import boundMark from '../bound/boundMark';
var keys = [
const keys = [
'marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex',

@@ -30,3 +30,3 @@ 'x', 'y', 'width', 'height', 'align', 'baseline', // layout

export function sceneFromJSON(json) {
var scene = (typeof json === 'string' ? JSON.parse(json) : json);
const scene = (typeof json === 'string' ? JSON.parse(json) : json);
return initialize(scene);

@@ -33,0 +33,0 @@ }

@@ -25,3 +25,3 @@ function compare(a, b) {

var zitems = zorder(scene);
const zitems = zorder(scene);

@@ -44,3 +44,3 @@ if (zitems && zitems.length) {

var zitems = zorder(scene);
const zitems = zorder(scene);
if (zitems && zitems.length) items = zitems;

@@ -47,0 +47,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc