@vitessce/vega 3.8.9 → 3.8.10

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.
Files changed (2) hide show
  1. package/dist/index.js +116 -31
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1377,40 +1377,51 @@ function compareDefined(compare2 = ascending$2) {
1377
1377
  function ascendingDefined(a2, b2) {
1378
1378
  return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
1379
1379
  }
1380
- var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
1380
+ const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
1381
+ function tickSpec(start, stop3, count2) {
1382
+ const step = (stop3 - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error2 = step / Math.pow(10, power), factor = error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1;
1383
+ let i1, i2, inc;
1384
+ if (power < 0) {
1385
+ inc = Math.pow(10, -power) / factor;
1386
+ i1 = Math.round(start * inc);
1387
+ i2 = Math.round(stop3 * inc);
1388
+ if (i1 / inc < start) ++i1;
1389
+ if (i2 / inc > stop3) --i2;
1390
+ inc = -inc;
1391
+ } else {
1392
+ inc = Math.pow(10, power) * factor;
1393
+ i1 = Math.round(start / inc);
1394
+ i2 = Math.round(stop3 / inc);
1395
+ if (i1 * inc < start) ++i1;
1396
+ if (i2 * inc > stop3) --i2;
1397
+ }
1398
+ if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop3, count2 * 2);
1399
+ return [i1, i2, inc];
1400
+ }
1381
1401
  function ticks(start, stop3, count2) {
1382
- var reverse2, i = -1, n, ticks2, step;
1383
1402
  stop3 = +stop3, start = +start, count2 = +count2;
1384
- if (start === stop3 && count2 > 0) return [start];
1385
- if (reverse2 = stop3 < start) n = start, start = stop3, stop3 = n;
1386
- if ((step = tickIncrement(start, stop3, count2)) === 0 || !isFinite(step)) return [];
1387
- if (step > 0) {
1388
- let r0 = Math.round(start / step), r1 = Math.round(stop3 / step);
1389
- if (r0 * step < start) ++r0;
1390
- if (r1 * step > stop3) --r1;
1391
- ticks2 = new Array(n = r1 - r0 + 1);
1392
- while (++i < n) ticks2[i] = (r0 + i) * step;
1403
+ if (!(count2 > 0)) return [];
1404
+ if (start === stop3) return [start];
1405
+ const reverse2 = stop3 < start, [i1, i2, inc] = reverse2 ? tickSpec(stop3, start, count2) : tickSpec(start, stop3, count2);
1406
+ if (!(i2 >= i1)) return [];
1407
+ const n = i2 - i1 + 1, ticks2 = new Array(n);
1408
+ if (reverse2) {
1409
+ if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc;
1410
+ else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc;
1393
1411
  } else {
1394
- step = -step;
1395
- let r0 = Math.round(start * step), r1 = Math.round(stop3 * step);
1396
- if (r0 / step < start) ++r0;
1397
- if (r1 / step > stop3) --r1;
1398
- ticks2 = new Array(n = r1 - r0 + 1);
1399
- while (++i < n) ticks2[i] = (r0 + i) / step;
1400
- }
1401
- if (reverse2) ticks2.reverse();
1412
+ if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc;
1413
+ else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc;
1414
+ }
1402
1415
  return ticks2;
1403
1416
  }
1404
1417
  function tickIncrement(start, stop3, count2) {
1405
- var step = (stop3 - start) / Math.max(0, count2), power = Math.floor(Math.log(step) / Math.LN10), error2 = step / Math.pow(10, power);
1406
- return power >= 0 ? (error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1);
1418
+ stop3 = +stop3, start = +start, count2 = +count2;
1419
+ return tickSpec(start, stop3, count2)[2];
1407
1420
  }
1408
1421
  function tickStep(start, stop3, count2) {
1409
- var step0 = Math.abs(stop3 - start) / Math.max(0, count2), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error2 = step0 / step1;
1410
- if (error2 >= e10) step1 *= 10;
1411
- else if (error2 >= e5) step1 *= 5;
1412
- else if (error2 >= e2) step1 *= 2;
1413
- return stop3 < start ? -step1 : step1;
1422
+ stop3 = +stop3, start = +start, count2 = +count2;
1423
+ const reverse2 = stop3 < start, inc = reverse2 ? tickIncrement(stop3, start, count2) : tickIncrement(start, stop3, count2);
1424
+ return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
1414
1425
  }
1415
1426
  function max$2(values2, valueof) {
1416
1427
  let max2;
@@ -1448,7 +1459,11 @@ function min$2(values2, valueof) {
1448
1459
  }
1449
1460
  return min2;
1450
1461
  }
1451
- function quickselect(array2, k, left = 0, right = array2.length - 1, compare2) {
1462
+ function quickselect(array2, k, left = 0, right = Infinity, compare2) {
1463
+ k = Math.floor(k);
1464
+ left = Math.floor(Math.max(0, left));
1465
+ right = Math.floor(Math.min(array2.length - 1, right));
1466
+ if (!(left <= k && k <= right)) return array2;
1452
1467
  compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
1453
1468
  while (right > left) {
1454
1469
  if (right - left > 600) {
@@ -1485,15 +1500,15 @@ function swap$1(array2, i, j) {
1485
1500
  }
1486
1501
  function quantile$1(values2, p, valueof) {
1487
1502
  values2 = Float64Array.from(numbers$2(values2, valueof));
1488
- if (!(n = values2.length)) return;
1489
- if ((p = +p) <= 0 || n < 2) return min$2(values2);
1503
+ if (!(n = values2.length) || isNaN(p = +p)) return;
1504
+ if (p <= 0 || n < 2) return min$2(values2);
1490
1505
  if (p >= 1) return max$2(values2);
1491
1506
  var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$2(quickselect(values2, i0).subarray(0, i0 + 1)), value1 = min$2(values2.subarray(i0 + 1));
1492
1507
  return value0 + (value1 - value0) * (i - i0);
1493
1508
  }
1494
1509
  function quantileSorted(values2, p, valueof = number$6) {
1495
- if (!(n = values2.length)) return;
1496
- if ((p = +p) <= 0 || n < 2) return +valueof(values2[0], 0, values2);
1510
+ if (!(n = values2.length) || isNaN(p = +p)) return;
1511
+ if (p <= 0 || n < 2) return +valueof(values2[0], 0, values2);
1497
1512
  if (p >= 1) return +valueof(values2[n - 1], n - 1, values2);
1498
1513
  var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values2[i0], i0, values2), value1 = +valueof(values2[i0 + 1], i0 + 1, values2);
1499
1514
  return value0 + (value1 - value0) * (i - i0);
@@ -43386,6 +43401,8 @@ function getInterpolateFunction(cmap) {
43386
43401
  }
43387
43402
  makeStyles()(() => ({
43388
43403
  legend: {
43404
+ position: "relative",
43405
+ // Needed for absolute positioning of slider overlay
43389
43406
  top: "2px",
43390
43407
  right: "2px",
43391
43408
  fontSize: "10px !important",
@@ -43417,6 +43434,74 @@ makeStyles()(() => ({
43417
43434
  },
43418
43435
  legendInvisible: {
43419
43436
  display: "none"
43437
+ },
43438
+ sliderContainer: {
43439
+ position: "absolute",
43440
+ // Position at the colormap location: top offset = titleHeight
43441
+ top: "10px",
43442
+ // titleHeight
43443
+ left: "2px",
43444
+ // Account for parent padding
43445
+ width: "calc(100% - 4px)",
43446
+ // Account for left and right padding
43447
+ height: "8px",
43448
+ // rectHeight
43449
+ "&:hover $sliderThumb": {
43450
+ opacity: 1
43451
+ }
43452
+ },
43453
+ sliderRoot: {
43454
+ position: "absolute",
43455
+ top: 0,
43456
+ left: 0,
43457
+ width: "100%",
43458
+ height: "8px",
43459
+ // rectHeight
43460
+ padding: 0,
43461
+ "& .MuiSlider-rail": {
43462
+ display: "none"
43463
+ },
43464
+ "& .MuiSlider-track": {
43465
+ display: "none"
43466
+ },
43467
+ "& .MuiSlider-valueLabel": {
43468
+ fontSize: "9px",
43469
+ padding: "2px 4px",
43470
+ backgroundColor: "rgb(0, 0, 0)",
43471
+ borderRadius: "2px"
43472
+ }
43473
+ },
43474
+ sliderThumb: {
43475
+ width: "4px",
43476
+ height: "12px",
43477
+ borderRadius: "2px",
43478
+ backgroundColor: "white",
43479
+ border: "1px solid black",
43480
+ opacity: 0,
43481
+ transition: "opacity 0.15s ease-in-out",
43482
+ "&:hover, &.Mui-focusVisible": {
43483
+ boxShadow: "0 0 0 4px rgba(0, 0, 0, 0.16)",
43484
+ opacity: 1
43485
+ },
43486
+ "&.Mui-active": {
43487
+ boxShadow: "0 0 0 6px rgba(0, 0, 0, 0.16)",
43488
+ opacity: 1
43489
+ }
43490
+ },
43491
+ colormapImage: {
43492
+ position: "absolute",
43493
+ top: "2px",
43494
+ height: "6px",
43495
+ // rectHeight
43496
+ pointerEvents: "none"
43497
+ },
43498
+ grayTrack: {
43499
+ position: "absolute",
43500
+ top: "2px",
43501
+ height: "6px",
43502
+ // rectHeight
43503
+ backgroundColor: "rgba(128, 128, 128, 0.5)",
43504
+ pointerEvents: "none"
43420
43505
  }
43421
43506
  }));
43422
43507
  makeStyles()(() => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vega",
3
- "version": "3.8.9",
3
+ "version": "3.8.10",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -21,9 +21,9 @@
21
21
  "vega": "^5.21.0",
22
22
  "vega-lite": "^5.1.1",
23
23
  "vega-tooltip": "^0.27.0",
24
- "@vitessce/styles": "3.8.9",
25
- "@vitessce/tooltip": "3.8.9",
26
- "@vitessce/legend": "3.8.9"
24
+ "@vitessce/styles": "3.8.10",
25
+ "@vitessce/tooltip": "3.8.10",
26
+ "@vitessce/legend": "3.8.10"
27
27
  },
28
28
  "devDependencies": {
29
29
  "react": "18.3.1",