@pixerate/editor 0.52.0 → 0.54.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.
Files changed (142) hide show
  1. package/dist/agent/index.cjs +37 -29
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.d.cts +4 -3
  4. package/dist/agent/index.d.ts +4 -3
  5. package/dist/agent/index.js +16 -8
  6. package/dist/agent/index.js.map +1 -1
  7. package/dist/animation/index.cjs +15 -1
  8. package/dist/animation/index.cjs.map +1 -1
  9. package/dist/animation/index.d.cts +3 -226
  10. package/dist/animation/index.d.ts +3 -226
  11. package/dist/animation/index.js +14 -0
  12. package/dist/bridge/cli.cjs +36 -0
  13. package/dist/bridge/cli.cjs.map +1 -0
  14. package/dist/bridge/cli.d.cts +1 -0
  15. package/dist/bridge/cli.d.ts +1 -0
  16. package/dist/bridge/cli.js +36 -0
  17. package/dist/bridge/cli.js.map +1 -0
  18. package/dist/bridge/index.cjs +16 -0
  19. package/dist/bridge/index.cjs.map +1 -0
  20. package/dist/bridge/index.d.cts +65 -0
  21. package/dist/bridge/index.d.ts +65 -0
  22. package/dist/bridge/index.js +16 -0
  23. package/dist/bridge/index.js.map +1 -0
  24. package/dist/bridge-client-C5OziCRK.d.cts +148 -0
  25. package/dist/bridge-client-C5dRjrz5.d.ts +148 -0
  26. package/dist/canvas/index.cjs +1308 -528
  27. package/dist/canvas/index.cjs.map +1 -1
  28. package/dist/canvas/index.d.cts +309 -5
  29. package/dist/canvas/index.d.ts +309 -5
  30. package/dist/canvas/index.js +1295 -515
  31. package/dist/canvas/index.js.map +1 -1
  32. package/dist/chart/index.cjs +193 -192
  33. package/dist/chart/index.cjs.map +1 -1
  34. package/dist/chart/index.d.cts +77 -59
  35. package/dist/chart/index.d.ts +77 -59
  36. package/dist/chart/index.js +87 -86
  37. package/dist/chart/index.js.map +1 -1
  38. package/dist/{chunk-UAW5FEMD.js → chunk-3S72F46R.js} +66 -8
  39. package/dist/chunk-3S72F46R.js.map +1 -0
  40. package/dist/{chunk-5TWIN7ZJ.js → chunk-47WWV3LI.js} +34 -4
  41. package/dist/chunk-47WWV3LI.js.map +1 -0
  42. package/dist/{chunk-OV7UAKIY.js → chunk-633QC34G.js} +172 -1
  43. package/dist/chunk-633QC34G.js.map +1 -0
  44. package/dist/chunk-AWKPSOSX.js +401 -0
  45. package/dist/chunk-AWKPSOSX.js.map +1 -0
  46. package/dist/chunk-B6DSIEXA.js +96 -0
  47. package/dist/chunk-B6DSIEXA.js.map +1 -0
  48. package/dist/{chunk-5N6AQCVB.js → chunk-BQQZ6MOI.js} +3 -3
  49. package/dist/{chunk-M5Z77GFH.cjs → chunk-C3JHII3M.cjs} +53 -53
  50. package/dist/{chunk-M5Z77GFH.cjs.map → chunk-C3JHII3M.cjs.map} +1 -1
  51. package/dist/{chunk-JOX6MJW4.cjs → chunk-CKRNELPO.cjs} +176 -5
  52. package/dist/chunk-CKRNELPO.cjs.map +1 -0
  53. package/dist/{chunk-TGBCBQFV.cjs → chunk-DK6QBGCS.cjs} +45 -15
  54. package/dist/chunk-DK6QBGCS.cjs.map +1 -0
  55. package/dist/chunk-EGFUVXKK.cjs +96 -0
  56. package/dist/chunk-EGFUVXKK.cjs.map +1 -0
  57. package/dist/{chunk-AMWXSYCI.js → chunk-GPWNYQ7R.js} +2 -370
  58. package/dist/chunk-GPWNYQ7R.js.map +1 -0
  59. package/dist/chunk-H5K77C7Y.cjs +3848 -0
  60. package/dist/chunk-H5K77C7Y.cjs.map +1 -0
  61. package/dist/chunk-K73CKYUM.cjs +458 -0
  62. package/dist/chunk-K73CKYUM.cjs.map +1 -0
  63. package/dist/{chunk-GTZXF4BI.cjs → chunk-NK3WL5TJ.cjs} +298 -133
  64. package/dist/chunk-NK3WL5TJ.cjs.map +1 -0
  65. package/dist/{chunk-3ZBAXET6.cjs → chunk-NN3JGUSX.cjs} +80 -22
  66. package/dist/chunk-NN3JGUSX.cjs.map +1 -0
  67. package/dist/chunk-NV22EMOZ.cjs +401 -0
  68. package/dist/chunk-NV22EMOZ.cjs.map +1 -0
  69. package/dist/{chunk-YMKPMXZ4.js → chunk-OIKYP7XC.js} +4 -4
  70. package/dist/{chunk-FEMIVHN3.cjs → chunk-P43HUQRX.cjs} +16 -16
  71. package/dist/{chunk-FEMIVHN3.cjs.map → chunk-P43HUQRX.cjs.map} +1 -1
  72. package/dist/chunk-PTMIGXZ2.js +467 -0
  73. package/dist/chunk-PTMIGXZ2.js.map +1 -0
  74. package/dist/chunk-QIWFEEWG.cjs +467 -0
  75. package/dist/chunk-QIWFEEWG.cjs.map +1 -0
  76. package/dist/{chunk-QFTVLEVN.js → chunk-RIXTW3C4.js} +3 -3
  77. package/dist/{chunk-WBOAXDKD.js → chunk-VODBAO32.js} +222 -57
  78. package/dist/chunk-VODBAO32.js.map +1 -0
  79. package/dist/chunk-WWJNC7SX.js +3848 -0
  80. package/dist/chunk-WWJNC7SX.js.map +1 -0
  81. package/dist/{chunk-2DEBI6KU.cjs → chunk-YZZMX6V7.cjs} +10 -10
  82. package/dist/{chunk-2DEBI6KU.cjs.map → chunk-YZZMX6V7.cjs.map} +1 -1
  83. package/dist/commands/index.d.cts +1 -1
  84. package/dist/commands/index.d.ts +1 -1
  85. package/dist/{controller-DS3drIvy.d.cts → controller-CX0QfSv0.d.cts} +53 -2
  86. package/dist/{controller-BdKzaxs2.d.ts → controller-DscWQbjO.d.ts} +53 -2
  87. package/dist/diagram/index.cjs +1146 -0
  88. package/dist/diagram/index.cjs.map +1 -0
  89. package/dist/diagram/index.d.cts +787 -0
  90. package/dist/diagram/index.d.ts +787 -0
  91. package/dist/diagram/index.js +1146 -0
  92. package/dist/diagram/index.js.map +1 -0
  93. package/dist/{easing-DTmX99QG.d.cts → easing-CNGk-W6d.d.cts} +1 -1
  94. package/dist/{easing-DTmX99QG.d.ts → easing-CNGk-W6d.d.ts} +1 -1
  95. package/dist/export/index.cjs +4 -4
  96. package/dist/export/index.js +3 -3
  97. package/dist/extensions/index.cjs +6 -6
  98. package/dist/extensions/index.d.cts +2 -2
  99. package/dist/extensions/index.d.ts +2 -2
  100. package/dist/extensions/index.js +5 -5
  101. package/dist/generation/index.d.cts +2 -2
  102. package/dist/generation/index.d.ts +2 -2
  103. package/dist/image-editor/index.d.cts +1 -1
  104. package/dist/image-editor/index.d.ts +1 -1
  105. package/dist/{index-Dt9lzydb.d.ts → index-CALDD35B.d.ts} +1 -1
  106. package/dist/{index-DOy9HzfC.d.cts → index-DIWB6xMf.d.cts} +1 -1
  107. package/dist/index.cjs +13 -13
  108. package/dist/index.d.cts +3 -3
  109. package/dist/index.d.ts +3 -3
  110. package/dist/index.js +6 -6
  111. package/dist/parameters/index.d.cts +1 -1
  112. package/dist/parameters/index.d.ts +1 -1
  113. package/dist/player-DSMjdgQ9.d.cts +225 -0
  114. package/dist/player-DdfVrKWq.d.ts +225 -0
  115. package/dist/presence-Cb6WhcrQ.d.cts +77 -0
  116. package/dist/presence-Cb6WhcrQ.d.ts +77 -0
  117. package/dist/{registry-CSlH4iUn.d.ts → registry-7AZFuand.d.ts} +1 -1
  118. package/dist/{registry-B4l-lYts.d.cts → registry-DIpIaCkH.d.cts} +1 -1
  119. package/dist/tools/index.cjs +10 -2
  120. package/dist/tools/index.cjs.map +1 -1
  121. package/dist/tools/index.d.cts +3 -74
  122. package/dist/tools/index.d.ts +3 -74
  123. package/dist/tools/index.js +12 -4
  124. package/dist/types-BULrFyuQ.d.cts +316 -0
  125. package/dist/types-BULrFyuQ.d.ts +316 -0
  126. package/dist/vector/index.d.cts +1 -1
  127. package/dist/vector/index.d.ts +1 -1
  128. package/package.json +14 -1
  129. package/dist/chunk-3ZBAXET6.cjs.map +0 -1
  130. package/dist/chunk-5TWIN7ZJ.js.map +0 -1
  131. package/dist/chunk-AMWXSYCI.js.map +0 -1
  132. package/dist/chunk-GTZXF4BI.cjs.map +0 -1
  133. package/dist/chunk-JOX6MJW4.cjs.map +0 -1
  134. package/dist/chunk-OV7UAKIY.js.map +0 -1
  135. package/dist/chunk-TGBCBQFV.cjs.map +0 -1
  136. package/dist/chunk-UAW5FEMD.js.map +0 -1
  137. package/dist/chunk-WBOAXDKD.js.map +0 -1
  138. package/dist/chunk-XFYUFVAX.cjs +0 -826
  139. package/dist/chunk-XFYUFVAX.cjs.map +0 -1
  140. /package/dist/{chunk-5N6AQCVB.js.map → chunk-BQQZ6MOI.js.map} +0 -0
  141. /package/dist/{chunk-YMKPMXZ4.js.map → chunk-OIKYP7XC.js.map} +0 -0
  142. /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  TRENDLINE_PROPS,
