vega 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -948,657 +948,39 @@
948
948
  };
949
949
  var stringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStringifyPrettyCompact);
950
950
 
951
- var iterator;
952
- var hasRequiredIterator;
953
- function requireIterator() {
954
- if (hasRequiredIterator) return iterator;
955
- hasRequiredIterator = 1;
956
- iterator = function (Yallist) {
957
- Yallist.prototype[Symbol.iterator] = function* () {
958
- for (let walker = this.head; walker; walker = walker.next) {
959
- yield walker.value;
960
- }
961
- };
962
- };
963
- return iterator;
964
- }
965
-
966
- var yallist = Yallist$1;
967
- Yallist$1.Node = Node;
968
- Yallist$1.create = Yallist$1;
969
- function Yallist$1(list) {
970
- var self = this;
971
- if (!(self instanceof Yallist$1)) {
972
- self = new Yallist$1();
973
- }
974
- self.tail = null;
975
- self.head = null;
976
- self.length = 0;
977
- if (list && typeof list.forEach === 'function') {
978
- list.forEach(function (item) {
979
- self.push(item);
980
- });
981
- } else if (arguments.length > 0) {
982
- for (var i = 0, l = arguments.length; i < l; i++) {
983
- self.push(arguments[i]);
984
- }
985
- }
986
- return self;
987
- }
988
- Yallist$1.prototype.removeNode = function (node) {
989
- if (node.list !== this) {
990
- throw new Error('removing node which does not belong to this list');
991
- }
992
- var next = node.next;
993
- var prev = node.prev;
994
- if (next) {
995
- next.prev = prev;
996
- }
997
- if (prev) {
998
- prev.next = next;
999
- }
1000
- if (node === this.head) {
1001
- this.head = next;
1002
- }
1003
- if (node === this.tail) {
1004
- this.tail = prev;
1005
- }
1006
- node.list.length--;
1007
- node.next = null;
1008
- node.prev = null;
1009
- node.list = null;
1010
- return next;
1011
- };
1012
- Yallist$1.prototype.unshiftNode = function (node) {
1013
- if (node === this.head) {
1014
- return;
1015
- }
1016
- if (node.list) {
1017
- node.list.removeNode(node);
1018
- }
1019
- var head = this.head;
1020
- node.list = this;
1021
- node.next = head;
1022
- if (head) {
1023
- head.prev = node;
1024
- }
1025
- this.head = node;
1026
- if (!this.tail) {
1027
- this.tail = node;
1028
- }
1029
- this.length++;
1030
- };
1031
- Yallist$1.prototype.pushNode = function (node) {
1032
- if (node === this.tail) {
1033
- return;
1034
- }
1035
- if (node.list) {
1036
- node.list.removeNode(node);
1037
- }
1038
- var tail = this.tail;
1039
- node.list = this;
1040
- node.prev = tail;
1041
- if (tail) {
1042
- tail.next = node;
1043
- }
1044
- this.tail = node;
1045
- if (!this.head) {
1046
- this.head = node;
1047
- }
1048
- this.length++;
1049
- };
1050
- Yallist$1.prototype.push = function () {
1051
- for (var i = 0, l = arguments.length; i < l; i++) {
1052
- push(this, arguments[i]);
1053
- }
1054
- return this.length;
1055
- };
1056
- Yallist$1.prototype.unshift = function () {
1057
- for (var i = 0, l = arguments.length; i < l; i++) {
1058
- unshift(this, arguments[i]);
1059
- }
1060
- return this.length;
1061
- };
1062
- Yallist$1.prototype.pop = function () {
1063
- if (!this.tail) {
1064
- return undefined;
1065
- }
1066
- var res = this.tail.value;
1067
- this.tail = this.tail.prev;
1068
- if (this.tail) {
1069
- this.tail.next = null;
1070
- } else {
1071
- this.head = null;
1072
- }
1073
- this.length--;
1074
- return res;
1075
- };
1076
- Yallist$1.prototype.shift = function () {
1077
- if (!this.head) {
1078
- return undefined;
1079
- }
1080
- var res = this.head.value;
1081
- this.head = this.head.next;
1082
- if (this.head) {
1083
- this.head.prev = null;
1084
- } else {
1085
- this.tail = null;
1086
- }
1087
- this.length--;
1088
- return res;
1089
- };
1090
- Yallist$1.prototype.forEach = function (fn, thisp) {
1091
- thisp = thisp || this;
1092
- for (var walker = this.head, i = 0; walker !== null; i++) {
1093
- fn.call(thisp, walker.value, i, this);
1094
- walker = walker.next;
1095
- }
1096
- };
1097
- Yallist$1.prototype.forEachReverse = function (fn, thisp) {
1098
- thisp = thisp || this;
1099
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
1100
- fn.call(thisp, walker.value, i, this);
1101
- walker = walker.prev;
1102
- }
1103
- };
1104
- Yallist$1.prototype.get = function (n) {
1105
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
1106
- // abort out of the list early if we hit a cycle
1107
- walker = walker.next;
1108
- }
1109
- if (i === n && walker !== null) {
1110
- return walker.value;
1111
- }
1112
- };
1113
- Yallist$1.prototype.getReverse = function (n) {
1114
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
1115
- // abort out of the list early if we hit a cycle
1116
- walker = walker.prev;
1117
- }
1118
- if (i === n && walker !== null) {
1119
- return walker.value;
1120
- }
1121
- };
1122
- Yallist$1.prototype.map = function (fn, thisp) {
1123
- thisp = thisp || this;
1124
- var res = new Yallist$1();
1125
- for (var walker = this.head; walker !== null;) {
1126
- res.push(fn.call(thisp, walker.value, this));
1127
- walker = walker.next;
1128
- }
1129
- return res;
1130
- };
1131
- Yallist$1.prototype.mapReverse = function (fn, thisp) {
1132
- thisp = thisp || this;
1133
- var res = new Yallist$1();
1134
- for (var walker = this.tail; walker !== null;) {
1135
- res.push(fn.call(thisp, walker.value, this));
1136
- walker = walker.prev;
1137
- }
1138
- return res;
1139
- };
1140
- Yallist$1.prototype.reduce = function (fn, initial) {
1141
- var acc;
1142
- var walker = this.head;
1143
- if (arguments.length > 1) {
1144
- acc = initial;
1145
- } else if (this.head) {
1146
- walker = this.head.next;
1147
- acc = this.head.value;
1148
- } else {
1149
- throw new TypeError('Reduce of empty list with no initial value');
1150
- }
1151
- for (var i = 0; walker !== null; i++) {
1152
- acc = fn(acc, walker.value, i);
1153
- walker = walker.next;
1154
- }
1155
- return acc;
1156
- };
1157
- Yallist$1.prototype.reduceReverse = function (fn, initial) {
1158
- var acc;
1159
- var walker = this.tail;
1160
- if (arguments.length > 1) {
1161
- acc = initial;
1162
- } else if (this.tail) {
1163
- walker = this.tail.prev;
1164
- acc = this.tail.value;
1165
- } else {
1166
- throw new TypeError('Reduce of empty list with no initial value');
1167
- }
1168
- for (var i = this.length - 1; walker !== null; i--) {
1169
- acc = fn(acc, walker.value, i);
1170
- walker = walker.prev;
1171
- }
1172
- return acc;
1173
- };
1174
- Yallist$1.prototype.toArray = function () {
1175
- var arr = new Array(this.length);
1176
- for (var i = 0, walker = this.head; walker !== null; i++) {
1177
- arr[i] = walker.value;
1178
- walker = walker.next;
1179
- }
1180
- return arr;
1181
- };
1182
- Yallist$1.prototype.toArrayReverse = function () {
1183
- var arr = new Array(this.length);
1184
- for (var i = 0, walker = this.tail; walker !== null; i++) {
1185
- arr[i] = walker.value;
1186
- walker = walker.prev;
1187
- }
1188
- return arr;
1189
- };
1190
- Yallist$1.prototype.slice = function (from, to) {
1191
- to = to || this.length;
1192
- if (to < 0) {
1193
- to += this.length;
1194
- }
1195
- from = from || 0;
1196
- if (from < 0) {
1197
- from += this.length;
1198
- }
1199
- var ret = new Yallist$1();
1200
- if (to < from || to < 0) {
1201
- return ret;
1202
- }
1203
- if (from < 0) {
1204
- from = 0;
1205
- }
1206
- if (to > this.length) {
1207
- to = this.length;
1208
- }
1209
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
1210
- walker = walker.next;
1211
- }
1212
- for (; walker !== null && i < to; i++, walker = walker.next) {
1213
- ret.push(walker.value);
1214
- }
1215
- return ret;
1216
- };
1217
- Yallist$1.prototype.sliceReverse = function (from, to) {
1218
- to = to || this.length;
1219
- if (to < 0) {
1220
- to += this.length;
1221
- }
1222
- from = from || 0;
1223
- if (from < 0) {
1224
- from += this.length;
1225
- }
1226
- var ret = new Yallist$1();
1227
- if (to < from || to < 0) {
1228
- return ret;
1229
- }
1230
- if (from < 0) {
1231
- from = 0;
1232
- }
1233
- if (to > this.length) {
1234
- to = this.length;
1235
- }
1236
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
1237
- walker = walker.prev;
1238
- }
1239
- for (; walker !== null && i > from; i--, walker = walker.prev) {
1240
- ret.push(walker.value);
1241
- }
1242
- return ret;
1243
- };
1244
- Yallist$1.prototype.splice = function (start, deleteCount, ...nodes) {
1245
- if (start > this.length) {
1246
- start = this.length - 1;
1247
- }
1248
- if (start < 0) {
1249
- start = this.length + start;
1250
- }
1251
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
1252
- walker = walker.next;
1253
- }
1254
- var ret = [];
1255
- for (var i = 0; walker && i < deleteCount; i++) {
1256
- ret.push(walker.value);
1257
- walker = this.removeNode(walker);
1258
- }
1259
- if (walker === null) {
1260
- walker = this.tail;
1261
- }
1262
- if (walker !== this.head && walker !== this.tail) {
1263
- walker = walker.prev;
1264
- }
1265
- for (var i = 0; i < nodes.length; i++) {
1266
- walker = insert(this, walker, nodes[i]);
1267
- }
1268
- return ret;
1269
- };
1270
- Yallist$1.prototype.reverse = function () {
1271
- var head = this.head;
1272
- var tail = this.tail;
1273
- for (var walker = head; walker !== null; walker = walker.prev) {
1274
- var p = walker.prev;
1275
- walker.prev = walker.next;
1276
- walker.next = p;
1277
- }
1278
- this.head = tail;
1279
- this.tail = head;
1280
- return this;
1281
- };
1282
- function insert(self, node, value) {
1283
- var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
1284
- if (inserted.next === null) {
1285
- self.tail = inserted;
1286
- }
1287
- if (inserted.prev === null) {
1288
- self.head = inserted;
1289
- }
1290
- self.length++;
1291
- return inserted;
1292
- }
1293
- function push(self, item) {
1294
- self.tail = new Node(item, self.tail, null, self);
1295
- if (!self.head) {
1296
- self.head = self.tail;
1297
- }
1298
- self.length++;
1299
- }
1300
- function unshift(self, item) {
1301
- self.head = new Node(item, null, self.head, self);
1302
- if (!self.tail) {
1303
- self.tail = self.head;
1304
- }
1305
- self.length++;
1306
- }
1307
- function Node(value, prev, next, list) {
1308
- if (!(this instanceof Node)) {
1309
- return new Node(value, prev, next, list);
1310
- }
1311
- this.list = list;
1312
- this.value = value;
1313
- if (prev) {
1314
- prev.next = this;
1315
- this.prev = prev;
1316
- } else {
1317
- this.prev = null;
1318
- }
1319
- if (next) {
1320
- next.prev = this;
1321
- this.next = next;
1322
- } else {
1323
- this.next = null;
1324
- }
1325
- }
1326
- try {
1327
- // add if support for Symbol.iterator is present
1328
- requireIterator()(Yallist$1);
1329
- } catch (er) {}
1330
-
1331
- // A linked list to keep track of recently-used-ness
1332
- const Yallist = yallist;
1333
- const MAX = Symbol('max');
1334
- const LENGTH = Symbol('length');
1335
- const LENGTH_CALCULATOR = Symbol('lengthCalculator');
1336
- const ALLOW_STALE = Symbol('allowStale');
1337
- const MAX_AGE = Symbol('maxAge');
1338
- const DISPOSE = Symbol('dispose');
1339
- const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
1340
- const LRU_LIST = Symbol('lruList');
1341
- const CACHE = Symbol('cache');
1342
- const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
1343
- const naiveLength = () => 1;
1344
-
1345
- // lruList is a yallist where the head is the youngest
1346
- // item, and the tail is the oldest. the list contains the Hit
1347
- // objects as the entries.
1348
- // Each Hit object has a reference to its Yallist.Node. This
1349
- // never changes.
1350
- //
1351
- // cache is a Map (or PseudoMap) that matches the keys to
1352
- // the Yallist.Node object.
1353
951
  class LRUCache {
1354
- constructor(options) {
1355
- if (typeof options === 'number') options = {
1356
- max: options
1357
- };
1358
- if (!options) options = {};
1359
- if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number');
1360
- // Kind of weird to have a default max of Infinity, but oh well.
1361
- this[MAX] = options.max || Infinity;
1362
- const lc = options.length || naiveLength;
1363
- this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;
1364
- this[ALLOW_STALE] = options.stale || false;
1365
- if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');
1366
- this[MAX_AGE] = options.maxAge || 0;
1367
- this[DISPOSE] = options.dispose;
1368
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
1369
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
1370
- this.reset();
1371
- }
1372
-
1373
- // resize the cache when the max changes.
1374
- set max(mL) {
1375
- if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');
1376
- this[MAX] = mL || Infinity;
1377
- trim(this);
1378
- }
1379
- get max() {
1380
- return this[MAX];
1381
- }
1382
- set allowStale(allowStale) {
1383
- this[ALLOW_STALE] = !!allowStale;
1384
- }
1385
- get allowStale() {
1386
- return this[ALLOW_STALE];
1387
- }
1388
- set maxAge(mA) {
1389
- if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');
1390
- this[MAX_AGE] = mA;
1391
- trim(this);
1392
- }
1393
- get maxAge() {
1394
- return this[MAX_AGE];
1395
- }
1396
-
1397
- // resize the cache when the lengthCalculator changes.
1398
- set lengthCalculator(lC) {
1399
- if (typeof lC !== 'function') lC = naiveLength;
1400
- if (lC !== this[LENGTH_CALCULATOR]) {
1401
- this[LENGTH_CALCULATOR] = lC;
1402
- this[LENGTH] = 0;
1403
- this[LRU_LIST].forEach(hit => {
1404
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
1405
- this[LENGTH] += hit.length;
1406
- });
1407
- }
1408
- trim(this);
1409
- }
1410
- get lengthCalculator() {
1411
- return this[LENGTH_CALCULATOR];
1412
- }
1413
- get length() {
1414
- return this[LENGTH];
1415
- }
1416
- get itemCount() {
1417
- return this[LRU_LIST].length;
1418
- }
1419
- rforEach(fn, thisp) {
1420
- thisp = thisp || this;
1421
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
1422
- const prev = walker.prev;
1423
- forEachStep(this, fn, walker, thisp);
1424
- walker = prev;
1425
- }
1426
- }
1427
- forEach(fn, thisp) {
1428
- thisp = thisp || this;
1429
- for (let walker = this[LRU_LIST].head; walker !== null;) {
1430
- const next = walker.next;
1431
- forEachStep(this, fn, walker, thisp);
1432
- walker = next;
1433
- }
1434
- }
1435
- keys() {
1436
- return this[LRU_LIST].toArray().map(k => k.key);
1437
- }
1438
- values() {
1439
- return this[LRU_LIST].toArray().map(k => k.value);
1440
- }
1441
- reset() {
1442
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
1443
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
1444
- }
1445
- this[CACHE] = new Map(); // hash of items by key
1446
- this[LRU_LIST] = new Yallist(); // list of items in order of use recency
1447
- this[LENGTH] = 0; // length of items in the list
1448
- }
1449
- dump() {
1450
- return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {
1451
- k: hit.key,
1452
- v: hit.value,
1453
- e: hit.now + (hit.maxAge || 0)
1454
- }).toArray().filter(h => h);
1455
- }
1456
- dumpLru() {
1457
- return this[LRU_LIST];
1458
- }
1459
- set(key, value, maxAge) {
1460
- maxAge = maxAge || this[MAX_AGE];
1461
- if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');
1462
- const now = maxAge ? Date.now() : 0;
1463
- const len = this[LENGTH_CALCULATOR](value, key);
1464
- if (this[CACHE].has(key)) {
1465
- if (len > this[MAX]) {
1466
- del(this, this[CACHE].get(key));
1467
- return false;
1468
- }
1469
- const node = this[CACHE].get(key);
1470
- const item = node.value;
1471
-
1472
- // dispose of the old one before overwriting
1473
- // split out into 2 ifs for better coverage tracking
1474
- if (this[DISPOSE]) {
1475
- if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);
1476
- }
1477
- item.now = now;
1478
- item.maxAge = maxAge;
1479
- item.value = value;
1480
- this[LENGTH] += len - item.length;
1481
- item.length = len;
1482
- this.get(key);
1483
- trim(this);
1484
- return true;
1485
- }
1486
- const hit = new Entry(key, value, len, now, maxAge);
1487
-
1488
- // oversized objects fall out of cache automatically.
1489
- if (hit.length > this[MAX]) {
1490
- if (this[DISPOSE]) this[DISPOSE](key, value);
1491
- return false;
1492
- }
1493
- this[LENGTH] += hit.length;
1494
- this[LRU_LIST].unshift(hit);
1495
- this[CACHE].set(key, this[LRU_LIST].head);
1496
- trim(this);
1497
- return true;
1498
- }
1499
- has(key) {
1500
- if (!this[CACHE].has(key)) return false;
1501
- const hit = this[CACHE].get(key).value;
1502
- return !isStale(this, hit);
952
+ constructor() {
953
+ this.max = 1000;
954
+ this.map = new Map();
1503
955
  }
1504
956
  get(key) {
1505
- return get(this, key, true);
1506
- }
1507
- peek(key) {
1508
- return get(this, key, false);
1509
- }
1510
- pop() {
1511
- const node = this[LRU_LIST].tail;
1512
- if (!node) return null;
1513
- del(this, node);
1514
- return node.value;
1515
- }
1516
- del(key) {
1517
- del(this, this[CACHE].get(key));
1518
- }
1519
- load(arr) {
1520
- // reset the cache
1521
- this.reset();
1522
- const now = Date.now();
1523
- // A previous serialized cache has the most recent items first
1524
- for (let l = arr.length - 1; l >= 0; l--) {
1525
- const hit = arr[l];
1526
- const expiresAt = hit.e || 0;
1527
- if (expiresAt === 0)
1528
- // the item was created without expiration in a non aged cache
1529
- this.set(hit.k, hit.v);else {
1530
- const maxAge = expiresAt - now;
1531
- // dont add already expired items
1532
- if (maxAge > 0) {
1533
- this.set(hit.k, hit.v, maxAge);
1534
- }
1535
- }
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;
1536
965
  }
1537
966
  }
1538
- prune() {
1539
- this[CACHE].forEach((value, key) => get(this, key, false));
967
+ delete(key) {
968
+ return this.map.delete(key);
1540
969
  }
1541
- }
1542
- const get = (self, key, doUse) => {
1543
- const node = self[CACHE].get(key);
1544
- if (node) {
1545
- const hit = node.value;
1546
- if (isStale(self, hit)) {
1547
- del(self, node);
1548
- if (!self[ALLOW_STALE]) return undefined;
1549
- } else {
1550
- if (doUse) {
1551
- if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();
1552
- 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);
1553
977
  }
978
+ this.map.set(key, value);
1554
979
  }
1555
- return hit.value;
1556
- }
1557
- };
1558
- const isStale = (self, hit) => {
1559
- if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;
1560
- const diff = Date.now() - hit.now;
1561
- return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
1562
- };
1563
- const trim = self => {
1564
- if (self[LENGTH] > self[MAX]) {
1565
- for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {
1566
- // We know that we're about to delete this one, and also
1567
- // what the next least recently used key will be, so just
1568
- // go ahead and set it now.
1569
- const prev = walker.prev;
1570
- del(self, walker);
1571
- walker = prev;
1572
- }
1573
- }
1574
- };
1575
- const del = (self, node) => {
1576
- if (node) {
1577
- const hit = node.value;
1578
- if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);
1579
- self[LENGTH] -= hit.length;
1580
- self[CACHE].delete(hit.key);
1581
- self[LRU_LIST].removeNode(node);
1582
- }
1583
- };
1584
- class Entry {
1585
- constructor(key, value, length, now, maxAge) {
1586
- this.key = key;
1587
- this.value = value;
1588
- this.length = length;
1589
- this.now = now;
1590
- this.maxAge = maxAge || 0;
980
+ return this;
1591
981
  }
1592
982
  }
