vega 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +12 -12
- data/lib/vega/engine.rb +1 -1
- data/lib/vega/spec.rb +4 -4
- 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 +518 -897
- data/vendor/assets/javascripts/vega-interpreter.js +33 -40
- data/vendor/assets/javascripts/vega-lite.js +2393 -1792
- data/vendor/assets/javascripts/vega.js +7345 -11726
- metadata +4 -4
@@ -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,676 +946,59 @@
|
|
943
946
|
return string;
|
944
947
|
}(passedObj, "", 0);
|
945
948
|
};
|
949
|
+
var stringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStringifyPrettyCompact);
|
946
950
|
|
947
|
-
var iterator;
|
948
|
-
var hasRequiredIterator;
|
949
|
-
function requireIterator() {
|
950
|
-
if (hasRequiredIterator) return iterator;
|
951
|
-
hasRequiredIterator = 1;
|
952
|
-
iterator = function (Yallist) {
|
953
|
-
Yallist.prototype[Symbol.iterator] = function* () {
|
954
|
-
for (let walker = this.head; walker; walker = walker.next) {
|
955
|
-
yield walker.value;
|
956
|
-
}
|
957
|
-
};
|
958
|
-
};
|
959
|
-
return iterator;
|
960
|
-
}
|
961
|
-
|
962
|
-
var yallist = Yallist$1;
|
963
|
-
Yallist$1.Node = Node;
|
964
|
-
Yallist$1.create = Yallist$1;
|
965
|
-
function Yallist$1(list) {
|
966
|
-
var self = this;
|
967
|
-
if (!(self instanceof Yallist$1)) {
|
968
|
-
self = new Yallist$1();
|
969
|
-
}
|
970
|
-
self.tail = null;
|
971
|
-
self.head = null;
|
972
|
-
self.length = 0;
|
973
|
-
if (list && typeof list.forEach === 'function') {
|
974
|
-
list.forEach(function (item) {
|
975
|
-
self.push(item);
|
976
|
-
});
|
977
|
-
} else if (arguments.length > 0) {
|
978
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
979
|
-
self.push(arguments[i]);
|
980
|
-
}
|
981
|
-
}
|
982
|
-
return self;
|
983
|
-
}
|
984
|
-
Yallist$1.prototype.removeNode = function (node) {
|
985
|
-
if (node.list !== this) {
|
986
|
-
throw new Error('removing node which does not belong to this list');
|
987
|
-
}
|
988
|
-
var next = node.next;
|
989
|
-
var prev = node.prev;
|
990
|
-
if (next) {
|
991
|
-
next.prev = prev;
|
992
|
-
}
|
993
|
-
if (prev) {
|
994
|
-
prev.next = next;
|
995
|
-
}
|
996
|
-
if (node === this.head) {
|
997
|
-
this.head = next;
|
998
|
-
}
|
999
|
-
if (node === this.tail) {
|
1000
|
-
this.tail = prev;
|
1001
|
-
}
|
1002
|
-
node.list.length--;
|
1003
|
-
node.next = null;
|
1004
|
-
node.prev = null;
|
1005
|
-
node.list = null;
|
1006
|
-
return next;
|
1007
|
-
};
|
1008
|
-
Yallist$1.prototype.unshiftNode = function (node) {
|
1009
|
-
if (node === this.head) {
|
1010
|
-
return;
|
1011
|
-
}
|
1012
|
-
if (node.list) {
|
1013
|
-
node.list.removeNode(node);
|
1014
|
-
}
|
1015
|
-
var head = this.head;
|
1016
|
-
node.list = this;
|
1017
|
-
node.next = head;
|
1018
|
-
if (head) {
|
1019
|
-
head.prev = node;
|
1020
|
-
}
|
1021
|
-
this.head = node;
|
1022
|
-
if (!this.tail) {
|
1023
|
-
this.tail = node;
|
1024
|
-
}
|
1025
|
-
this.length++;
|
1026
|
-
};
|
1027
|
-
Yallist$1.prototype.pushNode = function (node) {
|
1028
|
-
if (node === this.tail) {
|
1029
|
-
return;
|
1030
|
-
}
|
1031
|
-
if (node.list) {
|
1032
|
-
node.list.removeNode(node);
|
1033
|
-
}
|
1034
|
-
var tail = this.tail;
|
1035
|
-
node.list = this;
|
1036
|
-
node.prev = tail;
|
1037
|
-
if (tail) {
|
1038
|
-
tail.next = node;
|
1039
|
-
}
|
1040
|
-
this.tail = node;
|
1041
|
-
if (!this.head) {
|
1042
|
-
this.head = node;
|
1043
|
-
}
|
1044
|
-
this.length++;
|
1045
|
-
};
|
1046
|
-
Yallist$1.prototype.push = function () {
|
1047
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
1048
|
-
push(this, arguments[i]);
|
1049
|
-
}
|
1050
|
-
return this.length;
|
1051
|
-
};
|
1052
|
-
Yallist$1.prototype.unshift = function () {
|
1053
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
1054
|
-
unshift(this, arguments[i]);
|
1055
|
-
}
|
1056
|
-
return this.length;
|
1057
|
-
};
|
1058
|
-
Yallist$1.prototype.pop = function () {
|
1059
|
-
if (!this.tail) {
|
1060
|
-
return undefined;
|
1061
|
-
}
|
1062
|
-
var res = this.tail.value;
|
1063
|
-
this.tail = this.tail.prev;
|
1064
|
-
if (this.tail) {
|
1065
|
-
this.tail.next = null;
|
1066
|
-
} else {
|
1067
|
-
this.head = null;
|
1068
|
-
}
|
1069
|
-
this.length--;
|
1070
|
-
return res;
|
1071
|
-
};
|
1072
|
-
Yallist$1.prototype.shift = function () {
|
1073
|
-
if (!this.head) {
|
1074
|
-
return undefined;
|
1075
|
-
}
|
1076
|
-
var res = this.head.value;
|
1077
|
-
this.head = this.head.next;
|
1078
|
-
if (this.head) {
|
1079
|
-
this.head.prev = null;
|
1080
|
-
} else {
|
1081
|
-
this.tail = null;
|
1082
|
-
}
|
1083
|
-
this.length--;
|
1084
|
-
return res;
|
1085
|
-
};
|
1086
|
-
Yallist$1.prototype.forEach = function (fn, thisp) {
|
1087
|
-
thisp = thisp || this;
|
1088
|
-
for (var walker = this.head, i = 0; walker !== null; i++) {
|
1089
|
-
fn.call(thisp, walker.value, i, this);
|
1090
|
-
walker = walker.next;
|
1091
|
-
}
|
1092
|
-
};
|
1093
|
-
Yallist$1.prototype.forEachReverse = function (fn, thisp) {
|
1094
|
-
thisp = thisp || this;
|
1095
|
-
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
1096
|
-
fn.call(thisp, walker.value, i, this);
|
1097
|
-
walker = walker.prev;
|
1098
|
-
}
|
1099
|
-
};
|
1100
|
-
Yallist$1.prototype.get = function (n) {
|
1101
|
-
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
1102
|
-
// abort out of the list early if we hit a cycle
|
1103
|
-
walker = walker.next;
|
1104
|
-
}
|
1105
|
-
if (i === n && walker !== null) {
|
1106
|
-
return walker.value;
|
1107
|
-
}
|
1108
|
-
};
|
1109
|
-
Yallist$1.prototype.getReverse = function (n) {
|
1110
|
-
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
1111
|
-
// abort out of the list early if we hit a cycle
|
1112
|
-
walker = walker.prev;
|
1113
|
-
}
|
1114
|
-
if (i === n && walker !== null) {
|
1115
|
-
return walker.value;
|
1116
|
-
}
|
1117
|
-
};
|
1118
|
-
Yallist$1.prototype.map = function (fn, thisp) {
|
1119
|
-
thisp = thisp || this;
|
1120
|
-
var res = new Yallist$1();
|
1121
|
-
for (var walker = this.head; walker !== null;) {
|
1122
|
-
res.push(fn.call(thisp, walker.value, this));
|
1123
|
-
walker = walker.next;
|
1124
|
-
}
|
1125
|
-
return res;
|
1126
|
-
};
|
1127
|
-
Yallist$1.prototype.mapReverse = function (fn, thisp) {
|
1128
|
-
thisp = thisp || this;
|
1129
|
-
var res = new Yallist$1();
|
1130
|
-
for (var walker = this.tail; walker !== null;) {
|
1131
|
-
res.push(fn.call(thisp, walker.value, this));
|
1132
|
-
walker = walker.prev;
|
1133
|
-
}
|
1134
|
-
return res;
|
1135
|
-
};
|
1136
|
-
Yallist$1.prototype.reduce = function (fn, initial) {
|
1137
|
-
var acc;
|
1138
|
-
var walker = this.head;
|
1139
|
-
if (arguments.length > 1) {
|
1140
|
-
acc = initial;
|
1141
|
-
} else if (this.head) {
|
1142
|
-
walker = this.head.next;
|
1143
|
-
acc = this.head.value;
|
1144
|
-
} else {
|
1145
|
-
throw new TypeError('Reduce of empty list with no initial value');
|
1146
|
-
}
|
1147
|
-
for (var i = 0; walker !== null; i++) {
|
1148
|
-
acc = fn(acc, walker.value, i);
|
1149
|
-
walker = walker.next;
|
1150
|
-
}
|
1151
|
-
return acc;
|
1152
|
-
};
|
1153
|
-
Yallist$1.prototype.reduceReverse = function (fn, initial) {
|
1154
|
-
var acc;
|
1155
|
-
var walker = this.tail;
|
1156
|
-
if (arguments.length > 1) {
|
1157
|
-
acc = initial;
|
1158
|
-
} else if (this.tail) {
|
1159
|
-
walker = this.tail.prev;
|
1160
|
-
acc = this.tail.value;
|
1161
|
-
} else {
|
1162
|
-
throw new TypeError('Reduce of empty list with no initial value');
|
1163
|
-
}
|
1164
|
-
for (var i = this.length - 1; walker !== null; i--) {
|
1165
|
-
acc = fn(acc, walker.value, i);
|
1166
|
-
walker = walker.prev;
|
1167
|
-
}
|
1168
|
-
return acc;
|
1169
|
-
};
|
1170
|
-
Yallist$1.prototype.toArray = function () {
|
1171
|
-
var arr = new Array(this.length);
|
1172
|
-
for (var i = 0, walker = this.head; walker !== null; i++) {
|
1173
|
-
arr[i] = walker.value;
|
1174
|
-
walker = walker.next;
|
1175
|
-
}
|
1176
|
-
return arr;
|
1177
|
-
};
|
1178
|
-
Yallist$1.prototype.toArrayReverse = function () {
|
1179
|
-
var arr = new Array(this.length);
|
1180
|
-
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
1181
|
-
arr[i] = walker.value;
|
1182
|
-
walker = walker.prev;
|
1183
|
-
}
|
1184
|
-
return arr;
|
1185
|
-
};
|
1186
|
-
Yallist$1.prototype.slice = function (from, to) {
|
1187
|
-
to = to || this.length;
|
1188
|
-
if (to < 0) {
|
1189
|
-
to += this.length;
|
1190
|
-
}
|
1191
|
-
from = from || 0;
|
1192
|
-
if (from < 0) {
|
1193
|
-
from += this.length;
|
1194
|
-
}
|
1195
|
-
var ret = new Yallist$1();
|
1196
|
-
if (to < from || to < 0) {
|
1197
|
-
return ret;
|
1198
|
-
}
|
1199
|
-
if (from < 0) {
|
1200
|
-
from = 0;
|
1201
|
-
}
|
1202
|
-
if (to > this.length) {
|
1203
|
-
to = this.length;
|
1204
|
-
}
|
1205
|
-
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
1206
|
-
walker = walker.next;
|
1207
|
-
}
|
1208
|
-
for (; walker !== null && i < to; i++, walker = walker.next) {
|
1209
|
-
ret.push(walker.value);
|
1210
|
-
}
|
1211
|
-
return ret;
|
1212
|
-
};
|
1213
|
-
Yallist$1.prototype.sliceReverse = function (from, to) {
|
1214
|
-
to = to || this.length;
|
1215
|
-
if (to < 0) {
|
1216
|
-
to += this.length;
|
1217
|
-
}
|
1218
|
-
from = from || 0;
|
1219
|
-
if (from < 0) {
|
1220
|
-
from += this.length;
|
1221
|
-
}
|
1222
|
-
var ret = new Yallist$1();
|
1223
|
-
if (to < from || to < 0) {
|
1224
|
-
return ret;
|
1225
|
-
}
|
1226
|
-
if (from < 0) {
|
1227
|
-
from = 0;
|
1228
|
-
}
|
1229
|
-
if (to > this.length) {
|
1230
|
-
to = this.length;
|
1231
|
-
}
|
1232
|
-
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
1233
|
-
walker = walker.prev;
|
1234
|
-
}
|
1235
|
-
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
1236
|
-
ret.push(walker.value);
|
1237
|
-
}
|
1238
|
-
return ret;
|
1239
|
-
};
|
1240
|
-
Yallist$1.prototype.splice = function (start, deleteCount) {
|
1241
|
-
if (start > this.length) {
|
1242
|
-
start = this.length - 1;
|
1243
|
-
}
|
1244
|
-
if (start < 0) {
|
1245
|
-
start = this.length + start;
|
1246
|
-
}
|
1247
|
-
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
|
1248
|
-
walker = walker.next;
|
1249
|
-
}
|
1250
|
-
var ret = [];
|
1251
|
-
for (var i = 0; walker && i < deleteCount; i++) {
|
1252
|
-
ret.push(walker.value);
|
1253
|
-
walker = this.removeNode(walker);
|
1254
|
-
}
|
1255
|
-
if (walker === null) {
|
1256
|
-
walker = this.tail;
|
1257
|
-
}
|
1258
|
-
if (walker !== this.head && walker !== this.tail) {
|
1259
|
-
walker = walker.prev;
|
1260
|
-
}
|
1261
|
-
for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {
|
1262
|
-
walker = insert(this, walker, i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2]);
|
1263
|
-
}
|
1264
|
-
return ret;
|
1265
|
-
};
|
1266
|
-
Yallist$1.prototype.reverse = function () {
|
1267
|
-
var head = this.head;
|
1268
|
-
var tail = this.tail;
|
1269
|
-
for (var walker = head; walker !== null; walker = walker.prev) {
|
1270
|
-
var p = walker.prev;
|
1271
|
-
walker.prev = walker.next;
|
1272
|
-
walker.next = p;
|
1273
|
-
}
|
1274
|
-
this.head = tail;
|
1275
|
-
this.tail = head;
|
1276
|
-
return this;
|
1277
|
-
};
|
1278
|
-
function insert(self, node, value) {
|
1279
|
-
var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
|
1280
|
-
if (inserted.next === null) {
|
1281
|
-
self.tail = inserted;
|
1282
|
-
}
|
1283
|
-
if (inserted.prev === null) {
|
1284
|
-
self.head = inserted;
|
1285
|
-
}
|
1286
|
-
self.length++;
|
1287
|
-
return inserted;
|
1288
|
-
}
|
1289
|
-
function push(self, item) {
|
1290
|
-
self.tail = new Node(item, self.tail, null, self);
|
1291
|
-
if (!self.head) {
|
1292
|
-
self.head = self.tail;
|
1293
|
-
}
|
1294
|
-
self.length++;
|
1295
|
-
}
|
1296
|
-
function unshift(self, item) {
|
1297
|
-
self.head = new Node(item, null, self.head, self);
|
1298
|
-
if (!self.tail) {
|
1299
|
-
self.tail = self.head;
|
1300
|
-
}
|
1301
|
-
self.length++;
|
1302
|
-
}
|
1303
|
-
function Node(value, prev, next, list) {
|
1304
|
-
if (!(this instanceof Node)) {
|
1305
|
-
return new Node(value, prev, next, list);
|
1306
|
-
}
|
1307
|
-
this.list = list;
|
1308
|
-
this.value = value;
|
1309
|
-
if (prev) {
|
1310
|
-
prev.next = this;
|
1311
|
-
this.prev = prev;
|
1312
|
-
} else {
|
1313
|
-
this.prev = null;
|
1314
|
-
}
|
1315
|
-
if (next) {
|
1316
|
-
next.prev = this;
|
1317
|
-
this.next = next;
|
1318
|
-
} else {
|
1319
|
-
this.next = null;
|
1320
|
-
}
|
1321
|
-
}
|
1322
|
-
try {
|
1323
|
-
// add if support for Symbol.iterator is present
|
1324
|
-
requireIterator()(Yallist$1);
|
1325
|
-
} catch (er) {}
|
1326
|
-
|
1327
|
-
// A linked list to keep track of recently-used-ness
|
1328
|
-
const Yallist = yallist;
|
1329
|
-
const MAX = Symbol('max');
|
1330
|
-
const LENGTH = Symbol('length');
|
1331
|
-
const LENGTH_CALCULATOR = Symbol('lengthCalculator');
|
1332
|
-
const ALLOW_STALE = Symbol('allowStale');
|
1333
|
-
const MAX_AGE = Symbol('maxAge');
|
1334
|
-
const DISPOSE = Symbol('dispose');
|
1335
|
-
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
|
1336
|
-
const LRU_LIST = Symbol('lruList');
|
1337
|
-
const CACHE = Symbol('cache');
|
1338
|
-
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
|
1339
|
-
const naiveLength = () => 1;
|
1340
|
-
|
1341
|
-
// lruList is a yallist where the head is the youngest
|
1342
|
-
// item, and the tail is the oldest. the list contains the Hit
|
1343
|
-
// objects as the entries.
|
1344
|
-
// Each Hit object has a reference to its Yallist.Node. This
|
1345
|
-
// never changes.
|
1346
|
-
//
|
1347
|
-
// cache is a Map (or PseudoMap) that matches the keys to
|
1348
|
-
// the Yallist.Node object.
|
1349
951
|
class LRUCache {
|
1350
|
-
constructor(
|
1351
|
-
|
1352
|
-
|
1353
|
-
};
|
1354
|
-
if (!options) options = {};
|
1355
|
-
if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number');
|
1356
|
-
// Kind of weird to have a default max of Infinity, but oh well.
|
1357
|
-
this[MAX] = options.max || Infinity;
|
1358
|
-
const lc = options.length || naiveLength;
|
1359
|
-
this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;
|
1360
|
-
this[ALLOW_STALE] = options.stale || false;
|
1361
|
-
if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');
|
1362
|
-
this[MAX_AGE] = options.maxAge || 0;
|
1363
|
-
this[DISPOSE] = options.dispose;
|
1364
|
-
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
1365
|
-
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
|
1366
|
-
this.reset();
|
1367
|
-
}
|
1368
|
-
|
1369
|
-
// resize the cache when the max changes.
|
1370
|
-
set max(mL) {
|
1371
|
-
if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');
|
1372
|
-
this[MAX] = mL || Infinity;
|
1373
|
-
trim(this);
|
1374
|
-
}
|
1375
|
-
get max() {
|
1376
|
-
return this[MAX];
|
1377
|
-
}
|
1378
|
-
set allowStale(allowStale) {
|
1379
|
-
this[ALLOW_STALE] = !!allowStale;
|
1380
|
-
}
|
1381
|
-
get allowStale() {
|
1382
|
-
return this[ALLOW_STALE];
|
1383
|
-
}
|
1384
|
-
set maxAge(mA) {
|
1385
|
-
if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');
|
1386
|
-
this[MAX_AGE] = mA;
|
1387
|
-
trim(this);
|
1388
|
-
}
|
1389
|
-
get maxAge() {
|
1390
|
-
return this[MAX_AGE];
|
1391
|
-
}
|
1392
|
-
|
1393
|
-
// resize the cache when the lengthCalculator changes.
|
1394
|
-
set lengthCalculator(lC) {
|
1395
|
-
if (typeof lC !== 'function') lC = naiveLength;
|
1396
|
-
if (lC !== this[LENGTH_CALCULATOR]) {
|
1397
|
-
this[LENGTH_CALCULATOR] = lC;
|
1398
|
-
this[LENGTH] = 0;
|
1399
|
-
this[LRU_LIST].forEach(hit => {
|
1400
|
-
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
1401
|
-
this[LENGTH] += hit.length;
|
1402
|
-
});
|
1403
|
-
}
|
1404
|
-
trim(this);
|
1405
|
-
}
|
1406
|
-
get lengthCalculator() {
|
1407
|
-
return this[LENGTH_CALCULATOR];
|
1408
|
-
}
|
1409
|
-
get length() {
|
1410
|
-
return this[LENGTH];
|
1411
|
-
}
|
1412
|
-
get itemCount() {
|
1413
|
-
return this[LRU_LIST].length;
|
1414
|
-
}
|
1415
|
-
rforEach(fn, thisp) {
|
1416
|
-
thisp = thisp || this;
|
1417
|
-
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
1418
|
-
const prev = walker.prev;
|
1419
|
-
forEachStep(this, fn, walker, thisp);
|
1420
|
-
walker = prev;
|
1421
|
-
}
|
1422
|
-
}
|
1423
|
-
forEach(fn, thisp) {
|
1424
|
-
thisp = thisp || this;
|
1425
|
-
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
1426
|
-
const next = walker.next;
|
1427
|
-
forEachStep(this, fn, walker, thisp);
|
1428
|
-
walker = next;
|
1429
|
-
}
|
1430
|
-
}
|
1431
|
-
keys() {
|
1432
|
-
return this[LRU_LIST].toArray().map(k => k.key);
|
1433
|
-
}
|
1434
|
-
values() {
|
1435
|
-
return this[LRU_LIST].toArray().map(k => k.value);
|
1436
|
-
}
|
1437
|
-
reset() {
|
1438
|
-
if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
|
1439
|
-
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
|
1440
|
-
}
|
1441
|
-
this[CACHE] = new Map(); // hash of items by key
|
1442
|
-
this[LRU_LIST] = new Yallist(); // list of items in order of use recency
|
1443
|
-
this[LENGTH] = 0; // length of items in the list
|
1444
|
-
}
|
1445
|
-
|
1446
|
-
dump() {
|
1447
|
-
return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {
|
1448
|
-
k: hit.key,
|
1449
|
-
v: hit.value,
|
1450
|
-
e: hit.now + (hit.maxAge || 0)
|
1451
|
-
}).toArray().filter(h => h);
|
1452
|
-
}
|
1453
|
-
dumpLru() {
|
1454
|
-
return this[LRU_LIST];
|
1455
|
-
}
|
1456
|
-
set(key, value, maxAge) {
|
1457
|
-
maxAge = maxAge || this[MAX_AGE];
|
1458
|
-
if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');
|
1459
|
-
const now = maxAge ? Date.now() : 0;
|
1460
|
-
const len = this[LENGTH_CALCULATOR](value, key);
|
1461
|
-
if (this[CACHE].has(key)) {
|
1462
|
-
if (len > this[MAX]) {
|
1463
|
-
del(this, this[CACHE].get(key));
|
1464
|
-
return false;
|
1465
|
-
}
|
1466
|
-
const node = this[CACHE].get(key);
|
1467
|
-
const item = node.value;
|
1468
|
-
|
1469
|
-
// dispose of the old one before overwriting
|
1470
|
-
// split out into 2 ifs for better coverage tracking
|
1471
|
-
if (this[DISPOSE]) {
|
1472
|
-
if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);
|
1473
|
-
}
|
1474
|
-
item.now = now;
|
1475
|
-
item.maxAge = maxAge;
|
1476
|
-
item.value = value;
|
1477
|
-
this[LENGTH] += len - item.length;
|
1478
|
-
item.length = len;
|
1479
|
-
this.get(key);
|
1480
|
-
trim(this);
|
1481
|
-
return true;
|
1482
|
-
}
|
1483
|
-
const hit = new Entry(key, value, len, now, maxAge);
|
1484
|
-
|
1485
|
-
// oversized objects fall out of cache automatically.
|
1486
|
-
if (hit.length > this[MAX]) {
|
1487
|
-
if (this[DISPOSE]) this[DISPOSE](key, value);
|
1488
|
-
return false;
|
1489
|
-
}
|
1490
|
-
this[LENGTH] += hit.length;
|
1491
|
-
this[LRU_LIST].unshift(hit);
|
1492
|
-
this[CACHE].set(key, this[LRU_LIST].head);
|
1493
|
-
trim(this);
|
1494
|
-
return true;
|
1495
|
-
}
|
1496
|
-
has(key) {
|
1497
|
-
if (!this[CACHE].has(key)) return false;
|
1498
|
-
const hit = this[CACHE].get(key).value;
|
1499
|
-
return !isStale(this, hit);
|
952
|
+
constructor() {
|
953
|
+
this.max = 1000;
|
954
|
+
this.map = new Map();
|
1500
955
|
}
|
1501
956
|
get(key) {
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
del(this, node);
|
1511
|
-
return node.value;
|
1512
|
-
}
|
1513
|
-
del(key) {
|
1514
|
-
del(this, this[CACHE].get(key));
|
1515
|
-
}
|
1516
|
-
load(arr) {
|
1517
|
-
// reset the cache
|
1518
|
-
this.reset();
|
1519
|
-
const now = Date.now();
|
1520
|
-
// A previous serialized cache has the most recent items first
|
1521
|
-
for (let l = arr.length - 1; l >= 0; l--) {
|
1522
|
-
const hit = arr[l];
|
1523
|
-
const expiresAt = hit.e || 0;
|
1524
|
-
if (expiresAt === 0)
|
1525
|
-
// the item was created without expiration in a non aged cache
|
1526
|
-
this.set(hit.k, hit.v);else {
|
1527
|
-
const maxAge = expiresAt - now;
|
1528
|
-
// dont add already expired items
|
1529
|
-
if (maxAge > 0) {
|
1530
|
-
this.set(hit.k, hit.v, maxAge);
|
1531
|
-
}
|
1532
|
-
}
|
957
|
+
const value = this.map.get(key);
|
958
|
+
if (value === undefined) {
|
959
|
+
return undefined;
|
960
|
+
} else {
|
961
|
+
// Remove the key from the map and add it to the end
|
962
|
+
this.map.delete(key);
|
963
|
+
this.map.set(key, value);
|
964
|
+
return value;
|
1533
965
|
}
|
1534
966
|
}
|
1535
|
-
|
1536
|
-
this
|
967
|
+
delete(key) {
|
968
|
+
return this.map.delete(key);
|
1537
969
|
}
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
if (!self[ALLOW_STALE]) return undefined;
|
1546
|
-
} else {
|
1547
|
-
if (doUse) {
|
1548
|
-
if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();
|
1549
|
-
self[LRU_LIST].unshiftNode(node);
|
970
|
+
set(key, value) {
|
971
|
+
const deleted = this.delete(key);
|
972
|
+
if (!deleted && value !== undefined) {
|
973
|
+
// If cache is full, delete the least recently used item
|
974
|
+
if (this.map.size >= this.max) {
|
975
|
+
const firstKey = this.map.keys().next().value;
|
976
|
+
this.delete(firstKey);
|
1550
977
|
}
|
978
|
+
this.map.set(key, value);
|
1551
979
|
}
|
1552
|
-
return
|
1553
|
-
}
|
1554
|
-
};
|
1555
|
-
const isStale = (self, hit) => {
|
1556
|
-
if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;
|
1557
|
-
const diff = Date.now() - hit.now;
|
1558
|
-
return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
|
1559
|
-
};
|
1560
|
-
const trim = self => {
|
1561
|
-
if (self[LENGTH] > self[MAX]) {
|
1562
|
-
for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {
|
1563
|
-
// We know that we're about to delete this one, and also
|
1564
|
-
// what the next least recently used key will be, so just
|
1565
|
-
// go ahead and set it now.
|
1566
|
-
const prev = walker.prev;
|
1567
|
-
del(self, walker);
|
1568
|
-
walker = prev;
|
1569
|
-
}
|
1570
|
-
}
|
1571
|
-
};
|
1572
|
-
const del = (self, node) => {
|
1573
|
-
if (node) {
|
1574
|
-
const hit = node.value;
|
1575
|
-
if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);
|
1576
|
-
self[LENGTH] -= hit.length;
|
1577
|
-
self[CACHE].delete(hit.key);
|
1578
|
-
self[LRU_LIST].removeNode(node);
|
1579
|
-
}
|
1580
|
-
};
|
1581
|
-
class Entry {
|
1582
|
-
constructor(key, value, length, now, maxAge) {
|
1583
|
-
this.key = key;
|
1584
|
-
this.value = value;
|
1585
|
-
this.length = length;
|
1586
|
-
this.now = now;
|
1587
|
-
this.maxAge = maxAge || 0;
|
980
|
+
return this;
|
1588
981
|
}
|
1589
982
|
}
|
1590
|
-
|
1591
|
-
let hit = node.value;
|
1592
|
-
if (isStale(self, hit)) {
|
1593
|
-
del(self, node);
|
1594
|
-
if (!self[ALLOW_STALE]) hit = undefined;
|
1595
|
-
}
|
1596
|
-
if (hit) fn.call(thisp, hit.value, hit.key, self);
|
1597
|
-
};
|
1598
|
-
var lruCache = LRUCache;
|
983
|
+
var lrucache = LRUCache;
|
1599
984
|
|
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' ? {
|
985
|
+
// parse out just the options we care about
|
986
|
+
const looseOption = Object.freeze({
|
1604
987
|
loose: true
|
1605
|
-
}
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
988
|
+
});
|
989
|
+
const emptyOpts = Object.freeze({});
|
990
|
+
const parseOptions$1 = options => {
|
991
|
+
if (!options) {
|
992
|
+
return emptyOpts;
|
993
|
+
}
|
994
|
+
if (typeof options !== 'object') {
|
995
|
+
return looseOption;
|
996
|
+
}
|
997
|
+
return options;
|
998
|
+
};
|
1609
999
|
var parseOptions_1 = parseOptions$1;
|
1610
1000
|
|
1611
|
-
var
|
1612
|
-
var re$1 = {
|
1613
|
-
get exports(){ return reExports; },
|
1614
|
-
set exports(v){ reExports = v; },
|
1615
|
-
};
|
1001
|
+
var re$1 = {exports: {}};
|
1616
1002
|
|
1617
1003
|
// Note: this is the semver.org version of the spec that it implements
|
1618
1004
|
// Not necessarily the package version of this code.
|
@@ -1622,39 +1008,63 @@
|
|
1622
1008
|
|
1623
1009
|
// Max safe segment length for coercion.
|
1624
1010
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
1011
|
+
|
1012
|
+
// Max safe length for a build identifier. The max length minus 6 characters for
|
1013
|
+
// the shortest version with a build 0.0.0+BUILD.
|
1014
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
1015
|
+
const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
|
1625
1016
|
var constants = {
|
1626
|
-
SEMVER_SPEC_VERSION,
|
1627
1017
|
MAX_LENGTH: MAX_LENGTH$1,
|
1018
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
1019
|
+
MAX_SAFE_BUILD_LENGTH,
|
1628
1020
|
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
1629
|
-
|
1021
|
+
RELEASE_TYPES,
|
1022
|
+
SEMVER_SPEC_VERSION,
|
1023
|
+
FLAG_INCLUDE_PRERELEASE: 0b001,
|
1024
|
+
FLAG_LOOSE: 0b010
|
1630
1025
|
};
|
1631
1026
|
|
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
|
-
} : () => {};
|
1027
|
+
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
1028
|
var debug_1 = debug$1;
|
1639
1029
|
|
1640
1030
|
(function (module, exports) {
|
1641
1031
|
const {
|
1642
|
-
MAX_SAFE_COMPONENT_LENGTH
|
1032
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
1033
|
+
MAX_SAFE_BUILD_LENGTH,
|
1034
|
+
MAX_LENGTH
|
1643
1035
|
} = constants;
|
1644
1036
|
const debug = debug_1;
|
1645
1037
|
exports = module.exports = {};
|
1646
1038
|
|
1647
1039
|
// The actual regexps go on exports.re
|
1648
1040
|
const re = exports.re = [];
|
1041
|
+
const safeRe = exports.safeRe = [];
|
1649
1042
|
const src = exports.src = [];
|
1650
1043
|
const t = exports.t = {};
|
1651
1044
|
let R = 0;
|
1045
|
+
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
1046
|
+
|
1047
|
+
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
1048
|
+
// used internally via the safeRe object since all inputs in this library get
|
1049
|
+
// normalized first to trim and collapse all extra whitespace. The original
|
1050
|
+
// regexes are exported for userland consumption and lower level usage. A
|
1051
|
+
// future breaking change could export the safer regex only with a note that
|
1052
|
+
// all input should have extra whitespace removed.
|
1053
|
+
const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
|
1054
|
+
const makeSafeRegex = value => {
|
1055
|
+
for (const [token, max] of safeRegexReplacements) {
|
1056
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
1057
|
+
}
|
1058
|
+
return value;
|
1059
|
+
};
|
1652
1060
|
const createToken = (name, value, isGlobal) => {
|
1061
|
+
const safe = makeSafeRegex(value);
|
1653
1062
|
const index = R++;
|
1654
1063
|
debug(name, index, value);
|
1655
1064
|
t[name] = index;
|
1656
1065
|
src[index] = value;
|
1657
1066
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
1067
|
+
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
|
1658
1068
|
};
|
1659
1069
|
|
1660
1070
|
// The following Regular Expressions can be used for tokenizing,
|
@@ -1664,13 +1074,13 @@
|
|
1664
1074
|
// A single `0`, or a non-zero digit followed by zero or more digits.
|
1665
1075
|
|
1666
1076
|
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
1667
|
-
createToken('NUMERICIDENTIFIERLOOSE', '
|
1077
|
+
createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
|
1668
1078
|
|
1669
1079
|
// ## Non-numeric Identifier
|
1670
1080
|
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
1671
1081
|
// more letters, digits, or hyphens.
|
1672
1082
|
|
1673
|
-
createToken('NONNUMERICIDENTIFIER',
|
1083
|
+
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
1674
1084
|
|
1675
1085
|
// ## Main Version
|
1676
1086
|
// Three dot-separated numeric identifiers.
|
@@ -1694,7 +1104,7 @@
|
|
1694
1104
|
// ## Build Metadata Identifier
|
1695
1105
|
// Any combination of digits, letters, or hyphens.
|
1696
1106
|
|
1697
|
-
createToken('BUILDIDENTIFIER',
|
1107
|
+
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
|
1698
1108
|
|
1699
1109
|
// ## Build Metadata
|
1700
1110
|
// Plus sign, followed by one or more period-separated build metadata
|
@@ -1733,8 +1143,11 @@
|
|
1733
1143
|
|
1734
1144
|
// Coercion.
|
1735
1145
|
// Extract anything that could conceivably be a part of a valid semver
|
1736
|
-
createToken('
|
1146
|
+
createToken('COERCEPLAIN', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
1147
|
+
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
1148
|
+
createToken('COERCEFULL', src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
1737
1149
|
createToken('COERCERTL', src[t.COERCE], true);
|
1150
|
+
createToken('COERCERTLFULL', src[t.COERCEFULL], true);
|
1738
1151
|
|
1739
1152
|
// Tilde ranges.
|
1740
1153
|
// Meaning is "reasonably at or greater than"
|
@@ -1773,7 +1186,8 @@
|
|
1773
1186
|
// >=0.0.0 is like a star
|
1774
1187
|
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
1775
1188
|
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
1776
|
-
})(re$1,
|
1189
|
+
})(re$1, re$1.exports);
|
1190
|
+
var reExports = re$1.exports;
|
1777
1191
|
|
1778
1192
|
const numeric = /^[0-9]+$/;
|
1779
1193
|
const compareIdentifiers$1 = (a, b) => {
|
@@ -1797,7 +1211,7 @@
|
|
1797
1211
|
MAX_SAFE_INTEGER
|
1798
1212
|
} = constants;
|
1799
1213
|
const {
|
1800
|
-
re,
|
1214
|
+
safeRe: re,
|
1801
1215
|
t
|
1802
1216
|
} = reExports;
|
1803
1217
|
const parseOptions = parseOptions_1;
|
@@ -1814,7 +1228,7 @@
|
|
1814
1228
|
version = version.version;
|
1815
1229
|
}
|
1816
1230
|
} else if (typeof version !== 'string') {
|
1817
|
-
throw new TypeError(`Invalid
|
1231
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
1818
1232
|
}
|
1819
1233
|
if (version.length > MAX_LENGTH) {
|
1820
1234
|
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
@@ -1930,7 +1344,7 @@
|
|
1930
1344
|
do {
|
1931
1345
|
const a = this.build[i];
|
1932
1346
|
const b = other.build[i];
|
1933
|
-
debug('
|
1347
|
+
debug('build compare', i, a, b);
|
1934
1348
|
if (a === undefined && b === undefined) {
|
1935
1349
|
return 0;
|
1936
1350
|
} else if (b === undefined) {
|
@@ -1947,36 +1361,36 @@
|
|
1947
1361
|
|
1948
1362
|
// preminor will bump the version up to the next minor release, and immediately
|
1949
1363
|
// down to pre-release. premajor and prepatch work the same way.
|
1950
|
-
inc(release, identifier) {
|
1364
|
+
inc(release, identifier, identifierBase) {
|
1951
1365
|
switch (release) {
|
1952
1366
|
case 'premajor':
|
1953
1367
|
this.prerelease.length = 0;
|
1954
1368
|
this.patch = 0;
|
1955
1369
|
this.minor = 0;
|
1956
1370
|
this.major++;
|
1957
|
-
this.inc('pre', identifier);
|
1371
|
+
this.inc('pre', identifier, identifierBase);
|
1958
1372
|
break;
|
1959
1373
|
case 'preminor':
|
1960
1374
|
this.prerelease.length = 0;
|
1961
1375
|
this.patch = 0;
|
1962
1376
|
this.minor++;
|
1963
|
-
this.inc('pre', identifier);
|
1377
|
+
this.inc('pre', identifier, identifierBase);
|
1964
1378
|
break;
|
1965
1379
|
case 'prepatch':
|
1966
1380
|
// If this is already a prerelease, it will bump to the next version
|
1967
1381
|
// drop any prereleases that might already exist, since they are not
|
1968
1382
|
// relevant at this point.
|
1969
1383
|
this.prerelease.length = 0;
|
1970
|
-
this.inc('patch', identifier);
|
1971
|
-
this.inc('pre', identifier);
|
1384
|
+
this.inc('patch', identifier, identifierBase);
|
1385
|
+
this.inc('pre', identifier, identifierBase);
|
1972
1386
|
break;
|
1973
1387
|
// If the input is a non-prerelease version, this acts the same as
|
1974
1388
|
// prepatch.
|
1975
1389
|
case 'prerelease':
|
1976
1390
|
if (this.prerelease.length === 0) {
|
1977
|
-
this.inc('patch', identifier);
|
1391
|
+
this.inc('patch', identifier, identifierBase);
|
1978
1392
|
}
|
1979
|
-
this.inc('pre', identifier);
|
1393
|
+
this.inc('pre', identifier, identifierBase);
|
1980
1394
|
break;
|
1981
1395
|
case 'major':
|
1982
1396
|
// If this is a pre-major version, bump up to the same major version.
|
@@ -2014,38 +1428,53 @@
|
|
2014
1428
|
// This probably shouldn't be used publicly.
|
2015
1429
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
2016
1430
|
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
|
-
}
|
1431
|
+
{
|
1432
|
+
const base = Number(identifierBase) ? 1 : 0;
|
1433
|
+
if (!identifier && identifierBase === false) {
|
1434
|
+
throw new Error('invalid increment argument: identifier is empty');
|
2026
1435
|
}
|
2027
|
-
if (
|
2028
|
-
|
2029
|
-
|
1436
|
+
if (this.prerelease.length === 0) {
|
1437
|
+
this.prerelease = [base];
|
1438
|
+
} else {
|
1439
|
+
let i = this.prerelease.length;
|
1440
|
+
while (--i >= 0) {
|
1441
|
+
if (typeof this.prerelease[i] === 'number') {
|
1442
|
+
this.prerelease[i]++;
|
1443
|
+
i = -2;
|
1444
|
+
}
|
1445
|
+
}
|
1446
|
+
if (i === -1) {
|
1447
|
+
// didn't increment anything
|
1448
|
+
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
1449
|
+
throw new Error('invalid increment argument: identifier already exists');
|
1450
|
+
}
|
1451
|
+
this.prerelease.push(base);
|
1452
|
+
}
|
2030
1453
|
}
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
1454
|
+
if (identifier) {
|
1455
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
1456
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
1457
|
+
let prerelease = [identifier, base];
|
1458
|
+
if (identifierBase === false) {
|
1459
|
+
prerelease = [identifier];
|
1460
|
+
}
|
1461
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
1462
|
+
if (isNaN(this.prerelease[1])) {
|
1463
|
+
this.prerelease = prerelease;
|
1464
|
+
}
|
1465
|
+
} else {
|
1466
|
+
this.prerelease = prerelease;
|
2038
1467
|
}
|
2039
|
-
} else {
|
2040
|
-
this.prerelease = [identifier, 0];
|
2041
1468
|
}
|
1469
|
+
break;
|
2042
1470
|
}
|
2043
|
-
break;
|
2044
1471
|
default:
|
2045
1472
|
throw new Error(`invalid increment argument: ${release}`);
|
2046
1473
|
}
|
2047
|
-
this.format();
|
2048
|
-
this.
|
1474
|
+
this.raw = this.format();
|
1475
|
+
if (this.build.length) {
|
1476
|
+
this.raw += `+${this.build.join('.')}`;
|
1477
|
+
}
|
2049
1478
|
return this;
|
2050
1479
|
}
|
2051
1480
|
};
|
@@ -2143,6 +1572,7 @@
|
|
2143
1572
|
comp = comp.value;
|
2144
1573
|
}
|
2145
1574
|
}
|
1575
|
+
comp = comp.trim().split(/\s+/).join(' ');
|
2146
1576
|
debug('comparator', comp, options);
|
2147
1577
|
this.options = options;
|
2148
1578
|
this.loose = !!options.loose;
|
@@ -2193,12 +1623,6 @@
|
|
2193
1623
|
if (!(comp instanceof Comparator)) {
|
2194
1624
|
throw new TypeError('a Comparator is required');
|
2195
1625
|
}
|
2196
|
-
if (!options || typeof options !== 'object') {
|
2197
|
-
options = {
|
2198
|
-
loose: !!options,
|
2199
|
-
includePrerelease: false
|
2200
|
-
};
|
2201
|
-
}
|
2202
1626
|
if (this.operator === '') {
|
2203
1627
|
if (this.value === '') {
|
2204
1628
|
return true;
|
@@ -2210,19 +1634,43 @@
|
|
2210
1634
|
}
|
2211
1635
|
return new Range(this.value, options).test(comp.semver);
|
2212
1636
|
}
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
1637
|
+
options = parseOptions(options);
|
1638
|
+
|
1639
|
+
// Special cases where nothing can possibly be lower
|
1640
|
+
if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
1641
|
+
return false;
|
1642
|
+
}
|
1643
|
+
if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
1644
|
+
return false;
|
1645
|
+
}
|
1646
|
+
|
1647
|
+
// Same direction increasing (> or >=)
|
1648
|
+
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
1649
|
+
return true;
|
1650
|
+
}
|
1651
|
+
// Same direction decreasing (< or <=)
|
1652
|
+
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
1653
|
+
return true;
|
1654
|
+
}
|
1655
|
+
// same SemVer and both sides are inclusive (<= or >=)
|
1656
|
+
if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
|
1657
|
+
return true;
|
1658
|
+
}
|
1659
|
+
// opposite directions less than
|
1660
|
+
if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
1661
|
+
return true;
|
1662
|
+
}
|
1663
|
+
// opposite directions greater than
|
1664
|
+
if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
1665
|
+
return true;
|
1666
|
+
}
|
1667
|
+
return false;
|
2220
1668
|
}
|
2221
1669
|
}
|
2222
1670
|
comparator = Comparator;
|
2223
1671
|
const parseOptions = parseOptions_1;
|
2224
1672
|
const {
|
2225
|
-
re,
|
1673
|
+
safeRe: re,
|
2226
1674
|
t
|
2227
1675
|
} = reExports;
|
2228
1676
|
const cmp = cmp_1;
|
@@ -2259,9 +1707,13 @@
|
|
2259
1707
|
this.loose = !!options.loose;
|
2260
1708
|
this.includePrerelease = !!options.includePrerelease;
|
2261
1709
|
|
2262
|
-
// First
|
2263
|
-
|
2264
|
-
|
1710
|
+
// First reduce all whitespace as much as possible so we do not have to rely
|
1711
|
+
// on potentially slow regexes like \s*. This is then stored and used for
|
1712
|
+
// future error messages as well.
|
1713
|
+
this.raw = range.trim().split(/\s+/).join(' ');
|
1714
|
+
|
1715
|
+
// First, split on ||
|
1716
|
+
this.set = this.raw.split('||')
|
2265
1717
|
// map the range to a 2d array of comparators
|
2266
1718
|
.map(r => this.parseRange(r.trim()))
|
2267
1719
|
// throw out any comparator lists that are empty
|
@@ -2269,7 +1721,7 @@
|
|
2269
1721
|
// in loose mode, but will still throw if the WHOLE range is invalid.
|
2270
1722
|
.filter(c => c.length);
|
2271
1723
|
if (!this.set.length) {
|
2272
|
-
throw new TypeError(`Invalid SemVer Range: ${
|
1724
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
2273
1725
|
}
|
2274
1726
|
|
2275
1727
|
// if we have any that are not the null set, throw out null sets.
|
@@ -2292,21 +1744,17 @@
|
|
2292
1744
|
this.format();
|
2293
1745
|
}
|
2294
1746
|
format() {
|
2295
|
-
this.range = this.set.map(comps =>
|
2296
|
-
return comps.join(' ').trim();
|
2297
|
-
}).join('||').trim();
|
1747
|
+
this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();
|
2298
1748
|
return this.range;
|
2299
1749
|
}
|
2300
1750
|
toString() {
|
2301
1751
|
return this.range;
|
2302
1752
|
}
|
2303
1753
|
parseRange(range) {
|
2304
|
-
range = range.trim();
|
2305
|
-
|
2306
1754
|
// memoize range parsing for performance.
|
2307
1755
|
// this is a very hot path, and fully deterministic.
|
2308
|
-
const memoOpts =
|
2309
|
-
const memoKey =
|
1756
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
1757
|
+
const memoKey = memoOpts + ':' + range;
|
2310
1758
|
const cached = cache.get(memoKey);
|
2311
1759
|
if (cached) {
|
2312
1760
|
return cached;
|
@@ -2316,18 +1764,18 @@
|
|
2316
1764
|
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
2317
1765
|
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
2318
1766
|
debug('hyphen replace', range);
|
1767
|
+
|
2319
1768
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
2320
1769
|
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
2321
1770
|
debug('comparator trim', range);
|
2322
1771
|
|
2323
1772
|
// `~ 1.2.3` => `~1.2.3`
|
2324
1773
|
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
1774
|
+
debug('tilde trim', range);
|
2325
1775
|
|
2326
1776
|
// `^ 1.2.3` => `^1.2.3`
|
2327
1777
|
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
2328
|
-
|
2329
|
-
// normalize spaces
|
2330
|
-
range = range.split(/\s+/).join(' ');
|
1778
|
+
debug('caret trim', range);
|
2331
1779
|
|
2332
1780
|
// At this point, the range is completely trimmed and
|
2333
1781
|
// ready to be split into comparators.
|
@@ -2398,21 +1846,23 @@
|
|
2398
1846
|
}
|
2399
1847
|
}
|
2400
1848
|
range = Range;
|
2401
|
-
const LRU =
|
2402
|
-
const cache = new LRU(
|
2403
|
-
max: 1000
|
2404
|
-
});
|
1849
|
+
const LRU = lrucache;
|
1850
|
+
const cache = new LRU();
|
2405
1851
|
const parseOptions = parseOptions_1;
|
2406
1852
|
const Comparator = requireComparator();
|
2407
1853
|
const debug = debug_1;
|
2408
1854
|
const SemVer = semver;
|
2409
1855
|
const {
|
2410
|
-
re,
|
1856
|
+
safeRe: re,
|
2411
1857
|
t,
|
2412
1858
|
comparatorTrimReplace,
|
2413
1859
|
tildeTrimReplace,
|
2414
1860
|
caretTrimReplace
|
2415
1861
|
} = reExports;
|
1862
|
+
const {
|
1863
|
+
FLAG_INCLUDE_PRERELEASE,
|
1864
|
+
FLAG_LOOSE
|
1865
|
+
} = constants;
|
2416
1866
|
const isNullSet = c => c.value === '<0.0.0-0';
|
2417
1867
|
const isAny = c => c.value === '';
|
2418
1868
|
|
@@ -2455,9 +1905,9 @@
|
|
2455
1905
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
2456
1906
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
2457
1907
|
// ~0.0.1 --> >=0.0.1 <0.1.0-0
|
2458
|
-
const replaceTildes = (comp, options) =>
|
2459
|
-
return replaceTilde(c, options);
|
2460
|
-
}
|
1908
|
+
const replaceTildes = (comp, options) => {
|
1909
|
+
return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
|
1910
|
+
};
|
2461
1911
|
const replaceTilde = (comp, options) => {
|
2462
1912
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
2463
1913
|
return comp.replace(r, (_, M, m, p, pr) => {
|
@@ -2490,9 +1940,9 @@
|
|
2490
1940
|
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
2491
1941
|
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
2492
1942
|
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
2493
|
-
const replaceCarets = (comp, options) =>
|
2494
|
-
return replaceCaret(c, options);
|
2495
|
-
}
|
1943
|
+
const replaceCarets = (comp, options) => {
|
1944
|
+
return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
|
1945
|
+
};
|
2496
1946
|
const replaceCaret = (comp, options) => {
|
2497
1947
|
debug('caret', comp, options);
|
2498
1948
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
@@ -2539,9 +1989,7 @@
|
|
2539
1989
|
};
|
2540
1990
|
const replaceXRanges = (comp, options) => {
|
2541
1991
|
debug('replaceXRanges', comp, options);
|
2542
|
-
return comp.split(/\s+/).map(c =>
|
2543
|
-
return replaceXRange(c, options);
|
2544
|
-
}).join(' ');
|
1992
|
+
return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
|
2545
1993
|
};
|
2546
1994
|
const replaceXRange = (comp, options) => {
|
2547
1995
|
comp = comp.trim();
|
@@ -2627,7 +2075,8 @@
|
|
2627
2075
|
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
2628
2076
|
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
2629
2077
|
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
2630
|
-
|
2078
|
+
// TODO build?
|
2079
|
+
const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
2631
2080
|
if (isX(fM)) {
|
2632
2081
|
from = '';
|
2633
2082
|
} else if (isX(fm)) {
|
@@ -2697,6 +2146,7 @@
|
|
2697
2146
|
return range.test(version);
|
2698
2147
|
};
|
2699
2148
|
var satisfies_1 = satisfies;
|
2149
|
+
var satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);
|
2700
2150
|
|
2701
2151
|
function adjustSpatial(item, encode, swap) {
|
2702
2152
|
let t;
|
@@ -2857,6 +2307,8 @@
|
|
2857
2307
|
test: (r, t) => RegExp(r).test(t)
|
2858
2308
|
};
|
2859
2309
|
const EventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'];
|
2310
|
+
const DisallowedMethods = new Set([Function, eval, setTimeout, setInterval]);
|
2311
|
+
if (typeof setImmediate === 'function') DisallowedMethods.add(setImmediate);
|
2860
2312
|
const Visitors = {
|
2861
2313
|
Literal: ($, n) => n.value,
|
2862
2314
|
Identifier: ($, n) => {
|
@@ -2869,17 +2321,24 @@
|
|
2869
2321
|
if (d) $.memberDepth += 1;
|
2870
2322
|
const p = $(n.property);
|
2871
2323
|
if (d) $.memberDepth -= 1;
|
2324
|
+
if (DisallowedMethods.has(o[p])) {
|
2325
|
+
// eslint-disable-next-line no-console
|
2326
|
+
console.error(`Prevented interpretation of member "${p}" which could lead to insecure code execution`);
|
2327
|
+
return;
|
2328
|
+
}
|
2872
2329
|
return o[p];
|
2873
2330
|
},
|
2874
2331
|
CallExpression: ($, n) => {
|
2875
2332
|
const args = n.arguments;
|
2876
|
-
let name = n.callee.name;
|
2877
|
-
// re-route to corresponding standard function
|
2333
|
+
let name = n.callee.name;
|
2878
2334
|
|
2335
|
+
// handle special internal functions used by encoders
|
2336
|
+
// re-route to corresponding standard function
|
2879
2337
|
if (name.startsWith('_')) {
|
2880
2338
|
name = name.slice(1);
|
2881
|
-
}
|
2339
|
+
}
|
2882
2340
|
|
2341
|
+
// special case "if" due to conditional evaluation of branches
|
2883
2342
|
return name === 'if' ? $(args[0]) ? $(args[1]) : $(args[2]) : ($.fn[name] || Functions[name]).apply($.fn, args.map($));
|
2884
2343
|
},
|
2885
2344
|
ArrayExpression: ($, n) => n.elements.map($),
|
@@ -2891,7 +2350,12 @@
|
|
2891
2350
|
$.memberDepth += 1;
|
2892
2351
|
const k = $(p.key);
|
2893
2352
|
$.memberDepth -= 1;
|
2894
|
-
|
2353
|
+
if (DisallowedMethods.has($(p.value))) {
|
2354
|
+
// eslint-disable-next-line no-console
|
2355
|
+
console.error(`Prevented interpretation of property "${k}" which could lead to insecure code execution`);
|
2356
|
+
} else {
|
2357
|
+
o[k] = $(p.value);
|
2358
|
+
}
|
2895
2359
|
return o;
|
2896
2360
|
}, {})
|
2897
2361
|
};
|
@@ -2902,8 +2366,9 @@
|
|
2902
2366
|
$.params = params;
|
2903
2367
|
$.datum = datum;
|
2904
2368
|
$.event = event;
|
2905
|
-
$.item = item;
|
2369
|
+
$.item = item;
|
2906
2370
|
|
2371
|
+
// route event functions to annotated vega event context
|
2907
2372
|
EventFunctions.forEach(f => $.fn[f] = function () {
|
2908
2373
|
return event.vega[f](...arguments);
|
2909
2374
|
});
|
@@ -2983,7 +2448,7 @@
|
|
2983
2448
|
}
|
2984
2449
|
|
2985
2450
|
var name$1 = "vega-themes";
|
2986
|
-
var version$1$1 = "2.
|
2451
|
+
var version$1$1 = "2.15.0";
|
2987
2452
|
var description$1 = "Themes for stylized Vega and Vega-Lite visualizations.";
|
2988
2453
|
var keywords$1 = ["vega", "vega-lite", "themes", "style"];
|
2989
2454
|
var license$1 = "BSD-3-Clause";
|
@@ -3024,28 +2489,35 @@
|
|
3024
2489
|
preversion: "yarn lint",
|
3025
2490
|
serve: "browser-sync start -s -f build examples --serveStatic examples",
|
3026
2491
|
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",
|
2492
|
+
format: "eslint . --fix",
|
2493
|
+
lint: "eslint .",
|
3031
2494
|
release: "release-it"
|
3032
2495
|
};
|
3033
2496
|
var devDependencies$1 = {
|
3034
|
-
"@
|
3035
|
-
"@
|
3036
|
-
"@
|
3037
|
-
"@
|
3038
|
-
"
|
3039
|
-
|
3040
|
-
"
|
3041
|
-
"
|
2497
|
+
"@babel/core": "^7.24.6",
|
2498
|
+
"@babel/plugin-transform-runtime": "^7.24.6",
|
2499
|
+
"@babel/preset-env": "^7.24.6",
|
2500
|
+
"@babel/preset-typescript": "^7.24.6",
|
2501
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
2502
|
+
"@rollup/plugin-json": "^6.1.0",
|
2503
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
2504
|
+
"@rollup/plugin-terser": "^0.4.4",
|
2505
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
2506
|
+
"@typescript-eslint/parser": "^7.11.0",
|
2507
|
+
"browser-sync": "^3.0.2",
|
2508
|
+
concurrently: "^8.2.2",
|
2509
|
+
eslint: "^8.45.0",
|
2510
|
+
"eslint-config-prettier": "^9.1.0",
|
2511
|
+
"eslint-plugin-prettier": "^5.1.3",
|
2512
|
+
"gh-pages": "^6.1.1",
|
2513
|
+
prettier: "^3.2.5",
|
2514
|
+
"release-it": "^17.3.0",
|
2515
|
+
rollup: "^4.18.0",
|
3042
2516
|
"rollup-plugin-bundle-size": "^1.0.3",
|
3043
|
-
"rollup-plugin-ts": "^3.
|
3044
|
-
|
3045
|
-
|
3046
|
-
"vega-lite
|
3047
|
-
"vega-lite": "^5.0.0",
|
3048
|
-
vega: "^5.19.1"
|
2517
|
+
"rollup-plugin-ts": "^3.4.5",
|
2518
|
+
typescript: "^5.4.5",
|
2519
|
+
vega: "^5.25.0",
|
2520
|
+
"vega-lite": "^5.9.3"
|
3049
2521
|
};
|
3050
2522
|
var peerDependencies$1 = {
|
3051
2523
|
vega: "*",
|
@@ -3622,9 +3094,10 @@
|
|
3622
3094
|
* license that can be found in the LICENSE file or at
|
3623
3095
|
* https://developers.google.com/open-source/licenses/bsd
|
3624
3096
|
*/
|
3097
|
+
|
3625
3098
|
const markColor = '#3366CC';
|
3626
3099
|
const gridColor = '#ccc';
|
3627
|
-
const defaultFont = 'Arial, sans-serif';
|
3100
|
+
const defaultFont$1 = 'Arial, sans-serif';
|
3628
3101
|
const googlechartsTheme = {
|
3629
3102
|
arc: {
|
3630
3103
|
fill: markColor
|
@@ -3656,20 +3129,20 @@
|
|
3656
3129
|
},
|
3657
3130
|
style: {
|
3658
3131
|
'guide-label': {
|
3659
|
-
font: defaultFont,
|
3132
|
+
font: defaultFont$1,
|
3660
3133
|
fontSize: 12
|
3661
3134
|
},
|
3662
3135
|
'guide-title': {
|
3663
|
-
font: defaultFont,
|
3136
|
+
font: defaultFont$1,
|
3664
3137
|
fontSize: 12
|
3665
3138
|
},
|
3666
3139
|
'group-title': {
|
3667
|
-
font: defaultFont,
|
3140
|
+
font: defaultFont$1,
|
3668
3141
|
fontSize: 12
|
3669
3142
|
}
|
3670
3143
|
},
|
3671
3144
|
title: {
|
3672
|
-
font: defaultFont,
|
3145
|
+
font: defaultFont$1,
|
3673
3146
|
fontSize: 14,
|
3674
3147
|
fontWeight: 'bold',
|
3675
3148
|
dy: -3,
|
@@ -3807,10 +3280,151 @@
|
|
3807
3280
|
ordinal: ordinalPalette
|
3808
3281
|
}
|
3809
3282
|
};
|
3283
|
+
const defaultFont = 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif';
|
3284
|
+
const condensedFont = 'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif';
|
3285
|
+
const fontWeight = 400;
|
3286
|
+
const TOKENS = {
|
3287
|
+
textPrimary: {
|
3288
|
+
g90: '#f4f4f4',
|
3289
|
+
g100: '#f4f4f4',
|
3290
|
+
white: '#161616',
|
3291
|
+
g10: '#161616'
|
3292
|
+
},
|
3293
|
+
textSecondary: {
|
3294
|
+
g90: '#c6c6c6',
|
3295
|
+
g100: '#c6c6c6',
|
3296
|
+
white: '#525252',
|
3297
|
+
g10: '#525252'
|
3298
|
+
},
|
3299
|
+
// layer
|
3300
|
+
layerAccent01: {
|
3301
|
+
white: '#e0e0e0',
|
3302
|
+
g10: '#e0e0e0',
|
3303
|
+
g90: '#525252',
|
3304
|
+
g100: '#393939'
|
3305
|
+
},
|
3306
|
+
// grid
|
3307
|
+
gridBg: {
|
3308
|
+
white: '#ffffff',
|
3309
|
+
g10: '#ffffff',
|
3310
|
+
g90: '#161616',
|
3311
|
+
g100: '#161616'
|
3312
|
+
}
|
3313
|
+
};
|
3314
|
+
const darkCategories = ['#8a3ffc', '#33b1ff', '#007d79', '#ff7eb6', '#fa4d56', '#fff1f1', '#6fdc8c', '#4589ff', '#d12771', '#d2a106', '#08bdba', '#bae6ff', '#ba4e00', '#d4bbff'];
|
3315
|
+
const lightCategories = ['#6929c4', '#1192e8', '#005d5d', '#9f1853', '#fa4d56', '#570408', '#198038', '#002d9c', '#ee538b', '#b28600', '#009d9a', '#012749', '#8a3800', '#a56eff'];
|
3316
|
+
function genCarbonConfig({
|
3317
|
+
theme,
|
3318
|
+
background
|
3319
|
+
}) {
|
3320
|
+
const type = ['white', 'g10'].includes(theme) ? 'light' : 'dark';
|
3321
|
+
const viewbg = TOKENS.gridBg[theme];
|
3322
|
+
const titleColor = TOKENS.textPrimary[theme];
|
3323
|
+
const textColor = TOKENS.textSecondary[theme];
|
3324
|
+
const category = type === 'dark' ? darkCategories : lightCategories;
|
3325
|
+
const markColor = type === 'dark' ? '#d4bbff' : '#6929c4';
|
3326
|
+
return {
|
3327
|
+
background,
|
3328
|
+
arc: {
|
3329
|
+
fill: markColor
|
3330
|
+
},
|
3331
|
+
area: {
|
3332
|
+
fill: markColor
|
3333
|
+
},
|
3334
|
+
path: {
|
3335
|
+
stroke: markColor
|
3336
|
+
},
|
3337
|
+
rect: {
|
3338
|
+
fill: markColor
|
3339
|
+
},
|
3340
|
+
shape: {
|
3341
|
+
stroke: markColor
|
3342
|
+
},
|
3343
|
+
symbol: {
|
3344
|
+
stroke: markColor
|
3345
|
+
},
|
3346
|
+
circle: {
|
3347
|
+
fill: markColor
|
3348
|
+
},
|
3349
|
+
view: {
|
3350
|
+
fill: viewbg,
|
3351
|
+
stroke: viewbg
|
3352
|
+
},
|
3353
|
+
group: {
|
3354
|
+
fill: viewbg
|
3355
|
+
},
|
3356
|
+
title: {
|
3357
|
+
color: titleColor,
|
3358
|
+
anchor: 'start',
|
3359
|
+
dy: -15,
|
3360
|
+
fontSize: 16,
|
3361
|
+
font: defaultFont,
|
3362
|
+
fontWeight: 600
|
3363
|
+
},
|
3364
|
+
axis: {
|
3365
|
+
// Axis labels
|
3366
|
+
labelColor: textColor,
|
3367
|
+
labelFontSize: 12,
|
3368
|
+
labelFont: condensedFont,
|
3369
|
+
labelFontWeight: fontWeight,
|
3370
|
+
// Axis titles
|
3371
|
+
titleColor: titleColor,
|
3372
|
+
titleFontWeight: 600,
|
3373
|
+
titleFontSize: 12,
|
3374
|
+
// MISC
|
3375
|
+
grid: true,
|
3376
|
+
gridColor: TOKENS.layerAccent01[theme],
|
3377
|
+
labelAngle: 0
|
3378
|
+
},
|
3379
|
+
axisX: {
|
3380
|
+
titlePadding: 10
|
3381
|
+
},
|
3382
|
+
axisY: {
|
3383
|
+
titlePadding: 2.5
|
3384
|
+
},
|
3385
|
+
style: {
|
3386
|
+
'guide-label': {
|
3387
|
+
font: defaultFont,
|
3388
|
+
fill: textColor,
|
3389
|
+
fontWeight: fontWeight
|
3390
|
+
},
|
3391
|
+
'guide-title': {
|
3392
|
+
font: defaultFont,
|
3393
|
+
fill: textColor,
|
3394
|
+
fontWeight: fontWeight
|
3395
|
+
}
|
3396
|
+
},
|
3397
|
+
range: {
|
3398
|
+
category,
|
3399
|
+
diverging: ['#750e13', '#a2191f', '#da1e28', '#fa4d56', '#ff8389', '#ffb3b8', '#ffd7d9', '#fff1f1', '#e5f6ff', '#bae6ff', '#82cfff', '#33b1ff', '#1192e8', '#0072c3', '#00539a', '#003a6d'],
|
3400
|
+
heatmap: ['#f6f2ff', '#e8daff', '#d4bbff', '#be95ff', '#a56eff', '#8a3ffc', '#6929c4', '#491d8b', '#31135e', '#1c0f30']
|
3401
|
+
}
|
3402
|
+
};
|
3403
|
+
}
|
3404
|
+
const carbonwhite = genCarbonConfig({
|
3405
|
+
theme: 'white',
|
3406
|
+
background: '#ffffff'
|
3407
|
+
});
|
3408
|
+
const carbong10 = genCarbonConfig({
|
3409
|
+
theme: 'g10',
|
3410
|
+
background: '#f4f4f4'
|
3411
|
+
});
|
3412
|
+
const carbong90 = genCarbonConfig({
|
3413
|
+
theme: 'g90',
|
3414
|
+
background: '#262626'
|
3415
|
+
});
|
3416
|
+
const carbong100 = genCarbonConfig({
|
3417
|
+
theme: 'g100',
|
3418
|
+
background: '#161616'
|
3419
|
+
});
|
3810
3420
|
const version$2 = pkg$1.version;
|
3811
3421
|
|
3812
3422
|
var themes = /*#__PURE__*/Object.freeze({
|
3813
3423
|
__proto__: null,
|
3424
|
+
carbong10: carbong10,
|
3425
|
+
carbong100: carbong100,
|
3426
|
+
carbong90: carbong90,
|
3427
|
+
carbonwhite: carbonwhite,
|
3814
3428
|
dark: darkTheme,
|
3815
3429
|
excel: excelTheme,
|
3816
3430
|
fivethirtyeight: fiveThirtyEightTheme,
|
@@ -3865,8 +3479,7 @@
|
|
3865
3479
|
for (i = j = 0; j < n; ++j) {
|
3866
3480
|
c = p[j];
|
3867
3481
|
if (c === '\\') {
|
3868
|
-
s += p.substring(i, j);
|
3869
|
-
s += p.substring(++j, ++j);
|
3482
|
+
s += p.substring(i, j++);
|
3870
3483
|
i = j;
|
3871
3484
|
} else if (c === q) {
|
3872
3485
|
push();
|
@@ -3907,7 +3520,7 @@
|
|
3907
3520
|
function field(field, name, opt) {
|
3908
3521
|
const path = splitAccessPath(field);
|
3909
3522
|
field = path.length === 1 ? path[0] : field;
|
3910
|
-
return accessor((
|
3523
|
+
return accessor((getter)(path), [field], field);
|
3911
3524
|
}
|
3912
3525
|
field('id');
|
3913
3526
|
accessor(_ => _, [], 'identity');
|
@@ -3923,59 +3536,35 @@
|
|
3923
3536
|
return typeof _ === 'string';
|
3924
3537
|
}
|
3925
3538
|
|
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
3539
|
/**
|
3951
3540
|
* Format the value to be shown in the tooltip.
|
3952
3541
|
*
|
3953
3542
|
* @param value The value to show in the tooltip.
|
3954
3543
|
* @param valueToHtml Function to convert a single cell value to an HTML string
|
3955
3544
|
*/
|
3956
|
-
function formatValue(value, valueToHtml, maxDepth) {
|
3545
|
+
function formatValue(value, valueToHtml, maxDepth, baseURL) {
|
3957
3546
|
if (isArray(value)) {
|
3958
3547
|
return `[${value.map(v => valueToHtml(isString(v) ? v : stringify(v, maxDepth))).join(', ')}]`;
|
3959
3548
|
}
|
3960
3549
|
if (isObject(value)) {
|
3961
3550
|
let content = '';
|
3962
|
-
const
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
|
3967
|
-
rest = __rest(_a, ["title", "image"]);
|
3551
|
+
const {
|
3552
|
+
title,
|
3553
|
+
image,
|
3554
|
+
...rest
|
3555
|
+
} = value;
|
3968
3556
|
if (title) {
|
3969
3557
|
content += `<h2>${valueToHtml(title)}</h2>`;
|
3970
3558
|
}
|
3971
3559
|
if (image) {
|
3972
|
-
content += `<img src="${valueToHtml(image)}">`;
|
3560
|
+
content += `<img src="${new URL(valueToHtml(image), baseURL || location.href).href}">`;
|
3973
3561
|
}
|
3974
3562
|
const keys = Object.keys(rest);
|
3975
3563
|
if (keys.length > 0) {
|
3976
3564
|
content += '<table>';
|
3977
3565
|
for (const key of keys) {
|
3978
3566
|
let val = rest[key];
|
3567
|
+
|
3979
3568
|
// ignore undefined properties
|
3980
3569
|
if (val === undefined) {
|
3981
3570
|
continue;
|
@@ -3983,13 +3572,12 @@
|
|
3983
3572
|
if (isObject(val)) {
|
3984
3573
|
val = stringify(val, maxDepth);
|
3985
3574
|
}
|
3986
|
-
content += `<tr><td class="key">${valueToHtml(key)}
|
3575
|
+
content += `<tr><td class="key">${valueToHtml(key)}</td><td class="value">${valueToHtml(val)}</td></tr>`;
|
3987
3576
|
}
|
3988
3577
|
content += `</table>`;
|
3989
3578
|
}
|
3990
3579
|
return content || '{}'; // show empty object if there are no properties
|
3991
3580
|
}
|
3992
|
-
|
3993
3581
|
return valueToHtml(value);
|
3994
3582
|
}
|
3995
3583
|
function replacer(maxDepth) {
|
@@ -4010,6 +3598,7 @@
|
|
4010
3598
|
return value;
|
4011
3599
|
};
|
4012
3600
|
}
|
3601
|
+
|
4013
3602
|
/**
|
4014
3603
|
* Stringify any JS object to valid JSON
|
4015
3604
|
*/
|
@@ -4040,10 +3629,6 @@
|
|
4040
3629
|
margin-bottom: 10px;
|
4041
3630
|
font-size: 13px;
|
4042
3631
|
}
|
4043
|
-
#vg-tooltip-element img {
|
4044
|
-
max-width: 200px;
|
4045
|
-
max-height: 200px;
|
4046
|
-
}
|
4047
3632
|
#vg-tooltip-element table {
|
4048
3633
|
border-spacing: 0;
|
4049
3634
|
}
|
@@ -4119,9 +3704,14 @@
|
|
4119
3704
|
* A function to customize the rendered HTML of the tooltip.
|
4120
3705
|
* @param value A value string, or object of value strings keyed by field
|
4121
3706
|
* @param sanitize The `sanitize` function from `options.sanitize`
|
3707
|
+
* @param baseURL The `baseURL` from `options.baseURL`
|
4122
3708
|
* @returns {string} The returned string will become the `innerHTML` of the tooltip element
|
4123
3709
|
*/
|
4124
|
-
formatTooltip: formatValue
|
3710
|
+
formatTooltip: formatValue,
|
3711
|
+
/**
|
3712
|
+
* The baseurl to use in image paths.
|
3713
|
+
*/
|
3714
|
+
baseURL: ''
|
4125
3715
|
};
|
4126
3716
|
/**
|
4127
3717
|
* Escape special HTML characters.
|
@@ -4166,17 +3756,34 @@
|
|
4166
3756
|
* The tooltip handler class.
|
4167
3757
|
*/
|
4168
3758
|
class Handler {
|
3759
|
+
/**
|
3760
|
+
* The handler function. We bind this to this function in the constructor.
|
3761
|
+
*/
|
3762
|
+
|
3763
|
+
/**
|
3764
|
+
* Complete tooltip options.
|
3765
|
+
*/
|
3766
|
+
|
3767
|
+
/**
|
3768
|
+
* The tooltip html element.
|
3769
|
+
*/
|
3770
|
+
|
4169
3771
|
/**
|
4170
3772
|
* Create the tooltip handler and initialize the element and style.
|
4171
3773
|
*
|
4172
3774
|
* @param options Tooltip Options
|
4173
3775
|
*/
|
4174
3776
|
constructor(options) {
|
4175
|
-
this.options =
|
3777
|
+
this.options = {
|
3778
|
+
...DEFAULT_OPTIONS,
|
3779
|
+
...options
|
3780
|
+
};
|
4176
3781
|
const elementId = this.options.id;
|
4177
3782
|
this.el = null;
|
3783
|
+
|
4178
3784
|
// bind this to call
|
4179
3785
|
this.call = this.tooltipHandler.bind(this);
|
3786
|
+
|
4180
3787
|
// prepend a default stylesheet for tooltips to the head
|
4181
3788
|
if (!this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {
|
4182
3789
|
const style = document.createElement('style');
|
@@ -4190,28 +3797,32 @@
|
|
4190
3797
|
}
|
4191
3798
|
}
|
4192
3799
|
}
|
3800
|
+
|
4193
3801
|
/**
|
4194
3802
|
* The tooltip handler function.
|
4195
3803
|
*/
|
4196
3804
|
tooltipHandler(handler, event, item, value) {
|
4197
3805
|
// console.log(handler, event, item, value);
|
4198
|
-
|
3806
|
+
|
4199
3807
|
// append a div element that we use as a tooltip unless it already exists
|
4200
3808
|
this.el = document.getElementById(this.options.id);
|
4201
3809
|
if (!this.el) {
|
4202
3810
|
this.el = document.createElement('div');
|
4203
3811
|
this.el.setAttribute('id', this.options.id);
|
4204
3812
|
this.el.classList.add('vg-tooltip');
|
4205
|
-
const tooltipContainer =
|
3813
|
+
const tooltipContainer = document.fullscreenElement ?? document.body;
|
4206
3814
|
tooltipContainer.appendChild(this.el);
|
4207
3815
|
}
|
3816
|
+
|
4208
3817
|
// hide tooltip for null, undefined, or empty string values
|
4209
3818
|
if (value == null || value === '') {
|
4210
3819
|
this.el.classList.remove('visible', `${this.options.theme}-theme`);
|
4211
3820
|
return;
|
4212
3821
|
}
|
3822
|
+
|
4213
3823
|
// set the tooltip content
|
4214
|
-
this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth);
|
3824
|
+
this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth, this.options.baseURL);
|
3825
|
+
|
4215
3826
|
// make the tooltip visible
|
4216
3827
|
this.el.classList.add('visible', `${this.options.theme}-theme`);
|
4217
3828
|
const {
|
@@ -4378,20 +3989,10 @@
|
|
4378
3989
|
}
|
4379
3990
|
`;
|
4380
3991
|
|
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
3992
|
function isURL(s) {
|
4389
3993
|
return s.startsWith('http://') || s.startsWith('https://') || s.startsWith('//');
|
4390
3994
|
}
|
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
|
-
}
|
3995
|
+
function mergeDeep(dest, ...src) {
|
4395
3996
|
for (const s of src) {
|
4396
3997
|
deepMerge_(dest, s);
|
4397
3998
|
}
|
@@ -4404,7 +4005,7 @@
|
|
4404
4005
|
}
|
4405
4006
|
|
4406
4007
|
var name = "vega-embed";
|
4407
|
-
var version$1 = "6.
|
4008
|
+
var version$1 = "6.26.0";
|
4408
4009
|
var description = "Publish Vega visualizations as embedded web components.";
|
4409
4010
|
var keywords = ["vega", "data", "visualization", "component", "embed"];
|
4410
4011
|
var repository = {
|
@@ -4429,31 +4030,53 @@
|
|
4429
4030
|
var unpkg = "build/vega-embed.min.js";
|
4430
4031
|
var jsdelivr = "build/vega-embed.min.js";
|
4431
4032
|
var types = "build/vega-embed.module.d.ts";
|
4432
|
-
var files = ["src", "build"
|
4033
|
+
var files = ["src", "build"];
|
4034
|
+
var exports$1 = {
|
4035
|
+
".": {
|
4036
|
+
"import": {
|
4037
|
+
types: "./build/vega-embed.module.d.ts",
|
4038
|
+
"default": "./build/vega-embed.module.js"
|
4039
|
+
},
|
4040
|
+
require: {
|
4041
|
+
"default": "./build/vega-embed.js"
|
4042
|
+
}
|
4043
|
+
}
|
4044
|
+
};
|
4433
4045
|
var devDependencies = {
|
4434
|
-
"@babel/
|
4435
|
-
"@
|
4436
|
-
"@
|
4437
|
-
"@
|
4438
|
-
"@
|
4439
|
-
"@
|
4440
|
-
"@
|
4441
|
-
"
|
4442
|
-
|
4443
|
-
"
|
4444
|
-
"
|
4445
|
-
"
|
4446
|
-
"
|
4046
|
+
"@babel/core": "^7.24.7",
|
4047
|
+
"@babel/eslint-parser": "^7.24.7",
|
4048
|
+
"@babel/plugin-transform-runtime": "^7.24.7",
|
4049
|
+
"@babel/preset-env": "^7.24.7",
|
4050
|
+
"@babel/preset-typescript": "^7.24.7",
|
4051
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
4052
|
+
"@rollup/plugin-commonjs": "26.0.1",
|
4053
|
+
"@rollup/plugin-json": "^6.1.0",
|
4054
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
4055
|
+
"@rollup/plugin-terser": "^0.4.4",
|
4056
|
+
"@types/semver": "^7.5.8",
|
4057
|
+
"@typescript-eslint/parser": "^7.15.0",
|
4058
|
+
"@vitest/coverage-v8": "^1.6.0",
|
4059
|
+
"browser-sync": "^3.0.2",
|
4060
|
+
concurrently: "^8.2.2",
|
4061
|
+
"del-cli": "^5.1.0",
|
4062
|
+
eslint: "^9.6.0",
|
4063
|
+
"eslint-config-prettier": "^9.1.0",
|
4064
|
+
"eslint-plugin-prettier": "^5.1.3",
|
4065
|
+
"eslint-plugin-vitest": "^0.5.4",
|
4066
|
+
jsdom: "^24.1.0",
|
4447
4067
|
"postinstall-postinstall": "^2.1.0",
|
4448
|
-
|
4068
|
+
prettier: "^3.3.2",
|
4069
|
+
"release-it": "^17.4.1",
|
4070
|
+
rollup: "4.18.0",
|
4449
4071
|
"rollup-plugin-bundle-size": "^1.0.3",
|
4450
|
-
"rollup-plugin-ts": "^3.
|
4451
|
-
|
4452
|
-
|
4453
|
-
typescript: "^
|
4454
|
-
|
4455
|
-
"vega-lite": "^5.
|
4456
|
-
|
4072
|
+
"rollup-plugin-ts": "^3.4.5",
|
4073
|
+
sass: "^1.77.6",
|
4074
|
+
typescript: "^5.5.3",
|
4075
|
+
"typescript-eslint": "^7.15.0",
|
4076
|
+
vega: "^5.30.0",
|
4077
|
+
"vega-lite": "^5.19.0",
|
4078
|
+
vitest: "^1.6.0",
|
4079
|
+
"vitest-canvas-mock": "^0.3.3"
|
4457
4080
|
};
|
4458
4081
|
var peerDependencies = {
|
4459
4082
|
vega: "^5.21.0",
|
@@ -4462,31 +4085,27 @@
|
|
4462
4085
|
var dependencies = {
|
4463
4086
|
"fast-json-patch": "^3.1.1",
|
4464
4087
|
"json-stringify-pretty-compact": "^3.0.0",
|
4465
|
-
semver: "^7.
|
4466
|
-
tslib: "^2.
|
4467
|
-
"vega-interpreter": "^1.0.
|
4088
|
+
semver: "^7.6.2",
|
4089
|
+
tslib: "^2.6.3",
|
4090
|
+
"vega-interpreter": "^1.0.5",
|
4468
4091
|
"vega-schema-url-parser": "^2.2.0",
|
4469
|
-
"vega-themes": "^2.
|
4470
|
-
"vega-tooltip": "^0.
|
4092
|
+
"vega-themes": "^2.15.0",
|
4093
|
+
"vega-tooltip": "^0.34.0"
|
4471
4094
|
};
|
4472
|
-
var bundledDependencies = ["yallist"];
|
4473
4095
|
var scripts = {
|
4474
4096
|
prebuild: "yarn clean && yarn build:style",
|
4475
4097
|
build: "rollup -c",
|
4476
4098
|
"build:style": "./build-style.sh",
|
4477
|
-
clean: "del-cli build
|
4099
|
+
clean: "del-cli build src/style.ts",
|
4478
4100
|
prepublishOnly: "yarn clean && yarn build",
|
4479
4101
|
preversion: "yarn lint && yarn test",
|
4480
4102
|
serve: "browser-sync start --directory -s -f build *.html",
|
4481
4103
|
start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
|
4482
4104
|
pretest: "yarn build:style",
|
4483
|
-
test: "
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
eslintbase: "beemo eslint .",
|
4488
|
-
format: "yarn eslintbase --fix && yarn prettierbase --write",
|
4489
|
-
lint: "yarn eslintbase && yarn prettierbase --check",
|
4105
|
+
test: "vitest run",
|
4106
|
+
prettierbase: "prettier '*.{css,scss,html}'",
|
4107
|
+
format: "eslint . --fix && yarn prettierbase --write",
|
4108
|
+
lint: "eslint . && yarn prettierbase --check",
|
4490
4109
|
release: "release-it"
|
4491
4110
|
};
|
4492
4111
|
var pkg = {
|
@@ -4506,21 +4125,20 @@
|
|
4506
4125
|
jsdelivr: jsdelivr,
|
4507
4126
|
types: types,
|
4508
4127
|
files: files,
|
4128
|
+
exports: exports$1,
|
4509
4129
|
devDependencies: devDependencies,
|
4510
4130
|
peerDependencies: peerDependencies,
|
4511
4131
|
dependencies: dependencies,
|
4512
|
-
bundledDependencies: bundledDependencies,
|
4513
4132
|
scripts: scripts
|
4514
4133
|
};
|
4515
4134
|
|
4516
|
-
var _w$vl;
|
4517
4135
|
const version = pkg.version;
|
4518
4136
|
const vega = vegaImport__namespace;
|
4519
4137
|
let vegaLite = vegaLiteImport__namespace;
|
4520
4138
|
|
4521
4139
|
// For backwards compatibility with Vega-Lite before v4.
|
4522
4140
|
const w = typeof window !== 'undefined' ? window : undefined;
|
4523
|
-
if (vegaLite === undefined && w
|
4141
|
+
if (vegaLite === undefined && w?.vl?.compile) {
|
4524
4142
|
vegaLite = w.vl;
|
4525
4143
|
}
|
4526
4144
|
const DEFAULT_ACTIONS = {
|
@@ -4586,7 +4204,7 @@
|
|
4586
4204
|
console.warn(`The given visualization spec is written in ${NAMES[parsed.library]}, but mode argument sets ${NAMES[providedMode] ?? providedMode}.`);
|
4587
4205
|
}
|
4588
4206
|
const mode = parsed.library;
|
4589
|
-
if (!
|
4207
|
+
if (!satisfies$1(VERSION[mode], `^${parsed.version.slice(1)}`)) {
|
4590
4208
|
console.warn(`The input spec uses ${NAMES[mode]} ${parsed.version}, but the current version of ${NAMES[mode]} is v${VERSION[mode]}.`);
|
4591
4209
|
}
|
4592
4210
|
return mode;
|
@@ -4608,8 +4226,7 @@
|
|
4608
4226
|
return isLoader(opts) ? opts : vega.loader(opts);
|
4609
4227
|
}
|
4610
4228
|
function embedOptionsFromUsermeta(parsedSpec) {
|
4611
|
-
|
4612
|
-
const opts = ((_parsedSpec$usermeta = parsedSpec.usermeta) === null || _parsedSpec$usermeta === void 0 ? void 0 : _parsedSpec$usermeta.embedOptions) ?? {};
|
4229
|
+
const opts = parsedSpec.usermeta?.embedOptions ?? {};
|
4613
4230
|
if (vegaImport.isString(opts.defaultStyle)) {
|
4614
4231
|
// we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)
|
4615
4232
|
opts.defaultStyle = false;
|
@@ -4625,8 +4242,7 @@
|
|
4625
4242
|
* Object : The Vega/Vega-Lite specification as a parsed JSON object.
|
4626
4243
|
* @param opts A JavaScript object containing options for embedding.
|
4627
4244
|
*/
|
4628
|
-
async function embed(el, spec) {
|
4629
|
-
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
4245
|
+
async function embed(el, spec, opts = {}) {
|
4630
4246
|
let parsedSpec;
|
4631
4247
|
let loader;
|
4632
4248
|
if (vegaImport.isString(spec)) {
|
@@ -4673,9 +4289,7 @@
|
|
4673
4289
|
rootContainer: document.head ?? document.body
|
4674
4290
|
};
|
4675
4291
|
}
|
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;
|
4292
|
+
async function _embed(el, spec, opts = {}, loader) {
|
4679
4293
|
const config = opts.theme ? vegaImport.mergeConfig(themes[opts.theme], opts.config ?? {}) : opts.config;
|
4680
4294
|
const actions = vegaImport.isBoolean(opts.actions) ? opts.actions : mergeDeep({}, DEFAULT_ACTIONS, opts.actions ?? {});
|
4681
4295
|
const i18n = {
|
@@ -4707,7 +4321,7 @@
|
|
4707
4321
|
if (mode === 'vega-lite') {
|
4708
4322
|
if (vgSpec.$schema) {
|
4709
4323
|
const parsed = e(vgSpec.$schema);
|
4710
|
-
if (!
|
4324
|
+
if (!satisfies$1(VERSION.vega, `^${parsed.version.slice(1)}`)) {
|
4711
4325
|
console.warn(`The compiled spec uses Vega ${parsed.version}, but current version is v${VERSION.vega}.`);
|
4712
4326
|
}
|
4713
4327
|
}
|
@@ -4783,9 +4397,17 @@
|
|
4783
4397
|
}
|
4784
4398
|
});
|
4785
4399
|
if (opts.tooltip !== false) {
|
4786
|
-
const
|
4400
|
+
const {
|
4401
|
+
loader: loader_,
|
4402
|
+
tooltip
|
4403
|
+
} = opts;
|
4404
|
+
const baseURL = loader_ && !isLoader(loader_) ? loader_?.baseURL : undefined;
|
4405
|
+
const handler = isTooltipHandler(tooltip) ? tooltip :
|
4787
4406
|
// user provided boolean true or tooltip options
|
4788
|
-
new Handler(
|
4407
|
+
new Handler({
|
4408
|
+
baseURL,
|
4409
|
+
...(tooltip === true ? {} : tooltip)
|
4410
|
+
}).call;
|
4789
4411
|
view.tooltip(handler);
|
4790
4412
|
}
|
4791
4413
|
let {
|
@@ -4816,7 +4438,7 @@
|
|
4816
4438
|
let documentClickHandler;
|
4817
4439
|
if (actions !== false) {
|
4818
4440
|
let wrapper = element;
|
4819
|
-
if (opts.defaultStyle !== false) {
|
4441
|
+
if (opts.defaultStyle !== false || opts.forceActionsMenu) {
|
4820
4442
|
const details = document.createElement('details');
|
4821
4443
|
details.title = i18n.CLICK_TO_VIEW_ACTIONS;
|
4822
4444
|
element.append(details);
|
@@ -4863,7 +4485,7 @@
|
|
4863
4485
|
viewSourceLink.text = i18n.SOURCE_ACTION;
|
4864
4486
|
viewSourceLink.href = '#';
|
4865
4487
|
viewSourceLink.addEventListener('click', function (e) {
|
4866
|
-
viewSource(
|
4488
|
+
viewSource(stringify$1(spec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', mode);
|
4867
4489
|
e.preventDefault();
|
4868
4490
|
});
|
4869
4491
|
ctrl.append(viewSourceLink);
|
@@ -4875,7 +4497,7 @@
|
|
4875
4497
|
compileLink.text = i18n.COMPILED_ACTION;
|
4876
4498
|
compileLink.href = '#';
|
4877
4499
|
compileLink.addEventListener('click', function (e) {
|
4878
|
-
viewSource(
|
4500
|
+
viewSource(stringify$1(vgSpec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', 'vega');
|
4879
4501
|
e.preventDefault();
|
4880
4502
|
});
|
4881
4503
|
ctrl.append(compileLink);
|
@@ -4890,9 +4512,9 @@
|
|
4890
4512
|
editorLink.addEventListener('click', function (e) {
|
4891
4513
|
post(window, editorUrl, {
|
4892
4514
|
config: config,
|
4893
|
-
mode,
|
4515
|
+
mode: patch ? 'vega' : mode,
|
4894
4516
|
renderer,
|
4895
|
-
spec:
|
4517
|
+
spec: stringify$1(patch ? vgSpec : spec)
|
4896
4518
|
});
|
4897
4519
|
e.preventDefault();
|
4898
4520
|
});
|
@@ -4920,8 +4542,7 @@
|
|
4920
4542
|
*
|
4921
4543
|
* The main use case is in [Observable](https://observablehq.com/).
|
4922
4544
|
*/
|
4923
|
-
async function container (spec) {
|
4924
|
-
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
4545
|
+
async function container (spec, opt = {}) {
|
4925
4546
|
const wrapper = document.createElement('div');
|
4926
4547
|
wrapper.classList.add('vega-embed-wrapper');
|
4927
4548
|
const div = document.createElement('div');
|
@@ -4931,11 +4552,11 @@
|
|
4931
4552
|
source: false,
|
4932
4553
|
compiled: true,
|
4933
4554
|
editor: true,
|
4934
|
-
...
|
4555
|
+
...opt.actions
|
4935
4556
|
};
|
4936
4557
|
const result = await embed(div, spec, {
|
4937
4558
|
actions,
|
4938
|
-
...
|
4559
|
+
...opt
|
4939
4560
|
});
|
4940
4561
|
wrapper.value = result.view;
|
4941
4562
|
return wrapper;
|
@@ -4947,11 +4568,11 @@
|
|
4947
4568
|
function isElement(obj) {
|
4948
4569
|
return obj instanceof HTMLElement;
|
4949
4570
|
}
|
4950
|
-
const wrapper =
|
4951
|
-
if (
|
4952
|
-
return embed(
|
4571
|
+
const wrapper = (...args) => {
|
4572
|
+
if (args.length > 1 && (vegaImport.isString(args[0]) && !isURL(args[0]) || isElement(args[0]) || args.length === 3)) {
|
4573
|
+
return embed(args[0], args[1], args[2]);
|
4953
4574
|
}
|
4954
|
-
return container(
|
4575
|
+
return container(args[0], args[1]);
|
4955
4576
|
};
|
4956
4577
|
wrapper.vegaLite = vegaLite;
|
4957
4578
|
wrapper.vl = vegaLite; // backwards compatibility
|