@pixerate/editor-react 0.93.1 → 0.95.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/README.md +1 -1
- 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/dist/canvas/index.cjs +3 -1
- package/dist/canvas/index.js +5 -2
- package/dist/canvas/useMermaidDiagram.d.cts +7 -1
- package/dist/canvas/useMermaidDiagram.d.ts +7 -1
- package/dist/{chunk-NNM633RN.js → chunk-R7MEGRPV.js} +23 -0
- package/dist/index.cjs +81 -60
- package/dist/index.js +4 -2
- package/dist/persistence/index.cjs +25 -4
- package/dist/persistence/index.d.cts +1 -0
- package/dist/persistence/index.d.ts +1 -0
- package/dist/persistence/index.js +5 -3
- package/dist/persistence/useEditorAutosave.d.cts +17 -0
- package/dist/persistence/useEditorAutosave.d.ts +17 -0
- package/package.json +3 -3
|
@@ -32,6 +32,7 @@ var animation_editor_exports = {};
|
|
|
32
32
|
__export(animation_editor_exports, {
|
|
33
33
|
AnimationEditor: () => AnimationEditor,
|
|
34
34
|
AnimationEffectsPanel: () => AnimationEffectsPanel,
|
|
35
|
+
AnimationRecordPanel: () => AnimationRecordPanel,
|
|
35
36
|
AnimationStage: () => AnimationStage,
|
|
36
37
|
CommandInspector: () => CommandInspector,
|
|
37
38
|
CommandList: () => CommandList,
|
|
@@ -104,26 +105,44 @@ function useAnimationEffectsTools(registry, controller, options = {}) {
|
|
|
104
105
|
var import_react2 = require("react");
|
|
105
106
|
var import_animation_editor2 = require("@pixerate/editor/animation-editor");
|
|
106
107
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
107
|
-
function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, className = "" }) {
|
|
108
|
+
function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, recordMode = "move", className = "" }) {
|
|
108
109
|
const state = useAnimationEditorState(controller);
|
|
109
|
-
const { scene, time } = state;
|
|
110
|
+
const { scene, time, recording } = state;
|
|
111
|
+
const samples = recording?.samples ?? -1;
|
|
112
|
+
const dragging = (0, import_react2.useRef)(null);
|
|
113
|
+
const point = (e) => controller.clientToDocument(e.currentTarget.getBoundingClientRect(), e.clientX, e.clientY);
|
|
110
114
|
const key = highlight?.join("\0") ?? "";
|
|
111
115
|
const svg = (0, import_react2.useMemo)(
|
|
112
116
|
() => (0, import_animation_editor2.highlightMotionSvg)(
|
|
113
117
|
controller.toSvg(time, { pretty: false, idPrefix: "ae-", values, onionSkin, motionPaths }).replace(/<svg ([^>]*?)width="[^"]*" height="[^"]*"/, '<svg $1width="100%" height="100%"'),
|
|
114
118
|
highlight ?? []
|
|
115
119
|
),
|
|
116
|
-
[controller, scene, time, values, onionSkin, motionPaths, key]
|
|
120
|
+
[controller, scene, time, samples, values, onionSkin, motionPaths, key]
|
|
117
121
|
);
|
|
118
122
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
123
|
"div",
|
|
120
124
|
{
|
|
121
|
-
className: `relative overflow-hidden ${onPick ? "cursor-crosshair" : ""} ${className}`,
|
|
125
|
+
className: `relative overflow-hidden ${recording ? "cursor-grab touch-none" : onPick ? "cursor-crosshair" : ""} ${className}`,
|
|
122
126
|
style: { aspectRatio: `${scene.artwork.width} / ${scene.artwork.height}` },
|
|
123
127
|
"data-animation-stage": "",
|
|
128
|
+
"data-recording": recording ? "" : void 0,
|
|
124
129
|
role: "img",
|
|
125
130
|
"aria-label": `${scene.name} at ${(time / 1e3).toFixed(2)} s`,
|
|
126
131
|
onClick: onPick ? (e) => onPick((0, import_animation_editor2.motionNodeAtElement)(scene, e.target, e.currentTarget), e) : void 0,
|
|
132
|
+
onPointerDown: recording ? (e) => {
|
|
133
|
+
const id = (0, import_animation_editor2.motionNodeAtElement)(scene, e.target, e.currentTarget);
|
|
134
|
+
if (!id || !controller.beginRecordGesture(id, recordMode, point(e))) return;
|
|
135
|
+
dragging.current = e.pointerId;
|
|
136
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
} : void 0,
|
|
139
|
+
onPointerMove: recording ? (e) => dragging.current === e.pointerId && controller.updateRecordGesture(point(e)) : void 0,
|
|
140
|
+
onPointerUp: recording ? (e) => {
|
|
141
|
+
if (dragging.current !== e.pointerId) return;
|
|
142
|
+
dragging.current = null;
|
|
143
|
+
controller.endRecordGesture();
|
|
144
|
+
} : void 0,
|
|
145
|
+
onPointerCancel: recording ? () => (dragging.current = null, controller.endRecordGesture()) : void 0,
|
|
127
146
|
dangerouslySetInnerHTML: { __html: svg }
|
|
128
147
|
}
|
|
129
148
|
);
|
|
@@ -290,25 +309,76 @@ function PresenceLayer({ presence, viewport, className = "" }) {
|
|
|
290
309
|
}
|
|
291
310
|
|
|
292
311
|
// src/animation-editor/AnimationEditor.tsx
|
|
293
|
-
var
|
|
312
|
+
var import_animation_editor11 = require("@pixerate/editor/animation-editor");
|
|
313
|
+
|
|
314
|
+
// src/animation-editor/AnimationRecordPanel.tsx
|
|
315
|
+
var import_animation_editor3 = require("@pixerate/editor/animation-editor");
|
|
316
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
317
|
+
var btn = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
318
|
+
var MODE_LABELS = { move: "Move", scale: "Scale", rotate: "Rotate" };
|
|
319
|
+
var hex6 = (c) => c && /^#[0-9a-f]{6}/i.test(c) ? c.slice(0, 7).toLowerCase() : "#000000";
|
|
320
|
+
function AnimationRecordPanel({ controller, node, mode, onModeChange, className = "" }) {
|
|
321
|
+
const state = useAnimationEditorState(controller);
|
|
322
|
+
const { recording, readOnly, error } = state;
|
|
323
|
+
const pose = recording && node ? controller.pose(node) : null;
|
|
324
|
+
const sample = (values) => node && controller.recordSample(node, values);
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs ${className}`, "data-animation-record": "", children: [
|
|
326
|
+
recording ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
327
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: `${btn} border-red-500 text-red-600`, onClick: () => controller.stopRecording(), "data-record-stop": "", children: "\u25A0 Stop" }),
|
|
328
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, onClick: () => controller.cancelRecording(), "data-record-cancel": "", children: "Cancel" }),
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, onClick: () => controller.toggle(), children: state.playing ? "Pause" : "Resume" }),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "tabular-nums text-red-600", "aria-live": "polite", children: [
|
|
331
|
+
"\u25CF REC ",
|
|
332
|
+
(recording.elapsed / 1e3).toFixed(1),
|
|
333
|
+
" s \xB7 ",
|
|
334
|
+
recording.samples,
|
|
335
|
+
" samples"
|
|
336
|
+
] })
|
|
337
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": "Drag to", children: [
|
|
339
|
+
"Drag to",
|
|
340
|
+
import_animation_editor3.MOTION_RECORD_GESTURE_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-0.5", children: [
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "radio", name: "animation-record-mode", checked: mode === m, onChange: () => onModeChange(m) }),
|
|
342
|
+
" ",
|
|
343
|
+
MODE_LABELS[m]
|
|
344
|
+
] }, m))
|
|
345
|
+
] }),
|
|
346
|
+
pose && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-2", "data-record-paint": "", children: [
|
|
347
|
+
pose.fill !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
348
|
+
"Fill ",
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", value: hex6(pose.fill), onChange: (e) => sample({ fill: e.target.value }) })
|
|
350
|
+
] }),
|
|
351
|
+
pose.stroke !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
352
|
+
"Stroke ",
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", value: hex6(pose.stroke), onChange: (e) => sample({ stroke: e.target.value }) })
|
|
354
|
+
] }),
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
356
|
+
"Opacity ",
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "range", min: 0, max: 1, step: 0.01, value: pose.opacity, onChange: (e) => sample({ opacity: Number(e.target.value) }) })
|
|
358
|
+
] })
|
|
359
|
+
] }),
|
|
360
|
+
recording && !node && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground", children: "Drag an element; click one to record its paint and opacity." }),
|
|
361
|
+
!recording && error && /record/i.test(error) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-amber-600", children: error })
|
|
362
|
+
] });
|
|
363
|
+
}
|
|
294
364
|
|
|
295
365
|
// src/animation-editor/CommandInspector.tsx
|
|
296
366
|
var import_react7 = __toESM(require("react"), 1);
|
|
297
|
-
var
|
|
367
|
+
var import_animation_editor5 = require("@pixerate/editor/animation-editor");
|
|
298
368
|
|
|
299
369
|
// src/animation-editor/EasePicker.tsx
|
|
300
370
|
var import_react6 = require("react");
|
|
301
|
-
var
|
|
302
|
-
var
|
|
371
|
+
var import_animation_editor4 = require("@pixerate/editor/animation-editor");
|
|
372
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
303
373
|
var W = 72;
|
|
304
374
|
var H = 44;
|
|
305
375
|
function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
306
|
-
const key = (0,
|
|
307
|
-
const curve = (0, import_react6.useMemo)(() => (0,
|
|
308
|
-
const guides = (0,
|
|
376
|
+
const key = (0, import_animation_editor4.motionEaseKey)(value);
|
|
377
|
+
const curve = (0, import_react6.useMemo)(() => (0, import_animation_editor4.motionEasingCurve)(value ?? "ease-out"), [value]);
|
|
378
|
+
const guides = (0, import_animation_editor4.motionEasingGuides)(curve, H);
|
|
309
379
|
const spring = typeof value === "string" ? value.startsWith("spring") : value?.type === "spring";
|
|
310
|
-
return /* @__PURE__ */ (0,
|
|
311
|
-
/* @__PURE__ */ (0,
|
|
380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
|
|
381
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
312
382
|
"select",
|
|
313
383
|
{
|
|
314
384
|
className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -320,17 +390,17 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
320
390
|
onChange(e.target.value ? e.target.value : void 0);
|
|
321
391
|
},
|
|
322
392
|
children: [
|
|
323
|
-
|
|
324
|
-
key === "custom" && /* @__PURE__ */ (0,
|
|
393
|
+
import_animation_editor4.MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: c.value, children: c.label }, c.value)),
|
|
394
|
+
key === "custom" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "custom", children: "Custom" })
|
|
325
395
|
]
|
|
326
396
|
}
|
|
327
397
|
),
|
|
328
|
-
/* @__PURE__ */ (0,
|
|
329
|
-
/* @__PURE__ */ (0,
|
|
330
|
-
/* @__PURE__ */ (0,
|
|
331
|
-
/* @__PURE__ */ (0,
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("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: [
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: 0, x2: W, y1: guides.zero, y2: guides.zero, stroke: "currentColor", strokeOpacity: 0.2 }),
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: 0, x2: W, y1: guides.one, y2: guides.one, stroke: "currentColor", strokeOpacity: 0.2, strokeDasharray: "2 2" }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: (0, import_animation_editor4.motionEasingPath)(curve, W, H), fill: "none", stroke: "#f43f5e", strokeWidth: 1.5 })
|
|
332
402
|
] }),
|
|
333
|
-
spring && /* @__PURE__ */ (0,
|
|
403
|
+
spring && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
|
|
334
404
|
Math.round(curve.durationMs),
|
|
335
405
|
" ms"
|
|
336
406
|
] })
|
|
@@ -338,9 +408,9 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
|
|
|
338
408
|
}
|
|
339
409
|
|
|
340
410
|
// src/animation-editor/CommitInput.tsx
|
|
341
|
-
var
|
|
411
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
342
412
|
function CommitInput({ value, onCommit, ...rest }) {
|
|
343
|
-
return /* @__PURE__ */ (0,
|
|
413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
344
414
|
"input",
|
|
345
415
|
{
|
|
346
416
|
...rest,
|
|
@@ -355,25 +425,25 @@ function CommitInput({ value, onCommit, ...rest }) {
|
|
|
355
425
|
}
|
|
356
426
|
|
|
357
427
|
// src/animation-editor/CommandInspector.tsx
|
|
358
|
-
var
|
|
428
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
359
429
|
var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
360
430
|
function CommandInspector({ controller, picked, className = "" }) {
|
|
361
431
|
const state = useAnimationEditorState(controller);
|
|
362
432
|
const { scene, selection, readOnly, error } = state;
|
|
363
433
|
const [local, setLocalState] = (0, import_react7.useState)(null);
|
|
364
434
|
const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
|
|
365
|
-
const elements = (0, import_react7.useMemo)(() => (0,
|
|
435
|
+
const elements = (0, import_react7.useMemo)(() => (0, import_animation_editor5.describeMotionElements)(scene), [scene.artwork]);
|
|
366
436
|
const shot = selection ? scene.shots.find((s) => s.id === selection.shot) : void 0;
|
|
367
437
|
const index = selection?.command;
|
|
368
438
|
const command = shot && index !== void 0 ? shot.run[index] : void 0;
|
|
369
439
|
if (!shot || index === void 0 || !command) {
|
|
370
|
-
return /* @__PURE__ */ (0,
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
|
|
371
441
|
}
|
|
372
442
|
const values = command;
|
|
373
|
-
const fields = (0,
|
|
374
|
-
const primitive = (0,
|
|
443
|
+
const fields = (0, import_animation_editor5.motionCommandFields)(command.type);
|
|
444
|
+
const primitive = (0, import_animation_editor5.motionFlairPrimitive)(command);
|
|
375
445
|
const commit = (field, raw) => {
|
|
376
|
-
const edit = (0,
|
|
446
|
+
const edit = (0, import_animation_editor5.motionFieldEdit)(shot.id, index, field, raw);
|
|
377
447
|
if ("error" in edit) return setLocal(edit.error);
|
|
378
448
|
setLocal(null);
|
|
379
449
|
controller.apply(edit, `Set ${field.label.toLowerCase()}`);
|
|
@@ -386,45 +456,45 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
386
456
|
const common = { disabled: readOnly, "aria-label": field.label, title: field.description };
|
|
387
457
|
switch (field.kind) {
|
|
388
458
|
case "targets":
|
|
389
|
-
return /* @__PURE__ */ (0,
|
|
390
|
-
targets.map((id) => /* @__PURE__ */ (0,
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-targets": "", children: [
|
|
460
|
+
targets.map((id) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-0.5 rounded bg-muted px-1 text-[11px]", "data-target": id, children: [
|
|
391
461
|
name(id),
|
|
392
|
-
!readOnly && targets.length > 1 && /* @__PURE__ */ (0,
|
|
462
|
+
!readOnly && targets.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": `Remove ${id}`, onClick: () => commit(field, targets.filter((t) => t !== id)), children: "\xD7" })
|
|
393
463
|
] }, id)),
|
|
394
|
-
!readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ (0,
|
|
464
|
+
!readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("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: [
|
|
395
465
|
"+ ",
|
|
396
466
|
name(picked)
|
|
397
467
|
] }),
|
|
398
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
399
|
-
/* @__PURE__ */ (0,
|
|
400
|
-
elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ (0,
|
|
468
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("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: [
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "+ target\u2026" }),
|
|
470
|
+
elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: e.id, children: e.name ? `${e.name} (${e.id})` : e.id }, e.id))
|
|
401
471
|
] })
|
|
402
472
|
] });
|
|
403
473
|
case "node":
|
|
404
|
-
return /* @__PURE__ */ (0,
|
|
405
|
-
!field.required && /* @__PURE__ */ (0,
|
|
406
|
-
elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ (0,
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
|
|
475
|
+
!field.required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "\u2014" }),
|
|
476
|
+
elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("option", { value: e.id, children: [
|
|
407
477
|
e.name ? `${e.name} (${e.id})` : e.id,
|
|
408
478
|
e.hidden ? " \xB7 hidden" : ""
|
|
409
479
|
] }, e.id))
|
|
410
480
|
] });
|
|
411
481
|
case "enum":
|
|
412
|
-
return /* @__PURE__ */ (0,
|
|
413
|
-
!field.required && /* @__PURE__ */ (0,
|
|
414
|
-
field.options.map((o) => /* @__PURE__ */ (0,
|
|
482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
|
|
483
|
+
!field.required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "default" }),
|
|
484
|
+
field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o, children: o }, o))
|
|
415
485
|
] });
|
|
416
486
|
case "boolean":
|
|
417
|
-
return /* @__PURE__ */ (0,
|
|
487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
|
|
418
488
|
case "ease":
|
|
419
|
-
return /* @__PURE__ */ (0,
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
|
|
420
490
|
case "color":
|
|
421
|
-
return /* @__PURE__ */ (0,
|
|
422
|
-
/* @__PURE__ */ (0,
|
|
423
|
-
/* @__PURE__ */ (0,
|
|
491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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) }),
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", placeholder: "unchanged", onCommit: (raw) => commit(field, raw) })
|
|
424
494
|
] });
|
|
425
495
|
case "point": {
|
|
426
496
|
const p = v ?? void 0;
|
|
427
|
-
return /* @__PURE__ */ (0,
|
|
497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
428
498
|
CommitInput,
|
|
429
499
|
{
|
|
430
500
|
className: input,
|
|
@@ -441,8 +511,8 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
441
511
|
case "scale":
|
|
442
512
|
case "number":
|
|
443
513
|
case "integer":
|
|
444
|
-
return /* @__PURE__ */ (0,
|
|
445
|
-
/* @__PURE__ */ (0,
|
|
514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
446
516
|
CommitInput,
|
|
447
517
|
{
|
|
448
518
|
className: input,
|
|
@@ -456,40 +526,40 @@ function CommandInspector({ controller, picked, className = "" }) {
|
|
|
456
526
|
onCommit: (raw) => commit(field, raw)
|
|
457
527
|
}
|
|
458
528
|
),
|
|
459
|
-
field.unit && /* @__PURE__ */ (0,
|
|
529
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
|
|
460
530
|
] });
|
|
461
531
|
default:
|
|
462
|
-
return /* @__PURE__ */ (0,
|
|
532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
|
|
463
533
|
}
|
|
464
534
|
};
|
|
465
|
-
return /* @__PURE__ */ (0,
|
|
466
|
-
/* @__PURE__ */ (0,
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-command-inspector": "", "data-command-type": command.type, children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "font-medium", children: [
|
|
468
538
|
index + 1,
|
|
469
539
|
". ",
|
|
470
540
|
command.type
|
|
471
541
|
] }),
|
|
472
|
-
primitive ? /* @__PURE__ */ (0,
|
|
542
|
+
primitive ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "rounded bg-muted px-1 text-[10px]", "data-flair-primitive": primitive, title: "The Flair motion primitive this command plays", children: primitive }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "editor-only (no Flair primitive)" })
|
|
473
543
|
] }),
|
|
474
|
-
["main", "timing"].map((group) => /* @__PURE__ */ (0,
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
476
|
-
fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ (0,
|
|
477
|
-
/* @__PURE__ */ (0,
|
|
544
|
+
["main", "timing"].map((group) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("fieldset", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("legend", { className: "mb-1 text-[10px] uppercase tracking-wide text-muted-foreground", children: group === "main" ? "Command" : "Timing" }),
|
|
546
|
+
fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.default.Fragment, { children: [
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "truncate text-muted-foreground", title: field.description, children: [
|
|
478
548
|
field.label,
|
|
479
549
|
field.required ? " *" : ""
|
|
480
550
|
] }),
|
|
481
|
-
/* @__PURE__ */ (0,
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { "data-field": field.name, children: control(field) })
|
|
482
552
|
] }, field.name))
|
|
483
553
|
] }, group)),
|
|
484
|
-
message && /* @__PURE__ */ (0,
|
|
554
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
485
555
|
] });
|
|
486
556
|
}
|
|
487
557
|
|
|
488
558
|
// src/animation-editor/CommandList.tsx
|
|
489
559
|
var import_react8 = require("react");
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
var
|
|
560
|
+
var import_animation_editor6 = require("@pixerate/editor/animation-editor");
|
|
561
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
562
|
+
var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
493
563
|
function CommandList({ controller, shot, targets, className = "" }) {
|
|
494
564
|
const state = useAnimationEditorState(controller);
|
|
495
565
|
const { scene, selection, readOnly, error } = state;
|
|
@@ -498,8 +568,8 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
498
568
|
const [type, setType] = (0, import_react8.useState)("enter");
|
|
499
569
|
const [local, setLocalState] = (0, import_react8.useState)(null);
|
|
500
570
|
const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
|
|
501
|
-
if (!current) return /* @__PURE__ */ (0,
|
|
502
|
-
const rows = (0,
|
|
571
|
+
if (!current) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-list": "", children: "Add a shot to start." });
|
|
572
|
+
const rows = (0, import_animation_editor6.motionCommandRows)(scene, current.id);
|
|
503
573
|
const selected = selection?.shot === current.id ? selection.command : void 0;
|
|
504
574
|
const run = (edit, label) => {
|
|
505
575
|
setLocal(null);
|
|
@@ -507,22 +577,22 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
507
577
|
};
|
|
508
578
|
const add = () => {
|
|
509
579
|
const from = targets?.length ? targets : selected !== void 0 ? current.run[selected].targets ?? [] : [];
|
|
510
|
-
const command = (0,
|
|
580
|
+
const command = (0, import_animation_editor6.defaultMotionCommand)(type, from, scene);
|
|
511
581
|
if ("error" in command) return setLocal(command.error);
|
|
512
582
|
const at = selected !== void 0 ? selected + 1 : current.run.length;
|
|
513
583
|
const result = run({ op: "add_commands", shot: current.id, commands: [command], at }, `Add ${type}`);
|
|
514
584
|
if (result.ok) controller.select({ shot: current.id, command: at });
|
|
515
585
|
};
|
|
516
586
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
517
|
-
return /* @__PURE__ */ (0,
|
|
518
|
-
/* @__PURE__ */ (0,
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-command-list": "", "data-for-shot": current.id, children: [
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "font-medium", children: [
|
|
519
589
|
"Commands in ",
|
|
520
|
-
/* @__PURE__ */ (0,
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-rose-500", children: current.label ?? current.id })
|
|
521
591
|
] }),
|
|
522
|
-
/* @__PURE__ */ (0,
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
|
|
523
593
|
const c = row.command;
|
|
524
594
|
const isSelected = row.index === selected;
|
|
525
|
-
return /* @__PURE__ */ (0,
|
|
595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
526
596
|
"li",
|
|
527
597
|
{
|
|
528
598
|
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"}`,
|
|
@@ -530,18 +600,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
530
600
|
"data-selected": isSelected || void 0,
|
|
531
601
|
onClick: () => controller.select({ shot: current.id, command: row.index }),
|
|
532
602
|
children: [
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
603
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
|
|
534
604
|
row.index + 1,
|
|
535
605
|
". ",
|
|
536
606
|
row.summary
|
|
537
607
|
] }),
|
|
538
|
-
row.flairPrimitive && /* @__PURE__ */ (0,
|
|
539
|
-
/* @__PURE__ */ (0,
|
|
608
|
+
row.flairPrimitive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", "data-flair-primitive": row.flairPrimitive, children: row.flairPrimitive }),
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "tabular-nums text-[10px] text-muted-foreground", children: [
|
|
540
610
|
((row.end - row.start) / 1e3).toFixed(2),
|
|
541
611
|
" s"
|
|
542
612
|
] }),
|
|
543
|
-
/* @__PURE__ */ (0,
|
|
544
|
-
/* @__PURE__ */ (0,
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
|
|
614
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
545
615
|
"select",
|
|
546
616
|
{
|
|
547
617
|
className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]",
|
|
@@ -553,14 +623,14 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
553
623
|
"Change start"
|
|
554
624
|
),
|
|
555
625
|
children: [
|
|
556
|
-
/* @__PURE__ */ (0,
|
|
557
|
-
/* @__PURE__ */ (0,
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "after", children: "after previous" }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "previous", children: "with previous" })
|
|
558
628
|
]
|
|
559
629
|
}
|
|
560
630
|
),
|
|
561
|
-
/* @__PURE__ */ (0,
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
|
|
562
632
|
"+",
|
|
563
|
-
/* @__PURE__ */ (0,
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
564
634
|
"input",
|
|
565
635
|
{
|
|
566
636
|
className: "w-14 rounded border border-border bg-transparent px-1 py-0.5 text-[11px] tabular-nums",
|
|
@@ -584,11 +654,11 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
584
654
|
),
|
|
585
655
|
"ms"
|
|
586
656
|
] }),
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
588
|
-
/* @__PURE__ */ (0,
|
|
589
|
-
/* @__PURE__ */ (0,
|
|
590
|
-
/* @__PURE__ */ (0,
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
|
|
658
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" }),
|
|
659
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" }),
|
|
660
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, "aria-label": "Duplicate", disabled: readOnly, onClick: () => run((0, import_animation_editor6.duplicateMotionCommandEdit)(scene, current.id, row.index), "Duplicate command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u29C9" }),
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" })
|
|
592
662
|
] })
|
|
593
663
|
] })
|
|
594
664
|
]
|
|
@@ -596,18 +666,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
|
|
|
596
666
|
`${row.index}:${row.summary}`
|
|
597
667
|
);
|
|
598
668
|
}) }),
|
|
599
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
600
|
-
/* @__PURE__ */ (0,
|
|
601
|
-
/* @__PURE__ */ (0,
|
|
669
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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: import_animation_editor6.MOTION_COMMAND_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: t, children: t }, t)) }),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, onClick: add, "data-add-command": "", children: "Add command" })
|
|
602
672
|
] }),
|
|
603
|
-
message && /* @__PURE__ */ (0,
|
|
673
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
604
674
|
] });
|
|
605
675
|
}
|
|
606
676
|
|
|
607
677
|
// src/animation-editor/PlayheadScrubber.tsx
|
|
608
678
|
var import_react9 = require("react");
|
|
609
|
-
var
|
|
610
|
-
var
|
|
679
|
+
var import_animation_editor7 = require("@pixerate/editor/animation-editor");
|
|
680
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
611
681
|
var seconds2 = (ms) => `${(ms / 1e3).toFixed(2)} s`;
|
|
612
682
|
function worst2(issues) {
|
|
613
683
|
if (issues.some((i) => i.severity === "error")) return "error";
|
|
@@ -627,7 +697,7 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
627
697
|
observer.observe(el);
|
|
628
698
|
return () => observer.disconnect();
|
|
629
699
|
}, []);
|
|
630
|
-
const ticks = (0,
|
|
700
|
+
const ticks = (0, import_animation_editor7.motionRulerTicks)(duration, width);
|
|
631
701
|
const pct = (ms) => `${Math.min(span, Math.max(0, ms)) / span * 100}%`;
|
|
632
702
|
const seekAt = (clientX) => {
|
|
633
703
|
const box = track.current.getBoundingClientRect();
|
|
@@ -635,18 +705,18 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
635
705
|
};
|
|
636
706
|
const beats = [];
|
|
637
707
|
if (scene.beat && scene.beat.bpm > 0) {
|
|
638
|
-
for (let b = 0, t = (0,
|
|
708
|
+
for (let b = 0, t = (0, import_animation_editor7.motionBeatTime)(scene.beat, 0); t <= span && beats.length < 400; t = (0, import_animation_editor7.motionBeatTime)(scene.beat, ++b)) if (t >= 0) beats.push(t);
|
|
639
709
|
}
|
|
640
|
-
return /* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
642
|
-
/* @__PURE__ */ (0,
|
|
643
|
-
/* @__PURE__ */ (0,
|
|
710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, "data-playhead-scrubber": "", "data-shot-timeline": "", children: [
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }),
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => {
|
|
644
714
|
controller.pause();
|
|
645
715
|
controller.seek(0);
|
|
646
716
|
}, "aria-label": "Back to start", children: "\u23EE" }),
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
648
718
|
"Loop",
|
|
649
|
-
/* @__PURE__ */ (0,
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
650
720
|
"select",
|
|
651
721
|
{
|
|
652
722
|
className: "rounded border border-border bg-transparent px-1 py-0.5",
|
|
@@ -655,20 +725,20 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
655
725
|
"aria-label": "Loop",
|
|
656
726
|
onChange: (e) => controller.apply({ op: "set_settings", loop: e.target.value }, "Change loop"),
|
|
657
727
|
children: [
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "none", children: "Off" }),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "loop", children: "Loop" }),
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
|
|
661
731
|
]
|
|
662
732
|
}
|
|
663
733
|
)
|
|
664
734
|
] }),
|
|
665
|
-
/* @__PURE__ */ (0,
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
|
|
666
736
|
seconds2(time),
|
|
667
737
|
" / ",
|
|
668
738
|
seconds2(duration)
|
|
669
739
|
] })
|
|
670
740
|
] }),
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
672
742
|
"div",
|
|
673
743
|
{
|
|
674
744
|
ref: track,
|
|
@@ -698,17 +768,17 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
698
768
|
e.preventDefault();
|
|
699
769
|
},
|
|
700
770
|
children: [
|
|
701
|
-
/* @__PURE__ */ (0,
|
|
702
|
-
beats.map((t, i) => /* @__PURE__ */ (0,
|
|
703
|
-
scene.narration?.words.map((w, i) => /* @__PURE__ */ (0,
|
|
704
|
-
ticks.map((t) => /* @__PURE__ */ (0,
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative h-5 border-b border-border text-[10px] text-muted-foreground", "data-ruler": "", children: [
|
|
772
|
+
beats.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute bottom-0 h-1.5 w-px bg-sky-500/60", style: { left: pct(t) }, "data-beat": i }, `b${i}`)),
|
|
773
|
+
scene.narration?.words.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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}`)),
|
|
774
|
+
ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute -top-0.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time))
|
|
705
775
|
] }),
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
|
|
707
777
|
const mark = worst2(issues.filter((x) => x.shot === shot.id));
|
|
708
778
|
const selected = selection?.shot === shot.id;
|
|
709
779
|
const cue = scene.shots[i]?.at;
|
|
710
|
-
const cueTime = cue ? (0,
|
|
711
|
-
return /* @__PURE__ */ (0,
|
|
780
|
+
const cueTime = cue ? (0, import_animation_editor7.motionCueTime)(scene, cue) : void 0;
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
712
782
|
"button",
|
|
713
783
|
{
|
|
714
784
|
type: "button",
|
|
@@ -723,14 +793,14 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
723
793
|
controller.seekShot(shot.id);
|
|
724
794
|
},
|
|
725
795
|
children: [
|
|
726
|
-
mark && /* @__PURE__ */ (0,
|
|
796
|
+
mark && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
|
|
727
797
|
shot.label ?? shot.id
|
|
728
798
|
]
|
|
729
799
|
},
|
|
730
800
|
shot.id
|
|
731
801
|
);
|
|
732
802
|
}) }),
|
|
733
|
-
/* @__PURE__ */ (0,
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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": "" })
|
|
734
804
|
]
|
|
735
805
|
}
|
|
736
806
|
)
|
|
@@ -739,11 +809,11 @@ function PlayheadScrubber({ controller, className = "" }) {
|
|
|
739
809
|
|
|
740
810
|
// src/animation-editor/SceneSettings.tsx
|
|
741
811
|
var import_react10 = require("react");
|
|
742
|
-
var
|
|
743
|
-
var
|
|
812
|
+
var import_animation_editor8 = require("@pixerate/editor/animation-editor");
|
|
813
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
744
814
|
var input2 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
745
|
-
var
|
|
746
|
-
var unit = (u) => /* @__PURE__ */ (0,
|
|
815
|
+
var btn3 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
816
|
+
var unit = (u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: u });
|
|
747
817
|
function SceneSettings({ controller, className = "" }) {
|
|
748
818
|
const state = useAnimationEditorState(controller);
|
|
749
819
|
const { scene, readOnly, error, duration } = state;
|
|
@@ -767,7 +837,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
767
837
|
const s = Number(fitSeconds);
|
|
768
838
|
if (!(Number.isFinite(s) && s > 0)) return setLocal("Give the length to fit in seconds, above 0.");
|
|
769
839
|
try {
|
|
770
|
-
const edits = (0,
|
|
840
|
+
const edits = (0, import_animation_editor8.fitMotionSceneEdits)(scene, s * 1e3);
|
|
771
841
|
if (edits.length) apply(edits, `Fit to ${s} s`);
|
|
772
842
|
else setLocal(null);
|
|
773
843
|
} catch (e) {
|
|
@@ -776,32 +846,32 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
776
846
|
};
|
|
777
847
|
const beat = scene.beat;
|
|
778
848
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
779
|
-
return /* @__PURE__ */ (0,
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
781
|
-
/* @__PURE__ */ (0,
|
|
782
|
-
/* @__PURE__ */ (0,
|
|
783
|
-
/* @__PURE__ */ (0,
|
|
784
|
-
/* @__PURE__ */ (0,
|
|
785
|
-
/* @__PURE__ */ (0,
|
|
849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-scene-settings": "", children: [
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Loop" }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: input2, "aria-label": "Scene loop", disabled: readOnly, value: scene.loop ?? "none", onChange: (e) => settings({ loop: e.target.value }, "Change loop"), children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "none", children: "Off" }),
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "loop", children: "Loop" }),
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
|
|
786
856
|
] }),
|
|
787
|
-
/* @__PURE__ */ (0,
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
789
|
-
/* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
791
|
-
/* @__PURE__ */ (0,
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Motion blur" }),
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("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: [
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Off" }),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "90", children: "Light (90\xB0)" }),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "180", children: "Normal (180\xB0)" }),
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "360", children: "Heavy (360\xB0)" })
|
|
793
863
|
] }),
|
|
794
|
-
/* @__PURE__ */ (0,
|
|
795
|
-
/* @__PURE__ */ (0,
|
|
796
|
-
/* @__PURE__ */ (0,
|
|
797
|
-
/* @__PURE__ */ (0,
|
|
798
|
-
/* @__PURE__ */ (0,
|
|
799
|
-
/* @__PURE__ */ (0,
|
|
800
|
-
/* @__PURE__ */ (0,
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Plays on" }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("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: [
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Its own (autoplay)" }),
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "click", children: "Click (a shot per click)" }),
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "hover", children: "Hover" }),
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "press", children: "Press" }),
|
|
870
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "scroll", children: "Scroll" })
|
|
801
871
|
] }),
|
|
802
|
-
/* @__PURE__ */ (0,
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
804
|
-
/* @__PURE__ */ (0,
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Frame rate" }),
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
805
875
|
CommitInput,
|
|
806
876
|
{
|
|
807
877
|
className: input2,
|
|
@@ -817,9 +887,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
817
887
|
),
|
|
818
888
|
unit("fps")
|
|
819
889
|
] }),
|
|
820
|
-
/* @__PURE__ */ (0,
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
822
|
-
/* @__PURE__ */ (0,
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
823
893
|
CommitInput,
|
|
824
894
|
{
|
|
825
895
|
className: input2,
|
|
@@ -835,9 +905,9 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
835
905
|
),
|
|
836
906
|
unit("fps")
|
|
837
907
|
] }),
|
|
838
|
-
/* @__PURE__ */ (0,
|
|
839
|
-
/* @__PURE__ */ (0,
|
|
840
|
-
[0, 1].map((i) => /* @__PURE__ */ (0,
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Target length" }),
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
910
|
+
[0, 1].map((i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
841
911
|
CommitInput,
|
|
842
912
|
{
|
|
843
913
|
className: input2,
|
|
@@ -860,15 +930,15 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
860
930
|
)),
|
|
861
931
|
unit("s")
|
|
862
932
|
] }),
|
|
863
|
-
/* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Fit to" }),
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: input2, type: "number", min: 0.1, step: 0.5, "aria-label": "Fit to", value: fitSeconds, onChange: (e) => setFitTo(e.target.value) }),
|
|
866
936
|
unit("s"),
|
|
867
|
-
/* @__PURE__ */ (0,
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" })
|
|
868
938
|
] }),
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
871
|
-
/* @__PURE__ */ (0,
|
|
939
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Beat grid" }),
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", "data-beat-grid": "", children: [
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
872
942
|
CommitInput,
|
|
873
943
|
{
|
|
874
944
|
className: input2,
|
|
@@ -881,7 +951,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
881
951
|
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"))
|
|
882
952
|
}
|
|
883
953
|
),
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
885
955
|
CommitInput,
|
|
886
956
|
{
|
|
887
957
|
className: input2,
|
|
@@ -893,7 +963,7 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
893
963
|
onCommit: (raw) => beat && num(raw, "The offset is a number of ms.", () => true, (n) => settings({ beat: { ...beat, offset: n ?? 0 } }, "Change beat offset"))
|
|
894
964
|
}
|
|
895
965
|
),
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
897
967
|
CommitInput,
|
|
898
968
|
{
|
|
899
969
|
className: input2,
|
|
@@ -909,63 +979,63 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
909
979
|
)
|
|
910
980
|
] })
|
|
911
981
|
] }),
|
|
912
|
-
/* @__PURE__ */ (0,
|
|
913
|
-
/* @__PURE__ */ (0,
|
|
914
|
-
/* @__PURE__ */ (0,
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-muted-foreground", children: "Narration (a word a line: start ms, then the word)" }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
915
985
|
"textarea",
|
|
916
986
|
{
|
|
917
987
|
className: `${input2} h-20 font-mono`,
|
|
918
988
|
"aria-label": "Narration",
|
|
919
989
|
placeholder: "0 Meet\n320 the\n480 badge",
|
|
920
990
|
disabled: readOnly,
|
|
921
|
-
defaultValue: (0,
|
|
991
|
+
defaultValue: (0, import_animation_editor8.formatMotionNarration)(scene.narration),
|
|
922
992
|
onBlur: (e) => {
|
|
923
|
-
if (e.currentTarget.value === (0,
|
|
924
|
-
const parsed = (0,
|
|
993
|
+
if (e.currentTarget.value === (0, import_animation_editor8.formatMotionNarration)(scene.narration)) return;
|
|
994
|
+
const parsed = (0, import_animation_editor8.parseMotionNarration)(e.currentTarget.value);
|
|
925
995
|
if ("error" in parsed) return setLocal(parsed.error);
|
|
926
996
|
settings({ narration: parsed.narration }, parsed.narration ? "Change narration" : "Clear narration");
|
|
927
997
|
}
|
|
928
998
|
},
|
|
929
|
-
(0,
|
|
999
|
+
(0, import_animation_editor8.formatMotionNarration)(scene.narration)
|
|
930
1000
|
)
|
|
931
1001
|
] }),
|
|
932
|
-
/* @__PURE__ */ (0,
|
|
933
|
-
/* @__PURE__ */ (0,
|
|
934
|
-
/* @__PURE__ */ (0,
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-muted-foreground", children: "Drivers (one a line: target.property <- source.property * factor)" }),
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
935
1005
|
"textarea",
|
|
936
1006
|
{
|
|
937
1007
|
className: `${input2} h-14 font-mono`,
|
|
938
1008
|
"aria-label": "Drivers",
|
|
939
1009
|
placeholder: "back.x <- front.x * 0.5\nwheel.rotation <- wheel.x * 2.86",
|
|
940
1010
|
disabled: readOnly,
|
|
941
|
-
defaultValue: (0,
|
|
1011
|
+
defaultValue: (0, import_animation_editor8.formatMotionDrivers)(scene.drivers),
|
|
942
1012
|
onBlur: (e) => {
|
|
943
|
-
if (e.currentTarget.value === (0,
|
|
944
|
-
const parsed = (0,
|
|
1013
|
+
if (e.currentTarget.value === (0, import_animation_editor8.formatMotionDrivers)(scene.drivers)) return;
|
|
1014
|
+
const parsed = (0, import_animation_editor8.parseMotionDrivers)(e.currentTarget.value);
|
|
945
1015
|
if ("error" in parsed) return setLocal(parsed.error);
|
|
946
1016
|
apply({ op: "set_drivers", drivers: parsed.drivers }, parsed.drivers.length ? "Set drivers" : "Clear drivers");
|
|
947
1017
|
}
|
|
948
1018
|
},
|
|
949
|
-
(0,
|
|
1019
|
+
(0, import_animation_editor8.formatMotionDrivers)(scene.drivers)
|
|
950
1020
|
)
|
|
951
1021
|
] }),
|
|
952
|
-
message && /* @__PURE__ */ (0,
|
|
1022
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
953
1023
|
] });
|
|
954
1024
|
}
|
|
955
1025
|
|
|
956
1026
|
// src/animation-editor/ShotInspector.tsx
|
|
957
1027
|
var import_react11 = require("react");
|
|
958
|
-
var
|
|
959
|
-
var
|
|
1028
|
+
var import_animation_editor9 = require("@pixerate/editor/animation-editor");
|
|
1029
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
960
1030
|
var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
961
|
-
var
|
|
1031
|
+
var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
962
1032
|
function ShotInspector({ controller, shot, className = "" }) {
|
|
963
1033
|
const state = useAnimationEditorState(controller);
|
|
964
1034
|
const { scene, selection, readOnly, error } = state;
|
|
965
1035
|
const [local, setLocalState] = (0, import_react11.useState)(null);
|
|
966
1036
|
const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
|
|
967
|
-
const elements = (0, import_react11.useMemo)(() => (0,
|
|
968
|
-
const cues = (0, import_react11.useMemo)(() => (0,
|
|
1037
|
+
const elements = (0, import_react11.useMemo)(() => (0, import_animation_editor9.describeMotionElements)(scene), [scene.artwork]);
|
|
1038
|
+
const cues = (0, import_react11.useMemo)(() => (0, import_animation_editor9.motionCueChoices)(scene), [scene]);
|
|
969
1039
|
const id = shot ?? selection?.shot ?? scene.shots[0]?.id;
|
|
970
1040
|
const index = scene.shots.findIndex((s) => s.id === id);
|
|
971
1041
|
const current = scene.shots[index];
|
|
@@ -974,7 +1044,7 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
974
1044
|
return controller.apply(edit, label);
|
|
975
1045
|
};
|
|
976
1046
|
const addShot = () => {
|
|
977
|
-
const newId = (0,
|
|
1047
|
+
const newId = (0, import_animation_editor9.freshShotId)(scene, "shot");
|
|
978
1048
|
const at = index >= 0 ? index + 1 : scene.shots.length;
|
|
979
1049
|
if (apply({ op: "insert_shots", shots: [{ id: newId, label: "New shot", run: [] }], at }, "Add shot").ok) {
|
|
980
1050
|
controller.select({ shot: newId });
|
|
@@ -988,36 +1058,36 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
988
1058
|
apply({ op: "update_shot", shot: current.id, set: { [key]: n } }, label);
|
|
989
1059
|
};
|
|
990
1060
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
991
|
-
const cueKey = current ? (0,
|
|
1061
|
+
const cueKey = current ? (0, import_animation_editor9.motionCueKey)(current.at) : "";
|
|
992
1062
|
const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
|
|
993
|
-
return /* @__PURE__ */ (0,
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
996
|
-
current && /* @__PURE__ */ (0,
|
|
997
|
-
/* @__PURE__ */ (0,
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
999
|
-
current && /* @__PURE__ */ (0,
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1002
|
-
/* @__PURE__ */ (0,
|
|
1063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium", children: "Shot" }),
|
|
1066
|
+
current && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn4, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
|
|
1069
|
+
current && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn4, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
|
|
1003
1073
|
] })
|
|
1004
1074
|
] })
|
|
1005
1075
|
] }),
|
|
1006
|
-
current && /* @__PURE__ */ (0,
|
|
1007
|
-
/* @__PURE__ */ (0,
|
|
1008
|
-
/* @__PURE__ */ (0,
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1010
|
-
/* @__PURE__ */ (0,
|
|
1011
|
-
/* @__PURE__ */ (0,
|
|
1012
|
-
/* @__PURE__ */ (0,
|
|
1076
|
+
current && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(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") }),
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(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") }),
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
|
|
1013
1083
|
] }),
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1015
|
-
/* @__PURE__ */ (0,
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(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") }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
|
|
1018
1088
|
] }),
|
|
1019
|
-
/* @__PURE__ */ (0,
|
|
1020
|
-
/* @__PURE__ */ (0,
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1021
1091
|
"select",
|
|
1022
1092
|
{
|
|
1023
1093
|
className: input3,
|
|
@@ -1030,17 +1100,17 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
1030
1100
|
else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { frame: v.slice(6), padding: 24 } } }, "Frame camera");
|
|
1031
1101
|
},
|
|
1032
1102
|
children: [
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
current.camera && !frame && /* @__PURE__ */ (0,
|
|
1035
|
-
elements.map((e) => /* @__PURE__ */ (0,
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "keep framing" }),
|
|
1104
|
+
current.camera && !frame && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "rect", children: "a rectangle" }),
|
|
1105
|
+
elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("option", { value: `frame:${e.id}`, children: [
|
|
1036
1106
|
"frame ",
|
|
1037
1107
|
e.name ?? e.id
|
|
1038
1108
|
] }, e.id))
|
|
1039
1109
|
]
|
|
1040
1110
|
}
|
|
1041
1111
|
),
|
|
1042
|
-
/* @__PURE__ */ (0,
|
|
1043
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1044
1114
|
"select",
|
|
1045
1115
|
{
|
|
1046
1116
|
className: input3,
|
|
@@ -1048,19 +1118,19 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
1048
1118
|
disabled: readOnly || index === 0,
|
|
1049
1119
|
value: cueKey,
|
|
1050
1120
|
onChange: (e) => {
|
|
1051
|
-
const cue = (0,
|
|
1121
|
+
const cue = (0, import_animation_editor9.motionCueFromKey)(e.target.value);
|
|
1052
1122
|
apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
|
|
1053
1123
|
},
|
|
1054
1124
|
children: [
|
|
1055
|
-
/* @__PURE__ */ (0,
|
|
1056
|
-
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0,
|
|
1057
|
-
cues.map((c) => /* @__PURE__ */ (0,
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "after the shot before" }),
|
|
1126
|
+
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: cueKey, children: cueKey }),
|
|
1127
|
+
cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: c.value, children: c.label }, c.value))
|
|
1058
1128
|
]
|
|
1059
1129
|
}
|
|
1060
1130
|
),
|
|
1061
|
-
!cues.length && index > 0 && /* @__PURE__ */ (0,
|
|
1131
|
+
!cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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." })
|
|
1062
1132
|
] }),
|
|
1063
|
-
message && /* @__PURE__ */ (0,
|
|
1133
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
1064
1134
|
] });
|
|
1065
1135
|
}
|
|
1066
1136
|
|
|
@@ -1092,7 +1162,7 @@ function useEffectDescription(provider, effect) {
|
|
|
1092
1162
|
// src/effects/EffectThumbnail.tsx
|
|
1093
1163
|
var import_react13 = require("react");
|
|
1094
1164
|
var import_effects = require("@pixerate/editor/effects");
|
|
1095
|
-
var
|
|
1165
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1096
1166
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
1097
1167
|
const ref = (0, import_react13.useRef)(null);
|
|
1098
1168
|
const [failed, setFailed] = (0, import_react13.useState)(effect.kind === "motion");
|
|
@@ -1111,13 +1181,13 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
1111
1181
|
live = false;
|
|
1112
1182
|
};
|
|
1113
1183
|
}, [provider, effect, width, height]);
|
|
1114
|
-
return /* @__PURE__ */ (0,
|
|
1184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1115
1185
|
"div",
|
|
1116
1186
|
{
|
|
1117
1187
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
1118
1188
|
style: { aspectRatio: `${width} / ${height}` },
|
|
1119
1189
|
"data-effect-thumbnail": effect.id,
|
|
1120
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
1190
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
1121
1191
|
}
|
|
1122
1192
|
);
|
|
1123
1193
|
}
|
|
@@ -1125,7 +1195,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
1125
1195
|
// src/effects/EffectsBrowser.tsx
|
|
1126
1196
|
var import_react14 = require("react");
|
|
1127
1197
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
1128
|
-
var
|
|
1198
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1129
1199
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
1130
1200
|
const [all, setAll] = (0, import_react14.useState)([]);
|
|
1131
1201
|
const [query, setQuery] = (0, import_react14.useState)("");
|
|
@@ -1156,11 +1226,11 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1156
1226
|
const categories = (0, import_react14.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
1157
1227
|
const shown = found.filter(allowed);
|
|
1158
1228
|
if (!provider)
|
|
1159
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
-
return /* @__PURE__ */ (0,
|
|
1161
|
-
title && /* @__PURE__ */ (0,
|
|
1162
|
-
/* @__PURE__ */ (0,
|
|
1163
|
-
/* @__PURE__ */ (0,
|
|
1229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
|
|
1230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
1231
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1164
1234
|
"input",
|
|
1165
1235
|
{
|
|
1166
1236
|
type: "search",
|
|
@@ -1171,17 +1241,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1171
1241
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
1172
1242
|
}
|
|
1173
1243
|
),
|
|
1174
|
-
/* @__PURE__ */ (0,
|
|
1175
|
-
/* @__PURE__ */ (0,
|
|
1176
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "All categories" }),
|
|
1246
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: c, children: c }, c))
|
|
1177
1247
|
] }),
|
|
1178
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
1179
|
-
/* @__PURE__ */ (0,
|
|
1180
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
1248
|
+
uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Any use" }),
|
|
1250
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
1181
1251
|
] })
|
|
1182
1252
|
] }),
|
|
1183
|
-
error && /* @__PURE__ */ (0,
|
|
1184
|
-
/* @__PURE__ */ (0,
|
|
1253
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1185
1255
|
"button",
|
|
1186
1256
|
{
|
|
1187
1257
|
type: "button",
|
|
@@ -1190,13 +1260,13 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1190
1260
|
"data-effect-id": e.id,
|
|
1191
1261
|
onClick: () => onPick(e),
|
|
1192
1262
|
children: [
|
|
1193
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
1194
|
-
/* @__PURE__ */ (0,
|
|
1195
|
-
/* @__PURE__ */ (0,
|
|
1263
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
1264
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
|
|
1196
1266
|
]
|
|
1197
1267
|
}
|
|
1198
1268
|
) }, e.id)) }),
|
|
1199
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
1269
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
1200
1270
|
] });
|
|
1201
1271
|
}
|
|
1202
1272
|
|
|
@@ -1208,7 +1278,7 @@ var import_parameters2 = require("@pixerate/editor/parameters");
|
|
|
1208
1278
|
// src/parameters/fields.tsx
|
|
1209
1279
|
var import_react15 = require("react");
|
|
1210
1280
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
1211
|
-
var
|
|
1281
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1212
1282
|
var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
1213
1283
|
var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
|
|
1214
1284
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
@@ -1232,7 +1302,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
1232
1302
|
onKeyDown: keyDown,
|
|
1233
1303
|
...rest
|
|
1234
1304
|
};
|
|
1235
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
1305
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "text", ...props }, value);
|
|
1236
1306
|
}
|
|
1237
1307
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
1238
1308
|
function ParameterNumberInput({
|
|
@@ -1243,8 +1313,8 @@ function ParameterNumberInput({
|
|
|
1243
1313
|
id,
|
|
1244
1314
|
"aria-label": ariaLabel
|
|
1245
1315
|
}) {
|
|
1246
|
-
return /* @__PURE__ */ (0,
|
|
1247
|
-
/* @__PURE__ */ (0,
|
|
1316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
1317
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1248
1318
|
ParameterCommitInput,
|
|
1249
1319
|
{
|
|
1250
1320
|
id,
|
|
@@ -1266,7 +1336,7 @@ function ParameterNumberInput({
|
|
|
1266
1336
|
}
|
|
1267
1337
|
}
|
|
1268
1338
|
),
|
|
1269
|
-
field.unit && /* @__PURE__ */ (0,
|
|
1339
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
1270
1340
|
] });
|
|
1271
1341
|
}
|
|
1272
1342
|
function ParameterSlider(props) {
|
|
@@ -1277,10 +1347,10 @@ function ParameterSlider(props) {
|
|
|
1277
1347
|
dragging.current = false;
|
|
1278
1348
|
onGestureEnd?.();
|
|
1279
1349
|
};
|
|
1280
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
1350
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props });
|
|
1281
1351
|
const step = (0, import_parameters.parameterStep)(field);
|
|
1282
|
-
return /* @__PURE__ */ (0,
|
|
1283
|
-
/* @__PURE__ */ (0,
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1284
1354
|
"input",
|
|
1285
1355
|
{
|
|
1286
1356
|
type: "range",
|
|
@@ -1303,11 +1373,11 @@ function ParameterSlider(props) {
|
|
|
1303
1373
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
1304
1374
|
}
|
|
1305
1375
|
),
|
|
1306
|
-
/* @__PURE__ */ (0,
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
1307
1377
|
] });
|
|
1308
1378
|
}
|
|
1309
1379
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
1310
|
-
return /* @__PURE__ */ (0,
|
|
1380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1311
1381
|
"button",
|
|
1312
1382
|
{
|
|
1313
1383
|
type: "button",
|
|
@@ -1318,7 +1388,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
1318
1388
|
disabled: disabled || field.readOnly,
|
|
1319
1389
|
onClick: () => onChange(!value),
|
|
1320
1390
|
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
|
|
1321
|
-
children: /* @__PURE__ */ (0,
|
|
1391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1322
1392
|
"span",
|
|
1323
1393
|
{
|
|
1324
1394
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -1331,7 +1401,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
1331
1401
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
1332
1402
|
const off = disabled || field.readOnly;
|
|
1333
1403
|
if (field.control === "segmented") {
|
|
1334
|
-
return /* @__PURE__ */ (0,
|
|
1404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1335
1405
|
"button",
|
|
1336
1406
|
{
|
|
1337
1407
|
type: "button",
|
|
@@ -1347,7 +1417,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
1347
1417
|
)) });
|
|
1348
1418
|
}
|
|
1349
1419
|
const index = options.findIndex((o) => o.value === value);
|
|
1350
|
-
return /* @__PURE__ */ (0,
|
|
1420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1351
1421
|
"select",
|
|
1352
1422
|
{
|
|
1353
1423
|
id,
|
|
@@ -1359,7 +1429,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
1359
1429
|
if (option) onChange(option.value);
|
|
1360
1430
|
},
|
|
1361
1431
|
className: parameterInputClass,
|
|
1362
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
1432
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
1363
1433
|
}
|
|
1364
1434
|
);
|
|
1365
1435
|
}
|
|
@@ -1380,11 +1450,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1380
1450
|
picking.current = false;
|
|
1381
1451
|
onGestureEnd?.();
|
|
1382
1452
|
};
|
|
1383
|
-
return /* @__PURE__ */ (0,
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1386
|
-
/* @__PURE__ */ (0,
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1388
1458
|
"input",
|
|
1389
1459
|
{
|
|
1390
1460
|
type: "color",
|
|
@@ -1400,7 +1470,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1400
1470
|
}
|
|
1401
1471
|
)
|
|
1402
1472
|
] }),
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1404
1474
|
ParameterCommitInput,
|
|
1405
1475
|
{
|
|
1406
1476
|
id,
|
|
@@ -1416,7 +1486,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1416
1486
|
}
|
|
1417
1487
|
)
|
|
1418
1488
|
] }),
|
|
1419
|
-
alpha && /* @__PURE__ */ (0,
|
|
1489
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1420
1490
|
"input",
|
|
1421
1491
|
{
|
|
1422
1492
|
type: "range",
|
|
@@ -1434,10 +1504,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1434
1504
|
onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
|
|
1435
1505
|
}
|
|
1436
1506
|
),
|
|
1437
|
-
field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0,
|
|
1507
|
+
field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
|
|
1438
1508
|
const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
|
|
1439
1509
|
if (!swatch) return null;
|
|
1440
|
-
return /* @__PURE__ */ (0,
|
|
1510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1441
1511
|
"button",
|
|
1442
1512
|
{
|
|
1443
1513
|
type: "button",
|
|
@@ -1456,11 +1526,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1456
1526
|
}
|
|
1457
1527
|
function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
1458
1528
|
const size = (0, import_parameters.vectorSize)(field);
|
|
1459
|
-
return /* @__PURE__ */ (0,
|
|
1529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
1460
1530
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
1461
|
-
return /* @__PURE__ */ (0,
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1463
|
-
/* @__PURE__ */ (0,
|
|
1531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
1532
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1464
1534
|
ParameterNumberInput,
|
|
1465
1535
|
{
|
|
1466
1536
|
field: component,
|
|
@@ -1477,11 +1547,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
|
1477
1547
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
1478
1548
|
const off = disabled || field.readOnly;
|
|
1479
1549
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
1480
|
-
return /* @__PURE__ */ (0,
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
1482
|
-
/* @__PURE__ */ (0,
|
|
1483
|
-
/* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1551
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1485
1555
|
ParameterCommitInput,
|
|
1486
1556
|
{
|
|
1487
1557
|
id,
|
|
@@ -1492,10 +1562,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
1492
1562
|
onCommit: (text) => onChange(text.trim())
|
|
1493
1563
|
}
|
|
1494
1564
|
),
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1496
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
|
|
1566
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
|
|
1497
1567
|
"Choose file\u2026",
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1499
1569
|
"input",
|
|
1500
1570
|
{
|
|
1501
1571
|
type: "file",
|
|
@@ -1511,11 +1581,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
1511
1581
|
}
|
|
1512
1582
|
)
|
|
1513
1583
|
] }),
|
|
1514
|
-
value && /* @__PURE__ */ (0,
|
|
1584
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
|
|
1515
1585
|
] })
|
|
1516
1586
|
] })
|
|
1517
1587
|
] }),
|
|
1518
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
1588
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1519
1589
|
"button",
|
|
1520
1590
|
{
|
|
1521
1591
|
type: "button",
|
|
@@ -1525,14 +1595,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
1525
1595
|
disabled: off,
|
|
1526
1596
|
onClick: () => onChange(o.url),
|
|
1527
1597
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
1528
|
-
children: /* @__PURE__ */ (0,
|
|
1598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
1529
1599
|
},
|
|
1530
1600
|
o.url
|
|
1531
1601
|
)) })
|
|
1532
1602
|
] });
|
|
1533
1603
|
}
|
|
1534
1604
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
1535
|
-
return /* @__PURE__ */ (0,
|
|
1605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1536
1606
|
ParameterCommitInput,
|
|
1537
1607
|
{
|
|
1538
1608
|
id,
|
|
@@ -1551,31 +1621,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
1551
1621
|
switch (field.type) {
|
|
1552
1622
|
case "number":
|
|
1553
1623
|
case "int":
|
|
1554
|
-
return /* @__PURE__ */ (0,
|
|
1624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
1555
1625
|
case "boolean":
|
|
1556
|
-
return /* @__PURE__ */ (0,
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
1557
1627
|
case "choice":
|
|
1558
|
-
return /* @__PURE__ */ (0,
|
|
1628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
1559
1629
|
case "color":
|
|
1560
|
-
return /* @__PURE__ */ (0,
|
|
1630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
1561
1631
|
case "vector":
|
|
1562
|
-
return /* @__PURE__ */ (0,
|
|
1632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
1563
1633
|
case "image":
|
|
1564
|
-
return /* @__PURE__ */ (0,
|
|
1634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
1565
1635
|
case "text":
|
|
1566
|
-
return /* @__PURE__ */ (0,
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
1567
1637
|
}
|
|
1568
1638
|
}
|
|
1569
1639
|
|
|
1570
1640
|
// src/effects/EffectParameters.tsx
|
|
1571
|
-
var
|
|
1641
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1572
1642
|
function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
|
|
1573
1643
|
const fields = (0, import_react16.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
|
|
1574
1644
|
const idBase = (0, import_react16.useId)();
|
|
1575
1645
|
const gesture = import_react16.default.useRef(null);
|
|
1576
1646
|
const count = import_react16.default.useRef(0);
|
|
1577
|
-
return /* @__PURE__ */ (0,
|
|
1578
|
-
onPreset && description.presets.length > 0 && /* @__PURE__ */ (0,
|
|
1647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
1648
|
+
onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1579
1649
|
"select",
|
|
1580
1650
|
{
|
|
1581
1651
|
className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -1587,8 +1657,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
1587
1657
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
1588
1658
|
},
|
|
1589
1659
|
children: [
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1591
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
1661
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: p.name, children: p.name }, p.name))
|
|
1592
1662
|
]
|
|
1593
1663
|
}
|
|
1594
1664
|
),
|
|
@@ -1598,13 +1668,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
1598
1668
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
1599
1669
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
1600
1670
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
1601
|
-
return /* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
/* @__PURE__ */ (0,
|
|
1604
|
-
keyed && /* @__PURE__ */ (0,
|
|
1605
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
1671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
1674
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
1675
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
|
|
1606
1676
|
] }),
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1608
1678
|
ParameterFieldControl,
|
|
1609
1679
|
{
|
|
1610
1680
|
field,
|
|
@@ -1618,25 +1688,25 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
1618
1688
|
)
|
|
1619
1689
|
] }, field.id);
|
|
1620
1690
|
}),
|
|
1621
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
1691
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
1622
1692
|
] });
|
|
1623
1693
|
}
|
|
1624
1694
|
|
|
1625
1695
|
// src/animation-editor/AnimationEffectsPanel.tsx
|
|
1626
1696
|
var import_react17 = require("react");
|
|
1627
|
-
var
|
|
1628
|
-
var
|
|
1629
|
-
var
|
|
1697
|
+
var import_animation_editor10 = require("@pixerate/editor/animation-editor");
|
|
1698
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1699
|
+
var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1630
1700
|
function Controls({ controller, instance, effect, values }) {
|
|
1631
1701
|
const provider = controller.effectsProvider;
|
|
1632
1702
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1633
1703
|
const [message, setMessage] = (0, import_react17.useState)(null);
|
|
1634
1704
|
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
1635
|
-
if (!provider) return /* @__PURE__ */ (0,
|
|
1636
|
-
if (error) return /* @__PURE__ */ (0,
|
|
1637
|
-
if (!description) return /* @__PURE__ */ (0,
|
|
1638
|
-
return /* @__PURE__ */ (0,
|
|
1639
|
-
/* @__PURE__ */ (0,
|
|
1705
|
+
if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
|
|
1706
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
|
|
1707
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
1708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1640
1710
|
EffectParameters,
|
|
1641
1711
|
{
|
|
1642
1712
|
description,
|
|
@@ -1646,13 +1716,13 @@ function Controls({ controller, instance, effect, values }) {
|
|
|
1646
1716
|
onPreset: (v) => report(controller.updateMotionEffect(instance, v))
|
|
1647
1717
|
}
|
|
1648
1718
|
),
|
|
1649
|
-
message && /* @__PURE__ */ (0,
|
|
1719
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
1650
1720
|
] });
|
|
1651
1721
|
}
|
|
1652
1722
|
function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
1653
1723
|
const state = useAnimationEditorState(controller);
|
|
1654
1724
|
const provider = state.effectsProvider;
|
|
1655
|
-
const nodes = (0, import_react17.useMemo)(() => [...(0,
|
|
1725
|
+
const nodes = (0, import_react17.useMemo)(() => [...(0, import_animation_editor10.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
|
|
1656
1726
|
const [chosen, setChosen] = (0, import_react17.useState)("");
|
|
1657
1727
|
const target = node && nodes.includes(node) ? node : chosen && nodes.includes(chosen) ? chosen : "";
|
|
1658
1728
|
const [browse, setBrowse] = (0, import_react17.useState)(null);
|
|
@@ -1661,42 +1731,42 @@ function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
|
1661
1731
|
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
|
|
1662
1732
|
const applied = (0, import_react17.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
|
|
1663
1733
|
const disabled = state.readOnly;
|
|
1664
|
-
return /* @__PURE__ */ (0,
|
|
1665
|
-
/* @__PURE__ */ (0,
|
|
1666
|
-
/* @__PURE__ */ (0,
|
|
1667
|
-
/* @__PURE__ */ (0,
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1669
|
-
nodes.map((id) => /* @__PURE__ */ (0,
|
|
1734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
1738
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Node\u2026" }),
|
|
1739
|
+
nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: id, children: id }, id))
|
|
1670
1740
|
] }),
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1672
|
-
/* @__PURE__ */ (0,
|
|
1741
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
|
|
1673
1743
|
] }),
|
|
1674
|
-
!provider && /* @__PURE__ */ (0,
|
|
1675
|
-
browse === "motion" && /* @__PURE__ */ (0,
|
|
1676
|
-
browse === "vector" && /* @__PURE__ */ (0,
|
|
1677
|
-
/* @__PURE__ */ (0,
|
|
1678
|
-
/* @__PURE__ */ (0,
|
|
1679
|
-
/* @__PURE__ */ (0,
|
|
1744
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
|
|
1745
|
+
browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
|
|
1746
|
+
browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
1680
1750
|
e.name ?? e.effect,
|
|
1681
1751
|
" ",
|
|
1682
|
-
/* @__PURE__ */ (0,
|
|
1752
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1683
1753
|
"\xB7 ",
|
|
1684
1754
|
e.kind === "vector" ? "picture" : e.targets.join(", ")
|
|
1685
1755
|
] })
|
|
1686
1756
|
] }),
|
|
1687
|
-
/* @__PURE__ */ (0,
|
|
1757
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
|
|
1688
1758
|
] }),
|
|
1689
|
-
open === e.instance && /* @__PURE__ */ (0,
|
|
1759
|
+
open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
|
|
1690
1760
|
] }, e.instance)) }),
|
|
1691
|
-
!applied.length && /* @__PURE__ */ (0,
|
|
1692
|
-
message && /* @__PURE__ */ (0,
|
|
1761
|
+
!applied.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
|
|
1762
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
|
|
1693
1763
|
] });
|
|
1694
1764
|
}
|
|
1695
1765
|
|
|
1696
1766
|
// src/animation-editor/AnimationEditor.tsx
|
|
1697
|
-
var
|
|
1767
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1698
1768
|
var ONION = { before: 3, after: 1 };
|
|
1699
|
-
var
|
|
1769
|
+
var btn6 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
1700
1770
|
function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
|
|
1701
1771
|
const state = useAnimationEditorState(controller);
|
|
1702
1772
|
const rootRef = (0, import_react18.useRef)(null);
|
|
@@ -1734,15 +1804,16 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1734
1804
|
},
|
|
1735
1805
|
reveal: () => onPlaybackReveal?.()
|
|
1736
1806
|
});
|
|
1737
|
-
const presenceLayer = playing ? /* @__PURE__ */ (0,
|
|
1807
|
+
const presenceLayer = playing ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PresenceLayer, { presence: agentPresence }) : null;
|
|
1738
1808
|
useEffects(controller, effects);
|
|
1739
1809
|
const { issues, scene, selection, readOnly } = state;
|
|
1740
1810
|
const [picked, setPicked] = (0, import_react18.useState)(null);
|
|
1741
1811
|
const [onion, setOnion] = (0, import_react18.useState)(false);
|
|
1742
1812
|
const [paths, setPaths] = (0, import_react18.useState)(false);
|
|
1813
|
+
const [recordMode, setRecordMode] = (0, import_react18.useState)("move");
|
|
1743
1814
|
const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
|
|
1744
1815
|
const targets = command && "targets" in command ? command.targets : [];
|
|
1745
|
-
const nodes = (0, import_react18.useMemo)(() => (0,
|
|
1816
|
+
const nodes = (0, import_react18.useMemo)(() => (0, import_animation_editor11.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
|
|
1746
1817
|
const pickedValid = picked && nodes.has(picked) ? picked : null;
|
|
1747
1818
|
const onPick = (id, event) => {
|
|
1748
1819
|
if (event.shiftKey && id && command && "targets" in command && selection?.command !== void 0 && !readOnly) {
|
|
@@ -1752,7 +1823,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1752
1823
|
}
|
|
1753
1824
|
setPicked(id);
|
|
1754
1825
|
};
|
|
1755
|
-
const stage = /* @__PURE__ */ (0,
|
|
1826
|
+
const stage = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1756
1827
|
AnimationStage,
|
|
1757
1828
|
{
|
|
1758
1829
|
controller,
|
|
@@ -1761,18 +1832,19 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1761
1832
|
motionPaths: motionPaths ?? paths,
|
|
1762
1833
|
onPick: editable ? onPick : void 0,
|
|
1763
1834
|
highlight: editable ? [...pickedValid ? [pickedValid] : [], ...targets] : void 0,
|
|
1835
|
+
recordMode,
|
|
1764
1836
|
className: "rounded-md border border-border bg-muted/40"
|
|
1765
1837
|
}
|
|
1766
1838
|
);
|
|
1767
|
-
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0,
|
|
1839
|
+
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor11.motionIssueLine)(issue) }, i)) });
|
|
1768
1840
|
if (!editable)
|
|
1769
|
-
return /* @__PURE__ */ (0,
|
|
1841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
|
|
1770
1842
|
presenceLayer,
|
|
1771
1843
|
stage,
|
|
1772
|
-
/* @__PURE__ */ (0,
|
|
1844
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayheadScrubber, { controller }),
|
|
1773
1845
|
issueList
|
|
1774
1846
|
] });
|
|
1775
|
-
return /* @__PURE__ */ (0,
|
|
1847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1776
1848
|
"div",
|
|
1777
1849
|
{
|
|
1778
1850
|
ref: rootRef,
|
|
@@ -1787,40 +1859,41 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1787
1859
|
},
|
|
1788
1860
|
children: [
|
|
1789
1861
|
presenceLayer,
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
1791
1863
|
stage,
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
1794
|
-
/* @__PURE__ */ (0,
|
|
1795
|
-
/* @__PURE__ */ (0,
|
|
1796
|
-
onionSkin === void 0 && /* @__PURE__ */ (0,
|
|
1797
|
-
/* @__PURE__ */ (0,
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayheadScrubber, { controller }),
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn6, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
|
|
1867
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn6, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
|
|
1868
|
+
onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
|
|
1798
1870
|
" Onion skin"
|
|
1799
1871
|
] }),
|
|
1800
|
-
motionPaths === void 0 && /* @__PURE__ */ (0,
|
|
1801
|
-
/* @__PURE__ */ (0,
|
|
1872
|
+
motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
|
|
1802
1874
|
" Motion paths"
|
|
1803
1875
|
] }),
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1805
1877
|
"Picked ",
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "text-rose-500", children: pickedValid }),
|
|
1807
1879
|
" ",
|
|
1808
|
-
/* @__PURE__ */ (0,
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
|
|
1809
1881
|
] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
|
|
1810
1882
|
] }),
|
|
1883
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
|
|
1811
1884
|
issueList
|
|
1812
1885
|
] }),
|
|
1813
|
-
/* @__PURE__ */ (0,
|
|
1814
|
-
/* @__PURE__ */ (0,
|
|
1815
|
-
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0,
|
|
1816
|
-
/* @__PURE__ */ (0,
|
|
1817
|
-
/* @__PURE__ */ (0,
|
|
1818
|
-
/* @__PURE__ */ (0,
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
|
|
1888
|
+
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
|
|
1891
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ShotInspector, { controller, className: "mt-1" })
|
|
1820
1893
|
] }),
|
|
1821
|
-
/* @__PURE__ */ (0,
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { className: "border-t border-border pt-2", children: [
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SceneSettings, { controller, className: "mt-1" })
|
|
1824
1897
|
] })
|
|
1825
1898
|
] })
|
|
1826
1899
|
]
|
|
@@ -1831,6 +1904,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1831
1904
|
0 && (module.exports = {
|
|
1832
1905
|
AnimationEditor,
|
|
1833
1906
|
AnimationEffectsPanel,
|
|
1907
|
+
AnimationRecordPanel,
|
|
1834
1908
|
AnimationStage,
|
|
1835
1909
|
CommandInspector,
|
|
1836
1910
|
CommandList,
|