@pixerate/editor-react 0.158.0 → 0.160.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.
@@ -123,7 +123,7 @@ function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, hi
123
123
  controller.toSvg(time, { pretty: false, idPrefix: "ae-", values, onionSkin, motionPaths }).replace(/<svg ([^>]*?)width="[^"]*" height="[^"]*"/, '<svg $1width="100%" height="100%"'),
124
124
  highlight ?? []
125
125
  ),
126
- [controller, scene, time, samples, values, onionSkin, motionPaths, key, state.effectsProvider]
126
+ [controller, scene, time, samples, values, onionSkin, motionPaths, key, state.effectsProvider, state.layerPictures]
127
127
  );
128
128
  const stageRef = (0, import_react2.useRef)(null);
129
129
  const view = (0, import_react2.useMemo)(() => (0, import_animation_editor2.motionCameraViewAt)(controller.viewScene(), time, state.effectsProvider), [controller, scene, time, samples, state.effectsProvider]);
@@ -229,7 +229,7 @@ function ShotTimeline({ controller, className = "" }) {
229
229
  }
230
230
 
231
231
  // src/animation-editor/AnimationEditor.tsx
232
- var import_react24 = require("react");
232
+ var import_react25 = require("react");
233
233
 
234
234
  // src/playback/AgentPlaybackContext.tsx
235
235
  var import_react3 = require("react");
@@ -1038,12 +1038,12 @@ function SceneSettings({ controller, className = "" }) {
1038
1038
  }
1039
1039
 
1040
1040
  // src/animation-editor/ShotInspector.tsx
1041
- var import_react22 = require("react");
1041
+ var import_react23 = require("react");
1042
1042
  var import_animation_editor10 = require("@pixerate/editor/animation-editor");
1043
1043
 
1044
1044
  // src/animation-editor/ShotLayers.tsx
1045
- var import_react20 = __toESM(require("react"), 1);
1046
- var import_effects4 = require("@pixerate/editor/effects");
1045
+ var import_react21 = __toESM(require("react"), 1);
1046
+ var import_effects5 = require("@pixerate/editor/effects");
1047
1047
 
1048
1048
  // src/effects/useEffects.ts
1049
1049
  var import_react11 = require("react");
