vega 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- data/lib/vega/spec.rb +3 -3
- data/lib/vega/version.rb +1 -1
- data/vendor/assets/javascripts/vega-embed.js +1117 -171
- data/vendor/assets/javascripts/vega-lite.js +6 -6
- data/vendor/assets/javascripts/vega.js +602 -370
- metadata +9 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c647654effe7e3ffa6c7b3a362327194dc4b8d7191eff79aa16cdab069145c99
|
4
|
+
data.tar.gz: 6a5270fd82810cfa524532e65ff7affe90ef976c6b0fd0921a5f0cc8cebe0255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b5d92c2fcec4da87095c75f22fdaa5ab6d2f829c855a23c504e5e7c7e6f851ca40ae6335046fc8d410a62dfe9f180c644216df1c0a4128d6474f970993e54fe
|
7
|
+
data.tar.gz: 212a02dce568a2058fc637909422ec1d31fa3309816c5dca450fbbb5535389e8e5d85de7dfa9fc3681363425bda322512e74bb6da41533b2eac879b9d84a067e
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Interactive charts for Ruby, powered by [Vega](https://vega.github.io/vega/) and [Vega-Lite](https://vega.github.io/vega-lite/)
|
4
4
|
|
5
|
-
[See
|
5
|
+
[See it in action](https://vega.dokkuapp.com)
|
6
6
|
|
7
7
|
Works with Rails, iRuby, and other frameworks
|
8
8
|
|
9
|
-
[![Build Status](https://
|
9
|
+
[![Build Status](https://github.com/ankane/vega/workflows/build/badge.svg?branch=master)](https://github.com/ankane/vega/actions)
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -85,7 +85,7 @@ Vega.lite
|
|
85
85
|
.data([{city: "A", sales: 28}, {city: "B", sales: 55}, {city: "C", sales: 43}])
|
86
86
|
.mark(type: "bar", tooltip: true)
|
87
87
|
.encoding(
|
88
|
-
x: {field: "city", type: "
|
88
|
+
x: {field: "city", type: "nominal"},
|
89
89
|
y: {field: "sales", type: "quantitative"}
|
90
90
|
)
|
91
91
|
```
|
data/lib/vega/spec.rb
CHANGED
@@ -25,9 +25,9 @@ module Vega
|
|
25
25
|
<script>
|
26
26
|
require.config({
|
27
27
|
paths: {
|
28
|
-
'vega': 'https://cdn.jsdelivr.net/npm/vega@5.
|
29
|
-
'vega-lite': 'https://cdn.jsdelivr.net/npm/vega-lite@4.
|
30
|
-
'vega-embed': 'https://cdn.jsdelivr.net/npm/vega-embed@6.
|
28
|
+
'vega': 'https://cdn.jsdelivr.net/npm/vega@5.19.1?noext',
|
29
|
+
'vega-lite': 'https://cdn.jsdelivr.net/npm/vega-lite@4.17.0?noext',
|
30
|
+
'vega-embed': 'https://cdn.jsdelivr.net/npm/vega-embed@6.15.1?noext'
|
31
31
|
}
|
32
32
|
});
|
33
33
|
require(['vega', 'vega-lite', 'vega-embed'], function(vega, vegaLite, vegaEmbed) {
|
data/lib/vega/version.rb
CHANGED
@@ -5,30 +5,154 @@
|
|
5
5
|
}(this, (function (vegaImport, vegaLiteImport) { 'use strict';
|
6
6
|
|
7
7
|
function _interopNamespace(e) {
|
8
|
-
if (e && e.__esModule)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
n['default'] = e;
|
24
|
-
return Object.freeze(n);
|
8
|
+
if (e && e.__esModule) return e;
|
9
|
+
var n = Object.create(null);
|
10
|
+
if (e) {
|
11
|
+
Object.keys(e).forEach(function (k) {
|
12
|
+
if (k !== 'default') {
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
15
|
+
enumerable: true,
|
16
|
+
get: function () {
|
17
|
+
return e[k];
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
});
|
25
22
|
}
|
23
|
+
n['default'] = e;
|
24
|
+
return Object.freeze(n);
|
26
25
|
}
|
27
26
|
|
28
27
|
var vegaImport__namespace = /*#__PURE__*/_interopNamespace(vegaImport);
|
29
28
|
var vegaLiteImport__namespace = /*#__PURE__*/_interopNamespace(vegaLiteImport);
|
30
29
|
|
31
|
-
var
|
30
|
+
var name = "vega-embed";
|
31
|
+
var version = "6.15.1";
|
32
|
+
var description = "Publish Vega visualizations as embedded web components.";
|
33
|
+
var keywords = [
|
34
|
+
"vega",
|
35
|
+
"data",
|
36
|
+
"visualization",
|
37
|
+
"component",
|
38
|
+
"embed"
|
39
|
+
];
|
40
|
+
var repository = {
|
41
|
+
type: "git",
|
42
|
+
url: "http://github.com/vega/vega-embed.git"
|
43
|
+
};
|
44
|
+
var author = {
|
45
|
+
name: "UW Interactive Data Lab",
|
46
|
+
url: "http://idl.cs.washington.edu"
|
47
|
+
};
|
48
|
+
var contributors = [
|
49
|
+
{
|
50
|
+
name: "Dominik Moritz",
|
51
|
+
url: "https://www.domoritz.de"
|
52
|
+
}
|
53
|
+
];
|
54
|
+
var bugs = {
|
55
|
+
url: "https://github.com/vega/vega-embed/issues"
|
56
|
+
};
|
57
|
+
var homepage = "https://github.com/vega/vega-embed#readme";
|
58
|
+
var license = "BSD-3-Clause";
|
59
|
+
var main = "build/vega-embed.js";
|
60
|
+
var module = "build/vega-embed.module.js";
|
61
|
+
var unpkg = "build/vega-embed.min.js";
|
62
|
+
var jsdelivr = "build/vega-embed.min.js";
|
63
|
+
var types = "build/vega-embed.module.d.ts";
|
64
|
+
var files = [
|
65
|
+
"src",
|
66
|
+
"build",
|
67
|
+
"build-es5"
|
68
|
+
];
|
69
|
+
var devDependencies = {
|
70
|
+
"@rollup/plugin-commonjs": "17.1.0",
|
71
|
+
"@rollup/plugin-json": "^4.1.0",
|
72
|
+
"@rollup/plugin-node-resolve": "^11.1.1",
|
73
|
+
"@types/semver": "^7.3.4",
|
74
|
+
"@wessberg/rollup-plugin-ts": "^1.3.8",
|
75
|
+
"browser-sync": "^2.26.14",
|
76
|
+
concurrently: "^5.3.0",
|
77
|
+
"jest-canvas-mock": "^2.3.0",
|
78
|
+
"node-sass": "^5.0.0",
|
79
|
+
rollup: "^2.38.3",
|
80
|
+
"rollup-plugin-bundle-size": "^1.0.3",
|
81
|
+
"rollup-plugin-terser": "^7.0.2",
|
82
|
+
typescript: "^4.1.3",
|
83
|
+
vega: "^5.10.0",
|
84
|
+
"vega-lite": "^4.7.0",
|
85
|
+
"vega-lite-dev-config": "^0.14.8"
|
86
|
+
};
|
87
|
+
var peerDependencies = {
|
88
|
+
vega: "^5.13.0",
|
89
|
+
"vega-lite": "*"
|
90
|
+
};
|
91
|
+
var dependencies = {
|
92
|
+
"fast-json-patch": "^3.0.0-1",
|
93
|
+
"json-stringify-pretty-compact": "^2.0.0",
|
94
|
+
semver: "^7.3.4",
|
95
|
+
"vega-schema-url-parser": "^2.1.0",
|
96
|
+
"vega-themes": "^2.9.1",
|
97
|
+
"vega-tooltip": "^0.25.0"
|
98
|
+
};
|
99
|
+
var scripts = {
|
100
|
+
prebuild: "yarn clean && yarn build:style",
|
101
|
+
build: "rollup -c",
|
102
|
+
"build:style": "./build-style.sh",
|
103
|
+
clean: "rimraf build && rimraf build-es5 && rimraf src/style.ts",
|
104
|
+
prepublishOnly: "yarn clean && yarn build",
|
105
|
+
preversion: "yarn lint && yarn test",
|
106
|
+
serve: "browser-sync start --directory -s -f build *.html",
|
107
|
+
start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
|
108
|
+
pretest: "yarn build:style",
|
109
|
+
test: "beemo jest",
|
110
|
+
"test:inspect": "node --inspect-brk ./node_modules/.bin/jest --runInBand",
|
111
|
+
prepare: "beemo create-config",
|
112
|
+
prettierbase: "beemo prettier '*.{css,scss,html}'",
|
113
|
+
eslintbase: "beemo eslint .",
|
114
|
+
format: "yarn eslintbase --fix && yarn prettierbase --write",
|
115
|
+
lint: "yarn eslintbase && yarn prettierbase --check"
|
116
|
+
};
|
117
|
+
var beemo = {
|
118
|
+
module: "vega-lite-dev-config",
|
119
|
+
drivers: [
|
120
|
+
"typescript",
|
121
|
+
"prettier",
|
122
|
+
"eslint",
|
123
|
+
"babel",
|
124
|
+
"jest"
|
125
|
+
],
|
126
|
+
jest: {
|
127
|
+
testURL: "http://localhost/",
|
128
|
+
setupFiles: [
|
129
|
+
"jest-canvas-mock"
|
130
|
+
]
|
131
|
+
}
|
132
|
+
};
|
133
|
+
var pkg = {
|
134
|
+
name: name,
|
135
|
+
version: version,
|
136
|
+
description: description,
|
137
|
+
keywords: keywords,
|
138
|
+
repository: repository,
|
139
|
+
author: author,
|
140
|
+
contributors: contributors,
|
141
|
+
bugs: bugs,
|
142
|
+
homepage: homepage,
|
143
|
+
license: license,
|
144
|
+
main: main,
|
145
|
+
module: module,
|
146
|
+
unpkg: unpkg,
|
147
|
+
jsdelivr: jsdelivr,
|
148
|
+
types: types,
|
149
|
+
files: files,
|
150
|
+
devDependencies: devDependencies,
|
151
|
+
peerDependencies: peerDependencies,
|
152
|
+
dependencies: dependencies,
|
153
|
+
scripts: scripts,
|
154
|
+
beemo: beemo
|
155
|
+
};
|
32
156
|
|
33
157
|
/*! *****************************************************************************
|
34
158
|
Copyright (c) Microsoft Corporation.
|
@@ -960,18 +1084,9 @@
|
|
960
1084
|
})(passedObj, "", 0);
|
961
1085
|
};
|
962
1086
|
|
963
|
-
function createCommonjsModule(fn
|
964
|
-
|
965
|
-
|
966
|
-
exports: {},
|
967
|
-
require: function (path, base) {
|
968
|
-
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
969
|
-
}
|
970
|
-
}, fn(module, module.exports), module.exports;
|
971
|
-
}
|
972
|
-
|
973
|
-
function commonjsRequire () {
|
974
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
1087
|
+
function createCommonjsModule(fn) {
|
1088
|
+
var module = { exports: {} };
|
1089
|
+
return fn(module, module.exports), module.exports;
|
975
1090
|
}
|
976
1091
|
|
977
1092
|
// Note: this is the semver.org version of the spec that it implements
|
@@ -1187,6 +1302,18 @@
|
|
1187
1302
|
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$');
|
1188
1303
|
});
|
1189
1304
|
|
1305
|
+
// parse out just the options we care about so we always get a consistent
|
1306
|
+
// obj with keys in a consistent order.
|
1307
|
+
const opts = ['includePrerelease', 'loose', 'rtl'];
|
1308
|
+
const parseOptions = options =>
|
1309
|
+
!options ? {}
|
1310
|
+
: typeof options !== 'object' ? { loose: true }
|
1311
|
+
: opts.filter(k => options[k]).reduce((options, k) => {
|
1312
|
+
options[k] = true;
|
1313
|
+
return options
|
1314
|
+
}, {});
|
1315
|
+
var parseOptions_1 = parseOptions;
|
1316
|
+
|
1190
1317
|
const numeric = /^[0-9]+$/;
|
1191
1318
|
const compareIdentifiers = (a, b) => {
|
1192
1319
|
const anum = numeric.test(a);
|
@@ -1214,15 +1341,12 @@
|
|
1214
1341
|
const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 } = constants;
|
1215
1342
|
const { re, t } = re_1;
|
1216
1343
|
|
1344
|
+
|
1217
1345
|
const { compareIdentifiers: compareIdentifiers$1 } = identifiers;
|
1218
1346
|
class SemVer {
|
1219
1347
|
constructor (version, options) {
|
1220
|
-
|
1221
|
-
|
1222
|
-
loose: !!options,
|
1223
|
-
includePrerelease: false
|
1224
|
-
};
|
1225
|
-
}
|
1348
|
+
options = parseOptions_1(options);
|
1349
|
+
|
1226
1350
|
if (version instanceof SemVer) {
|
1227
1351
|
if (version.loose === !!options.loose &&
|
1228
1352
|
version.includePrerelease === !!options.includePrerelease) {
|
@@ -1505,13 +1629,9 @@
|
|
1505
1629
|
const { re: re$1, t: t$1 } = re_1;
|
1506
1630
|
|
1507
1631
|
|
1632
|
+
|
1508
1633
|
const parse = (version, options) => {
|
1509
|
-
|
1510
|
-
options = {
|
1511
|
-
loose: !!options,
|
1512
|
-
includePrerelease: false
|
1513
|
-
};
|
1514
|
-
}
|
1634
|
+
options = parseOptions_1(options);
|
1515
1635
|
|
1516
1636
|
if (version instanceof semver) {
|
1517
1637
|
return version
|
@@ -1735,15 +1855,777 @@
|
|
1735
1855
|
};
|
1736
1856
|
var coerce_1 = coerce;
|
1737
1857
|
|
1858
|
+
var iterator = function (Yallist) {
|
1859
|
+
Yallist.prototype[Symbol.iterator] = function* () {
|
1860
|
+
for (let walker = this.head; walker; walker = walker.next) {
|
1861
|
+
yield walker.value;
|
1862
|
+
}
|
1863
|
+
};
|
1864
|
+
};
|
1865
|
+
|
1866
|
+
var yallist = Yallist;
|
1867
|
+
|
1868
|
+
Yallist.Node = Node;
|
1869
|
+
Yallist.create = Yallist;
|
1870
|
+
|
1871
|
+
function Yallist (list) {
|
1872
|
+
var self = this;
|
1873
|
+
if (!(self instanceof Yallist)) {
|
1874
|
+
self = new Yallist();
|
1875
|
+
}
|
1876
|
+
|
1877
|
+
self.tail = null;
|
1878
|
+
self.head = null;
|
1879
|
+
self.length = 0;
|
1880
|
+
|
1881
|
+
if (list && typeof list.forEach === 'function') {
|
1882
|
+
list.forEach(function (item) {
|
1883
|
+
self.push(item);
|
1884
|
+
});
|
1885
|
+
} else if (arguments.length > 0) {
|
1886
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
1887
|
+
self.push(arguments[i]);
|
1888
|
+
}
|
1889
|
+
}
|
1890
|
+
|
1891
|
+
return self
|
1892
|
+
}
|
1893
|
+
|
1894
|
+
Yallist.prototype.removeNode = function (node) {
|
1895
|
+
if (node.list !== this) {
|
1896
|
+
throw new Error('removing node which does not belong to this list')
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
var next = node.next;
|
1900
|
+
var prev = node.prev;
|
1901
|
+
|
1902
|
+
if (next) {
|
1903
|
+
next.prev = prev;
|
1904
|
+
}
|
1905
|
+
|
1906
|
+
if (prev) {
|
1907
|
+
prev.next = next;
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
if (node === this.head) {
|
1911
|
+
this.head = next;
|
1912
|
+
}
|
1913
|
+
if (node === this.tail) {
|
1914
|
+
this.tail = prev;
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
node.list.length--;
|
1918
|
+
node.next = null;
|
1919
|
+
node.prev = null;
|
1920
|
+
node.list = null;
|
1921
|
+
|
1922
|
+
return next
|
1923
|
+
};
|
1924
|
+
|
1925
|
+
Yallist.prototype.unshiftNode = function (node) {
|
1926
|
+
if (node === this.head) {
|
1927
|
+
return
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
if (node.list) {
|
1931
|
+
node.list.removeNode(node);
|
1932
|
+
}
|
1933
|
+
|
1934
|
+
var head = this.head;
|
1935
|
+
node.list = this;
|
1936
|
+
node.next = head;
|
1937
|
+
if (head) {
|
1938
|
+
head.prev = node;
|
1939
|
+
}
|
1940
|
+
|
1941
|
+
this.head = node;
|
1942
|
+
if (!this.tail) {
|
1943
|
+
this.tail = node;
|
1944
|
+
}
|
1945
|
+
this.length++;
|
1946
|
+
};
|
1947
|
+
|
1948
|
+
Yallist.prototype.pushNode = function (node) {
|
1949
|
+
if (node === this.tail) {
|
1950
|
+
return
|
1951
|
+
}
|
1952
|
+
|
1953
|
+
if (node.list) {
|
1954
|
+
node.list.removeNode(node);
|
1955
|
+
}
|
1956
|
+
|
1957
|
+
var tail = this.tail;
|
1958
|
+
node.list = this;
|
1959
|
+
node.prev = tail;
|
1960
|
+
if (tail) {
|
1961
|
+
tail.next = node;
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
this.tail = node;
|
1965
|
+
if (!this.head) {
|
1966
|
+
this.head = node;
|
1967
|
+
}
|
1968
|
+
this.length++;
|
1969
|
+
};
|
1970
|
+
|
1971
|
+
Yallist.prototype.push = function () {
|
1972
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
1973
|
+
push(this, arguments[i]);
|
1974
|
+
}
|
1975
|
+
return this.length
|
1976
|
+
};
|
1977
|
+
|
1978
|
+
Yallist.prototype.unshift = function () {
|
1979
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
1980
|
+
unshift(this, arguments[i]);
|
1981
|
+
}
|
1982
|
+
return this.length
|
1983
|
+
};
|
1984
|
+
|
1985
|
+
Yallist.prototype.pop = function () {
|
1986
|
+
if (!this.tail) {
|
1987
|
+
return undefined
|
1988
|
+
}
|
1989
|
+
|
1990
|
+
var res = this.tail.value;
|
1991
|
+
this.tail = this.tail.prev;
|
1992
|
+
if (this.tail) {
|
1993
|
+
this.tail.next = null;
|
1994
|
+
} else {
|
1995
|
+
this.head = null;
|
1996
|
+
}
|
1997
|
+
this.length--;
|
1998
|
+
return res
|
1999
|
+
};
|
2000
|
+
|
2001
|
+
Yallist.prototype.shift = function () {
|
2002
|
+
if (!this.head) {
|
2003
|
+
return undefined
|
2004
|
+
}
|
2005
|
+
|
2006
|
+
var res = this.head.value;
|
2007
|
+
this.head = this.head.next;
|
2008
|
+
if (this.head) {
|
2009
|
+
this.head.prev = null;
|
2010
|
+
} else {
|
2011
|
+
this.tail = null;
|
2012
|
+
}
|
2013
|
+
this.length--;
|
2014
|
+
return res
|
2015
|
+
};
|
2016
|
+
|
2017
|
+
Yallist.prototype.forEach = function (fn, thisp) {
|
2018
|
+
thisp = thisp || this;
|
2019
|
+
for (var walker = this.head, i = 0; walker !== null; i++) {
|
2020
|
+
fn.call(thisp, walker.value, i, this);
|
2021
|
+
walker = walker.next;
|
2022
|
+
}
|
2023
|
+
};
|
2024
|
+
|
2025
|
+
Yallist.prototype.forEachReverse = function (fn, thisp) {
|
2026
|
+
thisp = thisp || this;
|
2027
|
+
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
2028
|
+
fn.call(thisp, walker.value, i, this);
|
2029
|
+
walker = walker.prev;
|
2030
|
+
}
|
2031
|
+
};
|
2032
|
+
|
2033
|
+
Yallist.prototype.get = function (n) {
|
2034
|
+
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
2035
|
+
// abort out of the list early if we hit a cycle
|
2036
|
+
walker = walker.next;
|
2037
|
+
}
|
2038
|
+
if (i === n && walker !== null) {
|
2039
|
+
return walker.value
|
2040
|
+
}
|
2041
|
+
};
|
2042
|
+
|
2043
|
+
Yallist.prototype.getReverse = function (n) {
|
2044
|
+
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
2045
|
+
// abort out of the list early if we hit a cycle
|
2046
|
+
walker = walker.prev;
|
2047
|
+
}
|
2048
|
+
if (i === n && walker !== null) {
|
2049
|
+
return walker.value
|
2050
|
+
}
|
2051
|
+
};
|
2052
|
+
|
2053
|
+
Yallist.prototype.map = function (fn, thisp) {
|
2054
|
+
thisp = thisp || this;
|
2055
|
+
var res = new Yallist();
|
2056
|
+
for (var walker = this.head; walker !== null;) {
|
2057
|
+
res.push(fn.call(thisp, walker.value, this));
|
2058
|
+
walker = walker.next;
|
2059
|
+
}
|
2060
|
+
return res
|
2061
|
+
};
|
2062
|
+
|
2063
|
+
Yallist.prototype.mapReverse = function (fn, thisp) {
|
2064
|
+
thisp = thisp || this;
|
2065
|
+
var res = new Yallist();
|
2066
|
+
for (var walker = this.tail; walker !== null;) {
|
2067
|
+
res.push(fn.call(thisp, walker.value, this));
|
2068
|
+
walker = walker.prev;
|
2069
|
+
}
|
2070
|
+
return res
|
2071
|
+
};
|
2072
|
+
|
2073
|
+
Yallist.prototype.reduce = function (fn, initial) {
|
2074
|
+
var acc;
|
2075
|
+
var walker = this.head;
|
2076
|
+
if (arguments.length > 1) {
|
2077
|
+
acc = initial;
|
2078
|
+
} else if (this.head) {
|
2079
|
+
walker = this.head.next;
|
2080
|
+
acc = this.head.value;
|
2081
|
+
} else {
|
2082
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
2083
|
+
}
|
2084
|
+
|
2085
|
+
for (var i = 0; walker !== null; i++) {
|
2086
|
+
acc = fn(acc, walker.value, i);
|
2087
|
+
walker = walker.next;
|
2088
|
+
}
|
2089
|
+
|
2090
|
+
return acc
|
2091
|
+
};
|
2092
|
+
|
2093
|
+
Yallist.prototype.reduceReverse = function (fn, initial) {
|
2094
|
+
var acc;
|
2095
|
+
var walker = this.tail;
|
2096
|
+
if (arguments.length > 1) {
|
2097
|
+
acc = initial;
|
2098
|
+
} else if (this.tail) {
|
2099
|
+
walker = this.tail.prev;
|
2100
|
+
acc = this.tail.value;
|
2101
|
+
} else {
|
2102
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
2103
|
+
}
|
2104
|
+
|
2105
|
+
for (var i = this.length - 1; walker !== null; i--) {
|
2106
|
+
acc = fn(acc, walker.value, i);
|
2107
|
+
walker = walker.prev;
|
2108
|
+
}
|
2109
|
+
|
2110
|
+
return acc
|
2111
|
+
};
|
2112
|
+
|
2113
|
+
Yallist.prototype.toArray = function () {
|
2114
|
+
var arr = new Array(this.length);
|
2115
|
+
for (var i = 0, walker = this.head; walker !== null; i++) {
|
2116
|
+
arr[i] = walker.value;
|
2117
|
+
walker = walker.next;
|
2118
|
+
}
|
2119
|
+
return arr
|
2120
|
+
};
|
2121
|
+
|
2122
|
+
Yallist.prototype.toArrayReverse = function () {
|
2123
|
+
var arr = new Array(this.length);
|
2124
|
+
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
2125
|
+
arr[i] = walker.value;
|
2126
|
+
walker = walker.prev;
|
2127
|
+
}
|
2128
|
+
return arr
|
2129
|
+
};
|
2130
|
+
|
2131
|
+
Yallist.prototype.slice = function (from, to) {
|
2132
|
+
to = to || this.length;
|
2133
|
+
if (to < 0) {
|
2134
|
+
to += this.length;
|
2135
|
+
}
|
2136
|
+
from = from || 0;
|
2137
|
+
if (from < 0) {
|
2138
|
+
from += this.length;
|
2139
|
+
}
|
2140
|
+
var ret = new Yallist();
|
2141
|
+
if (to < from || to < 0) {
|
2142
|
+
return ret
|
2143
|
+
}
|
2144
|
+
if (from < 0) {
|
2145
|
+
from = 0;
|
2146
|
+
}
|
2147
|
+
if (to > this.length) {
|
2148
|
+
to = this.length;
|
2149
|
+
}
|
2150
|
+
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
2151
|
+
walker = walker.next;
|
2152
|
+
}
|
2153
|
+
for (; walker !== null && i < to; i++, walker = walker.next) {
|
2154
|
+
ret.push(walker.value);
|
2155
|
+
}
|
2156
|
+
return ret
|
2157
|
+
};
|
2158
|
+
|
2159
|
+
Yallist.prototype.sliceReverse = function (from, to) {
|
2160
|
+
to = to || this.length;
|
2161
|
+
if (to < 0) {
|
2162
|
+
to += this.length;
|
2163
|
+
}
|
2164
|
+
from = from || 0;
|
2165
|
+
if (from < 0) {
|
2166
|
+
from += this.length;
|
2167
|
+
}
|
2168
|
+
var ret = new Yallist();
|
2169
|
+
if (to < from || to < 0) {
|
2170
|
+
return ret
|
2171
|
+
}
|
2172
|
+
if (from < 0) {
|
2173
|
+
from = 0;
|
2174
|
+
}
|
2175
|
+
if (to > this.length) {
|
2176
|
+
to = this.length;
|
2177
|
+
}
|
2178
|
+
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
2179
|
+
walker = walker.prev;
|
2180
|
+
}
|
2181
|
+
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
2182
|
+
ret.push(walker.value);
|
2183
|
+
}
|
2184
|
+
return ret
|
2185
|
+
};
|
2186
|
+
|
2187
|
+
Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
|
2188
|
+
if (start > this.length) {
|
2189
|
+
start = this.length - 1;
|
2190
|
+
}
|
2191
|
+
if (start < 0) {
|
2192
|
+
start = this.length + start;
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
|
2196
|
+
walker = walker.next;
|
2197
|
+
}
|
2198
|
+
|
2199
|
+
var ret = [];
|
2200
|
+
for (var i = 0; walker && i < deleteCount; i++) {
|
2201
|
+
ret.push(walker.value);
|
2202
|
+
walker = this.removeNode(walker);
|
2203
|
+
}
|
2204
|
+
if (walker === null) {
|
2205
|
+
walker = this.tail;
|
2206
|
+
}
|
2207
|
+
|
2208
|
+
if (walker !== this.head && walker !== this.tail) {
|
2209
|
+
walker = walker.prev;
|
2210
|
+
}
|
2211
|
+
|
2212
|
+
for (var i = 0; i < nodes.length; i++) {
|
2213
|
+
walker = insert(this, walker, nodes[i]);
|
2214
|
+
}
|
2215
|
+
return ret;
|
2216
|
+
};
|
2217
|
+
|
2218
|
+
Yallist.prototype.reverse = function () {
|
2219
|
+
var head = this.head;
|
2220
|
+
var tail = this.tail;
|
2221
|
+
for (var walker = head; walker !== null; walker = walker.prev) {
|
2222
|
+
var p = walker.prev;
|
2223
|
+
walker.prev = walker.next;
|
2224
|
+
walker.next = p;
|
2225
|
+
}
|
2226
|
+
this.head = tail;
|
2227
|
+
this.tail = head;
|
2228
|
+
return this
|
2229
|
+
};
|
2230
|
+
|
2231
|
+
function insert (self, node, value) {
|
2232
|
+
var inserted = node === self.head ?
|
2233
|
+
new Node(value, null, node, self) :
|
2234
|
+
new Node(value, node, node.next, self);
|
2235
|
+
|
2236
|
+
if (inserted.next === null) {
|
2237
|
+
self.tail = inserted;
|
2238
|
+
}
|
2239
|
+
if (inserted.prev === null) {
|
2240
|
+
self.head = inserted;
|
2241
|
+
}
|
2242
|
+
|
2243
|
+
self.length++;
|
2244
|
+
|
2245
|
+
return inserted
|
2246
|
+
}
|
2247
|
+
|
2248
|
+
function push (self, item) {
|
2249
|
+
self.tail = new Node(item, self.tail, null, self);
|
2250
|
+
if (!self.head) {
|
2251
|
+
self.head = self.tail;
|
2252
|
+
}
|
2253
|
+
self.length++;
|
2254
|
+
}
|
2255
|
+
|
2256
|
+
function unshift (self, item) {
|
2257
|
+
self.head = new Node(item, null, self.head, self);
|
2258
|
+
if (!self.tail) {
|
2259
|
+
self.tail = self.head;
|
2260
|
+
}
|
2261
|
+
self.length++;
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
function Node (value, prev, next, list) {
|
2265
|
+
if (!(this instanceof Node)) {
|
2266
|
+
return new Node(value, prev, next, list)
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
this.list = list;
|
2270
|
+
this.value = value;
|
2271
|
+
|
2272
|
+
if (prev) {
|
2273
|
+
prev.next = this;
|
2274
|
+
this.prev = prev;
|
2275
|
+
} else {
|
2276
|
+
this.prev = null;
|
2277
|
+
}
|
2278
|
+
|
2279
|
+
if (next) {
|
2280
|
+
next.prev = this;
|
2281
|
+
this.next = next;
|
2282
|
+
} else {
|
2283
|
+
this.next = null;
|
2284
|
+
}
|
2285
|
+
}
|
2286
|
+
|
2287
|
+
try {
|
2288
|
+
// add if support for Symbol.iterator is present
|
2289
|
+
iterator(Yallist);
|
2290
|
+
} catch (er) {}
|
2291
|
+
|
2292
|
+
// A linked list to keep track of recently-used-ness
|
2293
|
+
|
2294
|
+
|
2295
|
+
const MAX = Symbol('max');
|
2296
|
+
const LENGTH = Symbol('length');
|
2297
|
+
const LENGTH_CALCULATOR = Symbol('lengthCalculator');
|
2298
|
+
const ALLOW_STALE = Symbol('allowStale');
|
2299
|
+
const MAX_AGE = Symbol('maxAge');
|
2300
|
+
const DISPOSE = Symbol('dispose');
|
2301
|
+
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
|
2302
|
+
const LRU_LIST = Symbol('lruList');
|
2303
|
+
const CACHE = Symbol('cache');
|
2304
|
+
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
|
2305
|
+
|
2306
|
+
const naiveLength = () => 1;
|
2307
|
+
|
2308
|
+
// lruList is a yallist where the head is the youngest
|
2309
|
+
// item, and the tail is the oldest. the list contains the Hit
|
2310
|
+
// objects as the entries.
|
2311
|
+
// Each Hit object has a reference to its Yallist.Node. This
|
2312
|
+
// never changes.
|
2313
|
+
//
|
2314
|
+
// cache is a Map (or PseudoMap) that matches the keys to
|
2315
|
+
// the Yallist.Node object.
|
2316
|
+
class LRUCache {
|
2317
|
+
constructor (options) {
|
2318
|
+
if (typeof options === 'number')
|
2319
|
+
options = { max: options };
|
2320
|
+
|
2321
|
+
if (!options)
|
2322
|
+
options = {};
|
2323
|
+
|
2324
|
+
if (options.max && (typeof options.max !== 'number' || options.max < 0))
|
2325
|
+
throw new TypeError('max must be a non-negative number')
|
2326
|
+
// Kind of weird to have a default max of Infinity, but oh well.
|
2327
|
+
this[MAX] = options.max || Infinity;
|
2328
|
+
|
2329
|
+
const lc = options.length || naiveLength;
|
2330
|
+
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
|
2331
|
+
this[ALLOW_STALE] = options.stale || false;
|
2332
|
+
if (options.maxAge && typeof options.maxAge !== 'number')
|
2333
|
+
throw new TypeError('maxAge must be a number')
|
2334
|
+
this[MAX_AGE] = options.maxAge || 0;
|
2335
|
+
this[DISPOSE] = options.dispose;
|
2336
|
+
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
2337
|
+
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
|
2338
|
+
this.reset();
|
2339
|
+
}
|
2340
|
+
|
2341
|
+
// resize the cache when the max changes.
|
2342
|
+
set max (mL) {
|
2343
|
+
if (typeof mL !== 'number' || mL < 0)
|
2344
|
+
throw new TypeError('max must be a non-negative number')
|
2345
|
+
|
2346
|
+
this[MAX] = mL || Infinity;
|
2347
|
+
trim(this);
|
2348
|
+
}
|
2349
|
+
get max () {
|
2350
|
+
return this[MAX]
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
set allowStale (allowStale) {
|
2354
|
+
this[ALLOW_STALE] = !!allowStale;
|
2355
|
+
}
|
2356
|
+
get allowStale () {
|
2357
|
+
return this[ALLOW_STALE]
|
2358
|
+
}
|
2359
|
+
|
2360
|
+
set maxAge (mA) {
|
2361
|
+
if (typeof mA !== 'number')
|
2362
|
+
throw new TypeError('maxAge must be a non-negative number')
|
2363
|
+
|
2364
|
+
this[MAX_AGE] = mA;
|
2365
|
+
trim(this);
|
2366
|
+
}
|
2367
|
+
get maxAge () {
|
2368
|
+
return this[MAX_AGE]
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
// resize the cache when the lengthCalculator changes.
|
2372
|
+
set lengthCalculator (lC) {
|
2373
|
+
if (typeof lC !== 'function')
|
2374
|
+
lC = naiveLength;
|
2375
|
+
|
2376
|
+
if (lC !== this[LENGTH_CALCULATOR]) {
|
2377
|
+
this[LENGTH_CALCULATOR] = lC;
|
2378
|
+
this[LENGTH] = 0;
|
2379
|
+
this[LRU_LIST].forEach(hit => {
|
2380
|
+
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
2381
|
+
this[LENGTH] += hit.length;
|
2382
|
+
});
|
2383
|
+
}
|
2384
|
+
trim(this);
|
2385
|
+
}
|
2386
|
+
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
|
2387
|
+
|
2388
|
+
get length () { return this[LENGTH] }
|
2389
|
+
get itemCount () { return this[LRU_LIST].length }
|
2390
|
+
|
2391
|
+
rforEach (fn, thisp) {
|
2392
|
+
thisp = thisp || this;
|
2393
|
+
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
2394
|
+
const prev = walker.prev;
|
2395
|
+
forEachStep(this, fn, walker, thisp);
|
2396
|
+
walker = prev;
|
2397
|
+
}
|
2398
|
+
}
|
2399
|
+
|
2400
|
+
forEach (fn, thisp) {
|
2401
|
+
thisp = thisp || this;
|
2402
|
+
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
2403
|
+
const next = walker.next;
|
2404
|
+
forEachStep(this, fn, walker, thisp);
|
2405
|
+
walker = next;
|
2406
|
+
}
|
2407
|
+
}
|
2408
|
+
|
2409
|
+
keys () {
|
2410
|
+
return this[LRU_LIST].toArray().map(k => k.key)
|
2411
|
+
}
|
2412
|
+
|
2413
|
+
values () {
|
2414
|
+
return this[LRU_LIST].toArray().map(k => k.value)
|
2415
|
+
}
|
2416
|
+
|
2417
|
+
reset () {
|
2418
|
+
if (this[DISPOSE] &&
|
2419
|
+
this[LRU_LIST] &&
|
2420
|
+
this[LRU_LIST].length) {
|
2421
|
+
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
|
2422
|
+
}
|
2423
|
+
|
2424
|
+
this[CACHE] = new Map(); // hash of items by key
|
2425
|
+
this[LRU_LIST] = new yallist(); // list of items in order of use recency
|
2426
|
+
this[LENGTH] = 0; // length of items in the list
|
2427
|
+
}
|
2428
|
+
|
2429
|
+
dump () {
|
2430
|
+
return this[LRU_LIST].map(hit =>
|
2431
|
+
isStale(this, hit) ? false : {
|
2432
|
+
k: hit.key,
|
2433
|
+
v: hit.value,
|
2434
|
+
e: hit.now + (hit.maxAge || 0)
|
2435
|
+
}).toArray().filter(h => h)
|
2436
|
+
}
|
2437
|
+
|
2438
|
+
dumpLru () {
|
2439
|
+
return this[LRU_LIST]
|
2440
|
+
}
|
2441
|
+
|
2442
|
+
set (key, value, maxAge) {
|
2443
|
+
maxAge = maxAge || this[MAX_AGE];
|
2444
|
+
|
2445
|
+
if (maxAge && typeof maxAge !== 'number')
|
2446
|
+
throw new TypeError('maxAge must be a number')
|
2447
|
+
|
2448
|
+
const now = maxAge ? Date.now() : 0;
|
2449
|
+
const len = this[LENGTH_CALCULATOR](value, key);
|
2450
|
+
|
2451
|
+
if (this[CACHE].has(key)) {
|
2452
|
+
if (len > this[MAX]) {
|
2453
|
+
del(this, this[CACHE].get(key));
|
2454
|
+
return false
|
2455
|
+
}
|
2456
|
+
|
2457
|
+
const node = this[CACHE].get(key);
|
2458
|
+
const item = node.value;
|
2459
|
+
|
2460
|
+
// dispose of the old one before overwriting
|
2461
|
+
// split out into 2 ifs for better coverage tracking
|
2462
|
+
if (this[DISPOSE]) {
|
2463
|
+
if (!this[NO_DISPOSE_ON_SET])
|
2464
|
+
this[DISPOSE](key, item.value);
|
2465
|
+
}
|
2466
|
+
|
2467
|
+
item.now = now;
|
2468
|
+
item.maxAge = maxAge;
|
2469
|
+
item.value = value;
|
2470
|
+
this[LENGTH] += len - item.length;
|
2471
|
+
item.length = len;
|
2472
|
+
this.get(key);
|
2473
|
+
trim(this);
|
2474
|
+
return true
|
2475
|
+
}
|
2476
|
+
|
2477
|
+
const hit = new Entry(key, value, len, now, maxAge);
|
2478
|
+
|
2479
|
+
// oversized objects fall out of cache automatically.
|
2480
|
+
if (hit.length > this[MAX]) {
|
2481
|
+
if (this[DISPOSE])
|
2482
|
+
this[DISPOSE](key, value);
|
2483
|
+
|
2484
|
+
return false
|
2485
|
+
}
|
2486
|
+
|
2487
|
+
this[LENGTH] += hit.length;
|
2488
|
+
this[LRU_LIST].unshift(hit);
|
2489
|
+
this[CACHE].set(key, this[LRU_LIST].head);
|
2490
|
+
trim(this);
|
2491
|
+
return true
|
2492
|
+
}
|
2493
|
+
|
2494
|
+
has (key) {
|
2495
|
+
if (!this[CACHE].has(key)) return false
|
2496
|
+
const hit = this[CACHE].get(key).value;
|
2497
|
+
return !isStale(this, hit)
|
2498
|
+
}
|
2499
|
+
|
2500
|
+
get (key) {
|
2501
|
+
return get(this, key, true)
|
2502
|
+
}
|
2503
|
+
|
2504
|
+
peek (key) {
|
2505
|
+
return get(this, key, false)
|
2506
|
+
}
|
2507
|
+
|
2508
|
+
pop () {
|
2509
|
+
const node = this[LRU_LIST].tail;
|
2510
|
+
if (!node)
|
2511
|
+
return null
|
2512
|
+
|
2513
|
+
del(this, node);
|
2514
|
+
return node.value
|
2515
|
+
}
|
2516
|
+
|
2517
|
+
del (key) {
|
2518
|
+
del(this, this[CACHE].get(key));
|
2519
|
+
}
|
2520
|
+
|
2521
|
+
load (arr) {
|
2522
|
+
// reset the cache
|
2523
|
+
this.reset();
|
2524
|
+
|
2525
|
+
const now = Date.now();
|
2526
|
+
// A previous serialized cache has the most recent items first
|
2527
|
+
for (let l = arr.length - 1; l >= 0; l--) {
|
2528
|
+
const hit = arr[l];
|
2529
|
+
const expiresAt = hit.e || 0;
|
2530
|
+
if (expiresAt === 0)
|
2531
|
+
// the item was created without expiration in a non aged cache
|
2532
|
+
this.set(hit.k, hit.v);
|
2533
|
+
else {
|
2534
|
+
const maxAge = expiresAt - now;
|
2535
|
+
// dont add already expired items
|
2536
|
+
if (maxAge > 0) {
|
2537
|
+
this.set(hit.k, hit.v, maxAge);
|
2538
|
+
}
|
2539
|
+
}
|
2540
|
+
}
|
2541
|
+
}
|
2542
|
+
|
2543
|
+
prune () {
|
2544
|
+
this[CACHE].forEach((value, key) => get(this, key, false));
|
2545
|
+
}
|
2546
|
+
}
|
2547
|
+
|
2548
|
+
const get = (self, key, doUse) => {
|
2549
|
+
const node = self[CACHE].get(key);
|
2550
|
+
if (node) {
|
2551
|
+
const hit = node.value;
|
2552
|
+
if (isStale(self, hit)) {
|
2553
|
+
del(self, node);
|
2554
|
+
if (!self[ALLOW_STALE])
|
2555
|
+
return undefined
|
2556
|
+
} else {
|
2557
|
+
if (doUse) {
|
2558
|
+
if (self[UPDATE_AGE_ON_GET])
|
2559
|
+
node.value.now = Date.now();
|
2560
|
+
self[LRU_LIST].unshiftNode(node);
|
2561
|
+
}
|
2562
|
+
}
|
2563
|
+
return hit.value
|
2564
|
+
}
|
2565
|
+
};
|
2566
|
+
|
2567
|
+
const isStale = (self, hit) => {
|
2568
|
+
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
|
2569
|
+
return false
|
2570
|
+
|
2571
|
+
const diff = Date.now() - hit.now;
|
2572
|
+
return hit.maxAge ? diff > hit.maxAge
|
2573
|
+
: self[MAX_AGE] && (diff > self[MAX_AGE])
|
2574
|
+
};
|
2575
|
+
|
2576
|
+
const trim = self => {
|
2577
|
+
if (self[LENGTH] > self[MAX]) {
|
2578
|
+
for (let walker = self[LRU_LIST].tail;
|
2579
|
+
self[LENGTH] > self[MAX] && walker !== null;) {
|
2580
|
+
// We know that we're about to delete this one, and also
|
2581
|
+
// what the next least recently used key will be, so just
|
2582
|
+
// go ahead and set it now.
|
2583
|
+
const prev = walker.prev;
|
2584
|
+
del(self, walker);
|
2585
|
+
walker = prev;
|
2586
|
+
}
|
2587
|
+
}
|
2588
|
+
};
|
2589
|
+
|
2590
|
+
const del = (self, node) => {
|
2591
|
+
if (node) {
|
2592
|
+
const hit = node.value;
|
2593
|
+
if (self[DISPOSE])
|
2594
|
+
self[DISPOSE](hit.key, hit.value);
|
2595
|
+
|
2596
|
+
self[LENGTH] -= hit.length;
|
2597
|
+
self[CACHE].delete(hit.key);
|
2598
|
+
self[LRU_LIST].removeNode(node);
|
2599
|
+
}
|
2600
|
+
};
|
2601
|
+
|
2602
|
+
class Entry {
|
2603
|
+
constructor (key, value, length, now, maxAge) {
|
2604
|
+
this.key = key;
|
2605
|
+
this.value = value;
|
2606
|
+
this.length = length;
|
2607
|
+
this.now = now;
|
2608
|
+
this.maxAge = maxAge || 0;
|
2609
|
+
}
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
const forEachStep = (self, fn, node, thisp) => {
|
2613
|
+
let hit = node.value;
|
2614
|
+
if (isStale(self, hit)) {
|
2615
|
+
del(self, node);
|
2616
|
+
if (!self[ALLOW_STALE])
|
2617
|
+
hit = undefined;
|
2618
|
+
}
|
2619
|
+
if (hit)
|
2620
|
+
fn.call(thisp, hit.value, hit.key, self);
|
2621
|
+
};
|
2622
|
+
|
2623
|
+
var lruCache = LRUCache;
|
2624
|
+
|
1738
2625
|
// hoisted class for cyclic dependency
|
1739
2626
|
class Range {
|
1740
2627
|
constructor (range, options) {
|
1741
|
-
|
1742
|
-
options = {
|
1743
|
-
loose: !!options,
|
1744
|
-
includePrerelease: false
|
1745
|
-
};
|
1746
|
-
}
|
2628
|
+
options = parseOptions_1(options);
|
1747
2629
|
|
1748
2630
|
if (range instanceof Range) {
|
1749
2631
|
if (
|
@@ -1783,6 +2665,24 @@
|
|
1783
2665
|
throw new TypeError(`Invalid SemVer Range: ${range}`)
|
1784
2666
|
}
|
1785
2667
|
|
2668
|
+
// if we have any that are not the null set, throw out null sets.
|
2669
|
+
if (this.set.length > 1) {
|
2670
|
+
// keep the first one, in case they're all null sets
|
2671
|
+
const first = this.set[0];
|
2672
|
+
this.set = this.set.filter(c => !isNullSet(c[0]));
|
2673
|
+
if (this.set.length === 0)
|
2674
|
+
this.set = [first];
|
2675
|
+
else if (this.set.length > 1) {
|
2676
|
+
// if we have any that are *, then the range is just *
|
2677
|
+
for (const c of this.set) {
|
2678
|
+
if (c.length === 1 && isAny(c[0])) {
|
2679
|
+
this.set = [c];
|
2680
|
+
break
|
2681
|
+
}
|
2682
|
+
}
|
2683
|
+
}
|
2684
|
+
}
|
2685
|
+
|
1786
2686
|
this.format();
|
1787
2687
|
}
|
1788
2688
|
|
@@ -1801,8 +2701,17 @@
|
|
1801
2701
|
}
|
1802
2702
|
|
1803
2703
|
parseRange (range) {
|
1804
|
-
const loose = this.options.loose;
|
1805
2704
|
range = range.trim();
|
2705
|
+
|
2706
|
+
// memoize range parsing for performance.
|
2707
|
+
// this is a very hot path, and fully deterministic.
|
2708
|
+
const memoOpts = Object.keys(this.options).join(',');
|
2709
|
+
const memoKey = `parseRange:${memoOpts}:${range}`;
|
2710
|
+
const cached = cache.get(memoKey);
|
2711
|
+
if (cached)
|
2712
|
+
return cached
|
2713
|
+
|
2714
|
+
const loose = this.options.loose;
|
1806
2715
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
1807
2716
|
const hr = loose ? re$3[t$3.HYPHENRANGELOOSE] : re$3[t$3.HYPHENRANGE];
|
1808
2717
|
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
@@ -1824,15 +2733,33 @@
|
|
1824
2733
|
// ready to be split into comparators.
|
1825
2734
|
|
1826
2735
|
const compRe = loose ? re$3[t$3.COMPARATORLOOSE] : re$3[t$3.COMPARATOR];
|
1827
|
-
|
2736
|
+
const rangeList = range
|
1828
2737
|
.split(' ')
|
1829
2738
|
.map(comp => parseComparator(comp, this.options))
|
1830
2739
|
.join(' ')
|
1831
2740
|
.split(/\s+/)
|
2741
|
+
// >=0.0.0 is equivalent to *
|
1832
2742
|
.map(comp => replaceGTE0(comp, this.options))
|
1833
2743
|
// in loose mode, throw out any that are not valid comparators
|
1834
2744
|
.filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
|
1835
|
-
.map(comp => new comparator(comp, this.options))
|
2745
|
+
.map(comp => new comparator(comp, this.options));
|
2746
|
+
|
2747
|
+
// if any comparators are the null set, then replace with JUST null set
|
2748
|
+
// if more than one comparator, remove any * comparators
|
2749
|
+
// also, don't include the same comparator more than once
|
2750
|
+
rangeList.length;
|
2751
|
+
const rangeMap = new Map();
|
2752
|
+
for (const comp of rangeList) {
|
2753
|
+
if (isNullSet(comp))
|
2754
|
+
return [comp]
|
2755
|
+
rangeMap.set(comp.value, comp);
|
2756
|
+
}
|
2757
|
+
if (rangeMap.size > 1 && rangeMap.has(''))
|
2758
|
+
rangeMap.delete('');
|
2759
|
+
|
2760
|
+
const result = [...rangeMap.values()];
|
2761
|
+
cache.set(memoKey, result);
|
2762
|
+
return result
|
1836
2763
|
}
|
1837
2764
|
|
1838
2765
|
intersects (range, options) {
|
@@ -1882,6 +2809,10 @@
|
|
1882
2809
|
var range = Range;
|
1883
2810
|
|
1884
2811
|
|
2812
|
+
const cache = new lruCache({ max: 1000 });
|
2813
|
+
|
2814
|
+
|
2815
|
+
|
1885
2816
|
|
1886
2817
|
|
1887
2818
|
const {
|
@@ -1892,6 +2823,9 @@
|
|
1892
2823
|
caretTrimReplace
|
1893
2824
|
} = re_1;
|
1894
2825
|
|
2826
|
+
const isNullSet = c => c.value === '<0.0.0-0';
|
2827
|
+
const isAny = c => c.value === '';
|
2828
|
+
|
1895
2829
|
// take a set of comparators and determine whether there
|
1896
2830
|
// exists a version which can satisfy it
|
1897
2831
|
const isSatisfiable = (comparators, options) => {
|
@@ -2206,12 +3140,7 @@
|
|
2206
3140
|
return ANY
|
2207
3141
|
}
|
2208
3142
|
constructor (comp, options) {
|
2209
|
-
|
2210
|
-
options = {
|
2211
|
-
loose: !!options,
|
2212
|
-
includePrerelease: false
|
2213
|
-
};
|
2214
|
-
}
|
3143
|
+
options = parseOptions_1(options);
|
2215
3144
|
|
2216
3145
|
if (comp instanceof Comparator) {
|
2217
3146
|
if (comp.loose === !!options.loose) {
|
@@ -2333,6 +3262,7 @@
|
|
2333
3262
|
|
2334
3263
|
var comparator = Comparator;
|
2335
3264
|
|
3265
|
+
|
2336
3266
|
const {re: re$4, t: t$4} = re_1;
|
2337
3267
|
|
2338
3268
|
const satisfies = (version, range$1, options) => {
|
@@ -2415,6 +3345,7 @@
|
|
2415
3345
|
for (let i = 0; i < range$1.set.length; ++i) {
|
2416
3346
|
const comparators = range$1.set[i];
|
2417
3347
|
|
3348
|
+
let setMin = null;
|
2418
3349
|
comparators.forEach((comparator) => {
|
2419
3350
|
// Clone to avoid manipulating the comparator's semver object.
|
2420
3351
|
const compver = new semver(comparator.semver.version);
|
@@ -2429,8 +3360,8 @@
|
|
2429
3360
|
/* fallthrough */
|
2430
3361
|
case '':
|
2431
3362
|
case '>=':
|
2432
|
-
if (!
|
2433
|
-
|
3363
|
+
if (!setMin || gt_1(compver, setMin)) {
|
3364
|
+
setMin = compver;
|
2434
3365
|
}
|
2435
3366
|
break
|
2436
3367
|
case '<':
|
@@ -2442,6 +3373,8 @@
|
|
2442
3373
|
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
2443
3374
|
}
|
2444
3375
|
});
|
3376
|
+
if (setMin && (!minver || gt_1(minver, setMin)))
|
3377
|
+
minver = setMin;
|
2445
3378
|
}
|
2446
3379
|
|
2447
3380
|
if (minver && range$1.test(minver)) {
|
@@ -2495,7 +3428,7 @@
|
|
2495
3428
|
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
2496
3429
|
}
|
2497
3430
|
|
2498
|
-
// If it
|
3431
|
+
// If it satisfies the range it is not outside
|
2499
3432
|
if (satisfies_1(version, range$1, options)) {
|
2500
3433
|
return false
|
2501
3434
|
}
|
@@ -2625,15 +3558,18 @@
|
|
2625
3558
|
// - If EQ satisfies every C, return true
|
2626
3559
|
// - Else return false
|
2627
3560
|
// - If GT
|
2628
|
-
// - If GT is lower than any > or >= comp in C, return false
|
3561
|
+
// - If GT.semver is lower than any > or >= comp in C, return false
|
2629
3562
|
// - If GT is >=, and GT.semver does not satisfy every C, return false
|
2630
3563
|
// - If LT
|
2631
|
-
// - If LT.semver is greater than
|
3564
|
+
// - If LT.semver is greater than any < or <= comp in C, return false
|
2632
3565
|
// - If LT is <=, and LT.semver does not satisfy every C, return false
|
2633
3566
|
// - If any C is a = range, and GT or LT are set, return false
|
2634
3567
|
// - Else return true
|
2635
3568
|
|
2636
3569
|
const subset = (sub, dom, options) => {
|
3570
|
+
if (sub === dom)
|
3571
|
+
return true
|
3572
|
+
|
2637
3573
|
sub = new range(sub, options);
|
2638
3574
|
dom = new range(dom, options);
|
2639
3575
|
let sawNonNull = false;
|
@@ -2656,6 +3592,9 @@
|
|
2656
3592
|
};
|
2657
3593
|
|
2658
3594
|
const simpleSubset = (sub, dom, options) => {
|
3595
|
+
if (sub === dom)
|
3596
|
+
return true
|
3597
|
+
|
2659
3598
|
if (sub.length === 1 && sub[0].semver === ANY$2)
|
2660
3599
|
return dom.length === 1 && dom[0].semver === ANY$2
|
2661
3600
|
|
@@ -2694,6 +3633,7 @@
|
|
2694
3633
|
if (!satisfies_1(eq, String(c), options))
|
2695
3634
|
return false
|
2696
3635
|
}
|
3636
|
+
|
2697
3637
|
return true
|
2698
3638
|
}
|
2699
3639
|
|
@@ -2705,7 +3645,7 @@
|
|
2705
3645
|
if (gt) {
|
2706
3646
|
if (c.operator === '>' || c.operator === '>=') {
|
2707
3647
|
higher = higherGT(gt, c, options);
|
2708
|
-
if (higher === c)
|
3648
|
+
if (higher === c && higher !== gt)
|
2709
3649
|
return false
|
2710
3650
|
} else if (gt.operator === '>=' && !satisfies_1(gt.semver, String(c), options))
|
2711
3651
|
return false
|
@@ -2713,7 +3653,7 @@
|
|
2713
3653
|
if (lt) {
|
2714
3654
|
if (c.operator === '<' || c.operator === '<=') {
|
2715
3655
|
lower = lowerLT(lt, c, options);
|
2716
|
-
if (lower === c)
|
3656
|
+
if (lower === c && lower !== lt)
|
2717
3657
|
return false
|
2718
3658
|
} else if (lt.operator === '<=' && !satisfies_1(lt.semver, String(c), options))
|
2719
3659
|
return false
|
@@ -2809,21 +3749,21 @@
|
|
2809
3749
|
|
2810
3750
|
function schemaParser(e){const[n,r]=/\/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return {library:n,version:r}}
|
2811
3751
|
|
2812
|
-
var name = "vega-themes";
|
2813
|
-
var version$1 = "2.9.
|
2814
|
-
var description = "Themes for stylized Vega and Vega-Lite visualizations.";
|
2815
|
-
var keywords = [
|
3752
|
+
var name$1 = "vega-themes";
|
3753
|
+
var version$1 = "2.9.1";
|
3754
|
+
var description$1 = "Themes for stylized Vega and Vega-Lite visualizations.";
|
3755
|
+
var keywords$1 = [
|
2816
3756
|
"vega",
|
2817
3757
|
"vega-lite",
|
2818
3758
|
"themes",
|
2819
3759
|
"style"
|
2820
3760
|
];
|
2821
|
-
var license = "BSD-3-Clause";
|
2822
|
-
var author = {
|
3761
|
+
var license$1 = "BSD-3-Clause";
|
3762
|
+
var author$1 = {
|
2823
3763
|
name: "UW Interactive Data Lab",
|
2824
3764
|
url: "https://idl.cs.washington.edu"
|
2825
3765
|
};
|
2826
|
-
var contributors = [
|
3766
|
+
var contributors$1 = [
|
2827
3767
|
{
|
2828
3768
|
name: "Emily Gu",
|
2829
3769
|
url: "https://github.com/emilygu"
|
@@ -2841,20 +3781,20 @@
|
|
2841
3781
|
url: "https://www.domoritz.de"
|
2842
3782
|
}
|
2843
3783
|
];
|
2844
|
-
var main = "build/vega-themes.js";
|
2845
|
-
var module = "build/vega-themes.module.js";
|
2846
|
-
var unpkg = "build/vega-themes.min.js";
|
2847
|
-
var jsdelivr = "build/vega-themes.min.js";
|
2848
|
-
var types = "build/vega-themes.module.d.ts";
|
2849
|
-
var repository = {
|
3784
|
+
var main$1 = "build/vega-themes.js";
|
3785
|
+
var module$1 = "build/vega-themes.module.js";
|
3786
|
+
var unpkg$1 = "build/vega-themes.min.js";
|
3787
|
+
var jsdelivr$1 = "build/vega-themes.min.js";
|
3788
|
+
var types$1 = "build/vega-themes.module.d.ts";
|
3789
|
+
var repository$1 = {
|
2850
3790
|
type: "git",
|
2851
3791
|
url: "https://github.com/vega/vega-themes.git"
|
2852
3792
|
};
|
2853
|
-
var files = [
|
3793
|
+
var files$1 = [
|
2854
3794
|
"src",
|
2855
3795
|
"build"
|
2856
3796
|
];
|
2857
|
-
var scripts = {
|
3797
|
+
var scripts$1 = {
|
2858
3798
|
prebuild: "yarn clean",
|
2859
3799
|
build: "rollup -c",
|
2860
3800
|
clean: "rimraf build && rimraf examples/build",
|
@@ -2870,26 +3810,26 @@
|
|
2870
3810
|
format: "yarn eslintbase --fix",
|
2871
3811
|
lint: "yarn eslintbase"
|
2872
3812
|
};
|
2873
|
-
var devDependencies = {
|
3813
|
+
var devDependencies$1 = {
|
2874
3814
|
"@rollup/plugin-json": "^4.1.0",
|
2875
3815
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
2876
3816
|
"@wessberg/rollup-plugin-ts": "^1.3.4",
|
2877
|
-
"browser-sync": "^2.26.
|
2878
|
-
concurrently: "^5.
|
3817
|
+
"browser-sync": "^2.26.12",
|
3818
|
+
concurrently: "^5.3.0",
|
2879
3819
|
"gh-pages": "^3.1.0",
|
2880
|
-
rollup: "^2.26.
|
3820
|
+
rollup: "^2.26.11",
|
2881
3821
|
"rollup-plugin-bundle-size": "^1.0.3",
|
2882
3822
|
"rollup-plugin-terser": "^7.0.2",
|
2883
3823
|
typescript: "^4.0.2",
|
2884
3824
|
vega: "^5.10.0",
|
2885
3825
|
"vega-lite": "^4.8.1",
|
2886
|
-
"vega-lite-dev-config": "^0.14.
|
3826
|
+
"vega-lite-dev-config": "^0.14.6"
|
2887
3827
|
};
|
2888
|
-
var peerDependencies = {
|
3828
|
+
var peerDependencies$1 = {
|
2889
3829
|
vega: "*",
|
2890
3830
|
"vega-lite": "*"
|
2891
3831
|
};
|
2892
|
-
var beemo = {
|
3832
|
+
var beemo$1 = {
|
2893
3833
|
module: "vega-lite-dev-config",
|
2894
3834
|
drivers: [
|
2895
3835
|
"typescript",
|
@@ -2897,25 +3837,25 @@
|
|
2897
3837
|
"eslint"
|
2898
3838
|
]
|
2899
3839
|
};
|
2900
|
-
var pkg = {
|
2901
|
-
name: name,
|
3840
|
+
var pkg$1 = {
|
3841
|
+
name: name$1,
|
2902
3842
|
version: version$1,
|
2903
|
-
description: description,
|
2904
|
-
keywords: keywords,
|
2905
|
-
license: license,
|
2906
|
-
author: author,
|
2907
|
-
contributors: contributors,
|
2908
|
-
main: main,
|
2909
|
-
module: module,
|
2910
|
-
unpkg: unpkg,
|
2911
|
-
jsdelivr: jsdelivr,
|
2912
|
-
types: types,
|
2913
|
-
repository: repository,
|
2914
|
-
files: files,
|
2915
|
-
scripts: scripts,
|
2916
|
-
devDependencies: devDependencies,
|
2917
|
-
peerDependencies: peerDependencies,
|
2918
|
-
beemo: beemo
|
3843
|
+
description: description$1,
|
3844
|
+
keywords: keywords$1,
|
3845
|
+
license: license$1,
|
3846
|
+
author: author$1,
|
3847
|
+
contributors: contributors$1,
|
3848
|
+
main: main$1,
|
3849
|
+
module: module$1,
|
3850
|
+
unpkg: unpkg$1,
|
3851
|
+
jsdelivr: jsdelivr$1,
|
3852
|
+
types: types$1,
|
3853
|
+
repository: repository$1,
|
3854
|
+
files: files$1,
|
3855
|
+
scripts: scripts$1,
|
3856
|
+
devDependencies: devDependencies$1,
|
3857
|
+
peerDependencies: peerDependencies$1,
|
3858
|
+
beemo: beemo$1
|
2919
3859
|
};
|
2920
3860
|
|
2921
3861
|
const lightColor = '#fff';
|
@@ -3484,7 +4424,7 @@
|
|
3484
4424
|
},
|
3485
4425
|
};
|
3486
4426
|
|
3487
|
-
const version$1$1 = pkg.version;
|
4427
|
+
const version$1$1 = pkg$1.version;
|
3488
4428
|
|
3489
4429
|
var themes = /*#__PURE__*/Object.freeze({
|
3490
4430
|
__proto__: null,
|
@@ -3500,43 +4440,44 @@
|
|
3500
4440
|
vox: voxTheme
|
3501
4441
|
});
|
3502
4442
|
|
3503
|
-
function accessor(fn, fields, name) {
|
4443
|
+
function accessor (fn, fields, name) {
|
3504
4444
|
fn.fields = fields || [];
|
3505
4445
|
fn.fname = name;
|
3506
4446
|
return fn;
|
3507
4447
|
}
|
3508
4448
|
|
3509
|
-
function getter(path) {
|
4449
|
+
function getter (path) {
|
3510
4450
|
return path.length === 1 ? get1(path[0]) : getN(path);
|
3511
4451
|
}
|
3512
4452
|
|
3513
|
-
const get1 = field => function(obj) {
|
4453
|
+
const get1 = field => function (obj) {
|
3514
4454
|
return obj[field];
|
3515
4455
|
};
|
3516
4456
|
|
3517
4457
|
const getN = path => {
|
3518
4458
|
const len = path.length;
|
3519
|
-
return function(obj) {
|
4459
|
+
return function (obj) {
|
3520
4460
|
for (let i = 0; i < len; ++i) {
|
3521
4461
|
obj = obj[path[i]];
|
3522
4462
|
}
|
4463
|
+
|
3523
4464
|
return obj;
|
3524
4465
|
};
|
3525
4466
|
};
|
3526
4467
|
|
3527
|
-
function error(message) {
|
4468
|
+
function error (message) {
|
3528
4469
|
throw Error(message);
|
3529
4470
|
}
|
3530
4471
|
|
3531
|
-
function splitAccessPath(p) {
|
4472
|
+
function splitAccessPath (p) {
|
3532
4473
|
const path = [],
|
3533
4474
|
n = p.length;
|
3534
|
-
|
3535
4475
|
let q = null,
|
3536
4476
|
b = 0,
|
3537
4477
|
s = '',
|
3538
|
-
i,
|
3539
|
-
|
4478
|
+
i,
|
4479
|
+
j,
|
4480
|
+
c;
|
3540
4481
|
p = p + '';
|
3541
4482
|
|
3542
4483
|
function push() {
|
@@ -3545,8 +4486,9 @@
|
|
3545
4486
|
i = j + 1;
|
3546
4487
|
}
|
3547
4488
|
|
3548
|
-
for (i=j=0; j<n; ++j) {
|
4489
|
+
for (i = j = 0; j < n; ++j) {
|
3549
4490
|
c = p[j];
|
4491
|
+
|
3550
4492
|
if (c === '\\') {
|
3551
4493
|
s += p.substring(i, j);
|
3552
4494
|
s += p.substring(++j, ++j);
|
@@ -3591,35 +4533,26 @@
|
|
3591
4533
|
return path;
|
3592
4534
|
}
|
3593
4535
|
|
3594
|
-
function field(field, name, opt) {
|
4536
|
+
function field (field, name, opt) {
|
3595
4537
|
const path = splitAccessPath(field);
|
3596
4538
|
field = path.length === 1 ? path[0] : field;
|
3597
|
-
return accessor(
|
3598
|
-
(opt && opt.get || getter)(path),
|
3599
|
-
[field],
|
3600
|
-
name || field
|
3601
|
-
);
|
4539
|
+
return accessor((opt && opt.get || getter)(path), [field], name || field);
|
3602
4540
|
}
|
3603
4541
|
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
|
3610
|
-
const one = accessor(() => 1, [], 'one');
|
3611
|
-
|
3612
|
-
const truthy = accessor(() => true, [], 'true');
|
3613
|
-
|
3614
|
-
const falsy = accessor(() => false, [], 'false');
|
4542
|
+
field('id');
|
4543
|
+
accessor(_ => _, [], 'identity');
|
4544
|
+
accessor(() => 0, [], 'zero');
|
4545
|
+
accessor(() => 1, [], 'one');
|
4546
|
+
accessor(() => true, [], 'true');
|
4547
|
+
accessor(() => false, [], 'false');
|
3615
4548
|
|
3616
4549
|
var isArray = Array.isArray;
|
3617
4550
|
|
3618
|
-
function isObject(_) {
|
4551
|
+
function isObject (_) {
|
3619
4552
|
return _ === Object(_);
|
3620
4553
|
}
|
3621
4554
|
|
3622
|
-
function isString(_) {
|
4555
|
+
function isString (_) {
|
3623
4556
|
return typeof _ === 'string';
|
3624
4557
|
}
|
3625
4558
|
|
@@ -3851,6 +4784,7 @@
|
|
3851
4784
|
constructor(options) {
|
3852
4785
|
this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
3853
4786
|
const elementId = this.options.id;
|
4787
|
+
this.el = null;
|
3854
4788
|
// bind this to call
|
3855
4789
|
this.call = this.tooltipHandler.bind(this);
|
3856
4790
|
// prepend a default stylesheet for tooltips to the head
|
@@ -3866,21 +4800,22 @@
|
|
3866
4800
|
head.appendChild(style);
|
3867
4801
|
}
|
3868
4802
|
}
|
3869
|
-
// append a div element that we use as a tooltip unless it already exists
|
3870
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
3871
|
-
this.el = document.getElementById(elementId);
|
3872
|
-
if (!this.el) {
|
3873
|
-
this.el = document.createElement('div');
|
3874
|
-
this.el.setAttribute('id', elementId);
|
3875
|
-
this.el.classList.add('vg-tooltip');
|
3876
|
-
document.body.appendChild(this.el);
|
3877
|
-
}
|
3878
4803
|
}
|
3879
4804
|
/**
|
3880
4805
|
* The tooltip handler function.
|
3881
4806
|
*/
|
3882
4807
|
tooltipHandler(handler, event, item, value) {
|
3883
4808
|
// console.log(handler, event, item, value);
|
4809
|
+
// append a div element that we use as a tooltip unless it already exists
|
4810
|
+
this.el = document.getElementById(this.options.id);
|
4811
|
+
if (!this.el) {
|
4812
|
+
this.el = document.createElement('div');
|
4813
|
+
this.el.setAttribute('id', this.options.id);
|
4814
|
+
this.el.classList.add('vg-tooltip');
|
4815
|
+
document.body.appendChild(this.el);
|
4816
|
+
}
|
4817
|
+
const tooltipContainer = document.fullscreenElement != null ? document.fullscreenElement : document.body;
|
4818
|
+
tooltipContainer.appendChild(this.el);
|
3884
4819
|
// hide tooltip for null, undefined, or empty string values
|
3885
4820
|
if (value == null || value === '') {
|
3886
4821
|
this.el.classList.remove('visible', `${this.options.theme}-theme`);
|
@@ -3927,7 +4862,7 @@
|
|
3927
4862
|
}
|
3928
4863
|
|
3929
4864
|
// generated with build-style.sh
|
3930
|
-
var embedStyle = ".vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\n .vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left; }\n .vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none; }\n .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: \"\";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n .vega-embed .chart-wrapper {\n width: 100%;\n height: 100%; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow:
|
4865
|
+
var embedStyle = ".vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\n .vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left; }\n .vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none; }\n .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: \"\";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n .vega-embed .chart-wrapper {\n width: 100%;\n height: 100%; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n";
|
3931
4866
|
|
3932
4867
|
// polyfill for IE
|
3933
4868
|
if (!String.prototype.startsWith) {
|
@@ -4036,6 +4971,13 @@
|
|
4036
4971
|
function isLoader(o) {
|
4037
4972
|
return !!(o && 'load' in o);
|
4038
4973
|
}
|
4974
|
+
function createLoader(opts) {
|
4975
|
+
return isLoader(opts) ? opts : vega.loader(opts);
|
4976
|
+
}
|
4977
|
+
function embedOptionsFromUsermeta(parsedSpec) {
|
4978
|
+
var _a;
|
4979
|
+
return (_a = (parsedSpec.usermeta && parsedSpec.usermeta['embedOptions'])) !== null && _a !== void 0 ? _a : {};
|
4980
|
+
}
|
4039
4981
|
/**
|
4040
4982
|
* Embed a Vega visualization component in a web page. This function returns a promise.
|
4041
4983
|
*
|
@@ -4048,31 +4990,35 @@
|
|
4048
4990
|
var _a, _b, _c;
|
4049
4991
|
if (opts === void 0) { opts = {}; }
|
4050
4992
|
return __awaiter(this, void 0, void 0, function () {
|
4051
|
-
var
|
4052
|
-
return __generator(this, function (
|
4053
|
-
switch (
|
4993
|
+
var parsedSpec, loader, _d, _e, usermetaLoader, usermetaOpts, parsedOpts, mergedOpts;
|
4994
|
+
return __generator(this, function (_f) {
|
4995
|
+
switch (_f.label) {
|
4054
4996
|
case 0:
|
4055
|
-
loader = isLoader(opts.loader) ? opts.loader : vega.loader(opts.loader);
|
4056
4997
|
if (!vegaImport.isString(spec)) return [3 /*break*/, 2];
|
4057
|
-
|
4998
|
+
loader = createLoader(opts.loader);
|
4999
|
+
_e = (_d = JSON).parse;
|
4058
5000
|
return [4 /*yield*/, loader.load(spec)];
|
4059
5001
|
case 1:
|
4060
|
-
|
5002
|
+
parsedSpec = _e.apply(_d, [_f.sent()]);
|
4061
5003
|
return [3 /*break*/, 3];
|
4062
5004
|
case 2:
|
4063
|
-
|
4064
|
-
|
5005
|
+
parsedSpec = spec;
|
5006
|
+
_f.label = 3;
|
4065
5007
|
case 3:
|
4066
|
-
|
4067
|
-
|
5008
|
+
usermetaLoader = embedOptionsFromUsermeta(parsedSpec).loader;
|
5009
|
+
// either create the loader for the first time or create a new loader if the spec has new loader options
|
5010
|
+
if (!loader || usermetaLoader) {
|
5011
|
+
loader = createLoader((_a = opts.loader) !== null && _a !== void 0 ? _a : usermetaLoader);
|
5012
|
+
}
|
5013
|
+
return [4 /*yield*/, loadOpts(embedOptionsFromUsermeta(parsedSpec), loader)];
|
4068
5014
|
case 4:
|
4069
|
-
usermetaOpts =
|
5015
|
+
usermetaOpts = _f.sent();
|
4070
5016
|
return [4 /*yield*/, loadOpts(opts, loader)];
|
4071
5017
|
case 5:
|
4072
|
-
parsedOpts =
|
5018
|
+
parsedOpts = _f.sent();
|
4073
5019
|
mergedOpts = __assign(__assign({}, mergeDeep(parsedOpts, usermetaOpts)), { config: vegaImport.mergeConfig((_b = parsedOpts.config) !== null && _b !== void 0 ? _b : {}, (_c = usermetaOpts.config) !== null && _c !== void 0 ? _c : {}) });
|
4074
5020
|
return [4 /*yield*/, _embed(el, parsedSpec, mergedOpts, loader)];
|
4075
|
-
case 6: return [2 /*return*/,
|
5021
|
+
case 6: return [2 /*return*/, _f.sent()];
|
4076
5022
|
}
|
4077
5023
|
});
|
4078
5024
|
});
|
@@ -4131,7 +5077,7 @@
|
|
4131
5077
|
}
|
4132
5078
|
view.finalize();
|
4133
5079
|
}
|
4134
|
-
var config, actions, i18n, renderer, logLevel, downloadFileName,
|
5080
|
+
var config, actions, i18n, renderer, logLevel, downloadFileName, element, ID, _g, root, rootContainer, style, mode, vgSpec, parsed, container, chartWrapper, patch, ast, runtime, view, handler, hover, _h, hoverSet, updateSet, documentClickHandler, wrapper, details_1, summary, ctrl, _loop_1, _i, _j, ext, viewSourceLink, compileLink, editorUrl_1, editorLink;
|
4135
5081
|
return __generator(this, function (_k) {
|
4136
5082
|
switch (_k.label) {
|
4137
5083
|
case 0:
|
@@ -4141,13 +5087,13 @@
|
|
4141
5087
|
renderer = (_c = opts.renderer) !== null && _c !== void 0 ? _c : 'canvas';
|
4142
5088
|
logLevel = (_d = opts.logLevel) !== null && _d !== void 0 ? _d : vega.Warn;
|
4143
5089
|
downloadFileName = (_e = opts.downloadFileName) !== null && _e !== void 0 ? _e : 'visualization';
|
4144
|
-
|
4145
|
-
if (!
|
5090
|
+
element = typeof el === 'string' ? document.querySelector(el) : el;
|
5091
|
+
if (!element) {
|
4146
5092
|
throw new Error(el + " does not exist");
|
4147
5093
|
}
|
4148
5094
|
if (opts.defaultStyle !== false) {
|
4149
5095
|
ID = 'vega-embed-style';
|
4150
|
-
_g = getRoot(
|
5096
|
+
_g = getRoot(element), root = _g.root, rootContainer = _g.rootContainer;
|
4151
5097
|
if (!root.getElementById(ID)) {
|
4152
5098
|
style = document.createElement('style');
|
4153
5099
|
style.id = ID;
|
@@ -4168,17 +5114,17 @@
|
|
4168
5114
|
}
|
4169
5115
|
}
|
4170
5116
|
}
|
4171
|
-
|
5117
|
+
element.classList.add('vega-embed');
|
4172
5118
|
if (actions) {
|
4173
|
-
|
5119
|
+
element.classList.add('has-actions');
|
4174
5120
|
}
|
4175
|
-
|
4176
|
-
|
5121
|
+
element.innerHTML = ''; // clear container
|
5122
|
+
container = element;
|
4177
5123
|
if (actions) {
|
4178
5124
|
chartWrapper = document.createElement('div');
|
4179
5125
|
chartWrapper.classList.add(CHART_WRAPPER_CLASS);
|
4180
|
-
|
4181
|
-
|
5126
|
+
element.appendChild(chartWrapper);
|
5127
|
+
container = chartWrapper;
|
4182
5128
|
}
|
4183
5129
|
patch = opts.patch;
|
4184
5130
|
if (patch) {
|
@@ -4231,15 +5177,15 @@
|
|
4231
5177
|
view.padding(opts.padding);
|
4232
5178
|
}
|
4233
5179
|
}
|
4234
|
-
return [4 /*yield*/, view.initialize(
|
5180
|
+
return [4 /*yield*/, view.initialize(container, opts.bind).runAsync()];
|
4235
5181
|
case 1:
|
4236
5182
|
_k.sent();
|
4237
5183
|
if (actions !== false) {
|
4238
|
-
wrapper =
|
5184
|
+
wrapper = element;
|
4239
5185
|
if (opts.defaultStyle !== false) {
|
4240
5186
|
details_1 = document.createElement('details');
|
4241
5187
|
details_1.title = i18n.CLICK_TO_VIEW_ACTIONS;
|
4242
|
-
|
5188
|
+
element.append(details_1);
|
4243
5189
|
wrapper = details_1;
|
4244
5190
|
summary = document.createElement('summary');
|
4245
5191
|
summary.innerHTML = SVG_CIRCLES;
|
@@ -4390,7 +5336,7 @@
|
|
4390
5336
|
wrapper.embed = embed;
|
4391
5337
|
wrapper.vega = vega;
|
4392
5338
|
wrapper["default"] = embed;
|
4393
|
-
wrapper.version = version;
|
5339
|
+
wrapper.version = pkg.version;
|
4394
5340
|
|
4395
5341
|
return wrapper;
|
4396
5342
|
|