1593
- const forEachStep = (self, fn, node, thisp) => {
1594
- let hit = node.value;
1595
- if (isStale(self, hit)) {
1596
- del(self, node);
1597
- if (!self[ALLOW_STALE]) hit = undefined;
1598
- }
1599
- if (hit) fn.call(thisp, hit.value, hit.key, self);
1600
- };
1601
- var lruCache = LRUCache;
983
+ var lrucache = LRUCache;
1602
984
 
1603
985
  // parse out just the options we care about
1604
986
  const looseOption = Object.freeze({
@@ -1962,7 +1344,7 @@
1962
1344
  do {
1963
1345
  const a = this.build[i];
1964
1346
  const b = other.build[i];
1965
- debug('prerelease compare', i, a, b);
1347
+ debug('build compare', i, a, b);
1966
1348
  if (a === undefined && b === undefined) {
1967
1349
  return 0;
1968
1350
  } else if (b === undefined) {
@@ -2464,10 +1846,8 @@
2464
1846
  }
2465
1847
  }
2466
1848
  range = Range;
2467
- const LRU = lruCache;
2468
- const cache = new LRU({
2469
- max: 1000
2470
- });
1849
+ const LRU = lrucache;
1850
+ const cache = new LRU();
2471
1851
  const parseOptions = parseOptions_1;
2472
1852
  const Comparator = requireComparator();
2473
1853
  const debug = debug_1;
@@ -2695,7 +2075,8 @@
2695
2075
  // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
2696
2076
  // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
2697
2077
  // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
2698
- const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
2078
+ // TODO build?
2079
+ const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
2699
2080
  if (isX(fM)) {
2700
2081
  from = '';
2701
2082
  } else if (isX(fm)) {
@@ -3067,7 +2448,7 @@
3067
2448
  }
3068
2449
 
3069
2450
  var name$1 = "vega-themes";
3070
- var version$1$1 = "2.14.0";
2451
+ var version$1$1 = "2.15.0";
3071
2452
  var description$1 = "Themes for stylized Vega and Vega-Lite visualizations.";
3072
2453
  var keywords$1 = ["vega", "vega-lite", "themes", "style"];
3073
2454
  var license$1 = "BSD-3-Clause";
@@ -3113,32 +2494,28 @@
3113
2494
  release: "release-it"
3114
2495
  };
3115
2496
  var devDependencies$1 = {
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",
3125
- "@rollup/plugin-json": "^6.0.0",
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",
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",
3132
2509
  eslint: "^8.45.0",
3133
- "eslint-config-prettier": "^8.8.0",
3134
- "eslint-plugin-prettier": "^5.0.0",
3135
- "gh-pages": "^5.0.0",
3136
- prettier: "^3.0.0",
3137
- "release-it": "^16.1.0",
3138
- rollup: "^3.26.2",
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",
3139
2516
  "rollup-plugin-bundle-size": "^1.0.3",
3140
- "rollup-plugin-ts": "^3.2.0",
3141
- typescript: "^5.1.6",
2517
+ "rollup-plugin-ts": "^3.4.5",
2518
+ typescript: "^5.4.5",
3142
2519
  vega: "^5.25.0",
3143
2520
  "vega-lite": "^5.9.3"
3144
2521
  };
@@ -3904,15 +3281,46 @@
3904
3281
  }