@@ -2311,10 +2311,10 @@ function ParameterNumberInput(props) {
2311
2311
  const resolved = resolveParameterComponents(components, ctx);
2312
2312
  const CustomInput = resolved.input;
2313
2313
  const plain = plainNumber(field, value);
2314
- const handleCommit = (text, input6) => {
2314
+ const handleCommit = (text, input7) => {
2315
2315
  const n = (0, import_parameters.parseParameterNumberInput)(field, text);
2316
2316
  if (n === null || n === value) {
2317
- if (input6) input6.value = plain;
2317
+ if (input7) input7.value = plain;
2318
2318
  } else {
2319
2319
  onChange(n);
2320
2320
  }
@@ -2812,13 +2812,130 @@ function EffectParameters({
2812
2812
  ] });
2813
2813
  }
2814
2814
 
2815
- // src/animation-editor/ShotLayers.tsx
2815
+ // src/effects/EffectTemplates.tsx
2816
+ var import_react20 = require("react");
2817
+ var import_effects4 = require("@pixerate/editor/effects");
2816
2818
  var import_jsx_runtime19 = require("react/jsx-runtime");
2817
2819
  var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
2820
+ var btn4 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
2821
+ function SlotField({ slot, value, error, onChange }) {
2822
+ const id = `template-slot-${slot.name}`;
2823
+ let field;
2824
+ if (slot.type === "color") field = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { id, className: "h-6 w-10", type: "color", value: String(value), onChange: (e) => onChange(e.target.value) });
2825
+ else if (slot.type === "number")
2826
+ field = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { id, className: input3, type: "number", min: slot.min, max: slot.max, step: slot.integer ? 1 : "any", value: String(value), onChange: (e) => onChange(e.target.value === "" ? "" : Number(e.target.value)) });
2827
+ else if (slot.type === "text")
2828
+ field = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
2829
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { id, className: input3, maxLength: slot.maxLength, value: String(value), onChange: (e) => onChange(e.target.value) }),
2830
+ slot.maxLength !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
2831
+ String(value).length,
2832
+ "/",
2833
+ slot.maxLength
2834
+ ] })
2835
+ ] });
2836
+ else
2837
+ field = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2838
+ "input",
2839
+ {
2840
+ id,
2841
+ className: input3,
2842
+ placeholder: slot.hasDefault ? "URL or <svg> (default: a placeholder)" : "URL or <svg> (empty: left open)",
2843
+ value: typeof value === "string" ? value : "",
2844
+ onChange: (e) => onChange(e.target.value)
2845
+ }
2846
+ );
2847
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-0.5", "data-template-slot": slot.name, children: [
2848
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: id, className: "text-muted-foreground", title: slot.description, children: slot.label }),
2849
+ field,
2850
+ error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-destructive", children: error })
2851
+ ] });
2852
+ }
2853
+ function EffectTemplates({ provider, onFill, fillLabel = "Use template", disabled = false, className = "" }) {
2854
+ const [templates, setTemplates] = (0, import_react20.useState)([]);
2855
+ const [chosen, setChosen] = (0, import_react20.useState)("");
2856
+ const [description, setDescription] = (0, import_react20.useState)(null);
2857
+ const [values, setValues] = (0, import_react20.useState)({});
2858
+ const [message, setMessage] = (0, import_react20.useState)(null);
2859
+ const [busy, setBusy] = (0, import_react20.useState)(false);
2860
+ const supported = !!provider?.capabilities.supportsTemplates && !!provider.listTemplates && !!provider.describeTemplate;
2861
+ (0, import_react20.useEffect)(() => {
2862
+ let live = true;
2863
+ setTemplates([]);
2864
+ setChosen("");
2865
+ if (supported) void Promise.resolve(provider.listTemplates()).then((t) => live && setTemplates(t), () => live && setTemplates([]));
2866
+ return () => {
2867
+ live = false;
2868
+ };
2869
+ }, [provider, supported]);
2870
+ (0, import_react20.useEffect)(() => {
2871
+ let live = true;
2872
+ setDescription(null);
2873
+ setMessage(null);
2874
+ if (!chosen || !supported) return;
2875
+ void Promise.resolve(provider.describeTemplate(chosen)).then(
2876
+ (d) => {
2877
+ if (!live) return;
2878
+ setDescription(d);
2879
+ setValues(Object.fromEntries(d.slots.map((s) => [s.name, (0, import_effects4.isSubjectTemplateSlot)(s) ? "" : s.default])));
2880
+ },
2881
+ (e) => live && setMessage(e.message)
2882
+ );
2883
+ return () => {
2884
+ live = false;
2885
+ };
2886
+ }, [provider, supported, chosen]);
2887
+ if (!supported || !templates.length) return null;
2888
+ const given = Object.fromEntries(Object.entries(values).filter(([, v]) => v !== ""));
2889
+ const problems = description ? (0, import_effects4.checkTemplateValues)(description.slots, given) : [];
2890
+ const problemFor = (slot) => problems.find((p) => p.startsWith(`Slot "${slot}"`));
2891
+ const fill = async () => {
2892
+ if (!description || problems.length) return;
2893
+ setBusy(true);
2894
+ const r = await onFill(description.id, given);
2895
+ setBusy(false);
2896
+ if (r.ok) setChosen("");
2897
+ else setMessage(r.error);
2898
+ };
2899
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-effect-templates": "", children: [
2900
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { className: input3, "aria-label": "Template", disabled, value: chosen, onChange: (e) => setChosen(e.target.value), children: [
2901
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "Templates\u2026" }),
2902
+ templates.map((t) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: t.id, children: [
2903
+ t.name,
2904
+ " (",
2905
+ t.shots,
2906
+ " shots)"
2907
+ ] }, t.id))
2908
+ ] }),
2909
+ description && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2910
+ "form",
2911
+ {
2912
+ className: "flex flex-col gap-1 rounded border border-border p-1",
2913
+ "data-template-form": description.id,
2914
+ onSubmit: (e) => {
2915
+ e.preventDefault();
2916
+ void fill();
2917
+ },
2918
+ children: [
2919
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: description.description }),
2920
+ description.slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SlotField, { slot, value: values[slot.name] ?? "", error: problemFor(slot.name), onChange: (v) => setValues({ ...values, [slot.name]: v }) }, slot.name)),
2921
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
2922
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "submit", className: btn4, disabled: disabled || busy || problems.length > 0, children: fillLabel }),
2923
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn4, onClick: () => setChosen(""), children: "Cancel" })
2924
+ ] })
2925
+ ]
2926
+ }
2927
+ ),
2928
+ message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2929
+ ] });
2930
+ }
2931
+
2932
+ // src/animation-editor/ShotLayers.tsx
2933
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2934
+ var input4 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
2818
2935
  var button = "rounded border border-border px-1 text-[11px] disabled:opacity-40";
2819
2936
  function useEffectList(provider, keep) {
2820
- const [list, setList] = (0, import_react20.useState)([]);
2821
- (0, import_react20.useEffect)(() => {
2937
+ const [list, setList] = (0, import_react21.useState)([]);
2938
+ (0, import_react21.useEffect)(() => {
2822
2939
  let live = true;
2823
2940
  if (!provider) return setList([]);
2824
2941
  void Promise.resolve(provider.list()).then(
@@ -2842,13 +2959,13 @@ function SubjectField({ layer, disabled, onSet }) {
2842
2959
  const s = layer.subject;
2843
2960
  const kind = !s ? "" : "slot" in s ? "slot" : "text" in s ? "text" : "image" in s ? "image" : "svg";
2844
2961
  const value = !s ? "" : "slot" in s ? s.slot : "text" in s ? s.text : "image" in s ? s.image : s.svg;
2845
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2846
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Subject" }),
2847
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
2848
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2962
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2963
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "Subject" }),
2964
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
2965
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2849
2966
  "select",
2850
2967
  {
2851
- className: `${input3} w-20 flex-none`,
2968
+ className: `${input4} w-20 flex-none`,
2852
2969
  "aria-label": "Subject kind",
2853
2970
  disabled,
2854
2971
  value: kind,
@@ -2857,18 +2974,18 @@ function SubjectField({ layer, disabled, onSet }) {
2857
2974
  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"/>' });
2858
2975
  },
2859
2976
  children: [
2860
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "none" }),
2861
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "image", children: "picture" }),
2862
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "svg", children: "SVG" }),
2863
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "text", children: "words" }),
2864
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "slot", children: "slot" })
2977
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "none" }),
2978
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "image", children: "picture" }),
2979
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "svg", children: "SVG" }),
2980
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "text", children: "words" }),
2981
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "slot", children: "slot" })
2865
2982
  ]
