@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/agent/planner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CanvasEdge, CanvasNode, Side } from
|
|
2
|
-
import type { AgentCommand, AgentStep, EditorSnapshot } from
|
|
1
|
+
import type { CanvasEdge, CanvasNode, Rect, Side } from "../canvas/types.js";
|
|
2
|
+
import type { AgentCommand, AgentStep, EditorSnapshot } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Normalizes a placement side from either the planner vocabulary (`right | below | left | above`)
|
|
5
5
|
* or the MCP tool schema vocabulary (`top | right | bottom | left`). Unknown values fall back to `right`.
|
|
@@ -14,6 +14,11 @@ export declare function planAgentCommand<TNode extends CanvasNode = CanvasNode,
|
|
|
14
14
|
height: number;
|
|
15
15
|
};
|
|
16
16
|
idGenerator?: () => string;
|
|
17
|
+
/**
|
|
18
|
+
* The visible part of the canvas (flow coordinates), or a getter for it. Unanchored new
|
|
19
|
+
* nodes go in free space at its centre instead of beside the last node.
|
|
20
|
+
*/
|
|
21
|
+
visibleRect?: Rect | null | (() => Rect | null | undefined);
|
|
17
22
|
}): AgentStep<TNode, TEdge>[];
|
|
18
23
|
/**
|
|
19
24
|
* Converts an MCP tool call into a planner command. `edit_canvas` /
|
|
@@ -65,7 +65,10 @@ export declare function createRichTextToolProvider(target: RichTextToolTarget, o
|
|
|
65
65
|
* `unmerge_cells` / `transpose_range` on an A1 range (not the user's
|
|
66
66
|
* selection), checked against merges and read-only cells first.
|
|
67
67
|
*/
|
|
68
|
-
export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions
|
|
68
|
+
export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions & {
|
|
69
|
+
/** The agent playback surface its calls are acted out on (default `spreadsheet`, where `SpreadsheetEditor` attaches). */
|
|
70
|
+
playbackSurface?: string;
|
|
71
|
+
}): AgentToolProvider;
|
|
69
72
|
export interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> extends ToolProviderOptions {
|
|
70
73
|
/** Current editor / canvas state. */
|
|
71
74
|
getSnapshot: () => EditorSnapshot<TNode, TEdge>;
|
|
@@ -65,7 +65,10 @@ export declare function createRichTextToolProvider(target: RichTextToolTarget, o
|
|
|
65
65
|
* `unmerge_cells` / `transpose_range` on an A1 range (not the user's
|
|
66
66
|
* selection), checked against merges and read-only cells first.
|
|
67
67
|
*/
|
|
68
|
-
export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions
|
|
68
|
+
export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions & {
|
|
69
|
+
/** The agent playback surface its calls are acted out on (default `spreadsheet`, where `SpreadsheetEditor` attaches). */
|
|
70
|
+
playbackSurface?: string;
|
|
71
|
+
}): AgentToolProvider;
|
|
69
72
|
export interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> extends ToolProviderOptions {
|
|
70
73
|
/** Current editor / canvas state. */
|
|
71
74
|
getSnapshot: () => EditorSnapshot<TNode, TEdge>;
|
|
@@ -3972,6 +3972,54 @@ var AnimationEditorController = (_class = class {
|
|
|
3972
3972
|
}
|
|
3973
3973
|
}, _class);
|
|
3974
3974
|
|
|
3975
|
+
// src/animation-editor/playback.ts
|
|
3976
|
+
var str = (v) => typeof v === "string" && v.length > 0;
|
|
3977
|
+
function elementsOf(args) {
|
|
3978
|
+
const out = [];
|
|
3979
|
+
const add = (v) => str(v) && !out.includes(v) && out.push(v);
|
|
3980
|
+
const fromCommand = (c) => {
|
|
3981
|
+
if (!c || typeof c !== "object") return;
|
|
3982
|
+
const t = _nullishCoalesce(c.targets, () => ( c.target));
|
|
3983
|
+
if (Array.isArray(t)) t.forEach(add);
|
|
3984
|
+
else add(t);
|
|
3985
|
+
};
|
|
3986
|
+
fromCommand(args);
|
|
3987
|
+
fromCommand(args.command);
|
|
3988
|
+
if (Array.isArray(args.commands)) args.commands.forEach(fromCommand);
|
|
3989
|
+
const fromShot = (s) => {
|
|
3990
|
+
if (!s || typeof s !== "object") return;
|
|
3991
|
+
for (const key of ["run", "commands"]) {
|
|
3992
|
+
const list = s[key];
|
|
3993
|
+
if (Array.isArray(list)) list.forEach(fromCommand);
|
|
3994
|
+
}
|
|
3995
|
+
};
|
|
3996
|
+
if (Array.isArray(args.run)) args.run.forEach(fromCommand);
|
|
3997
|
+
if (Array.isArray(args.shots)) args.shots.forEach(fromShot);
|
|
3998
|
+
if (Array.isArray(args.ops)) {
|
|
3999
|
+
for (const op of args.ops) {
|
|
4000
|
+
fromShot(op);
|
|
4001
|
+
if (Array.isArray(_optionalChain([op, 'optionalAccess', _160 => _160.shots]))) op.shots.forEach(fromShot);
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
4004
|
+
return out.slice(0, 4);
|
|
4005
|
+
}
|
|
4006
|
+
function planAnimationToolPlayback(tool, args) {
|
|
4007
|
+
const steps = [];
|
|
4008
|
+
const shot = str(args.shot) ? args.shot : str(args.id) && /shot/.test(tool) ? args.id : null;
|
|
4009
|
+
if (shot) steps.push({ type: "target", ref: { kind: "shot", id: shot } }, { type: "press" }, { type: "release" });
|
|
4010
|
+
for (const id of elementsOf(args)) steps.push({ type: "target", ref: { kind: "element", id } });
|
|
4011
|
+
return steps.length ? steps : null;
|
|
4012
|
+
}
|
|
4013
|
+
function withAnimationPlayback(provider, surface = "animation") {
|
|
4014
|
+
const plan = (tool) => tool.plan || tool.playback !== void 0 ? tool : { ...tool, plan: (args) => planAnimationToolPlayback(tool.name, args) };
|
|
4015
|
+
const tools = provider.tools;
|
|
4016
|
+
return {
|
|
4017
|
+
...provider,
|
|
4018
|
+
playbackSurface: _nullishCoalesce(provider.playbackSurface, () => ( surface)),
|
|
4019
|
+
tools: typeof tools === "function" ? () => tools().map(plan) : tools.map(plan)
|
|
4020
|
+
};
|
|
4021
|
+
}
|
|
4022
|
+
|
|
3975
4023
|
// src/animation-editor/tools.ts
|
|
3976
4024
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
3977
4025
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
@@ -4132,7 +4180,7 @@ var MOTION_COMMAND_SCHEMA = {
|
|
|
4132
4180
|
oneOf: MOTION_COMMAND_TYPES.map((type) => MOTION_COMMAND_TYPE_SCHEMAS[type])
|
|
4133
4181
|
};
|
|
4134
4182
|
var REF2 = (name, description) => ({ $ref: `#/$defs/${name}`, ...description ? { description } : {} });
|
|
4135
|
-
var firstSentence = (text) => _nullishCoalesce(_optionalChain([/^.*?[.;](?=\s|$)/, 'access',
|
|
4183
|
+
var firstSentence = (text) => _nullishCoalesce(_optionalChain([/^.*?[.;](?=\s|$)/, 'access', _161 => _161.exec, 'call', _162 => _162(text), 'optionalAccess', _163 => _163[0]]), () => ( text));
|
|
4136
4184
|
var COMMAND_TYPE_LINES = MOTION_COMMAND_TYPES.map((type) => `${type}: ${firstSentence(_nullishCoalesce(MOTION_COMMAND_TYPE_SCHEMAS[type].description, () => ( "")))}`);
|
|
4137
4185
|
var EASE_COMPACT = {
|
|
4138
4186
|
description: `Easing: a preset, or a curve { "type": "cubic-bezier", x1, y1, x2, y2 }, { "type": "spring", stiffness, damping, mass, velocity } (spring presets are Figma's; with no "duration" it lasts until it settles) or { "type": "elastic", amplitude, period, mode }. Default: ease-out for entrances, ease-in-out for moves.`,
|
|
@@ -4540,9 +4588,9 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
4540
4588
|
handler: ({ from = 0, to, limit = 200 }) => {
|
|
4541
4589
|
const s = scene();
|
|
4542
4590
|
const timeline = compileMotionScene(s);
|
|
4543
|
-
const words = _nullishCoalesce(_optionalChain([s, 'access',
|
|
4591
|
+
const words = _nullishCoalesce(_optionalChain([s, 'access', _164 => _164.narration, 'optionalAccess', _165 => _165.words]), () => ( []));
|
|
4544
4592
|
const end = _nullishCoalesce(to, () => ( Math.max(timeline.duration, words.length ? _nullishCoalesce(words[words.length - 1].end, () => ( words[words.length - 1].start)) : 0)));
|
|
4545
|
-
const shotAt = (ms) => _optionalChain([timeline, 'access',
|
|
4593
|
+
const shotAt = (ms) => _optionalChain([timeline, 'access', _166 => _166.shots, 'access', _167 => _167.find, 'call', _168 => _168((x) => ms >= x.start && ms < x.end), 'optionalAccess', _169 => _169.id]);
|
|
4546
4594
|
const beats = [];
|
|
4547
4595
|
if (s.beat && s.beat.bpm > 0) {
|
|
4548
4596
|
const first = Math.max(0, Math.ceil(motionBeatAt(s.beat, from).beat - 1e-9));
|
|
@@ -4864,7 +4912,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
4864
4912
|
inputSchema: object({ shot: SHOT_ID, commands: { type: "array", items: REF2("command"), minItems: 1, description: "Commands to add." }, at: { type: "integer", minimum: 0, description: "Index in the run (default: the end)." } }, ["shot", "commands"]),
|
|
4865
4913
|
annotations: { title: "Add commands to a shot", ...WRITE },
|
|
4866
4914
|
handler: ({ shot, commands, at }) => {
|
|
4867
|
-
const before = _nullishCoalesce(_optionalChain([scene, 'call',
|
|
4915
|
+
const before = _nullishCoalesce(_optionalChain([scene, 'call', _170 => _170(), 'access', _171 => _171.shots, 'access', _172 => _172.find, 'call', _173 => _173((s) => s.id === shot), 'optionalAccess', _174 => _174.run, 'access', _175 => _175.length]), () => ( 0));
|
|
4868
4916
|
const first = _nullishCoalesce(at, () => ( before));
|
|
4869
4917
|
return apply({ op: "add_commands", shot, commands, at }, "Add commands", (s) => {
|
|
4870
4918
|
const shots = describeMotionShots(s);
|
|
@@ -4998,7 +5046,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
4998
5046
|
const finish = (tools) => tools.map((tool) => ({ ...tool, inputSchema: withDefs(tool.inputSchema) }));
|
|
4999
5047
|
const reads = finish([getAnimation, getShot, describeCommand, findElements, getTextLayout, getMotionPath, getTimingGrid, checkAnimation, renderFrame, exportFlairMotion, exportFlairEffect, exportLottie, seekAnimation]);
|
|
5000
5048
|
const writes = finish([setArtworkSvg, importPptx, setDrivers, setClip, copyAnimation, fitAnimation, importFlairEffect, insertShots, updateShot, deleteShots, moveShot, addCommands, updateCommand, deleteCommands, moveCommand, setSettings, setControls, editAnimation, writeAnimation, undo, redo]);
|
|
5001
|
-
return {
|
|
5049
|
+
return withAnimationPlayback({
|
|
5002
5050
|
id: _nullishCoalesce(options.id, () => ( "animation")),
|
|
5003
5051
|
namespace: options.namespace,
|
|
5004
5052
|
title: "Animation editor",
|
|
@@ -5015,7 +5063,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
5015
5063
|
}
|
|
5016
5064
|
});
|
|
5017
5065
|
}
|
|
5018
|
-
};
|
|
5066
|
+
});
|
|
5019
5067
|
}
|
|
5020
5068
|
|
|
5021
5069
|
// src/animation-editor/instructions.ts
|
|
@@ -5065,7 +5113,7 @@ var TIMING = /* @__PURE__ */ new Set(["duration", "delay", "stagger", "with", "e
|
|
|
5065
5113
|
var COLORS = /* @__PURE__ */ new Set(["fill", "stroke", "color"]);
|
|
5066
5114
|
var NODES = /* @__PURE__ */ new Set(["into", "path"]);
|
|
5067
5115
|
function branch(type) {
|
|
5068
|
-
return (_nullishCoalesce(MOTION_COMMAND_SCHEMA.oneOf, () => ( []))).find((b) => _optionalChain([b, 'access',
|
|
5116
|
+
return (_nullishCoalesce(MOTION_COMMAND_SCHEMA.oneOf, () => ( []))).find((b) => _optionalChain([b, 'access', _176 => _176.properties, 'optionalAccess', _177 => _177.type, 'optionalAccess', _178 => _178.const]) === type);
|
|
5069
5117
|
}
|
|
5070
5118
|
function unitOf(type, name) {
|
|
5071
5119
|
if (name === "duration" || name === "delay" || name === "stagger") return "ms";
|
|
@@ -5100,7 +5148,7 @@ function kindOf(name, schema) {
|
|
|
5100
5148
|
}
|
|
5101
5149
|
function motionCommandFields(type) {
|
|
5102
5150
|
const schema = branch(type);
|
|
5103
|
-
if (!_optionalChain([schema, 'optionalAccess',
|
|
5151
|
+
if (!_optionalChain([schema, 'optionalAccess', _179 => _179.properties])) return [];
|
|
5104
5152
|
const required = new Set(_nullishCoalesce(schema.required, () => ( [])));
|
|
5105
5153
|
const fields = Object.entries(schema.properties).filter(([name]) => name !== "type").map(([name, s]) => {
|
|
5106
5154
|
const kind = kindOf(name, s);
|
|
@@ -5157,7 +5205,7 @@ function defaultMotionCommand(type, targets, scene) {
|
|
|
5157
5205
|
if (type === "wait") return { type: "wait", duration: 500 };
|
|
5158
5206
|
if (!targets.length) return { error: "Pick a target first: click an element on the stage." };
|
|
5159
5207
|
const nodes = [...indexMotionNodes(scene.artwork.nodes).values()];
|
|
5160
|
-
const other = (pred) => _optionalChain([nodes, 'access',
|
|
5208
|
+
const other = (pred) => _optionalChain([nodes, 'access', _180 => _180.find, 'call', _181 => _181((e) => !targets.includes(e.node.id) && pred(e)), 'optionalAccess', _182 => _182.node, 'access', _183 => _183.id]);
|
|
5161
5209
|
const base = { targets: [...targets] };
|
|
5162
5210
|
switch (type) {
|
|
5163
5211
|
case "scale":
|
|
@@ -5188,8 +5236,8 @@ function defaultMotionCommand(type, targets, scene) {
|
|
|
5188
5236
|
}
|
|
5189
5237
|
case "effect": {
|
|
5190
5238
|
for (const id of targets) {
|
|
5191
|
-
const node = _optionalChain([nodes, 'access',
|
|
5192
|
-
for (const effect of _nullishCoalesce(_optionalChain([node, 'optionalAccess',
|
|
5239
|
+
const node = _optionalChain([nodes, 'access', _184 => _184.find, 'call', _185 => _185((e) => e.node.id === id), 'optionalAccess', _186 => _186.node]);
|
|
5240
|
+
for (const effect of _nullishCoalesce(_optionalChain([node, 'optionalAccess', _187 => _187.effects]), () => ( []))) {
|
|
5193
5241
|
const param = Object.entries(effect.params).find(([, v]) => typeof v === "number");
|
|
5194
5242
|
if (param) return { type, ...base, effect: effect.id, param: param[0], to: param[1] + 1 };
|
|
5195
5243
|
}
|
|
@@ -5214,11 +5262,11 @@ function motionCommandRows(scene, shotId) {
|
|
|
5214
5262
|
return scene.shots[index].run.map((command3, i) => {
|
|
5215
5263
|
const t = timeline.commands.find((c) => c.shotIndex === index && c.command === i);
|
|
5216
5264
|
const primitive = motionFlairPrimitive(command3);
|
|
5217
|
-
return { index: i, command: command3, summary: motionCommandSummary(command3), start: _nullishCoalesce(_optionalChain([t, 'optionalAccess',
|
|
5265
|
+
return { index: i, command: command3, summary: motionCommandSummary(command3), start: _nullishCoalesce(_optionalChain([t, 'optionalAccess', _188 => _188.start]), () => ( 0)), end: _nullishCoalesce(_optionalChain([t, 'optionalAccess', _189 => _189.end]), () => ( 0)), ...primitive ? { flairPrimitive: primitive } : {} };
|
|
5218
5266
|
});
|
|
5219
5267
|
}
|
|
5220
5268
|
function duplicateMotionCommandEdit(scene, shot, command3) {
|
|
5221
|
-
const run = _nullishCoalesce(_optionalChain([scene, 'access',
|
|
5269
|
+
const run = _nullishCoalesce(_optionalChain([scene, 'access', _190 => _190.shots, 'access', _191 => _191.find, 'call', _192 => _192((s) => s.id === shot), 'optionalAccess', _193 => _193.run]), () => ( []));
|
|
5222
5270
|
return { op: "add_commands", shot, commands: run[command3] ? [structuredClone(run[command3])] : [], at: command3 + 1 };
|
|
5223
5271
|
}
|
|
5224
5272
|
var MOTION_EASE_CHOICES = [
|
|
@@ -5303,7 +5351,7 @@ function motionCueFromKey(key) {
|
|
|
5303
5351
|
function motionCueChoices(scene, limit = 256) {
|
|
5304
5352
|
const choices = [];
|
|
5305
5353
|
const s = (ms) => `${(ms / 1e3).toFixed(2)} s`;
|
|
5306
|
-
const end = Math.max(compileMotionScene(scene).duration, ..._nullishCoalesce(_optionalChain([scene, 'access',
|
|
5354
|
+
const end = Math.max(compileMotionScene(scene).duration, ..._nullishCoalesce(_optionalChain([scene, 'access', _194 => _194.narration, 'optionalAccess', _195 => _195.words, 'access', _196 => _196.map, 'call', _197 => _197((w) => _nullishCoalesce(w.end, () => ( w.start)))]), () => ( [0]))) + 2e3;
|
|
5307
5355
|
if (scene.beat && scene.beat.bpm > 0) {
|
|
5308
5356
|
for (let beat = 0; choices.length < limit; beat++) {
|
|
5309
5357
|
const time = motionBeatTime(scene.beat, beat);
|
|
@@ -5313,7 +5361,7 @@ function motionCueChoices(scene, limit = 256) {
|
|
|
5313
5361
|
choices.push({ value: `beat:${beat}`, label: `Beat ${beat} (bar ${at.bar}.${at.beatInBar}) \xB7 ${s(time)}`, time });
|
|
5314
5362
|
}
|
|
5315
5363
|
}
|
|
5316
|
-
_optionalChain([scene, 'access',
|
|
5364
|
+
_optionalChain([scene, 'access', _198 => _198.narration, 'optionalAccess', _199 => _199.words, 'access', _200 => _200.forEach, 'call', _201 => _201((w, i) => {
|
|
5317
5365
|
if (choices.length < limit * 2) choices.push({ value: `word:${i}`, label: `Word ${i} \u201C${w.text}\u201D \xB7 ${s(w.start)}`, time: w.start });
|
|
5318
5366
|
})]);
|
|
5319
5367
|
return choices;
|
|
@@ -5322,7 +5370,7 @@ function motionShotCueTime(scene, cue) {
|
|
|
5322
5370
|
return cue ? motionCueTime(scene, cue) : void 0;
|
|
5323
5371
|
}
|
|
5324
5372
|
function formatMotionNarration(narration) {
|
|
5325
|
-
return (_nullishCoalesce(_optionalChain([narration, 'optionalAccess',
|
|
5373
|
+
return (_nullishCoalesce(_optionalChain([narration, 'optionalAccess', _202 => _202.words]), () => ( []))).map((w) => `${w.start} ${w.text}`).join("\n");
|
|
5326
5374
|
}
|
|
5327
5375
|
function parseMotionNarration(text) {
|
|
5328
5376
|
const lines = text.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
@@ -5371,7 +5419,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5371
5419
|
if (!r.ok) throw new Error(r.error);
|
|
5372
5420
|
return { target, effect: info(r.effect), effects: controller.appliedEffects().filter((e) => e.targets.includes(target)).map(info), ...r.notes.length ? { notes: r.notes } : {} };
|
|
5373
5421
|
};
|
|
5374
|
-
return _chunkRUZQMYXHcjs.createEffectToolProvider.call(void 0, {
|
|
5422
|
+
return withAnimationPlayback(_chunkRUZQMYXHcjs.createEffectToolProvider.call(void 0, {
|
|
5375
5423
|
id: _nullishCoalesce(options.id, () => ( "animation-effects")),
|
|
5376
5424
|
namespace: options.namespace,
|
|
5377
5425
|
title: "Animation effects",
|
|
@@ -5438,7 +5486,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5438
5486
|
}
|
|
5439
5487
|
}
|
|
5440
5488
|
]
|
|
5441
|
-
});
|
|
5489
|
+
}));
|
|
5442
5490
|
}
|
|
5443
5491
|
|
|
5444
5492
|
|
|
@@ -5593,4 +5641,6 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5593
5641
|
|
|
5594
5642
|
|
|
5595
5643
|
|
|
5596
|
-
|
|
5644
|
+
|
|
5645
|
+
|
|
5646
|
+
exports.ANIMATION_EDITOR_AGENT_INSTRUCTIONS = ANIMATION_EDITOR_AGENT_INSTRUCTIONS; exports.AnimationEditorController = AnimationEditorController; exports.FLAIR_EASES = FLAIR_EASES; exports.FLAIR_EXPORT_VERSION = FLAIR_EXPORT_VERSION; exports.MOTION_ADDITIVE_PROPERTIES = MOTION_ADDITIVE_PROPERTIES; exports.MOTION_BLENDS = MOTION_BLENDS; exports.MOTION_CAMERA_MS = MOTION_CAMERA_MS; exports.MOTION_CASCADES = MOTION_CASCADES; exports.MOTION_CLIP_TARGET = MOTION_CLIP_TARGET; exports.MOTION_COMMAND_FIELDS = MOTION_COMMAND_FIELDS; exports.MOTION_COMMAND_SCHEMA = MOTION_COMMAND_SCHEMA; exports.MOTION_COMMAND_TYPES = MOTION_COMMAND_TYPES; exports.MOTION_COMMAND_TYPE_SCHEMAS = MOTION_COMMAND_TYPE_SCHEMAS; exports.MOTION_DEFAULT_DURATIONS = MOTION_DEFAULT_DURATIONS; exports.MOTION_DEFAULT_HOLD = MOTION_DEFAULT_HOLD; exports.MOTION_DIRECTIONS = MOTION_DIRECTIONS; exports.MOTION_DRAW_EFFECT_ID = MOTION_DRAW_EFFECT_ID; exports.MOTION_DRAW_MS_PER_UNIT = MOTION_DRAW_MS_PER_UNIT; exports.MOTION_DRAW_RANGE = MOTION_DRAW_RANGE; exports.MOTION_DRIVEN_PROPERTIES = MOTION_DRIVEN_PROPERTIES; exports.MOTION_EASE_CHOICES = MOTION_EASE_CHOICES; exports.MOTION_EASE_IN_OUT = MOTION_EASE_IN_OUT; exports.MOTION_EASE_OUT = MOTION_EASE_OUT; exports.MOTION_EDIT_OPS = MOTION_EDIT_OPS; exports.MOTION_ENTER_STYLES = MOTION_ENTER_STYLES; exports.MOTION_EXIT_STYLES = MOTION_EXIT_STYLES; exports.MOTION_IRIS_SHAPES = MOTION_IRIS_SHAPES; exports.MOTION_ISSUE_CODES = _chunkEBDZWIOPcjs.MOTION_ISSUE_CODES; exports.MOTION_MIN_CHANGE_MS = MOTION_MIN_CHANGE_MS; exports.MOTION_REPEAT_MODES = MOTION_REPEAT_MODES; exports.MOTION_SPEED_RANGE = MOTION_SPEED_RANGE; exports.MOTION_SPLIT_ORIENTATIONS = MOTION_SPLIT_ORIENTATIONS; exports.MOTION_TEXT_STAGGER = MOTION_TEXT_STAGGER; exports.MOTION_TEXT_UNITS = MOTION_TEXT_UNITS; exports.MOTION_TRIGGERS = MOTION_TRIGGERS; exports.MotionSceneFormatError = MotionSceneFormatError; exports.activeSegment = activeSegment; exports.applyMotionControlValues = applyMotionControlValues; exports.applyMotionDrivers = applyMotionDrivers; exports.applyMotionEdits = applyMotionEdits; exports.checkMotionScene = checkMotionScene; exports.clipsShapeProblems = clipsShapeProblems; exports.commandShapeProblems = commandShapeProblems; exports.compileMotionScene = compileMotionScene; exports.createAnimationEditorToolProvider = createAnimationEditorToolProvider; exports.createAnimationEffectsToolProvider = createAnimationEffectsToolProvider; exports.createMotionScene = createMotionScene; exports.defaultMotionCommand = defaultMotionCommand; exports.describeMotionElements = describeMotionElements; exports.describeMotionShots = describeMotionShots; exports.driversShapeProblems = driversShapeProblems; exports.duplicateMotionCommandEdit = duplicateMotionCommandEdit; exports.fitMotionRect = fitMotionRect; exports.fitMotionScene = fitMotionScene; exports.fitMotionSceneEdits = fitMotionSceneEdits; exports.flairAtLeast = flairAtLeast; exports.flairCurveFor = flairCurveFor; exports.flairEaseFor = flairEaseFor; exports.formatMotionDrivers = formatMotionDrivers; exports.formatMotionNarration = formatMotionNarration; exports.freshShotId = freshShotId; exports.fromFlairSvgMotion = fromFlairSvgMotion; exports.fromFlairVectorEffect = fromFlairVectorEffect; exports.fromPptxAnimation = fromPptxAnimation; exports.highlightMotionSvg = highlightMotionSvg; exports.indexMotionNodes = indexMotionNodes; exports.interpolateMotionValue = interpolateMotionValue; exports.isMotionCommand = isMotionCommand; exports.isMotionShot = isMotionShot; exports.matchMotionNodes = matchMotionNodes; exports.motionAddTrackKey = motionAddTrackKey; exports.motionArtworkSvg = motionArtworkSvg; exports.motionBeatAt = motionBeatAt; exports.motionBeatTime = motionBeatTime; exports.motionBlurTimes = motionBlurTimes; exports.motionCascade = motionCascade; exports.motionClipAttrs = motionClipAttrs; exports.motionClipLayout = motionClipLayout; exports.motionCommandDuration = motionCommandDuration; exports.motionCommandFields = motionCommandFields; exports.motionCommandRepeat = motionCommandRepeat; exports.motionCommandRows = motionCommandRows; exports.motionCommandSlots = motionCommandSlots; exports.motionCommandSummary = motionCommandSummary; exports.motionCommandsFromEffect = motionCommandsFromEffect; exports.motionContactSheetSvg = motionContactSheetSvg; exports.motionCueChoices = motionCueChoices; exports.motionCueFromKey = motionCueFromKey; exports.motionCueKey = motionCueKey; exports.motionCueTime = motionCueTime; exports.motionCycleDuration = motionCycleDuration; exports.motionDrivenNodes = motionDrivenNodes; exports.motionDriverSources = motionDriverSources; exports.motionEaseKey = motionEaseKey; exports.motionEasingCurve = motionEasingCurve; exports.motionEasingGuides = motionEasingGuides; exports.motionEasingPath = motionEasingPath; exports.motionFieldEdit = motionFieldEdit; exports.motionFieldLabel = motionFieldLabel; exports.motionFlairPrimitive = motionFlairPrimitive; exports.motionFollowRoute = motionFollowRoute; exports.motionFrameAt = motionFrameAt; exports.motionFrameToSvg = motionFrameToSvg; exports.motionGhosts = motionGhosts; exports.motionIssue = _chunkEBDZWIOPcjs.motionIssue; exports.motionIssueKey = _chunkEBDZWIOPcjs.motionIssueKey; exports.motionIssueLine = _chunkEBDZWIOPcjs.motionIssueLine; exports.motionMovingIds = motionMovingIds; exports.motionNodeAtElement = motionNodeAtElement; exports.motionNodeClips = motionNodeClips; exports.motionNodeOffset = motionNodeOffset; exports.motionPartsFromVectorEffect = motionPartsFromVectorEffect; exports.motionPath = motionPath; exports.motionPathLength = motionPathLength; exports.motionPathsSvg = motionPathsSvg; exports.motionPropertyValue = motionPropertyValue; exports.motionRestValue = motionRestValue; exports.motionRevealClip = motionRevealClip; exports.motionRevealPadding = motionRevealPadding; exports.motionRulerTicks = motionRulerTicks; exports.motionSceneEffects = motionSceneEffects; exports.motionSceneShapeProblems = motionSceneShapeProblems; exports.motionSceneToJson = motionSceneToJson; exports.motionShotAt = motionShotAt; exports.motionShotCueTime = motionShotCueTime; exports.motionShotTimeScale = motionShotTimeScale; exports.motionStageSvg = motionStageSvg; exports.motionTextLayout = motionTextLayout; exports.motionTextUnits = motionTextUnits; exports.motionTrackKey = motionTrackKey; exports.namedWithSuggestion = _chunkEBDZWIOPcjs.namedWithSuggestion; exports.nextMotionEffectInstance = nextMotionEffectInstance; exports.parseMotionDrivers = parseMotionDrivers; exports.parseMotionFieldInput = parseMotionFieldInput; exports.parseMotionNarration = parseMotionNarration; exports.parseMotionScene = parseMotionScene; exports.planAnimationToolPlayback = planAnimationToolPlayback; exports.resolveMotionCamera = resolveMotionCamera; exports.resolveMotionEditRefs = resolveMotionEditRefs; exports.segmentProgress = segmentProgress; exports.segmentValue = segmentValue; exports.shotShapeProblems = shotShapeProblems; exports.smoothMotionLegs = smoothMotionLegs; exports.smoothMotionTimes = smoothMotionTimes; exports.suggestName = _chunkEBDZWIOPcjs.suggestName; exports.toFlairEffectDocument = toFlairEffectDocument; exports.toFlairSvgMotion = toFlairSvgMotion; exports.toFlairVectorEffect = toFlairVectorEffect; exports.toLottie = toLottie; exports.trackValue = trackValue; exports.withAnimationPlayback = withAnimationPlayback; exports.withMotionLayers = withMotionLayers; exports.withViewBox = withViewBox; exports.withoutMotionEffect = withoutMotionEffect;
|
|
@@ -3972,6 +3972,54 @@ var AnimationEditorController = class {
|
|
|
3972
3972
|
}
|
|
3973
3973
|
};
|
|
3974
3974
|
|
|
3975
|
+
// src/animation-editor/playback.ts
|
|
3976
|
+
var str = (v) => typeof v === "string" && v.length > 0;
|
|
3977
|
+
function elementsOf(args) {
|
|
3978
|
+
const out = [];
|
|
3979
|
+
const add = (v) => str(v) && !out.includes(v) && out.push(v);
|
|
3980
|
+
const fromCommand = (c) => {
|
|
3981
|
+
if (!c || typeof c !== "object") return;
|
|
3982
|
+
const t = c.targets ?? c.target;
|
|
3983
|
+
if (Array.isArray(t)) t.forEach(add);
|
|
3984
|
+
else add(t);
|
|
3985
|
+
};
|
|
3986
|
+
fromCommand(args);
|
|
3987
|
+
fromCommand(args.command);
|
|
3988
|
+
if (Array.isArray(args.commands)) args.commands.forEach(fromCommand);
|
|
3989
|
+
const fromShot = (s) => {
|
|
3990
|
+
if (!s || typeof s !== "object") return;
|
|
3991
|
+
for (const key of ["run", "commands"]) {
|
|
3992
|
+
const list = s[key];
|
|
3993
|
+
if (Array.isArray(list)) list.forEach(fromCommand);
|
|
3994
|
+
}
|
|
3995
|
+
};
|
|
3996
|
+
if (Array.isArray(args.run)) args.run.forEach(fromCommand);
|
|
3997
|
+
if (Array.isArray(args.shots)) args.shots.forEach(fromShot);
|
|
3998
|
+
if (Array.isArray(args.ops)) {
|
|
3999
|
+
for (const op of args.ops) {
|
|
4000
|
+
fromShot(op);
|
|
4001
|
+
if (Array.isArray(op?.shots)) op.shots.forEach(fromShot);
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
4004
|
+
return out.slice(0, 4);
|
|
4005
|
+
}
|
|
4006
|
+
function planAnimationToolPlayback(tool, args) {
|
|
4007
|
+
const steps = [];
|
|
4008
|
+
const shot = str(args.shot) ? args.shot : str(args.id) && /shot/.test(tool) ? args.id : null;
|
|
4009
|
+
if (shot) steps.push({ type: "target", ref: { kind: "shot", id: shot } }, { type: "press" }, { type: "release" });
|
|
4010
|
+
for (const id of elementsOf(args)) steps.push({ type: "target", ref: { kind: "element", id } });
|
|
4011
|
+
return steps.length ? steps : null;
|
|
4012
|
+
}
|
|
4013
|
+
function withAnimationPlayback(provider, surface = "animation") {
|
|
4014
|
+
const plan = (tool) => tool.plan || tool.playback !== void 0 ? tool : { ...tool, plan: (args) => planAnimationToolPlayback(tool.name, args) };
|
|
4015
|
+
const tools = provider.tools;
|
|
4016
|
+
return {
|
|
4017
|
+
...provider,
|
|
4018
|
+
playbackSurface: provider.playbackSurface ?? surface,
|
|
4019
|
+
tools: typeof tools === "function" ? () => tools().map(plan) : tools.map(plan)
|
|
4020
|
+
};
|
|
4021
|
+
}
|
|
4022
|
+
|
|
3975
4023
|
// src/animation-editor/tools.ts
|
|
3976
4024
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
3977
4025
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
@@ -4998,7 +5046,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
4998
5046
|
const finish = (tools) => tools.map((tool) => ({ ...tool, inputSchema: withDefs(tool.inputSchema) }));
|
|
4999
5047
|
const reads = finish([getAnimation, getShot, describeCommand, findElements, getTextLayout, getMotionPath, getTimingGrid, checkAnimation, renderFrame, exportFlairMotion, exportFlairEffect, exportLottie, seekAnimation]);
|
|
5000
5048
|
const writes = finish([setArtworkSvg, importPptx, setDrivers, setClip, copyAnimation, fitAnimation, importFlairEffect, insertShots, updateShot, deleteShots, moveShot, addCommands, updateCommand, deleteCommands, moveCommand, setSettings, setControls, editAnimation, writeAnimation, undo, redo]);
|
|
5001
|
-
return {
|
|
5049
|
+
return withAnimationPlayback({
|
|
5002
5050
|
id: options.id ?? "animation",
|
|
5003
5051
|
namespace: options.namespace,
|
|
5004
5052
|
title: "Animation editor",
|
|
@@ -5015,7 +5063,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
5015
5063
|
}
|
|
5016
5064
|
});
|
|
5017
5065
|
}
|
|
5018
|
-
};
|
|
5066
|
+
});
|
|
5019
5067
|
}
|
|
5020
5068
|
|
|
5021
5069
|
// src/animation-editor/instructions.ts
|
|
@@ -5371,7 +5419,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5371
5419
|
if (!r.ok) throw new Error(r.error);
|
|
5372
5420
|
return { target, effect: info(r.effect), effects: controller.appliedEffects().filter((e) => e.targets.includes(target)).map(info), ...r.notes.length ? { notes: r.notes } : {} };
|
|
5373
5421
|
};
|
|
5374
|
-
return createEffectToolProvider({
|
|
5422
|
+
return withAnimationPlayback(createEffectToolProvider({
|
|
5375
5423
|
id: options.id ?? "animation-effects",
|
|
5376
5424
|
namespace: options.namespace,
|
|
5377
5425
|
title: "Animation effects",
|
|
@@ -5438,7 +5486,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5438
5486
|
}
|
|
5439
5487
|
}
|
|
5440
5488
|
]
|
|
5441
|
-
});
|
|
5489
|
+
}));
|
|
5442
5490
|
}
|
|
5443
5491
|
export {
|
|
5444
5492
|
ANIMATION_EDITOR_AGENT_INSTRUCTIONS,
|
|
@@ -5577,6 +5625,7 @@ export {
|
|
|
5577
5625
|
parseMotionFieldInput,
|
|
5578
5626
|
parseMotionNarration,
|
|
5579
5627
|
parseMotionScene,
|
|
5628
|
+
planAnimationToolPlayback,
|
|
5580
5629
|
resolveMotionCamera,
|
|
5581
5630
|
resolveMotionEditRefs,
|
|
5582
5631
|
segmentProgress,
|
|
@@ -5590,6 +5639,7 @@ export {
|
|
|
5590
5639
|
toFlairVectorEffect,
|
|
5591
5640
|
toLottie,
|
|
5592
5641
|
trackValue,
|
|
5642
|
+
withAnimationPlayback,
|
|
5593
5643
|
withMotionLayers,
|
|
5594
5644
|
withViewBox,
|
|
5595
5645
|
withoutMotionEffect
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentToolProvider } from '../tools/registry.cjs';
|
|
2
|
+
import type { PlaybackStep } from '../tools/playback.cjs';
|
|
3
|
+
/** The cursor steps for one animation tool call (by bare name), or null to fall back to the ids it names. */
|
|
4
|
+
export declare function planAnimationToolPlayback(tool: string, args: Record<string, any>): PlaybackStep[] | null;
|
|
5
|
+
/**
|
|
6
|
+
* Gives an animation tool provider agent playback: each tool plans its steps with
|
|
7
|
+
* `planAnimationToolPlayback` and every call plays on `surface` (default `animation`, where
|
|
8
|
+
* `AnimationEditor` attaches itself).
|
|
9
|
+
*/
|
|
10
|
+
export declare function withAnimationPlayback(provider: AgentToolProvider, surface?: string): AgentToolProvider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentToolProvider } from '../tools/registry.js';
|
|
2
|
+
import type { PlaybackStep } from '../tools/playback.js';
|
|
3
|
+
/** The cursor steps for one animation tool call (by bare name), or null to fall back to the ids it names. */
|
|
4
|
+
export declare function planAnimationToolPlayback(tool: string, args: Record<string, any>): PlaybackStep[] | null;
|
|
5
|
+
/**
|
|
6
|
+
* Gives an animation tool provider agent playback: each tool plans its steps with
|
|
7
|
+
* `planAnimationToolPlayback` and every call plays on `surface` (default `animation`, where
|
|
8
|
+
* `AnimationEditor` attaches itself).
|
|
9
|
+
*/
|
|
10
|
+
export declare function withAnimationPlayback(provider: AgentToolProvider, surface?: string): AgentToolProvider;
|