3905
3282
  };
3906
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';
3907
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
+ };
3908
3314
  const darkCategories = ['#8a3ffc', '#33b1ff', '#007d79', '#ff7eb6', '#fa4d56', '#fff1f1', '#6fdc8c', '#4589ff', '#d12771', '#d2a106', '#08bdba', '#bae6ff', '#ba4e00', '#d4bbff'];
3909
3315
  const lightCategories = ['#6929c4', '#1192e8', '#005d5d', '#9f1853', '#fa4d56', '#570408', '#198038', '#002d9c', '#ee538b', '#b28600', '#009d9a', '#012749', '#8a3800', '#a56eff'];
3910
3316
  function genCarbonConfig({
3911
- type,
3317
+ theme,
3912
3318
  background
3913
3319
  }) {
3914
- const viewbg = type === 'dark' ? '#161616' : '#ffffff';
3915
- const textColor = type === 'dark' ? '#f4f4f4' : '#161616';
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];
3916
3324
  const category = type === 'dark' ? darkCategories : lightCategories;
3917
3325
  const markColor = type === 'dark' ? '#d4bbff' : '#6929c4';
3918
3326
  return {
@@ -3946,7 +3354,7 @@
3946
3354
  fill: viewbg
3947
3355
  },
3948
3356
  title: {
3949
- color: textColor,
3357
+ color: titleColor,
3950
3358
  anchor: 'start',
3951
3359
  dy: -15,
3952
3360
  fontSize: 16,
@@ -3954,13 +3362,26 @@
3954
3362
  fontWeight: 600
3955
3363
  },