2866
2983
  }
2867
2984
  ),
2868
- kind && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2985
+ kind && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2869
2986
  CommitInput,
2870
2987
  {
2871
- className: input3,
2988
+ className: input4,
2872
2989
  "aria-label": kind === "image" ? "Picture URL" : kind === "svg" ? "SVG markup" : kind === "text" ? "Words" : "Slot name",
2873
2990
  disabled,
2874
2991
  value,
@@ -2887,42 +3004,42 @@ function LayerControls({ controller, layer, report }) {
2887
3004
  const n = Number(raw);
2888
3005
  if (Number.isFinite(n) && n >= 0 && n <= max) set({ [field]: n });
2889
3006
  };
2890
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
2891
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Role" }),
2892
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { className: input3, "aria-label": "Layer role", disabled: state.readOnly, value: layer.role ?? "", onChange: (e) => set({ role: e.target.value || null }), children: [
2893
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: "", children: [
3007
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("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: [
3008
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "Role" }),
3009
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { className: input4, "aria-label": "Layer role", disabled: state.readOnly, value: layer.role ?? "", onChange: (e) => set({ role: e.target.value || null }), children: [
3010
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("option", { value: "", children: [
2894
3011
  layer.rect ? "subject" : "background",
2895
3012
  " (default)"
2896
3013
  ] }),
2897
- import_effects4.EFFECT_LAYER_ROLES.map((r) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: r, children: r }, r))
3014
+ import_effects5.EFFECT_LAYER_ROLES.map((r) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: r, children: r }, r))
2898
3015
  ] }),
2899
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SubjectField, { layer, disabled: state.readOnly, onSet: (subject) => set({ subject }) }),
2900
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Opacity" }),
2901
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(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) }),
2902
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Fade" }),
2903
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(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) }),
2904
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Until" }),
2905
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3016
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SubjectField, { layer, disabled: state.readOnly, onSet: (subject) => set({ subject }) }),
3017
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "Opacity" }),
3018
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitInput, { className: input4, 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) }),
3019
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "Fade" }),
3020
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitInput, { className: input4, 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) }),
3021
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "Until" }),
3022
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2906
3023
  "select",
2907
3024
  {
2908
- className: input3,
3025
+ className: input4,
2909
3026
  "aria-label": "Layer lasts until",
2910
3027
  disabled: state.readOnly,
2911
3028
  value: typeof layer.until === "object" ? String(layer.until.shots) : layer.until === void 0 ? "1" : "ms",
2912
3029
  onChange: (e) => set({ until: e.target.value === "1" ? null : { shots: Number(e.target.value) } }),
2913
3030
  children: [
2914
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "1", children: "the next shot" }),
2915
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "2", children: "the shot after next" }),
2916
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "3", children: "three shots on" }),
2917
- typeof layer.until === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: "ms", children: [
3031
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "1", children: "the next shot" }),
3032
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "2", children: "the shot after next" }),
3033
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "3", children: "three shots on" }),
3034
+ typeof layer.until === "number" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("option", { value: "ms", children: [
2918
3035
  layer.until,
2919
3036
  " ms"
2920
3037
  ] })
2921
3038
  ]
2922
3039
  }
2923
3040
  ),
2924
- error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "col-span-2 text-[11px] text-amber-500", children: error }),
2925
- description && !state.readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3041
+ error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "col-span-2 text-[11px] text-amber-500", children: error }),
3042
+ description && !state.readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2926
3043
  EffectParameters,
2927
3044
  {
2928
3045
  description,
@@ -2939,9 +3056,9 @@ function LayerControls({ controller, layer, report }) {
2939
3056
  }
2940
3057
  function ShotLayers({ controller, shot, className = "" }) {
2941
3058
  const state = useAnimationEditorState(controller);
2942
- const effects = useEffectList(state.effectsProvider, import_effects4.effectLayerOffered);
2943
- const [open, setOpen] = (0, import_react20.useState)(null);
2944
- const [message, setMessage] = (0, import_react20.useState)(null);
3059
+ const effects = useEffectList(state.effectsProvider, import_effects5.effectLayerOffered);
3060
+ const [open, setOpen] = (0, import_react21.useState)(null);
3061
+ const [message, setMessage] = (0, import_react21.useState)(null);
2945
3062
  const current = state.scene.shots.find((s) => s.id === shot);
2946
3063
  if (!current) return null;
2947
3064
  const layers = current.layers ?? [];
@@ -2958,35 +3075,35 @@ function ShotLayers({ controller, shot, className = "" }) {
2958
3075
  report(controller.addShotLayer(shot, { effect: value, ...needsSubject ? { subject: { slot: "picture" } } : {} }));
2959
3076
  };
2960
3077
  if (!layers.length && !effects.length && state.readOnly) return null;
2961
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-shot-layers": "", children: [
2962
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Layers" }),
2963
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { className: input3, "aria-label": "Add a layer", disabled: state.readOnly, value: "", onChange: (e) => add(e.target.value), children: [
2964
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "add a layer\u2026" }),
2965
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: ":picture", children: "Picture" }),
2966
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: ":words", children: "Words" }),
2967
- effects.map((e) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: e.id, children: [
3078
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-shot-layers": "", children: [
3079
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "Layers" }),
3080
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { className: input4, "aria-label": "Add a layer", disabled: state.readOnly, value: "", onChange: (e) => add(e.target.value), children: [
3081
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "add a layer\u2026" }),
3082
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: ":picture", children: "Picture" }),
3083
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: ":words", children: "Words" }),
3084
+ effects.map((e) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("option", { value: e.id, children: [
2968
3085
  e.name,
2969
3086
  " (",
2970
3087
  e.uses.filter((u) => u !== "interactive").join(", "),
2971
3088
  ")"
2972
3089
  ] }, e.id))