8
8
  VALUE,
9
9
  WIDTH
10
- } from "../chunk-5TWIN7ZJ.js";
10
+ } from "../chunk-47WWV3LI.js";
11
11
  import {
12
12
  CHART_OOXML_CONTENT_TYPE,
13
13
  CHART_OOXML_NS,
@@ -16,7 +16,7 @@ import {
16
16
  chartFromOoxml,
17
17
  chartToOoxml,
18
18
  readZip
19
- } from "../chunk-UAW5FEMD.js";
19
+ } from "../chunk-3S72F46R.js";
20
20
  import {
21
21
  CHART_COLOR_SCHEMES,
22
22
  CHART_DATE_STEPS,
@@ -35,6 +35,8 @@ import {
35
35
  chartMovingAverage,
36
36
  chartPresetPatch,
37
37
  chartQuantile,
38
+ chartScaleFromPixel,
39
+ chartScaleToPixel,
38
40
  chartSceneToDomSpec,
39
41
  chartSceneToSvg,
40
42
  chartSerialToDate,
@@ -62,6 +64,7 @@ import {
62
64
  layoutSparkline,
63
65
  linearMap,
64
66
  monochromeChartPalette,
67
+ niceLogScale,
65
68
  niceScale,
66
69
  niceStep,
67
70
  parseChartDate,
@@ -72,10 +75,14 @@ import {
72
75
  summarizeChart,
73
76
  summarizeChartSeries,
74
77
  trendNumberText
75
- } from "../chunk-WBOAXDKD.js";
78
+ } from "../chunk-VODBAO32.js";
76
79
  import {
77
80
  CHART_AXIS_KINDS,
81
+ CHART_AXIS_SCALES,
78
82
  CHART_CURVES,
83
+ CHART_ERROR_BAR_DIRECTIONS,
84
+ CHART_ERROR_BAR_LABELS,
85
+ CHART_ERROR_BAR_TYPES,
79
86
  CHART_LABEL_POSITIONS,
80
87
  CHART_LEGEND_POSITIONS,
81
88
  CHART_MARKERS,
@@ -96,6 +103,8 @@ import {
96
103
  chartContrastRatio,
97
104
  chartDataFromTable,
98
105
  chartDataToTable,
106
+ chartErrorAmounts,
107
+ chartErrorBarsOfType,
99
108
  chartFamily,
100
109
  chartLuminance,
101
110
  chartPointColor,
@@ -111,23 +120,36 @@ import {
111
120
  createChartSpec,
112
121
  cyclePaletteColor,
113
122
  defaultChartAxis,
123
+ defaultChartErrorBarValue,
124
+ describeChartErrorBars,
125
+ formatChartAmountList,
114
126
  isCartesianChart,
115
127
  isXyChart,
116
128
  normalizeChartAxis,
129
+ normalizeChartErrorBars,
117
130
  normalizeChartSpec,
118
131
  normalizeChartTrendline,
119
132
  normalizeChartValues,
133
+ parseChartAmountList,
120
134
  parseChartColor,
121
135
  parseChartValue,
122
136
  shadeChartColor,
123
137
  simulateChartVision,
124
138
  uniqueChartSeriesId
125
- } from "../chunk-OV7UAKIY.js";
139
+ } from "../chunk-633QC34G.js";
126
140
  import "../chunk-EKYHKQPG.js";
127
141
  import {
128
142
  parseCsv
129
143
  } from "../chunk-664LQYFJ.js";
130
144
  import "../chunk-QVZZGT4X.js";
145
+ import {
146
+ PRESENCE_COLORS,
147
+ PerformanceQueue,
148
+ PresenceStore,
149
+ createInstantPresenceClock,
150
+ realPresenceClock,
151
+ tweenPresenceCursor
152
+ } from "../chunk-B6DSIEXA.js";
131
153
 
132
154
  // src/chart/raster.ts
133
155
  var CHART_RASTER_MAX_SIZE = 1024;
@@ -413,7 +435,7 @@ function createChartCommands(controller, options = {}) {
413
435
  id: `${prefix}update`,
414
436
  label: "Change Chart\u2026",
415
437
  keywords: ["chart", "title", "axis", "legend", "stack", "style", "format", "type"],
416
- description: "Changes chart presentation as one undo step: type, titles, axes (xAxis = categories, yAxis = values, yAxis2 = secondary values), legend, stacking, orientation, curve, points, data labels, palette, donut hole, bar spacing, histogram bins or waterfall total. Invalid values change nothing and return why.",
438
+ description: 'Changes chart presentation as one undo step: type, titles, axes (xAxis = categories, yAxis = values, yAxis2 = secondary values; reverse, and scale "log" on value axes), legend, stacking, orientation, curve, points, data labels, palette, donut hole, bar spacing, histogram bins or waterfall total. Invalid values change nothing and return why.',
417
439
  params: object(CHART_UPDATE_PROPERTIES),
418
440
  run: (_ctx, params) => {
419
441
  check(controller.update(params));
@@ -467,7 +489,7 @@ function createChartCommands(controller, options = {}) {
467
489
  id: `${prefix}updateSeries`,
468
490
  label: "Change Series\u2026",
469
491
  keywords: ["chart", "series", "rename", "colour", "color", "hide", "axis", "marker"],
470
- description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (null resets a field).",
492
+ description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn, including error bars (null resets a field).",
471
493
  params: object({ series: SERIES_REF, ...Object.fromEntries(Object.entries(SERIES_PROPS).filter(([k]) => k !== "values")) }, ["series"]),
472
494
  run: (_ctx, params) => {
473
495
  const { series, ...patch } = params;
@@ -690,13 +712,14 @@ function snapChartDragValue(scene, value, options = {}) {
690
712
  const scale = options.scale ?? scene.valueScale;
691
713
  const tolerance = options.tolerancePx ?? 6;
692
714
  if (scale) {
693
- const px = (v) => linearMap(v, scale.domain, scale.range);
715
+ const px = (v) => chartScaleToPixel(v, scale);
694
716
  const at = px(value);
695
717
  let best = null;
696
718
  let bestDist = tolerance;
697
719
  for (const c of [...options.candidates ?? [], ...scale.ticks]) {
698
720
  if (!Number.isFinite(c)) continue;
699
721
  const d = Math.abs(px(c) - at);
722
+ if (!Number.isFinite(d)) continue;
700
723
  if (d <= bestDist) {
701
724
  best = c;
702
725
  bestDist = d;
@@ -704,7 +727,7 @@ function snapChartDragValue(scene, value, options = {}) {
704
727
  }
705
728
  if (best !== null) return best;
706
729
  }
707
- return snapChartValue(scene, value, options.step, scale?.ticks);
730
+ return snapChartValue(scene, value, options.step, scale?.ticks, scale?.logBase);
708
731
  }
709
732
  function startChartPointDrag(controller, scene, target, start, options = {}) {
710
733
  if (!canDragChartPoint(controller, scene, target)) return null;
@@ -738,27 +761,31 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
738
761
  const at = chartValueAtPoint(scene, point, secondary);
739
762
  if (at === void 0) return;
740
763
  const factor = moveOptions.fine ? 0.1 : 1;
741
- let dy = (at - startAt) * factor;
742
- let dx = 0;
764
+ const moved = (from, to, s, value) => s.logBase && value > 0 && from > 0 && to > 0 ? value * Math.pow(to / from, factor) : value + (to - from) * factor;
765
+ let moveY = true;
766
+ let moveX = false;
767
+ let atX;
743
768
  if (xy && startX !== null && startAtX !== void 0) {
744
- const atX = chartXAtPoint(scene, point);
745
- if (atX !== void 0) dx = (atX - startAtX) * factor;
769
+ atX = chartXAtPoint(scene, point);
770
+ moveX = atX !== void 0;
746
771
  if (moveOptions.lockAxis) {
747
- if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y)) dy = 0;
748
- else dx = 0;
772
+ if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y)) moveY = false;
773
+ else moveX = false;
749
774
  }
750
775
  }
751
776
  const snap = (v, s, c) => {
752
777
  if (moveOptions.noSnap) return Number(v.toPrecision(12));
753
778
  if (moveOptions.fine) {
779
+ if (s.logBase && !options.step) return v > 0 ? Number(v.toPrecision(3)) : v;
754
780
  const unit = options.step ? options.step / 10 : s.ticks.length > 1 ? (s.ticks[1] - s.ticks[0]) / 100 : void 0;
755
781
  return snapChartValue(scene, v, unit, s.ticks);
756
782
  }
757
783
  return snapChartDragValue(scene, v, { candidates: c, tolerancePx: options.tolerancePx, step: options.step, scale: s });
758
784
  };
759
- const y = snap(startValue + dy, scale, candidates);
785
+ const y = moveY ? snap(moved(startAt, at, scale, startValue), scale, candidates) : startValue;
760
786
  if (xy && startX !== null) {
761
- const x = dx !== 0 ? snap(startX + dx, scene.xScale, [0, startX]) : startX;
787
+ const nextX = moveX ? moved(startAtX, atX, scene.xScale, startX) : startX;
788
+ const x = nextX !== startX ? snap(nextX, scene.xScale, [0, startX]) : startX;
762
789
  const xs = [...series.x ?? []];
763
790
  xs[index] = x;
764
791
  controller.setValue(seriesId, index, y, { label });
@@ -805,11 +832,21 @@ function handleChartKey(controller, scene, event) {
805
832
  case "ArrowUp":
806
833
  case "ArrowDown": {
807
834
  if (selection?.kind !== "point" || scene?.percent) return false;
808
- const secondary = controller.getSeries(selection.seriesId)?.axis === "secondary";
809
- const ticks = (secondary ? scene?.valueScale2 : null)?.ticks ?? scene?.valueScale?.ticks ?? [];
835
+ const series = controller.getSeries(selection.seriesId);
836
+ const secondary = series?.axis === "secondary";
837
+ const scale = (secondary ? scene?.valueScale2 : null) ?? scene?.valueScale;
838
+ const ticks = scale?.ticks ?? [];
839
+ const up = event.key === "ArrowUp";
840
+ const current = series?.values[selection.index] ?? null;
841
+ if (scale?.logBase && current !== null && current > 0) {
842
+ const power = event.shiftKey ? 1 : event.altKey ? 0.01 : 0.1;
843
+ const next = Number((current * Math.pow(scale.logBase, up ? power : -power)).toPrecision(event.altKey ? 4 : 3));
844
+ controller.nudgeValue(selection.seriesId, selection.index, next - current);
845
+ return true;
846
+ }
810
847
  const step = ticks.length > 1 ? ticks[1] - ticks[0] : 1;
811
848
  const amount = event.shiftKey ? step : event.altKey ? step / 100 : step / 10;
812
- controller.nudgeValue(selection.seriesId, selection.index, amount * (event.key === "ArrowUp" ? 1 : -1));
849
+ controller.nudgeValue(selection.seriesId, selection.index, amount * (up ? 1 : -1));
813
850
  return true;
814
851
  }
815
852
  default:
@@ -1056,7 +1093,7 @@ function createChartToolProvider(controller, options = {}) {
1056
1093
  const updateChart = {
1057
1094
  name: "update_chart",
1058
1095
  title: "Change chart presentation",
1059
- description: "Changes how the chart looks, as one undo step: type, titles, axes (xAxis = categories or numeric x, yAxis = values, yAxis2 = secondary values), legend, stacking, orientation, curve, points, data labels and their position, palette, donut hole, bar spacing, histogram bins, waterfall total. All-or-nothing: invalid values change nothing and come back as sentences. Returns the new spec.",
1096
+ description: 'Changes how the chart looks, as one undo step: type, titles, axes (xAxis = categories or numeric x, yAxis = values, yAxis2 = secondary values; each can be reversed, and value axes can be logarithmic with scale "log"), legend, stacking, orientation, curve, points, data labels and their position, palette, donut hole, bar spacing, histogram bins, waterfall total. All-or-nothing: invalid values change nothing and come back as sentences. Returns the new spec.',
1060
1097
  inputSchema: {
1061
1098
  type: "object",
1062
1099
  properties: CHART_UPDATE_PROPERTIES,
@@ -1144,7 +1181,7 @@ function createChartToolProvider(controller, options = {}) {
1144
1181
  const updateSeries = {
1145
1182
  name: "update_chart_series",
1146
1183
  title: "Change a series",
1147
- description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (marker, curve, labels, format, x values, bubble sizes, point colours). null resets a field. Values change with set_chart_values. Returns the series.",
1184
+ description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (marker, curve, labels, format, x values, bubble sizes, point colours, error bars). null resets a field. Values change with set_chart_values. Returns the series.",
1148
1185
  inputSchema: {
1149
1186
  type: "object",
1150
1187
  properties: { series: SERIES_REF, ...Object.fromEntries(Object.entries(SERIES_PROPS).filter(([k]) => k !== "values")) },
@@ -1600,44 +1637,11 @@ function blendChartScenes(from, to, t) {
1600
1637
  var easeChartTween = (t) => 1 - Math.pow(1 - Math.max(0, Math.min(1, t)), 3);
1601
1638
 
1602
1639
  // src/chart/presence.ts
1603
- var ChartPresence = class {
1604
- state = { actors: [] };
1605
- listeners = /* @__PURE__ */ new Set();
1606
- getState = () => this.state;
1607
- subscribe = (listener) => {
1608
- this.listeners.add(listener);
1609
- return () => {
1610
- this.listeners.delete(listener);
1611
- };
1612
- };
1613
- /** Adds or changes an actor. */
1614
- set(actor) {
1615
- const current = this.state.actors.find((a) => a.id === actor.id);
1616
- const next = { name: actor.id, color: CHART_PRESENCE_COLORS[this.state.actors.length % CHART_PRESENCE_COLORS.length], x: 0, y: 0, pressed: false, ...current, ...actor };
1617
- this.state = { actors: current ? this.state.actors.map((a) => a.id === actor.id ? next : a) : [...this.state.actors, next] };
1618
- this.listeners.forEach((l) => l(this.state));
1619
- }
1620
- remove(id) {
1621
- if (!this.state.actors.some((a) => a.id === id)) return;
1622
- this.state = { actors: this.state.actors.filter((a) => a.id !== id) };
1623
- this.listeners.forEach((l) => l(this.state));
1624
- }
1625
- };
1626
- var CHART_PRESENCE_COLORS = ["#7c3aed", "#db2777", "#0891b2", "#ea580c", "#16a34a"];
1627
- var realChartClock = {
1628
- now: () => Date.now(),
1629
- wait: (ms) => new Promise((resolve2) => setTimeout(resolve2, Math.max(0, ms)))
1640
+ var ChartPresence = class extends PresenceStore {
1630
1641
  };
1631
- function createInstantChartClock(start = 0) {
1632
- let t = start;
1633
- return {
1634
- now: () => t,
1635
- wait: async (ms) => {
1636
- t += Math.max(0, ms);
1637
- },
1638
- elapsed: () => t - start
1639
- };
1640
- }
1642
+ var CHART_PRESENCE_COLORS = PRESENCE_COLORS;
1643
+ var realChartClock = realPresenceClock;
1644
+ var createInstantChartClock = createInstantPresenceClock;
1641
1645
  function chartPointAnchor(scene, seriesId, index) {
1642
1646
  const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && m.target?.kind === "point" && m.target.seriesId === seriesId && m.target.index === index);
1643
1647
  if (!mark) return null;
@@ -1704,35 +1708,25 @@ var ChartDirector = class {
1704
1708
  this.presence = presence;
1705
1709
  this.options = options;
1706
1710
  this.clock = options.clock ?? realChartClock;
1711
+ this.queue = new PerformanceQueue(presence, {
1712
+ clock: this.clock,
1713
+ linger: options.linger,
1714
+ beginGesture: (key) => controller.beginGesture(key),
1715
+ endGesture: () => controller.endGesture()
1716
+ });
1707
1717
  }
1708
1718
  controller;
1709
1719
  presence;
1710
1720
  options;
1711
- queues = /* @__PURE__ */ new Map();
1712
1721
  clock;
1713
- calls = 0;
1722
+ queue;
1714
1723
  /** Acts out `commands` in order for `actor`. Resolves with one result per command. */
1715
1724
  perform(actor, commands) {
1716
- const prev = this.queues.get(actor.id) ?? Promise.resolve();
1717
- const run = prev.then(async () => {
1725
+ return this.queue.run(actor, async () => {
1718
1726
  const results = [];
1719
- this.presence.set({ id: actor.id, ...actor.name ? { name: actor.name } : {}, ...actor.color ? { color: actor.color } : {} });
1720
- this.controller.beginGesture(`agent:${actor.id}:${++this.calls}`);
1721
- try {
1722
- for (const command of commands) results.push(await this.performOne(actor.id, command));
1723
- } finally {
1724
- this.controller.endGesture();
1725
- this.presence.set({ id: actor.id, message: void 0, pressed: false });
1726
- }
1727
- const linger = this.options.linger ?? 1500;
1728
- if (linger > 0) {
1729
- await this.clock.wait(linger);
1730
- if (this.queues.get(actor.id) === run) this.presence.remove(actor.id);
1731
- }
1727
+ for (const command of commands) results.push(await this.performOne(actor.id, command));
1732
1728
  return results;
1733
1729
  });
1734
- this.queues.set(actor.id, run.catch(() => void 0));
1735
- return run;
1736
1730
  }
1737
1731
  stale(command) {
1738
1732
  const spec = this.controller.getSpec();
@@ -1744,15 +1738,8 @@ var ChartDirector = class {
1744
1738
  }
1745
1739
  return null;
1746
1740
  }
1747
- async move(id, from, to, ms, each) {
1748
- const frames = Math.max(1, Math.round(ms / 16));
1749
- for (let f = 1; f <= frames; f++) {
1750
- const t = f / frames;
1751
- const e = 1 - Math.pow(1 - t, 3);
1752
- this.presence.set({ id, x: from.x + (to.x - from.x) * e, y: from.y + (to.y - from.y) * e });
1753
- each?.(e);
1754
- await this.clock.wait(ms / frames);
1755
- }
1741
+ move(id, from, to, ms, each) {
1742
+ return tweenPresenceCursor(this.presence, this.clock, id, from, to, ms, each);
1756
1743
  }
1757
1744
  async performOne(id, command) {
1758
1745
  const stale = this.stale(command);
@@ -2106,9 +2093,13 @@ function createOfficeChartToolProvider(options = {}) {
2106
2093
  }
2107
2094
  export {
2108
2095
  CHART_AXIS_KINDS,
2096
+ CHART_AXIS_SCALES,
2109
2097
  CHART_COLOR_SCHEMES,
2110
2098
  CHART_CURVES,
2111
2099
  CHART_DATE_STEPS,
2100
+ CHART_ERROR_BAR_DIRECTIONS,
2101
+ CHART_ERROR_BAR_LABELS,
2102
+ CHART_ERROR_BAR_TYPES,
2112
2103
  CHART_LABEL_POSITIONS,
2113
2104
  CHART_LAYOUT_PRESETS,
2114
2105
  CHART_LEGEND_POSITIONS,
@@ -2152,6 +2143,8 @@ export {
2152
2143
  chartDataToTable,
2153
2144
  chartDateLabels,
2154
2145
  chartDateToSerial,
2146
+ chartErrorAmounts,
2147
+ chartErrorBarsOfType,
2155
2148
  chartFamily,
2156
2149
  chartFileName,
2157
2150
  chartFormatToCode,
@@ -2170,6 +2163,8 @@ export {
2170
2163
  chartRasterSize,
2171
2164
  chartRgbToHex,
2172
2165
  chartRgbToOklab,
2166
+ chartScaleFromPixel,
2167
+ chartScaleToPixel,
2173
2168
  chartSceneToDomSpec,
2174
2169
  chartSceneToSvg,
2175
2170
  chartSerialToDate,
@@ -2202,7 +2197,9 @@ export {
2202
2197
  cyclePaletteColor,
2203
2198
  decimateChartPoints,
2204
2199
  defaultChartAxis,
2200
+ defaultChartErrorBarValue,
2205
2201
  describeChart,
2202
+ describeChartErrorBars,
2206
2203
  describeChartSelection,
2207
2204
  describeOfficeChartPlace,
2208
2205
  downloadChartPng,
@@ -2214,6 +2211,7 @@ export {
2214
2211
  extractXlsxCharts,
2215
2212
  findMermaidCharts,
2216
2213
  fitChartTrendline,
2214
+ formatChartAmountList,
2217
2215
  formatChartDate,
2218
2216
  formatChartNumber,
2219
2217
  formatChartValueWithCode,
@@ -2224,12 +2222,15 @@ export {
2224
2222
  layoutSparkline,
2225
2223
  linearMap,
2226
2224
  monochromeChartPalette,
2225
+ niceLogScale,
2227
2226
  niceScale,
2228
2227
  niceStep,
2229
2228
  normalizeChartAxis,
2229
+ normalizeChartErrorBars,
2230
2230
  normalizeChartSpec,
2231
2231
  normalizeChartTrendline,
2232
2232
  normalizeChartValues,
2233
+ parseChartAmountList,
2233
2234
  parseChartColor,
2234
2235
  parseChartDate,
2235
2236
  parseChartValue,