3956
3364
  axis: {
3365
+ // Axis labels
3957
3366
  labelColor: textColor,
3958
3367
  labelFontSize: 12,
3368
+ labelFont: condensedFont,
3369
+ labelFontWeight: fontWeight,
3370
+ // Axis titles
3371
+ titleColor: titleColor,
3372
+ titleFontWeight: 600,
3373
+ titleFontSize: 12,
3374
+ // MISC
3959
3375
  grid: true,
3960
- gridColor: '#525252',
3961
- titleColor: textColor,
3376
+ gridColor: TOKENS.layerAccent01[theme],
3962
3377
  labelAngle: 0
3963
3378
  },
3379
+ axisX: {
3380
+ titlePadding: 10
3381
+ },
3382
+ axisY: {
3383
+ titlePadding: 2.5
3384
+ },
3964
3385
  style: {
3965
3386
  'guide-label': {
3966
3387
  font: defaultFont,
@@ -3981,19 +3402,19 @@
3981
3402
  };
3982
3403
  }
3983
3404
  const carbonwhite = genCarbonConfig({
3984
- type: 'light',
3405
+ theme: 'white',
3985
3406
  background: '#ffffff'
3986
3407
  });
3987
3408
  const carbong10 = genCarbonConfig({
3988
- type: 'light',
3409
+ theme: 'g10',
3989
3410
  background: '#f4f4f4'
3990
3411
  });
