@pixerate/editor-react 0.93.1 → 0.94.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/animation-editor/AnimationEditor.d.cts +3 -2
- package/dist/animation-editor/AnimationEditor.d.ts +3 -2
- package/dist/animation-editor/AnimationRecordPanel.d.cts +17 -0
- package/dist/animation-editor/AnimationRecordPanel.d.ts +17 -0
- package/dist/animation-editor/AnimationStage.d.cts +8 -2
- package/dist/animation-editor/AnimationStage.d.ts +8 -2
- package/dist/animation-editor/index.cjs +426 -352
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +315 -242
- package/package.json +3 -3
|
@@ -68,29 +68,47 @@ function useAnimationEffectsTools(registry, controller, options = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// src/animation-editor/AnimationStage.tsx
|
|
71
|
-
import { useMemo as useMemo2 } from "react";
|
|
71
|
+
import { useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
72
72
|
import { highlightMotionSvg, motionNodeAtElement } from "@pixerate/editor/animation-editor";
|
|
73
73
|
import { jsx } from "react/jsx-runtime";
|
|
74
|
-
function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, className = "" }) {
|
|
74
|
+
function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, recordMode = "move", className = "" }) {
|
|
75
75
|
const state = useAnimationEditorState(controller);
|
|
76
|
-
const { scene, time } = state;
|
|
76
|
+
const { scene, time, recording } = state;
|
|
77
|
+
const samples = recording?.samples ?? -1;
|
|
78
|
+
const dragging = useRef2(null);
|
|
79
|
+
const point = (e) => controller.clientToDocument(e.currentTarget.getBoundingClientRect(), e.clientX, e.clientY);
|
|
77
80
|
const key = highlight?.join("\0") ?? "";
|
|
78
81
|
const svg = useMemo2(
|
|
79
82
|
() => highlightMotionSvg(
|
|
80
83
|
controller.toSvg(time, { pretty: false, idPrefix: "ae-", values, onionSkin, motionPaths }).replace(/<svg ([^>]*?)width="[^"]*" height="[^"]*"/, '<svg $1width="100%" height="100%"'),
|
|
81
84
|
highlight ?? []
|
|
82
85
|
),
|
|
83
|
-
[controller, scene, time, values, onionSkin, motionPaths, key]
|
|
86
|
+
[controller, scene, time, samples, values, onionSkin, motionPaths, key]
|
|
84
87
|
);
|
|
85
88
|
return /* @__PURE__ */ jsx(
|
|
86
89
|
"div",
|
|
87
90
|
{
|
|
88
|
-
className: `relative overflow-hidden ${onPick ? "cursor-crosshair" : ""} ${className}`,
|
|
91
|
+
className: `relative overflow-hidden ${recording ? "cursor-grab touch-none" : onPick ? "cursor-crosshair" : ""} ${className}`,
|
|
89
92
|
style: { aspectRatio: `${scene.artwork.width} / ${scene.artwork.height}` },
|
|
90
93
|
"data-animation-stage": "",
|
|
94
|
+
"data-recording": recording ? "" : void 0,
|
|
91
95
|
role: "img",
|
|
92
96
|
"aria-label": `${scene.name} at ${(time / 1e3).toFixed(2)} s`,
|
|
93
97
|
onClick: onPick ? (e) => onPick(motionNodeAtElement(scene, e.target, e.currentTarget), e) : void 0,
|
|
98
|
+
onPointerDown: recording ? (e) => {
|
|
99
|
+
const id = motionNodeAtElement(scene, e.target, e.currentTarget);
|
|
100
|
+
if (!id || !controller.beginRecordGesture(id, recordMode, point(e))) return;
|
|
101
|
+
dragging.current = e.pointerId;
|
|
102
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
} : void 0,
|
|
105
|
+
onPointerMove: recording ? (e) => dragging.current === e.pointerId && controller.updateRecordGesture(point(e)) : void 0,
|
|
106
|
+
onPointerUp: recording ? (e) => {
|
|
107
|
+
if (dragging.current !== e.pointerId) return;
|
|
108
|
+
dragging.current = null;
|
|
109
|
+
controller.endRecordGesture();
|
|
110
|
+
} : void 0,
|
|
111
|
+
onPointerCancel: recording ? () => (dragging.current = null, controller.endRecordGesture()) : void 0,
|
|
94
112
|
dangerouslySetInnerHTML: { __html: svg }
|
|
95
113
|
}
|
|
96
114
|
);
|
|
@@ -167,9 +185,60 @@ function ShotTimeline({ controller, className = "" }) {
|
|
|
167
185
|
}
|
|
168
186
|
|
|
169
187
|
// src/animation-editor/AnimationEditor.tsx
|
|
170
|
-
import { useMemo as useMemo7, useRef as
|
|
188
|
+
import { useMemo as useMemo7, useRef as useRef4, useState as useState7 } from "react";
|
|
171
189
|
import { indexMotionNodes as indexMotionNodes2, motionIssueLine } from "@pixerate/editor/animation-editor";
|
|
172
190
|
|
|
191
|
+
// src/animation-editor/AnimationRecordPanel.tsx
|
|
192
|
+
import { MOTION_RECORD_GESTURE_MODES } from "@pixerate/editor/animation-editor";
|
|
193
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
194
|
+
var btn = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
195
|
+
var MODE_LABELS = { move: "Move", scale: "Scale", rotate: "Rotate" };
|
|
196
|
+
var hex6 = (c) => c && /^#[0-9a-f]{6}/i.test(c) ? c.slice(0, 7).toLowerCase() : "#000000";
|
|
197
|
+
function AnimationRecordPanel({ controller, node, mode, onModeChange, className = "" }) {
|
|
198
|
+
const state = useAnimationEditorState(controller);
|
|
199
|
+
const { recording, readOnly, error } = state;
|
|
200
|
+
const pose = recording && node ? controller.pose(node) : null;
|
|
201
|
+
const sample = (values) => node && controller.recordSample(node, values);
|
|
202
|
+
return /* @__PURE__ */ jsxs2("div", { className: `flex flex-wrap items-center gap-2 text-xs ${className}`, "data-animation-record": "", children: [
|
|
203
|
+
recording ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
204
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: `${btn} border-red-500 text-red-600`, onClick: () => controller.stopRecording(), "data-record-stop": "", children: "\u25A0 Stop" }),
|
|
205
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.cancelRecording(), "data-record-cancel": "", children: "Cancel" }),
|
|
206
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.toggle(), children: state.playing ? "Pause" : "Resume" }),
|
|
207
|
+
/* @__PURE__ */ jsxs2("span", { className: "tabular-nums text-red-600", "aria-live": "polite", children: [
|
|
208
|
+
"\u25CF REC ",
|
|
209
|
+
(recording.elapsed / 1e3).toFixed(1),
|
|
210
|
+
" s \xB7 ",
|
|
211
|
+
recording.samples,
|
|
212
|
+
" samples"
|
|
213
|
+
] })
|
|
214
|
+
] }) : /* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.startRecording(), disabled: readOnly, title: "Perform changes live on the stage and keep them as a new shot", "data-record-start": "", children: "\u25CF Record" }),
|
|
215
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": "Drag to", children: [
|
|
216
|
+
"Drag to",
|
|
217
|
+
MOTION_RECORD_GESTURE_MODES.map((m) => /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-0.5", children: [
|
|
218
|
+
/* @__PURE__ */ jsx3("input", { type: "radio", name: "animation-record-mode", checked: mode === m, onChange: () => onModeChange(m) }),
|
|
219
|
+
" ",
|
|
220
|
+
MODE_LABELS[m]
|
|
221
|
+
] }, m))
|
|
222
|
+
] }),
|
|
223
|
+
pose && /* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-2", "data-record-paint": "", children: [
|
|
224
|
+
pose.fill !== void 0 && /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1", children: [
|
|
225
|
+
"Fill ",
|
|
226
|
+
/* @__PURE__ */ jsx3("input", { type: "color", value: hex6(pose.fill), onChange: (e) => sample({ fill: e.target.value }) })
|
|
227
|
+
] }),
|
|
228
|
+
pose.stroke !== void 0 && /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1", children: [
|
|
229
|
+
"Stroke ",
|
|
230
|
+
/* @__PURE__ */ jsx3("input", { type: "color", value: hex6(pose.stroke), onChange: (e) => sample({ stroke: e.target.value }) })
|
|
231
|
+
] }),
|
|
232
|
+
/* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1", children: [
|
|
233
|
+
"Opacity ",
|
|
234
|
+
/* @__PURE__ */ jsx3("input", { type: "range", min: 0, max: 1, step: 0.01, value: pose.opacity, onChange: (e) => sample({ opacity: Number(e.target.value) }) })
|
|
235
|
+
] })
|
|
236
|
+
] }),
|
|
237
|
+
recording && !node && /* @__PURE__ */ jsx3("span", { className: "text-muted-foreground", children: "Drag an element; click one to record its paint and opacity." }),
|
|
238
|
+
!recording && error && /record/i.test(error) && /* @__PURE__ */ jsx3("span", { className: "text-amber-600", children: error })
|
|
239
|
+
] });
|
|
240
|
+
}
|
|
241
|
+
|
|
173
242
|
// src/animation-editor/CommandInspector.tsx
|
|
174
243
|
import React3, { useMemo as useMemo4, useState } from "react";
|
|
175
244
|
import {
|
|
@@ -182,7 +251,7 @@ import {
|
|
|
182
251
|
// src/animation-editor/EasePicker.tsx
|
|
183
252
|
import { useMemo as useMemo3 } from "react";
|
|
184
253
|
import { MOTION_EASE_CHOICES, motionEaseKey, motionEasingCurve, motionEasingGuides, motionEasingPath } from "@pixerate/editor/animation-editor";
|
|
185
|
-
import { jsx as
|
|
254
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
186
255
|
var W = 72;
|
|
187
256
|
var H = 44;
|
|
188
257
|
function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
@@ -190,8 +259,8 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
190
259
|
const curve = useMemo3(() => motionEasingCurve(value ?? "ease-out"), [value]);
|
|
191
260
|
const guides = motionEasingGuides(curve, H);
|
|
192
261
|
const spring = typeof value === "string" ? value.startsWith("spring") : value?.type === "spring";
|
|
193
|
-
return /* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
262
|
+
return /* @__PURE__ */ jsxs3("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
|
|
263
|
+
/* @__PURE__ */ jsxs3(
|
|
195
264
|
"select",
|
|
196
265
|
{
|
|
197
266
|
className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -203,17 +272,17 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
203
272
|
onChange(e.target.value ? e.target.value : void 0);
|
|
204
273
|
},
|
|
205
274
|
children: [
|
|
206
|
-
MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */
|
|
207
|
-
key === "custom" && /* @__PURE__ */
|
|
275
|
+
MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */ jsx4("option", { value: c.value, children: c.label }, c.value)),
|
|
276
|
+
key === "custom" && /* @__PURE__ */ jsx4("option", { value: "custom", children: "Custom" })
|
|
208
277
|
]
|
|
209
278
|
}
|
|
210
279
|
),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ jsxs3("svg", { width: W, height: H, viewBox: `0 0 ${W} ${H}`, className: "shrink-0 rounded border border-border", "data-ease-curve": key || "default", "aria-hidden": "true", children: [
|
|
281
|
+
/* @__PURE__ */ jsx4("line", { x1: 0, x2: W, y1: guides.zero, y2: guides.zero, stroke: "currentColor", strokeOpacity: 0.2 }),
|
|
282
|
+
/* @__PURE__ */ jsx4("line", { x1: 0, x2: W, y1: guides.one, y2: guides.one, stroke: "currentColor", strokeOpacity: 0.2, strokeDasharray: "2 2" }),
|
|
283
|
+
/* @__PURE__ */ jsx4("path", { d: motionEasingPath(curve, W, H), fill: "none", stroke: "#f43f5e", strokeWidth: 1.5 })
|
|
215
284
|
] }),
|
|
216
|
-
spring && /* @__PURE__ */
|
|
285
|
+
spring && /* @__PURE__ */ jsxs3("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
|
|
217
286
|
Math.round(curve.durationMs),
|
|
218
287
|
" ms"
|
|
219
288
|
] })
|
|
@@ -221,9 +290,9 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
221
290
|
}
|
|
222
291
|
|
|
223
292
|
// src/animation-editor/CommitInput.tsx
|
|
224
|
-
import { jsx as
|
|
293
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
225
294
|
function CommitInput({ value, onCommit, ...rest }) {
|
|
226
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ jsx5(
|
|
227
296
|
"input",
|
|
228
297
|
{
|
|
229
298
|
...rest,
|
|
@@ -238,7 +307,7 @@ function CommitInput({ value, onCommit, ...rest }) {
|
|
|
238
307
|
}
|
|
239
308
|
|
|
240
309
|
// src/animation-editor/CommandInspector.tsx
|
|
241
|
-
import { jsx as
|
|
310
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
242
311
|
var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
243
312
|
function CommandInspector({ controller, picked, className = "" }) {
|
|
244
313
|
const state = useAnimationEditorState(controller);
|
|
@@ -250,7 +319,7 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
250
319
|
const index = selection?.command;
|
|
251
320
|
const command = shot && index !== void 0 ? shot.run[index] : void 0;
|
|
252
321
|
if (!shot || index === void 0 || !command) {
|
|
253
|
-
return /* @__PURE__ */
|
|
322
|
+
return /* @__PURE__ */ jsx6("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
|
|
254
323
|
}
|
|
255
324
|
const values = command;
|
|
256
325
|
const fields = motionCommandFields(command.type);
|
|
@@ -269,45 +338,45 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
269
338
|
const common = { disabled: readOnly, "aria-label": field.label, title: field.description };
|
|
270
339
|
switch (field.kind) {
|
|
271
340
|
case "targets":
|
|
272
|
-
return /* @__PURE__ */
|
|
273
|
-
targets.map((id) => /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-1", "data-targets": "", children: [
|
|
342
|
+
targets.map((id) => /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-0.5 rounded bg-muted px-1 text-[11px]", "data-target": id, children: [
|
|
274
343
|
name(id),
|
|
275
|
-
!readOnly && targets.length > 1 && /* @__PURE__ */
|
|
344
|
+
!readOnly && targets.length > 1 && /* @__PURE__ */ jsx6("button", { type: "button", "aria-label": `Remove ${id}`, onClick: () => commit(field, targets.filter((t) => t !== id)), children: "\xD7" })
|
|
276
345
|
] }, id)),
|
|
277
|
-
!readOnly && picked && !targets.includes(picked) && /* @__PURE__ */
|
|
346
|
+
!readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ jsxs4("button", { type: "button", className: "rounded border border-rose-500 px-1 text-[11px] text-rose-500", onClick: () => commit(field, [...targets, picked]), "data-add-picked": "", children: [
|
|
278
347
|
"+ ",
|
|
279
348
|
name(picked)
|
|
280
349
|
] }),
|
|
281
|
-
!readOnly && /* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */
|
|
350
|
+
!readOnly && /* @__PURE__ */ jsxs4("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Add target", value: "", onChange: (e) => e.target.value && commit(field, [...targets, e.target.value]), children: [
|
|
351
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "+ target\u2026" }),
|
|
352
|
+
elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ jsx6("option", { value: e.id, children: e.name ? `${e.name} (${e.id})` : e.id }, e.id))
|
|
284
353
|
] })
|
|
285
354
|
] });
|
|
286
355
|
case "node":
|
|
287
|
-
return /* @__PURE__ */
|
|
288
|
-
!field.required && /* @__PURE__ */
|
|
289
|
-
elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ jsxs4("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
|
|
357
|
+
!field.required && /* @__PURE__ */ jsx6("option", { value: "", children: "\u2014" }),
|
|
358
|
+
elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ jsxs4("option", { value: e.id, children: [
|
|
290
359
|
e.name ? `${e.name} (${e.id})` : e.id,
|
|
291
360
|
e.hidden ? " \xB7 hidden" : ""
|
|
292
361
|
] }, e.id))
|
|
293
362
|
] });
|
|
294
363
|
case "enum":
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
!field.required && /* @__PURE__ */
|
|
297
|
-
field.options.map((o) => /* @__PURE__ */
|
|
364
|
+
return /* @__PURE__ */ jsxs4("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
|
|
365
|
+
!field.required && /* @__PURE__ */ jsx6("option", { value: "", children: "default" }),
|
|
366
|
+
field.options.map((o) => /* @__PURE__ */ jsx6("option", { value: o, children: o }, o))
|
|
298
367
|
] });
|
|
299
368
|
case "boolean":
|
|
300
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ jsx6("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
|
|
301
370
|
case "ease":
|
|
302
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ jsx6(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
|
|
303
372
|
case "color":
|
|
304
|
-
return /* @__PURE__ */
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */
|
|
373
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
374
|
+
/* @__PURE__ */ jsx6("input", { type: "color", disabled: readOnly, "aria-label": `${field.label} swatch`, value: typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v) ? v : "#000000", onChange: (e) => commit(field, e.target.value) }),
|
|
375
|
+
/* @__PURE__ */ jsx6(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", placeholder: "unchanged", onCommit: (raw) => commit(field, raw) })
|
|
307
376
|
] });
|
|
308
377
|
case "point": {
|
|
309
378
|
const p = v ?? void 0;
|
|
310
|
-
return /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ jsx6(
|
|
311
380
|
CommitInput,
|
|
312
381
|
{
|
|
313
382
|
className: input,
|
|
@@ -324,8 +393,8 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
324
393
|
case "scale":
|
|
325
394
|
case "number":
|
|
326
395
|
case "integer":
|
|
327
|
-
return /* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
397
|
+
/* @__PURE__ */ jsx6(
|
|
329
398
|
CommitInput,
|
|
330
399
|
{
|
|
331
400
|
className: input,
|
|
@@ -339,32 +408,32 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
339
408
|
onCommit: (raw) => commit(field, raw)
|
|
340
409
|
}
|
|
341
410
|
),
|
|
342
|
-
field.unit && /* @__PURE__ */
|
|
411
|
+
field.unit && /* @__PURE__ */ jsx6("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
|
|
343
412
|
] });
|
|
344
413
|
default:
|
|
345
|
-
return /* @__PURE__ */
|
|
414
|
+
return /* @__PURE__ */ jsx6(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
|
|
346
415
|
}
|
|
347
416
|
};
|
|
348
|
-
return /* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsxs4("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-command-inspector": "", "data-command-type": command.type, children: [
|
|
418
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
419
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-medium", children: [
|
|
351
420
|
index + 1,
|
|
352
421
|
". ",
|
|
353
422
|
command.type
|
|
354
423
|
] }),
|
|
355
|
-
primitive ? /* @__PURE__ */
|
|
424
|
+
primitive ? /* @__PURE__ */ jsx6("code", { className: "rounded bg-muted px-1 text-[10px]", "data-flair-primitive": primitive, title: "The Flair motion primitive this command plays", children: primitive }) : /* @__PURE__ */ jsx6("span", { className: "text-[10px] text-muted-foreground", children: "editor-only (no Flair primitive)" })
|
|
356
425
|
] }),
|
|
357
|
-
["main", "timing"].map((group) => /* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
426
|
+
["main", "timing"].map((group) => /* @__PURE__ */ jsxs4("fieldset", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
427
|
+
/* @__PURE__ */ jsx6("legend", { className: "mb-1 text-[10px] uppercase tracking-wide text-muted-foreground", children: group === "main" ? "Command" : "Timing" }),
|
|
428
|
+
fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ jsxs4(React3.Fragment, { children: [
|
|
429
|
+
/* @__PURE__ */ jsxs4("label", { className: "truncate text-muted-foreground", title: field.description, children: [
|
|
361
430
|
field.label,
|
|
362
431
|
field.required ? " *" : ""
|
|
363
432
|
] }),
|
|
364
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ jsx6("div", { "data-field": field.name, children: control(field) })
|
|
365
434
|
] }, field.name))
|
|
366
435
|
] }, group)),
|
|
367
|
-
message && /* @__PURE__ */
|
|
436
|
+
message && /* @__PURE__ */ jsx6("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
368
437
|
] });
|
|
369
438
|
}
|
|
370
439
|
|
|
@@ -376,8 +445,8 @@ import {
|
|
|
376
445
|
duplicateMotionCommandEdit,
|
|
377
446
|
motionCommandRows
|
|
378
447
|
} from "@pixerate/editor/animation-editor";
|
|
379
|
-
import { jsx as
|
|
380
|
-
var
|
|
448
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
449
|
+
var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
381
450
|
function CommandList({ controller, shot, targets, className = "" }) {
|
|
382
451
|
const state = useAnimationEditorState(controller);
|
|
383
452
|
const { scene, selection, readOnly, error } = state;
|
|
@@ -386,7 +455,7 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
386
455
|
const [type, setType] = useState2("enter");
|
|
387
456
|
const [local, setLocalState] = useState2(null);
|
|
388
457
|
const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
|
|
389
|
-
if (!current) return /* @__PURE__ */
|
|
458
|
+
if (!current) return /* @__PURE__ */ jsx7("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-list": "", children: "Add a shot to start." });
|
|
390
459
|
const rows = motionCommandRows(scene, current.id);
|
|
391
460
|
const selected = selection?.shot === current.id ? selection.command : void 0;
|
|
392
461
|
const run = (edit, label) => {
|
|
@@ -402,15 +471,15 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
402
471
|
if (result.ok) controller.select({ shot: current.id, command: at });
|
|
403
472
|
};
|
|
404
473
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
405
|
-
return /* @__PURE__ */
|
|
406
|
-
/* @__PURE__ */
|
|
474
|
+
return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-command-list": "", "data-for-shot": current.id, children: [
|
|
475
|
+
/* @__PURE__ */ jsxs5("div", { className: "font-medium", children: [
|
|
407
476
|
"Commands in ",
|
|
408
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ jsx7("span", { className: "text-rose-500", children: current.label ?? current.id })
|
|
409
478
|
] }),
|
|
410
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ jsx7("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
|
|
411
480
|
const c = row.command;
|
|
412
481
|
const isSelected = row.index === selected;
|
|
413
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ jsxs5(
|
|
414
483
|
"li",
|
|
415
484
|
{
|
|
416
485
|
className: `flex flex-wrap items-center gap-1 rounded border px-1.5 py-1 ${isSelected ? "border-rose-500 bg-rose-500/10" : "border-border"}`,
|
|
@@ -418,18 +487,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
418
487
|
"data-selected": isSelected || void 0,
|
|
419
488
|
onClick: () => controller.select({ shot: current.id, command: row.index }),
|
|
420
489
|
children: [
|
|
421
|
-
/* @__PURE__ */
|
|
490
|
+
/* @__PURE__ */ jsxs5("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
|
|
422
491
|
row.index + 1,
|
|
423
492
|
". ",
|
|
424
493
|
row.summary
|
|
425
494
|
] }),
|
|
426
|
-
row.flairPrimitive && /* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
495
|
+
row.flairPrimitive && /* @__PURE__ */ jsx7("code", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", "data-flair-primitive": row.flairPrimitive, children: row.flairPrimitive }),
|
|
496
|
+
/* @__PURE__ */ jsxs5("span", { className: "tabular-nums text-[10px] text-muted-foreground", children: [
|
|
428
497
|
((row.end - row.start) / 1e3).toFixed(2),
|
|
429
498
|
" s"
|
|
430
499
|
] }),
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
|
|
501
|
+
/* @__PURE__ */ jsxs5(
|
|
433
502
|
"select",
|
|
434
503
|
{
|
|
435
504
|
className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]",
|
|
@@ -441,14 +510,14 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
441
510
|
"Change start"
|
|
442
511
|
),
|
|
443
512
|
children: [
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ jsx7("option", { value: "after", children: "after previous" }),
|
|
514
|
+
/* @__PURE__ */ jsx7("option", { value: "previous", children: "with previous" })
|
|
446
515
|
]
|
|
447
516
|
}
|
|
448
517
|
),
|
|
449
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
|
|
450
519
|
"+",
|
|
451
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ jsx7(
|
|
452
521
|
"input",
|
|
453
522
|
{
|
|
454
523
|
className: "w-14 rounded border border-border bg-transparent px-1 py-0.5 text-[11px] tabular-nums",
|
|
@@ -472,11 +541,11 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
472
541
|
),
|
|
473
542
|
"ms"
|
|
474
543
|
] }),
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ jsxs5("span", { className: "ml-auto flex gap-0.5", children: [
|
|
545
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: btn2, "aria-label": "Move up", disabled: readOnly || row.index === 0, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index - 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index - 1 }), children: "\u2191" }),
|
|
546
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: btn2, "aria-label": "Move down", disabled: readOnly || row.index === rows.length - 1, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index + 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u2193" }),
|
|
547
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: btn2, "aria-label": "Duplicate", disabled: readOnly, onClick: () => run(duplicateMotionCommandEdit(scene, current.id, row.index), "Duplicate command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u29C9" }),
|
|
548
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: btn2, "aria-label": "Delete", disabled: readOnly, onClick: () => run({ op: "delete_commands", shot: current.id, commands: [row.index] }, "Delete command"), children: "\u2715" })
|
|
480
549
|
] })
|
|
481
550
|
] })
|
|
482
551
|
]
|
|
@@ -484,18 +553,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
484
553
|
`${row.index}:${row.summary}`
|
|
485
554
|
);
|
|
486
555
|
}) }),
|
|
487
|
-
!readOnly && /* @__PURE__ */
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
556
|
+
!readOnly && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
|
|
557
|
+
/* @__PURE__ */ jsx7("select", { className: "flex-1 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "New command type", value: type, onChange: (e) => setType(e.target.value), children: MOTION_COMMAND_TYPES.map((t) => /* @__PURE__ */ jsx7("option", { value: t, children: t }, t)) }),
|
|
558
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: btn2, onClick: add, "data-add-command": "", children: "Add command" })
|
|
490
559
|
] }),
|
|
491
|
-
message && /* @__PURE__ */
|
|
560
|
+
message && /* @__PURE__ */ jsx7("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
492
561
|
] });
|
|
493
562
|
}
|
|
494
563
|
|
|
495
564
|
// src/animation-editor/PlayheadScrubber.tsx
|
|
496
|
-
import { useEffect as useEffect2, useRef as
|
|
565
|
+
import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
|
|
497
566
|
import { motionBeatTime, motionCueTime, motionRulerTicks } from "@pixerate/editor/animation-editor";
|
|
498
|
-
import { jsx as
|
|
567
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
499
568
|
var seconds2 = (ms) => `${(ms / 1e3).toFixed(2)} s`;
|
|
500
569
|
function worst2(issues) {
|
|
501
570
|
if (issues.some((i) => i.severity === "error")) return "error";
|
|
@@ -506,7 +575,7 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
506
575
|
const state = useAnimationEditorState(controller);
|
|
507
576
|
const { duration, shots, time, playing, selection, issues, scene, readOnly } = state;
|
|
508
577
|
const span = Math.max(1, duration);
|
|
509
|
-
const track =
|
|
578
|
+
const track = useRef3(null);
|
|
510
579
|
const [width, setWidth] = useState3(600);
|
|
511
580
|
useEffect2(() => {
|
|
512
581
|
const el = track.current;
|
|
@@ -525,16 +594,16 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
525
594
|
if (scene.beat && scene.beat.bpm > 0) {
|
|
526
595
|
for (let b = 0, t = motionBeatTime(scene.beat, 0); t <= span && beats.length < 400; t = motionBeatTime(scene.beat, ++b)) if (t >= 0) beats.push(t);
|
|
527
596
|
}
|
|
528
|
-
return /* @__PURE__ */
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */
|
|
531
|
-
/* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col gap-1 ${className}`, "data-playhead-scrubber": "", "data-shot-timeline": "", children: [
|
|
598
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
599
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => controller.toggle(), "aria-label": playing ? "Pause" : "Play", disabled: !shots.length, children: playing ? "Pause" : "Play" }),
|
|
600
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => {
|
|
532
601
|
controller.pause();
|
|
533
602
|
controller.seek(0);
|
|
534
603
|
}, "aria-label": "Back to start", children: "\u23EE" }),
|
|
535
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
536
605
|
"Loop",
|
|
537
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ jsxs6(
|
|
538
607
|
"select",
|
|
539
608
|
{
|
|
540
609
|
className: "rounded border border-border bg-transparent px-1 py-0.5",
|
|
@@ -543,20 +612,20 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
543
612
|
"aria-label": "Loop",
|
|
544
613
|
onChange: (e) => controller.apply({ op: "set_settings", loop: e.target.value }, "Change loop"),
|
|
545
614
|
children: [
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ jsx8("option", { value: "none", children: "Off" }),
|
|
616
|
+
/* @__PURE__ */ jsx8("option", { value: "loop", children: "Loop" }),
|
|
617
|
+
/* @__PURE__ */ jsx8("option", { value: "ping-pong", children: "Ping-pong" })
|
|
549
618
|
]
|
|
550
619
|
}
|
|
551
620
|
)
|
|
552
621
|
] }),
|
|
553
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ jsxs6("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
|
|
554
623
|
seconds2(time),
|
|
555
624
|
" / ",
|
|
556
625
|
seconds2(duration)
|
|
557
626
|
] })
|
|
558
627
|
] }),
|
|
559
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ jsxs6(
|
|
560
629
|
"div",
|
|
561
630
|
{
|
|
562
631
|
ref: track,
|
|
@@ -586,17 +655,17 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
586
655
|
e.preventDefault();
|
|
587
656
|
},
|
|
588
657
|
children: [
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
beats.map((t, i) => /* @__PURE__ */
|
|
591
|
-
scene.narration?.words.map((w, i) => /* @__PURE__ */
|
|
592
|
-
ticks.map((t) => /* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ jsxs6("div", { className: "relative h-5 border-b border-border text-[10px] text-muted-foreground", "data-ruler": "", children: [
|
|
659
|
+
beats.map((t, i) => /* @__PURE__ */ jsx8("div", { className: "absolute bottom-0 h-1.5 w-px bg-sky-500/60", style: { left: pct(t) }, "data-beat": i }, `b${i}`)),
|
|
660
|
+
scene.narration?.words.map((w, i) => /* @__PURE__ */ jsx8("div", { className: "absolute top-0 h-1.5 w-px bg-emerald-500/70", style: { left: pct(w.start) }, title: `\u201C${w.text}\u201D at ${seconds2(w.start)}`, "data-word": i }, `w${i}`)),
|
|
661
|
+
ticks.map((t) => /* @__PURE__ */ jsx8("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: pct(t.time) }, children: t.label && /* @__PURE__ */ jsx8("span", { className: "absolute -top-0.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time))
|
|
593
662
|
] }),
|
|
594
|
-
/* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ jsx8("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
|
|
595
664
|
const mark = worst2(issues.filter((x) => x.shot === shot.id));
|
|
596
665
|
const selected = selection?.shot === shot.id;
|
|
597
666
|
const cue = scene.shots[i]?.at;
|
|
598
667
|
const cueTime = cue ? motionCueTime(scene, cue) : void 0;
|
|
599
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ jsxs6(
|
|
600
669
|
"button",
|
|
601
670
|
{
|
|
602
671
|
type: "button",
|
|
@@ -611,14 +680,14 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
611
680
|
controller.seekShot(shot.id);
|
|
612
681
|
},
|
|
613
682
|
children: [
|
|
614
|
-
mark && /* @__PURE__ */
|
|
683
|
+
mark && /* @__PURE__ */ jsx8("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
|
|
615
684
|
shot.label ?? shot.id
|
|
616
685
|
]
|
|
617
686
|
},
|
|
618
687
|
shot.id
|
|
619
688
|
);
|
|
620
689
|
}) }),
|
|
621
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ jsx8("div", { className: "pointer-events-none absolute inset-y-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: pct(time) }, "data-playhead": "" })
|
|
622
691
|
]
|
|
623
692
|
}
|
|
624
693
|
)
|
|
@@ -628,10 +697,10 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
628
697
|
// src/animation-editor/SceneSettings.tsx
|
|
629
698
|
import { useState as useState4 } from "react";
|
|
630
699
|
import { fitMotionSceneEdits, formatMotionDrivers, formatMotionNarration, parseMotionDrivers, parseMotionNarration } from "@pixerate/editor/animation-editor";
|
|
631
|
-
import { jsx as
|
|
700
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
632
701
|
var input2 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
633
|
-
var
|
|
634
|
-
var unit = (u) => /* @__PURE__ */
|
|
702
|
+
var btn3 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
703
|
+
var unit = (u) => /* @__PURE__ */ jsx9("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: u });
|
|
635
704
|
function SceneSettings({ controller, className = "" }) {
|
|
636
705
|
const state = useAnimationEditorState(controller);
|
|
637
706
|
const { scene, readOnly, error, duration } = state;
|
|
@@ -664,32 +733,32 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
664
733
|
};
|
|
665
734
|
const beat = scene.beat;
|
|
666
735
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
667
|
-
return /* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
736
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-scene-settings": "", children: [
|
|
737
|
+
/* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
738
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Loop" }),
|
|
739
|
+
/* @__PURE__ */ jsxs7("select", { className: input2, "aria-label": "Scene loop", disabled: readOnly, value: scene.loop ?? "none", onChange: (e) => settings({ loop: e.target.value }, "Change loop"), children: [
|
|
740
|
+
/* @__PURE__ */ jsx9("option", { value: "none", children: "Off" }),
|
|
741
|
+
/* @__PURE__ */ jsx9("option", { value: "loop", children: "Loop" }),
|
|
742
|
+
/* @__PURE__ */ jsx9("option", { value: "ping-pong", children: "Ping-pong" })
|
|
674
743
|
] }),
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
678
|
-
/* @__PURE__ */
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Motion blur" }),
|
|
745
|
+
/* @__PURE__ */ jsxs7("select", { className: input2, "aria-label": "Motion blur", disabled: readOnly, value: scene.motionBlur ? String(scene.motionBlur.shutter ?? 180) : "", onChange: (e) => settings({ motionBlur: e.target.value ? { ...scene.motionBlur ?? {}, shutter: Number(e.target.value) } : null }, "Change motion blur"), children: [
|
|
746
|
+
/* @__PURE__ */ jsx9("option", { value: "", children: "Off" }),
|
|
747
|
+
/* @__PURE__ */ jsx9("option", { value: "90", children: "Light (90\xB0)" }),
|
|
748
|
+
/* @__PURE__ */ jsx9("option", { value: "180", children: "Normal (180\xB0)" }),
|
|
749
|
+
/* @__PURE__ */ jsx9("option", { value: "360", children: "Heavy (360\xB0)" })
|
|
681
750
|
] }),
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
751
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Plays on" }),
|
|
752
|
+
/* @__PURE__ */ jsxs7("select", { className: input2, "aria-label": "Scene trigger", title: "How a viewer plays it when exported to Flair", disabled: readOnly, value: scene.trigger ?? "", onChange: (e) => settings({ trigger: e.target.value || null }, "Change trigger"), children: [
|
|
753
|
+
/* @__PURE__ */ jsx9("option", { value: "", children: "Its own (autoplay)" }),
|
|
754
|
+
/* @__PURE__ */ jsx9("option", { value: "click", children: "Click (a shot per click)" }),
|
|
755
|
+
/* @__PURE__ */ jsx9("option", { value: "hover", children: "Hover" }),
|
|
756
|
+
/* @__PURE__ */ jsx9("option", { value: "press", children: "Press" }),
|
|
757
|
+
/* @__PURE__ */ jsx9("option", { value: "scroll", children: "Scroll" })
|
|
689
758
|
] }),
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Frame rate" }),
|
|
760
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
|
|
761
|
+
/* @__PURE__ */ jsx9(
|
|
693
762
|
CommitInput,
|
|
694
763
|
{
|
|
695
764
|
className: input2,
|
|
@@ -705,9 +774,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
705
774
|
),
|
|
706
775
|
unit("fps")
|
|
707
776
|
] }),
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", title: "Hold changes on a grid of this many frames a second (12 = on twos); empty is smooth", children: "Steps" }),
|
|
778
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
|
|
779
|
+
/* @__PURE__ */ jsx9(
|
|
711
780
|
CommitInput,
|
|
712
781
|
{
|
|
713
782
|
className: input2,
|
|
@@ -723,9 +792,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
723
792
|
),
|
|
724
793
|
unit("fps")
|
|
725
794
|
] }),
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
[0, 1].map((i) => /* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Target length" }),
|
|
796
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
|
|
797
|
+
[0, 1].map((i) => /* @__PURE__ */ jsx9(
|
|
729
798
|
CommitInput,
|
|
730
799
|
{
|
|
731
800
|
className: input2,
|
|
@@ -748,15 +817,15 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
748
817
|
)),
|
|
749
818
|
unit("s")
|
|
750
819
|
] }),
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Fit to" }),
|
|
821
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
|
|
822
|
+
/* @__PURE__ */ jsx9("input", { className: input2, type: "number", min: 0.1, step: 0.5, "aria-label": "Fit to", value: fitSeconds, onChange: (e) => setFitTo(e.target.value) }),
|
|
754
823
|
unit("s"),
|
|
755
|
-
/* @__PURE__ */
|
|
824
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: btn3, disabled: readOnly || !scene.shots.length, onClick: fit, "data-fit": "", title: "Change the shots' speeds so the scene lasts this long", children: "Fit" })
|
|
756
825
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ jsx9("label", { className: "text-muted-foreground", children: "Beat grid" }),
|
|
827
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", "data-beat-grid": "", children: [
|
|
828
|
+
/* @__PURE__ */ jsx9(
|
|
760
829
|
CommitInput,
|
|
761
830
|
{
|
|
762
831
|
className: input2,
|
|
@@ -769,7 +838,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
769
838
|
onCommit: (raw) => num(raw, "BPM must be above 0.", (n) => n > 0, (n) => settings({ beat: n === null ? null : { ...beat ?? {}, bpm: n } }, n === null ? "Clear beat grid" : "Change tempo"))
|
|
770
839
|
}
|
|
771
840
|
),
|
|
772
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ jsx9(
|
|
773
842
|
CommitInput,
|
|
774
843
|
{
|
|
775
844
|
className: input2,
|
|
@@ -781,7 +850,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
781
850
|
onCommit: (raw) => beat && num(raw, "The offset is a number of ms.", () => true, (n) => settings({ beat: { ...beat, offset: n ?? 0 } }, "Change beat offset"))
|
|
782
851
|
}
|
|
783
852
|
),
|
|
784
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx9(
|
|
785
854
|
CommitInput,
|
|
786
855
|
{
|
|
787
856
|
className: input2,
|
|
@@ -797,9 +866,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
797
866
|
)
|
|
798
867
|
] })
|
|
799
868
|
] }),
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
870
|
+
/* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Narration (a word a line: start ms, then the word)" }),
|
|
871
|
+
/* @__PURE__ */ jsx9(
|
|
803
872
|
"textarea",
|
|
804
873
|
{
|
|
805
874
|
className: `${input2} h-20 font-mono`,
|
|
@@ -817,9 +886,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
817
886
|
formatMotionNarration(scene.narration)
|
|
818
887
|
)
|
|
819
888
|
] }),
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
889
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
890
|
+
/* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Drivers (one a line: target.property <- source.property * factor)" }),
|
|
891
|
+
/* @__PURE__ */ jsx9(
|
|
823
892
|
"textarea",
|
|
824
893
|
{
|
|
825
894
|
className: `${input2} h-14 font-mono`,
|
|
@@ -837,16 +906,16 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
837
906
|
formatMotionDrivers(scene.drivers)
|
|
838
907
|
)
|
|
839
908
|
] }),
|
|
840
|
-
message && /* @__PURE__ */
|
|
909
|
+
message && /* @__PURE__ */ jsx9("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
841
910
|
] });
|
|
842
911
|
}
|
|
843
912
|
|
|
844
913
|
// src/animation-editor/ShotInspector.tsx
|
|
845
914
|
import { useMemo as useMemo5, useState as useState5 } from "react";
|
|
846
915
|
import { describeMotionElements as describeMotionElements2, freshShotId, motionCueChoices, motionCueFromKey, motionCueKey } from "@pixerate/editor/animation-editor";
|
|
847
|
-
import { Fragment, jsx as
|
|
916
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
848
917
|
var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
849
|
-
var
|
|
918
|
+
var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
850
919
|
function ShotInspector({ controller, shot, className = "" }) {
|
|
851
920
|
const state = useAnimationEditorState(controller);
|
|
852
921
|
const { scene, selection, readOnly, error } = state;
|
|
@@ -878,34 +947,34 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
878
947
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
879
948
|
const cueKey = current ? motionCueKey(current.at) : "";
|
|
880
949
|
const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
|
|
881
|
-
return /* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
current && /* @__PURE__ */
|
|
885
|
-
/* @__PURE__ */
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
current && /* @__PURE__ */
|
|
888
|
-
/* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */
|
|
950
|
+
return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
|
|
951
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
952
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium", children: "Shot" }),
|
|
953
|
+
current && /* @__PURE__ */ jsx10("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
|
|
954
|
+
/* @__PURE__ */ jsxs8("span", { className: "ml-auto flex gap-0.5", children: [
|
|
955
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn4, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
|
|
956
|
+
current && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
957
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn4, "aria-label": "Move shot earlier", disabled: readOnly || index === 0, onClick: () => apply({ op: "move_shot", shot: current.id, to: index - 1 }, "Move shot"), children: "\u2190" }),
|
|
958
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn4, "aria-label": "Move shot later", disabled: readOnly || index === scene.shots.length - 1, onClick: () => apply({ op: "move_shot", shot: current.id, to: index + 1 }, "Move shot"), children: "\u2192" }),
|
|
959
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn4, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
|
|
891
960
|
] })
|
|
892
961
|
] })
|
|
893
962
|
] }),
|
|
894
|
-
current && /* @__PURE__ */
|
|
895
|
-
/* @__PURE__ */
|
|
896
|
-
/* @__PURE__ */
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
963
|
+
current && /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
964
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Label" }),
|
|
965
|
+
/* @__PURE__ */ jsx10(CommitInput, { className: input3, "aria-label": "Shot label", disabled: readOnly, value: current.label ?? "", onCommit: (raw) => apply(raw.trim() ? { op: "update_shot", shot: current.id, set: { label: raw.trim() } } : { op: "update_shot", shot: current.id, remove: ["label"] }, "Rename shot") }),
|
|
966
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Hold" }),
|
|
967
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
968
|
+
/* @__PURE__ */ jsx10(CommitInput, { className: input3, type: "number", min: 0, step: 50, "aria-label": "Hold", placeholder: "600", disabled: readOnly, value: current.hold !== void 0 ? String(current.hold) : "", onCommit: (raw) => number("hold", raw, "Change hold") }),
|
|
969
|
+
/* @__PURE__ */ jsx10("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
|
|
901
970
|
] }),
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
905
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Speed" }),
|
|
972
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
973
|
+
/* @__PURE__ */ jsx10(CommitInput, { className: input3, type: "number", min: 0.05, step: 0.05, "aria-label": "Speed", placeholder: "1", disabled: readOnly, value: current.speed !== void 0 ? String(current.speed) : "", onCommit: (raw) => number("speed", raw, "Change speed") }),
|
|
974
|
+
/* @__PURE__ */ jsx10("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
|
|
906
975
|
] }),
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Camera" }),
|
|
977
|
+
/* @__PURE__ */ jsxs8(
|
|
909
978
|
"select",
|
|
910
979
|
{
|
|
911
980
|
className: input3,
|
|
@@ -918,17 +987,17 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
918
987
|
else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { frame: v.slice(6), padding: 24 } } }, "Frame camera");
|
|
919
988
|
},
|
|
920
989
|
children: [
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
current.camera && !frame && /* @__PURE__ */
|
|
923
|
-
elements.map((e) => /* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "keep framing" }),
|
|
991
|
+
current.camera && !frame && /* @__PURE__ */ jsx10("option", { value: "rect", children: "a rectangle" }),
|
|
992
|
+
elements.map((e) => /* @__PURE__ */ jsxs8("option", { value: `frame:${e.id}`, children: [
|
|
924
993
|
"frame ",
|
|
925
994
|
e.name ?? e.id
|
|
926
995
|
] }, e.id))
|
|
927
996
|
]
|
|
928
997
|
}
|
|
929
998
|
),
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Starts on" }),
|
|
1000
|
+
/* @__PURE__ */ jsxs8(
|
|
932
1001
|
"select",
|
|
933
1002
|
{
|
|
934
1003
|
className: input3,
|
|
@@ -940,33 +1009,33 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
940
1009
|
apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
|
|
941
1010
|
},
|
|
942
1011
|
children: [
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */
|
|
945
|
-
cues.map((c) => /* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "after the shot before" }),
|
|
1013
|
+
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ jsx10("option", { value: cueKey, children: cueKey }),
|
|
1014
|
+
cues.map((c) => /* @__PURE__ */ jsx10("option", { value: c.value, children: c.label }, c.value))
|
|
946
1015
|
]
|
|
947
1016
|
}
|
|
948
1017
|
),
|
|
949
|
-
!cues.length && index > 0 && /* @__PURE__ */
|
|
1018
|
+
!cues.length && index > 0 && /* @__PURE__ */ jsx10("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "Add a beat grid or narration in the scene settings to cue shots to them." })
|
|
950
1019
|
] }),
|
|
951
|
-
message && /* @__PURE__ */
|
|
1020
|
+
message && /* @__PURE__ */ jsx10("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
952
1021
|
] });
|
|
953
1022
|
}
|
|
954
1023
|
|
|
955
1024
|
// src/animation-editor/AnimationEffectsPanel.tsx
|
|
956
1025
|
import { useMemo as useMemo6, useState as useState6 } from "react";
|
|
957
1026
|
import { indexMotionNodes } from "@pixerate/editor/animation-editor";
|
|
958
|
-
import { Fragment as
|
|
959
|
-
var
|
|
1027
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1028
|
+
var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
960
1029
|
function Controls({ controller, instance, effect, values }) {
|
|
961
1030
|
const provider = controller.effectsProvider;
|
|
962
1031
|
const { description, error } = useEffectDescription(provider, effect);
|
|
963
1032
|
const [message, setMessage] = useState6(null);
|
|
964
1033
|
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
965
|
-
if (!provider) return /* @__PURE__ */
|
|
966
|
-
if (error) return /* @__PURE__ */
|
|
967
|
-
if (!description) return /* @__PURE__ */
|
|
968
|
-
return /* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1034
|
+
if (!provider) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
|
|
1035
|
+
if (error) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-500", children: error });
|
|
1036
|
+
if (!description) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
1037
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1038
|
+
/* @__PURE__ */ jsx11(
|
|
970
1039
|
EffectParameters,
|
|
971
1040
|
{
|
|
972
1041
|
description,
|
|
@@ -976,7 +1045,7 @@ function Controls({ controller, instance, effect, values }) {
|
|
|
976
1045
|
onPreset: (v) => report(controller.updateMotionEffect(instance, v))
|
|
977
1046
|
}
|
|
978
1047
|
),
|
|
979
|
-
message && /* @__PURE__ */
|
|
1048
|
+
message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
980
1049
|
] });
|
|
981
1050
|
}
|
|
982
1051
|
function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
@@ -991,45 +1060,45 @@ function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
|
991
1060
|
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
|
|
992
1061
|
const applied = useMemo6(() => controller.appliedEffects(), [controller, state.scene]);
|
|
993
1062
|
const disabled = state.readOnly;
|
|
994
|
-
return /* @__PURE__ */
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
nodes.map((id) => /* @__PURE__ */
|
|
1063
|
+
return /* @__PURE__ */ jsxs9("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
|
|
1064
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1065
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
1066
|
+
/* @__PURE__ */ jsxs9("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Node to animate", value: target, disabled: !!node, onChange: (e) => setChosen(e.currentTarget.value), children: [
|
|
1067
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "Node\u2026" }),
|
|
1068
|
+
nodes.map((id) => /* @__PURE__ */ jsx11("option", { value: id, children: id }, id))
|
|
1000
1069
|
] }),
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn5, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
|
|
1071
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
|
|
1003
1072
|
] }),
|
|
1004
|
-
!provider && /* @__PURE__ */
|
|
1005
|
-
browse === "motion" && /* @__PURE__ */
|
|
1006
|
-
browse === "vector" && /* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1073
|
+
!provider && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
|
|
1074
|
+
browse === "motion" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
|
|
1075
|
+
browse === "vector" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
|
|
1076
|
+
/* @__PURE__ */ jsx11("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ jsxs9("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
|
|
1077
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1078
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.instance, onClick: () => setOpen(open === e.instance ? null : e.instance), children: [
|
|
1010
1079
|
e.name ?? e.effect,
|
|
1011
1080
|
" ",
|
|
1012
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
1013
1082
|
"\xB7 ",
|
|
1014
1083
|
e.kind === "vector" ? "picture" : e.targets.join(", ")
|
|
1015
1084
|
] })
|
|
1016
1085
|
] }),
|
|
1017
|
-
/* @__PURE__ */
|
|
1086
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
|
|
1018
1087
|
] }),
|
|
1019
|
-
open === e.instance && /* @__PURE__ */
|
|
1088
|
+
open === e.instance && /* @__PURE__ */ jsx11("div", { className: "mt-1", children: /* @__PURE__ */ jsx11(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
|
|
1020
1089
|
] }, e.instance)) }),
|
|
1021
|
-
!applied.length && /* @__PURE__ */
|
|
1022
|
-
message && /* @__PURE__ */
|
|
1090
|
+
!applied.length && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
|
|
1091
|
+
message && /* @__PURE__ */ jsx11("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
|
|
1023
1092
|
] });
|
|
1024
1093
|
}
|
|
1025
1094
|
|
|
1026
1095
|
// src/animation-editor/AnimationEditor.tsx
|
|
1027
|
-
import { Fragment as
|
|
1096
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1028
1097
|
var ONION = { before: 3, after: 1 };
|
|
1029
|
-
var
|
|
1098
|
+
var btn6 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
1030
1099
|
function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
|
|
1031
1100
|
const state = useAnimationEditorState(controller);
|
|
1032
|
-
const rootRef =
|
|
1101
|
+
const rootRef = useRef4(null);
|
|
1033
1102
|
const ambientPlayback = useAgentPlayback();
|
|
1034
1103
|
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
1035
1104
|
const rectIn = (el) => {
|
|
@@ -1064,12 +1133,13 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1064
1133
|
},
|
|
1065
1134
|
reveal: () => onPlaybackReveal?.()
|
|
1066
1135
|
});
|
|
1067
|
-
const presenceLayer = playing ? /* @__PURE__ */
|
|
1136
|
+
const presenceLayer = playing ? /* @__PURE__ */ jsx12(PresenceLayer, { presence: agentPresence }) : null;
|
|
1068
1137
|
useEffects(controller, effects);
|
|
1069
1138
|
const { issues, scene, selection, readOnly } = state;
|
|
1070
1139
|
const [picked, setPicked] = useState7(null);
|
|
1071
1140
|
const [onion, setOnion] = useState7(false);
|
|
1072
1141
|
const [paths, setPaths] = useState7(false);
|
|
1142
|
+
const [recordMode, setRecordMode] = useState7("move");
|
|
1073
1143
|
const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
|
|
1074
1144
|
const targets = command && "targets" in command ? command.targets : [];
|
|
1075
1145
|
const nodes = useMemo7(() => indexMotionNodes2(scene.artwork.nodes), [scene.artwork]);
|
|
@@ -1082,7 +1152,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1082
1152
|
}
|
|
1083
1153
|
setPicked(id);
|
|
1084
1154
|
};
|
|
1085
|
-
const stage = /* @__PURE__ */
|
|
1155
|
+
const stage = /* @__PURE__ */ jsx12(
|
|
1086
1156
|
AnimationStage,
|
|
1087
1157
|
{
|
|
1088
1158
|
controller,
|
|
@@ -1091,18 +1161,19 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1091
1161
|
motionPaths: motionPaths ?? paths,
|
|
1092
1162
|
onPick: editable ? onPick : void 0,
|
|
1093
1163
|
highlight: editable ? [...pickedValid ? [pickedValid] : [], ...targets] : void 0,
|
|
1164
|
+
recordMode,
|
|
1094
1165
|
className: "rounded-md border border-border bg-muted/40"
|
|
1095
1166
|
}
|
|
1096
1167
|
);
|
|
1097
|
-
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */
|
|
1168
|
+
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ jsx12("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ jsx12("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: motionIssueLine(issue) }, i)) });
|
|
1098
1169
|
if (!editable)
|
|
1099
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ jsxs10("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
|
|
1100
1171
|
presenceLayer,
|
|
1101
1172
|
stage,
|
|
1102
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ jsx12(PlayheadScrubber, { controller }),
|
|
1103
1174
|
issueList
|
|
1104
1175
|
] });
|
|
1105
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */ jsxs10(
|
|
1106
1177
|
"div",
|
|
1107
1178
|
{
|
|
1108
1179
|
ref: rootRef,
|
|
@@ -1117,40 +1188,41 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1117
1188
|
},
|
|
1118
1189
|
children: [
|
|
1119
1190
|
presenceLayer,
|
|
1120
|
-
/* @__PURE__ */
|
|
1191
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
1121
1192
|
stage,
|
|
1122
|
-
/* @__PURE__ */
|
|
1123
|
-
/* @__PURE__ */
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
onionSkin === void 0 && /* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ jsx12(PlayheadScrubber, { controller }),
|
|
1194
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1195
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: btn6, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
|
|
1196
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: btn6, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
|
|
1197
|
+
onionSkin === void 0 && /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
1198
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
|
|
1128
1199
|
" Onion skin"
|
|
1129
1200
|
] }),
|
|
1130
|
-
motionPaths === void 0 && /* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
1201
|
+
motionPaths === void 0 && /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
1202
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
|
|
1132
1203
|
" Motion paths"
|
|
1133
1204
|
] }),
|
|
1134
|
-
/* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ jsx12("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1135
1206
|
"Picked ",
|
|
1136
|
-
/* @__PURE__ */
|
|
1207
|
+
/* @__PURE__ */ jsx12("code", { className: "text-rose-500", children: pickedValid }),
|
|
1137
1208
|
" ",
|
|
1138
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
|
|
1139
1210
|
] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
|
|
1140
1211
|
] }),
|
|
1212
|
+
!readOnly && /* @__PURE__ */ jsx12(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
|
|
1141
1213
|
issueList
|
|
1142
1214
|
] }),
|
|
1143
|
-
/* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1148
|
-
/* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-3", children: [
|
|
1216
|
+
/* @__PURE__ */ jsx12(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
|
|
1217
|
+
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ jsx12(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
|
|
1218
|
+
/* @__PURE__ */ jsx12(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
|
|
1219
|
+
/* @__PURE__ */ jsxs10("details", { open: true, className: "border-t border-border pt-2", children: [
|
|
1220
|
+
/* @__PURE__ */ jsx12("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
|
|
1221
|
+
/* @__PURE__ */ jsx12(ShotInspector, { controller, className: "mt-1" })
|
|
1150
1222
|
] }),
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1153
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsxs10("details", { className: "border-t border-border pt-2", children: [
|
|
1224
|
+
/* @__PURE__ */ jsx12("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
|
|
1225
|
+
/* @__PURE__ */ jsx12(SceneSettings, { controller, className: "mt-1" })
|
|
1154
1226
|
] })
|
|
1155
1227
|
] })
|
|
1156
1228
|
]
|
|
@@ -1160,6 +1232,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1160
1232
|
export {
|
|
1161
1233
|
AnimationEditor,
|
|
1162
1234
|
AnimationEffectsPanel,
|
|
1235
|
+
AnimationRecordPanel,
|
|
1163
1236
|
AnimationStage,
|
|
1164
1237
|
CommandInspector,
|
|
1165
1238
|
CommandList,
|