2973
3090
  ] }),
2974
- layers.map((layer, i) => ({ layer, i })).reverse().map(({ layer, i }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react20.default.Fragment, { children: [
2975
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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") }),
2976
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
2977
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex-1 truncate text-[10px] text-muted-foreground", children: [
3091
+ layers.map((layer, i) => ({ layer, i })).reverse().map(({ layer, i }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react21.default.Fragment, { children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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") }),
3093
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3094
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "flex-1 truncate text-[10px] text-muted-foreground", children: [
2978
3095
  layer.role ?? (layer.rect ? "subject" : "background"),
2979
3096
  " ",
2980
3097
  subjectLabel(layer.subject)
2981
3098
  ] }),
2982
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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" }),
2983
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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" }),
2984
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${layer.id}`, disabled: state.readOnly, onClick: () => report(controller.removeShotLayer(layer.id)), children: "\xD7" })
3099
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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" }),
3100
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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" }),
3101
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${layer.id}`, disabled: state.readOnly, onClick: () => report(controller.removeShotLayer(layer.id)), children: "\xD7" })
2985
3102
  ] }),
2986
- open === layer.id && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LayerControls, { controller, layer, report })
3103
+ open === layer.id && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LayerControls, { controller, layer, report })
2987
3104
  ] }, layer.id)),
2988
- !state.effectsProvider && layers.some((l) => l.effect) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "No effects provider is set, so effect layers are not drawn." }),
2989
- message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
3105
+ !state.effectsProvider && layers.some((l) => l.effect) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "No effects provider is set, so effect layers are not drawn." }),
3106
+ message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
2990
3107
  ] });
2991
3108
  }
2992
3109
  function ShotTransition({ controller, shot, className = "" }) {
@@ -2996,7 +3113,7 @@ function ShotTransition({ controller, shot, className = "" }) {
2996
3113
  const current = state.scene.shots[index];
2997
3114
  const transition = current?.transition;
2998
3115
  const { description } = useEffectDescription(state.effectsProvider, transition?.effect);
2999
- const [message, setMessage] = (0, import_react20.useState)(null);
3116
+ const [message, setMessage] = (0, import_react21.useState)(null);
3000
3117
  if (!current || index === 0 || !transitions.length && !transition) return null;
3001
3118
  const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? null : x.error));
3002
3119
  const set = (changes, merge) => {
@@ -3005,23 +3122,23 @@ function ShotTransition({ controller, shot, className = "" }) {
3005
3122
  report(controller.setShotTransition(shot, next, { merge: merge ?? void 0 }));
3006
3123
  };
3007
3124
  const known = transitions.some((t) => t.id === transition?.effect);
3008
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-shot-transition": "", children: [
3009
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "text-muted-foreground", children: "Transition in" }),
3010
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
3011
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "cut" }),
3012
- transition && !known && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: transition.effect, children: [
3125
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-shot-transition": "", children: [
3126
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "text-muted-foreground", children: "Transition in" }),
3127
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { className: input4, "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: [
3128
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "cut" }),
3129
+ transition && !known && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("option", { value: transition.effect, children: [
3013
3130
  transition.name ?? transition.effect,
3014
3131
  " (not in the provider)"
3015
3132
  ] }),
3016
- transitions.map((t) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: t.id, children: t.name }, t.id))
3133
+ transitions.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: t.id, children: t.name }, t.id))
3017
3134
  ] }),
3018
- transition && known && !state.readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "col-span-2 flex flex-col gap-1 border-l border-border pl-2", "data-shot-transition-controls": "", children: [
3019
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3020
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-16 text-muted-foreground", children: "Length" }),
3021
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(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.") }),
3022
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3135
+ transition && known && !state.readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "col-span-2 flex flex-col gap-1 border-l border-border pl-2", "data-shot-transition-controls": "", children: [
3136
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3137
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 text-muted-foreground", children: "Length" }),
3138
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitInput, { className: input4, 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.") }),
3139
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3023
3140
  ] }),
3024
- description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3141
+ description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3025
3142
  EffectParameters,
3026
3143
  {
3027
3144
  description,
@@ -3035,22 +3152,22 @@ function ShotTransition({ controller, shot, className = "" }) {
3035
3152
  }
3036
3153
  )
3037
3154
  ] }),
3038
- message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
3155
+ message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
3039
3156
  ] });
3040
3157
  }
3041
3158
 
3042
3159
  // src/animation-editor/ShotCameraMoves.tsx
3043
- var import_react21 = __toESM(require("react"), 1);
3160
+ var import_react22 = __toESM(require("react"), 1);
3044
3161
  var import_animation_editor9 = require("@pixerate/editor/animation-editor");