3991
3412
  const carbong90 = genCarbonConfig({
3992
- type: 'dark',
3413
+ theme: 'g90',
3993
3414
  background: '#262626'
3994
3415
  });
3995
3416
  const carbong100 = genCarbonConfig({
3996
- type: 'dark',
3417
+ theme: 'g100',
3997
3418
  background: '#161616'
3998
3419
  });
3999
3420
  const version$2 = pkg$1.version;
@@ -4099,7 +3520,7 @@
4099
3520
  function field(field, name, opt) {
4100
3521
  const path = splitAccessPath(field);
4101
3522
  field = path.length === 1 ? path[0] : field;
4102
- return accessor((opt && opt.get || getter)(path), [field], name || field);
3523
+ return accessor((getter)(path), [field], field);
4103
3524
  }
4104
3525
  field('id');
4105
3526
  accessor(_ => _, [], 'identity');
@@ -4584,7 +4005,7 @@
4584
4005
  }
4585
4006
 
4586
4007
  var name = "vega-embed";
4587
- var version$1 = "6.25.0";
4008
+ var version$1 = "6.26.0";
4588
4009
  var description = "Publish Vega visualizations as embedded web components.";
4589
4010
  var keywords = ["vega", "data", "visualization", "component", "embed"];
4590
4011
  var repository = {
@@ -4610,40 +4031,52 @@
4610
4031
  var jsdelivr = "build/vega-embed.min.js";
4611
4032
  var types = "build/vega-embed.module.d.ts";
4612
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
+ };
4613
4045
  var devDependencies = {
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",
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",
4618
4051
  "@release-it/conventional-changelog": "^8.0.1",
4619
- "@rollup/plugin-commonjs": "25.0.7",
4052
+ "@rollup/plugin-commonjs": "26.0.1",
4620
4053
  "@rollup/plugin-json": "^6.1.0",
4621
4054
  "@rollup/plugin-node-resolve": "^15.2.3",
4622
4055
  "@rollup/plugin-terser": "^0.4.4",
4623
- "@types/jest": "^29.5.12",
4624
4056
  "@types/semver": "^7.5.8",
4625
- "@typescript-eslint/eslint-plugin": "^7.6.0",
4626
- "@typescript-eslint/parser": "^7.6.0",
4057
+ "@typescript-eslint/parser": "^7.15.0",
4058
+ "@vitest/coverage-v8": "^1.6.0",
4627
4059
  "browser-sync": "^3.0.2",
4628
4060
  concurrently: "^8.2.2",
4629
4061
  "del-cli": "^5.1.0",
4630
- eslint: "^8.56.0",
4062
+ eslint: "^9.6.0",
4631
4063
  "eslint-config-prettier": "^9.1.0",
4632
- "eslint-plugin-jest": "^28.2.0",
4633
4064
  "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",
4065
+ "eslint-plugin-vitest": "^0.5.4",
4066
+ jsdom: "^24.1.0",
4637
4067
  "postinstall-postinstall": "^2.1.0",
4638
- prettier: "^3.2.5",
4639
- "release-it": "^17.1.1",
4640
- rollup: "4.14.1",
4068
+ prettier: "^3.3.2",
4069
+ "release-it": "^17.4.1",
4070
+ rollup: "4.18.0",
4641
4071
  "rollup-plugin-bundle-size": "^1.0.3",
4642
4072
  "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"
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"
4647
4080
  };
