@pixerate/editor-react 0.92.0 → 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 +14 -3
- package/dist/animation-editor/AnimationEditor.d.ts +14 -3
- 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 +607 -405
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +359 -242
- package/dist/canvas/index.cjs +3 -2
- package/dist/canvas/index.js +4 -4
- package/dist/chart/ChartEditor.d.cts +12 -1
- package/dist/chart/ChartEditor.d.ts +12 -1
- package/dist/chart/index.cjs +187 -29
- package/dist/chart/index.js +74 -10
- package/dist/{chunk-6MDTFAPY.js → chunk-6YRSQW2V.js} +5 -5
- package/dist/chunk-7I73DW4V.js +43 -0
- package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
- package/dist/{chunk-ECBC4HD7.js → chunk-IPVWWVSF.js} +3 -2
- package/dist/image-editor/index.cjs +3 -2
- package/dist/image-editor/index.js +2 -2
- package/dist/index.cjs +609 -527
- package/dist/index.js +10 -6
- package/dist/paint-editor/PaintEditor.d.cts +12 -1
- package/dist/paint-editor/PaintEditor.d.ts +12 -1
- package/dist/paint-editor/index.cjs +319 -164
- package/dist/paint-editor/index.js +84 -11
- package/dist/parameters/ParametersPanel.d.cts +11 -1
- package/dist/parameters/ParametersPanel.d.ts +11 -1
- package/dist/parameters/index.cjs +190 -41
- package/dist/parameters/index.js +23 -4
- package/dist/playback/index.d.cts +1 -0
- package/dist/playback/index.d.ts +1 -0
- package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
- package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
- package/dist/playback/usePlaybackSurface.d.cts +3 -1
- package/dist/playback/usePlaybackSurface.d.ts +3 -1
- package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
- package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +443 -313
- package/dist/spreadsheet/index.js +2 -1
- package/dist/vector/index.cjs +3 -2
- package/dist/vector/index.js +5 -5
- package/dist/video-editor/VideoEditor.d.cts +6 -1
- package/dist/video-editor/VideoEditor.d.ts +6 -1
- package/dist/video-editor/VideoTimeline.d.cts +11 -1
- package/dist/video-editor/VideoTimeline.d.ts +11 -1
- package/dist/video-editor/index.cjs +463 -332
- package/dist/video-editor/index.js +53 -5
- package/package.json +3 -3
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
useEffects
|
|
6
6
|
} from "../chunk-5R67YSSD.js";
|
|
7
7
|
import "../chunk-OTGJEYHV.js";
|
|
8
|
+
import {
|
|
9
|
+
PresenceLayer,
|
|
10
|
+
useAgentPlayback,
|
|
11
|
+
usePlaybackSurface
|
|
12
|
+
} from "../chunk-IPVWWVSF.js";
|
|
8
13
|
|
|
9
14
|
// src/animation-editor/useAnimationEditor.ts
|
|
10
15
|
import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
@@ -63,29 +68,47 @@ function useAnimationEffectsTools(registry, controller, options = {}) {
|
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
// src/animation-editor/AnimationStage.tsx
|
|
66
|
-
import { useMemo as useMemo2 } from "react";
|
|
71
|
+
import { useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
67
72
|
import { highlightMotionSvg, motionNodeAtElement } from "@pixerate/editor/animation-editor";
|
|
68
73
|
import { jsx } from "react/jsx-runtime";
|
|
69
|
-
function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, className = "" }) {
|
|
74
|
+
function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, recordMode = "move", className = "" }) {
|
|
70
75
|
const state = useAnimationEditorState(controller);
|
|
71
|
-
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);
|
|
72
80
|
const key = highlight?.join("\0") ?? "";
|
|
73
81
|
const svg = useMemo2(
|
|
74
82
|
() => highlightMotionSvg(
|
|
75
83
|
controller.toSvg(time, { pretty: false, idPrefix: "ae-", values, onionSkin, motionPaths }).replace(/<svg ([^>]*?)width="[^"]*" height="[^"]*"/, '<svg $1width="100%" height="100%"'),
|
|
76
84
|
highlight ?? []
|
|
77
85
|
),
|
|
78
|
-
[controller, scene, time, values, onionSkin, motionPaths, key]
|
|
86
|
+
[controller, scene, time, samples, values, onionSkin, motionPaths, key]
|
|
79
87
|
);
|
|
80
88
|
return /* @__PURE__ */ jsx(
|
|
81
89
|
"div",
|
|
82
90
|
{
|
|
83
|
-
className: `relative overflow-hidden ${onPick ? "cursor-crosshair" : ""} ${className}`,
|
|
91
|
+
className: `relative overflow-hidden ${recording ? "cursor-grab touch-none" : onPick ? "cursor-crosshair" : ""} ${className}`,
|
|
84
92
|
style: { aspectRatio: `${scene.artwork.width} / ${scene.artwork.height}` },
|
|
85
93
|
"data-animation-stage": "",
|
|
94
|
+
"data-recording": recording ? "" : void 0,
|
|
86
95
|
role: "img",
|
|
87
96
|
"aria-label": `${scene.name} at ${(time / 1e3).toFixed(2)} s`,
|
|
88
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,
|
|
89
112
|
dangerouslySetInnerHTML: { __html: svg }
|
|
90
113
|
}
|
|
91
114
|
);
|
|
@@ -162,9 +185,60 @@ function ShotTimeline({ controller, className = "" }) {
|
|
|
162
185
|
}
|
|
163
186
|
|
|
164
187
|
// src/animation-editor/AnimationEditor.tsx
|
|
165
|
-
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
188
|
+
import { useMemo as useMemo7, useRef as useRef4, useState as useState7 } from "react";
|
|
166
189
|
import { indexMotionNodes as indexMotionNodes2, motionIssueLine } from "@pixerate/editor/animation-editor";
|
|
167
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
|
+
|
|
168
242
|
// src/animation-editor/CommandInspector.tsx
|
|
169
243
|
import React3, { useMemo as useMemo4, useState } from "react";
|
|
170
244
|
import {
|
|
@@ -177,7 +251,7 @@ import {
|
|
|
177
251
|
// src/animation-editor/EasePicker.tsx
|
|
178
252
|
import { useMemo as useMemo3 } from "react";
|
|
179
253
|
import { MOTION_EASE_CHOICES, motionEaseKey, motionEasingCurve, motionEasingGuides, motionEasingPath } from "@pixerate/editor/animation-editor";
|
|
180
|
-
import { jsx as
|
|
254
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
181
255
|
var W = 72;
|
|
182
256
|
var H = 44;
|
|
183
257
|
function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
@@ -185,8 +259,8 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
185
259
|
const curve = useMemo3(() => motionEasingCurve(value ?? "ease-out"), [value]);
|
|
186
260
|
const guides = motionEasingGuides(curve, H);
|
|
187
261
|
const spring = typeof value === "string" ? value.startsWith("spring") : value?.type === "spring";
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
262
|
+
return /* @__PURE__ */ jsxs3("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
|
|
263
|
+
/* @__PURE__ */ jsxs3(
|
|
190
264
|
"select",
|
|
191
265
|
{
|
|
192
266
|
className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -198,17 +272,17 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
198
272
|
onChange(e.target.value ? e.target.value : void 0);
|
|
199
273
|
},
|
|
200
274
|
children: [
|
|
201
|
-
MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */
|
|
202
|
-
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" })
|
|
203
277
|
]
|
|
204
278
|
}
|
|
205
279
|
),
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
/* @__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 })
|
|
210
284
|
] }),
|
|
211
|
-
spring && /* @__PURE__ */
|
|
285
|
+
spring && /* @__PURE__ */ jsxs3("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
|
|
212
286
|
Math.round(curve.durationMs),
|
|
213
287
|
" ms"
|
|
214
288
|
] })
|
|
@@ -216,9 +290,9 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
216
290
|
}
|
|
217
291
|
|
|
218
292
|
// src/animation-editor/CommitInput.tsx
|
|
219
|
-
import { jsx as
|
|
293
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
220
294
|
function CommitInput({ value, onCommit, ...rest }) {
|
|
221
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ jsx5(
|
|
222
296
|
"input",
|
|
223
297
|
{
|
|
224
298
|
...rest,
|
|
@@ -233,7 +307,7 @@ function CommitInput({ value, onCommit, ...rest }) {
|
|
|
233
307
|
}
|
|
234
308
|
|
|
235
309
|
// src/animation-editor/CommandInspector.tsx
|
|
236
|
-
import { jsx as
|
|
310
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
237
311
|
var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
238
312
|
function CommandInspector({ controller, picked, className = "" }) {
|
|
239
313
|
const state = useAnimationEditorState(controller);
|
|
@@ -245,7 +319,7 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
245
319
|
const index = selection?.command;
|
|
246
320
|
const command = shot && index !== void 0 ? shot.run[index] : void 0;
|
|
247
321
|
if (!shot || index === void 0 || !command) {
|
|
248
|
-
return /* @__PURE__ */
|
|
322
|
+
return /* @__PURE__ */ jsx6("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
|
|
249
323
|
}
|
|
250
324
|
const values = command;
|
|
251
325
|
const fields = motionCommandFields(command.type);
|
|
@@ -264,45 +338,45 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
264
338
|
const common = { disabled: readOnly, "aria-label": field.label, title: field.description };
|
|
265
339
|
switch (field.kind) {
|
|
266
340
|
case "targets":
|
|
267
|
-
return /* @__PURE__ */
|
|
268
|
-
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: [
|
|
269
343
|
name(id),
|
|
270
|
-
!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" })
|
|
271
345
|
] }, id)),
|
|
272
|
-
!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: [
|
|
273
347
|
"+ ",
|
|
274
348
|
name(picked)
|
|
275
349
|
] }),
|
|
276
|
-
!readOnly && /* @__PURE__ */
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
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))
|
|
279
353
|
] })
|
|
280
354
|
] });
|
|
281
355
|
case "node":
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
!field.required && /* @__PURE__ */
|
|
284
|
-
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: [
|
|
285
359
|
e.name ? `${e.name} (${e.id})` : e.id,
|
|
286
360
|
e.hidden ? " \xB7 hidden" : ""
|
|
287
361
|
] }, e.id))
|
|
288
362
|
] });
|
|
289
363
|
case "enum":
|
|
290
|
-
return /* @__PURE__ */
|
|
291
|
-
!field.required && /* @__PURE__ */
|
|
292
|
-
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))
|
|
293
367
|
] });
|
|
294
368
|
case "boolean":
|
|
295
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ jsx6("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
|
|
296
370
|
case "ease":
|
|
297
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ jsx6(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
|
|
298
372
|
case "color":
|
|
299
|
-
return /* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
/* @__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) })
|
|
302
376
|
] });
|
|
303
377
|
case "point": {
|
|
304
378
|
const p = v ?? void 0;
|
|
305
|
-
return /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ jsx6(
|
|
306
380
|
CommitInput,
|
|
307
381
|
{
|
|
308
382
|
className: input,
|
|
@@ -319,8 +393,8 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
319
393
|
case "scale":
|
|
320
394
|
case "number":
|
|
321
395
|
case "integer":
|
|
322
|
-
return /* @__PURE__ */
|
|
323
|
-
/* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
397
|
+
/* @__PURE__ */ jsx6(
|
|
324
398
|
CommitInput,
|
|
325
399
|
{
|
|
326
400
|
className: input,
|
|
@@ -334,32 +408,32 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
334
408
|
onCommit: (raw) => commit(field, raw)
|
|
335
409
|
}
|
|
336
410
|
),
|
|
337
|
-
field.unit && /* @__PURE__ */
|
|
411
|
+
field.unit && /* @__PURE__ */ jsx6("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
|
|
338
412
|
] });
|
|
339
413
|
default:
|
|
340
|
-
return /* @__PURE__ */
|
|
414
|
+
return /* @__PURE__ */ jsx6(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
|
|
341
415
|
}
|
|
342
416
|
};
|
|
343
|
-
return /* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
/* @__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: [
|
|
346
420
|
index + 1,
|
|
347
421
|
". ",
|
|
348
422
|
command.type
|
|
349
423
|
] }),
|
|
350
|
-
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)" })
|
|
351
425
|
] }),
|
|
352
|
-
["main", "timing"].map((group) => /* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */
|
|
355
|
-
/* @__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: [
|
|
356
430
|
field.label,
|
|
357
431
|
field.required ? " *" : ""
|
|
358
432
|
] }),
|
|
359
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ jsx6("div", { "data-field": field.name, children: control(field) })
|
|
360
434
|
] }, field.name))
|
|
361
435
|
] }, group)),
|
|
362
|
-
message && /* @__PURE__ */
|
|
436
|
+
message && /* @__PURE__ */ jsx6("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
363
437
|
] });
|
|
364
438
|
}
|
|
365
439
|
|
|
@@ -371,8 +445,8 @@ import {
|
|
|
371
445
|
duplicateMotionCommandEdit,
|
|
372
446
|
motionCommandRows
|
|
373
447
|
} from "@pixerate/editor/animation-editor";
|
|
374
|
-
import { jsx as
|
|
375
|
-
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";
|
|
376
450
|
function CommandList({ controller, shot, targets, className = "" }) {
|
|
377
451
|
const state = useAnimationEditorState(controller);
|
|
378
452
|
const { scene, selection, readOnly, error } = state;
|
|
@@ -381,7 +455,7 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
381
455
|
const [type, setType] = useState2("enter");
|
|
382
456
|
const [local, setLocalState] = useState2(null);
|
|
383
457
|
const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
|
|
384
|
-
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." });
|
|
385
459
|
const rows = motionCommandRows(scene, current.id);
|
|
386
460
|
const selected = selection?.shot === current.id ? selection.command : void 0;
|
|
387
461
|
const run = (edit, label) => {
|
|
@@ -397,15 +471,15 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
397
471
|
if (result.ok) controller.select({ shot: current.id, command: at });
|
|
398
472
|
};
|
|
399
473
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
400
|
-
return /* @__PURE__ */
|
|
401
|
-
/* @__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: [
|
|
402
476
|
"Commands in ",
|
|
403
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ jsx7("span", { className: "text-rose-500", children: current.label ?? current.id })
|
|
404
478
|
] }),
|
|
405
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ jsx7("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
|
|
406
480
|
const c = row.command;
|
|
407
481
|
const isSelected = row.index === selected;
|
|
408
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ jsxs5(
|
|
409
483
|
"li",
|
|
410
484
|
{
|
|
411
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"}`,
|
|
@@ -413,18 +487,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
413
487
|
"data-selected": isSelected || void 0,
|
|
414
488
|
onClick: () => controller.select({ shot: current.id, command: row.index }),
|
|
415
489
|
children: [
|
|
416
|
-
/* @__PURE__ */
|
|
490
|
+
/* @__PURE__ */ jsxs5("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
|
|
417
491
|
row.index + 1,
|
|
418
492
|
". ",
|
|
419
493
|
row.summary
|
|
420
494
|
] }),
|
|
421
|
-
row.flairPrimitive && /* @__PURE__ */
|
|
422
|
-
/* @__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: [
|
|
423
497
|
((row.end - row.start) / 1e3).toFixed(2),
|
|
424
498
|
" s"
|
|
425
499
|
] }),
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
|
|
501
|
+
/* @__PURE__ */ jsxs5(
|
|
428
502
|
"select",
|
|
429
503
|
{
|
|
430
504
|
className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]",
|
|
@@ -436,14 +510,14 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
436
510
|
"Change start"
|
|
437
511
|
),
|
|
438
512
|
children: [
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ jsx7("option", { value: "after", children: "after previous" }),
|
|
514
|
+
/* @__PURE__ */ jsx7("option", { value: "previous", children: "with previous" })
|
|
441
515
|
]
|
|
442
516
|
}
|
|
443
517
|
),
|
|
444
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
|
|
445
519
|
"+",
|
|
446
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ jsx7(
|
|
447
521
|
"input",
|
|
448
522
|
{
|
|
449
523
|
className: "w-14 rounded border border-border bg-transparent px-1 py-0.5 text-[11px] tabular-nums",
|
|
@@ -467,11 +541,11 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
467
541
|
),
|
|
468
542
|
"ms"
|
|
469
543
|
] }),
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
/* @__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" })
|
|
475
549
|
] })
|
|
476
550
|
] })
|
|
477
551
|
]
|
|
@@ -479,18 +553,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
479
553
|
`${row.index}:${row.summary}`
|
|
480
554
|
);
|
|
481
555
|
}) }),
|
|
482
|
-
!readOnly && /* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
484
|
-
/* @__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" })
|
|
485
559
|
] }),
|
|
486
|
-
message && /* @__PURE__ */
|
|
560
|
+
message && /* @__PURE__ */ jsx7("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
487
561
|
] });
|
|
488
562
|
}
|
|
489
563
|
|
|
490
564
|
// src/animation-editor/PlayheadScrubber.tsx
|
|
491
|
-
import { useEffect as useEffect2, useRef as
|
|
565
|
+
import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
|
|
492
566
|
import { motionBeatTime, motionCueTime, motionRulerTicks } from "@pixerate/editor/animation-editor";
|
|
493
|
-
import { jsx as
|
|
567
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
494
568
|
var seconds2 = (ms) => `${(ms / 1e3).toFixed(2)} s`;
|
|
495
569
|
function worst2(issues) {
|
|
496
570
|
if (issues.some((i) => i.severity === "error")) return "error";
|
|
@@ -501,7 +575,7 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
501
575
|
const state = useAnimationEditorState(controller);
|
|
502
576
|
const { duration, shots, time, playing, selection, issues, scene, readOnly } = state;
|
|
503
577
|
const span = Math.max(1, duration);
|
|
504
|
-
const track =
|
|
578
|
+
const track = useRef3(null);
|
|
505
579
|
const [width, setWidth] = useState3(600);
|
|
506
580
|
useEffect2(() => {
|
|
507
581
|
const el = track.current;
|
|
@@ -520,16 +594,16 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
520
594
|
if (scene.beat && scene.beat.bpm > 0) {
|
|
521
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);
|
|
522
596
|
}
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__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: () => {
|
|
527
601
|
controller.pause();
|
|
528
602
|
controller.seek(0);
|
|
529
603
|
}, "aria-label": "Back to start", children: "\u23EE" }),
|
|
530
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
531
605
|
"Loop",
|
|
532
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ jsxs6(
|
|
533
607
|
"select",
|
|
534
608
|
{
|
|
535
609
|
className: "rounded border border-border bg-transparent px-1 py-0.5",
|
|
@@ -538,20 +612,20 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
538
612
|
"aria-label": "Loop",
|
|
539
613
|
onChange: (e) => controller.apply({ op: "set_settings", loop: e.target.value }, "Change loop"),
|
|
540
614
|
children: [
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
/* @__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" })
|
|
544
618
|
]
|
|
545
619
|
}
|
|
546
620
|
)
|
|
547
621
|
] }),
|
|
548
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ jsxs6("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
|
|
549
623
|
seconds2(time),
|
|
550
624
|
" / ",
|
|
551
625
|
seconds2(duration)
|
|
552
626
|
] })
|
|
553
627
|
] }),
|
|
554
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ jsxs6(
|
|
555
629
|
"div",
|
|
556
630
|
{
|
|
557
631
|
ref: track,
|
|
@@ -581,17 +655,17 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
581
655
|
e.preventDefault();
|
|
582
656
|
},
|
|
583
657
|
children: [
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
beats.map((t, i) => /* @__PURE__ */
|
|
586
|
-
scene.narration?.words.map((w, i) => /* @__PURE__ */
|
|
587
|
-
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))
|
|
588
662
|
] }),
|
|
589
|
-
/* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ jsx8("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
|
|
590
664
|
const mark = worst2(issues.filter((x) => x.shot === shot.id));
|
|
591
665
|
const selected = selection?.shot === shot.id;
|
|
592
666
|
const cue = scene.shots[i]?.at;
|
|
593
667
|
const cueTime = cue ? motionCueTime(scene, cue) : void 0;
|
|
594
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ jsxs6(
|
|
595
669
|
"button",
|
|
596
670
|
{
|
|
597
671
|
type: "button",
|
|
@@ -606,14 +680,14 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
606
680
|
controller.seekShot(shot.id);
|
|
607
681
|
},
|
|
608
682
|
children: [
|
|
609
|
-
mark && /* @__PURE__ */
|
|
683
|
+
mark && /* @__PURE__ */ jsx8("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
|
|
610
684
|
shot.label ?? shot.id
|
|
611
685
|
]
|
|
612
686
|
},
|
|
613
687
|
shot.id
|
|
614
688
|
);
|
|
615
689
|
}) }),
|
|
616
|
-
/* @__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": "" })
|
|
617
691
|
]
|
|
618
692
|
}
|
|
619
693
|
)
|
|
@@ -623,10 +697,10 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
623
697
|
// src/animation-editor/SceneSettings.tsx
|
|
624
698
|
import { useState as useState4 } from "react";
|
|
625
699
|
import { fitMotionSceneEdits, formatMotionDrivers, formatMotionNarration, parseMotionDrivers, parseMotionNarration } from "@pixerate/editor/animation-editor";
|
|
626
|
-
import { jsx as
|
|
700
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
627
701
|
var input2 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
628
|
-
var
|
|
629
|
-
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 });
|
|
630
704
|
function SceneSettings({ controller, className = "" }) {
|
|
631
705
|
const state = useAnimationEditorState(controller);
|
|
632
706
|
const { scene, readOnly, error, duration } = state;
|
|
@@ -659,32 +733,32 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
659
733
|
};
|
|
660
734
|
const beat = scene.beat;
|
|
661
735
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
662
|
-
return /* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
/* @__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" })
|
|
669
743
|
] }),
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
/* @__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)" })
|
|
676
750
|
] }),
|
|
677
|
-
/* @__PURE__ */
|
|
678
|
-
/* @__PURE__ */
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__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" })
|
|
684
758
|
] }),
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__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(
|
|
688
762
|
CommitInput,
|
|
689
763
|
{
|
|
690
764
|
className: input2,
|
|
@@ -700,9 +774,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
700
774
|
),
|
|
701
775
|
unit("fps")
|
|
702
776
|
] }),
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__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(
|
|
706
780
|
CommitInput,
|
|
707
781
|
{
|
|
708
782
|
className: input2,
|
|
@@ -718,9 +792,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
718
792
|
),
|
|
719
793
|
unit("fps")
|
|
720
794
|
] }),
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
[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(
|
|
724
798
|
CommitInput,
|
|
725
799
|
{
|
|
726
800
|
className: input2,
|
|
@@ -743,15 +817,15 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
743
817
|
)),
|
|
744
818
|
unit("s")
|
|
745
819
|
] }),
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__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) }),
|
|
749
823
|
unit("s"),
|
|
750
|
-
/* @__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" })
|
|
751
825
|
] }),
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
/* @__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(
|
|
755
829
|
CommitInput,
|
|
756
830
|
{
|
|
757
831
|
className: input2,
|
|
@@ -764,7 +838,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
764
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"))
|
|
765
839
|
}
|
|
766
840
|
),
|
|
767
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ jsx9(
|
|
768
842
|
CommitInput,
|
|
769
843
|
{
|
|
770
844
|
className: input2,
|
|
@@ -776,7 +850,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
776
850
|
onCommit: (raw) => beat && num(raw, "The offset is a number of ms.", () => true, (n) => settings({ beat: { ...beat, offset: n ?? 0 } }, "Change beat offset"))
|
|
777
851
|
}
|
|
778
852
|
),
|
|
779
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx9(
|
|
780
854
|
CommitInput,
|
|
781
855
|
{
|
|
782
856
|
className: input2,
|
|
@@ -792,9 +866,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
792
866
|
)
|
|
793
867
|
] })
|
|
794
868
|
] }),
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
/* @__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(
|
|
798
872
|
"textarea",
|
|
799
873
|
{
|
|
800
874
|
className: `${input2} h-20 font-mono`,
|
|
@@ -812,9 +886,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
812
886
|
formatMotionNarration(scene.narration)
|
|
813
887
|
)
|
|
814
888
|
] }),
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__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(
|
|
818
892
|
"textarea",
|
|
819
893
|
{
|
|
820
894
|
className: `${input2} h-14 font-mono`,
|
|
@@ -832,16 +906,16 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
832
906
|
formatMotionDrivers(scene.drivers)
|
|
833
907
|
)
|
|
834
908
|
] }),
|
|
835
|
-
message && /* @__PURE__ */
|
|
909
|
+
message && /* @__PURE__ */ jsx9("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
836
910
|
] });
|
|
837
911
|
}
|
|
838
912
|
|
|
839
913
|
// src/animation-editor/ShotInspector.tsx
|
|
840
914
|
import { useMemo as useMemo5, useState as useState5 } from "react";
|
|
841
915
|
import { describeMotionElements as describeMotionElements2, freshShotId, motionCueChoices, motionCueFromKey, motionCueKey } from "@pixerate/editor/animation-editor";
|
|
842
|
-
import { Fragment, jsx as
|
|
916
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
843
917
|
var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
844
|
-
var
|
|
918
|
+
var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
845
919
|
function ShotInspector({ controller, shot, className = "" }) {
|
|
846
920
|
const state = useAnimationEditorState(controller);
|
|
847
921
|
const { scene, selection, readOnly, error } = state;
|
|
@@ -873,34 +947,34 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
873
947
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
874
948
|
const cueKey = current ? motionCueKey(current.at) : "";
|
|
875
949
|
const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
|
|
876
|
-
return /* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
current && /* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
current && /* @__PURE__ */
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
/* @__PURE__ */
|
|
885
|
-
/* @__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" })
|
|
886
960
|
] })
|
|
887
961
|
] })
|
|
888
962
|
] }),
|
|
889
|
-
current && /* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
895
|
-
/* @__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" })
|
|
896
970
|
] }),
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__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" })
|
|
901
975
|
] }),
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Camera" }),
|
|
977
|
+
/* @__PURE__ */ jsxs8(
|
|
904
978
|
"select",
|
|
905
979
|
{
|
|
906
980
|
className: input3,
|
|
@@ -913,17 +987,17 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
913
987
|
else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { frame: v.slice(6), padding: 24 } } }, "Frame camera");
|
|
914
988
|
},
|
|
915
989
|
children: [
|
|
916
|
-
/* @__PURE__ */
|
|
917
|
-
current.camera && !frame && /* @__PURE__ */
|
|
918
|
-
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: [
|
|
919
993
|
"frame ",
|
|
920
994
|
e.name ?? e.id
|
|
921
995
|
] }, e.id))
|
|
922
996
|
]
|
|
923
997
|
}
|
|
924
998
|
),
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Starts on" }),
|
|
1000
|
+
/* @__PURE__ */ jsxs8(
|
|
927
1001
|
"select",
|
|
928
1002
|
{
|
|
929
1003
|
className: input3,
|
|
@@ -935,33 +1009,33 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
935
1009
|
apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
|
|
936
1010
|
},
|
|
937
1011
|
children: [
|
|
938
|
-
/* @__PURE__ */
|
|
939
|
-
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */
|
|
940
|
-
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))
|
|
941
1015
|
]
|
|
942
1016
|
}
|
|
943
1017
|
),
|
|
944
|
-
!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." })
|
|
945
1019
|
] }),
|
|
946
|
-
message && /* @__PURE__ */
|
|
1020
|
+
message && /* @__PURE__ */ jsx10("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
947
1021
|
] });
|
|
948
1022
|
}
|
|
949
1023
|
|
|
950
1024
|
// src/animation-editor/AnimationEffectsPanel.tsx
|
|
951
1025
|
import { useMemo as useMemo6, useState as useState6 } from "react";
|
|
952
1026
|
import { indexMotionNodes } from "@pixerate/editor/animation-editor";
|
|
953
|
-
import { Fragment as
|
|
954
|
-
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";
|
|
955
1029
|
function Controls({ controller, instance, effect, values }) {
|
|
956
1030
|
const provider = controller.effectsProvider;
|
|
957
1031
|
const { description, error } = useEffectDescription(provider, effect);
|
|
958
1032
|
const [message, setMessage] = useState6(null);
|
|
959
1033
|
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
960
|
-
if (!provider) return /* @__PURE__ */
|
|
961
|
-
if (error) return /* @__PURE__ */
|
|
962
|
-
if (!description) return /* @__PURE__ */
|
|
963
|
-
return /* @__PURE__ */
|
|
964
|
-
/* @__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(
|
|
965
1039
|
EffectParameters,
|
|
966
1040
|
{
|
|
967
1041
|
description,
|
|
@@ -971,7 +1045,7 @@ function Controls({ controller, instance, effect, values }) {
|
|
|
971
1045
|
onPreset: (v) => report(controller.updateMotionEffect(instance, v))
|
|
972
1046
|
}
|
|
973
1047
|
),
|
|
974
|
-
message && /* @__PURE__ */
|
|
1048
|
+
message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
975
1049
|
] });
|
|
976
1050
|
}
|
|
977
1051
|
function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
@@ -986,49 +1060,86 @@ function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
|
986
1060
|
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
|
|
987
1061
|
const applied = useMemo6(() => controller.appliedEffects(), [controller, state.scene]);
|
|
988
1062
|
const disabled = state.readOnly;
|
|
989
|
-
return /* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
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))
|
|
995
1069
|
] }),
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__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" })
|
|
998
1072
|
] }),
|
|
999
|
-
!provider && /* @__PURE__ */
|
|
1000
|
-
browse === "motion" && /* @__PURE__ */
|
|
1001
|
-
browse === "vector" && /* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__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: [
|
|
1005
1079
|
e.name ?? e.effect,
|
|
1006
1080
|
" ",
|
|
1007
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
1008
1082
|
"\xB7 ",
|
|
1009
1083
|
e.kind === "vector" ? "picture" : e.targets.join(", ")
|
|
1010
1084
|
] })
|
|
1011
1085
|
] }),
|
|
1012
|
-
/* @__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" })
|
|
1013
1087
|
] }),
|
|
1014
|
-
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 }) })
|
|
1015
1089
|
] }, e.instance)) }),
|
|
1016
|
-
!applied.length && /* @__PURE__ */
|
|
1017
|
-
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 })
|
|
1018
1092
|
] });
|
|
1019
1093
|
}
|
|
1020
1094
|
|
|
1021
1095
|
// src/animation-editor/AnimationEditor.tsx
|
|
1022
|
-
import { Fragment as
|
|
1096
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1023
1097
|
var ONION = { before: 3, after: 1 };
|
|
1024
|
-
var
|
|
1025
|
-
function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "" }) {
|
|
1098
|
+
var btn6 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
1099
|
+
function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
|
|
1026
1100
|
const state = useAnimationEditorState(controller);
|
|
1101
|
+
const rootRef = useRef4(null);
|
|
1102
|
+
const ambientPlayback = useAgentPlayback();
|
|
1103
|
+
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
1104
|
+
const rectIn = (el) => {
|
|
1105
|
+
const box = rootRef.current?.getBoundingClientRect();
|
|
1106
|
+
const r = el?.getBoundingClientRect();
|
|
1107
|
+
return box && r && r.width > 0 ? { x: r.left - box.left, y: r.top - box.top, width: r.width, height: r.height } : null;
|
|
1108
|
+
};
|
|
1109
|
+
const agentPresence = usePlaybackSurface(playing, playbackId, {
|
|
1110
|
+
defaultKind: "shot",
|
|
1111
|
+
locate: (ref) => {
|
|
1112
|
+
const root = rootRef.current;
|
|
1113
|
+
if (!root) return null;
|
|
1114
|
+
if (ref.kind === "shot") return rectIn(root.querySelector(`[data-shot="${CSS.escape(ref.id)}"]`));
|
|
1115
|
+
if (ref.kind === "element") return rectIn(root.querySelector(`[data-animation-stage] [id="ae-${CSS.escape(ref.id)}"]`));
|
|
1116
|
+
return null;
|
|
1117
|
+
},
|
|
1118
|
+
bounds: () => {
|
|
1119
|
+
const r = rootRef.current?.getBoundingClientRect();
|
|
1120
|
+
return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
|
|
1121
|
+
},
|
|
1122
|
+
visible: () => {
|
|
1123
|
+
const r = rootRef.current?.getBoundingClientRect();
|
|
1124
|
+
return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
|
|
1125
|
+
},
|
|
1126
|
+
toViewport: (p) => {
|
|
1127
|
+
const r = rootRef.current?.getBoundingClientRect();
|
|
1128
|
+
return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
|
|
1129
|
+
},
|
|
1130
|
+
fromViewport: (p) => {
|
|
1131
|
+
const r = rootRef.current?.getBoundingClientRect();
|
|
1132
|
+
return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
|
|
1133
|
+
},
|
|
1134
|
+
reveal: () => onPlaybackReveal?.()
|
|
1135
|
+
});
|
|
1136
|
+
const presenceLayer = playing ? /* @__PURE__ */ jsx12(PresenceLayer, { presence: agentPresence }) : null;
|
|
1027
1137
|
useEffects(controller, effects);
|
|
1028
1138
|
const { issues, scene, selection, readOnly } = state;
|
|
1029
1139
|
const [picked, setPicked] = useState7(null);
|
|
1030
1140
|
const [onion, setOnion] = useState7(false);
|
|
1031
1141
|
const [paths, setPaths] = useState7(false);
|
|
1142
|
+
const [recordMode, setRecordMode] = useState7("move");
|
|
1032
1143
|
const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
|
|
1033
1144
|
const targets = command && "targets" in command ? command.targets : [];
|
|
1034
1145
|
const nodes = useMemo7(() => indexMotionNodes2(scene.artwork.nodes), [scene.artwork]);
|
|
@@ -1041,7 +1152,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1041
1152
|
}
|
|
1042
1153
|
setPicked(id);
|
|
1043
1154
|
};
|
|
1044
|
-
const stage = /* @__PURE__ */
|
|
1155
|
+
const stage = /* @__PURE__ */ jsx12(
|
|
1045
1156
|
AnimationStage,
|
|
1046
1157
|
{
|
|
1047
1158
|
controller,
|
|
@@ -1050,20 +1161,23 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1050
1161
|
motionPaths: motionPaths ?? paths,
|
|
1051
1162
|
onPick: editable ? onPick : void 0,
|
|
1052
1163
|
highlight: editable ? [...pickedValid ? [pickedValid] : [], ...targets] : void 0,
|
|
1164
|
+
recordMode,
|
|
1053
1165
|
className: "rounded-md border border-border bg-muted/40"
|
|
1054
1166
|
}
|
|
1055
1167
|
);
|
|
1056
|
-
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)) });
|
|
1057
1169
|
if (!editable)
|
|
1058
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ jsxs10("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
|
|
1171
|
+
presenceLayer,
|
|
1059
1172
|
stage,
|
|
1060
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ jsx12(PlayheadScrubber, { controller }),
|
|
1061
1174
|
issueList
|
|
1062
1175
|
] });
|
|
1063
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */ jsxs10(
|
|
1064
1177
|
"div",
|
|
1065
1178
|
{
|
|
1066
|
-
|
|
1179
|
+
ref: rootRef,
|
|
1180
|
+
className: `relative grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
|
|
1067
1181
|
"data-animation-editor": "",
|
|
1068
1182
|
onKeyDown: (e) => {
|
|
1069
1183
|
const el = e.target;
|
|
@@ -1073,40 +1187,42 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1073
1187
|
else controller.undo();
|
|
1074
1188
|
},
|
|
1075
1189
|
children: [
|
|
1076
|
-
|
|
1190
|
+
presenceLayer,
|
|
1191
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
1077
1192
|
stage,
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1082
|
-
onionSkin === void 0 && /* @__PURE__ */
|
|
1083
|
-
/* @__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) }),
|
|
1084
1199
|
" Onion skin"
|
|
1085
1200
|
] }),
|
|
1086
|
-
motionPaths === void 0 && /* @__PURE__ */
|
|
1087
|
-
/* @__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) }),
|
|
1088
1203
|
" Motion paths"
|
|
1089
1204
|
] }),
|
|
1090
|
-
/* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ jsx12("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1091
1206
|
"Picked ",
|
|
1092
|
-
/* @__PURE__ */
|
|
1207
|
+
/* @__PURE__ */ jsx12("code", { className: "text-rose-500", children: pickedValid }),
|
|
1093
1208
|
" ",
|
|
1094
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
|
|
1095
1210
|
] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
|
|
1096
1211
|
] }),
|
|
1212
|
+
!readOnly && /* @__PURE__ */ jsx12(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
|
|
1097
1213
|
issueList
|
|
1098
1214
|
] }),
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__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" })
|
|
1106
1222
|
] }),
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__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" })
|
|
1110
1226
|
] })
|
|
1111
1227
|
] })
|
|
1112
1228
|
]
|
|
@@ -1116,6 +1232,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1116
1232
|
export {
|
|
1117
1233
|
AnimationEditor,
|
|
1118
1234
|
AnimationEffectsPanel,
|
|
1235
|
+
AnimationRecordPanel,
|
|
1119
1236
|
AnimationStage,
|
|
1120
1237
|
CommandInspector,
|
|
1121
1238
|
CommandList,
|