3045
- var import_jsx_runtime20 = require("react/jsx-runtime");
3046
- var input4 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
3162
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3163
+ var input5 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
3047
3164
  var ROLES = [
3048
3165
  { role: "transition", label: "Move in", none: "ease in" },
3049
3166
  { role: "hold", label: "While holding", none: "stay still" }
3050
3167
  ];
3051
3168
  function useCameraMoves(controller, provider) {
3052
- const [moves, setMoves] = (0, import_react21.useState)({ transition: [], hold: [] });
3053
- (0, import_react21.useEffect)(() => {
3169
+ const [moves, setMoves] = (0, import_react22.useState)({ transition: [], hold: [] });
3170
+ (0, import_react22.useEffect)(() => {
3054
3171
  let live = true;
3055
3172
  void Promise.all([controller.cameraMoves("transition"), controller.cameraMoves("hold")]).then(
3056
3173
  ([transition, hold]) => live && setMoves({ transition, hold }),
@@ -3066,7 +3183,7 @@ function MoveControls({ controller, shot, role }) {
3066
3183
  const state = useAnimationEditorState(controller);
3067
3184
  const move = (0, import_animation_editor9.motionShotCameraMove)(state.scene.shots.find((s) => s.id === shot), role);
3068
3185
  const { description, error } = useEffectDescription(state.effectsProvider, move?.move);
3069
- const [message, setMessage] = (0, import_react21.useState)(null);
3186
+ const [message, setMessage] = (0, import_react22.useState)(null);
3070
3187
  if (!move) return null;
3071
3188
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
3072
3189
  const set = (changes, merge) => {
@@ -3074,15 +3191,15 @@ function MoveControls({ controller, shot, role }) {
3074
3191
  for (const k of Object.keys(next)) if (next[k] === null || k === "values" && !Object.keys(next[k]).length) delete next[k];
3075
3192
  report(controller.setShotCameraMove(shot, role, next, { merge: merge ?? void 0 }));
3076
3193
  };
3077
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3194
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3078
3195
  if (!description) return null;
3079
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "col-span-2 flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
3080
- role === "transition" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3081
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 text-muted-foreground", children: "Length" }),
3082
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3196
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "col-span-2 flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
3197
+ role === "transition" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3198
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16 text-muted-foreground", children: "Length" }),
3199
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3083
3200
  CommitInput,
3084
3201
  {
3085
- className: input4,
3202
+ className: input5,
3086
3203
  type: "number",
3087
3204
  min: 0,
3088
3205
  step: 50,
@@ -3092,9 +3209,9 @@ function MoveControls({ controller, shot, role }) {
3092
3209
  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.")
3093
3210
  }
3094
3211
  ),
3095
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3212
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3096
3213
  ] }),
3097
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3214
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3098
3215
  EffectParameters,
3099
3216
  {
3100
3217
  description,
@@ -3107,66 +3224,66 @@ function MoveControls({ controller, shot, role }) {
3107
3224
  onPresetName: (name) => set({ preset: name, values: {} })
3108
3225
  }
3109
3226
  ),
3110
- message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3227
+ message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3111
3228
  ] });
3112
3229
  }
3113
3230
  function ShotCameraMoves({ controller, shot, className = "" }) {
3114
3231
  const state = useAnimationEditorState(controller);
3115
3232
  const moves = useCameraMoves(controller, state.effectsProvider);
3116
3233
  const current = state.scene.shots.find((s) => s.id === shot);
3117
- const [message, setMessage] = (0, import_react21.useState)(null);
3234
+ const [message, setMessage] = (0, import_react22.useState)(null);
3118
3235
  if (!current) return null;
3119
3236
  const has = moves.transition.length + moves.hold.length > 0;
3120
3237
  const named = current.camera?.in !== void 0 || current.camera?.during !== void 0;
3121
3238
  if (!has)
3122
- return named ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
3239
+ return named ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
3123
3240
  "This shot names camera moves, but ",
3124
3241
  state.effectsProvider ? `${state.effectsProvider.name} has none` : "no effects provider is set",
3125
3242
  ", so the camera eases instead."
3126
3243
  ] }) : null;
3127
3244
  const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? null : x.error));