4648
4081
  var peerDependencies = {
4649
4082
  vega: "^5.21.0",
@@ -4652,11 +4085,11 @@
4652
4085
  var dependencies = {
4653
4086
  "fast-json-patch": "^3.1.1",
4654
4087
  "json-stringify-pretty-compact": "^3.0.0",
4655
- semver: "^7.6.0",
4656
- tslib: "^2.6.2",
4088
+ semver: "^7.6.2",
4089
+ tslib: "^2.6.3",
4657
4090
  "vega-interpreter": "^1.0.5",
4658
4091
  "vega-schema-url-parser": "^2.2.0",
4659
- "vega-themes": "^2.14.0",
4092
+ "vega-themes": "^2.15.0",
4660
4093
  "vega-tooltip": "^0.34.0"
4661
4094
  };
4662
4095
  var scripts = {
@@ -4669,8 +4102,7 @@
4669
4102
  serve: "browser-sync start --directory -s -f build *.html",
4670
4103
  start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
4671
4104
  pretest: "yarn build:style",
4672
- test: "jest",
4673
- "test:inspect": "node --inspect-brk ./node_modules/.bin/jest --runInBand",
4105
+ test: "vitest run",
4674
4106
  prettierbase: "prettier '*.{css,scss,html}'",
4675
4107
  format: "eslint . --fix && yarn prettierbase --write",
4676
4108
  lint: "eslint . && yarn prettierbase --check",
@@ -4693,6 +4125,7 @@
4693
4125
  jsdelivr: jsdelivr,
4694
4126
  types: types,
4695
4127
  files: files,
4128
+ exports: exports$1,
4696
4129
  devDependencies: devDependencies,
4697
4130
  peerDependencies: peerDependencies,
4698
4131
  dependencies: dependencies,
@@ -5079,9 +4512,9 @@
5079
4512
  editorLink.addEventListener('click', function (e) {
5080
4513
  post(window, editorUrl, {
5081
4514
  config: config,
5082
- mode,
4515
+ mode: patch ? 'vega' : mode,
5083
4516
  renderer,
5084
- spec: stringify$1(spec)
4517
+ spec: stringify$1(patch ? vgSpec : spec)
5085
4518
  });
5086
4519
  e.preventDefault();
5087
4520
  });