vega 0.5.0 → 0.6.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/lib/vega/spec.rb +4 -4
- data/lib/vega/version.rb +1 -1
- data/vendor/assets/javascripts/vega-embed.js +2 -2
- data/vendor/assets/javascripts/vega-interpreter.js +4 -14
- data/vendor/assets/javascripts/vega-lite.js +1 -1
- data/vendor/assets/javascripts/vega.js +74 -123
- metadata +3 -3
|
@@ -100,6 +100,11 @@
|
|
|
100
100
|
const one$2 = accessor(() => 1, [], 'one');
|
|
101
101
|
const truthy = accessor(() => true, [], 'true');
|
|
102
102
|
const falsy = accessor(() => false, [], 'false');
|
|
103
|
+
|
|
104
|
+
/** Utilities common to vega-interpreter and vega-expression for evaluating expresions */
|
|
105
|
+
|
|
106
|
+
/** JSON authors are not allowed to set these properties, as these are built-in to the JS Object Prototype and should not be overridden. */
|
|
107
|
+
const DisallowedObjectProperties = new Set([...Object.getOwnPropertyNames(Object.prototype).filter(name => typeof Object.prototype[name] === 'function'), '__proto__']);
|
|
103
108
|
function log$1$1(method, level, input) {
|
|
104
109
|
const args = [level].concat([].slice.call(input));
|
|
105
110
|
console[method].apply(console, args); // eslint-disable-line no-console
|
|
@@ -109,8 +114,7 @@
|
|
|
109
114
|
const Warn = 2;
|
|
110
115
|
const Info = 3;
|
|
111
116
|
const Debug = 4;
|
|
112
|
-
function logger(_, method) {
|
|
113
|
-
let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1$1;
|
|
117
|
+
function logger(_, method, handler = log$1$1) {
|
|
114
118
|
let level = _ || None$2;
|
|
115
119
|
return {
|
|
116
120
|
level(_) {
|
|
@@ -144,10 +148,7 @@
|
|
|
144
148
|
return _ === Object(_);
|
|
145
149
|
}
|
|
146
150
|
const isLegalKey = key => key !== '__proto__';
|
|
147
|
-
function mergeConfig() {
|
|
148
|
-
for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
149
|
-
configs[_key] = arguments[_key];
|
|
150
|
-
}
|
|
151
|
+
function mergeConfig(...configs) {
|
|
151
152
|
return configs.reduce((out, source) => {
|
|
152
153
|
for (const key in source) {
|
|
153
154
|
if (key === 'signals') {
|
|
@@ -669,10 +670,10 @@
|
|
|
669
670
|
return array && peek$1(array) - array[0] || 0;
|
|
670
671
|
}
|
|
671
672
|
function $(x) {
|
|
672
|
-
return isArray(x) ?
|
|
673
|
+
return isArray(x) ? `[${x.map(v => v === null ? 'null' : $(v))}]` : isObject(x) || isString(x) ?
|
|
673
674
|
// Output valid JSON and JS source strings.
|
|
674
|
-
// See
|
|
675
|
-
JSON.stringify(x).
|
|
675
|
+
// See https://github.com/judofyr/timeless/blob/master/posts/json-isnt-a-javascript-subset.md
|
|
676
|
+
JSON.stringify(x).replaceAll('\u2028', '\\u2028').replaceAll('\u2029', '\\u2029') : x;
|
|
676
677
|
}
|
|
677
678
|
function toBoolean(_) {
|
|
678
679
|
return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
|
|
@@ -1145,9 +1146,7 @@
|
|
|
1145
1146
|
compare2 = f;
|
|
1146
1147
|
delta = f;
|
|
1147
1148
|
}
|
|
1148
|
-
function left(a, x) {
|
|
1149
|
-
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1150
|
-
let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
|
|
1149
|
+
function left(a, x, lo = 0, hi = a.length) {
|
|
1151
1150
|
if (lo < hi) {
|
|
1152
1151
|
if (compare1(x, x) !== 0) return hi;
|
|
1153
1152
|
do {
|
|
@@ -1157,9 +1156,7 @@
|
|
|
1157
1156
|
}
|
|
1158
1157
|
return lo;
|
|
1159
1158
|
}
|
|
1160
|
-
function right(a, x) {
|
|
1161
|
-
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1162
|
-
let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
|
|
1159
|
+
function right(a, x, lo = 0, hi = a.length) {
|
|
1163
1160
|
if (lo < hi) {
|
|
1164
1161
|
if (compare1(x, x) !== 0) return hi;
|
|
1165
1162
|
do {
|
|
@@ -1169,9 +1166,7 @@
|
|
|
1169
1166
|
}
|
|
1170
1167
|
return lo;
|
|
1171
1168
|
}
|
|
1172
|
-
function center(a, x) {
|
|
1173
|
-
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1174
|
-
let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
|
|
1169
|
+
function center(a, x, lo = 0, hi = a.length) {
|
|
1175
1170
|
const i = left(a, x, lo, hi - 1);
|
|
1176
1171
|
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
|
1177
1172
|
}
|
|
@@ -1288,8 +1283,7 @@
|
|
|
1288
1283
|
}
|
|
1289
1284
|
|
|
1290
1285
|
class InternMap extends Map {
|
|
1291
|
-
constructor(entries) {
|
|
1292
|
-
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keyof;
|
|
1286
|
+
constructor(entries, key = keyof) {
|
|
1293
1287
|
super();
|
|
1294
1288
|
Object.defineProperties(this, {
|
|
1295
1289
|
_intern: {
|
|
@@ -1315,8 +1309,7 @@
|
|
|
1315
1309
|
}
|
|
1316
1310
|
}
|
|
1317
1311
|
class InternSet extends Set {
|
|
1318
|
-
constructor(values) {
|
|
1319
|
-
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keyof;
|
|
1312
|
+
constructor(values, key = keyof) {
|
|
1320
1313
|
super();
|
|
1321
1314
|
Object.defineProperties(this, {
|
|
1322
1315
|
_intern: {
|
|
@@ -1338,29 +1331,26 @@
|
|
|
1338
1331
|
return super.delete(intern_delete(this, value));
|
|
1339
1332
|
}
|
|
1340
1333
|
}
|
|
1341
|
-
function intern_get(
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
} = _ref;
|
|
1334
|
+
function intern_get({
|
|
1335
|
+
_intern,
|
|
1336
|
+
_key
|
|
1337
|
+
}, value) {
|
|
1346
1338
|
const key = _key(value);
|
|
1347
1339
|
return _intern.has(key) ? _intern.get(key) : value;
|
|
1348
1340
|
}
|
|
1349
|
-
function intern_set(
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
} = _ref2;
|
|
1341
|
+
function intern_set({
|
|
1342
|
+
_intern,
|
|
1343
|
+
_key
|
|
1344
|
+
}, value) {
|
|
1354
1345
|
const key = _key(value);
|
|
1355
1346
|
if (_intern.has(key)) return _intern.get(key);
|
|
1356
1347
|
_intern.set(key, value);
|
|
1357
1348
|
return value;
|
|
1358
1349
|
}
|
|
1359
|
-
function intern_delete(
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
} = _ref3;
|
|
1350
|
+
function intern_delete({
|
|
1351
|
+
_intern,
|
|
1352
|
+
_key
|
|
1353
|
+
}, value) {
|
|
1364
1354
|
const key = _key(value);
|
|
1365
1355
|
if (_intern.has(key)) {
|
|
1366
1356
|
value = _intern.get(key);
|
|
@@ -1376,8 +1366,7 @@
|
|
|
1376
1366
|
return Array.from(keys, key => source[key]);
|
|
1377
1367
|
}
|
|
1378
1368
|
|
|
1379
|
-
function compareDefined() {
|
|
1380
|
-
let compare = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ascending$1;
|
|
1369
|
+
function compareDefined(compare = ascending$1) {
|
|
1381
1370
|
if (compare === ascending$1) return ascendingDefined;
|
|
1382
1371
|
if (typeof compare !== "function") throw new TypeError("compare is not a function");
|
|
1383
1372
|
return (a, b) => {
|
|
@@ -1483,10 +1472,7 @@
|
|
|
1483
1472
|
|
|
1484
1473
|
// Based on https://github.com/mourner/quickselect
|
|
1485
1474
|
// ISC license, Copyright 2018 Vladimir Agafonkin.
|
|
1486
|
-
function quickselect(array, k) {
|
|
1487
|
-
let left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1488
|
-
let right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Infinity;
|
|
1489
|
-
let compare = arguments.length > 4 ? arguments[4] : undefined;
|
|
1475
|
+
function quickselect(array, k, left = 0, right = Infinity, compare) {
|
|
1490
1476
|
k = Math.floor(k);
|
|
1491
1477
|
left = Math.floor(Math.max(0, left));
|
|
1492
1478
|
right = Math.floor(Math.min(array.length - 1, right));
|
|
@@ -1537,8 +1523,7 @@
|
|
|
1537
1523
|
value1 = min$2(values.subarray(i0 + 1));
|
|
1538
1524
|
return value0 + (value1 - value0) * (i - i0);
|
|
1539
1525
|
}
|
|
1540
|
-
function quantileSorted(values, p) {
|
|
1541
|
-
let valueof = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : number$6;
|
|
1526
|
+
function quantileSorted(values, p, valueof = number$6) {
|
|
1542
1527
|
if (!(n = values.length) || isNaN(p = +p)) return;
|
|
1543
1528
|
if (p <= 0 || n < 2) return +valueof(values[0], 0, values);
|
|
1544
1529
|
if (p >= 1) return +valueof(values[n - 1], n - 1, values);
|
|
@@ -1606,10 +1591,7 @@
|
|
|
1606
1591
|
return sum;
|
|
1607
1592
|
}
|
|
1608
1593
|
|
|
1609
|
-
function intersection(values) {
|
|
1610
|
-
for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1611
|
-
others[_key - 1] = arguments[_key];
|
|
1612
|
-
}
|
|
1594
|
+
function intersection(values, ...others) {
|
|
1613
1595
|
values = new InternSet(values);
|
|
1614
1596
|
others = others.map(set$4);
|
|
1615
1597
|
out: for (const value of values) {
|
|
@@ -1626,11 +1608,8 @@
|
|
|
1626
1608
|
return values instanceof InternSet ? values : new InternSet(values);
|
|
1627
1609
|
}
|
|
1628
1610
|
|
|
1629
|
-
function union() {
|
|
1611
|
+
function union(...others) {
|
|
1630
1612
|
const set = new InternSet();
|
|
1631
|
-
for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1632
|
-
others[_key] = arguments[_key];
|
|
1633
|
-
}
|
|
1634
1613
|
for (const other of others) {
|
|
1635
1614
|
for (const o of other) {
|
|
1636
1615
|
set.add(o);
|
|
@@ -2237,10 +2216,7 @@
|
|
|
2237
2216
|
}
|
|
2238
2217
|
function tickInterval(start, stop, count) {
|
|
2239
2218
|
const target = Math.abs(stop - start) / count;
|
|
2240
|
-
const i = bisector(
|
|
2241
|
-
let [,, step] = _ref;
|
|
2242
|
-
return step;
|
|
2243
|
-
}).right(tickIntervals, target);
|
|
2219
|
+
const i = bisector(([,, step]) => step).right(tickIntervals, target);
|
|
2244
2220
|
if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop / durationYear$1, count));
|
|
2245
2221
|
if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));
|
|
2246
2222
|
const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
|
|
@@ -3361,22 +3337,20 @@
|
|
|
3361
3337
|
/**
|
|
3362
3338
|
* Factory for a loader constructor that provides methods for requesting
|
|
3363
3339
|
* files from either the network or disk, and for sanitizing request URIs.
|
|
3364
|
-
* @param {function} fetch - The Fetch API for HTTP network requests.
|
|
3365
|
-
* If null or undefined, HTTP loading will be disabled.
|
|
3366
3340
|
* @param {object} fs - The file system interface for file loading.
|
|
3367
3341
|
* If null or undefined, local file loading will be disabled.
|
|
3368
3342
|
* @return {function} A loader constructor with the following signature:
|
|
3369
3343
|
* param {object} [options] - Optional default loading options to use.
|
|
3370
3344
|
* return {object} - A new loader instance.
|
|
3371
3345
|
*/
|
|
3372
|
-
function loaderFactory(
|
|
3346
|
+
function loaderFactory(fs) {
|
|
3373
3347
|
return options => ({
|
|
3374
3348
|
options: options || {},
|
|
3375
3349
|
sanitize: sanitize,
|
|
3376
3350
|
load: load$1,
|
|
3377
3351
|
fileAccess: false,
|
|
3378
3352
|
file: fileLoader(),
|
|
3379
|
-
http: httpLoader
|
|
3353
|
+
http: httpLoader
|
|
3380
3354
|
});
|
|
3381
3355
|
}
|
|
3382
3356
|
|
|
@@ -3393,7 +3367,7 @@
|
|
|
3393
3367
|
async function load$1(uri, options) {
|
|
3394
3368
|
const opt = await this.sanitize(uri, options),
|
|
3395
3369
|
url = opt.href;
|
|
3396
|
-
return opt.localFile ? this.file(url) : this.http(url, options);
|
|
3370
|
+
return opt.localFile ? this.file(url) : this.http(url, options?.http);
|
|
3397
3371
|
}
|
|
3398
3372
|
|
|
3399
3373
|
/**
|
|
@@ -3492,27 +3466,16 @@
|
|
|
3492
3466
|
}
|
|
3493
3467
|
|
|
3494
3468
|
/**
|
|
3495
|
-
*
|
|
3496
|
-
* @param {
|
|
3497
|
-
* @
|
|
3498
|
-
*
|
|
3499
|
-
* param {object} options - An options hash.
|
|
3500
|
-
* return {Promise} - A promise that resolves to the file contents.
|
|
3501
|
-
*/
|
|
3502
|
-
function httpLoader(fetch) {
|
|
3503
|
-
return fetch ? async function (url, options) {
|
|
3504
|
-
const opt = extend$1({}, this.options.http, options),
|
|
3505
|
-
type = options && options.response,
|
|
3506
|
-
response = await fetch(url, opt);
|
|
3507
|
-
return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
|
|
3508
|
-
} : httpReject;
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3511
|
-
/**
|
|
3512
|
-
* Default http request handler that simply rejects.
|
|
3469
|
+
* An http loader.
|
|
3470
|
+
* @param {string} url - The url to request.
|
|
3471
|
+
* @param {Partial<RequestInit>} options - An options hash.
|
|
3472
|
+
* @return {Promise} - A promise that resolves to the file contents.
|
|
3513
3473
|
*/
|
|
3514
|
-
async function
|
|
3515
|
-
|
|
3474
|
+
async function httpLoader(url, options) {
|
|
3475
|
+
const opt = extend$1({}, this.options.http, options),
|
|
3476
|
+
type = options && options.response,
|
|
3477
|
+
response = await fetch(url, opt);
|
|
3478
|
+
return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
|
|
3516
3479
|
}
|
|
3517
3480
|
const isValid = _ => _ != null && _ === _;
|
|
3518
3481
|
const isBoolean = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;
|
|
@@ -3672,7 +3635,7 @@
|
|
|
3672
3635
|
}
|
|
3673
3636
|
}
|
|
3674
3637
|
}
|
|
3675
|
-
const loader = loaderFactory(
|
|
3638
|
+
const loader = loaderFactory();
|
|
3676
3639
|
|
|
3677
3640
|
function UniqueList(idFunc) {
|
|
3678
3641
|
const $ = idFunc || identity$6,
|
|
@@ -18372,12 +18335,9 @@
|
|
|
18372
18335
|
return m;
|
|
18373
18336
|
},
|
|
18374
18337
|
m = {
|
|
18375
|
-
open(tag) {
|
|
18338
|
+
open(tag, ...attrs) {
|
|
18376
18339
|
push(tag);
|
|
18377
18340
|
outer = '<' + tag;
|
|
18378
|
-
for (var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
18379
|
-
attrs[_key - 1] = arguments[_key];
|
|
18380
|
-
}
|
|
18381
18341
|
for (const set of attrs) {
|
|
18382
18342
|
for (const key in set) attr(key, set[key]);
|
|
18383
18343
|
}
|
|
@@ -22155,7 +22115,7 @@
|
|
|
22155
22115
|
boundsStream$1.point = boundsPoint$1;
|
|
22156
22116
|
boundsStream$1.lineStart = boundsLineStart;
|
|
22157
22117
|
boundsStream$1.lineEnd = boundsLineEnd;
|
|
22158
|
-
if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$3) phi1 = 90;else if (deltaSum < -
|
|
22118
|
+
if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$3) phi1 = 90;else if (deltaSum < -epsilon$3) phi0 = -90;
|
|
22159
22119
|
range$2[0] = lambda0, range$2[1] = lambda1;
|
|
22160
22120
|
},
|
|
22161
22121
|
sphere: function () {
|
|
@@ -22689,7 +22649,7 @@
|
|
|
22689
22649
|
// from the point to the South pole. If it is zero, then the point is the
|
|
22690
22650
|
// same side as the South pole.
|
|
22691
22651
|
|
|
22692
|
-
return (angle < -
|
|
22652
|
+
return (angle < -epsilon$3 || angle < epsilon$3 && sum < -epsilon2) ^ winding & 1;
|
|
22693
22653
|
}
|
|
22694
22654
|
|
|
22695
22655
|
function clip$1 (pointVisible, clipLine, interpolate, start) {
|
|
@@ -23106,7 +23066,7 @@
|
|
|
23106
23066
|
}
|
|
23107
23067
|
|
|
23108
23068
|
var clipMax = 1e9,
|
|
23109
|
-
clipMin = -
|
|
23069
|
+
clipMin = -clipMax;
|
|
23110
23070
|
|
|
23111
23071
|
// TODO Use d3-polygon’s polygonContains here for the ring check?
|
|
23112
23072
|
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
|
|
@@ -30623,9 +30583,7 @@
|
|
|
30623
30583
|
const EPSILON = Math.pow(2, -52);
|
|
30624
30584
|
const EDGE_STACK = new Uint32Array(512);
|
|
30625
30585
|
class Delaunator {
|
|
30626
|
-
static from(points) {
|
|
30627
|
-
let getX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetX;
|
|
30628
|
-
let getY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetY;
|
|
30586
|
+
static from(points, getX = defaultGetX, getY = defaultGetY) {
|
|
30629
30587
|
const n = points.length;
|
|
30630
30588
|
const coords = new Float64Array(n * 2);
|
|
30631
30589
|
for (let i = 0; i < n; i++) {
|
|
@@ -31111,8 +31069,7 @@
|
|
|
31111
31069
|
}
|
|
31112
31070
|
|
|
31113
31071
|
let Voronoi$1 = class Voronoi {
|
|
31114
|
-
constructor(delaunay) {
|
|
31115
|
-
let [xmin, ymin, xmax, ymax] = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 960, 500];
|
|
31072
|
+
constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) {
|
|
31116
31073
|
if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds");
|
|
31117
31074
|
this.delaunay = delaunay;
|
|
31118
31075
|
this._circumcenters = new Float64Array(delaunay.points.length * 2);
|
|
@@ -31520,10 +31477,7 @@
|
|
|
31520
31477
|
return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r];
|
|
31521
31478
|
}
|
|
31522
31479
|
class Delaunay {
|
|
31523
|
-
static from(points) {
|
|
31524
|
-
let fx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pointX;
|
|
31525
|
-
let fy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pointY;
|
|
31526
|
-
let that = arguments.length > 3 ? arguments[3] : undefined;
|
|
31480
|
+
static from(points, fx = pointX, fy = pointY, that) {
|
|
31527
31481
|
return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that)));
|
|
31528
31482
|
}
|
|
31529
31483
|
constructor(points) {
|
|
@@ -31626,8 +31580,7 @@
|
|
|
31626
31580
|
}
|
|
31627
31581
|
} while (e !== e0);
|
|
31628
31582
|
}
|
|
31629
|
-
find(x, y) {
|
|
31630
|
-
let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
31583
|
+
find(x, y, i = 0) {
|
|
31631
31584
|
if ((x = +x, x !== x) || (y = +y, y !== y)) return -1;
|
|
31632
31585
|
const i0 = i;
|
|
31633
31586
|
let c;
|
|
@@ -33052,7 +33005,7 @@
|
|
|
33052
33005
|
resolvefilter: ResolveFilter
|
|
33053
33006
|
});
|
|
33054
33007
|
|
|
33055
|
-
var version$1 = "6.
|
|
33008
|
+
var version$1 = "6.2.0";
|
|
33056
33009
|
|
|
33057
33010
|
const RawCode = 'RawCode';
|
|
33058
33011
|
const Literal = 'Literal';
|
|
@@ -34558,6 +34511,8 @@
|
|
|
34558
34511
|
globalvar = opt.globalvar,
|
|
34559
34512
|
fieldvar = opt.fieldvar,
|
|
34560
34513
|
outputGlobal = isFunction(globalvar) ? globalvar : id => `${globalvar}["${id}"]`;
|
|
34514
|
+
// JSON authors are not allowed to set properties with these names, as these are built-in to the JS Object Prototype.
|
|
34515
|
+
new Set([...Object.getOwnPropertyNames(Object.prototype).filter(name => typeof Object.prototype[name] === 'function'), '__proto__']);
|
|
34561
34516
|
let globals = {},
|
|
34562
34517
|
fields = {},
|
|
34563
34518
|
memberDepth = 0;
|
|
@@ -34611,7 +34566,16 @@
|
|
|
34611
34566
|
UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',
|
|
34612
34567
|
ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',
|
|
34613
34568
|
LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
|
|
34614
|
-
ObjectExpression: n =>
|
|
34569
|
+
ObjectExpression: n => {
|
|
34570
|
+
// If any keys would override Object prototype methods, throw error
|
|
34571
|
+
for (const prop of n.properties) {
|
|
34572
|
+
const keyName = prop.key.name;
|
|
34573
|
+
if (DisallowedObjectProperties.has(keyName)) {
|
|
34574
|
+
error('Illegal property: ' + keyName);
|
|
34575
|
+
}
|
|
34576
|
+
}
|
|
34577
|
+
return '{' + n.properties.map(visit).join(',') + '}';
|
|
34578
|
+
},
|
|
34615
34579
|
Property: n => {
|
|
34616
34580
|
memberDepth += 1;
|
|
34617
34581
|
const k = visit(n.key);
|
|
@@ -35258,28 +35222,16 @@
|
|
|
35258
35222
|
function sequence(seq) {
|
|
35259
35223
|
return array(seq) || (isString(seq) ? seq : null);
|
|
35260
35224
|
}
|
|
35261
|
-
function join(seq) {
|
|
35262
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
35263
|
-
args[_key - 1] = arguments[_key];
|
|
35264
|
-
}
|
|
35225
|
+
function join(seq, ...args) {
|
|
35265
35226
|
return array(seq).join(...args);
|
|
35266
35227
|
}
|
|
35267
|
-
function indexof(seq) {
|
|
35268
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
35269
|
-
args[_key2 - 1] = arguments[_key2];
|
|
35270
|
-
}
|
|
35228
|
+
function indexof(seq, ...args) {
|
|
35271
35229
|
return sequence(seq).indexOf(...args);
|
|
35272
35230
|
}
|
|
35273
|
-
function lastindexof(seq) {
|
|
35274
|
-
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
35275
|
-
args[_key3 - 1] = arguments[_key3];
|
|
35276
|
-
}
|
|
35231
|
+
function lastindexof(seq, ...args) {
|
|
35277
35232
|
return sequence(seq).lastIndexOf(...args);
|
|
35278
35233
|
}
|
|
35279
|
-
function slice(seq) {
|
|
35280
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
35281
|
-
args[_key4 - 1] = arguments[_key4];
|
|
35282
|
-
}
|
|
35234
|
+
function slice(seq, ...args) {
|
|
35283
35235
|
return sequence(seq).slice(...args);
|
|
35284
35236
|
}
|
|
35285
35237
|
function replace(str, pattern, repl) {
|
|
@@ -35408,8 +35360,7 @@
|
|
|
35408
35360
|
* @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point
|
|
35409
35361
|
* @returns a new array containing the lasso with the new point
|
|
35410
35362
|
*/
|
|
35411
|
-
function lassoAppend(lasso, x, y) {
|
|
35412
|
-
let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
|
|
35363
|
+
function lassoAppend(lasso, x, y, minDist = 5) {
|
|
35413
35364
|
lasso = array$5(lasso);
|
|
35414
35365
|
const last = lasso[lasso.length - 1];
|
|
35415
35366
|
|
|
@@ -35424,8 +35375,7 @@
|
|
|
35424
35375
|
* @returns the svg path command that draws the lasso
|
|
35425
35376
|
*/
|
|
35426
35377
|
function lassoPath(lasso) {
|
|
35427
|
-
return array$5(lasso).reduce((svg,
|
|
35428
|
-
let [x, y] = _ref;
|
|
35378
|
+
return array$5(lasso).reduce((svg, [x, y], i) => {
|
|
35429
35379
|
return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `;
|
|
35430
35380
|
}, '');
|
|
35431
35381
|
}
|
|
@@ -41505,6 +41455,7 @@
|
|
|
41505
41455
|
exports.DAYOFYEAR = DAYOFYEAR;
|
|
41506
41456
|
exports.Dataflow = Dataflow;
|
|
41507
41457
|
exports.Debug = Debug;
|
|
41458
|
+
exports.DisallowedObjectProperties = DisallowedObjectProperties;
|
|
41508
41459
|
exports.Error = Error$1;
|
|
41509
41460
|
exports.EventStream = EventStream;
|
|
41510
41461
|
exports.Gradient = Gradient$1;
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vega
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -45,14 +45,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
45
45
|
requirements:
|
|
46
46
|
- - ">="
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: '3.
|
|
48
|
+
version: '3.3'
|
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0'
|
|
54
54
|
requirements: []
|
|
55
|
-
rubygems_version:
|
|
55
|
+
rubygems_version: 4.0.6
|
|
56
56
|
specification_version: 4
|
|
57
57
|
summary: Interactive charts for Ruby, powered by Vega and Vega-Lite
|
|
58
58
|
test_files: []
|