3128
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-camera-moves": "", children: [
3245
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1 ${className}`, "data-camera-moves": "", children: [
3129
3246
  ROLES.map(({ role, label, none }) => {
3130
3247
  const move = (0, import_animation_editor9.motionShotCameraMove)(current, role);
3131
3248
  const known = moves[role].some((m) => m.id === move?.move);
3132
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react21.default.Fragment, { children: [
3133
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "text-muted-foreground", children: label }),
3134
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3249
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react22.default.Fragment, { children: [
3250
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground", children: label }),
3251
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3135
3252
  "select",
3136
3253
  {
3137
- className: input4,
3254
+ className: input5,
3138
3255
  "aria-label": label,
3139
3256
  disabled: state.readOnly,
3140
3257
  value: move?.move ?? "",
3141
3258
  onChange: (e) => report(e.target.value ? controller.setShotCameraMove(current.id, role, e.target.value) : controller.clearShotCameraMove(current.id, role)),
3142
3259
  children: [
3143
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: none }),
3144
- move && !known && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("option", { value: move.move, children: [
3260
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: none }),
3261
+ move && !known && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("option", { value: move.move, children: [
3145
3262
  move.move,
3146
3263
  " (not in the provider)"
3147
3264
  ] }),
3148
- moves[role].map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: m.id, children: m.name }, m.id))
3265
+ moves[role].map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: m.id, children: m.name }, m.id))
3149
3266
  ]
3150
3267
  }
3151
3268
  ),
3152
- move && known && !state.readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoveControls, { controller, shot: current.id, role })
3269
+ move && known && !state.readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MoveControls, { controller, shot: current.id, role })
3153
3270
  ] }, role);
3154
3271
  }),
3155
- message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
3272
+ message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "col-span-2 text-[11px] text-destructive", role: "alert", children: message })
3156
3273
  ] });
3157
3274
  }
3158
3275
 
3159
3276
  // src/animation-editor/ShotInspector.tsx
3160
- var import_jsx_runtime21 = require("react/jsx-runtime");
3161
- var input5 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
3162
- var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3277
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3278
+ var input6 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
3279
+ var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3163
3280
  function ShotInspector({ controller, shot, className = "" }) {
3164
3281
  const state = useAnimationEditorState(controller);
3165
3282
  const { scene, selection, readOnly, error } = state;
3166
- const [local, setLocalState] = (0, import_react22.useState)(null);
3283
+ const [local, setLocalState] = (0, import_react23.useState)(null);
3167
3284
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
3168
- const elements = (0, import_react22.useMemo)(() => (0, import_animation_editor10.describeMotionElements)(scene), [scene.artwork]);
3169
- const cues = (0, import_react22.useMemo)(() => (0, import_animation_editor10.motionCueChoices)(scene), [scene]);
3285
+ const elements = (0, import_react23.useMemo)(() => (0, import_animation_editor10.describeMotionElements)(scene), [scene.artwork]);
3286
+ const cues = (0, import_react23.useMemo)(() => (0, import_animation_editor10.motionCueChoices)(scene), [scene]);
3170
3287
  const id = shot ?? selection?.shot ?? scene.shots[0]?.id;
3171
3288
  const index = scene.shots.findIndex((s) => s.id === id);
3172
3289
  const current = scene.shots[index];
@@ -3191,37 +3308,37 @@ function ShotInspector({ controller, shot, className = "" }) {
3191
3308
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
3192
3309
  const cueKey = current ? (0, import_animation_editor10.motionCueKey)(current.at) : "";
3193
3310
  const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
3194
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
3195
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3196
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-medium", children: "Shot" }),
3197
- current && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
3198
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
3199
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn4, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
3200
- current && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
3201
- /* @__PURE__ */ (0, import_jsx_runtime21.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" }),
3202
- /* @__PURE__ */ (0, import_jsx_runtime21.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" }),
3203
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn4, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
3311
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
3312
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3313
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-medium", children: "Shot" }),
3314
+ current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
3315
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
3316
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
3317
+ current && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
3318
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, "aria-label": "Move shot earlier", disabled: readOnly || index === 0, onClick: () => apply({ op: "move_shot", shot: current.id, to: index - 1 }, "Move shot"), children: "\u2190" }),
3319
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, "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" }),
3320
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
3204
3321
  ] })
3205
3322
  ] })
3206
3323
  ] }),
3207
- current && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
3208
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
3209
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(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") }),
3210
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
3211
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3212
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(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") }),
3213
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3324
+ current && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
3325
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
3326
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CommitInput, { className: input6, "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") }),
3327
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
3328
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3329
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CommitInput, { className: input6, 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") }),
3330
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3214
3331
  ] }),
3215
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
3216
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3217
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(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") }),
3218
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
3332
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
3333
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3334
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CommitInput, { className: input6, 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") }),
3335
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
3219
3336
  ] }),
3220
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
3221
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3337
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
3338
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3222
3339
  "select",
3223
3340
  {
3224
- className: input5,
3341
+ className: input6,
3225
3342
  "aria-label": "Camera frames",
3226
3343
  disabled: readOnly,
3227
3344
  value: current.camera && (0, import_animation_editor10.motionCameraFramed)(current.camera) ? frame ? `frame:${frame}` : "rect" : "",
@@ -3232,20 +3349,20 @@ function ShotInspector({ controller, shot, className = "" }) {
3232
3349
  else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { ...moves, frame: v.slice(6), padding: 24 } } }, "Frame camera");
3233
3350
  },
3234
3351
  children: [
3235
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "keep framing" }),
3236
- current.camera && (0, import_animation_editor10.motionCameraFramed)(current.camera) && !frame && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "rect", children: "a rectangle" }),
3237
- elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("option", { value: `frame:${e.id}`, children: [
3352
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "keep framing" }),
3353
+ current.camera && (0, import_animation_editor10.motionCameraFramed)(current.camera) && !frame && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "rect", children: "a rectangle" }),
3354
+ elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: `frame:${e.id}`, children: [
3238
3355
  "frame ",
3239
3356
  e.name ?? e.id
3240
3357
  ] }, e.id))
3241
3358
  ]
3242
3359
  }
3243
3360
  ),
3244
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
3245
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3361
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
3362
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3246
3363
  "select",
3247
3364
  {
3248
- className: input5,
3365
+ className: input6,
3249
3366
  "aria-label": "Cue",
3250
3367
  disabled: readOnly || index === 0,
3251
3368
  value: cueKey,
@@ -3254,36 +3371,36 @@ function ShotInspector({ controller, shot, className = "" }) {
3254
3371
  apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
3255
3372
  },
3256
3373
  children: [
3257
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "after the shot before" }),
3258
- cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: cueKey, children: cueKey }),
3259
- cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: c.value, children: c.label }, c.value))
3374
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "after the shot before" }),
3375
+ cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: cueKey, children: cueKey }),
3376
+ cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: c.value, children: c.label }, c.value))
3260
3377
  ]
3261
3378
  }
3262
3379
  ),
3263
- !cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.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." })
3380
+ !cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.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." })
3264
3381
  ] }),
3265
- current && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShotCameraMoves, { controller, shot: current.id }),
3266
- current && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShotTransition, { controller, shot: current.id }),
3267
- current && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShotLayers, { controller, shot: current.id }),
3268
- message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
3382
+ current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ShotCameraMoves, { controller, shot: current.id }),
3383
+ current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ShotTransition, { controller, shot: current.id }),
3384
+ current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ShotLayers, { controller, shot: current.id }),
3385
+ message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
3269
3386
  ] });
3270
3387
  }
3271
3388
 
3272
3389
  // src/animation-editor/AnimationEffectsPanel.tsx
3273
- var import_react23 = require("react");
3390
+ var import_react24 = require("react");
3274
3391
  var import_animation_editor11 = require("@pixerate/editor/animation-editor");
3275
- var import_jsx_runtime22 = require("react/jsx-runtime");
3276
- var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3392
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3393
+ var btn6 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3277
3394
  function Controls({ controller, instance, effect, values }) {
3278
3395
  const provider = controller.effectsProvider;
3279
3396
  const { description, error } = useEffectDescription(provider, effect);
3280
- const [message, setMessage] = (0, import_react23.useState)(null);
3397
+ const [message, setMessage] = (0, import_react24.useState)(null);
3281
3398
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
3282
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
3283
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3284
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3285
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
3286
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3399
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
3400
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3401
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3402
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
3403
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3287
3404
  EffectParameters,
3288
3405
  {
3289
3406
  description,
@@ -3293,60 +3410,61 @@ function Controls({ controller, instance, effect, values }) {
3293
3410
  onPreset: (v) => report(controller.updateMotionEffect(instance, v))
3294
3411
  }
3295
3412
  ),
3296
- message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3413
+ message && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3297
3414
  ] });
3298
3415
  }
3299
3416
  function AnimationEffectsPanel({ controller, node, className = "" }) {
3300
3417
  const state = useAnimationEditorState(controller);
3301
3418
  const provider = state.effectsProvider;
3302
- const nodes = (0, import_react23.useMemo)(() => [...(0, import_animation_editor11.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
3303
- const [chosen, setChosen] = (0, import_react23.useState)("");
3419
+ const nodes = (0, import_react24.useMemo)(() => [...(0, import_animation_editor11.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
3420
+ const [chosen, setChosen] = (0, import_react24.useState)("");
3304
3421
  const target = node && nodes.includes(node) ? node : chosen && nodes.includes(chosen) ? chosen : "";
3305
- const [browse, setBrowse] = (0, import_react23.useState)(null);
3306
- const [open, setOpen] = (0, import_react23.useState)(null);
3307
- const [message, setMessage] = (0, import_react23.useState)(null);
3422
+ const [browse, setBrowse] = (0, import_react24.useState)(null);
3423
+ const [open, setOpen] = (0, import_react24.useState)(null);
3424
+ const [message, setMessage] = (0, import_react24.useState)(null);
3308
3425
  const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
3309
- const applied = (0, import_react23.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
3426
+ const applied = (0, import_react24.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
3310
3427
  const disabled = state.readOnly;
3311
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
3312
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3313
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
3314
- /* @__PURE__ */ (0, import_jsx_runtime22.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: [
3315
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Node\u2026" }),
3316
- nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: id, children: id }, id))
3428
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
3429
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3430
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
3431
+ /* @__PURE__ */ (0, import_jsx_runtime23.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: [
3432
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Node\u2026" }),
3433
+ nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: id, children: id }, id))
3317
3434
  ] }),
3318
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
3319
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
3435
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn6, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
3436
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn6, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
3320
3437
  ] }),
3321
- !provider && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
3322
- browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
3323
- browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
3324
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
3325
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3326
- /* @__PURE__ */ (0, import_jsx_runtime22.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: [
3438
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
3439
+ browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
3440
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectTemplates, { provider, disabled, fillLabel: "New scene from template", onFill: (t, v) => controller.fillTemplate(t, v).then((r) => (r.ok && r.notes.length && setMessage(r.notes.join(" ")), r)) }),
3441
+ browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
3442
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
3443
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1", children: [
3444
+ /* @__PURE__ */ (0, import_jsx_runtime23.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: [
3327
3445
  e.name ?? e.effect,
3328
3446
  " ",
3329
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "text-muted-foreground", children: [
3447
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "text-muted-foreground", children: [
3330
3448
  "\xB7 ",
3331
3449
  e.kind === "vector" ? "picture" : e.targets.join(", ")
3332
3450
  ] })
3333
3451
  ] }),
3334
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
3452
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn6, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
3335
3453
  ] }),
3336
- open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
3454
+ open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
3337
3455
  ] }, e.instance)) }),
3338
- !applied.length && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
3339
- message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
3456
+ !applied.length && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
3457
+ message && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
3340
3458
  ] });
3341
3459
  }
3342
3460
 
3343
3461
  // src/animation-editor/AnimationEditor.tsx
3344
- var import_jsx_runtime23 = require("react/jsx-runtime");
3462
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3345
3463
  var ONION = { before: 3, after: 1 };
3346
- var btn6 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
3464
+ var btn7 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
3347
3465
  function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
3348
3466
  const state = useAnimationEditorState(controller);
3349
- const rootRef = (0, import_react24.useRef)(null);
3467
+ const rootRef = (0, import_react25.useRef)(null);
3350
3468
  const ambientPlayback = useAgentPlayback();
3351
3469
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3352
3470
  const rectIn = (el) => {
@@ -3381,16 +3499,16 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
3381
3499
  },
3382
3500
  reveal: () => onPlaybackReveal?.()
3383
3501
  });
3384
- const presenceLayer = playing ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PresenceLayer, { presence: agentPresence }) : null;
3502
+ const presenceLayer = playing ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PresenceLayer, { presence: agentPresence }) : null;
3385
3503
  useEffects(controller, effects);
3386
3504
  const { issues, scene, selection, readOnly } = state;
3387
- const [picked, setPicked] = (0, import_react24.useState)(null);
3388
- const [onion, setOnion] = (0, import_react24.useState)(false);
3389
- const [paths, setPaths] = (0, import_react24.useState)(false);
3390
- const [recordMode, setRecordMode] = (0, import_react24.useState)("move");
3505
+ const [picked, setPicked] = (0, import_react25.useState)(null);
3506
+ const [onion, setOnion] = (0, import_react25.useState)(false);
3507
+ const [paths, setPaths] = (0, import_react25.useState)(false);
3508
+ const [recordMode, setRecordMode] = (0, import_react25.useState)("move");
3391
3509
  const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
3392
3510
  const targets = command && "targets" in command ? command.targets : [];
3393
- const nodes = (0, import_react24.useMemo)(() => (0, import_animation_editor12.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
3511
+ const nodes = (0, import_react25.useMemo)(() => (0, import_animation_editor12.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
3394
3512
  const pickedValid = picked && nodes.has(picked) ? picked : null;
3395
3513
  const onPick = (id, event) => {
3396
3514
  if (event.shiftKey && id && command && "targets" in command && selection?.command !== void 0 && !readOnly) {
@@ -3400,7 +3518,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
3400
3518
  }
3401
3519
  setPicked(id);
3402
3520
  };
3403
- const stage = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3521
+ const stage = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3404
3522
  AnimationStage,
3405
3523
  {
3406
3524
  controller,
@@ -3413,15 +3531,15 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
3413
3531
  className: "rounded-md border border-border bg-muted/40"
3414
3532
  }
3415
3533
  );
3416
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor12.motionIssueLine)(issue) }, i)) });
3534
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor12.motionIssueLine)(issue) }, i)) });
3417
3535
  if (!editable)
3418
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
3536
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
3419
3537
  presenceLayer,
3420
3538
  stage,
3421
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PlayheadScrubber, { controller }),
3539
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PlayheadScrubber, { controller }),
3422
3540
  issueList
3423
3541
  ] });
3424
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3542
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3425
3543
  "div",
3426
3544
  {
3427
3545
  ref: rootRef,
@@ -3436,41 +3554,41 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
3436
3554
  },
3437
3555
  children: [
3438
3556
  presenceLayer,
3439
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
3557
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
3440
3558
  stage,
3441
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PlayheadScrubber, { controller }),
3442
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
3443
- /* @__PURE__ */ (0, import_jsx_runtime23.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" }),
3444
- /* @__PURE__ */ (0, import_jsx_runtime23.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" }),
3445
- onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
3446
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
3559
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PlayheadScrubber, { controller }),
3560
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
3561
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: btn7, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
3562
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: btn7, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
3563
+ onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3564
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
3447
3565
  " Onion skin"
3448
3566
  ] }),
3449
- motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
3450
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
3567
+ motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3568
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
3451
3569
  " Motion paths"
3452
3570
  ] }),
3453
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
3571
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
3454
3572
  "Picked ",
3455
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { className: "text-rose-500", children: pickedValid }),
3573
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { className: "text-rose-500", children: pickedValid }),
3456
3574
  " ",
3457
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
3575
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
3458
3576
  ] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
3459
3577
  ] }),
3460
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
3578
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
3461
3579
  issueList
3462
3580
  ] }),
3463
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3464
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
3465
- (state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
3466
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
3467
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
3468
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
3469
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ShotInspector, { controller, className: "mt-1" })
3581
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3582
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
3583
+ (state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
3584
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
3585
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
3586
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
3587
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ShotInspector, { controller, className: "mt-1" })
3470
3588
  ] }),
3471
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("details", { className: "border-t border-border pt-2", children: [
3472
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
3473
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SceneSettings, { controller, className: "mt-1" })
3589
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("details", { className: "border-t border-border pt-2", children: [
3590
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
3591
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SceneSettings, { controller, className: "mt-1" })
3474
3592
  ] })
3475
3593
  ] })
3476
3594
  ]