@pixerate/editor 0.141.0 → 0.143.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.
- package/dist/agent/index.cjs +107 -48
- package/dist/agent/index.js +76 -17
- package/dist/agent/planner.d.cts +7 -2
- package/dist/agent/planner.d.ts +7 -2
- package/dist/agent/providers.d.cts +4 -1
- package/dist/agent/providers.d.ts +4 -1
- package/dist/animation-editor/index.cjs +69 -19
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +54 -4
- package/dist/animation-editor/playback.d.cts +10 -0
- package/dist/animation-editor/playback.d.ts +10 -0
- package/dist/canvas/index.cjs +103 -101
- package/dist/canvas/index.js +3 -1
- package/dist/canvas/layout.d.cts +15 -2
- package/dist/canvas/layout.d.ts +15 -2
- package/dist/chart/index.cjs +254 -170
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +243 -159
- package/dist/chart/playback.d.cts +22 -0
- package/dist/chart/playback.d.ts +22 -0
- package/dist/{chunk-MFFE55CS.js → chunk-54GVEVXS.js} +6 -4
- package/dist/{chunk-E747F3D5.js → chunk-CC6WKVIH.js} +86 -5
- package/dist/{chunk-UBRYHNRU.cjs → chunk-EL4PSKFT.cjs} +46 -4
- package/dist/{chunk-VTY64I6H.cjs → chunk-QSM3MDDJ.cjs} +85 -85
- package/dist/{chunk-2RUNJYOX.cjs → chunk-QZFEX2N4.cjs} +86 -5
- package/dist/{chunk-DW4CV5H4.js → chunk-U4VE4UI2.js} +45 -3
- package/dist/{chunk-LMSFXRAJ.js → chunk-VGJTUCWM.js} +1 -1
- package/dist/{chunk-6SFREX6H.cjs → chunk-X2HQP7DF.cjs} +6 -4
- package/dist/chunk-XH32BATE.cjs +68 -0
- package/dist/chunk-Y6SGC6KO.js +68 -0
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.js +6 -2
- package/dist/paint-editor/index.cjs +67 -19
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +67 -19
- package/dist/paint-editor/playback.d.cts +16 -0
- package/dist/paint-editor/playback.d.ts +16 -0
- package/dist/parameters/index.cjs +32 -8
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +28 -4
- package/dist/parameters/playback.d.cts +10 -0
- package/dist/parameters/playback.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +7 -3
- package/dist/spreadsheet/index.d.cts +1 -0
- package/dist/spreadsheet/index.d.ts +1 -0
- package/dist/spreadsheet/index.js +6 -2
- package/dist/spreadsheet/playback.d.cts +15 -0
- package/dist/spreadsheet/playback.d.ts +15 -0
- package/dist/tools/index.cjs +10 -3
- package/dist/tools/index.d.cts +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +9 -2
- package/dist/tools/script.d.cts +77 -0
- package/dist/tools/script.d.ts +77 -0
- package/dist/video-editor/index.cjs +81 -28
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +58 -5
- package/dist/video-editor/playback.d.cts +20 -0
- package/dist/video-editor/playback.d.ts +20 -0
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -0
- package/skills/pixerate-chart/SKILL.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +1 -0
- package/skills/pixerate-parameters/SKILL.md +1 -0
- package/skills/pixerate-spreadsheet/SKILL.md +1 -0
- package/skills/pixerate-video-editor/SKILL.md +1 -0
- package/dist/chunk-PLKIYNJZ.js +0 -0
- package/dist/chunk-TNCWKC5M.cjs +0 -1
package/dist/canvas/index.js
CHANGED
|
@@ -88,12 +88,13 @@ import {
|
|
|
88
88
|
matchSize,
|
|
89
89
|
overlaps,
|
|
90
90
|
placeBeside,
|
|
91
|
+
placeInView,
|
|
91
92
|
readStyleSize,
|
|
92
93
|
reorderNodes,
|
|
93
94
|
toggleLockNodes,
|
|
94
95
|
unlockNodes,
|
|
95
96
|
withStyleSize
|
|
96
|
-
} from "../chunk-
|
|
97
|
+
} from "../chunk-U4VE4UI2.js";
|
|
97
98
|
import {
|
|
98
99
|
DEFAULT_ARRANGE_SHORTCUTS,
|
|
99
100
|
matchArrangeShortcut
|
|
@@ -12057,6 +12058,7 @@ export {
|
|
|
12057
12058
|
pathfinder,
|
|
12058
12059
|
pieScene,
|
|
12059
12060
|
placeBeside,
|
|
12061
|
+
placeInView,
|
|
12060
12062
|
planarSplit,
|
|
12061
12063
|
playCanvasSceneTransition,
|
|
12062
12064
|
playWebAnimations,
|
package/dist/canvas/layout.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanvasEdge, CanvasLayoutOptions, CanvasNode, IncrementalLayoutOptions, PlaceBesideOptions, Rect, Side, XYPosition } from
|
|
1
|
+
import type { CanvasEdge, CanvasLayoutOptions, CanvasNode, IncrementalLayoutOptions, PlaceBesideOptions, Rect, Side, XYPosition } from "./types.cjs";
|
|
2
2
|
export declare const DEFAULT_NODE_WIDTH = 200;
|
|
3
3
|
export declare const DEFAULT_NODE_HEIGHT = 60;
|
|
4
4
|
export declare const DEFAULT_PLACEMENT_GAP = 48;
|
|
@@ -42,7 +42,7 @@ export declare function overlaps(a: Rect, b: Rect, pad?: number): boolean;
|
|
|
42
42
|
/**
|
|
43
43
|
* Maps directed layout flow to its natural forward growth side.
|
|
44
44
|
*/
|
|
45
|
-
export declare function flowSide(direction?:
|
|
45
|
+
export declare function flowSide(direction?: "LR" | "TB" | "RL" | "BT"): Side;
|
|
46
46
|
/**
|
|
47
47
|
* Incremental layout blending:
|
|
48
48
|
* Keeps established/manual node positions intact. Runs Dagre on the entire graph,
|
|
@@ -58,3 +58,16 @@ export declare function placeBeside(rects: Record<string, Rect>, size: {
|
|
|
58
58
|
width: number;
|
|
59
59
|
height: number;
|
|
60
60
|
}, side: Side, nearNodeId?: string, options?: PlaceBesideOptions): XYPosition;
|
|
61
|
+
/**
|
|
62
|
+
* Where a node of `size` goes when nothing anchors it: centred in `view` (the visible part of
|
|
63
|
+
* the canvas, in flow coordinates) when that is free, else the nearest free spot in rings
|
|
64
|
+
* around the centre, so new work appears where the user is looking and never on top of
|
|
65
|
+
* `rects`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function placeInView(rects: Record<string, Rect>, size: {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
}, view: Rect, options?: {
|
|
71
|
+
gap?: number;
|
|
72
|
+
maxRings?: number;
|
|
73
|
+
}): XYPosition;
|
package/dist/canvas/layout.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanvasEdge, CanvasLayoutOptions, CanvasNode, IncrementalLayoutOptions, PlaceBesideOptions, Rect, Side, XYPosition } from
|
|
1
|
+
import type { CanvasEdge, CanvasLayoutOptions, CanvasNode, IncrementalLayoutOptions, PlaceBesideOptions, Rect, Side, XYPosition } from "./types.js";
|
|
2
2
|
export declare const DEFAULT_NODE_WIDTH = 200;
|
|
3
3
|
export declare const DEFAULT_NODE_HEIGHT = 60;
|
|
4
4
|
export declare const DEFAULT_PLACEMENT_GAP = 48;
|
|
@@ -42,7 +42,7 @@ export declare function overlaps(a: Rect, b: Rect, pad?: number): boolean;
|
|
|
42
42
|
/**
|
|
43
43
|
* Maps directed layout flow to its natural forward growth side.
|
|
44
44
|
*/
|
|
45
|
-
export declare function flowSide(direction?:
|
|
45
|
+
export declare function flowSide(direction?: "LR" | "TB" | "RL" | "BT"): Side;
|
|
46
46
|
/**
|
|
47
47
|
* Incremental layout blending:
|
|
48
48
|
* Keeps established/manual node positions intact. Runs Dagre on the entire graph,
|
|
@@ -58,3 +58,16 @@ export declare function placeBeside(rects: Record<string, Rect>, size: {
|
|
|
58
58
|
width: number;
|
|
59
59
|
height: number;
|
|
60
60
|
}, side: Side, nearNodeId?: string, options?: PlaceBesideOptions): XYPosition;
|
|
61
|
+
/**
|
|
62
|
+
* Where a node of `size` goes when nothing anchors it: centred in `view` (the visible part of
|
|
63
|
+
* the canvas, in flow coordinates) when that is free, else the nearest free spot in rings
|
|
64
|
+
* around the centre, so new work appears where the user is looking and never on top of
|
|
65
|
+
* `rects`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function placeInView(rects: Record<string, Rect>, size: {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
}, view: Rect, options?: {
|
|
71
|
+
gap?: number;
|
|
72
|
+
maxRings?: number;
|
|
73
|
+
}): XYPosition;
|
package/dist/chart/index.cjs
CHANGED
|
@@ -925,6 +925,242 @@ function chartHitTest(scene, point, measure = (t, s, w = 400) => t.length * s *
|
|
|
925
925
|
return point.x >= 0 && point.y >= 0 && point.x <= scene.width && point.y <= scene.height ? { kind: "chart" } : null;
|
|
926
926
|
}
|
|
927
927
|
|
|
928
|
+
// src/chart/presence.ts
|
|
929
|
+
var ChartPresence = class extends _chunkUJGAA6AKcjs.PresenceStore {
|
|
930
|
+
};
|
|
931
|
+
var CHART_PRESENCE_COLORS = _chunkUJGAA6AKcjs.PRESENCE_COLORS;
|
|
932
|
+
var realChartClock = _chunkUJGAA6AKcjs.realPresenceClock;
|
|
933
|
+
var createInstantChartClock = _chunkUJGAA6AKcjs.createInstantPresenceClock;
|
|
934
|
+
function chartPointAnchor(scene, seriesId, index) {
|
|
935
|
+
const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _71 => _71.target, 'optionalAccess', _72 => _72.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
|
|
936
|
+
if (!mark) return null;
|
|
937
|
+
if (mark.kind === "rect") return { x: mark.x + mark.width / 2, y: mark.y };
|
|
938
|
+
if (mark.kind === "circle") return { x: mark.cx, y: mark.cy };
|
|
939
|
+
return null;
|
|
940
|
+
}
|
|
941
|
+
var anchorFor = (scene, role) => {
|
|
942
|
+
const m = scene.marks.find((x) => x.role === role);
|
|
943
|
+
if (!m) return null;
|
|
944
|
+
if (m.kind === "text") return { x: m.x, y: m.y };
|
|
945
|
+
if (m.kind === "rect") return { x: m.x + m.width / 2, y: m.y + m.height / 2 };
|
|
946
|
+
if (m.kind === "line") return { x: (m.x1 + m.x2) / 2, y: (m.y1 + m.y2) / 2 };
|
|
947
|
+
return null;
|
|
948
|
+
};
|
|
949
|
+
function planChartCommand(spec, scene, command, speed = 1) {
|
|
950
|
+
const ms = (n) => Math.round(n / Math.max(0.1, speed));
|
|
951
|
+
const steps = [];
|
|
952
|
+
const note = "note" in command && command.note ? command.note : void 0;
|
|
953
|
+
if (note) steps.push({ type: "say", text: note, ms: ms(500) });
|
|
954
|
+
switch (command.kind) {
|
|
955
|
+
case "say":
|
|
956
|
+
steps.push({ type: "say", text: command.text, ms: ms(900) });
|
|
957
|
+
return steps;
|
|
958
|
+
case "setValue": {
|
|
959
|
+
const at = chartPointAnchor(scene, command.seriesId, command.index);
|
|
960
|
+
const series = spec.series.find((s) => s.id === command.seriesId);
|
|
961
|
+
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _73 => _73.values, 'access', _74 => _74[command.index]]), () => ( 0));
|
|
962
|
+
const scale = _optionalChain([series, 'optionalAccess', _75 => _75.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
|
|
963
|
+
if (at && scale) {
|
|
964
|
+
const px = _chunk6HMEHNWWcjs.linearMap.call(void 0, command.value, scale.domain, scale.range);
|
|
965
|
+
const to = scale.axis === "y" ? { x: at.x, y: px } : { x: px, y: at.y };
|
|
966
|
+
steps.push({ type: "move", to: at, ms: ms(380) }, { type: "press" }, { type: "drag", to, ms: ms(520), from, value: command.value }, { type: "release" });
|
|
967
|
+
} else steps.push({ type: "drag", to: { x: scene.plot.x + scene.plot.width / 2, y: scene.plot.y + scene.plot.height / 2 }, ms: ms(200), from, value: command.value });
|
|
968
|
+
steps.push({ type: "commit" });
|
|
969
|
+
return steps;
|
|
970
|
+
}
|
|
971
|
+
case "select": {
|
|
972
|
+
const sel = command.selection;
|
|
973
|
+
let to = null;
|
|
974
|
+
if (_optionalChain([sel, 'optionalAccess', _76 => _76.kind]) === "point") to = chartPointAnchor(scene, sel.seriesId, sel.index);
|
|
975
|
+
else if (sel) {
|
|
976
|
+
const m = scene.marks.find((x) => x.target && JSON.stringify(x.target) === JSON.stringify(sel));
|
|
977
|
+
if (_optionalChain([m, 'optionalAccess', _77 => _77.kind]) === "text") to = { x: m.x, y: m.y };
|
|
978
|
+
else if (_optionalChain([m, 'optionalAccess', _78 => _78.kind]) === "rect") to = { x: m.x + m.width / 2, y: m.y + m.height / 2 };
|
|
979
|
+
else if (_optionalChain([m, 'optionalAccess', _79 => _79.kind]) === "circle") to = { x: m.cx, y: m.cy };
|
|
980
|
+
}
|
|
981
|
+
if (to) steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" });
|
|
982
|
+
steps.push({ type: "commit" });
|
|
983
|
+
return steps;
|
|
984
|
+
}
|
|
985
|
+
case "update": {
|
|
986
|
+
const keys = Object.keys(command.patch);
|
|
987
|
+
const role = keys.includes("title") ? "title" : keys.includes("legend") ? "legend-label" : keys.some((k) => k === "xAxis") ? "axis" : keys.some((k) => k === "yAxis" || k === "yAxis2") ? "tick-label" : null;
|
|
988
|
+
const to = role && anchorFor(scene, role) || { x: scene.plot.x + scene.plot.width / 2, y: scene.plot.y + 12 };
|
|
989
|
+
steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" }, { type: "commit" });
|
|
990
|
+
return steps;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
var ChartDirector = class {
|
|
995
|
+
constructor(controller, presence, options) {
|
|
996
|
+
this.controller = controller;
|
|
997
|
+
this.presence = presence;
|
|
998
|
+
this.options = options;
|
|
999
|
+
this.clock = _nullishCoalesce(options.clock, () => ( realChartClock));
|
|
1000
|
+
this.queue = new (0, _chunkUJGAA6AKcjs.PerformanceQueue)(presence, {
|
|
1001
|
+
clock: this.clock,
|
|
1002
|
+
linger: options.linger,
|
|
1003
|
+
beginGesture: (key) => controller.beginGesture(key),
|
|
1004
|
+
endGesture: () => controller.endGesture()
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
/** Acts out `commands` in order for `actor`. Resolves with one result per command. */
|
|
1013
|
+
perform(actor, commands) {
|
|
1014
|
+
return this.queue.run(actor, async () => {
|
|
1015
|
+
const results = [];
|
|
1016
|
+
for (const command of commands) results.push(await this.performOne(actor.id, command));
|
|
1017
|
+
return results;
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
stale(command) {
|
|
1021
|
+
const spec = this.controller.getSpec();
|
|
1022
|
+
if (command.kind === "setValue") {
|
|
1023
|
+
const s = spec.series.find((x) => x.id === command.seriesId);
|
|
1024
|
+
if (!s) return `The series "${command.seriesId}" no longer exists.`;
|
|
1025
|
+
if (command.index < 0 || command.index >= spec.categories.length) return `Category ${command.index} no longer exists.`;
|
|
1026
|
+
if (!Number.isFinite(command.value)) return "The value must be a finite number.";
|
|
1027
|
+
}
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1030
|
+
move(id, from, to, ms, each) {
|
|
1031
|
+
return _chunkUJGAA6AKcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, from, to, ms, each);
|
|
1032
|
+
}
|
|
1033
|
+
async performOne(id, command) {
|
|
1034
|
+
const stale = this.stale(command);
|
|
1035
|
+
if (stale) return { ok: false, command, message: stale };
|
|
1036
|
+
const steps = planChartCommand(this.controller.getSpec(), this.options.scene(), command, this.options.speed);
|
|
1037
|
+
const where = () => {
|
|
1038
|
+
const a = this.presence.getState().actors.find((x) => x.id === id);
|
|
1039
|
+
return { x: a.x, y: a.y };
|
|
1040
|
+
};
|
|
1041
|
+
{
|
|
1042
|
+
for (const step of steps) {
|
|
1043
|
+
switch (step.type) {
|
|
1044
|
+
case "say":
|
|
1045
|
+
this.presence.set({ id, message: step.text });
|
|
1046
|
+
await this.clock.wait(step.ms);
|
|
1047
|
+
break;
|
|
1048
|
+
case "move":
|
|
1049
|
+
await this.move(id, where(), step.to, step.ms);
|
|
1050
|
+
break;
|
|
1051
|
+
case "press":
|
|
1052
|
+
this.presence.set({ id, pressed: true });
|
|
1053
|
+
break;
|
|
1054
|
+
case "release":
|
|
1055
|
+
this.presence.set({ id, pressed: false });
|
|
1056
|
+
break;
|
|
1057
|
+
case "drag": {
|
|
1058
|
+
if (command.kind !== "setValue") break;
|
|
1059
|
+
const stale2 = this.stale(command);
|
|
1060
|
+
if (stale2) return { ok: false, command, message: stale2 };
|
|
1061
|
+
const label = `${_nullishCoalesce(_optionalChain([this, 'access', _80 => _80.presence, 'access', _81 => _81.getState, 'call', _82 => _82(), 'access', _83 => _83.actors, 'access', _84 => _84.find, 'call', _85 => _85((a) => a.id === id), 'optionalAccess', _86 => _86.name]), () => ( "Agent"))}: edit value`;
|
|
1062
|
+
await this.move(id, where(), step.to, step.ms, (e) => {
|
|
1063
|
+
const v = step.from + (step.value - step.from) * e;
|
|
1064
|
+
this.controller.setValue(command.seriesId, command.index, Number(v.toPrecision(12)), { label });
|
|
1065
|
+
});
|
|
1066
|
+
this.controller.setValue(command.seriesId, command.index, step.value, { label });
|
|
1067
|
+
break;
|
|
1068
|
+
}
|
|
1069
|
+
case "commit": {
|
|
1070
|
+
if (command.kind === "select") this.controller.select(command.selection);
|
|
1071
|
+
else if (command.kind === "update") {
|
|
1072
|
+
const result = this.controller.update(command.patch, command.label ? { label: command.label } : {});
|
|
1073
|
+
if (!result.ok) return { ok: false, command, message: result.message };
|
|
1074
|
+
}
|
|
1075
|
+
break;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
return { ok: true, command };
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
// src/chart/playback.ts
|
|
1085
|
+
var click = (ref) => [{ type: "target", ref }, { type: "press" }, { type: "release" }];
|
|
1086
|
+
var control = (id) => ({ kind: "control", id });
|
|
1087
|
+
function chartPointRef(series, category) {
|
|
1088
|
+
return { kind: "point", id: JSON.stringify([series, category]) };
|
|
1089
|
+
}
|
|
1090
|
+
function locateChartPoint(spec, scene, ref) {
|
|
1091
|
+
if (ref.kind !== "point") return null;
|
|
1092
|
+
let parsed;
|
|
1093
|
+
try {
|
|
1094
|
+
parsed = JSON.parse(ref.id);
|
|
1095
|
+
} catch (e3) {
|
|
1096
|
+
return null;
|
|
1097
|
+
}
|
|
1098
|
+
if (!Array.isArray(parsed)) return null;
|
|
1099
|
+
const [seriesRef, categoryRef] = parsed;
|
|
1100
|
+
const series = _nullishCoalesce(spec.series.find((s) => s.id === seriesRef), () => ( spec.series.find((s) => s.name === seriesRef)));
|
|
1101
|
+
const index = typeof categoryRef === "number" ? categoryRef : spec.categories.findIndex((c) => String(c) === String(categoryRef));
|
|
1102
|
+
if (!series || index < 0) return null;
|
|
1103
|
+
const at = chartPointAnchor(scene, series.id, index);
|
|
1104
|
+
return at ? { x: at.x - 6, y: at.y - 6, width: 12, height: 12 } : null;
|
|
1105
|
+
}
|
|
1106
|
+
function planChartToolPlayback(tool, args) {
|
|
1107
|
+
switch (tool) {
|
|
1108
|
+
case "update_chart": {
|
|
1109
|
+
const steps = [];
|
|
1110
|
+
for (const key of Object.keys(args).slice(0, 4)) {
|
|
1111
|
+
steps.push(...click(key === "type" && typeof args.type === "string" ? { kind: "chart-type", id: args.type } : control(key)));
|
|
1112
|
+
}
|
|
1113
|
+
return steps.length ? steps : null;
|
|
1114
|
+
}
|
|
1115
|
+
case "apply_chart_preset":
|
|
1116
|
+
return [...args.layout ? click(control("preset.layout")) : [], ...args.colors ? click(control("preset.colors")) : []];
|
|
1117
|
+
case "set_chart_values": {
|
|
1118
|
+
const cells = Array.isArray(args.cells) ? args.cells : [];
|
|
1119
|
+
const steps = cells.slice(0, 6).filter((c) => typeof c.series === "string" && (typeof c.category === "string" || typeof c.category === "number")).flatMap((c) => click(chartPointRef(c.series, c.category)));
|
|
1120
|
+
return steps.length ? steps : null;
|
|
1121
|
+
}
|
|
1122
|
+
case "select_chart_element":
|
|
1123
|
+
if (args.kind === "point" && typeof args.series === "string" && args.category !== void 0) return click(chartPointRef(args.series, args.category));
|
|
1124
|
+
return typeof args.kind === "string" && args.kind !== "none" ? click(control(args.kind)) : null;
|
|
1125
|
+
case "set_chart_data":
|
|
1126
|
+
case "import_chart_csv":
|
|
1127
|
+
case "import_chart_mermaid":
|
|
1128
|
+
case "import_chart_ooxml":
|
|
1129
|
+
case "add_chart_series":
|
|
1130
|
+
case "update_chart_series":
|
|
1131
|
+
case "remove_chart_series":
|
|
1132
|
+
case "add_chart_category":
|
|
1133
|
+
case "remove_chart_category":
|
|
1134
|
+
case "transpose_chart":
|
|
1135
|
+
return [{ type: "target", ref: { kind: "grid", id: "data" } }];
|
|
1136
|
+
case "add_chart_trendline":
|
|
1137
|
+
case "remove_chart_trendline":
|
|
1138
|
+
return click(control("trendline.add"));
|
|
1139
|
+
case "render_chart":
|
|
1140
|
+
return [{ type: "target", ref: { kind: "action", id: "download-png" } }];
|
|
1141
|
+
case "undo_chart":
|
|
1142
|
+
return click({ kind: "action", id: "undo" });
|
|
1143
|
+
case "redo_chart":
|
|
1144
|
+
return click({ kind: "action", id: "redo" });
|
|
1145
|
+
default:
|
|
1146
|
+
return null;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
var DIRECTED = /* @__PURE__ */ new Set(["set_chart_values", "select_chart_element"]);
|
|
1150
|
+
function withChartPlayback(provider, options) {
|
|
1151
|
+
const plan = (tool) => {
|
|
1152
|
+
if (tool.plan || tool.playback !== void 0) return tool;
|
|
1153
|
+
if (options.director && DIRECTED.has(tool.name)) return { ...tool, playback: "self" };
|
|
1154
|
+
return { ...tool, plan: (args) => planChartToolPlayback(tool.name, args) };
|
|
1155
|
+
};
|
|
1156
|
+
const tools = provider.tools;
|
|
1157
|
+
return {
|
|
1158
|
+
...provider,
|
|
1159
|
+
playbackSurface: _nullishCoalesce(_nullishCoalesce(provider.playbackSurface, () => ( options.surface)), () => ( "chart")),
|
|
1160
|
+
tools: typeof tools === "function" ? () => tools().map(plan) : tools.map(plan)
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
|
|
928
1164
|
// src/chart/tools.ts
|
|
929
1165
|
var RENDER_CHART_INSTRUCTIONS = 'Draws the chart without changing it so you can check how it looks: SVG text by default, or a PNG image with format "png" when the host can rasterize. Returns the layout warnings (hidden or thinned labels, dropped markers) alongside. An image costs tokens, so render after a batch of edits rather than after each one, and use it to check what text cannot tell you: overlapping or cut-off labels, a crowded legend, unreadable colours, whether the chart reads at the given size. For values, ids and warnings alone, get_chart is cheaper.';
|
|
930
1166
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
@@ -1029,7 +1265,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1029
1265
|
handler: ({ colors, surface }) => {
|
|
1030
1266
|
const s = spec();
|
|
1031
1267
|
const visible = s.series.filter((x) => !x.hidden);
|
|
1032
|
-
const own = _chunkUR37VCIRcjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access',
|
|
1268
|
+
const own = _chunkUR37VCIRcjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _87 => _87[0], 'optionalAccess', _88 => _88.pointColors, 'optionalAccess', _89 => _89[i]]) || _chunkUR37VCIRcjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkUR37VCIRcjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
1033
1269
|
return { colors: _nullishCoalesce(colors, () => ( own)), ..._chunkUR37VCIRcjs.checkChartColors.call(void 0, _nullishCoalesce(colors, () => ( own)), { surface }) };
|
|
1034
1270
|
}
|
|
1035
1271
|
};
|
|
@@ -1059,8 +1295,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1059
1295
|
annotations: { title: "Read a trendline fit", ...READ },
|
|
1060
1296
|
handler: ({ series, index }) => {
|
|
1061
1297
|
const s = seriesById(series);
|
|
1062
|
-
const line = _optionalChain([s, 'access',
|
|
1063
|
-
if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access',
|
|
1298
|
+
const line = _optionalChain([s, 'access', _90 => _90.trendlines, 'optionalAccess', _91 => _91[index]]);
|
|
1299
|
+
if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access', _92 => _92.trendlines, 'optionalAccess', _93 => _93.length]), () => ( 0))}.`);
|
|
1064
1300
|
if (line.type === "moving-average") return { trendline: line, points: controller.trendlineMovingAverage(s.id, index) };
|
|
1065
1301
|
const fit = controller.trendlineFit(s.id, index);
|
|
1066
1302
|
if (!fit) fail2(`The ${line.type} trendline on "${s.name}" cannot be fitted: it needs more points (and positive values for log, exponential and power fits).`);
|
|
@@ -1318,7 +1554,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1318
1554
|
handler: ({ series, index }) => {
|
|
1319
1555
|
const s = seriesById(series);
|
|
1320
1556
|
resolve(controller.removeTrendline(s.id, index));
|
|
1321
|
-
return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
1557
|
+
return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _94 => _94.getSeries, 'call', _95 => _95(s.id), 'optionalAccess', _96 => _96.trendlines]), () => ( [])) };
|
|
1322
1558
|
}
|
|
1323
1559
|
};
|
|
1324
1560
|
const applyPreset = {
|
|
@@ -1428,9 +1664,9 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1428
1664
|
const scene = _chunk6HMEHNWWcjs.layoutChart.call(void 0, controller.toJSON(), { width, height });
|
|
1429
1665
|
const start = { x: from.x * width, y: from.y * height };
|
|
1430
1666
|
const target = chartHitTest(scene, start);
|
|
1431
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
1667
|
+
if (_optionalChain([target, 'optionalAccess', _97 => _97.kind]) !== "point") fail2(`There is no bar or point at (${from.x}, ${from.y}); ${target ? `that is the ${target.kind}` : "that is outside the chart"}. Use render_chart to find marks.`);
|
|
1432
1668
|
const t = target;
|
|
1433
|
-
const before = _nullishCoalesce(_optionalChain([controller, 'access',
|
|
1669
|
+
const before = _nullishCoalesce(_optionalChain([controller, 'access', _98 => _98.getSeries, 'call', _99 => _99(t.seriesId), 'optionalAccess', _100 => _100.values, 'access', _101 => _101[t.index]]), () => ( null));
|
|
1434
1670
|
const session = startChartPointDrag(controller, scene, t, start);
|
|
1435
1671
|
if (!session) fail2("That point cannot be dragged here (percent-stacked charts, pies and gaps cannot be dragged).");
|
|
1436
1672
|
session.move({ x: to.x * width, y: to.y * height }, { fine, lockAxis });
|
|
@@ -1458,7 +1694,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1458
1694
|
const scene = _chunk6HMEHNWWcjs.layoutChart.call(void 0, controller.toJSON(), size);
|
|
1459
1695
|
const used = handleChartKey(controller, scene, { key: k, shiftKey: shift, altKey: alt });
|
|
1460
1696
|
const sel = controller.getState().selection;
|
|
1461
|
-
const value = _optionalChain([sel, 'optionalAccess',
|
|
1697
|
+
const value = _optionalChain([sel, 'optionalAccess', _102 => _102.kind]) === "point" ? _nullishCoalesce(_optionalChain([controller, 'access', _103 => _103.getSeries, 'call', _104 => _104(sel.seriesId), 'optionalAccess', _105 => _105.values, 'access', _106 => _106[sel.index]]), () => ( null)) : void 0;
|
|
1462
1698
|
return { used, selection: sel, ...value !== void 0 ? { value } : {} };
|
|
1463
1699
|
}
|
|
1464
1700
|
};
|
|
@@ -1488,7 +1724,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1488
1724
|
};
|
|
1489
1725
|
const reads = [getChart, renderChart, checkColors, recommend, getTrendline, listPresets, exportMermaid, exportOoxml];
|
|
1490
1726
|
const writes = [updateChart, setData, setValues, addSeries, updateSeries, removeSeries, addCategory, removeCategory, importCsv, importMermaid, addTrendline, removeTrendline, applyPreset, transpose, select, drag, key, undo, redo];
|
|
1491
|
-
return {
|
|
1727
|
+
return withChartPlayback({
|
|
1492
1728
|
id: _nullishCoalesce(options.id, () => ( "chart")),
|
|
1493
1729
|
namespace: options.namespace,
|
|
1494
1730
|
title: "Chart editor",
|
|
@@ -1508,7 +1744,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1508
1744
|
}
|
|
1509
1745
|
});
|
|
1510
1746
|
}
|
|
1511
|
-
};
|
|
1747
|
+
}, { director: !!options.director });
|
|
1512
1748
|
}
|
|
1513
1749
|
|
|
1514
1750
|
// src/chart/stream.ts
|
|
@@ -1517,7 +1753,7 @@ function parsePartialChartJson(text) {
|
|
|
1517
1753
|
if (!src) return void 0;
|
|
1518
1754
|
try {
|
|
1519
1755
|
return JSON.parse(src);
|
|
1520
|
-
} catch (
|
|
1756
|
+
} catch (e4) {
|
|
1521
1757
|
}
|
|
1522
1758
|
const stack = [];
|
|
1523
1759
|
let inString = false;
|
|
@@ -1541,7 +1777,7 @@ function parsePartialChartJson(text) {
|
|
|
1541
1777
|
const candidate = trimmed + [...stack].reverse().join("");
|
|
1542
1778
|
try {
|
|
1543
1779
|
return JSON.parse(candidate);
|
|
1544
|
-
} catch (
|
|
1780
|
+
} catch (e5) {
|
|
1545
1781
|
const next = trimmed.replace(/,\s*$/, "").replace(/(?:,|\{)\s*"[^"]*"\s*:?\s*$/, (m) => m.trim().startsWith("{") ? "{" : "").replace(/:\s*$/, ": null").replace(/(?<=[\[,:]\s*)(-|tr?u?|fa?l?s?|nu?l?)$/, "").replace(/(?<=[\[,:]\s*)(-?\d+\.)$/, (m) => m.slice(0, -1));
|
|
1546
1782
|
if (next === trimmed) break;
|
|
1547
1783
|
out = next;
|
|
@@ -1595,7 +1831,7 @@ var ChartStream = (_class = class {
|
|
|
1595
1831
|
function safeParse(text) {
|
|
1596
1832
|
try {
|
|
1597
1833
|
return JSON.parse(text);
|
|
1598
|
-
} catch (
|
|
1834
|
+
} catch (e6) {
|
|
1599
1835
|
return parsePartialChartJson(text);
|
|
1600
1836
|
}
|
|
1601
1837
|
}
|
|
@@ -1643,162 +1879,6 @@ function blendChartScenes(from, to, t) {
|
|
|
1643
1879
|
}
|
|
1644
1880
|
var easeChartTween = (t) => 1 - Math.pow(1 - Math.max(0, Math.min(1, t)), 3);
|
|
1645
1881
|
|
|
1646
|
-
// src/chart/presence.ts
|
|
1647
|
-
var ChartPresence = class extends _chunkUJGAA6AKcjs.PresenceStore {
|
|
1648
|
-
};
|
|
1649
|
-
var CHART_PRESENCE_COLORS = _chunkUJGAA6AKcjs.PRESENCE_COLORS;
|
|
1650
|
-
var realChartClock = _chunkUJGAA6AKcjs.realPresenceClock;
|
|
1651
|
-
var createInstantChartClock = _chunkUJGAA6AKcjs.createInstantPresenceClock;
|
|
1652
|
-
function chartPointAnchor(scene, seriesId, index) {
|
|
1653
|
-
const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _91 => _91.target, 'optionalAccess', _92 => _92.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
|
|
1654
|
-
if (!mark) return null;
|
|
1655
|
-
if (mark.kind === "rect") return { x: mark.x + mark.width / 2, y: mark.y };
|
|
1656
|
-
if (mark.kind === "circle") return { x: mark.cx, y: mark.cy };
|
|
1657
|
-
return null;
|
|
1658
|
-
}
|
|
1659
|
-
var anchorFor = (scene, role) => {
|
|
1660
|
-
const m = scene.marks.find((x) => x.role === role);
|
|
1661
|
-
if (!m) return null;
|
|
1662
|
-
if (m.kind === "text") return { x: m.x, y: m.y };
|
|
1663
|
-
if (m.kind === "rect") return { x: m.x + m.width / 2, y: m.y + m.height / 2 };
|
|
1664
|
-
if (m.kind === "line") return { x: (m.x1 + m.x2) / 2, y: (m.y1 + m.y2) / 2 };
|
|
1665
|
-
return null;
|
|
1666
|
-
};
|
|
1667
|
-
function planChartCommand(spec, scene, command, speed = 1) {
|
|
1668
|
-
const ms = (n) => Math.round(n / Math.max(0.1, speed));
|
|
1669
|
-
const steps = [];
|
|
1670
|
-
const note = "note" in command && command.note ? command.note : void 0;
|
|
1671
|
-
if (note) steps.push({ type: "say", text: note, ms: ms(500) });
|
|
1672
|
-
switch (command.kind) {
|
|
1673
|
-
case "say":
|
|
1674
|
-
steps.push({ type: "say", text: command.text, ms: ms(900) });
|
|
1675
|
-
return steps;
|
|
1676
|
-
case "setValue": {
|
|
1677
|
-
const at = chartPointAnchor(scene, command.seriesId, command.index);
|
|
1678
|
-
const series = spec.series.find((s) => s.id === command.seriesId);
|
|
1679
|
-
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _93 => _93.values, 'access', _94 => _94[command.index]]), () => ( 0));
|
|
1680
|
-
const scale = _optionalChain([series, 'optionalAccess', _95 => _95.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
|
|
1681
|
-
if (at && scale) {
|
|
1682
|
-
const px = _chunk6HMEHNWWcjs.linearMap.call(void 0, command.value, scale.domain, scale.range);
|
|
1683
|
-
const to = scale.axis === "y" ? { x: at.x, y: px } : { x: px, y: at.y };
|
|
1684
|
-
steps.push({ type: "move", to: at, ms: ms(380) }, { type: "press" }, { type: "drag", to, ms: ms(520), from, value: command.value }, { type: "release" });
|
|
1685
|
-
} else steps.push({ type: "drag", to: { x: scene.plot.x + scene.plot.width / 2, y: scene.plot.y + scene.plot.height / 2 }, ms: ms(200), from, value: command.value });
|
|
1686
|
-
steps.push({ type: "commit" });
|
|
1687
|
-
return steps;
|
|
1688
|
-
}
|
|
1689
|
-
case "select": {
|
|
1690
|
-
const sel = command.selection;
|
|
1691
|
-
let to = null;
|
|
1692
|
-
if (_optionalChain([sel, 'optionalAccess', _96 => _96.kind]) === "point") to = chartPointAnchor(scene, sel.seriesId, sel.index);
|
|
1693
|
-
else if (sel) {
|
|
1694
|
-
const m = scene.marks.find((x) => x.target && JSON.stringify(x.target) === JSON.stringify(sel));
|
|
1695
|
-
if (_optionalChain([m, 'optionalAccess', _97 => _97.kind]) === "text") to = { x: m.x, y: m.y };
|
|
1696
|
-
else if (_optionalChain([m, 'optionalAccess', _98 => _98.kind]) === "rect") to = { x: m.x + m.width / 2, y: m.y + m.height / 2 };
|
|
1697
|
-
else if (_optionalChain([m, 'optionalAccess', _99 => _99.kind]) === "circle") to = { x: m.cx, y: m.cy };
|
|
1698
|
-
}
|
|
1699
|
-
if (to) steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" });
|
|
1700
|
-
steps.push({ type: "commit" });
|
|
1701
|
-
return steps;
|
|
1702
|
-
}
|
|
1703
|
-
case "update": {
|
|
1704
|
-
const keys = Object.keys(command.patch);
|
|
1705
|
-
const role = keys.includes("title") ? "title" : keys.includes("legend") ? "legend-label" : keys.some((k) => k === "xAxis") ? "axis" : keys.some((k) => k === "yAxis" || k === "yAxis2") ? "tick-label" : null;
|
|
1706
|
-
const to = role && anchorFor(scene, role) || { x: scene.plot.x + scene.plot.width / 2, y: scene.plot.y + 12 };
|
|
1707
|
-
steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" }, { type: "commit" });
|
|
1708
|
-
return steps;
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
var ChartDirector = class {
|
|
1713
|
-
constructor(controller, presence, options) {
|
|
1714
|
-
this.controller = controller;
|
|
1715
|
-
this.presence = presence;
|
|
1716
|
-
this.options = options;
|
|
1717
|
-
this.clock = _nullishCoalesce(options.clock, () => ( realChartClock));
|
|
1718
|
-
this.queue = new (0, _chunkUJGAA6AKcjs.PerformanceQueue)(presence, {
|
|
1719
|
-
clock: this.clock,
|
|
1720
|
-
linger: options.linger,
|
|
1721
|
-
beginGesture: (key) => controller.beginGesture(key),
|
|
1722
|
-
endGesture: () => controller.endGesture()
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
/** Acts out `commands` in order for `actor`. Resolves with one result per command. */
|
|
1731
|
-
perform(actor, commands) {
|
|
1732
|
-
return this.queue.run(actor, async () => {
|
|
1733
|
-
const results = [];
|
|
1734
|
-
for (const command of commands) results.push(await this.performOne(actor.id, command));
|
|
1735
|
-
return results;
|
|
1736
|
-
});
|
|
1737
|
-
}
|
|
1738
|
-
stale(command) {
|
|
1739
|
-
const spec = this.controller.getSpec();
|
|
1740
|
-
if (command.kind === "setValue") {
|
|
1741
|
-
const s = spec.series.find((x) => x.id === command.seriesId);
|
|
1742
|
-
if (!s) return `The series "${command.seriesId}" no longer exists.`;
|
|
1743
|
-
if (command.index < 0 || command.index >= spec.categories.length) return `Category ${command.index} no longer exists.`;
|
|
1744
|
-
if (!Number.isFinite(command.value)) return "The value must be a finite number.";
|
|
1745
|
-
}
|
|
1746
|
-
return null;
|
|
1747
|
-
}
|
|
1748
|
-
move(id, from, to, ms, each) {
|
|
1749
|
-
return _chunkUJGAA6AKcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, from, to, ms, each);
|
|
1750
|
-
}
|
|
1751
|
-
async performOne(id, command) {
|
|
1752
|
-
const stale = this.stale(command);
|
|
1753
|
-
if (stale) return { ok: false, command, message: stale };
|
|
1754
|
-
const steps = planChartCommand(this.controller.getSpec(), this.options.scene(), command, this.options.speed);
|
|
1755
|
-
const where = () => {
|
|
1756
|
-
const a = this.presence.getState().actors.find((x) => x.id === id);
|
|
1757
|
-
return { x: a.x, y: a.y };
|
|
1758
|
-
};
|
|
1759
|
-
{
|
|
1760
|
-
for (const step of steps) {
|
|
1761
|
-
switch (step.type) {
|
|
1762
|
-
case "say":
|
|
1763
|
-
this.presence.set({ id, message: step.text });
|
|
1764
|
-
await this.clock.wait(step.ms);
|
|
1765
|
-
break;
|
|
1766
|
-
case "move":
|
|
1767
|
-
await this.move(id, where(), step.to, step.ms);
|
|
1768
|
-
break;
|
|
1769
|
-
case "press":
|
|
1770
|
-
this.presence.set({ id, pressed: true });
|
|
1771
|
-
break;
|
|
1772
|
-
case "release":
|
|
1773
|
-
this.presence.set({ id, pressed: false });
|
|
1774
|
-
break;
|
|
1775
|
-
case "drag": {
|
|
1776
|
-
if (command.kind !== "setValue") break;
|
|
1777
|
-
const stale2 = this.stale(command);
|
|
1778
|
-
if (stale2) return { ok: false, command, message: stale2 };
|
|
1779
|
-
const label = `${_nullishCoalesce(_optionalChain([this, 'access', _100 => _100.presence, 'access', _101 => _101.getState, 'call', _102 => _102(), 'access', _103 => _103.actors, 'access', _104 => _104.find, 'call', _105 => _105((a) => a.id === id), 'optionalAccess', _106 => _106.name]), () => ( "Agent"))}: edit value`;
|
|
1780
|
-
await this.move(id, where(), step.to, step.ms, (e) => {
|
|
1781
|
-
const v = step.from + (step.value - step.from) * e;
|
|
1782
|
-
this.controller.setValue(command.seriesId, command.index, Number(v.toPrecision(12)), { label });
|
|
1783
|
-
});
|
|
1784
|
-
this.controller.setValue(command.seriesId, command.index, step.value, { label });
|
|
1785
|
-
break;
|
|
1786
|
-
}
|
|
1787
|
-
case "commit": {
|
|
1788
|
-
if (command.kind === "select") this.controller.select(command.selection);
|
|
1789
|
-
else if (command.kind === "update") {
|
|
1790
|
-
const result = this.controller.update(command.patch, command.label ? { label: command.label } : {});
|
|
1791
|
-
if (!result.ok) return { ok: false, command, message: result.message };
|
|
1792
|
-
}
|
|
1793
|
-
break;
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return { ok: true, command };
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
};
|
|
1801
|
-
|
|
1802
1882
|
// src/chart/office-files.ts
|
|
1803
1883
|
var OfficeChartsError = class extends Error {
|
|
1804
1884
|
constructor(message, options) {
|
|
@@ -1991,7 +2071,7 @@ function fromBase64(data) {
|
|
|
1991
2071
|
let binary;
|
|
1992
2072
|
try {
|
|
1993
2073
|
binary = atob(clean);
|
|
1994
|
-
} catch (
|
|
2074
|
+
} catch (e7) {
|
|
1995
2075
|
return fail3('"data" is not valid base64. Pass the whole .xlsx, .pptx or .docx file encoded as base64 (a data: URL prefix is fine).');
|
|
1996
2076
|
}
|
|
1997
2077
|
const out = new Uint8Array(binary.length);
|
|
@@ -2263,4 +2343,8 @@ function createOfficeChartToolProvider(options = {}) {
|
|
|
2263
2343
|
|
|
2264
2344
|
|
|
2265
2345
|
|
|
2266
|
-
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
exports.CHART_AXIS_KINDS = _chunkUR37VCIRcjs.CHART_AXIS_KINDS; exports.CHART_AXIS_SCALES = _chunkUR37VCIRcjs.CHART_AXIS_SCALES; exports.CHART_COLOR_SCHEMES = _chunkXQ33O5BCcjs.CHART_COLOR_SCHEMES; exports.CHART_CURVES = _chunkUR37VCIRcjs.CHART_CURVES; exports.CHART_DATE_STEPS = _chunk6HMEHNWWcjs.CHART_DATE_STEPS; exports.CHART_ERROR_BAR_DIRECTIONS = _chunkUR37VCIRcjs.CHART_ERROR_BAR_DIRECTIONS; exports.CHART_ERROR_BAR_LABELS = _chunkUR37VCIRcjs.CHART_ERROR_BAR_LABELS; exports.CHART_ERROR_BAR_TYPES = _chunkUR37VCIRcjs.CHART_ERROR_BAR_TYPES; exports.CHART_LABEL_POSITIONS = _chunkUR37VCIRcjs.CHART_LABEL_POSITIONS; exports.CHART_LAYOUT_PRESETS = _chunkXQ33O5BCcjs.CHART_LAYOUT_PRESETS; exports.CHART_LEGEND_POSITIONS = _chunkUR37VCIRcjs.CHART_LEGEND_POSITIONS; exports.CHART_MARKERS = _chunkUR37VCIRcjs.CHART_MARKERS; exports.CHART_MERMAID_META_PREFIX = _chunkXQ33O5BCcjs.CHART_MERMAID_META_PREFIX; exports.CHART_NUMBER_STYLES = _chunkUR37VCIRcjs.CHART_NUMBER_STYLES; exports.CHART_OOXML_CONTENT_TYPE = _chunkHLMF3E53cjs.CHART_OOXML_CONTENT_TYPE; exports.CHART_OOXML_NS = _chunkHLMF3E53cjs.CHART_OOXML_NS; exports.CHART_OOXML_RELATIONSHIP = _chunkHLMF3E53cjs.CHART_OOXML_RELATIONSHIP; exports.CHART_ORIENTATIONS = _chunkUR37VCIRcjs.CHART_ORIENTATIONS; exports.CHART_PALETTE_SHADES = _chunkUR37VCIRcjs.CHART_PALETTE_SHADES; exports.CHART_PRESENCE_COLORS = CHART_PRESENCE_COLORS; exports.CHART_RASTER_MAX_SIZE = CHART_RASTER_MAX_SIZE; exports.CHART_SERIES_TYPES = _chunkUR37VCIRcjs.CHART_SERIES_TYPES; exports.CHART_STACKINGS = _chunkUR37VCIRcjs.CHART_STACKINGS; exports.CHART_TRENDLINE_TYPES = _chunkUR37VCIRcjs.CHART_TRENDLINE_TYPES; exports.CHART_TYPES = _chunkUR37VCIRcjs.CHART_TYPES; exports.CHART_TYPE_LABELS = _chunkUR37VCIRcjs.CHART_TYPE_LABELS; exports.CSS_VARIABLE_CHART_THEME = _chunkUR37VCIRcjs.CSS_VARIABLE_CHART_THEME; exports.ChartController = _chunkXQ33O5BCcjs.ChartController; exports.ChartDirector = ChartDirector; exports.ChartPresence = ChartPresence; exports.ChartStream = ChartStream; exports.DEFAULT_CHART_PALETTE = _chunkUR37VCIRcjs.DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = _chunkUR37VCIRcjs.DEFAULT_CHART_THEME; exports.MAX_CHART_DATA_LABELS = _chunk6HMEHNWWcjs.MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = _chunk6HMEHNWWcjs.MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = _chunk6HMEHNWWcjs.MAX_CHART_MARKERS; exports.OfficeChartsError = OfficeChartsError; exports.RENDER_CHART_INSTRUCTIONS = RENDER_CHART_INSTRUCTIONS; exports.analyzeChartTable = analyzeChartTable; exports.blendChartScenes = blendChartScenes; exports.canDragChartPoint = canDragChartPoint; exports.chartBoxStats = _chunk6HMEHNWWcjs.chartBoxStats; exports.chartClientToScene = chartClientToScene; exports.chartColorDistance = _chunkUR37VCIRcjs.chartColorDistance; exports.chartColorInputValue = _chunkUR37VCIRcjs.chartColorInputValue; exports.chartColorsByCategory = _chunkUR37VCIRcjs.chartColorsByCategory; exports.chartContrastRatio = _chunkUR37VCIRcjs.chartContrastRatio; exports.chartDataFromTable = _chunkUR37VCIRcjs.chartDataFromTable; exports.chartDataToTable = _chunkUR37VCIRcjs.chartDataToTable; exports.chartDateLabels = _chunk6HMEHNWWcjs.chartDateLabels; exports.chartDateToSerial = _chunk6HMEHNWWcjs.chartDateToSerial; exports.chartErrorAmounts = _chunkUR37VCIRcjs.chartErrorAmounts; exports.chartErrorBarsOfType = _chunkUR37VCIRcjs.chartErrorBarsOfType; exports.chartFamily = _chunkUR37VCIRcjs.chartFamily; exports.chartFileName = chartFileName; exports.chartFormatToCode = _chunkHLMF3E53cjs.chartFormatToCode; exports.chartFromMermaid = _chunkXQ33O5BCcjs.chartFromMermaid; exports.chartFromOoxml = _chunkHLMF3E53cjs.chartFromOoxml; exports.chartFromTable = chartFromTable; exports.chartHistogram = _chunk6HMEHNWWcjs.chartHistogram; exports.chartHitTest = chartHitTest; exports.chartLuminance = _chunkUR37VCIRcjs.chartLuminance; exports.chartMermaidFamily = _chunkXQ33O5BCcjs.chartMermaidFamily; exports.chartMovingAverage = _chunk6HMEHNWWcjs.chartMovingAverage; exports.chartPointAnchor = chartPointAnchor; exports.chartPointColor = _chunkUR37VCIRcjs.chartPointColor; exports.chartPointRef = chartPointRef; exports.chartPresetPatch = _chunkXQ33O5BCcjs.chartPresetPatch; exports.chartQuantile = _chunk6HMEHNWWcjs.chartQuantile; exports.chartRasterSize = chartRasterSize; exports.chartRgbToHex = _chunkUR37VCIRcjs.chartRgbToHex; exports.chartRgbToOklab = _chunkUR37VCIRcjs.chartRgbToOklab; exports.chartScaleFromPixel = _chunk6HMEHNWWcjs.chartScaleFromPixel; exports.chartScaleToPixel = _chunk6HMEHNWWcjs.chartScaleToPixel; exports.chartSceneToDomSpec = _chunkXQ33O5BCcjs.chartSceneToDomSpec; exports.chartSceneToSvg = _chunkXQ33O5BCcjs.chartSceneToSvg; exports.chartSerialToDate = _chunk6HMEHNWWcjs.chartSerialToDate; exports.chartSeriesColor = _chunkUR37VCIRcjs.chartSeriesColor; exports.chartSeriesType = _chunkUR37VCIRcjs.chartSeriesType; exports.chartSliceColor = _chunkUR37VCIRcjs.chartSliceColor; exports.chartSquarify = _chunk6HMEHNWWcjs.chartSquarify; exports.chartSupportsTrendlines = _chunk6HMEHNWWcjs.chartSupportsTrendlines; exports.chartTextBaseline = _chunkXQ33O5BCcjs.chartTextBaseline; exports.chartTextOn = _chunkUR37VCIRcjs.chartTextOn; exports.chartTextTransform = _chunkXQ33O5BCcjs.chartTextTransform; exports.chartToMermaid = _chunkXQ33O5BCcjs.chartToMermaid; exports.chartToOoxml = _chunkHLMF3E53cjs.chartToOoxml; exports.chartToSvg = _chunkXQ33O5BCcjs.chartToSvg; exports.chartTrendlineName = _chunk6HMEHNWWcjs.chartTrendlineName; exports.chartValueAtPoint = _chunk6HMEHNWWcjs.chartValueAtPoint; exports.chartXAtPoint = _chunk6HMEHNWWcjs.chartXAtPoint; exports.checkChartColors = _chunkUR37VCIRcjs.checkChartColors; exports.cloneChartSeries = _chunkUR37VCIRcjs.cloneChartSeries; exports.cloneChartSpec = _chunkUR37VCIRcjs.cloneChartSpec; exports.compileChartFormatCode = _chunk6HMEHNWWcjs.compileChartFormatCode; exports.contrastingTextColor = _chunk6HMEHNWWcjs.contrastingTextColor; exports.createChartCommands = createChartCommands; exports.createChartController = _chunkXQ33O5BCcjs.createChartController; exports.createChartRasterizer = createChartRasterizer; exports.createChartSpec = _chunkUR37VCIRcjs.createChartSpec; exports.createChartToolProvider = createChartToolProvider; exports.createInstantChartClock = createInstantChartClock; exports.createOfficeChartToolProvider = createOfficeChartToolProvider; exports.cyclePaletteColor = _chunkUR37VCIRcjs.cyclePaletteColor; exports.decimateChartPoints = _chunk6HMEHNWWcjs.decimateChartPoints; exports.defaultChartAxis = _chunkUR37VCIRcjs.defaultChartAxis; exports.defaultChartErrorBarValue = _chunkUR37VCIRcjs.defaultChartErrorBarValue; exports.describeChart = _chunkXQ33O5BCcjs.describeChart; exports.describeChartErrorBars = _chunkUR37VCIRcjs.describeChartErrorBars; exports.describeChartSelection = describeChartSelection; exports.describeOfficeChartPlace = describeOfficeChartPlace; exports.downloadChartPng = downloadChartPng; exports.easeChartTween = easeChartTween; exports.estimateChartTextWidth = _chunk6HMEHNWWcjs.estimateChartTextWidth; exports.extractDocxCharts = extractDocxCharts; exports.extractOfficeCharts = extractOfficeCharts; exports.extractPptxCharts = extractPptxCharts; exports.extractXlsxCharts = extractXlsxCharts; exports.findMermaidCharts = _chunkXQ33O5BCcjs.findMermaidCharts; exports.fitChartTrendline = _chunk6HMEHNWWcjs.fitChartTrendline; exports.formatChartAmountList = _chunkUR37VCIRcjs.formatChartAmountList; exports.formatChartDate = _chunk6HMEHNWWcjs.formatChartDate; exports.formatChartNumber = _chunk6HMEHNWWcjs.formatChartNumber; exports.formatChartValueWithCode = _chunk6HMEHNWWcjs.formatChartValueWithCode; exports.handleChartKey = handleChartKey; exports.isCartesianChart = _chunkUR37VCIRcjs.isCartesianChart; exports.isXyChart = _chunkUR37VCIRcjs.isXyChart; exports.layoutChart = _chunk6HMEHNWWcjs.layoutChart; exports.layoutSparkline = _chunkXQ33O5BCcjs.layoutSparkline; exports.linearMap = _chunk6HMEHNWWcjs.linearMap; exports.locateChartPoint = locateChartPoint; exports.monochromeChartPalette = _chunkXQ33O5BCcjs.monochromeChartPalette; exports.niceLogScale = _chunk6HMEHNWWcjs.niceLogScale; exports.niceScale = _chunk6HMEHNWWcjs.niceScale; exports.niceStep = _chunk6HMEHNWWcjs.niceStep; exports.normalizeChartAxis = _chunkUR37VCIRcjs.normalizeChartAxis; exports.normalizeChartErrorBars = _chunkUR37VCIRcjs.normalizeChartErrorBars; exports.normalizeChartSpec = _chunkUR37VCIRcjs.normalizeChartSpec; exports.normalizeChartTrendline = _chunkUR37VCIRcjs.normalizeChartTrendline; exports.normalizeChartValues = _chunkUR37VCIRcjs.normalizeChartValues; exports.parseChartAmountList = _chunkUR37VCIRcjs.parseChartAmountList; exports.parseChartColor = _chunkUR37VCIRcjs.parseChartColor; exports.parseChartDate = _chunk6HMEHNWWcjs.parseChartDate; exports.parseChartValue = _chunkUR37VCIRcjs.parseChartValue; exports.parsePartialChartJson = parsePartialChartJson; exports.planChartCommand = planChartCommand; exports.planChartToolPlayback = planChartToolPlayback; exports.rasterizeChartSvg = rasterizeChartSvg; exports.realChartClock = realChartClock; exports.recommendChartTypes = recommendChartTypes; exports.recommendForShape = recommendForShape; exports.resolveChartSvgPaints = resolveChartSvgPaints; exports.sameChartSelection = _chunk6HMEHNWWcjs.sameChartSelection; exports.shadeChartColor = _chunkUR37VCIRcjs.shadeChartColor; exports.simulateChartVision = _chunkUR37VCIRcjs.simulateChartVision; exports.snapChartDragValue = snapChartDragValue; exports.snapChartValue = _chunk6HMEHNWWcjs.snapChartValue; exports.sparklineToSvg = _chunkXQ33O5BCcjs.sparklineToSvg; exports.startChartPointDrag = startChartPointDrag; exports.stepDecimals = _chunk6HMEHNWWcjs.stepDecimals; exports.summarizeChart = _chunkXQ33O5BCcjs.summarizeChart; exports.summarizeChartSeries = _chunk6HMEHNWWcjs.summarizeChartSeries; exports.trendNumberText = _chunk6HMEHNWWcjs.trendNumberText; exports.uniqueChartSeriesId = _chunkUR37VCIRcjs.uniqueChartSeriesId; exports.withChartPlayback = withChartPlayback;
|
package/dist/chart/index.d.cts
CHANGED