@pixerate/editor-react 0.156.0 → 0.158.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/ShotInspector.d.cts +1 -1
- package/dist/animation-editor/ShotInspector.d.ts +1 -1
- package/dist/animation-editor/ShotLayers.d.cts +26 -0
- package/dist/animation-editor/ShotLayers.d.ts +26 -0
- package/dist/animation-editor/index.cjs +377 -142
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +367 -134
- package/dist/canvas/index.cjs +12 -6
- package/dist/canvas/index.js +13 -6
- package/dist/canvas/useCanvasEditorDocument.d.cts +5 -3
- package/dist/canvas/useCanvasEditorDocument.d.ts +5 -3
- package/package.json +3 -3
|
@@ -194,7 +194,7 @@ function ShotTimeline({ controller, className = "" }) {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// src/animation-editor/AnimationEditor.tsx
|
|
197
|
-
import { useMemo as useMemo7, useRef as useRef4, useState as
|
|
197
|
+
import { useMemo as useMemo7, useRef as useRef4, useState as useState9 } from "react";
|
|
198
198
|
import { indexMotionNodes as indexMotionNodes2, motionIssueLine } from "@pixerate/editor/animation-editor";
|
|
199
199
|
|
|
200
200
|
// src/animation-editor/AnimationRecordPanel.tsx
|
|
@@ -920,21 +920,250 @@ function SceneSettings({ controller, className = "" }) {
|
|
|
920
920
|
}
|
|
921
921
|
|
|
922
922
|
// src/animation-editor/ShotInspector.tsx
|
|
923
|
-
import { useMemo as useMemo5, useState as
|
|
923
|
+
import { useMemo as useMemo5, useState as useState7 } from "react";
|
|
924
924
|
import { describeMotionElements as describeMotionElements2, freshShotId, motionCameraFramed, motionCueChoices, motionCueFromKey, motionCueKey } from "@pixerate/editor/animation-editor";
|
|
925
925
|
|
|
926
|
-
// src/animation-editor/
|
|
926
|
+
// src/animation-editor/ShotLayers.tsx
|
|
927
927
|
import React7, { useEffect as useEffect3, useState as useState5 } from "react";
|
|
928
|
-
import {
|
|
929
|
-
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
928
|
+
import { EFFECT_LAYER_ROLES, effectLayerOffered } from "@pixerate/editor/effects";
|
|
929
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
930
930
|
var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
931
|
+
var button = "rounded border border-border px-1 text-[11px] disabled:opacity-40";
|
|
932
|
+
function useEffectList(provider, keep) {
|
|
933
|
+
const [list, setList] = useState5([]);
|
|
934
|
+
useEffect3(() => {
|
|
935
|
+
let live = true;
|
|
936
|
+
if (!provider) return setList([]);
|
|
937
|
+
void Promise.resolve(provider.list()).then(
|
|
938
|
+
(all) => live && setList(all.filter(keep)),
|
|
939
|
+
() => live && setList([])
|
|
940
|
+
);
|
|
941
|
+
return () => {
|
|
942
|
+
live = false;
|
|
943
|
+
};
|
|
944
|
+
}, [provider]);
|
|
945
|
+
return list;
|
|
946
|
+
}
|
|
947
|
+
var isTransition = (e) => e.uses.includes("transition") && e.kind !== "camera";
|
|
948
|
+
function subjectLabel(subject) {
|
|
949
|
+
if (!subject) return "";
|
|
950
|
+
if ("slot" in subject) return `slot ${subject.slot}`;
|
|
951
|
+
if ("text" in subject) return `\u201C${subject.text}\u201D`;
|
|
952
|
+
return "image" in subject ? "picture" : "SVG";
|
|
953
|
+
}
|
|
954
|
+
function SubjectField({ layer, disabled, onSet }) {
|
|
955
|
+
const s = layer.subject;
|
|
956
|
+
const kind = !s ? "" : "slot" in s ? "slot" : "text" in s ? "text" : "image" in s ? "image" : "svg";
|
|
957
|
+
const value = !s ? "" : "slot" in s ? s.slot : "text" in s ? s.text : "image" in s ? s.image : s.svg;
|
|
958
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
959
|
+
/* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Subject" }),
|
|
960
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
|
|
961
|
+
/* @__PURE__ */ jsxs8(
|
|
962
|
+
"select",
|
|
963
|
+
{
|
|
964
|
+
className: `${input3} w-20 flex-none`,
|
|
965
|
+
"aria-label": "Subject kind",
|
|
966
|
+
disabled,
|
|
967
|
+
value: kind,
|
|
968
|
+
onChange: (e) => {
|
|
969
|
+
const k = e.target.value;
|
|
970
|
+
onSet(k === "" ? null : k === "slot" ? { slot: value || "picture" } : k === "text" ? { text: value || "Title" } : k === "image" ? { image: value || "https://" } : { svg: value || '<svg xmlns="http://www.w3.org/2000/svg"/>' });
|
|
971
|
+
},
|
|
972
|
+
children: [
|
|
973
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "none" }),
|
|
974
|
+
/* @__PURE__ */ jsx10("option", { value: "image", children: "picture" }),
|
|
975
|
+
/* @__PURE__ */ jsx10("option", { value: "svg", children: "SVG" }),
|
|
976
|
+
/* @__PURE__ */ jsx10("option", { value: "text", children: "words" }),
|
|
977
|
+
/* @__PURE__ */ jsx10("option", { value: "slot", children: "slot" })
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
kind && /* @__PURE__ */ jsx10(
|
|
982
|
+
CommitInput,
|
|
983
|
+
{
|
|
984
|
+
className: input3,
|
|
985
|
+
"aria-label": kind === "image" ? "Picture URL" : kind === "svg" ? "SVG markup" : kind === "text" ? "Words" : "Slot name",
|
|
986
|
+
disabled,
|
|
987
|
+
value,
|
|
988
|
+
onCommit: (raw) => raw.trim() && onSet({ [kind]: raw })
|
|
989
|
+
}
|
|
990
|
+
)
|
|
991
|
+
] })
|
|
992
|
+
] });
|
|
993
|
+
}
|
|
994
|
+
function LayerControls({ controller, layer, report }) {
|
|
995
|
+
const state = useAnimationEditorState(controller);
|
|
996
|
+
const { description, error } = useEffectDescription(state.effectsProvider, layer.effect);
|
|
997
|
+
const set = (changes, merge) => report(controller.updateShotLayer(layer.id, changes, { merge: merge ?? void 0 }));
|
|
998
|
+
const number = (raw, field, max) => {
|
|
999
|
+
if (raw.trim() === "") return set({ [field]: null });
|
|
1000
|
+
const n = Number(raw);
|
|
1001
|
+
if (Number.isFinite(n) && n >= 0 && n <= max) set({ [field]: n });
|
|
1002
|
+
};
|
|
1003
|
+
return /* @__PURE__ */ jsxs8("div", { className: "col-span-2 grid grid-cols-[4.5rem_1fr] items-center gap-x-2 gap-y-1 border-l border-border pl-2", "data-shot-layer-controls": layer.id, children: [
|
|
1004
|
+
/* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Role" }),
|
|
1005
|
+
/* @__PURE__ */ jsxs8("select", { className: input3, "aria-label": "Layer role", disabled: state.readOnly, value: layer.role ?? "", onChange: (e) => set({ role: e.target.value || null }), children: [
|
|
1006
|
+
/* @__PURE__ */ jsxs8("option", { value: "", children: [
|
|
1007
|
+
layer.rect ? "subject" : "background",
|
|
1008
|
+
" (default)"
|
|
1009
|
+
] }),
|
|
1010
|
+
EFFECT_LAYER_ROLES.map((r) => /* @__PURE__ */ jsx10("option", { value: r, children: r }, r))
|
|
1011
|
+
] }),
|
|
1012
|
+
/* @__PURE__ */ jsx10(SubjectField, { layer, disabled: state.readOnly, onSet: (subject) => set({ subject }) }),
|
|
1013
|
+
/* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Opacity" }),
|
|
1014
|
+
/* @__PURE__ */ jsx10(CommitInput, { className: input3, type: "number", min: 0, max: 1, step: 0.05, "aria-label": "Layer opacity", placeholder: "1", disabled: state.readOnly, value: layer.opacity !== void 0 ? String(layer.opacity) : "", onCommit: (raw) => number(raw, "opacity", 1) }),
|
|
1015
|
+
/* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Fade" }),
|
|
1016
|
+
/* @__PURE__ */ jsx10(CommitInput, { className: input3, type: "number", min: 0, step: 50, "aria-label": "Layer fade (ms)", placeholder: "0", disabled: state.readOnly, value: layer.fade !== void 0 ? String(layer.fade) : "", onCommit: (raw) => number(raw, "fade", 6e4) }),
|
|
1017
|
+
/* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Until" }),
|
|
1018
|
+
/* @__PURE__ */ jsxs8(
|
|
1019
|
+
"select",
|
|
1020
|
+
{
|
|
1021
|
+
className: input3,
|
|
1022
|
+
"aria-label": "Layer lasts until",
|
|
1023
|
+
disabled: state.readOnly,
|
|
1024
|
+
value: typeof layer.until === "object" ? String(layer.until.shots) : layer.until === void 0 ? "1" : "ms",
|
|
1025
|
+
onChange: (e) => set({ until: e.target.value === "1" ? null : { shots: Number(e.target.value) } }),
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ jsx10("option", { value: "1", children: "the next shot" }),
|
|
1028
|
+
/* @__PURE__ */ jsx10("option", { value: "2", children: "the shot after next" }),
|
|
1029
|
+
/* @__PURE__ */ jsx10("option", { value: "3", children: "three shots on" }),
|
|
1030
|
+
typeof layer.until === "number" && /* @__PURE__ */ jsxs8("option", { value: "ms", children: [
|
|
1031
|
+
layer.until,
|
|
1032
|
+
" ms"
|
|
1033
|
+
] })
|
|
1034
|
+
]
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
error && /* @__PURE__ */ jsx10("p", { className: "col-span-2 text-[11px] text-amber-500", children: error }),
|
|
1038
|
+
description && !state.readOnly && /* @__PURE__ */ jsx10("div", { className: "col-span-2", children: /* @__PURE__ */ jsx10(
|
|
1039
|
+
EffectParameters,
|
|
1040
|
+
{
|
|
1041
|
+
description,
|
|
1042
|
+
values: layer.values ?? {},
|
|
1043
|
+
onChange: (k, v, gesture) => set({ values: { ...layer.values ?? {}, [k]: v }, preset: null }, gesture),
|
|
1044
|
+
onReset: (k) => {
|
|
1045
|
+
const { [k]: _gone, ...rest } = layer.values ?? {};
|
|
1046
|
+
set({ values: Object.keys(rest).length ? rest : null, preset: null });
|
|
1047
|
+
},
|
|
1048
|
+
onPresetName: (name) => set({ preset: name, values: null })
|
|
1049
|
+
}
|
|
1050
|
+
) })
|
|
1051
|
+
] });
|
|
1052
|
+
}
|
|
1053
|
+
function ShotLayers({ controller, shot, className = "" }) {
|
|
1054
|
+
const state = useAnimationEditorState(controller);
|
|
1055
|
+
const effects = useEffectList(state.effectsProvider, effectLayerOffered);
|
|
1056
|
+
const [open, setOpen] = useState5(null);
|
|
1057
|
+
const [message, setMessage] = useState5(null);
|
|
1058
|
+
const current = state.scene.shots.find((s) => s.id === shot);
|
|
1059
|
+
if (!current) return null;
|
|
1060
|
+
const layers = current.layers ?? [];
|
|
1061
|
+
const report = (r) => void r.then((x) => {
|
|
1062
|
+
setMessage(x.ok ? null : x.error);
|
|
1063
|
+
if (x.ok && x.layer) setOpen(x.layer.id);
|
|
1064
|
+
});
|
|
1065
|
+
const add = (value) => {
|
|
1066
|
+
if (!value) return;
|
|
1067
|
+
if (value === ":picture") return report(controller.addShotLayer(shot, { subject: { slot: "picture" } }));
|
|
1068
|
+
if (value === ":words") return report(controller.addShotLayer(shot, { subject: { text: "Title" }, role: "overlay" }));
|
|
1069
|
+
const e = effects.find((x) => x.id === value);
|
|
1070
|
+
const needsSubject = e?.uses.includes("filter");
|
|
1071
|
+
report(controller.addShotLayer(shot, { effect: value, ...needsSubject ? { subject: { slot: "picture" } } : {} }));
|
|
1072
|
+
};
|
|
1073
|
+
if (!layers.length && !effects.length && state.readOnly) return null;
|
|
1074
|
+
return /* @__PURE__ */ jsxs8("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-shot-layers": "", children: [
|
|
1075
|
+
/* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Layers" }),
|
|
1076
|
+
/* @__PURE__ */ jsxs8("select", { className: input3, "aria-label": "Add a layer", disabled: state.readOnly, value: "", onChange: (e) => add(e.target.value), children: [
|
|
1077
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "add a layer\u2026" }),
|
|
1078
|
+
/* @__PURE__ */ jsx10("option", { value: ":picture", children: "Picture" }),
|
|
1079
|
+
/* @__PURE__ */ jsx10("option", { value: ":words", children: "Words" }),
|
|
1080
|
+
effects.map((e) => /* @__PURE__ */ jsxs8("option", { value: e.id, children: [
|
|
1081
|
+
e.name,
|
|
1082
|
+
" (",
|
|
1083
|
+
e.uses.filter((u) => u !== "interactive").join(", "),
|
|
1084
|
+
")"
|
|
1085
|
+
] }, e.id))
|
|
1086
|
+
] }),
|
|
1087
|
+
layers.map((layer, i) => ({ layer, i })).reverse().map(({ layer, i }) => /* @__PURE__ */ jsxs8(React7.Fragment, { children: [
|
|
1088
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: "truncate text-left text-xs", "aria-expanded": open === layer.id, onClick: () => setOpen(open === layer.id ? null : layer.id), "data-shot-layer": layer.id, children: layer.name ?? (layer.effect ? layer.effect : "Picture") }),
|
|
1089
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
1090
|
+
/* @__PURE__ */ jsxs8("span", { className: "flex-1 truncate text-[10px] text-muted-foreground", children: [
|
|
1091
|
+
layer.role ?? (layer.rect ? "subject" : "background"),
|
|
1092
|
+
" ",
|
|
1093
|
+
subjectLabel(layer.subject)
|
|
1094
|
+
] }),
|
|
1095
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": `Move ${layer.id} up`, disabled: state.readOnly || i === layers.length - 1, onClick: () => report(controller.moveShotLayer(layer.id, i + 1)), children: "\u2191" }),
|
|
1096
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": `Move ${layer.id} down`, disabled: state.readOnly || i === 0, onClick: () => report(controller.moveShotLayer(layer.id, i - 1)), children: "\u2193" }),
|
|
1097
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": `Remove ${layer.id}`, disabled: state.readOnly, onClick: () => report(controller.removeShotLayer(layer.id)), children: "\xD7" })
|
|
1098
|
+
] }),
|
|
1099
|
+
open === layer.id && /* @__PURE__ */ jsx10(LayerControls, { controller, layer, report })
|
|
1100
|
+
] }, layer.id)),
|
|
1101
|
+
!state.effectsProvider && layers.some((l) => l.effect) && /* @__PURE__ */ jsx10("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "No effects provider is set, so effect layers are not drawn." }),
|
|
1102
|
+
message && /* @__PURE__ */ jsx10("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
|
|
1103
|
+
] });
|
|
1104
|
+
}
|
|
1105
|
+
function ShotTransition({ controller, shot, className = "" }) {
|
|
1106
|
+
const state = useAnimationEditorState(controller);
|
|
1107
|
+
const transitions = useEffectList(state.effectsProvider, isTransition);
|
|
1108
|
+
const index = state.scene.shots.findIndex((s) => s.id === shot);
|
|
1109
|
+
const current = state.scene.shots[index];
|
|
1110
|
+
const transition = current?.transition;
|
|
1111
|
+
const { description } = useEffectDescription(state.effectsProvider, transition?.effect);
|
|
1112
|
+
const [message, setMessage] = useState5(null);
|
|
1113
|
+
if (!current || index === 0 || !transitions.length && !transition) return null;
|
|
1114
|
+
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? null : x.error));
|
|
1115
|
+
const set = (changes, merge) => {
|
|
1116
|
+
const next = { ...transition, ...changes };
|
|
1117
|
+
for (const k of Object.keys(next)) if (next[k] === null) delete next[k];
|
|
1118
|
+
report(controller.setShotTransition(shot, next, { merge: merge ?? void 0 }));
|
|
1119
|
+
};
|
|
1120
|
+
const known = transitions.some((t) => t.id === transition?.effect);
|
|
1121
|
+
return /* @__PURE__ */ jsxs8("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-shot-transition": "", children: [
|
|
1122
|
+
/* @__PURE__ */ jsx10("label", { className: "text-muted-foreground", children: "Transition in" }),
|
|
1123
|
+
/* @__PURE__ */ jsxs8("select", { className: input3, "aria-label": "Transition in", disabled: state.readOnly, value: transition?.effect ?? "", onChange: (e) => e.target.value ? report(controller.setShotTransition(shot, { effect: e.target.value, ...transition?.ms ? { ms: transition.ms } : {} })) : report(controller.clearShotTransition(shot)), children: [
|
|
1124
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "cut" }),
|
|
1125
|
+
transition && !known && /* @__PURE__ */ jsxs8("option", { value: transition.effect, children: [
|
|
1126
|
+
transition.name ?? transition.effect,
|
|
1127
|
+
" (not in the provider)"
|
|
1128
|
+
] }),
|
|
1129
|
+
transitions.map((t) => /* @__PURE__ */ jsx10("option", { value: t.id, children: t.name }, t.id))
|
|
1130
|
+
] }),
|
|
1131
|
+
transition && known && !state.readOnly && /* @__PURE__ */ jsxs8("div", { className: "col-span-2 flex flex-col gap-1 border-l border-border pl-2", "data-shot-transition-controls": "", children: [
|
|
1132
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
1133
|
+
/* @__PURE__ */ jsx10("span", { className: "w-16 text-muted-foreground", children: "Length" }),
|
|
1134
|
+
/* @__PURE__ */ jsx10(CommitInput, { className: input3, type: "number", min: 1, step: 50, "aria-label": "Transition length", value: String(transition.ms ?? ""), onCommit: (raw) => Number(raw) > 0 ? set({ ms: Number(raw) }) : setMessage("Length is a number of ms above 0.") }),
|
|
1135
|
+
/* @__PURE__ */ jsx10("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
|
|
1136
|
+
] }),
|
|
1137
|
+
description && /* @__PURE__ */ jsx10(
|
|
1138
|
+
EffectParameters,
|
|
1139
|
+
{
|
|
1140
|
+
description,
|
|
1141
|
+
values: transition.values ?? {},
|
|
1142
|
+
onChange: (k, v, gesture) => set({ values: { ...transition.values ?? {}, [k]: v }, preset: null }, gesture),
|
|
1143
|
+
onReset: (k) => {
|
|
1144
|
+
const { [k]: _gone, ...rest } = transition.values ?? {};
|
|
1145
|
+
set({ values: Object.keys(rest).length ? rest : null, preset: null });
|
|
1146
|
+
},
|
|
1147
|
+
onPresetName: (name) => set({ preset: name, values: null })
|
|
1148
|
+
}
|
|
1149
|
+
)
|
|
1150
|
+
] }),
|
|
1151
|
+
message && /* @__PURE__ */ jsx10("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
|
|
1152
|
+
] });
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
// src/animation-editor/ShotCameraMoves.tsx
|
|
1156
|
+
import React8, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1157
|
+
import { motionShotCameraMove } from "@pixerate/editor/animation-editor";
|
|
1158
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1159
|
+
var input4 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
931
1160
|
var ROLES = [
|
|
932
1161
|
{ role: "transition", label: "Move in", none: "ease in" },
|
|
933
1162
|
{ role: "hold", label: "While holding", none: "stay still" }
|
|
934
1163
|
];
|
|
935
1164
|
function useCameraMoves(controller, provider) {
|
|
936
|
-
const [moves, setMoves] =
|
|
937
|
-
|
|
1165
|
+
const [moves, setMoves] = useState6({ transition: [], hold: [] });
|
|
1166
|
+
useEffect4(() => {
|
|
938
1167
|
let live = true;
|
|
939
1168
|
void Promise.all([controller.cameraMoves("transition"), controller.cameraMoves("hold")]).then(
|
|
940
1169
|
([transition, hold]) => live && setMoves({ transition, hold }),
|
|
@@ -950,7 +1179,7 @@ function MoveControls({ controller, shot, role }) {
|
|
|
950
1179
|
const state = useAnimationEditorState(controller);
|
|
951
1180
|
const move = motionShotCameraMove(state.scene.shots.find((s) => s.id === shot), role);
|
|
952
1181
|
const { description, error } = useEffectDescription(state.effectsProvider, move?.move);
|
|
953
|
-
const [message, setMessage] =
|
|
1182
|
+
const [message, setMessage] = useState6(null);
|
|
954
1183
|
if (!move) return null;
|
|
955
1184
|
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
956
1185
|
const set = (changes, merge) => {
|
|
@@ -958,15 +1187,15 @@ function MoveControls({ controller, shot, role }) {
|
|
|
958
1187
|
for (const k of Object.keys(next)) if (next[k] === null || k === "values" && !Object.keys(next[k]).length) delete next[k];
|
|
959
1188
|
report(controller.setShotCameraMove(shot, role, next, { merge: merge ?? void 0 }));
|
|
960
1189
|
};
|
|
961
|
-
if (error) return /* @__PURE__ */
|
|
1190
|
+
if (error) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-500", children: error });
|
|
962
1191
|
if (!description) return null;
|
|
963
|
-
return /* @__PURE__ */
|
|
964
|
-
role === "transition" && /* @__PURE__ */
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
1192
|
+
return /* @__PURE__ */ jsxs9("div", { className: "col-span-2 flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
|
|
1193
|
+
role === "transition" && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1194
|
+
/* @__PURE__ */ jsx11("span", { className: "w-16 text-muted-foreground", children: "Length" }),
|
|
1195
|
+
/* @__PURE__ */ jsx11(
|
|
967
1196
|
CommitInput,
|
|
968
1197
|
{
|
|
969
|
-
className:
|
|
1198
|
+
className: input4,
|
|
970
1199
|
type: "number",
|
|
971
1200
|
min: 0,
|
|
972
1201
|
step: 50,
|
|
@@ -976,9 +1205,9 @@ function MoveControls({ controller, shot, role }) {
|
|
|
976
1205
|
onCommit: (raw) => raw.trim() === "" ? set({ ms: null }) : Number.isFinite(Number(raw)) && Number(raw) >= 0 ? set({ ms: Number(raw) }) : setMessage("Length is a number of ms, 0 or more.")
|
|
977
1206
|
}
|
|
978
1207
|
),
|
|
979
|
-
/* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ jsx11("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
|
|
980
1209
|
] }),
|
|
981
|
-
/* @__PURE__ */
|
|
1210
|
+
/* @__PURE__ */ jsx11(
|
|
982
1211
|
EffectParameters,
|
|
983
1212
|
{
|
|
984
1213
|
description,
|
|
@@ -991,63 +1220,63 @@ function MoveControls({ controller, shot, role }) {
|
|
|
991
1220
|
onPresetName: (name) => set({ preset: name, values: {} })
|
|
992
1221
|
}
|
|
993
1222
|
),
|
|
994
|
-
message && /* @__PURE__ */
|
|
1223
|
+
message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
995
1224
|
] });
|
|
996
1225
|
}
|
|
997
1226
|
function ShotCameraMoves({ controller, shot, className = "" }) {
|
|
998
1227
|
const state = useAnimationEditorState(controller);
|
|
999
1228
|
const moves = useCameraMoves(controller, state.effectsProvider);
|
|
1000
1229
|
const current = state.scene.shots.find((s) => s.id === shot);
|
|
1001
|
-
const [message, setMessage] =
|
|
1230
|
+
const [message, setMessage] = useState6(null);
|
|
1002
1231
|
if (!current) return null;
|
|
1003
1232
|
const has = moves.transition.length + moves.hold.length > 0;
|
|
1004
1233
|
const named = current.camera?.in !== void 0 || current.camera?.during !== void 0;
|
|
1005
1234
|
if (!has)
|
|
1006
|
-
return named ? /* @__PURE__ */
|
|
1235
|
+
return named ? /* @__PURE__ */ jsxs9("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
|
|
1007
1236
|
"This shot names camera moves, but ",
|
|
1008
1237
|
state.effectsProvider ? `${state.effectsProvider.name} has none` : "no effects provider is set",
|
|
1009
1238
|
", so the camera eases instead."
|
|
1010
1239
|
] }) : null;
|
|
1011
1240
|
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? null : x.error));
|
|
1012
|
-
return /* @__PURE__ */
|
|
1241
|
+
return /* @__PURE__ */ jsxs9("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-camera-moves": "", children: [
|
|
1013
1242
|
ROLES.map(({ role, label, none }) => {
|
|
1014
1243
|
const move = motionShotCameraMove(current, role);
|
|
1015
1244
|
const known = moves[role].some((m) => m.id === move?.move);
|
|
1016
|
-
return /* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ jsxs9(React8.Fragment, { children: [
|
|
1246
|
+
/* @__PURE__ */ jsx11("label", { className: "text-muted-foreground", children: label }),
|
|
1247
|
+
/* @__PURE__ */ jsxs9(
|
|
1019
1248
|
"select",
|
|
1020
1249
|
{
|
|
1021
|
-
className:
|
|
1250
|
+
className: input4,
|
|
1022
1251
|
"aria-label": label,
|
|
1023
1252
|
disabled: state.readOnly,
|
|
1024
1253
|
value: move?.move ?? "",
|
|
1025
1254
|
onChange: (e) => report(e.target.value ? controller.setShotCameraMove(current.id, role, e.target.value) : controller.clearShotCameraMove(current.id, role)),
|
|
1026
1255
|
children: [
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
move && !known && /* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: none }),
|
|
1257
|
+
move && !known && /* @__PURE__ */ jsxs9("option", { value: move.move, children: [
|
|
1029
1258
|
move.move,
|
|
1030
1259
|
" (not in the provider)"
|
|
1031
1260
|
] }),
|
|
1032
|
-
moves[role].map((m) => /* @__PURE__ */
|
|
1261
|
+
moves[role].map((m) => /* @__PURE__ */ jsx11("option", { value: m.id, children: m.name }, m.id))
|
|
1033
1262
|
]
|
|
1034
1263
|
}
|
|
1035
1264
|
),
|
|
1036
|
-
move && known && !state.readOnly && /* @__PURE__ */
|
|
1265
|
+
move && known && !state.readOnly && /* @__PURE__ */ jsx11(MoveControls, { controller, shot: current.id, role })
|
|
1037
1266
|
] }, role);
|
|
1038
1267
|
}),
|
|
1039
|
-
message && /* @__PURE__ */
|
|
1268
|
+
message && /* @__PURE__ */ jsx11("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
|
|
1040
1269
|
] });
|
|
1041
1270
|
}
|
|
1042
1271
|
|
|
1043
1272
|
// src/animation-editor/ShotInspector.tsx
|
|
1044
|
-
import { Fragment as
|
|
1045
|
-
var
|
|
1273
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1274
|
+
var input5 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
1046
1275
|
var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1047
1276
|
function ShotInspector({ controller, shot, className = "" }) {
|
|
1048
1277
|
const state = useAnimationEditorState(controller);
|
|
1049
1278
|
const { scene, selection, readOnly, error } = state;
|
|
1050
|
-
const [local, setLocalState] =
|
|
1279
|
+
const [local, setLocalState] = useState7(null);
|
|
1051
1280
|
const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
|
|
1052
1281
|
const elements = useMemo5(() => describeMotionElements2(scene), [scene.artwork]);
|
|
1053
1282
|
const cues = useMemo5(() => motionCueChoices(scene), [scene]);
|
|
@@ -1075,37 +1304,37 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
1075
1304
|
const message = (local && local.revision === state.revision ? local.text : null) ?? error;
|
|
1076
1305
|
const cueKey = current ? motionCueKey(current.at) : "";
|
|
1077
1306
|
const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
|
|
1078
|
-
return /* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
current && /* @__PURE__ */
|
|
1082
|
-
/* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1084
|
-
current && /* @__PURE__ */
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1307
|
+
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
|
|
1308
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1309
|
+
/* @__PURE__ */ jsx12("span", { className: "font-medium", children: "Shot" }),
|
|
1310
|
+
current && /* @__PURE__ */ jsx12("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
|
|
1311
|
+
/* @__PURE__ */ jsxs10("span", { className: "ml-auto flex gap-0.5", children: [
|
|
1312
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: btn4, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
|
|
1313
|
+
current && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1314
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
1315
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
1316
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: btn4, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
|
|
1088
1317
|
] })
|
|
1089
1318
|
] })
|
|
1090
1319
|
] }),
|
|
1091
|
-
current && /* @__PURE__ */
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
/* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1320
|
+
current && /* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
|
|
1321
|
+
/* @__PURE__ */ jsx12("label", { className: "text-muted-foreground", children: "Label" }),
|
|
1322
|
+
/* @__PURE__ */ jsx12(CommitInput, { className: input5, "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") }),
|
|
1323
|
+
/* @__PURE__ */ jsx12("label", { className: "text-muted-foreground", children: "Hold" }),
|
|
1324
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1325
|
+
/* @__PURE__ */ jsx12(CommitInput, { className: input5, 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") }),
|
|
1326
|
+
/* @__PURE__ */ jsx12("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
|
|
1098
1327
|
] }),
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ jsx12("label", { className: "text-muted-foreground", children: "Speed" }),
|
|
1329
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1330
|
+
/* @__PURE__ */ jsx12(CommitInput, { className: input5, 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") }),
|
|
1331
|
+
/* @__PURE__ */ jsx12("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
|
|
1103
1332
|
] }),
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ jsx12("label", { className: "text-muted-foreground", children: "Camera" }),
|
|
1334
|
+
/* @__PURE__ */ jsxs10(
|
|
1106
1335
|
"select",
|
|
1107
1336
|
{
|
|
1108
|
-
className:
|
|
1337
|
+
className: input5,
|
|
1109
1338
|
"aria-label": "Camera frames",
|
|
1110
1339
|
disabled: readOnly,
|
|
1111
1340
|
value: current.camera && motionCameraFramed(current.camera) ? frame ? `frame:${frame}` : "rect" : "",
|
|
@@ -1116,20 +1345,20 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
1116
1345
|
else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { ...moves, frame: v.slice(6), padding: 24 } } }, "Frame camera");
|
|
1117
1346
|
},
|
|
1118
1347
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
current.camera && motionCameraFramed(current.camera) && !frame && /* @__PURE__ */
|
|
1121
|
-
elements.map((e) => /* @__PURE__ */
|
|
1348
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "keep framing" }),
|
|
1349
|
+
current.camera && motionCameraFramed(current.camera) && !frame && /* @__PURE__ */ jsx12("option", { value: "rect", children: "a rectangle" }),
|
|
1350
|
+
elements.map((e) => /* @__PURE__ */ jsxs10("option", { value: `frame:${e.id}`, children: [
|
|
1122
1351
|
"frame ",
|
|
1123
1352
|
e.name ?? e.id
|
|
1124
1353
|
] }, e.id))
|
|
1125
1354
|
]
|
|
1126
1355
|
}
|
|
1127
1356
|
),
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ jsx12("label", { className: "text-muted-foreground", children: "Starts on" }),
|
|
1358
|
+
/* @__PURE__ */ jsxs10(
|
|
1130
1359
|
"select",
|
|
1131
1360
|
{
|
|
1132
|
-
className:
|
|
1361
|
+
className: input5,
|
|
1133
1362
|
"aria-label": "Cue",
|
|
1134
1363
|
disabled: readOnly || index === 0,
|
|
1135
1364
|
value: cueKey,
|
|
@@ -1138,34 +1367,36 @@ function ShotInspector({ controller, shot, className = "" }) {
|
|
|
1138
1367
|
apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
|
|
1139
1368
|
},
|
|
1140
1369
|
children: [
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */
|
|
1143
|
-
cues.map((c) => /* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "after the shot before" }),
|
|
1371
|
+
cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ jsx12("option", { value: cueKey, children: cueKey }),
|
|
1372
|
+
cues.map((c) => /* @__PURE__ */ jsx12("option", { value: c.value, children: c.label }, c.value))
|
|
1144
1373
|
]
|
|
1145
1374
|
}
|
|
1146
1375
|
),
|
|
1147
|
-
!cues.length && index > 0 && /* @__PURE__ */
|
|
1376
|
+
!cues.length && index > 0 && /* @__PURE__ */ jsx12("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." })
|
|
1148
1377
|
] }),
|
|
1149
|
-
current && /* @__PURE__ */
|
|
1150
|
-
|
|
1378
|
+
current && /* @__PURE__ */ jsx12(ShotCameraMoves, { controller, shot: current.id }),
|
|
1379
|
+
current && /* @__PURE__ */ jsx12(ShotTransition, { controller, shot: current.id }),
|
|
1380
|
+
current && /* @__PURE__ */ jsx12(ShotLayers, { controller, shot: current.id }),
|
|
1381
|
+
message && /* @__PURE__ */ jsx12("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
|
|
1151
1382
|
] });
|
|
1152
1383
|
}
|
|
1153
1384
|
|
|
1154
1385
|
// src/animation-editor/AnimationEffectsPanel.tsx
|
|
1155
|
-
import { useMemo as useMemo6, useState as
|
|
1386
|
+
import { useMemo as useMemo6, useState as useState8 } from "react";
|
|
1156
1387
|
import { indexMotionNodes } from "@pixerate/editor/animation-editor";
|
|
1157
|
-
import { Fragment as
|
|
1388
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1158
1389
|
var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1159
1390
|
function Controls({ controller, instance, effect, values }) {
|
|
1160
1391
|
const provider = controller.effectsProvider;
|
|
1161
1392
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1162
|
-
const [message, setMessage] =
|
|
1393
|
+
const [message, setMessage] = useState8(null);
|
|
1163
1394
|
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
1164
|
-
if (!provider) return /* @__PURE__ */
|
|
1165
|
-
if (error) return /* @__PURE__ */
|
|
1166
|
-
if (!description) return /* @__PURE__ */
|
|
1167
|
-
return /* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1395
|
+
if (!provider) return /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
|
|
1396
|
+
if (error) return /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-amber-500", children: error });
|
|
1397
|
+
if (!description) return /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
1398
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1399
|
+
/* @__PURE__ */ jsx13(
|
|
1169
1400
|
EffectParameters,
|
|
1170
1401
|
{
|
|
1171
1402
|
description,
|
|
@@ -1175,55 +1406,55 @@ function Controls({ controller, instance, effect, values }) {
|
|
|
1175
1406
|
onPreset: (v) => report(controller.updateMotionEffect(instance, v))
|
|
1176
1407
|
}
|
|
1177
1408
|
),
|
|
1178
|
-
message && /* @__PURE__ */
|
|
1409
|
+
message && /* @__PURE__ */ jsx13("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
1179
1410
|
] });
|
|
1180
1411
|
}
|
|
1181
1412
|
function AnimationEffectsPanel({ controller, node, className = "" }) {
|
|
1182
1413
|
const state = useAnimationEditorState(controller);
|
|
1183
1414
|
const provider = state.effectsProvider;
|
|
1184
1415
|
const nodes = useMemo6(() => [...indexMotionNodes(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
|
|
1185
|
-
const [chosen, setChosen] =
|
|
1416
|
+
const [chosen, setChosen] = useState8("");
|
|
1186
1417
|
const target = node && nodes.includes(node) ? node : chosen && nodes.includes(chosen) ? chosen : "";
|
|
1187
|
-
const [browse, setBrowse] =
|
|
1188
|
-
const [open, setOpen] =
|
|
1189
|
-
const [message, setMessage] =
|
|
1418
|
+
const [browse, setBrowse] = useState8(null);
|
|
1419
|
+
const [open, setOpen] = useState8(null);
|
|
1420
|
+
const [message, setMessage] = useState8(null);
|
|
1190
1421
|
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
|
|
1191
1422
|
const applied = useMemo6(() => controller.appliedEffects(), [controller, state.scene]);
|
|
1192
1423
|
const disabled = state.readOnly;
|
|
1193
|
-
return /* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
nodes.map((id) => /* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsxs11("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
|
|
1425
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1426
|
+
/* @__PURE__ */ jsx13("span", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
1427
|
+
/* @__PURE__ */ jsxs11("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: [
|
|
1428
|
+
/* @__PURE__ */ jsx13("option", { value: "", children: "Node\u2026" }),
|
|
1429
|
+
nodes.map((id) => /* @__PURE__ */ jsx13("option", { value: id, children: id }, id))
|
|
1199
1430
|
] }),
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn5, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
|
|
1432
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
|
|
1202
1433
|
] }),
|
|
1203
|
-
!provider && /* @__PURE__ */
|
|
1204
|
-
browse === "motion" && /* @__PURE__ */
|
|
1205
|
-
browse === "vector" && /* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1434
|
+
!provider && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
|
|
1435
|
+
browse === "motion" && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
|
|
1436
|
+
browse === "vector" && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
|
|
1437
|
+
/* @__PURE__ */ jsx13("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ jsxs11("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
|
|
1438
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
1439
|
+
/* @__PURE__ */ jsxs11("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: [
|
|
1209
1440
|
e.name ?? e.effect,
|
|
1210
1441
|
" ",
|
|
1211
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
|
|
1212
1443
|
"\xB7 ",
|
|
1213
1444
|
e.kind === "vector" ? "picture" : e.targets.join(", ")
|
|
1214
1445
|
] })
|
|
1215
1446
|
] }),
|
|
1216
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
|
|
1217
1448
|
] }),
|
|
1218
|
-
open === e.instance && /* @__PURE__ */
|
|
1449
|
+
open === e.instance && /* @__PURE__ */ jsx13("div", { className: "mt-1", children: /* @__PURE__ */ jsx13(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
|
|
1219
1450
|
] }, e.instance)) }),
|
|
1220
|
-
!applied.length && /* @__PURE__ */
|
|
1221
|
-
message && /* @__PURE__ */
|
|
1451
|
+
!applied.length && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
|
|
1452
|
+
message && /* @__PURE__ */ jsx13("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
|
|
1222
1453
|
] });
|
|
1223
1454
|
}
|
|
1224
1455
|
|
|
1225
1456
|
// src/animation-editor/AnimationEditor.tsx
|
|
1226
|
-
import { Fragment as
|
|
1457
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1227
1458
|
var ONION = { before: 3, after: 1 };
|
|
1228
1459
|
var btn6 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
1229
1460
|
function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
|
|
@@ -1263,13 +1494,13 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1263
1494
|
},
|
|
1264
1495
|
reveal: () => onPlaybackReveal?.()
|
|
1265
1496
|
});
|
|
1266
|
-
const presenceLayer = playing ? /* @__PURE__ */
|
|
1497
|
+
const presenceLayer = playing ? /* @__PURE__ */ jsx14(PresenceLayer, { presence: agentPresence }) : null;
|
|
1267
1498
|
useEffects(controller, effects);
|
|
1268
1499
|
const { issues, scene, selection, readOnly } = state;
|
|
1269
|
-
const [picked, setPicked] =
|
|
1270
|
-
const [onion, setOnion] =
|
|
1271
|
-
const [paths, setPaths] =
|
|
1272
|
-
const [recordMode, setRecordMode] =
|
|
1500
|
+
const [picked, setPicked] = useState9(null);
|
|
1501
|
+
const [onion, setOnion] = useState9(false);
|
|
1502
|
+
const [paths, setPaths] = useState9(false);
|
|
1503
|
+
const [recordMode, setRecordMode] = useState9("move");
|
|
1273
1504
|
const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
|
|
1274
1505
|
const targets = command && "targets" in command ? command.targets : [];
|
|
1275
1506
|
const nodes = useMemo7(() => indexMotionNodes2(scene.artwork.nodes), [scene.artwork]);
|
|
@@ -1282,7 +1513,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1282
1513
|
}
|
|
1283
1514
|
setPicked(id);
|
|
1284
1515
|
};
|
|
1285
|
-
const stage = /* @__PURE__ */
|
|
1516
|
+
const stage = /* @__PURE__ */ jsx14(
|
|
1286
1517
|
AnimationStage,
|
|
1287
1518
|
{
|
|
1288
1519
|
controller,
|
|
@@ -1295,15 +1526,15 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1295
1526
|
className: "rounded-md border border-border bg-muted/40"
|
|
1296
1527
|
}
|
|
1297
1528
|
);
|
|
1298
|
-
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */
|
|
1529
|
+
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ jsx14("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: motionIssueLine(issue) }, i)) });
|
|
1299
1530
|
if (!editable)
|
|
1300
|
-
return /* @__PURE__ */
|
|
1531
|
+
return /* @__PURE__ */ jsxs12("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
|
|
1301
1532
|
presenceLayer,
|
|
1302
1533
|
stage,
|
|
1303
|
-
/* @__PURE__ */
|
|
1534
|
+
/* @__PURE__ */ jsx14(PlayheadScrubber, { controller }),
|
|
1304
1535
|
issueList
|
|
1305
1536
|
] });
|
|
1306
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ jsxs12(
|
|
1307
1538
|
"div",
|
|
1308
1539
|
{
|
|
1309
1540
|
ref: rootRef,
|
|
@@ -1318,41 +1549,41 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
|
|
|
1318
1549
|
},
|
|
1319
1550
|
children: [
|
|
1320
1551
|
presenceLayer,
|
|
1321
|
-
/* @__PURE__ */
|
|
1552
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
1322
1553
|
stage,
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
onionSkin === void 0 && /* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ jsx14(PlayheadScrubber, { controller }),
|
|
1555
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1556
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: btn6, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
|
|
1557
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: btn6, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
|
|
1558
|
+
onionSkin === void 0 && /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
1559
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
|
|
1329
1560
|
" Onion skin"
|
|
1330
1561
|
] }),
|
|
1331
|
-
motionPaths === void 0 && /* @__PURE__ */
|
|
1332
|
-
/* @__PURE__ */
|
|
1562
|
+
motionPaths === void 0 && /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
1563
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
|
|
1333
1564
|
" Motion paths"
|
|
1334
1565
|
] }),
|
|
1335
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ jsx14("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
1336
1567
|
"Picked ",
|
|
1337
|
-
/* @__PURE__ */
|
|
1568
|
+
/* @__PURE__ */ jsx14("code", { className: "text-rose-500", children: pickedValid }),
|
|
1338
1569
|
" ",
|
|
1339
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
|
|
1340
1571
|
] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
|
|
1341
1572
|
] }),
|
|
1342
|
-
!readOnly && /* @__PURE__ */
|
|
1573
|
+
!readOnly && /* @__PURE__ */ jsx14(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
|
|
1343
1574
|
issueList
|
|
1344
1575
|
] }),
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1576
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-col gap-3", children: [
|
|
1577
|
+
/* @__PURE__ */ jsx14(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
|
|
1578
|
+
(state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ jsx14(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
|
|
1579
|
+
/* @__PURE__ */ jsx14(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
|
|
1580
|
+
/* @__PURE__ */ jsxs12("details", { open: true, className: "border-t border-border pt-2", children: [
|
|
1581
|
+
/* @__PURE__ */ jsx14("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
|
|
1582
|
+
/* @__PURE__ */ jsx14(ShotInspector, { controller, className: "mt-1" })
|
|
1352
1583
|
] }),
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ jsxs12("details", { className: "border-t border-border pt-2", children: [
|
|
1585
|
+
/* @__PURE__ */ jsx14("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
|
|
1586
|
+
/* @__PURE__ */ jsx14(SceneSettings, { controller, className: "mt-1" })
|
|
1356
1587
|
] })
|
|
1357
1588
|
] })
|
|
1358
1589
|
]
|
|
@@ -1371,7 +1602,9 @@ export {
|
|
|
1371
1602
|
SceneSettings,
|
|
1372
1603
|
ShotCameraMoves,
|
|
1373
1604
|
ShotInspector,
|
|
1605
|
+
ShotLayers,
|
|
1374
1606
|
ShotTimeline,
|
|
1607
|
+
ShotTransition,
|
|
1375
1608
|
useAnimationEditor,
|
|
1376
1609
|
useAnimationEditorController,
|
|
1377
1610
|
useAnimationEditorState,
|