flexdesk 0.12.0 → 0.13.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  modalHost
3
- } from "./chunk-6EZPPN4E.js";
3
+ } from "./chunk-NNFTETK3.js";
4
4
 
5
5
  // src/help/help_registry.js
6
6
  var EMPTY_PROVIDER = Object.freeze({
@@ -472,4 +472,4 @@ export {
472
472
  showContextMenu,
473
473
  hideContextMenu
474
474
  };
475
- //# sourceMappingURL=chunk-5QPGYHBN.js.map
475
+ //# sourceMappingURL=chunk-CWPMLX67.js.map
@@ -723,7 +723,7 @@ function buildLegendLayout(position) {
723
723
  }
724
724
  }
725
725
  function buildOverlayShapes(opts = {}) {
726
- const { referenceLines = [], shadedBands = [], yRefByAxisId = {} } = opts;
726
+ const { referenceLines = [], shadedBands = [], verticalLines = [], yRefByAxisId = {} } = opts;
727
727
  const shapes = [];
728
728
  const annotations = [];
729
729
  const dashMap = { solid: "solid", dashed: "dash", dotted: "dot", dashdot: "dashdot" };
@@ -792,6 +792,38 @@ function buildOverlayShapes(opts = {}) {
792
792
  });
793
793
  }
794
794
  }
795
+ for (const mark of verticalLines) {
796
+ if (mark == null || mark.x == null || typeof mark.x === "number" && !Number.isFinite(mark.x)) continue;
797
+ const color = mark.color || "rgba(255, 200, 0, 0.75)";
798
+ shapes.push({
799
+ type: "line",
800
+ xref: "x",
801
+ yref: "paper",
802
+ x0: mark.x,
803
+ x1: mark.x,
804
+ y0: 0,
805
+ y1: 1,
806
+ line: {
807
+ color,
808
+ width: mark.lineWidth ?? 1.5,
809
+ dash: dashMap[mark.lineStyle || "dashed"] || "dash"
810
+ },
811
+ layer: "above"
812
+ });
813
+ if (mark.label) {
814
+ annotations.push({
815
+ x: mark.x,
816
+ y: mark.labelY ?? 1,
817
+ xref: "x",
818
+ yref: "paper",
819
+ text: mark.label,
820
+ showarrow: false,
821
+ font: { size: 10, color },
822
+ xanchor: "left",
823
+ yanchor: "bottom"
824
+ });
825
+ }
826
+ }
795
827
  return { shapes, annotations };
796
828
  }
797
829
  function buildFanBandTraces(options) {
@@ -906,6 +938,78 @@ function buildIndicatorTrace(options) {
906
938
  return trace;
907
939
  }
908
940
 
941
+ // src/charts/downsample.js
942
+ function strideIndices(n, targetPoints) {
943
+ if (!Number.isFinite(n) || n <= 0) return null;
944
+ const target = Math.max(2, Math.floor(targetPoints) || 0);
945
+ if (n <= target) return null;
946
+ const step = (n - 1) / (target - 1);
947
+ const idx = new Array(target);
948
+ for (let i = 0; i < target; i++) idx[i] = Math.round(i * step);
949
+ idx[target - 1] = n - 1;
950
+ let w = 0;
951
+ for (let r = 0; r < idx.length; r++) {
952
+ if (w === 0 || idx[r] > idx[w - 1]) idx[w++] = idx[r];
953
+ }
954
+ idx.length = w;
955
+ return idx;
956
+ }
957
+ function strideDownsampleShared(time, series, targetPoints) {
958
+ const idx = strideIndices(time?.length ?? 0, targetPoints);
959
+ if (!idx) return { time, series };
960
+ const dsTime = idx.map((i) => time[i]);
961
+ const dsSeries = {};
962
+ for (const [name, arr] of Object.entries(series || {})) {
963
+ if (!Array.isArray(arr)) {
964
+ dsSeries[name] = arr;
965
+ continue;
966
+ }
967
+ dsSeries[name] = idx.map((i) => i < arr.length ? arr[i] : null);
968
+ }
969
+ return { time: dsTime, series: dsSeries };
970
+ }
971
+ function lttb(x, y, threshold) {
972
+ const n = Math.min(x?.length ?? 0, y?.length ?? 0);
973
+ const target = Math.floor(threshold) || 0;
974
+ if (target <= 0 || target >= n) return { x: x.slice(0, n), y: y.slice(0, n) };
975
+ if (target < 3) return { x: [x[0], x[n - 1]], y: [y[0], y[n - 1]] };
976
+ const num = (v) => Number.isFinite(v) ? v : 0;
977
+ const outX = [x[0]];
978
+ const outY = [y[0]];
979
+ const bucketSize = (n - 2) / (target - 2);
980
+ let a = 0;
981
+ for (let i = 0; i < target - 2; i++) {
982
+ let nextStart = Math.floor((i + 1) * bucketSize) + 1;
983
+ let nextEnd = Math.min(Math.floor((i + 2) * bucketSize) + 1, n);
984
+ if (nextEnd <= nextStart) nextEnd = Math.min(nextStart + 1, n);
985
+ let avgX = 0, avgY = 0;
986
+ const count = nextEnd - nextStart;
987
+ for (let j = nextStart; j < nextEnd; j++) {
988
+ avgX += x[j];
989
+ avgY += num(y[j]);
990
+ }
991
+ avgX /= count;
992
+ avgY /= count;
993
+ const curStart = Math.floor(i * bucketSize) + 1;
994
+ const curEnd = Math.min(Math.floor((i + 1) * bucketSize) + 1, n);
995
+ const ax = x[a], ay = num(y[a]);
996
+ let maxArea = -1, chosen = curStart;
997
+ for (let j = curStart; j < curEnd; j++) {
998
+ const area = Math.abs((ax - avgX) * (num(y[j]) - ay) - (ax - x[j]) * (avgY - ay));
999
+ if (area > maxArea) {
1000
+ maxArea = area;
1001
+ chosen = j;
1002
+ }
1003
+ }
1004
+ outX.push(x[chosen]);
1005
+ outY.push(y[chosen]);
1006
+ a = chosen;
1007
+ }
1008
+ outX.push(x[n - 1]);
1009
+ outY.push(y[n - 1]);
1010
+ return { x: outX, y: outY };
1011
+ }
1012
+
909
1013
  // src/charts/plot_config.js
910
1014
  var _uid = 0;
911
1015
  function uid(prefix = "p") {
@@ -2360,6 +2464,9 @@ export {
2360
2464
  buildBoxTrace,
2361
2465
  buildHeatmapTrace,
2362
2466
  buildIndicatorTrace,
2467
+ strideIndices,
2468
+ strideDownsampleShared,
2469
+ lttb,
2363
2470
  uid,
2364
2471
  applyNanHandling,
2365
2472
  PLOT_LAYOUTS,
@@ -2370,4 +2477,4 @@ export {
2370
2477
  openPlotPopoutWindow,
2371
2478
  openRawTracesWindow
2372
2479
  };
2373
- //# sourceMappingURL=chunk-2LEJQD4H.js.map
2480
+ //# sourceMappingURL=chunk-IYMNDPWH.js.map