vega 0.3.1 → 0.3.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/README.md +12 -12
- data/lib/vega/version.rb +1 -1
- data/lib/vega.rb +8 -8
- data/licenses/LICENSE-vega-interpreter.txt +1 -1
- data/licenses/LICENSE-vega.txt +1 -1
- data/vendor/assets/javascripts/vega-embed.js +436 -248
- data/vendor/assets/javascripts/vega-interpreter.js +33 -40
- data/vendor/assets/javascripts/vega-lite.js +2191 -1580
- data/vendor/assets/javascripts/vega.js +7345 -11726
- metadata +3 -3
@@ -506,7 +506,6 @@
|
|
506
506
|
results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
|
507
507
|
document = results[i].newDocument; // in case root was replaced
|
508
508
|
}
|
509
|
-
|
510
509
|
results.newDocument = document;
|
511
510
|
return results;
|
512
511
|
}
|
@@ -877,6 +876,10 @@
|
|
877
876
|
unescapePathComponent
|
878
877
|
});
|
879
878
|
|
879
|
+
function getDefaultExportFromCjs (x) {
|
880
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
881
|
+
}
|
882
|
+
|
880
883
|
// Note: This regex matches even invalid JSON strings, but since we’re
|
881
884
|
// working on the output of `JSON.stringify` we know that only valid strings
|
882
885
|
// are present (unless the user supplied a weird `options.indent` but in
|
@@ -943,6 +946,7 @@
|
|
943
946
|
return string;
|
944
947
|
}(passedObj, "", 0);
|
945
948
|
};
|
949
|
+
var stringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStringifyPrettyCompact);
|
946
950
|
|
947
951
|
var iterator;
|
948
952
|
var hasRequiredIterator;
|
@@ -1237,7 +1241,7 @@
|
|
1237
1241
|
}
|
1238
1242
|
return ret;
|
1239
1243
|
};
|
1240
|
-
Yallist$1.prototype.splice = function (start, deleteCount) {
|
1244
|
+
Yallist$1.prototype.splice = function (start, deleteCount, ...nodes) {
|
1241
1245
|
if (start > this.length) {
|
1242
1246
|
start = this.length - 1;
|
1243
1247
|
}
|
@@ -1258,8 +1262,8 @@
|
|
1258
1262
|
if (walker !== this.head && walker !== this.tail) {
|
1259
1263
|
walker = walker.prev;
|
1260
1264
|
}
|
1261
|
-
for (var i = 0; i <
|
1262
|
-
walker = insert(this, walker,
|
1265
|
+
for (var i = 0; i < nodes.length; i++) {
|
1266
|
+
walker = insert(this, walker, nodes[i]);
|
1263
1267
|
}
|
1264
1268
|
return ret;
|
1265
1269
|
};
|
@@ -1442,7 +1446,6 @@
|
|
1442
1446
|
this[LRU_LIST] = new Yallist(); // list of items in order of use recency
|
1443
1447
|
this[LENGTH] = 0; // length of items in the list
|
1444
1448
|
}
|
1445
|
-
|
1446
1449
|
dump() {
|
1447
1450
|
return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {
|
1448
1451
|
k: hit.key,
|
@@ -1597,22 +1600,23 @@
|
|
1597
1600
|
};
|
1598
1601
|
var lruCache = LRUCache;
|
1599
1602
|
|
1600
|
-
// parse out just the options we care about
|
1601
|
-
|
1602
|
-
const opts = ['includePrerelease', 'loose', 'rtl'];
|
1603
|
-
const parseOptions$1 = options => !options ? {} : typeof options !== 'object' ? {
|
1603
|
+
// parse out just the options we care about
|
1604
|
+
const looseOption = Object.freeze({
|
1604
1605
|
loose: true
|
1605
|
-
}
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1606
|
+
});
|
1607
|
+
const emptyOpts = Object.freeze({});
|
1608
|
+
const parseOptions$1 = options => {
|
1609
|
+
if (!options) {
|
1610
|
+
return emptyOpts;
|
1611
|
+
}
|
1612
|
+
if (typeof options !== 'object') {
|
1613
|
+
return looseOption;
|
1614
|
+
}
|
1615
|
+
return options;
|
1616
|
+
};
|
1609
1617
|
var parseOptions_1 = parseOptions$1;
|
1610
1618
|
|
1611
|
-
var
|
1612
|
-
var re$1 = {
|
1613
|
-
get exports(){ return reExports; },
|
1614
|
-
set exports(v){ reExports = v; },
|
1615
|
-
};
|
1619
|
+
var re$1 = {exports: {}};
|
1616
1620
|
|
1617
1621
|
// Note: this is the semver.org version of the spec that it implements
|
1618
1622
|
// Not necessarily the package version of this code.
|
@@ -1622,39 +1626,63 @@
|
|
1622
1626
|
|
1623
1627
|
// Max safe segment length for coercion.
|
1624
1628
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
1629
|
+
|
1630
|
+
// Max safe length for a build identifier. The max length minus 6 characters for
|
1631
|
+
// the shortest version with a build 0.0.0+BUILD.
|
1632
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
1633
|
+
const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
|
1625
1634
|
var constants = {
|
1626
|
-
SEMVER_SPEC_VERSION,
|
1627
1635
|
MAX_LENGTH: MAX_LENGTH$1,
|
1636
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
1637
|
+
MAX_SAFE_BUILD_LENGTH,
|
1628
1638
|
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
1629
|
-
|
1639
|
+
RELEASE_TYPES,
|
1640
|
+
SEMVER_SPEC_VERSION,
|
1641
|
+
FLAG_INCLUDE_PRERELEASE: 0b001,
|
1642
|
+
FLAG_LOOSE: 0b010
|
1630
1643
|
};
|
1631
1644
|
|
1632
|
-
const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ?
|
1633
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
1634
|
-
args[_key] = arguments[_key];
|
1635
|
-
}
|
1636
|
-
return console.error('SEMVER', ...args);
|
1637
|
-
} : () => {};
|
1645
|
+
const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
|
1638
1646
|
var debug_1 = debug$1;
|
1639
1647
|
|
1640
1648
|
(function (module, exports) {
|
1641
1649
|
const {
|
1642
|
-
MAX_SAFE_COMPONENT_LENGTH
|
1650
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
1651
|
+
MAX_SAFE_BUILD_LENGTH,
|
1652
|
+
MAX_LENGTH
|
1643
1653
|
} = constants;
|
1644
1654
|
const debug = debug_1;
|
1645
1655
|
exports = module.exports = {};
|
1646
1656
|
|
1647
1657
|
// The actual regexps go on exports.re
|
1648
1658
|
const re = exports.re = [];
|
1659
|
+
const safeRe = exports.safeRe = [];
|
1649
1660
|
const src = exports.src = [];
|
1650
1661
|
const t = exports.t = {};
|
1651
1662
|
let R = 0;
|
1663
|
+
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
1664
|
+
|
1665
|
+
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
1666
|
+
// used internally via the safeRe object since all inputs in this library get
|
1667
|
+
// normalized first to trim and collapse all extra whitespace. The original
|
1668
|
+
// regexes are exported for userland consumption and lower level usage. A
|
1669
|
+
// future breaking change could export the safer regex only with a note that
|
1670
|
+
// all input should have extra whitespace removed.
|
1671
|
+
const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
|
1672
|
+
const makeSafeRegex = value => {
|
1673
|
+
for (const [token, max] of safeRegexReplacements) {
|
1674
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
1675
|
+
}
|
1676
|
+
return value;
|
1677
|
+
};
|
1652
1678
|
const createToken = (name, value, isGlobal) => {
|
1679
|
+
const safe = makeSafeRegex(value);
|
1653
1680
|
const index = R++;
|
1654
1681
|
debug(name, index, value);
|
1655
1682
|
t[name] = index;
|
1656
1683
|
src[index] = value;
|
1657
1684
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
1685
|
+
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
|
1658
1686
|
};
|
1659
1687
|
|
1660
1688
|
// The following Regular Expressions can be used for tokenizing,
|
@@ -1664,13 +1692,13 @@
|
|
1664
1692
|
// A single `0`, or a non-zero digit followed by zero or more digits.
|
1665
1693
|
|
1666
1694
|
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
1667
|
-
createToken('NUMERICIDENTIFIERLOOSE', '
|
1695
|
+
createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
|
1668
1696
|
|
1669
1697
|
// ## Non-numeric Identifier
|
1670
1698
|
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
1671
1699
|
// more letters, digits, or hyphens.
|
1672
1700
|
|
1673
|
-
createToken('NONNUMERICIDENTIFIER',
|
1701
|
+
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
1674
1702
|
|
1675
1703
|
// ## Main Version
|
1676
1704
|
// Three dot-separated numeric identifiers.
|
@@ -1694,7 +1722,7 @@
|
|
1694
1722
|
// ## Build Metadata Identifier
|
1695
1723
|
// Any combination of digits, letters, or hyphens.
|
1696
1724
|
|
1697
|
-
createToken('BUILDIDENTIFIER',
|
1725
|
+
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
|
1698
1726
|
|
1699
1727
|
// ## Build Metadata
|
1700
1728
|
// Plus sign, followed by one or more period-separated build metadata
|
@@ -1733,8 +1761,11 @@
|
|
1733
1761
|
|
1734
1762
|
// Coercion.
|
1735
1763
|
// Extract anything that could conceivably be a part of a valid semver
|
1736
|
-
createToken('
|
1764
|
+
createToken('COERCEPLAIN', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
1765
|
+
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
1766
|
+
createToken('COERCEFULL', src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
1737
1767
|
createToken('COERCERTL', src[t.COERCE], true);
|
1768
|
+
createToken('COERCERTLFULL', src[t.COERCEFULL], true);
|
1738
1769
|
|
1739
1770
|
// Tilde ranges.
|
1740
1771
|
// Meaning is "reasonably at or greater than"
|
@@ -1773,7 +1804,8 @@
|
|
1773
1804
|
// >=0.0.0 is like a star
|
1774
1805
|
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
1775
1806
|
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
1776
|
-
})(re$1,
|
1807
|
+
})(re$1, re$1.exports);
|
1808
|
+
var reExports = re$1.exports;
|
1777
1809
|
|
1778
1810
|
const numeric = /^[0-9]+$/;
|
1779
1811
|
const compareIdentifiers$1 = (a, b) => {
|
@@ -1797,7 +1829,7 @@
|
|
1797
1829
|
MAX_SAFE_INTEGER
|
1798
1830
|
} = constants;
|
1799
1831
|
const {
|
1800
|
-
re,
|
1832
|
+
safeRe: re,
|
1801
1833
|
t
|
1802
1834
|
} = reExports;
|
1803
1835
|
const parseOptions = parseOptions_1;
|
@@ -1814,7 +1846,7 @@
|
|
1814
1846
|
version = version.version;
|
1815
1847
|
}
|
1816
1848
|
} else if (typeof version !== 'string') {
|
1817
|
-
throw new TypeError(`Invalid
|
1849
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
1818
1850
|
}
|
1819
1851
|
if (version.length > MAX_LENGTH) {
|
1820
1852
|
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
@@ -1947,36 +1979,36 @@
|
|
1947
1979
|
|
1948
1980
|
// preminor will bump the version up to the next minor release, and immediately
|
1949
1981
|
// down to pre-release. premajor and prepatch work the same way.
|
1950
|
-
inc(release, identifier) {
|
1982
|
+
inc(release, identifier, identifierBase) {
|
1951
1983
|
switch (release) {
|
1952
1984
|
case 'premajor':
|
1953
1985
|
this.prerelease.length = 0;
|
1954
1986
|
this.patch = 0;
|
1955
1987
|
this.minor = 0;
|
1956
1988
|
this.major++;
|
1957
|
-
this.inc('pre', identifier);
|
1989
|
+
this.inc('pre', identifier, identifierBase);
|
1958
1990
|
break;
|
1959
1991
|
case 'preminor':
|
1960
1992
|
this.prerelease.length = 0;
|
1961
1993
|
this.patch = 0;
|
1962
1994
|
this.minor++;
|
1963
|
-
this.inc('pre', identifier);
|
1995
|
+
this.inc('pre', identifier, identifierBase);
|
1964
1996
|
break;
|
1965
1997
|
case 'prepatch':
|
1966
1998
|
// If this is already a prerelease, it will bump to the next version
|
1967
1999
|
// drop any prereleases that might already exist, since they are not
|
1968
2000
|
// relevant at this point.
|
1969
2001
|
this.prerelease.length = 0;
|
1970
|
-
this.inc('patch', identifier);
|
1971
|
-
this.inc('pre', identifier);
|
2002
|
+
this.inc('patch', identifier, identifierBase);
|
2003
|
+
this.inc('pre', identifier, identifierBase);
|
1972
2004
|
break;
|
1973
2005
|
// If the input is a non-prerelease version, this acts the same as
|
1974
2006
|
// prepatch.
|
1975
2007
|
case 'prerelease':
|
1976
2008
|
if (this.prerelease.length === 0) {
|
1977
|
-
this.inc('patch', identifier);
|
2009
|
+
this.inc('patch', identifier, identifierBase);
|
1978
2010
|
}
|
1979
|
-
this.inc('pre', identifier);
|
2011
|
+
this.inc('pre', identifier, identifierBase);
|
1980
2012
|
break;
|
1981
2013
|
case 'major':
|
1982
2014
|
// If this is a pre-major version, bump up to the same major version.
|
@@ -2014,38 +2046,53 @@
|
|
2014
2046
|
// This probably shouldn't be used publicly.
|
2015
2047
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
2016
2048
|
case 'pre':
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
while (--i >= 0) {
|
2022
|
-
if (typeof this.prerelease[i] === 'number') {
|
2023
|
-
this.prerelease[i]++;
|
2024
|
-
i = -2;
|
2025
|
-
}
|
2049
|
+
{
|
2050
|
+
const base = Number(identifierBase) ? 1 : 0;
|
2051
|
+
if (!identifier && identifierBase === false) {
|
2052
|
+
throw new Error('invalid increment argument: identifier is empty');
|
2026
2053
|
}
|
2027
|
-
if (
|
2028
|
-
|
2029
|
-
|
2054
|
+
if (this.prerelease.length === 0) {
|
2055
|
+
this.prerelease = [base];
|
2056
|
+
} else {
|
2057
|
+
let i = this.prerelease.length;
|
2058
|
+
while (--i >= 0) {
|
2059
|
+
if (typeof this.prerelease[i] === 'number') {
|
2060
|
+
this.prerelease[i]++;
|
2061
|
+
i = -2;
|
2062
|
+
}
|
2063
|
+
}
|
2064
|
+
if (i === -1) {
|
2065
|
+
// didn't increment anything
|
2066
|
+
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
2067
|
+
throw new Error('invalid increment argument: identifier already exists');
|
2068
|
+
}
|
2069
|
+
this.prerelease.push(base);
|
2070
|
+
}
|
2030
2071
|
}
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2072
|
+
if (identifier) {
|
2073
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
2074
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
2075
|
+
let prerelease = [identifier, base];
|
2076
|
+
if (identifierBase === false) {
|
2077
|
+
prerelease = [identifier];
|
2078
|
+
}
|
2079
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
2080
|
+
if (isNaN(this.prerelease[1])) {
|
2081
|
+
this.prerelease = prerelease;
|
2082
|
+
}
|
2083
|
+
} else {
|
2084
|
+
this.prerelease = prerelease;
|
2038
2085
|
}
|
2039
|
-
} else {
|
2040
|
-
this.prerelease = [identifier, 0];
|
2041
2086
|
}
|
2087
|
+
break;
|
2042
2088
|
}
|
2043
|
-
break;
|
2044
2089
|
default:
|
2045
2090
|
throw new Error(`invalid increment argument: ${release}`);
|
2046
2091
|
}
|
2047
|
-
this.format();
|
2048
|
-
this.
|
2092
|
+
this.raw = this.format();
|
2093
|
+
if (this.build.length) {
|
2094
|
+
this.raw += `+${this.build.join('.')}`;
|
2095
|
+
}
|
2049
2096
|
return this;
|
2050
2097
|
}
|
2051
2098
|
};
|
@@ -2143,6 +2190,7 @@
|
|
2143
2190
|
comp = comp.value;
|
2144
2191
|
}
|
2145
2192
|
}
|
2193
|
+
comp = comp.trim().split(/\s+/).join(' ');
|
2146
2194
|
debug('comparator', comp, options);
|
2147
2195
|
this.options = options;
|
2148
2196
|
this.loose = !!options.loose;
|
@@ -2193,12 +2241,6 @@
|
|
2193
2241
|
if (!(comp instanceof Comparator)) {
|
2194
2242
|
throw new TypeError('a Comparator is required');
|
2195
2243
|
}
|
2196
|
-
if (!options || typeof options !== 'object') {
|
2197
|
-
options = {
|
2198
|
-
loose: !!options,
|
2199
|
-
includePrerelease: false
|
2200
|
-
};
|
2201
|
-
}
|
2202
2244
|
if (this.operator === '') {
|
2203
2245
|
if (this.value === '') {
|
2204
2246
|
return true;
|
@@ -2210,19 +2252,43 @@
|
|
2210
2252
|
}
|
2211
2253
|
return new Range(this.value, options).test(comp.semver);
|
2212
2254
|
}
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2255
|
+
options = parseOptions(options);
|
2256
|
+
|
2257
|
+
// Special cases where nothing can possibly be lower
|
2258
|
+
if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
2259
|
+
return false;
|
2260
|
+
}
|
2261
|
+
if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
2262
|
+
return false;
|
2263
|
+
}
|
2264
|
+
|
2265
|
+
// Same direction increasing (> or >=)
|
2266
|
+
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
2267
|
+
return true;
|
2268
|
+
}
|
2269
|
+
// Same direction decreasing (< or <=)
|
2270
|
+
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
2271
|
+
return true;
|
2272
|
+
}
|
2273
|
+
// same SemVer and both sides are inclusive (<= or >=)
|
2274
|
+
if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
|
2275
|
+
return true;
|
2276
|
+
}
|
2277
|
+
// opposite directions less than
|
2278
|
+
if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
2279
|
+
return true;
|
2280
|
+
}
|
2281
|
+
// opposite directions greater than
|
2282
|
+
if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
2283
|
+
return true;
|
2284
|
+
}
|
2285
|
+
return false;
|
2220
2286
|
}
|
2221
2287
|
}
|
2222
2288
|
comparator = Comparator;
|
2223
2289
|
const parseOptions = parseOptions_1;
|
2224
2290
|
const {
|
2225
|
-
re,
|
2291
|
+
safeRe: re,
|
2226
2292
|
t
|
2227
2293
|
} = reExports;
|
2228
2294
|
const cmp = cmp_1;
|
@@ -2259,9 +2325,13 @@
|
|
2259
2325
|
this.loose = !!options.loose;
|
2260
2326
|
this.includePrerelease = !!options.includePrerelease;
|
2261
2327
|
|
2262
|
-
// First
|
2263
|
-
|
2264
|
-
|
2328
|
+
// First reduce all whitespace as much as possible so we do not have to rely
|
2329
|
+
// on potentially slow regexes like \s*. This is then stored and used for
|
2330
|
+
// future error messages as well.
|
2331
|
+
this.raw = range.trim().split(/\s+/).join(' ');
|
2332
|
+
|
2333
|
+
// First, split on ||
|
2334
|
+
this.set = this.raw.split('||')
|
2265
2335
|
// map the range to a 2d array of comparators
|
2266
2336
|
.map(r => this.parseRange(r.trim()))
|
2267
2337
|
// throw out any comparator lists that are empty
|
@@ -2269,7 +2339,7 @@
|
|
2269
2339
|
// in loose mode, but will still throw if the WHOLE range is invalid.
|
2270
2340
|
.filter(c => c.length);
|
2271
2341
|
if (!this.set.length) {
|
2272
|
-
throw new TypeError(`Invalid SemVer Range: ${
|
2342
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
2273
2343
|
}
|
2274
2344
|
|
2275
2345
|
// if we have any that are not the null set, throw out null sets.
|
@@ -2292,21 +2362,17 @@
|
|
2292
2362
|
this.format();
|
2293
2363
|
}
|
2294
2364
|
format() {
|
2295
|
-
this.range = this.set.map(comps =>
|
2296
|
-
return comps.join(' ').trim();
|
2297
|
-
}).join('||').trim();
|
2365
|
+
this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();
|
2298
2366
|
return this.range;
|
2299
2367
|
}
|
2300
2368
|
toString() {
|
2301
2369
|
return this.range;
|
2302
2370
|
}
|
2303
2371
|
parseRange(range) {
|
2304
|
-
range = range.trim();
|
2305
|
-
|
2306
2372
|
// memoize range parsing for performance.
|
2307
2373
|
// this is a very hot path, and fully deterministic.
|
2308
|
-
const memoOpts =
|
2309
|
-
const memoKey =
|
2374
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
2375
|
+
const memoKey = memoOpts + ':' + range;
|
2310
2376
|
const cached = cache.get(memoKey);
|
2311
2377
|
if (cached) {
|
2312
2378
|
return cached;
|
@@ -2316,18 +2382,18 @@
|
|
2316
2382
|
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
2317
2383
|
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
2318
2384
|
debug('hyphen replace', range);
|
2385
|
+
|
2319
2386
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
2320
2387
|
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
2321
2388
|
debug('comparator trim', range);
|
2322
2389
|
|
2323
2390
|
// `~ 1.2.3` => `~1.2.3`
|
2324
2391
|
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
2392
|
+
debug('tilde trim', range);
|
2325
2393
|
|
2326
2394
|
// `^ 1.2.3` => `^1.2.3`
|
2327
2395
|
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
2328
|
-
|
2329
|
-
// normalize spaces
|
2330
|
-
range = range.split(/\s+/).join(' ');
|
2396
|
+
debug('caret trim', range);
|
2331
2397
|
|
2332
2398
|
// At this point, the range is completely trimmed and
|
2333
2399
|
// ready to be split into comparators.
|
@@ -2407,12 +2473,16 @@
|
|
2407
2473
|
const debug = debug_1;
|
2408
2474
|
const SemVer = semver;
|
2409
2475
|
const {
|
2410
|
-
re,
|
2476
|
+
safeRe: re,
|
2411
2477
|
t,
|
2412
2478
|
comparatorTrimReplace,
|
2413
2479
|
tildeTrimReplace,
|
2414
2480
|
caretTrimReplace
|
2415
2481
|
} = reExports;
|
2482
|
+
const {
|
2483
|
+
FLAG_INCLUDE_PRERELEASE,
|
2484
|
+
FLAG_LOOSE
|
2485
|
+
} = constants;
|
2416
2486
|
const isNullSet = c => c.value === '<0.0.0-0';
|
2417
2487
|
const isAny = c => c.value === '';
|
2418
2488
|
|
@@ -2455,9 +2525,9 @@
|
|
2455
2525
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
2456
2526
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
2457
2527
|
// ~0.0.1 --> >=0.0.1 <0.1.0-0
|
2458
|
-
const replaceTildes = (comp, options) =>
|
2459
|
-
return replaceTilde(c, options);
|
2460
|
-
}
|
2528
|
+
const replaceTildes = (comp, options) => {
|
2529
|
+
return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
|
2530
|
+
};
|
2461
2531
|
const replaceTilde = (comp, options) => {
|
2462
2532
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
2463
2533
|
return comp.replace(r, (_, M, m, p, pr) => {
|
@@ -2490,9 +2560,9 @@
|
|
2490
2560
|
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
2491
2561
|
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
2492
2562
|
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
2493
|
-
const replaceCarets = (comp, options) =>
|
2494
|
-
return replaceCaret(c, options);
|
2495
|
-
}
|
2563
|
+
const replaceCarets = (comp, options) => {
|
2564
|
+
return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
|
2565
|
+
};
|
2496
2566
|
const replaceCaret = (comp, options) => {
|
2497
2567
|
debug('caret', comp, options);
|
2498
2568
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
@@ -2539,9 +2609,7 @@
|
|
2539
2609
|
};
|
2540
2610
|
const replaceXRanges = (comp, options) => {
|
2541
2611
|
debug('replaceXRanges', comp, options);
|
2542
|
-
return comp.split(/\s+/).map(c =>
|
2543
|
-
return replaceXRange(c, options);
|
2544
|
-
}).join(' ');
|
2612
|
+
return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
|
2545
2613
|
};
|
2546
2614
|
const replaceXRange = (comp, options) => {
|
2547
2615
|
comp = comp.trim();
|
@@ -2697,6 +2765,7 @@
|
|
2697
2765
|
return range.test(version);
|
2698
2766
|
};
|
2699
2767
|
var satisfies_1 = satisfies;
|
2768
|
+
var satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);
|
2700
2769
|
|
2701
2770
|
function adjustSpatial(item, encode, swap) {
|
2702
2771
|
let t;
|
@@ -2857,6 +2926,8 @@
|
|
2857
2926
|
test: (r, t) => RegExp(r).test(t)
|
2858
2927
|
};
|
2859
2928
|
const EventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'];
|
2929
|
+
const DisallowedMethods = new Set([Function, eval, setTimeout, setInterval]);
|
2930
|
+
if (typeof setImmediate === 'function') DisallowedMethods.add(setImmediate);
|
2860
2931
|
const Visitors = {
|
2861
2932
|
Literal: ($, n) => n.value,
|
2862
2933
|
Identifier: ($, n) => {
|
@@ -2869,17 +2940,24 @@
|
|
2869
2940
|
if (d) $.memberDepth += 1;
|
2870
2941
|
const p = $(n.property);
|
2871
2942
|
if (d) $.memberDepth -= 1;
|
2943
|
+
if (DisallowedMethods.has(o[p])) {
|
2944
|
+
// eslint-disable-next-line no-console
|
2945
|
+
console.error(`Prevented interpretation of member "${p}" which could lead to insecure code execution`);
|
2946
|
+
return;
|
2947
|
+
}
|
2872
2948
|
return o[p];
|
2873
2949
|
},
|
2874
2950
|
CallExpression: ($, n) => {
|
2875
2951
|
const args = n.arguments;
|
2876
|
-
let name = n.callee.name;
|
2877
|
-
// re-route to corresponding standard function
|
2952
|
+
let name = n.callee.name;
|
2878
2953
|
|
2954
|
+
// handle special internal functions used by encoders
|
2955
|
+
// re-route to corresponding standard function
|
2879
2956
|
if (name.startsWith('_')) {
|
2880
2957
|
name = name.slice(1);
|
2881
|
-
}
|
2958
|
+
}
|
2882
2959
|
|
2960
|
+
// special case "if" due to conditional evaluation of branches
|
2883
2961
|
return name === 'if' ? $(args[0]) ? $(args[1]) : $(args[2]) : ($.fn[name] || Functions[name]).apply($.fn, args.map($));
|
2884
2962
|
},
|
2885
2963
|
ArrayExpression: ($, n) => n.elements.map($),
|
@@ -2891,7 +2969,12 @@
|
|
2891
2969
|
$.memberDepth += 1;
|
2892
2970
|
const k = $(p.key);
|
2893
2971
|
$.memberDepth -= 1;
|
2894
|
-
|
2972
|
+
if (DisallowedMethods.has($(p.value))) {
|
2973
|
+
// eslint-disable-next-line no-console
|
2974
|
+
console.error(`Prevented interpretation of property "${k}" which could lead to insecure code execution`);
|
2975
|
+
} else {
|
2976
|
+
o[k] = $(p.value);
|
2977
|
+
}
|
2895
2978
|
return o;
|
2896
2979
|
}, {})
|
2897
2980
|
};
|
@@ -2902,8 +2985,9 @@
|
|
2902
2985
|
$.params = params;
|
2903
2986
|
$.datum = datum;
|
2904
2987
|
$.event = event;
|
2905
|
-
$.item = item;
|
2988
|
+
$.item = item;
|
2906
2989
|
|
2990
|
+
// route event functions to annotated vega event context
|
2907
2991
|
EventFunctions.forEach(f => $.fn[f] = function () {
|
2908
2992
|
return event.vega[f](...arguments);
|
2909
2993
|
});
|
@@ -2983,7 +3067,7 @@
|
|
2983
3067
|
}
|
2984
3068
|
|
2985
3069
|
var name$1 = "vega-themes";
|
2986
|
-
var version$1$1 = "2.
|
3070
|
+
var version$1$1 = "2.14.0";
|
2987
3071
|
var description$1 = "Themes for stylized Vega and Vega-Lite visualizations.";
|
2988
3072
|
var keywords$1 = ["vega", "vega-lite", "themes", "style"];
|
2989
3073
|
var license$1 = "BSD-3-Clause";
|
@@ -3024,28 +3108,39 @@
|
|
3024
3108
|
preversion: "yarn lint",
|
3025
3109
|
serve: "browser-sync start -s -f build examples --serveStatic examples",
|
3026
3110
|
start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
|
3027
|
-
|
3028
|
-
|
3029
|
-
format: "yarn eslintbase --fix",
|
3030
|
-
lint: "yarn eslintbase",
|
3111
|
+
format: "eslint . --fix",
|
3112
|
+
lint: "eslint .",
|
3031
3113
|
release: "release-it"
|
3032
3114
|
};
|
3033
3115
|
var devDependencies$1 = {
|
3034
|
-
"@
|
3116
|
+
"@babel/core": "^7.22.9",
|
3117
|
+
"@babel/plugin-proposal-async-generator-functions": "^7.20.7",
|
3118
|
+
"@babel/plugin-proposal-json-strings": "^7.18.6",
|
3119
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
3120
|
+
"@babel/plugin-proposal-optional-catch-binding": "^7.18.6",
|
3121
|
+
"@babel/plugin-transform-runtime": "^7.22.9",
|
3122
|
+
"@babel/preset-env": "^7.22.9",
|
3123
|
+
"@babel/preset-typescript": "^7.22.5",
|
3124
|
+
"@release-it/conventional-changelog": "^7.0.0",
|
3035
3125
|
"@rollup/plugin-json": "^6.0.0",
|
3036
|
-
"@rollup/plugin-node-resolve": "^15.0
|
3037
|
-
"@rollup/plugin-terser": "^0.4.
|
3038
|
-
"
|
3039
|
-
|
3126
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
3127
|
+
"@rollup/plugin-terser": "^0.4.3",
|
3128
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
3129
|
+
"@typescript-eslint/parser": "^6.0.0",
|
3130
|
+
"browser-sync": "^2.29.3",
|
3131
|
+
concurrently: "^8.2.0",
|
3132
|
+
eslint: "^8.45.0",
|
3133
|
+
"eslint-config-prettier": "^8.8.0",
|
3134
|
+
"eslint-plugin-prettier": "^5.0.0",
|
3040
3135
|
"gh-pages": "^5.0.0",
|
3041
|
-
|
3136
|
+
prettier: "^3.0.0",
|
3137
|
+
"release-it": "^16.1.0",
|
3138
|
+
rollup: "^3.26.2",
|
3042
3139
|
"rollup-plugin-bundle-size": "^1.0.3",
|
3043
|
-
"rollup-plugin-ts": "^3.0
|
3044
|
-
|
3045
|
-
|
3046
|
-
"vega-lite
|
3047
|
-
"vega-lite": "^5.0.0",
|
3048
|
-
vega: "^5.19.1"
|
3140
|
+
"rollup-plugin-ts": "^3.2.0",
|
3141
|
+
typescript: "^5.1.6",
|
3142
|
+
vega: "^5.25.0",
|
3143
|
+
"vega-lite": "^5.9.3"
|
3049
3144
|
};
|
3050
3145
|
var peerDependencies$1 = {
|
3051
3146
|
vega: "*",
|
@@ -3622,9 +3717,10 @@
|
|
3622
3717
|
* license that can be found in the LICENSE file or at
|
3623
3718
|
* https://developers.google.com/open-source/licenses/bsd
|
3624
3719
|
*/
|
3720
|
+
|
3625
3721
|
const markColor = '#3366CC';
|
3626
3722
|
const gridColor = '#ccc';
|
3627
|
-
const defaultFont = 'Arial, sans-serif';
|
3723
|
+
const defaultFont$1 = 'Arial, sans-serif';
|
3628
3724
|
const googlechartsTheme = {
|
3629
3725
|
arc: {
|
3630
3726
|
fill: markColor
|
@@ -3656,20 +3752,20 @@
|
|
3656
3752
|
},
|
3657
3753
|
style: {
|
3658
3754
|
'guide-label': {
|
3659
|
-
font: defaultFont,
|
3755
|
+
font: defaultFont$1,
|
3660
3756
|
fontSize: 12
|
3661
3757
|
},
|
3662
3758
|
'guide-title': {
|
3663
|
-
font: defaultFont,
|
3759
|
+
font: defaultFont$1,
|
3664
3760
|
fontSize: 12
|
3665
3761
|
},
|
3666
3762
|
'group-title': {
|
3667
|
-
font: defaultFont,
|
3763
|
+
font: defaultFont$1,
|
3668
3764
|
fontSize: 12
|
3669
3765
|
}
|
3670
3766
|
},
|
3671
3767
|
title: {
|
3672
|
-
font: defaultFont,
|
3768
|
+
font: defaultFont$1,
|
3673
3769
|
fontSize: 14,
|
3674
3770
|
fontWeight: 'bold',
|
3675
3771
|
dy: -3,
|
@@ -3807,10 +3903,107 @@
|
|
3807
3903
|
ordinal: ordinalPalette
|
3808
3904
|
}
|
3809
3905
|
};
|
3906
|
+
const defaultFont = 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif';
|
3907
|
+
const fontWeight = 400;
|
3908
|
+
const darkCategories = ['#8a3ffc', '#33b1ff', '#007d79', '#ff7eb6', '#fa4d56', '#fff1f1', '#6fdc8c', '#4589ff', '#d12771', '#d2a106', '#08bdba', '#bae6ff', '#ba4e00', '#d4bbff'];
|
3909
|
+
const lightCategories = ['#6929c4', '#1192e8', '#005d5d', '#9f1853', '#fa4d56', '#570408', '#198038', '#002d9c', '#ee538b', '#b28600', '#009d9a', '#012749', '#8a3800', '#a56eff'];
|
3910
|
+
function genCarbonConfig({
|
3911
|
+
type,
|
3912
|
+
background
|
3913
|
+
}) {
|
3914
|
+
const viewbg = type === 'dark' ? '#161616' : '#ffffff';
|
3915
|
+
const textColor = type === 'dark' ? '#f4f4f4' : '#161616';
|
3916
|
+
const category = type === 'dark' ? darkCategories : lightCategories;
|
3917
|
+
const markColor = type === 'dark' ? '#d4bbff' : '#6929c4';
|
3918
|
+
return {
|
3919
|
+
background,
|
3920
|
+
arc: {
|
3921
|
+
fill: markColor
|
3922
|
+
},
|
3923
|
+
area: {
|
3924
|
+
fill: markColor
|
3925
|
+
},
|
3926
|
+
path: {
|
3927
|
+
stroke: markColor
|
3928
|
+
},
|
3929
|
+
rect: {
|
3930
|
+
fill: markColor
|
3931
|
+
},
|
3932
|
+
shape: {
|
3933
|
+
stroke: markColor
|
3934
|
+
},
|
3935
|
+
symbol: {
|
3936
|
+
stroke: markColor
|
3937
|
+
},
|
3938
|
+
circle: {
|
3939
|
+
fill: markColor
|
3940
|
+
},
|
3941
|
+
view: {
|
3942
|
+
fill: viewbg,
|
3943
|
+
stroke: viewbg
|
3944
|
+
},
|
3945
|
+
group: {
|
3946
|
+
fill: viewbg
|
3947
|
+
},
|
3948
|
+
title: {
|
3949
|
+
color: textColor,
|
3950
|
+
anchor: 'start',
|
3951
|
+
dy: -15,
|
3952
|
+
fontSize: 16,
|
3953
|
+
font: defaultFont,
|
3954
|
+
fontWeight: 600
|
3955
|
+
},
|
3956
|
+
axis: {
|
3957
|
+
labelColor: textColor,
|
3958
|
+
labelFontSize: 12,
|
3959
|
+
grid: true,
|
3960
|
+
gridColor: '#525252',
|
3961
|
+
titleColor: textColor,
|
3962
|
+
labelAngle: 0
|
3963
|
+
},
|
3964
|
+
style: {
|
3965
|
+
'guide-label': {
|
3966
|
+
font: defaultFont,
|
3967
|
+
fill: textColor,
|
3968
|
+
fontWeight: fontWeight
|
3969
|
+
},
|
3970
|
+
'guide-title': {
|
3971
|
+
font: defaultFont,
|
3972
|
+
fill: textColor,
|
3973
|
+
fontWeight: fontWeight
|
3974
|
+
}
|
3975
|
+
},
|
3976
|
+
range: {
|
3977
|
+
category,
|
3978
|
+
diverging: ['#750e13', '#a2191f', '#da1e28', '#fa4d56', '#ff8389', '#ffb3b8', '#ffd7d9', '#fff1f1', '#e5f6ff', '#bae6ff', '#82cfff', '#33b1ff', '#1192e8', '#0072c3', '#00539a', '#003a6d'],
|
3979
|
+
heatmap: ['#f6f2ff', '#e8daff', '#d4bbff', '#be95ff', '#a56eff', '#8a3ffc', '#6929c4', '#491d8b', '#31135e', '#1c0f30']
|
3980
|
+
}
|
3981
|
+
};
|
3982
|
+
}
|
3983
|
+
const carbonwhite = genCarbonConfig({
|
3984
|
+
type: 'light',
|
3985
|
+
background: '#ffffff'
|
3986
|
+
});
|
3987
|
+
const carbong10 = genCarbonConfig({
|
3988
|
+
type: 'light',
|
3989
|
+
background: '#f4f4f4'
|
3990
|
+
});
|
3991
|
+
const carbong90 = genCarbonConfig({
|
3992
|
+
type: 'dark',
|
3993
|
+
background: '#262626'
|
3994
|
+
});
|
3995
|
+
const carbong100 = genCarbonConfig({
|
3996
|
+
type: 'dark',
|
3997
|
+
background: '#161616'
|
3998
|
+
});
|
3810
3999
|
const version$2 = pkg$1.version;
|
3811
4000
|
|
3812
4001
|
var themes = /*#__PURE__*/Object.freeze({
|
3813
4002
|
__proto__: null,
|
4003
|
+
carbong10: carbong10,
|
4004
|
+
carbong100: carbong100,
|
4005
|
+
carbong90: carbong90,
|
4006
|
+
carbonwhite: carbonwhite,
|
3814
4007
|
dark: darkTheme,
|
3815
4008
|
excel: excelTheme,
|
3816
4009
|
fivethirtyeight: fiveThirtyEightTheme,
|
@@ -3865,8 +4058,7 @@
|
|
3865
4058
|
for (i = j = 0; j < n; ++j) {
|
3866
4059
|
c = p[j];
|
3867
4060
|
if (c === '\\') {
|
3868
|
-
s += p.substring(i, j);
|
3869
|
-
s += p.substring(++j, ++j);
|
4061
|
+
s += p.substring(i, j++);
|
3870
4062
|
i = j;
|
3871
4063
|
} else if (c === q) {
|
3872
4064
|
push();
|
@@ -3923,59 +4115,35 @@
|
|
3923
4115
|
return typeof _ === 'string';
|
3924
4116
|
}
|
3925
4117
|
|
3926
|
-
/******************************************************************************
|
3927
|
-
Copyright (c) Microsoft Corporation.
|
3928
|
-
|
3929
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
3930
|
-
purpose with or without fee is hereby granted.
|
3931
|
-
|
3932
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
3933
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
3934
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
3935
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
3936
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
3937
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
3938
|
-
PERFORMANCE OF THIS SOFTWARE.
|
3939
|
-
***************************************************************************** */
|
3940
|
-
|
3941
|
-
function __rest(s, e) {
|
3942
|
-
var t = {};
|
3943
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
3944
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
3945
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
3946
|
-
}
|
3947
|
-
return t;
|
3948
|
-
}
|
3949
|
-
|
3950
4118
|
/**
|
3951
4119
|
* Format the value to be shown in the tooltip.
|
3952
4120
|
*
|
3953
4121
|
* @param value The value to show in the tooltip.
|
3954
4122
|
* @param valueToHtml Function to convert a single cell value to an HTML string
|
3955
4123
|
*/
|
3956
|
-
function formatValue(value, valueToHtml, maxDepth) {
|
4124
|
+
function formatValue(value, valueToHtml, maxDepth, baseURL) {
|
3957
4125
|
if (isArray(value)) {
|
3958
4126
|
return `[${value.map(v => valueToHtml(isString(v) ? v : stringify(v, maxDepth))).join(', ')}]`;
|
3959
4127
|
}
|
3960
4128
|
if (isObject(value)) {
|
3961
4129
|
let content = '';
|
3962
|
-
const
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
|
3967
|
-
rest = __rest(_a, ["title", "image"]);
|
4130
|
+
const {
|
4131
|
+
title,
|
4132
|
+
image,
|
4133
|
+
...rest
|
4134
|
+
} = value;
|
3968
4135
|
if (title) {
|
3969
4136
|
content += `<h2>${valueToHtml(title)}</h2>`;
|
3970
4137
|
}
|
3971
4138
|
if (image) {
|
3972
|
-
content += `<img src="${valueToHtml(image)}">`;
|
4139
|
+
content += `<img src="${new URL(valueToHtml(image), baseURL || location.href).href}">`;
|
3973
4140
|
}
|
3974
4141
|
const keys = Object.keys(rest);
|
3975
4142
|
if (keys.length > 0) {
|
3976
4143
|
content += '<table>';
|
3977
4144
|
for (const key of keys) {
|
3978
4145
|
let val = rest[key];
|
4146
|
+
|
3979
4147
|
// ignore undefined properties
|
3980
4148
|
if (val === undefined) {
|
3981
4149
|
continue;
|
@@ -3983,13 +4151,12 @@
|
|
3983
4151
|
if (isObject(val)) {
|
3984
4152
|
val = stringify(val, maxDepth);
|
3985
4153
|
}
|
3986
|
-
content += `<tr><td class="key">${valueToHtml(key)}
|
4154
|
+
content += `<tr><td class="key">${valueToHtml(key)}</td><td class="value">${valueToHtml(val)}</td></tr>`;
|
3987
4155
|
}
|
3988
4156
|
content += `</table>`;
|
3989
4157
|
}
|
3990
4158
|
return content || '{}'; // show empty object if there are no properties
|
3991
4159
|
}
|
3992
|
-
|
3993
4160
|
return valueToHtml(value);
|
3994
4161
|
}
|
3995
4162
|
function replacer(maxDepth) {
|
@@ -4010,6 +4177,7 @@
|
|
4010
4177
|
return value;
|
4011
4178
|
};
|
4012
4179
|
}
|
4180
|
+
|
4013
4181
|
/**
|
4014
4182
|
* Stringify any JS object to valid JSON
|
4015
4183
|
*/
|
@@ -4040,10 +4208,6 @@
|
|
4040
4208
|
margin-bottom: 10px;
|
4041
4209
|
font-size: 13px;
|
4042
4210
|
}
|
4043
|
-
#vg-tooltip-element img {
|
4044
|
-
max-width: 200px;
|
4045
|
-
max-height: 200px;
|
4046
|
-
}
|
4047
4211
|
#vg-tooltip-element table {
|
4048
4212
|
border-spacing: 0;
|
4049
4213
|
}
|
@@ -4119,9 +4283,14 @@
|
|
4119
4283
|
* A function to customize the rendered HTML of the tooltip.
|
4120
4284
|
* @param value A value string, or object of value strings keyed by field
|
4121
4285
|
* @param sanitize The `sanitize` function from `options.sanitize`
|
4286
|
+
* @param baseURL The `baseURL` from `options.baseURL`
|
4122
4287
|
* @returns {string} The returned string will become the `innerHTML` of the tooltip element
|
4123
4288
|
*/
|
4124
|
-
formatTooltip: formatValue
|
4289
|
+
formatTooltip: formatValue,
|
4290
|
+
/**
|
4291
|
+
* The baseurl to use in image paths.
|
4292
|
+
*/
|
4293
|
+
baseURL: ''
|
4125
4294
|
};
|
4126
4295
|
/**
|
4127
4296
|
* Escape special HTML characters.
|
@@ -4166,17 +4335,34 @@
|
|
4166
4335
|
* The tooltip handler class.
|
4167
4336
|
*/
|
4168
4337
|
class Handler {
|
4338
|
+
/**
|
4339
|
+
* The handler function. We bind this to this function in the constructor.
|
4340
|
+
*/
|
4341
|
+
|
4342
|
+
/**
|
4343
|
+
* Complete tooltip options.
|
4344
|
+
*/
|
4345
|
+
|
4346
|
+
/**
|
4347
|
+
* The tooltip html element.
|
4348
|
+
*/
|
4349
|
+
|
4169
4350
|
/**
|
4170
4351
|
* Create the tooltip handler and initialize the element and style.
|
4171
4352
|
*
|
4172
4353
|
* @param options Tooltip Options
|
4173
4354
|
*/
|
4174
4355
|
constructor(options) {
|
4175
|
-
this.options =
|
4356
|
+
this.options = {
|
4357
|
+
...DEFAULT_OPTIONS,
|
4358
|
+
...options
|
4359
|
+
};
|
4176
4360
|
const elementId = this.options.id;
|
4177
4361
|
this.el = null;
|
4362
|
+
|
4178
4363
|
// bind this to call
|
4179
4364
|
this.call = this.tooltipHandler.bind(this);
|
4365
|
+
|
4180
4366
|
// prepend a default stylesheet for tooltips to the head
|
4181
4367
|
if (!this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {
|
4182
4368
|
const style = document.createElement('style');
|
@@ -4190,28 +4376,32 @@
|
|
4190
4376
|
}
|
4191
4377
|
}
|
4192
4378
|
}
|
4379
|
+
|
4193
4380
|
/**
|
4194
4381
|
* The tooltip handler function.
|
4195
4382
|
*/
|
4196
4383
|
tooltipHandler(handler, event, item, value) {
|
4197
4384
|
// console.log(handler, event, item, value);
|
4198
|
-
|
4385
|
+
|
4199
4386
|
// append a div element that we use as a tooltip unless it already exists
|
4200
4387
|
this.el = document.getElementById(this.options.id);
|
4201
4388
|
if (!this.el) {
|
4202
4389
|
this.el = document.createElement('div');
|
4203
4390
|
this.el.setAttribute('id', this.options.id);
|
4204
4391
|
this.el.classList.add('vg-tooltip');
|
4205
|
-
const tooltipContainer =
|
4392
|
+
const tooltipContainer = document.fullscreenElement ?? document.body;
|
4206
4393
|
tooltipContainer.appendChild(this.el);
|
4207
4394
|
}
|
4395
|
+
|
4208
4396
|
// hide tooltip for null, undefined, or empty string values
|
4209
4397
|
if (value == null || value === '') {
|
4210
4398
|
this.el.classList.remove('visible', `${this.options.theme}-theme`);
|
4211
4399
|
return;
|
4212
4400
|
}
|
4401
|
+
|
4213
4402
|
// set the tooltip content
|
4214
|
-
this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth);
|
4403
|
+
this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth, this.options.baseURL);
|
4404
|
+
|
4215
4405
|
// make the tooltip visible
|
4216
4406
|
this.el.classList.add('visible', `${this.options.theme}-theme`);
|
4217
4407
|
const {
|
@@ -4378,20 +4568,10 @@
|
|
4378
4568
|
}
|
4379
4569
|
`;
|
4380
4570
|
|
4381
|
-
// polyfill for IE
|
4382
|
-
if (!String.prototype.startsWith) {
|
4383
|
-
// eslint-disable-next-line no-extend-native,func-names
|
4384
|
-
String.prototype.startsWith = function (search, pos) {
|
4385
|
-
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
4386
|
-
};
|
4387
|
-
}
|
4388
4571
|
function isURL(s) {
|
4389
4572
|
return s.startsWith('http://') || s.startsWith('https://') || s.startsWith('//');
|
4390
4573
|
}
|
4391
|
-
function mergeDeep(dest) {
|
4392
|
-
for (var _len = arguments.length, src = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
4393
|
-
src[_key - 1] = arguments[_key];
|
4394
|
-
}
|
4574
|
+
function mergeDeep(dest, ...src) {
|
4395
4575
|
for (const s of src) {
|
4396
4576
|
deepMerge_(dest, s);
|
4397
4577
|
}
|
@@ -4404,7 +4584,7 @@
|
|
4404
4584
|
}
|
4405
4585
|
|
4406
4586
|
var name = "vega-embed";
|
4407
|
-
var version$1 = "6.
|
4587
|
+
var version$1 = "6.25.0";
|
4408
4588
|
var description = "Publish Vega visualizations as embedded web components.";
|
4409
4589
|
var keywords = ["vega", "data", "visualization", "component", "embed"];
|
4410
4590
|
var repository = {
|
@@ -4429,31 +4609,41 @@
|
|
4429
4609
|
var unpkg = "build/vega-embed.min.js";
|
4430
4610
|
var jsdelivr = "build/vega-embed.min.js";
|
4431
4611
|
var types = "build/vega-embed.module.d.ts";
|
4432
|
-
var files = ["src", "build"
|
4612
|
+
var files = ["src", "build"];
|
4433
4613
|
var devDependencies = {
|
4434
|
-
"@babel/
|
4435
|
-
"@
|
4436
|
-
"@
|
4437
|
-
"@
|
4438
|
-
"@
|
4439
|
-
"@rollup/plugin-
|
4440
|
-
"@
|
4441
|
-
"
|
4442
|
-
|
4443
|
-
"
|
4444
|
-
"
|
4445
|
-
"
|
4446
|
-
"
|
4614
|
+
"@babel/core": "^7.24.4",
|
4615
|
+
"@babel/plugin-transform-runtime": "^7.24.3",
|
4616
|
+
"@babel/preset-env": "^7.24.4",
|
4617
|
+
"@babel/preset-typescript": "^7.24.1",
|
4618
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
4619
|
+
"@rollup/plugin-commonjs": "25.0.7",
|
4620
|
+
"@rollup/plugin-json": "^6.1.0",
|
4621
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
4622
|
+
"@rollup/plugin-terser": "^0.4.4",
|
4623
|
+
"@types/jest": "^29.5.12",
|
4624
|
+
"@types/semver": "^7.5.8",
|
4625
|
+
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
4626
|
+
"@typescript-eslint/parser": "^7.6.0",
|
4627
|
+
"browser-sync": "^3.0.2",
|
4628
|
+
concurrently: "^8.2.2",
|
4629
|
+
"del-cli": "^5.1.0",
|
4630
|
+
eslint: "^8.56.0",
|
4631
|
+
"eslint-config-prettier": "^9.1.0",
|
4632
|
+
"eslint-plugin-jest": "^28.2.0",
|
4633
|
+
"eslint-plugin-prettier": "^5.1.3",
|
4634
|
+
jest: "^29.7.0",
|
4635
|
+
"jest-canvas-mock": "^2.5.2",
|
4636
|
+
"jest-environment-jsdom": "^29.7.0",
|
4447
4637
|
"postinstall-postinstall": "^2.1.0",
|
4448
|
-
|
4638
|
+
prettier: "^3.2.5",
|
4639
|
+
"release-it": "^17.1.1",
|
4640
|
+
rollup: "4.14.1",
|
4449
4641
|
"rollup-plugin-bundle-size": "^1.0.3",
|
4450
|
-
"rollup-plugin-ts": "^3.
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
"vega-lite
|
4455
|
-
"vega-lite": "^5.2.0",
|
4456
|
-
vega: "^5.22.1"
|
4642
|
+
"rollup-plugin-ts": "^3.4.5",
|
4643
|
+
sass: "^1.74.1",
|
4644
|
+
typescript: "^5.4.5",
|
4645
|
+
vega: "^5.22.1",
|
4646
|
+
"vega-lite": "^5.2.0"
|
4457
4647
|
};
|
4458
4648
|
var peerDependencies = {
|
4459
4649
|
vega: "^5.21.0",
|
@@ -4462,31 +4652,28 @@
|
|
4462
4652
|
var dependencies = {
|
4463
4653
|
"fast-json-patch": "^3.1.1",
|
4464
4654
|
"json-stringify-pretty-compact": "^3.0.0",
|
4465
|
-
semver: "^7.
|
4466
|
-
tslib: "^2.
|
4467
|
-
"vega-interpreter": "^1.0.
|
4655
|
+
semver: "^7.6.0",
|
4656
|
+
tslib: "^2.6.2",
|
4657
|
+
"vega-interpreter": "^1.0.5",
|
4468
4658
|
"vega-schema-url-parser": "^2.2.0",
|
4469
|
-
"vega-themes": "^2.
|
4470
|
-
"vega-tooltip": "^0.
|
4659
|
+
"vega-themes": "^2.14.0",
|
4660
|
+
"vega-tooltip": "^0.34.0"
|
4471
4661
|
};
|
4472
|
-
var bundledDependencies = ["yallist"];
|
4473
4662
|
var scripts = {
|
4474
4663
|
prebuild: "yarn clean && yarn build:style",
|
4475
4664
|
build: "rollup -c",
|
4476
4665
|
"build:style": "./build-style.sh",
|
4477
|
-
clean: "del-cli build
|
4666
|
+
clean: "del-cli build src/style.ts",
|
4478
4667
|
prepublishOnly: "yarn clean && yarn build",
|
4479
4668
|
preversion: "yarn lint && yarn test",
|
4480
4669
|
serve: "browser-sync start --directory -s -f build *.html",
|
4481
4670
|
start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
|
4482
4671
|
pretest: "yarn build:style",
|
4483
|
-
test: "
|
4672
|
+
test: "jest",
|
4484
4673
|
"test:inspect": "node --inspect-brk ./node_modules/.bin/jest --runInBand",
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
format: "yarn eslintbase --fix && yarn prettierbase --write",
|
4489
|
-
lint: "yarn eslintbase && yarn prettierbase --check",
|
4674
|
+
prettierbase: "prettier '*.{css,scss,html}'",
|
4675
|
+
format: "eslint . --fix && yarn prettierbase --write",
|
4676
|
+
lint: "eslint . && yarn prettierbase --check",
|
4490
4677
|
release: "release-it"
|
4491
4678
|
};
|
4492
4679
|
var pkg = {
|
@@ -4509,18 +4696,16 @@
|
|
4509
4696
|
devDependencies: devDependencies,
|
4510
4697
|
peerDependencies: peerDependencies,
|
4511
4698
|
dependencies: dependencies,
|
4512
|
-
bundledDependencies: bundledDependencies,
|
4513
4699
|
scripts: scripts
|
4514
4700
|
};
|
4515
4701
|
|
4516
|
-
var _w$vl;
|
4517
4702
|
const version = pkg.version;
|
4518
4703
|
const vega = vegaImport__namespace;
|
4519
4704
|
let vegaLite = vegaLiteImport__namespace;
|
4520
4705
|
|
4521
4706
|
// For backwards compatibility with Vega-Lite before v4.
|
4522
4707
|
const w = typeof window !== 'undefined' ? window : undefined;
|
4523
|
-
if (vegaLite === undefined && w
|
4708
|
+
if (vegaLite === undefined && w?.vl?.compile) {
|
4524
4709
|
vegaLite = w.vl;
|
4525
4710
|
}
|
4526
4711
|
const DEFAULT_ACTIONS = {
|
@@ -4586,7 +4771,7 @@
|
|
4586
4771
|
console.warn(`The given visualization spec is written in ${NAMES[parsed.library]}, but mode argument sets ${NAMES[providedMode] ?? providedMode}.`);
|
4587
4772
|
}
|
4588
4773
|
const mode = parsed.library;
|
4589
|
-
if (!
|
4774
|
+
if (!satisfies$1(VERSION[mode], `^${parsed.version.slice(1)}`)) {
|
4590
4775
|
console.warn(`The input spec uses ${NAMES[mode]} ${parsed.version}, but the current version of ${NAMES[mode]} is v${VERSION[mode]}.`);
|
4591
4776
|
}
|
4592
4777
|
return mode;
|
@@ -4608,8 +4793,7 @@
|
|
4608
4793
|
return isLoader(opts) ? opts : vega.loader(opts);
|
4609
4794
|
}
|
4610
4795
|
function embedOptionsFromUsermeta(parsedSpec) {
|
4611
|
-
|
4612
|
-
const opts = ((_parsedSpec$usermeta = parsedSpec.usermeta) === null || _parsedSpec$usermeta === void 0 ? void 0 : _parsedSpec$usermeta.embedOptions) ?? {};
|
4796
|
+
const opts = parsedSpec.usermeta?.embedOptions ?? {};
|
4613
4797
|
if (vegaImport.isString(opts.defaultStyle)) {
|
4614
4798
|
// we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)
|
4615
4799
|
opts.defaultStyle = false;
|
@@ -4625,8 +4809,7 @@
|
|
4625
4809
|
* Object : The Vega/Vega-Lite specification as a parsed JSON object.
|
4626
4810
|
* @param opts A JavaScript object containing options for embedding.
|
4627
4811
|
*/
|
4628
|
-
async function embed(el, spec) {
|
4629
|
-
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
4812
|
+
async function embed(el, spec, opts = {}) {
|
4630
4813
|
let parsedSpec;
|
4631
4814
|
let loader;
|
4632
4815
|
if (vegaImport.isString(spec)) {
|
@@ -4673,9 +4856,7 @@
|
|
4673
4856
|
rootContainer: document.head ?? document.body
|
4674
4857
|
};
|
4675
4858
|
}
|
4676
|
-
async function _embed(el, spec) {
|
4677
|
-
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
4678
|
-
let loader = arguments.length > 3 ? arguments[3] : undefined;
|
4859
|
+
async function _embed(el, spec, opts = {}, loader) {
|
4679
4860
|
const config = opts.theme ? vegaImport.mergeConfig(themes[opts.theme], opts.config ?? {}) : opts.config;
|
4680
4861
|
const actions = vegaImport.isBoolean(opts.actions) ? opts.actions : mergeDeep({}, DEFAULT_ACTIONS, opts.actions ?? {});
|
4681
4862
|
const i18n = {
|
@@ -4707,7 +4888,7 @@
|
|
4707
4888
|
if (mode === 'vega-lite') {
|
4708
4889
|
if (vgSpec.$schema) {
|
4709
4890
|
const parsed = e(vgSpec.$schema);
|
4710
|
-
if (!
|
4891
|
+
if (!satisfies$1(VERSION.vega, `^${parsed.version.slice(1)}`)) {
|
4711
4892
|
console.warn(`The compiled spec uses Vega ${parsed.version}, but current version is v${VERSION.vega}.`);
|
4712
4893
|
}
|
4713
4894
|
}
|
@@ -4783,9 +4964,17 @@
|
|
4783
4964
|
}
|
4784
4965
|
});
|
4785
4966
|
if (opts.tooltip !== false) {
|
4786
|
-
const
|
4967
|
+
const {
|
4968
|
+
loader: loader_,
|
4969
|
+
tooltip
|
4970
|
+
} = opts;
|
4971
|
+
const baseURL = loader_ && !isLoader(loader_) ? loader_?.baseURL : undefined;
|
4972
|
+
const handler = isTooltipHandler(tooltip) ? tooltip :
|
4787
4973
|
// user provided boolean true or tooltip options
|
4788
|
-
new Handler(
|
4974
|
+
new Handler({
|
4975
|
+
baseURL,
|
4976
|
+
...(tooltip === true ? {} : tooltip)
|
4977
|
+
}).call;
|
4789
4978
|
view.tooltip(handler);
|
4790
4979
|
}
|
4791
4980
|
let {
|
@@ -4816,7 +5005,7 @@
|
|
4816
5005
|
let documentClickHandler;
|
4817
5006
|
if (actions !== false) {
|
4818
5007
|
let wrapper = element;
|
4819
|
-
if (opts.defaultStyle !== false) {
|
5008
|
+
if (opts.defaultStyle !== false || opts.forceActionsMenu) {
|
4820
5009
|
const details = document.createElement('details');
|
4821
5010
|
details.title = i18n.CLICK_TO_VIEW_ACTIONS;
|
4822
5011
|
element.append(details);
|
@@ -4863,7 +5052,7 @@
|
|
4863
5052
|
viewSourceLink.text = i18n.SOURCE_ACTION;
|
4864
5053
|
viewSourceLink.href = '#';
|
4865
5054
|
viewSourceLink.addEventListener('click', function (e) {
|
4866
|
-
viewSource(
|
5055
|
+
viewSource(stringify$1(spec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', mode);
|
4867
5056
|
e.preventDefault();
|
4868
5057
|
});
|
4869
5058
|
ctrl.append(viewSourceLink);
|
@@ -4875,7 +5064,7 @@
|
|
4875
5064
|
compileLink.text = i18n.COMPILED_ACTION;
|
4876
5065
|
compileLink.href = '#';
|
4877
5066
|
compileLink.addEventListener('click', function (e) {
|
4878
|
-
viewSource(
|
5067
|
+
viewSource(stringify$1(vgSpec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', 'vega');
|
4879
5068
|
e.preventDefault();
|
4880
5069
|
});
|
4881
5070
|
ctrl.append(compileLink);
|
@@ -4892,7 +5081,7 @@
|
|
4892
5081
|
config: config,
|
4893
5082
|
mode,
|
4894
5083
|
renderer,
|
4895
|
-
spec:
|
5084
|
+
spec: stringify$1(spec)
|
4896
5085
|
});
|
4897
5086
|
e.preventDefault();
|
4898
5087
|
});
|
@@ -4920,8 +5109,7 @@
|
|
4920
5109
|
*
|
4921
5110
|
* The main use case is in [Observable](https://observablehq.com/).
|
4922
5111
|
*/
|
4923
|
-
async function container (spec) {
|
4924
|
-
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
5112
|
+
async function container (spec, opt = {}) {
|
4925
5113
|
const wrapper = document.createElement('div');
|
4926
5114
|
wrapper.classList.add('vega-embed-wrapper');
|
4927
5115
|
const div = document.createElement('div');
|
@@ -4931,11 +5119,11 @@
|
|
4931
5119
|
source: false,
|
4932
5120
|
compiled: true,
|
4933
5121
|
editor: true,
|
4934
|
-
...
|
5122
|
+
...opt.actions
|
4935
5123
|
};
|
4936
5124
|
const result = await embed(div, spec, {
|
4937
5125
|
actions,
|
4938
|
-
...
|
5126
|
+
...opt
|
4939
5127
|
});
|
4940
5128
|
wrapper.value = result.view;
|
4941
5129
|
return wrapper;
|
@@ -4947,11 +5135,11 @@
|
|
4947
5135
|
function isElement(obj) {
|
4948
5136
|
return obj instanceof HTMLElement;
|
4949
5137
|
}
|
4950
|
-
const wrapper =
|
4951
|
-
if (
|
4952
|
-
return embed(
|
5138
|
+
const wrapper = (...args) => {
|
5139
|
+
if (args.length > 1 && (vegaImport.isString(args[0]) && !isURL(args[0]) || isElement(args[0]) || args.length === 3)) {
|
5140
|
+
return embed(args[0], args[1], args[2]);
|
4953
5141
|
}
|
4954
|
-
return container(
|
5142
|
+
return container(args[0], args[1]);
|
4955
5143
|
};
|
4956
5144
|
wrapper.vegaLite = vegaLite;
|
4957
5145
|
wrapper.vl = vegaLite; // backwards compatibility
|