@pixerate/editor 0.10.0 → 0.11.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 +52 -1
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +68 -1
- package/dist/agent/index.d.ts +68 -1
- package/dist/agent/index.js +50 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +171 -8
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +91 -1
- package/dist/canvas/index.d.ts +91 -1
- package/dist/canvas/index.js +163 -8
- package/dist/canvas/index.js.map +1 -1
- package/dist/index.cjs +223 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +213 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -9,8 +9,8 @@ export { Content, Editor, EditorOptions, Extensions } from '@tiptap/core';
|
|
|
9
9
|
export { ASTNode, BinaryOpNode, CellCoordinate, CellData, CellDep, CellFormat, CellRange, CellRefNode, ColumnBinding, ColumnType, DataSourceBinder, DependencyGraph, EvaluationContext, FormulaEvaluator, FormulaParser, FormulaToken, FormulaTokenType, FunctionCallNode, LiteralNode, PropertyRefNode, RangeNode, RowType, SpreadsheetColumn, SpreadsheetController, SpreadsheetControllerOptions, SpreadsheetDataSource, SpreadsheetDataSourceField, SpreadsheetDocument, SpreadsheetRow, UnaryOpNode, colNameToIndex, extractCellDependencies, indexToColName, parseCellReference, parseFormula, parseRange, tokenizeFormula } from './spreadsheet/index.cjs';
|
|
10
10
|
export { Command, HistoryManager, HistoryManagerOptions, HistoryState, MergedExecutionOptions, SnapshotCommandOptions, createHistoryManager } from './history/index.cjs';
|
|
11
11
|
export { C as CanvasClipboardPayload, a as CanvasDockingCallbacks, b as CanvasEdge, c as CanvasLayoutOptions, d as CanvasNode, e as CollapseNodeOptions, D as DirectionalDisplacementOptions, f as DisplacementDirection, g as DockStrategy, E as ExplodeNodeOptions, h as ExplosionSnapshot, F as FanOutTrajectoryOptions, G as GraphDifferences, I as IncrementalLayoutOptions, N as NodeTransition, P as PlaceBesideOptions, i as Point, j as Position, R as Rect, k as ReflowDisplacementOptions, S as Side, T as TrajectoryFunction, l as TrajectoryPoint, X as XYPosition } from './types-lGtRobRV.cjs';
|
|
12
|
-
export { DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, StreamingLayoutManager, StreamingLayoutManagerOptions, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, centerNodes, centre, computeNodesBoundingBox, createBezierTrajectory, createFanOutTrajectory, defaultEasing, ensureLayout, estimateNodeSize, flowSide, getCenteredNodePosition, getLayoutedNodes, isEventFromTextInput, isValidCanvasNode, isValidUrl, linearPositionTrajectory, linearTrajectory, overlaps, parseCanvasClipboardData, placeBeside, remapPastedNodes, repositionNodesTo, runMultiNodeTransition, serializeCanvasNodes } from './canvas/index.cjs';
|
|
13
|
-
export { AgentCommand, AgentPresence, AgentStep, EDITOR_MCP_TOOLS, EditorSnapshot, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, planAgentCommand } from './agent/index.cjs';
|
|
12
|
+
export { CanvasHeightOptions, Clock, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, ManualClock, StreamingLayoutManager, StreamingLayoutManagerOptions, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canvasHeight, centerNodes, centre, computeNodesBoundingBox, connectedOnly, createBezierTrajectory, createFanOutTrajectory, defaultEasing, ensureLayout, estimateCanvasHeight, estimateNodeSize, flowSide, getCenteredNodePosition, getLayoutedNodes, isEventFromTextInput, isValidCanvasNode, isValidUrl, layoutBounds, linearPositionTrajectory, linearTrajectory, overlaps, pageHidden, parseCanvasClipboardData, placeBeside, realClock, remapPastedNodes, repositionNodesTo, runMultiNodeTransition, serializeCanvasNodes } from './canvas/index.cjs';
|
|
13
|
+
export { AgentCommand, AgentPresence, AgentStep, EDITOR_MCP_TOOLS, EXPORT_EXCLUDED_SELECTORS, EditorSnapshot, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_VIEW_EDITOR, planAgentCommand } from './agent/index.cjs';
|
|
14
14
|
export { MarkdownOptions } from 'tiptap-markdown';
|
|
15
15
|
import '@tiptap/pm/view';
|
|
16
16
|
import '@tiptap/pm/model';
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export { Content, Editor, EditorOptions, Extensions } from '@tiptap/core';
|
|
|
9
9
|
export { ASTNode, BinaryOpNode, CellCoordinate, CellData, CellDep, CellFormat, CellRange, CellRefNode, ColumnBinding, ColumnType, DataSourceBinder, DependencyGraph, EvaluationContext, FormulaEvaluator, FormulaParser, FormulaToken, FormulaTokenType, FunctionCallNode, LiteralNode, PropertyRefNode, RangeNode, RowType, SpreadsheetColumn, SpreadsheetController, SpreadsheetControllerOptions, SpreadsheetDataSource, SpreadsheetDataSourceField, SpreadsheetDocument, SpreadsheetRow, UnaryOpNode, colNameToIndex, extractCellDependencies, indexToColName, parseCellReference, parseFormula, parseRange, tokenizeFormula } from './spreadsheet/index.js';
|
|
10
10
|
export { Command, HistoryManager, HistoryManagerOptions, HistoryState, MergedExecutionOptions, SnapshotCommandOptions, createHistoryManager } from './history/index.js';
|
|
11
11
|
export { C as CanvasClipboardPayload, a as CanvasDockingCallbacks, b as CanvasEdge, c as CanvasLayoutOptions, d as CanvasNode, e as CollapseNodeOptions, D as DirectionalDisplacementOptions, f as DisplacementDirection, g as DockStrategy, E as ExplodeNodeOptions, h as ExplosionSnapshot, F as FanOutTrajectoryOptions, G as GraphDifferences, I as IncrementalLayoutOptions, N as NodeTransition, P as PlaceBesideOptions, i as Point, j as Position, R as Rect, k as ReflowDisplacementOptions, S as Side, T as TrajectoryFunction, l as TrajectoryPoint, X as XYPosition } from './types-lGtRobRV.js';
|
|
12
|
-
export { DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, StreamingLayoutManager, StreamingLayoutManagerOptions, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, centerNodes, centre, computeNodesBoundingBox, createBezierTrajectory, createFanOutTrajectory, defaultEasing, ensureLayout, estimateNodeSize, flowSide, getCenteredNodePosition, getLayoutedNodes, isEventFromTextInput, isValidCanvasNode, isValidUrl, linearPositionTrajectory, linearTrajectory, overlaps, parseCanvasClipboardData, placeBeside, remapPastedNodes, repositionNodesTo, runMultiNodeTransition, serializeCanvasNodes } from './canvas/index.js';
|
|
13
|
-
export { AgentCommand, AgentPresence, AgentStep, EDITOR_MCP_TOOLS, EditorSnapshot, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, planAgentCommand } from './agent/index.js';
|
|
12
|
+
export { CanvasHeightOptions, Clock, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, ManualClock, StreamingLayoutManager, StreamingLayoutManagerOptions, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canvasHeight, centerNodes, centre, computeNodesBoundingBox, connectedOnly, createBezierTrajectory, createFanOutTrajectory, defaultEasing, ensureLayout, estimateCanvasHeight, estimateNodeSize, flowSide, getCenteredNodePosition, getLayoutedNodes, isEventFromTextInput, isValidCanvasNode, isValidUrl, layoutBounds, linearPositionTrajectory, linearTrajectory, overlaps, pageHidden, parseCanvasClipboardData, placeBeside, realClock, remapPastedNodes, repositionNodesTo, runMultiNodeTransition, serializeCanvasNodes } from './canvas/index.js';
|
|
13
|
+
export { AgentCommand, AgentPresence, AgentStep, EDITOR_MCP_TOOLS, EXPORT_EXCLUDED_SELECTORS, EditorSnapshot, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_VIEW_EDITOR, planAgentCommand } from './agent/index.js';
|
|
14
14
|
export { MarkdownOptions } from 'tiptap-markdown';
|
|
15
15
|
import '@tiptap/pm/view';
|
|
16
16
|
import '@tiptap/pm/model';
|
package/dist/index.js
CHANGED
|
@@ -4453,6 +4453,79 @@ function placeBeside(rects, size, side, nearNodeId, options = {}) {
|
|
|
4453
4453
|
};
|
|
4454
4454
|
}
|
|
4455
4455
|
|
|
4456
|
+
// src/canvas/clock.ts
|
|
4457
|
+
var pageHidden = () => typeof document !== "undefined" && document.hidden;
|
|
4458
|
+
var realClock = {
|
|
4459
|
+
live: true,
|
|
4460
|
+
now: () => typeof performance !== "undefined" ? performance.now() : Date.now(),
|
|
4461
|
+
frame: () => new Promise((resolve) => {
|
|
4462
|
+
if (typeof requestAnimationFrame === "function" && !pageHidden()) {
|
|
4463
|
+
requestAnimationFrame(() => resolve());
|
|
4464
|
+
} else {
|
|
4465
|
+
setTimeout(resolve, 16);
|
|
4466
|
+
}
|
|
4467
|
+
}),
|
|
4468
|
+
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)))
|
|
4469
|
+
};
|
|
4470
|
+
var settle = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
4471
|
+
var ManualClock = class {
|
|
4472
|
+
live = false;
|
|
4473
|
+
time;
|
|
4474
|
+
frames = [];
|
|
4475
|
+
sleepers = [];
|
|
4476
|
+
seq = 0;
|
|
4477
|
+
constructor(start = 0) {
|
|
4478
|
+
this.time = start;
|
|
4479
|
+
}
|
|
4480
|
+
now() {
|
|
4481
|
+
return this.time;
|
|
4482
|
+
}
|
|
4483
|
+
frame() {
|
|
4484
|
+
return new Promise((resolve) => this.frames.push(resolve));
|
|
4485
|
+
}
|
|
4486
|
+
sleep(ms) {
|
|
4487
|
+
return new Promise(
|
|
4488
|
+
(resolve) => this.sleepers.push({
|
|
4489
|
+
at: this.time + Math.max(0, ms),
|
|
4490
|
+
seq: this.seq++,
|
|
4491
|
+
resolve
|
|
4492
|
+
})
|
|
4493
|
+
);
|
|
4494
|
+
}
|
|
4495
|
+
/** Whether any frames or sleep timers are currently pending. */
|
|
4496
|
+
get pending() {
|
|
4497
|
+
return this.frames.length > 0 || this.sleepers.length > 0;
|
|
4498
|
+
}
|
|
4499
|
+
/** Advances time by `ms`, resolving due sleep timers in order, followed by queued frames. */
|
|
4500
|
+
async advance(ms) {
|
|
4501
|
+
const end = this.time + Math.max(0, ms);
|
|
4502
|
+
await settle();
|
|
4503
|
+
while (true) {
|
|
4504
|
+
let next;
|
|
4505
|
+
for (const s of this.sleepers) {
|
|
4506
|
+
if (s.at <= end && (!next || s.at < next.at || s.at === next.at && s.seq < next.seq)) {
|
|
4507
|
+
next = s;
|
|
4508
|
+
}
|
|
4509
|
+
}
|
|
4510
|
+
if (!next) break;
|
|
4511
|
+
this.sleepers.splice(this.sleepers.indexOf(next), 1);
|
|
4512
|
+
this.time = Math.max(this.time, next.at);
|
|
4513
|
+
next.resolve();
|
|
4514
|
+
await settle();
|
|
4515
|
+
}
|
|
4516
|
+
this.time = end;
|
|
4517
|
+
const dueFrames = this.frames.splice(0, this.frames.length);
|
|
4518
|
+
for (const resolveFrame of dueFrames) {
|
|
4519
|
+
resolveFrame();
|
|
4520
|
+
}
|
|
4521
|
+
await settle();
|
|
4522
|
+
}
|
|
4523
|
+
/** Convenience method to advance by 1 frame at a given fps (default: 60fps = 16.67ms). */
|
|
4524
|
+
async tick(fps = 60) {
|
|
4525
|
+
await this.advance(Math.round(1e3 / fps));
|
|
4526
|
+
}
|
|
4527
|
+
};
|
|
4528
|
+
|
|
4456
4529
|
// src/canvas/trajectory.ts
|
|
4457
4530
|
var defaultEasing = (t) => --t * t * t + 1;
|
|
4458
4531
|
var linearTrajectory = (origin, target, progress) => {
|
|
@@ -4520,9 +4593,15 @@ function runMultiNodeTransition(transitions, options = {}) {
|
|
|
4520
4593
|
return () => {
|
|
4521
4594
|
};
|
|
4522
4595
|
}
|
|
4523
|
-
const {
|
|
4596
|
+
const {
|
|
4597
|
+
defaultDuration = 400,
|
|
4598
|
+
defaultEasing: easingFunc = defaultEasing,
|
|
4599
|
+
clock = realClock,
|
|
4600
|
+
onUpdate,
|
|
4601
|
+
onComplete
|
|
4602
|
+
} = options;
|
|
4524
4603
|
let isCancelled = false;
|
|
4525
|
-
const startTime =
|
|
4604
|
+
const startTime = clock.now();
|
|
4526
4605
|
const items = transitions.map((tr, i) => ({
|
|
4527
4606
|
...tr,
|
|
4528
4607
|
index: tr.index ?? i,
|
|
@@ -4534,7 +4613,7 @@ function runMultiNodeTransition(transitions, options = {}) {
|
|
|
4534
4613
|
}));
|
|
4535
4614
|
function frame() {
|
|
4536
4615
|
if (isCancelled) return;
|
|
4537
|
-
const now =
|
|
4616
|
+
const now = clock.now();
|
|
4538
4617
|
let allCompleted = true;
|
|
4539
4618
|
for (let i = 0; i < items.length; i++) {
|
|
4540
4619
|
const item = items[i];
|
|
@@ -4566,9 +4645,7 @@ function runMultiNodeTransition(transitions, options = {}) {
|
|
|
4566
4645
|
}
|
|
4567
4646
|
onUpdate?.();
|
|
4568
4647
|
if (!allCompleted) {
|
|
4569
|
-
|
|
4570
|
-
requestAnimationFrame(frame);
|
|
4571
|
-
}
|
|
4648
|
+
clock.frame().then(frame);
|
|
4572
4649
|
} else {
|
|
4573
4650
|
onComplete?.();
|
|
4574
4651
|
}
|
|
@@ -4846,10 +4923,76 @@ function repositionNodesTo(nodes, targetOrigin) {
|
|
|
4846
4923
|
}));
|
|
4847
4924
|
}
|
|
4848
4925
|
|
|
4926
|
+
// src/canvas/view.ts
|
|
4927
|
+
function clampHeight(contentHeight, options = {}) {
|
|
4928
|
+
const { min = 320, max = 560, padding = 48 } = options;
|
|
4929
|
+
return Math.round(Math.min(max, Math.max(min, contentHeight + padding)));
|
|
4930
|
+
}
|
|
4931
|
+
function layoutBounds(nodes) {
|
|
4932
|
+
if (nodes.length === 0) return null;
|
|
4933
|
+
let minX = Infinity;
|
|
4934
|
+
let minY = Infinity;
|
|
4935
|
+
let maxX = -Infinity;
|
|
4936
|
+
let maxY = -Infinity;
|
|
4937
|
+
for (const node of nodes) {
|
|
4938
|
+
const x = node.position.x;
|
|
4939
|
+
const y = node.position.y;
|
|
4940
|
+
const width = node.width ?? 180;
|
|
4941
|
+
const height = node.height ?? 80;
|
|
4942
|
+
minX = Math.min(minX, x);
|
|
4943
|
+
minY = Math.min(minY, y);
|
|
4944
|
+
maxX = Math.max(maxX, x + width);
|
|
4945
|
+
maxY = Math.max(maxY, y + height);
|
|
4946
|
+
}
|
|
4947
|
+
if (minX === Infinity) return null;
|
|
4948
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
4949
|
+
}
|
|
4950
|
+
function canvasHeight(nodes, options) {
|
|
4951
|
+
return clampHeight(layoutBounds(nodes)?.height ?? 0, options);
|
|
4952
|
+
}
|
|
4953
|
+
var DEFAULT_RANK_HEIGHT = 80 + 72;
|
|
4954
|
+
var NODES_PER_RANK = 2;
|
|
4955
|
+
function estimateCanvasHeight(nodes, edges, options) {
|
|
4956
|
+
const ranks = Math.max(1, Math.ceil(nodes.length / NODES_PER_RANK));
|
|
4957
|
+
return clampHeight(ranks * DEFAULT_RANK_HEIGHT, options);
|
|
4958
|
+
}
|
|
4959
|
+
function mix(a, b, t) {
|
|
4960
|
+
return a + (b - a) * t;
|
|
4961
|
+
}
|
|
4962
|
+
function blendLayout(from, to, t) {
|
|
4963
|
+
if (t >= 1) return to;
|
|
4964
|
+
const fromMap = new Map(from.map((n) => [n.id, n]));
|
|
4965
|
+
return to.map((target) => {
|
|
4966
|
+
const origin = fromMap.get(target.id);
|
|
4967
|
+
if (!origin) return target;
|
|
4968
|
+
return {
|
|
4969
|
+
...target,
|
|
4970
|
+
position: {
|
|
4971
|
+
x: mix(origin.position.x, target.position.x, t),
|
|
4972
|
+
y: mix(origin.position.y, target.position.y, t)
|
|
4973
|
+
},
|
|
4974
|
+
width: origin.width !== void 0 && target.width !== void 0 ? mix(origin.width, target.width, t) : target.width,
|
|
4975
|
+
height: origin.height !== void 0 && target.height !== void 0 ? mix(origin.height, target.height, t) : target.height
|
|
4976
|
+
};
|
|
4977
|
+
});
|
|
4978
|
+
}
|
|
4979
|
+
function connectedOnly(nodes, edges) {
|
|
4980
|
+
if (edges.length === 0) return nodes;
|
|
4981
|
+
const linkedNodeIds = /* @__PURE__ */ new Set();
|
|
4982
|
+
for (const edge of edges) {
|
|
4983
|
+
linkedNodeIds.add(edge.source);
|
|
4984
|
+
linkedNodeIds.add(edge.target);
|
|
4985
|
+
}
|
|
4986
|
+
const filtered = nodes.filter((node) => linkedNodeIds.has(node.id));
|
|
4987
|
+
return filtered.length > 0 ? filtered : nodes;
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4849
4990
|
// src/canvas/streaming.ts
|
|
4850
4991
|
var StreamingLayoutManager = class {
|
|
4851
4992
|
throttleMs;
|
|
4852
4993
|
glideDurationMs;
|
|
4994
|
+
connectedOnly;
|
|
4995
|
+
clock;
|
|
4853
4996
|
layoutOptions;
|
|
4854
4997
|
onLayoutUpdated;
|
|
4855
4998
|
pendingTimer = null;
|
|
@@ -4858,6 +5001,8 @@ var StreamingLayoutManager = class {
|
|
|
4858
5001
|
constructor(options = {}) {
|
|
4859
5002
|
this.throttleMs = options.throttleMs ?? 200;
|
|
4860
5003
|
this.glideDurationMs = options.glideDurationMs ?? 300;
|
|
5004
|
+
this.connectedOnly = options.connectedOnly ?? false;
|
|
5005
|
+
this.clock = options.clock ?? realClock;
|
|
4861
5006
|
this.layoutOptions = options.layoutOptions ?? { direction: "LR" };
|
|
4862
5007
|
this.onLayoutUpdated = options.onLayoutUpdated;
|
|
4863
5008
|
}
|
|
@@ -4885,7 +5030,8 @@ var StreamingLayoutManager = class {
|
|
|
4885
5030
|
this.recalculateAndGlide(nodes, edges, currentPositions);
|
|
4886
5031
|
}
|
|
4887
5032
|
recalculateAndGlide(nodes, edges, currentPositions) {
|
|
4888
|
-
|
|
5033
|
+
const targetNodes = this.connectedOnly ? connectedOnly(nodes, edges) : nodes;
|
|
5034
|
+
if (targetNodes.length === 0) return;
|
|
4889
5035
|
if (this.activeTransitionCancel) {
|
|
4890
5036
|
this.activeTransitionCancel();
|
|
4891
5037
|
this.activeTransitionCancel = null;
|
|
@@ -4894,7 +5040,7 @@ var StreamingLayoutManager = class {
|
|
|
4894
5040
|
for (const [id, pos] of currentPositions.entries()) {
|
|
4895
5041
|
stored[id] = pos;
|
|
4896
5042
|
}
|
|
4897
|
-
const layouted = ensureLayout(
|
|
5043
|
+
const layouted = ensureLayout(targetNodes, edges, {
|
|
4898
5044
|
...this.layoutOptions,
|
|
4899
5045
|
storedPositions: stored
|
|
4900
5046
|
});
|
|
@@ -4918,6 +5064,7 @@ var StreamingLayoutManager = class {
|
|
|
4918
5064
|
this.targetPositions = nextPositions;
|
|
4919
5065
|
if (transitions.length > 0) {
|
|
4920
5066
|
this.activeTransitionCancel = runMultiNodeTransition(transitions, {
|
|
5067
|
+
clock: this.clock,
|
|
4921
5068
|
onUpdate: () => {
|
|
4922
5069
|
const liveMap = new Map(currentPositions);
|
|
4923
5070
|
for (const trans of transitions) {
|
|
@@ -5125,6 +5272,24 @@ function planAgentCommand(command, snapshot, options = {}) {
|
|
|
5125
5272
|
}
|
|
5126
5273
|
];
|
|
5127
5274
|
}
|
|
5275
|
+
case "choreography:say": {
|
|
5276
|
+
return [
|
|
5277
|
+
{
|
|
5278
|
+
type: "step:say",
|
|
5279
|
+
text: command.text,
|
|
5280
|
+
atNodeId: command.atNodeId,
|
|
5281
|
+
position: command.position
|
|
5282
|
+
}
|
|
5283
|
+
];
|
|
5284
|
+
}
|
|
5285
|
+
case "choreography:wait": {
|
|
5286
|
+
return [
|
|
5287
|
+
{
|
|
5288
|
+
type: "step:wait",
|
|
5289
|
+
ms: command.ms
|
|
5290
|
+
}
|
|
5291
|
+
];
|
|
5292
|
+
}
|
|
5128
5293
|
default: {
|
|
5129
5294
|
return [];
|
|
5130
5295
|
}
|
|
@@ -5249,10 +5414,39 @@ var MCP_TOOL_EDIT_PROMPT = {
|
|
|
5249
5414
|
required: ["operation"]
|
|
5250
5415
|
}
|
|
5251
5416
|
};
|
|
5417
|
+
var MCP_TOOL_VIEW_EDITOR = {
|
|
5418
|
+
name: "view_editor",
|
|
5419
|
+
description: "Captures a visual image snapshot (JPEG or PNG) of the editor canvas or viewport for multimodal evaluation. Active agent cursor indicators are automatically excluded from the snapshot.",
|
|
5420
|
+
inputSchema: {
|
|
5421
|
+
type: "object",
|
|
5422
|
+
properties: {
|
|
5423
|
+
scope: {
|
|
5424
|
+
type: "string",
|
|
5425
|
+
enum: ["viewport", "canvas"],
|
|
5426
|
+
description: "Whether to capture only the visible viewport or the full canvas bounding box (default: viewport)."
|
|
5427
|
+
},
|
|
5428
|
+
format: {
|
|
5429
|
+
type: "string",
|
|
5430
|
+
enum: ["jpeg", "png"],
|
|
5431
|
+
description: "Image format of the base64 snapshot (default: jpeg)."
|
|
5432
|
+
},
|
|
5433
|
+
maxEdge: {
|
|
5434
|
+
type: "integer",
|
|
5435
|
+
description: "Maximum width or height dimension in pixels (default: 1024)."
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
};
|
|
5440
|
+
var EXPORT_EXCLUDED_SELECTORS = [
|
|
5441
|
+
".pixerate-presence",
|
|
5442
|
+
".agent-presence",
|
|
5443
|
+
".ursula-presence"
|
|
5444
|
+
];
|
|
5252
5445
|
var EDITOR_MCP_TOOLS = [
|
|
5253
5446
|
MCP_TOOL_GET_EDITOR_STATE,
|
|
5254
5447
|
MCP_TOOL_EDIT_CANVAS,
|
|
5255
|
-
MCP_TOOL_EDIT_PROMPT
|
|
5448
|
+
MCP_TOOL_EDIT_PROMPT,
|
|
5449
|
+
MCP_TOOL_VIEW_EDITOR
|
|
5256
5450
|
];
|
|
5257
5451
|
export {
|
|
5258
5452
|
ColorHighlighter,
|
|
@@ -5263,6 +5457,7 @@ export {
|
|
|
5263
5457
|
DependencyGraph,
|
|
5264
5458
|
DirtyTracker,
|
|
5265
5459
|
EDITOR_MCP_TOOLS,
|
|
5460
|
+
EXPORT_EXCLUDED_SELECTORS,
|
|
5266
5461
|
EditorController,
|
|
5267
5462
|
FontSize,
|
|
5268
5463
|
FormulaEvaluator,
|
|
@@ -5276,7 +5471,9 @@ export {
|
|
|
5276
5471
|
MCP_TOOL_EDIT_CANVAS,
|
|
5277
5472
|
MCP_TOOL_EDIT_PROMPT,
|
|
5278
5473
|
MCP_TOOL_GET_EDITOR_STATE,
|
|
5474
|
+
MCP_TOOL_VIEW_EDITOR,
|
|
5279
5475
|
MENTION_REGEX,
|
|
5476
|
+
ManualClock,
|
|
5280
5477
|
Markdown2 as Markdown,
|
|
5281
5478
|
Mention,
|
|
5282
5479
|
SlashCommands,
|
|
@@ -5286,13 +5483,16 @@ export {
|
|
|
5286
5483
|
TEMPLATE_REGEX,
|
|
5287
5484
|
TemplateSuggestions,
|
|
5288
5485
|
VARIABLE_REGEX,
|
|
5486
|
+
blendLayout,
|
|
5289
5487
|
boundsOf,
|
|
5290
5488
|
calculateDagreReflowDisplacement,
|
|
5291
5489
|
calculateDirectionalDisplacement,
|
|
5490
|
+
canvasHeight,
|
|
5292
5491
|
centerNodes,
|
|
5293
5492
|
centre,
|
|
5294
5493
|
colNameToIndex,
|
|
5295
5494
|
computeNodesBoundingBox,
|
|
5495
|
+
connectedOnly,
|
|
5296
5496
|
createBezierTrajectory,
|
|
5297
5497
|
createDirtyTracker,
|
|
5298
5498
|
createEditor,
|
|
@@ -5304,6 +5504,7 @@ export {
|
|
|
5304
5504
|
defaultIsEqual,
|
|
5305
5505
|
ensureLayout,
|
|
5306
5506
|
escapeHtml,
|
|
5507
|
+
estimateCanvasHeight,
|
|
5307
5508
|
estimateNodeSize,
|
|
5308
5509
|
extractCellDependencies,
|
|
5309
5510
|
extractInstructionNames,
|
|
@@ -5327,12 +5528,14 @@ export {
|
|
|
5327
5528
|
isEventFromTextInput,
|
|
5328
5529
|
isValidCanvasNode,
|
|
5329
5530
|
isValidUrl,
|
|
5531
|
+
layoutBounds,
|
|
5330
5532
|
linearPositionTrajectory,
|
|
5331
5533
|
linearTrajectory,
|
|
5332
5534
|
mapRawOffsetToResolved,
|
|
5333
5535
|
mapResolvedOffsetToRaw,
|
|
5334
5536
|
markdownToTipTapHtml,
|
|
5335
5537
|
overlaps,
|
|
5538
|
+
pageHidden,
|
|
5336
5539
|
parseCanvasClipboardData,
|
|
5337
5540
|
parseCellReference,
|
|
5338
5541
|
parseFormula,
|
|
@@ -5343,6 +5546,7 @@ export {
|
|
|
5343
5546
|
planAgentCommand,
|
|
5344
5547
|
preprocessMarkdownFileLinks,
|
|
5345
5548
|
preprocessMarkdownMentions,
|
|
5549
|
+
realClock,
|
|
5346
5550
|
remapPastedNodes,
|
|
5347
5551
|
removeImageNode,
|
|
5348
5552
|
repositionNodesTo,
|