@pixerate/editor-react 0.155.0 → 0.156.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/video-editor/ClipCameraMoves.d.cts +15 -0
- package/dist/video-editor/ClipCameraMoves.d.ts +15 -0
- package/dist/video-editor/ClipInspector.d.cts +2 -2
- package/dist/video-editor/ClipInspector.d.ts +2 -2
- package/dist/video-editor/index.cjs +3131 -2977
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +392 -241
- package/package.json +3 -3
|
@@ -627,9 +627,158 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
|
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
// src/video-editor/ClipInspector.tsx
|
|
630
|
-
import { useState as
|
|
630
|
+
import { useState as useState4 } from "react";
|
|
631
|
+
|
|
632
|
+
// src/video-editor/ClipCameraMoves.tsx
|
|
633
|
+
import React4, { useEffect as useEffect5, useState as useState3 } from "react";
|
|
634
|
+
import { findVideoClip, videoClipCameraMove } from "@pixerate/editor/video-editor";
|
|
635
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
636
|
+
var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
|
|
637
|
+
var ROLES = [
|
|
638
|
+
{ role: "transition", label: "Move in", none: "none" },
|
|
639
|
+
{ role: "hold", label: "While holding", none: "none" }
|
|
640
|
+
];
|
|
641
|
+
function MoveControls({ controller, clip, role }) {
|
|
642
|
+
const state = useVideoEditorState(controller);
|
|
643
|
+
const move = videoClipCameraMove(findVideoClip(state.project, clip)?.clip, role);
|
|
644
|
+
const { description, error } = useEffectDescription(state.effectsProvider, move?.move);
|
|
645
|
+
const [message, setMessage] = useState3(null);
|
|
646
|
+
if (!move) return null;
|
|
647
|
+
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
648
|
+
const set = (changes, merge) => {
|
|
649
|
+
const next = { ...move, ...changes };
|
|
650
|
+
for (const k of Object.keys(next)) if (next[k] === null || k === "values" && !Object.keys(next[k]).length) delete next[k];
|
|
651
|
+
report(controller.setClipCameraMove(clip, role, next, { merge: merge ?? void 0 }));
|
|
652
|
+
};
|
|
653
|
+
if (error) return /* @__PURE__ */ jsx5("p", { className: "text-[11px] text-amber-500", children: error });
|
|
654
|
+
if (!description) return null;
|
|
655
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
|
|
656
|
+
role === "transition" && /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-1 text-xs", children: [
|
|
657
|
+
/* @__PURE__ */ jsx5("span", { className: "w-16 text-muted-foreground", children: "Length" }),
|
|
658
|
+
/* @__PURE__ */ jsx5(
|
|
659
|
+
"input",
|
|
660
|
+
{
|
|
661
|
+
className: input,
|
|
662
|
+
type: "number",
|
|
663
|
+
min: 0,
|
|
664
|
+
step: 50,
|
|
665
|
+
"aria-label": "Move length",
|
|
666
|
+
defaultValue: move.ms ?? "",
|
|
667
|
+
placeholder: String(description.camera?.durationMs ?? ""),
|
|
668
|
+
onBlur: (e) => {
|
|
669
|
+
const raw = e.currentTarget.value.trim();
|
|
670
|
+
if (raw === String(move.ms ?? "")) return;
|
|
671
|
+
if (raw === "") set({ ms: null });
|
|
672
|
+
else if (Number.isFinite(Number(raw)) && Number(raw) >= 0) set({ ms: Number(raw) });
|
|
673
|
+
else setMessage("Length is a number of ms, 0 or more.");
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
String(move.ms)
|
|
677
|
+
),
|
|
678
|
+
/* @__PURE__ */ jsx5("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
|
|
679
|
+
] }),
|
|
680
|
+
/* @__PURE__ */ jsx5(
|
|
681
|
+
EffectParameters,
|
|
682
|
+
{
|
|
683
|
+
description,
|
|
684
|
+
values: move.values ?? {},
|
|
685
|
+
onChange: (k, v, gesture) => set({ values: { ...move.values ?? {}, [k]: v }, preset: null }, gesture),
|
|
686
|
+
onReset: (k) => {
|
|
687
|
+
const { [k]: _gone, ...rest } = move.values ?? {};
|
|
688
|
+
set({ values: rest, preset: null });
|
|
689
|
+
},
|
|
690
|
+
onPresetName: (name) => set({ preset: name, values: {} })
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
message && /* @__PURE__ */ jsx5("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
694
|
+
] });
|
|
695
|
+
}
|
|
696
|
+
function ClipCameraMoves({ controller, clip, className = "" }) {
|
|
697
|
+
const state = useVideoEditorState(controller);
|
|
698
|
+
const [moves, setMoves] = useState3({ transition: [], hold: [] });
|
|
699
|
+
const [message, setMessage] = useState3(null);
|
|
700
|
+
useEffect5(() => {
|
|
701
|
+
let live = true;
|
|
702
|
+
void Promise.all([controller.cameraMoves("transition"), controller.cameraMoves("hold")]).then(
|
|
703
|
+
([transition, hold]) => live && setMoves({ transition, hold }),
|
|
704
|
+
() => live && setMoves({ transition: [], hold: [] })
|
|
705
|
+
);
|
|
706
|
+
return () => {
|
|
707
|
+
live = false;
|
|
708
|
+
};
|
|
709
|
+
}, [controller, state.effectsProvider]);
|
|
710
|
+
const at = findVideoClip(state.project, clip);
|
|
711
|
+
if (!at || at.track.kind === "audio" || at.clip.type === "adjustment") return null;
|
|
712
|
+
const current = at.clip;
|
|
713
|
+
if (!moves.transition.length && !moves.hold.length)
|
|
714
|
+
return current.camera ? /* @__PURE__ */ jsxs4("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
|
|
715
|
+
"This clip's camera moves are baked into its keys; ",
|
|
716
|
+
state.effectsProvider ? `${state.effectsProvider.name} has no camera moves` : "no effects provider is set",
|
|
717
|
+
", so they cannot be changed here."
|
|
718
|
+
] }) : null;
|
|
719
|
+
const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
|
|
720
|
+
const disabled = state.readOnly || !!at.track.locked;
|
|
721
|
+
return /* @__PURE__ */ jsxs4("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-camera-moves": "", children: [
|
|
722
|
+
ROLES.map(({ role, label, none }) => {
|
|
723
|
+
const move = videoClipCameraMove(current, role);
|
|
724
|
+
const known = moves[role].some((m) => m.id === move?.move);
|
|
725
|
+
return /* @__PURE__ */ jsxs4(React4.Fragment, { children: [
|
|
726
|
+
/* @__PURE__ */ jsxs4("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
|
|
727
|
+
/* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: label }),
|
|
728
|
+
/* @__PURE__ */ jsxs4(
|
|
729
|
+
"select",
|
|
730
|
+
{
|
|
731
|
+
className: input,
|
|
732
|
+
"aria-label": label,
|
|
733
|
+
disabled,
|
|
734
|
+
value: move?.move ?? "",
|
|
735
|
+
onChange: (e) => report(e.target.value ? controller.setClipCameraMove(clip, role, e.target.value) : controller.clearClipCameraMove(clip, role)),
|
|
736
|
+
children: [
|
|
737
|
+
/* @__PURE__ */ jsx5("option", { value: "", children: none }),
|
|
738
|
+
move && !known && /* @__PURE__ */ jsxs4("option", { value: move.move, children: [
|
|
739
|
+
move.move,
|
|
740
|
+
" (not in the provider)"
|
|
741
|
+
] }),
|
|
742
|
+
moves[role].map((m) => /* @__PURE__ */ jsx5("option", { value: m.id, children: m.name }, m.id))
|
|
743
|
+
]
|
|
744
|
+
}
|
|
745
|
+
)
|
|
746
|
+
] }),
|
|
747
|
+
move && known && !disabled && /* @__PURE__ */ jsx5(MoveControls, { controller, clip, role })
|
|
748
|
+
] }, role);
|
|
749
|
+
}),
|
|
750
|
+
current.camera && !disabled && /* @__PURE__ */ jsxs4("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
|
|
751
|
+
/* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: "Camera zoom" }),
|
|
752
|
+
/* @__PURE__ */ jsx5(
|
|
753
|
+
"input",
|
|
754
|
+
{
|
|
755
|
+
className: input,
|
|
756
|
+
type: "number",
|
|
757
|
+
min: 0.1,
|
|
758
|
+
step: 0.1,
|
|
759
|
+
"aria-label": "Camera zoom",
|
|
760
|
+
placeholder: "1",
|
|
761
|
+
defaultValue: current.camera.framing?.zoom ?? "",
|
|
762
|
+
onBlur: (e) => {
|
|
763
|
+
const raw = e.currentTarget.value.trim();
|
|
764
|
+
const zoom = Number(raw);
|
|
765
|
+
if (raw === String(current.camera?.framing?.zoom ?? "")) return;
|
|
766
|
+
const role = current.camera?.in !== void 0 ? "transition" : "hold";
|
|
767
|
+
const spec = videoClipCameraMove(current, role);
|
|
768
|
+
if (raw !== "" && !(zoom > 0)) return setMessage("Zoom is a number above 0 (1 shows the whole picture).");
|
|
769
|
+
report(controller.setClipCameraMove(clip, role, spec, { framing: raw === "" ? null : { ...current.camera?.framing, zoom } }));
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
String(current.camera.framing?.zoom)
|
|
773
|
+
)
|
|
774
|
+
] }),
|
|
775
|
+
message && /* @__PURE__ */ jsx5("p", { className: "text-[11px] text-destructive", role: "alert", children: message })
|
|
776
|
+
] });
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// src/video-editor/ClipInspector.tsx
|
|
631
780
|
import {
|
|
632
|
-
findVideoClip,
|
|
781
|
+
findVideoClip as findVideoClip2,
|
|
633
782
|
formatVideoSeconds as formatVideoSeconds2,
|
|
634
783
|
VIDEO_CLIP_ANIMATION_EFFECTS,
|
|
635
784
|
VIDEO_CLIP_ANIMATION_LABELS,
|
|
@@ -661,7 +810,7 @@ import {
|
|
|
661
810
|
VIDEO_MASK_SHAPES,
|
|
662
811
|
VIDEO_MASK_SHAPE_LABELS
|
|
663
812
|
} from "@pixerate/editor/video-editor";
|
|
664
|
-
import { Fragment as Fragment3, jsx as
|
|
813
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
665
814
|
var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
666
815
|
var field = "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs disabled:opacity-50";
|
|
667
816
|
var DEFAULT_TRANSITION = 500;
|
|
@@ -675,7 +824,7 @@ function Commit({
|
|
|
675
824
|
if (raw !== value) onCommit(raw);
|
|
676
825
|
};
|
|
677
826
|
if (multiline)
|
|
678
|
-
return /* @__PURE__ */
|
|
827
|
+
return /* @__PURE__ */ jsx6(
|
|
679
828
|
"textarea",
|
|
680
829
|
{
|
|
681
830
|
className: field,
|
|
@@ -687,10 +836,10 @@ function Commit({
|
|
|
687
836
|
},
|
|
688
837
|
value
|
|
689
838
|
);
|
|
690
|
-
return /* @__PURE__ */
|
|
839
|
+
return /* @__PURE__ */ jsx6("input", { className: field, ...rest, defaultValue: value, onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(), onBlur: (e) => commit(e.currentTarget.value) }, value);
|
|
691
840
|
}
|
|
692
841
|
function LutControls({ controller, clip, disabled }) {
|
|
693
|
-
const [message, setMessage] =
|
|
842
|
+
const [message, setMessage] = useState4(null);
|
|
694
843
|
const lut = clip.grade?.lut;
|
|
695
844
|
const apply = (setting, label) => {
|
|
696
845
|
const r = controller.apply(videoLutEdits(controller.getProject(), [clip.id], setting), label);
|
|
@@ -714,16 +863,16 @@ function LutControls({ controller, clip, disabled }) {
|
|
|
714
863
|
setMessage(`${file.name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
715
864
|
}
|
|
716
865
|
};
|
|
717
|
-
return /* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
867
|
+
/* @__PURE__ */ jsx6(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 gap-1", children: [
|
|
868
|
+
/* @__PURE__ */ jsx6(Commit, { value: lut?.src ?? "", placeholder: "look.cube", "aria-label": "LUT file", disabled, onCommit: (raw) => void choose(raw.trim()) }),
|
|
869
|
+
/* @__PURE__ */ jsxs5("label", { className: `${btn2} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
|
|
721
870
|
"Load",
|
|
722
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ jsx6("input", { type: "file", accept: ".cube", className: "sr-only", disabled, "aria-label": "Load a .cube LUT", onChange: (e) => void readFile(e.currentTarget.files?.[0]) })
|
|
723
872
|
] }),
|
|
724
|
-
lut && /* @__PURE__ */
|
|
873
|
+
lut && /* @__PURE__ */ jsx6("button", { type: "button", className: btn2, disabled, "aria-label": "Remove LUT", onClick: () => apply(null, "Remove LUT"), children: "\u2715" })
|
|
725
874
|
] }) }),
|
|
726
|
-
lut && /* @__PURE__ */
|
|
875
|
+
lut && /* @__PURE__ */ jsx6(Row, { label: "LUT strength", name: "grade.lut.strength", children: /* @__PURE__ */ jsx6(
|
|
727
876
|
Commit,
|
|
728
877
|
{
|
|
729
878
|
type: "number",
|
|
@@ -739,7 +888,7 @@ function LutControls({ controller, clip, disabled }) {
|
|
|
739
888
|
}
|
|
740
889
|
}
|
|
741
890
|
) }),
|
|
742
|
-
lut && /* @__PURE__ */
|
|
891
|
+
lut && /* @__PURE__ */ jsx6(Row, { label: "Protect skin", name: "grade.lut.preserveSkinTones", children: /* @__PURE__ */ jsx6(
|
|
743
892
|
Commit,
|
|
744
893
|
{
|
|
745
894
|
type: "number",
|
|
@@ -759,12 +908,12 @@ function LutControls({ controller, clip, disabled }) {
|
|
|
759
908
|
}
|
|
760
909
|
}
|
|
761
910
|
) }),
|
|
762
|
-
message && /* @__PURE__ */
|
|
911
|
+
message && /* @__PURE__ */ jsx6("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
|
|
763
912
|
] });
|
|
764
913
|
}
|
|
765
914
|
function Row({ label, name, children }) {
|
|
766
|
-
return /* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ jsxs5("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
|
|
916
|
+
/* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: label }),
|
|
768
917
|
children
|
|
769
918
|
] });
|
|
770
919
|
}
|
|
@@ -772,8 +921,8 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
772
921
|
const state = useVideoEditorState(controller);
|
|
773
922
|
const { project, selection, readOnly, time } = state;
|
|
774
923
|
if (selection.length !== 1)
|
|
775
|
-
return /* @__PURE__ */
|
|
776
|
-
const at =
|
|
924
|
+
return /* @__PURE__ */ jsx6("p", { className: `text-xs text-muted-foreground ${className}`, "data-clip-inspector": "", children: selection.length ? `${selection.length} clips selected. Select one clip to edit it.` : "Select a clip on the timeline to edit it." });
|
|
925
|
+
const at = findVideoClip2(project, selection[0]);
|
|
777
926
|
if (!at) return null;
|
|
778
927
|
const clip = at.clip;
|
|
779
928
|
const disabled = readOnly || !!at.track.locked;
|
|
@@ -789,24 +938,24 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
789
938
|
};
|
|
790
939
|
const text = (key, label) => {
|
|
791
940
|
const value = clip[key];
|
|
792
|
-
return /* @__PURE__ */
|
|
941
|
+
return /* @__PURE__ */ jsx6(Commit, { value: value === void 0 ? "" : String(value), "aria-label": label ?? key, disabled, onCommit: (raw) => set(key, raw.trim() || void 0, `Change ${label ?? key}`) });
|
|
793
942
|
};
|
|
794
943
|
const number = (key, label, attrs = {}) => {
|
|
795
944
|
const value = clip[key];
|
|
796
|
-
return /* @__PURE__ */
|
|
945
|
+
return /* @__PURE__ */ jsx6(Commit, { type: "number", value: value === void 0 ? "" : String(value), "aria-label": label, disabled, onCommit: (raw) => num(key, raw, `Change ${label.toLowerCase()}`), ...attrs });
|
|
797
946
|
};
|
|
798
947
|
const transition = clip.transition;
|
|
799
|
-
return /* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
803
|
-
at.track.locked && /* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
|
|
949
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
950
|
+
/* @__PURE__ */ jsx6("span", { className: "font-medium", children: videoClipHeading(clip) }),
|
|
951
|
+
/* @__PURE__ */ jsx6("code", { className: "text-muted-foreground", children: clip.id }),
|
|
952
|
+
at.track.locked && /* @__PURE__ */ jsx6("span", { className: "text-amber-500", children: "locked track" })
|
|
804
953
|
] }),
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */
|
|
808
|
-
videoKeyframeRows(project, clip.id, time).map((row) => /* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ jsx6(Row, { label: "Name", name: "name", children: text("name", "Name") }),
|
|
955
|
+
/* @__PURE__ */ jsx6(Row, { label: "Start", name: "start", children: /* @__PURE__ */ jsx6("span", { className: "tabular-nums text-xs", children: formatVideoSeconds2(clip.start) }) }),
|
|
956
|
+
/* @__PURE__ */ jsx6(Row, { label: "Duration", name: "duration", children: /* @__PURE__ */ jsx6("span", { className: "tabular-nums text-xs", children: formatVideoSeconds2(clip.duration) }) }),
|
|
957
|
+
videoKeyframeRows(project, clip.id, time).map((row) => /* @__PURE__ */ jsx6(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
|
|
958
|
+
/* @__PURE__ */ jsx6(
|
|
810
959
|
Commit,
|
|
811
960
|
{
|
|
812
961
|
type: "number",
|
|
@@ -825,7 +974,7 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
825
974
|
}
|
|
826
975
|
}
|
|
827
976
|
),
|
|
828
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ jsx6(
|
|
829
978
|
"button",
|
|
830
979
|
{
|
|
831
980
|
type: "button",
|
|
@@ -842,11 +991,11 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
842
991
|
children: row.onKey ? "\u25C6" : "\u25C7"
|
|
843
992
|
}
|
|
844
993
|
),
|
|
845
|
-
row.keyed && /* @__PURE__ */
|
|
994
|
+
row.keyed && /* @__PURE__ */ jsx6("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", "data-keyframe-count": row.property, children: row.keys })
|
|
846
995
|
] }) }, row.property)),
|
|
847
|
-
at.track.kind === "video" && /* @__PURE__ */
|
|
848
|
-
at.track.kind === "video" && /* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
996
|
+
at.track.kind === "video" && /* @__PURE__ */ jsx6(Row, { label: "Blend", name: "blend", children: /* @__PURE__ */ jsx6("select", { className: field, value: clip.blend ?? "normal", disabled, "aria-label": "Blend mode", onChange: (e) => set("blend", e.target.value === "normal" ? void 0 : e.target.value, "Change blend mode"), children: VIDEO_BLEND_MODES.map((m) => /* @__PURE__ */ jsx6("option", { value: m, children: VIDEO_BLEND_MODE_LABELS[m] }, m)) }) }),
|
|
997
|
+
at.track.kind === "video" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
998
|
+
/* @__PURE__ */ jsx6(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ jsxs5(
|
|
850
999
|
"select",
|
|
851
1000
|
{
|
|
852
1001
|
className: field,
|
|
@@ -858,12 +1007,12 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
858
1007
|
if (grade) controller.apply({ op: "update_clip", clip: clip.id, set: { grade } }, `Apply ${e.target.value} look`);
|
|
859
1008
|
},
|
|
860
1009
|
children: [
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
VIDEO_GRADE_PRESET_NAMES.map((name) => /* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: clip.grade ? "Graded" : "None" }),
|
|
1011
|
+
VIDEO_GRADE_PRESET_NAMES.map((name) => /* @__PURE__ */ jsx6("option", { value: name, children: name.replace(/-/g, " ") }, name))
|
|
863
1012
|
]
|
|
864
1013
|
}
|
|
865
1014
|
) }),
|
|
866
|
-
VIDEO_GRADE_CONTROLS.map((c) => /* @__PURE__ */
|
|
1015
|
+
VIDEO_GRADE_CONTROLS.map((c) => /* @__PURE__ */ jsx6(Row, { label: c.label, name: `grade.${c.key}`, children: /* @__PURE__ */ jsx6(
|
|
867
1016
|
Commit,
|
|
868
1017
|
{
|
|
869
1018
|
type: "number",
|
|
@@ -882,10 +1031,10 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
882
1031
|
}
|
|
883
1032
|
}
|
|
884
1033
|
) }, c.key)),
|
|
885
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ jsx6(LutControls, { controller, clip, disabled })
|
|
886
1035
|
] }),
|
|
887
|
-
clip.type === "adjustment" && /* @__PURE__ */
|
|
888
|
-
/* @__PURE__ */
|
|
1036
|
+
clip.type === "adjustment" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1037
|
+
/* @__PURE__ */ jsx6(Row, { label: "Changes", name: "scope", children: /* @__PURE__ */ jsx6(
|
|
889
1038
|
"select",
|
|
890
1039
|
{
|
|
891
1040
|
className: field,
|
|
@@ -898,13 +1047,13 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
898
1047
|
if (scope === "track") controller.apply({ op: "update_clip", clip: clip.id, set: { scope, targetTrack: clip.targetTrack ?? target ?? at.track.id } }, "Change adjustment scope");
|
|
899
1048
|
else controller.apply({ op: "update_clip", clip: clip.id, ...scope === "underneath" ? { remove: ["scope", "targetTrack"] } : { set: { scope }, remove: ["targetTrack"] } }, "Change adjustment scope");
|
|
900
1049
|
},
|
|
901
|
-
children: VIDEO_ADJUSTMENT_SCOPES.map((s) => /* @__PURE__ */
|
|
1050
|
+
children: VIDEO_ADJUSTMENT_SCOPES.map((s) => /* @__PURE__ */ jsx6("option", { value: s, children: VIDEO_ADJUSTMENT_SCOPE_LABELS[s] }, s))
|
|
902
1051
|
}
|
|
903
1052
|
) }),
|
|
904
|
-
clip.scope === "track" && /* @__PURE__ */
|
|
1053
|
+
clip.scope === "track" && /* @__PURE__ */ jsx6(Row, { label: "Track", name: "targetTrack", children: /* @__PURE__ */ jsx6("select", { className: field, value: clip.targetTrack ?? "", disabled, "aria-label": "Adjusted track", onChange: (e) => set("targetTrack", e.target.value, "Change adjusted track"), children: project.tracks.filter((t) => t.kind === "video").map((t) => /* @__PURE__ */ jsx6("option", { value: t.id, children: t.name ?? t.id }, t.id)) }) })
|
|
905
1054
|
] }),
|
|
906
|
-
at.track.kind === "video" && /* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
1055
|
+
at.track.kind === "video" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1056
|
+
/* @__PURE__ */ jsx6(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ jsxs5(
|
|
908
1057
|
"select",
|
|
909
1058
|
{
|
|
910
1059
|
className: field,
|
|
@@ -922,8 +1071,8 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
922
1071
|
controller.apply(videoMaskEdit(clip.id, shape ? { ...rest, shape, ...shape === "polygon" ? { points } : {} } : null), shape ? "Mask clip" : "Remove mask");
|
|
923
1072
|
},
|
|
924
1073
|
children: [
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
VIDEO_MASK_SHAPES.map((s) => /* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "None" }),
|
|
1075
|
+
VIDEO_MASK_SHAPES.map((s) => /* @__PURE__ */ jsx6("option", { value: s, children: VIDEO_MASK_SHAPE_LABELS[s] }, s))
|
|
927
1076
|
]
|
|
928
1077
|
}
|
|
929
1078
|
) }),
|
|
@@ -932,7 +1081,7 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
932
1081
|
["height", "Mask height", 0.05],
|
|
933
1082
|
["feather", "Feather (px)", 5],
|
|
934
1083
|
["rotation", "Mask angle", 5]
|
|
935
|
-
].map(([key, label, step]) => /* @__PURE__ */
|
|
1084
|
+
].map(([key, label, step]) => /* @__PURE__ */ jsx6(Row, { label, name: `mask.${key}`, children: /* @__PURE__ */ jsx6(
|
|
936
1085
|
Commit,
|
|
937
1086
|
{
|
|
938
1087
|
type: "number",
|
|
@@ -950,7 +1099,7 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
950
1099
|
}
|
|
951
1100
|
}
|
|
952
1101
|
) }, key)),
|
|
953
|
-
clip.mask && /* @__PURE__ */
|
|
1102
|
+
clip.mask && /* @__PURE__ */ jsx6(Row, { label: "Invert mask", name: "mask.inverted", children: /* @__PURE__ */ jsx6(
|
|
954
1103
|
"input",
|
|
955
1104
|
{
|
|
956
1105
|
type: "checkbox",
|
|
@@ -965,7 +1114,7 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
965
1114
|
}
|
|
966
1115
|
) })
|
|
967
1116
|
] }),
|
|
968
|
-
at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */
|
|
1117
|
+
at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ jsx6(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ jsxs5(
|
|
969
1118
|
"select",
|
|
970
1119
|
{
|
|
971
1120
|
className: field,
|
|
@@ -977,20 +1126,20 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
977
1126
|
set(key, effect ? { ...clip[key], effect } : void 0, key === "animateIn" ? "Change entrance" : "Change exit");
|
|
978
1127
|
},
|
|
979
1128
|
children: [
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
VIDEO_CLIP_ANIMATION_EFFECTS.map((effect) => /* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "None" }),
|
|
1130
|
+
VIDEO_CLIP_ANIMATION_EFFECTS.map((effect) => /* @__PURE__ */ jsx6("option", { value: effect, children: VIDEO_CLIP_ANIMATION_LABELS[effect] }, effect))
|
|
982
1131
|
]
|
|
983
1132
|
}
|
|
984
1133
|
) }, key)),
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
clip.type === "media" && /* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
1134
|
+
/* @__PURE__ */ jsx6(Row, { label: "Fade in (ms)", name: "fadeIn", children: number("fadeIn", "Fade in", { min: 0, step: 100 }) }),
|
|
1135
|
+
/* @__PURE__ */ jsx6(Row, { label: "Fade out (ms)", name: "fadeOut", children: number("fadeOut", "Fade out", { min: 0, step: 100 }) }),
|
|
1136
|
+
clip.type === "media" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1137
|
+
/* @__PURE__ */ jsx6(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
|
|
1138
|
+
/* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: "ramped" }),
|
|
1139
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: btn2, disabled, onClick: () => controller.apply({ op: "set_time_remap", clip: clip.id, keys: null, ripple: true }, "Remove speed ramp"), children: "Remove ramp" })
|
|
991
1140
|
] }) : number("speed", "Speed", { min: 0.1, step: 0.25 }) }),
|
|
992
|
-
project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
1141
|
+
project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ jsx6(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ jsxs5("span", { className: "flex flex-wrap gap-1", children: [
|
|
1142
|
+
/* @__PURE__ */ jsx6(
|
|
994
1143
|
"button",
|
|
995
1144
|
{
|
|
996
1145
|
type: "button",
|
|
@@ -1001,11 +1150,11 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
1001
1150
|
children: "Freeze 1 s here"
|
|
1002
1151
|
}
|
|
1003
1152
|
),
|
|
1004
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: btn2, disabled, title: "Normal speed, then a glide into 0.3\xD7 slow motion", onClick: () => controller.apply(videoSpeedRampEdit(clip, videoSlowMotionRamp(clip.duration)), "Speed ramp"), children: "Slow-mo ramp" })
|
|
1005
1154
|
] }) }),
|
|
1006
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ jsx6(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ jsx6("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) }),
|
|
1007
1156
|
["fadeInCurve", "fadeOutCurve"].map(
|
|
1008
|
-
(key) => (key === "fadeInCurve" ? clip.fadeIn : clip.fadeOut) ? /* @__PURE__ */
|
|
1157
|
+
(key) => (key === "fadeInCurve" ? clip.fadeIn : clip.fadeOut) ? /* @__PURE__ */ jsx6(Row, { label: key === "fadeInCurve" ? "Fade in sound" : "Fade out sound", name: key, children: /* @__PURE__ */ jsx6(
|
|
1009
1158
|
"select",
|
|
1010
1159
|
{
|
|
1011
1160
|
className: field,
|
|
@@ -1016,28 +1165,28 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
1016
1165
|
const curve = e.target.value;
|
|
1017
1166
|
set(key, curve === "linear" ? void 0 : curve, key === "fadeInCurve" ? "Change fade in curve" : "Change fade out curve");
|
|
1018
1167
|
},
|
|
1019
|
-
children: VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */
|
|
1168
|
+
children: VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ jsx6("option", { value: c, children: VIDEO_FADE_CURVE_LABELS[c] }, c))
|
|
1020
1169
|
}
|
|
1021
1170
|
) }, key) : null
|
|
1022
1171
|
)
|
|
1023
1172
|
] }),
|
|
1024
|
-
clip.type === "text" && /* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1173
|
+
clip.type === "text" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1174
|
+
/* @__PURE__ */ jsx6(Row, { label: "Text", name: "text", children: /* @__PURE__ */ jsx6(Commit, { multiline: true, value: clip.text, "aria-label": "Text", disabled, onCommit: (raw) => set("text", raw, "Change text") }) }),
|
|
1175
|
+
/* @__PURE__ */ jsx6(Row, { label: "Colour", name: "color", children: text("color", "Colour") }),
|
|
1176
|
+
/* @__PURE__ */ jsx6(Row, { label: "Font size", name: "fontSize", children: number("fontSize", "Font size", { min: 1, step: 2 }) }),
|
|
1177
|
+
/* @__PURE__ */ jsx6(Row, { label: "Background", name: "background", children: text("background", "Background") })
|
|
1029
1178
|
] }),
|
|
1030
|
-
clip.type === "sequence" && /* @__PURE__ */
|
|
1031
|
-
/* @__PURE__ */
|
|
1179
|
+
clip.type === "sequence" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1180
|
+
/* @__PURE__ */ jsx6(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ jsxs5("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
|
|
1032
1181
|
project.sequences?.find((q) => q.id === clip.sequence)?.name ?? clip.sequence,
|
|
1033
1182
|
" \xB7 from ",
|
|
1034
1183
|
formatVideoSeconds2(clip.in ?? 0)
|
|
1035
1184
|
] }) }),
|
|
1036
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ jsx6(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ jsx6("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) })
|
|
1037
1186
|
] }),
|
|
1038
|
-
clip.type === "effect" && /* @__PURE__ */
|
|
1039
|
-
clip.type === "color" && /* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1187
|
+
clip.type === "effect" && /* @__PURE__ */ jsx6(Row, { label: "Effect", name: "effect", children: /* @__PURE__ */ jsx6("span", { className: "truncate text-xs", title: "Change its controls in the Effects panel", children: clip.name ?? clip.effect }) }),
|
|
1188
|
+
clip.type === "color" && /* @__PURE__ */ jsx6(Row, { label: "Colour", name: "color", children: /* @__PURE__ */ jsx6(Commit, { value: clip.color, "aria-label": "Colour", disabled, onCommit: (raw) => raw.trim() && set("color", raw.trim(), "Change colour") }) }),
|
|
1189
|
+
/* @__PURE__ */ jsx6(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ jsxs5(
|
|
1041
1190
|
"select",
|
|
1042
1191
|
{
|
|
1043
1192
|
className: field,
|
|
@@ -1053,12 +1202,12 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
1053
1202
|
);
|
|
1054
1203
|
},
|
|
1055
1204
|
children: [
|
|
1056
|
-
/* @__PURE__ */
|
|
1057
|
-
VIDEO_TRANSITION_TYPES.filter((t) => t !== "effect" || transition?.type === "effect").map((t) => /* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "None" }),
|
|
1206
|
+
VIDEO_TRANSITION_TYPES.filter((t) => t !== "effect" || transition?.type === "effect").map((t) => /* @__PURE__ */ jsx6("option", { value: t, children: t === "effect" ? `Effect: ${transition?.effect?.name ?? transition?.effect?.effect}` : VIDEO_TRANSITION_LABELS[t] }, t))
|
|
1058
1207
|
]
|
|
1059
1208
|
}
|
|
1060
1209
|
) }),
|
|
1061
|
-
transition && /* @__PURE__ */
|
|
1210
|
+
transition && /* @__PURE__ */ jsx6(Row, { label: "Length (ms)", name: "transitionDuration", children: /* @__PURE__ */ jsx6(
|
|
1062
1211
|
Commit,
|
|
1063
1212
|
{
|
|
1064
1213
|
type: "number",
|
|
@@ -1073,7 +1222,7 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
1073
1222
|
}
|
|
1074
1223
|
}
|
|
1075
1224
|
) }),
|
|
1076
|
-
transition && videoTransitionHasDirection(transition.type) && /* @__PURE__ */
|
|
1225
|
+
transition && videoTransitionHasDirection(transition.type) && /* @__PURE__ */ jsx6(Row, { label: "Direction", name: "transitionDirection", children: /* @__PURE__ */ jsx6(
|
|
1077
1226
|
"select",
|
|
1078
1227
|
{
|
|
1079
1228
|
className: field,
|
|
@@ -1081,10 +1230,10 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
1081
1230
|
disabled,
|
|
1082
1231
|
"aria-label": "Transition direction",
|
|
1083
1232
|
onChange: (e) => controller.apply({ op: "set_transition", clip: clip.id, transition: { ...transition, direction: e.target.value } }, "Change transition direction"),
|
|
1084
|
-
children: VIDEO_WIPE_DIRECTIONS.map((d) => /* @__PURE__ */
|
|
1233
|
+
children: VIDEO_WIPE_DIRECTIONS.map((d) => /* @__PURE__ */ jsx6("option", { value: d, children: d }, d))
|
|
1085
1234
|
}
|
|
1086
1235
|
) }),
|
|
1087
|
-
transition && /* @__PURE__ */
|
|
1236
|
+
transition && /* @__PURE__ */ jsx6(Row, { label: "Transition sound", name: "transitionAudioCurve", children: /* @__PURE__ */ jsx6(
|
|
1088
1237
|
"select",
|
|
1089
1238
|
{
|
|
1090
1239
|
className: field,
|
|
@@ -1097,30 +1246,31 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
1097
1246
|
const next = curve === videoTransitionAudioCurve(rest) ? rest : { ...rest, audioCurve: curve };
|
|
1098
1247
|
controller.apply({ op: "set_transition", clip: clip.id, transition: next }, "Change transition sound");
|
|
1099
1248
|
},
|
|
1100
|
-
children: VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */
|
|
1249
|
+
children: VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ jsx6("option", { value: c, children: VIDEO_FADE_CURVE_LABELS[c] }, c))
|
|
1101
1250
|
}
|
|
1102
|
-
) })
|
|
1251
|
+
) }),
|
|
1252
|
+
/* @__PURE__ */ jsx6(ClipCameraMoves, { controller, clip: clip.id })
|
|
1103
1253
|
] });
|
|
1104
1254
|
}
|
|
1105
1255
|
|
|
1106
1256
|
// src/video-editor/MediaBin.tsx
|
|
1107
|
-
import { useState as
|
|
1257
|
+
import { useState as useState5 } from "react";
|
|
1108
1258
|
import {
|
|
1109
1259
|
formatVideoSeconds as formatVideoSeconds3,
|
|
1110
1260
|
probeVideoMedia,
|
|
1111
1261
|
videoAssetDropEdit,
|
|
1112
1262
|
videoAssetKindOf
|
|
1113
1263
|
} from "@pixerate/editor/video-editor";
|
|
1114
|
-
import { Fragment as Fragment4, jsx as
|
|
1264
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1115
1265
|
var btn3 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
1116
1266
|
function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMedia, className = "" }) {
|
|
1117
1267
|
const { project, readOnly } = useVideoEditorState(controller);
|
|
1118
1268
|
const canEdit = editable && !readOnly;
|
|
1119
|
-
const [url, setUrl] =
|
|
1120
|
-
const [urlKind, setUrlKind] =
|
|
1121
|
-
const [busy, setBusy] =
|
|
1122
|
-
const [problem, setProblem] =
|
|
1123
|
-
const [over, setOver] =
|
|
1269
|
+
const [url, setUrl] = useState5("");
|
|
1270
|
+
const [urlKind, setUrlKind] = useState5("");
|
|
1271
|
+
const [busy, setBusy] = useState5(0);
|
|
1272
|
+
const [problem, setProblem] = useState5(null);
|
|
1273
|
+
const [over, setOver] = useState5(false);
|
|
1124
1274
|
const addSource = async (src, kind, name) => {
|
|
1125
1275
|
setBusy((n) => n + 1);
|
|
1126
1276
|
try {
|
|
@@ -1168,7 +1318,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
|
|
|
1168
1318
|
if (added) controller.select([added]);
|
|
1169
1319
|
}
|
|
1170
1320
|
};
|
|
1171
|
-
return /* @__PURE__ */
|
|
1321
|
+
return /* @__PURE__ */ jsxs6(
|
|
1172
1322
|
"div",
|
|
1173
1323
|
{
|
|
1174
1324
|
className: `flex flex-col gap-2 rounded ${over ? "ring-2 ring-rose-500/60" : ""} ${className}`,
|
|
@@ -1186,21 +1336,21 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
|
|
|
1186
1336
|
void addFiles(e.dataTransfer.files);
|
|
1187
1337
|
},
|
|
1188
1338
|
children: [
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
project.assets.length ? /* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
asset.proxies?.length ? /* @__PURE__ */
|
|
1194
|
-
asset.duration !== void 0 && /* @__PURE__ */
|
|
1195
|
-
editable && /* @__PURE__ */
|
|
1196
|
-
] }, asset.id)) }) : /* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ jsx7("div", { className: "text-xs font-medium", children: "Media" }),
|
|
1340
|
+
project.assets.length ? /* @__PURE__ */ jsx7("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ jsxs6("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
|
|
1341
|
+
/* @__PURE__ */ jsx7("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-asset-kind": "", children: asset.kind }),
|
|
1342
|
+
/* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1 truncate", title: asset.src, children: asset.name ?? asset.id }),
|
|
1343
|
+
asset.proxies?.length ? /* @__PURE__ */ jsx7("span", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", title: `Proxies: ${asset.proxies.map((p) => `${p.scale * 100}%`).join(", ")} (the preview can play these; exports use the original)`, "data-asset-proxies": "", children: "proxy" }) : null,
|
|
1344
|
+
asset.duration !== void 0 && /* @__PURE__ */ jsx7("span", { className: "tabular-nums text-muted-foreground", children: formatVideoSeconds3(asset.duration) }),
|
|
1345
|
+
editable && /* @__PURE__ */ jsx7("button", { type: "button", className: btn3, disabled: !canEdit, onClick: () => addToTimeline(asset), "data-add-to-timeline": "", children: "Add to timeline" })
|
|
1346
|
+
] }, asset.id)) }) : /* @__PURE__ */ jsxs6("p", { className: "text-xs text-muted-foreground", children: [
|
|
1197
1347
|
"No media yet.",
|
|
1198
1348
|
editable ? " Choose or drop files, or add a URL." : ""
|
|
1199
1349
|
] }),
|
|
1200
|
-
editable && /* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1350
|
+
editable && /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1351
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
|
|
1202
1352
|
"Choose or drop video, audio or image files",
|
|
1203
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ jsx7(
|
|
1204
1354
|
"input",
|
|
1205
1355
|
{
|
|
1206
1356
|
type: "file",
|
|
@@ -1217,7 +1367,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
|
|
|
1217
1367
|
}
|
|
1218
1368
|
)
|
|
1219
1369
|
] }),
|
|
1220
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ jsxs6(
|
|
1221
1371
|
"form",
|
|
1222
1372
|
{
|
|
1223
1373
|
className: "flex items-center gap-1",
|
|
@@ -1226,7 +1376,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
|
|
|
1226
1376
|
void addUrl();
|
|
1227
1377
|
},
|
|
1228
1378
|
children: [
|
|
1229
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ jsx7(
|
|
1230
1380
|
"input",
|
|
1231
1381
|
{
|
|
1232
1382
|
className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -1237,26 +1387,26 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
|
|
|
1237
1387
|
onChange: (e) => setUrl(e.target.value)
|
|
1238
1388
|
}
|
|
1239
1389
|
),
|
|
1240
|
-
/* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
/* @__PURE__ */
|
|
1390
|
+
/* @__PURE__ */ jsxs6("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", value: urlKind, disabled: !canEdit, "aria-label": "Media kind", onChange: (e) => setUrlKind(e.target.value), children: [
|
|
1391
|
+
/* @__PURE__ */ jsx7("option", { value: "", children: "Auto" }),
|
|
1392
|
+
/* @__PURE__ */ jsx7("option", { value: "video", children: "Video" }),
|
|
1393
|
+
/* @__PURE__ */ jsx7("option", { value: "audio", children: "Audio" }),
|
|
1394
|
+
/* @__PURE__ */ jsx7("option", { value: "image", children: "Image" })
|
|
1245
1395
|
] }),
|
|
1246
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ jsx7("button", { type: "submit", className: btn3, disabled: !canEdit || !url.trim(), "data-add-url": "", children: "Add" })
|
|
1247
1397
|
]
|
|
1248
1398
|
}
|
|
1249
1399
|
)
|
|
1250
1400
|
] }),
|
|
1251
|
-
busy > 0 && /* @__PURE__ */
|
|
1252
|
-
problem && /* @__PURE__ */
|
|
1401
|
+
busy > 0 && /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Reading media\u2026" }),
|
|
1402
|
+
problem && /* @__PURE__ */ jsx7("p", { className: "text-xs text-red-500", role: "alert", "data-media-error": "", children: problem })
|
|
1253
1403
|
]
|
|
1254
1404
|
}
|
|
1255
1405
|
);
|
|
1256
1406
|
}
|
|
1257
1407
|
|
|
1258
1408
|
// src/video-editor/TranscriptPanel.tsx
|
|
1259
|
-
import
|
|
1409
|
+
import React7, { useMemo as useMemo3, useState as useState6 } from "react";
|
|
1260
1410
|
import {
|
|
1261
1411
|
findVideoFillers,
|
|
1262
1412
|
findVideoTranscriptPauses,
|
|
@@ -1266,15 +1416,15 @@ import {
|
|
|
1266
1416
|
videoWordAt,
|
|
1267
1417
|
videoWordsRange
|
|
1268
1418
|
} from "@pixerate/editor/video-editor";
|
|
1269
|
-
import { Fragment as Fragment5, jsx as
|
|
1419
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1270
1420
|
var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1271
1421
|
function TranscriptPanel({ controller, track, editable = true, className = "" }) {
|
|
1272
1422
|
const state = useVideoEditorState(controller);
|
|
1273
1423
|
const { project, time, readOnly } = state;
|
|
1274
1424
|
const canEdit = editable && !readOnly;
|
|
1275
|
-
const [anchor, setAnchor] =
|
|
1276
|
-
const [focus, setFocus] =
|
|
1277
|
-
const [message, setMessage] =
|
|
1425
|
+
const [anchor, setAnchor] = useState6(null);
|
|
1426
|
+
const [focus, setFocus] = useState6(null);
|
|
1427
|
+
const [message, setMessage] = useState6(null);
|
|
1278
1428
|
const words = useMemo3(() => {
|
|
1279
1429
|
try {
|
|
1280
1430
|
return videoTimelineTranscript(project, { track });
|
|
@@ -1301,9 +1451,9 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
|
|
|
1301
1451
|
setMessage(e instanceof Error ? e.message : String(e));
|
|
1302
1452
|
}
|
|
1303
1453
|
};
|
|
1304
|
-
return /* @__PURE__ */
|
|
1305
|
-
words.length > 0 ? /* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1454
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
|
|
1455
|
+
words.length > 0 ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
1456
|
+
/* @__PURE__ */ jsx8(
|
|
1307
1457
|
"div",
|
|
1308
1458
|
{
|
|
1309
1459
|
className: "max-h-48 overflow-y-auto leading-6",
|
|
@@ -1319,8 +1469,8 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
|
|
|
1319
1469
|
},
|
|
1320
1470
|
children: words.map((w, i) => {
|
|
1321
1471
|
const inSelection = selected !== null && i >= selected[0] && i <= selected[1];
|
|
1322
|
-
return /* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ jsxs7(React7.Fragment, { children: [
|
|
1473
|
+
/* @__PURE__ */ jsx8(
|
|
1324
1474
|
"span",
|
|
1325
1475
|
{
|
|
1326
1476
|
role: "option",
|
|
@@ -1346,32 +1496,32 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
|
|
|
1346
1496
|
})
|
|
1347
1497
|
}
|
|
1348
1498
|
),
|
|
1349
|
-
canEdit && /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1499
|
+
canEdit && /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-1", children: [
|
|
1500
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: btn4, disabled: !selected, onClick: () => selected && cut([videoWordsRange(words, selected[0], selected[1])], "Cut words", "Select words to cut."), children: "Delete selected words" }),
|
|
1501
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: btn4, onClick: () => cut(findVideoFillers(words), "Remove fillers", "No filler words found."), children: "Remove fillers" }),
|
|
1502
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: btn4, onClick: () => cut(findVideoTranscriptPauses(words, { fps: project.fps }), "Tighten pauses", "No long pauses found."), children: "Tighten pauses" })
|
|
1353
1503
|
] })
|
|
1354
|
-
] }) : /* @__PURE__ */
|
|
1355
|
-
canEdit && sound.length > 0 && /* @__PURE__ */
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
1504
|
+
] }) : /* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", "data-transcript-empty": "", children: "No transcribed media on the timeline. Load a transcript (Whisper JSON, .srt or .vtt) for a video or audio asset to edit by text." }),
|
|
1505
|
+
canEdit && sound.length > 0 && /* @__PURE__ */ jsxs7("details", { children: [
|
|
1506
|
+
/* @__PURE__ */ jsx8("summary", { className: "cursor-pointer text-muted-foreground", children: "Transcripts" }),
|
|
1507
|
+
/* @__PURE__ */ jsx8("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-2", children: [
|
|
1508
|
+
/* @__PURE__ */ jsxs7("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
1359
1509
|
a.name ?? a.id,
|
|
1360
1510
|
" ",
|
|
1361
1511
|
a.transcript ? `\xB7 ${a.transcript.length} words` : ""
|
|
1362
1512
|
] }),
|
|
1363
|
-
/* @__PURE__ */
|
|
1513
|
+
/* @__PURE__ */ jsx8("input", { type: "file", accept: ".json,.srt,.vtt,application/json,text/vtt", "aria-label": `Load a transcript for ${a.name ?? a.id}`, className: "w-40 text-[10px]", onChange: (e) => void load(a.id, e.target.files?.[0]) })
|
|
1364
1514
|
] }, a.id)) })
|
|
1365
1515
|
] }),
|
|
1366
|
-
message && /* @__PURE__ */
|
|
1516
|
+
message && /* @__PURE__ */ jsx8("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: message })
|
|
1367
1517
|
] });
|
|
1368
1518
|
}
|
|
1369
1519
|
|
|
1370
1520
|
// src/video-editor/TranscriptEditor.tsx
|
|
1371
|
-
import
|
|
1521
|
+
import React8, { useState as useState7 } from "react";
|
|
1372
1522
|
|
|
1373
1523
|
// src/video-editor/useTranscriptVideo.ts
|
|
1374
|
-
import { useEffect as
|
|
1524
|
+
import { useEffect as useEffect6, useRef as useRef5, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
1375
1525
|
import { TranscriptVideoController } from "@pixerate/editor/video-editor";
|
|
1376
1526
|
function useTranscriptVideoController(controller, options = {}) {
|
|
1377
1527
|
const ref = useRef5(null);
|
|
@@ -1381,7 +1531,7 @@ function useTranscriptVideoController(controller, options = {}) {
|
|
|
1381
1531
|
ref.current = { key, editor: controller, transcript: new TranscriptVideoController(controller, options) };
|
|
1382
1532
|
}
|
|
1383
1533
|
const transcript = ref.current.transcript;
|
|
1384
|
-
|
|
1534
|
+
useEffect6(() => () => transcript.destroy(), [transcript]);
|
|
1385
1535
|
return transcript;
|
|
1386
1536
|
}
|
|
1387
1537
|
function useTranscriptVideoState(transcript) {
|
|
@@ -1389,7 +1539,7 @@ function useTranscriptVideoState(transcript) {
|
|
|
1389
1539
|
}
|
|
1390
1540
|
|
|
1391
1541
|
// src/video-editor/TranscriptEditor.tsx
|
|
1392
|
-
import { jsx as
|
|
1542
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1393
1543
|
var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1394
1544
|
var CHIP = {
|
|
1395
1545
|
filler: "bg-amber-400/30 text-amber-700 dark:text-amber-300",
|
|
@@ -1400,13 +1550,13 @@ var KIND_LABEL = { filler: "filler", pause: "pause", repetition: "repeat" };
|
|
|
1400
1550
|
function TranscriptEditor({ controller, track, planFirst = false, editable = true, className = "" }) {
|
|
1401
1551
|
const transcript = useTranscriptVideoController(controller, { track, planFirst });
|
|
1402
1552
|
const state = useTranscriptVideoState(transcript);
|
|
1403
|
-
const [anchor, setAnchor] =
|
|
1553
|
+
const [anchor, setAnchor] = useState7(null);
|
|
1404
1554
|
const canEdit = editable && state.editable;
|
|
1405
1555
|
const { words, current, selection, disfluencies, flags } = state;
|
|
1406
1556
|
if (!words.length)
|
|
1407
|
-
return /* @__PURE__ */
|
|
1408
|
-
return /* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ jsx9("p", { className: `text-xs text-muted-foreground ${className}`, "data-transcript-editor": "", "data-transcript-empty": "", children: "No transcribed media on the timeline. Attach a transcript (Whisper JSON, .srt or .vtt) to edit by text." });
|
|
1558
|
+
return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
|
|
1559
|
+
/* @__PURE__ */ jsx9(
|
|
1410
1560
|
"div",
|
|
1411
1561
|
{
|
|
1412
1562
|
className: "max-h-56 overflow-y-auto leading-6",
|
|
@@ -1423,8 +1573,8 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
|
|
|
1423
1573
|
children: words.map((w, i) => {
|
|
1424
1574
|
const selected = !!selection && i >= selection[0] && i <= selection[1];
|
|
1425
1575
|
const kinds = flags[i];
|
|
1426
|
-
return /* @__PURE__ */
|
|
1427
|
-
/* @__PURE__ */
|
|
1576
|
+
return /* @__PURE__ */ jsxs8(React8.Fragment, { children: [
|
|
1577
|
+
/* @__PURE__ */ jsx9(
|
|
1428
1578
|
"span",
|
|
1429
1579
|
{
|
|
1430
1580
|
role: "option",
|
|
@@ -1447,62 +1597,62 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
|
|
|
1447
1597
|
children: w.word
|
|
1448
1598
|
}
|
|
1449
1599
|
),
|
|
1450
|
-
kinds?.includes("pause") ? /* @__PURE__ */
|
|
1600
|
+
kinds?.includes("pause") ? /* @__PURE__ */ jsx9("span", { className: "mx-0.5 text-sky-500", "aria-hidden": "true", children: "\u23F8" }) : " "
|
|
1451
1601
|
] }, `${w.clip}:${w.index}`);
|
|
1452
1602
|
})
|
|
1453
1603
|
}
|
|
1454
1604
|
),
|
|
1455
|
-
canEdit && /* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1605
|
+
canEdit && /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1606
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: btn5, disabled: !selection, onClick: () => transcript.deleteSelection(), "data-delete-words": "", children: planFirst ? "Propose deleting words" : "Delete words" }),
|
|
1607
|
+
/* @__PURE__ */ jsxs8("button", { type: "button", className: btn5, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
|
|
1458
1608
|
"Plan cleanup (",
|
|
1459
1609
|
disfluencies.length,
|
|
1460
1610
|
")"
|
|
1461
1611
|
] })
|
|
1462
1612
|
] }),
|
|
1463
|
-
disfluencies.length > 0 && /* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1613
|
+
disfluencies.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ jsxs8("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
|
|
1614
|
+
/* @__PURE__ */ jsxs8("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
|
|
1465
1615
|
KIND_LABEL[d.kind],
|
|
1466
1616
|
": ",
|
|
1467
1617
|
d.kind === "pause" ? `${((d.to - d.from) / 1e3).toFixed(1)} s` : d.text
|
|
1468
1618
|
] }),
|
|
1469
|
-
canEdit && /* @__PURE__ */
|
|
1619
|
+
canEdit && /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": `Cut ${KIND_LABEL[d.kind]} ${d.text}`, onClick: () => transcript.removeDisfluency(i), "data-cut-disfluency": i, children: "\u2715" })
|
|
1470
1620
|
] }, `${d.kind}:${d.from}`)) }),
|
|
1471
|
-
state.error && /* @__PURE__ */
|
|
1621
|
+
state.error && /* @__PURE__ */ jsx9("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: state.error })
|
|
1472
1622
|
] });
|
|
1473
1623
|
}
|
|
1474
1624
|
|
|
1475
1625
|
// src/video-editor/EditPlanPreview.tsx
|
|
1476
|
-
import { useState as
|
|
1626
|
+
import { useState as useState8 } from "react";
|
|
1477
1627
|
import { describeVideoEditPlan, formatVideoSeconds as formatVideoSeconds4 } from "@pixerate/editor/video-editor";
|
|
1478
|
-
import { jsx as
|
|
1628
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1479
1629
|
var btn6 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
|
|
1480
1630
|
function EditPlanPreview({ controller, editable = true, className = "" }) {
|
|
1481
1631
|
const state = useVideoEditorState(controller);
|
|
1482
|
-
const [message, setMessage] =
|
|
1632
|
+
const [message, setMessage] = useState8(null);
|
|
1483
1633
|
if (!state.plans.length) return null;
|
|
1484
1634
|
const total = Math.max(1, state.duration);
|
|
1485
|
-
return /* @__PURE__ */
|
|
1635
|
+
return /* @__PURE__ */ jsxs9("section", { className: `flex flex-col gap-2 rounded-md border border-amber-500/50 bg-amber-500/5 p-2 text-xs ${className}`, "aria-label": "Proposed edits", "data-edit-plans": "", children: [
|
|
1486
1636
|
state.plans.map((plan) => {
|
|
1487
1637
|
const s = plan.summary;
|
|
1488
1638
|
const stale = controller.isPlanStale(plan.id);
|
|
1489
|
-
return /* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1639
|
+
return /* @__PURE__ */ jsxs9("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
|
|
1640
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
1641
|
+
/* @__PURE__ */ jsx10("h3", { className: "flex-1 font-semibold", children: plan.title }),
|
|
1642
|
+
/* @__PURE__ */ jsxs9("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
|
|
1493
1643
|
s.durationDelta < 0 ? "\u2212" : s.durationDelta > 0 ? "+" : "\xB1",
|
|
1494
1644
|
formatVideoSeconds4(Math.abs(s.durationDelta))
|
|
1495
1645
|
] })
|
|
1496
1646
|
] }),
|
|
1497
|
-
plan.description && /* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1647
|
+
plan.description && /* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: plan.description }),
|
|
1648
|
+
/* @__PURE__ */ jsxs9("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
|
|
1499
1649
|
describeVideoEditPlan(plan),
|
|
1500
1650
|
" \xB7 ",
|
|
1501
1651
|
formatVideoSeconds4(s.durationBefore),
|
|
1502
1652
|
" \u2192 ",
|
|
1503
1653
|
formatVideoSeconds4(s.durationAfter)
|
|
1504
1654
|
] }),
|
|
1505
|
-
plan.ranges && plan.ranges.length > 0 && /* @__PURE__ */
|
|
1655
|
+
plan.ranges && plan.ranges.length > 0 && /* @__PURE__ */ jsx10("div", { className: "relative h-3 w-full overflow-hidden rounded bg-muted", "aria-label": "Stretches the plan cuts", "data-plan-strip": "", children: plan.ranges.map((r, i) => /* @__PURE__ */ jsx10(
|
|
1506
1656
|
"button",
|
|
1507
1657
|
{
|
|
1508
1658
|
type: "button",
|
|
@@ -1514,7 +1664,7 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
|
|
|
1514
1664
|
},
|
|
1515
1665
|
i
|
|
1516
1666
|
)) }),
|
|
1517
|
-
s.newIssues.length > 0 && /* @__PURE__ */
|
|
1667
|
+
s.newIssues.length > 0 && /* @__PURE__ */ jsxs9("p", { className: "text-amber-600", children: [
|
|
1518
1668
|
"It would add ",
|
|
1519
1669
|
s.newIssues.length,
|
|
1520
1670
|
" problem",
|
|
@@ -1522,9 +1672,9 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
|
|
|
1522
1672
|
": ",
|
|
1523
1673
|
s.newIssues[0].message
|
|
1524
1674
|
] }),
|
|
1525
|
-
stale && /* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1527
|
-
/* @__PURE__ */
|
|
1675
|
+
stale && /* @__PURE__ */ jsx10("p", { className: "text-amber-600", "data-plan-stale": "", children: "The project changed since this plan was made; it is checked again when accepted." }),
|
|
1676
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
|
|
1677
|
+
/* @__PURE__ */ jsx10(
|
|
1528
1678
|
"button",
|
|
1529
1679
|
{
|
|
1530
1680
|
type: "button",
|
|
@@ -1538,25 +1688,25 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
|
|
|
1538
1688
|
children: "Accept plan"
|
|
1539
1689
|
}
|
|
1540
1690
|
),
|
|
1541
|
-
/* @__PURE__ */
|
|
1691
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn6, "data-discard-plan": "", onClick: () => (controller.discardPlan(plan.id), setMessage(null)), children: "Discard" })
|
|
1542
1692
|
] })
|
|
1543
1693
|
] }, plan.id);
|
|
1544
1694
|
}),
|
|
1545
|
-
message && /* @__PURE__ */
|
|
1695
|
+
message && /* @__PURE__ */ jsx10("p", { className: "text-red-500", role: "alert", "data-plan-error": "", children: message })
|
|
1546
1696
|
] });
|
|
1547
1697
|
}
|
|
1548
1698
|
|
|
1549
1699
|
// src/video-editor/VideoEditor.tsx
|
|
1550
|
-
import { useEffect as
|
|
1700
|
+
import { useEffect as useEffect8 } from "react";
|
|
1551
1701
|
|
|
1552
1702
|
// src/video-editor/VideoEffectsPanel.tsx
|
|
1553
|
-
import { useEffect as
|
|
1703
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1554
1704
|
import {
|
|
1555
|
-
findVideoClip as
|
|
1705
|
+
findVideoClip as findVideoClip3,
|
|
1556
1706
|
isVideoKeyframes,
|
|
1557
1707
|
openVideoClipEffectAuthoring
|
|
1558
1708
|
} from "@pixerate/editor/video-editor";
|
|
1559
|
-
import { Fragment as Fragment6, jsx as
|
|
1709
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1560
1710
|
var btn7 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1561
1711
|
var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => isVideoKeyframes(v)).map(([k]) => k));
|
|
1562
1712
|
function EffectControls({
|
|
@@ -1569,25 +1719,25 @@ function EffectControls({
|
|
|
1569
1719
|
onPreset
|
|
1570
1720
|
}) {
|
|
1571
1721
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1572
|
-
if (!provider) return /* @__PURE__ */
|
|
1722
|
+
if (!provider) return /* @__PURE__ */ jsxs10("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
1573
1723
|
'No effects provider: "',
|
|
1574
1724
|
name ?? effect,
|
|
1575
1725
|
'" is kept and shown as a placeholder.'
|
|
1576
1726
|
] });
|
|
1577
|
-
if (error) return /* @__PURE__ */
|
|
1578
|
-
if (!description) return /* @__PURE__ */
|
|
1579
|
-
return /* @__PURE__ */
|
|
1727
|
+
if (error) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-500", children: error });
|
|
1728
|
+
if (!description) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
1729
|
+
return /* @__PURE__ */ jsx11(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
1580
1730
|
}
|
|
1581
1731
|
function VideoEffectsPanel({ controller, className = "" }) {
|
|
1582
1732
|
const state = useVideoEditorState(controller);
|
|
1583
1733
|
const provider = state.effectsProvider;
|
|
1584
|
-
const [browse, setBrowse] =
|
|
1585
|
-
const [message, setMessage] =
|
|
1586
|
-
const [open, setOpen] =
|
|
1587
|
-
const [authoring, setAuthoring] =
|
|
1588
|
-
|
|
1734
|
+
const [browse, setBrowse] = useState9(null);
|
|
1735
|
+
const [message, setMessage] = useState9(null);
|
|
1736
|
+
const [open, setOpen] = useState9(null);
|
|
1737
|
+
const [authoring, setAuthoring] = useState9(null);
|
|
1738
|
+
useEffect7(() => () => authoring?.dispose(), [authoring]);
|
|
1589
1739
|
const selected = state.selection[0];
|
|
1590
|
-
const at = selected ?
|
|
1740
|
+
const at = selected ? findVideoClip3(state.project, selected) : null;
|
|
1591
1741
|
const clip = at?.clip ?? null;
|
|
1592
1742
|
const disabled = state.readOnly;
|
|
1593
1743
|
const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? null : x.error));
|
|
@@ -1596,18 +1746,18 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1596
1746
|
if (!track) return setMessage("Add a video track first.");
|
|
1597
1747
|
report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
|
|
1598
1748
|
};
|
|
1599
|
-
return /* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
/* @__PURE__ */
|
|
1602
|
-
/* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
|
|
1750
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1751
|
+
/* @__PURE__ */ jsx11("h3", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
1752
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
|
|
1603
1753
|
] }),
|
|
1604
|
-
!provider && /* @__PURE__ */
|
|
1605
|
-
browse === "generator" && /* @__PURE__ */
|
|
1606
|
-
!clip && /* @__PURE__ */
|
|
1607
|
-
clip && /* @__PURE__ */
|
|
1608
|
-
clip.type === "effect" && /* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
1610
|
-
/* @__PURE__ */
|
|
1754
|
+
!provider && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
|
|
1755
|
+
browse === "generator" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
|
|
1756
|
+
!clip && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
|
|
1757
|
+
clip && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
1758
|
+
clip.type === "effect" && /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
1759
|
+
/* @__PURE__ */ jsx11("div", { className: "font-medium", children: clip.name ?? clip.effect }),
|
|
1760
|
+
/* @__PURE__ */ jsx11(
|
|
1611
1761
|
EffectControls,
|
|
1612
1762
|
{
|
|
1613
1763
|
provider,
|
|
@@ -1620,13 +1770,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1620
1770
|
}
|
|
1621
1771
|
)
|
|
1622
1772
|
] }),
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
clip.transition?.type === "effect" ? /* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "transition", children: [
|
|
1774
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1775
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-medium", children: "Transition in" }),
|
|
1776
|
+
clip.transition?.type === "effect" ? /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
|
|
1627
1777
|
] }),
|
|
1628
|
-
browse === "transition" && /* @__PURE__ */
|
|
1629
|
-
clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */
|
|
1778
|
+
browse === "transition" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
|
|
1779
|
+
clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ jsx11(
|
|
1630
1780
|
EffectControls,
|
|
1631
1781
|
{
|
|
1632
1782
|
provider,
|
|
@@ -1639,19 +1789,19 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1639
1789
|
}
|
|
1640
1790
|
)
|
|
1641
1791
|
] }),
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
1792
|
+
/* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "stack", children: [
|
|
1793
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1794
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-medium", children: "On this clip" }),
|
|
1795
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
|
|
1646
1796
|
] }),
|
|
1647
|
-
browse === "clip" && /* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1651
|
-
/* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1797
|
+
browse === "clip" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
|
|
1798
|
+
/* @__PURE__ */ jsx11("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ jsxs10("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
|
|
1799
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1800
|
+
/* @__PURE__ */ jsx11("input", { type: "checkbox", checked: e.enabled !== false, disabled, "aria-label": `${e.name ?? e.effect} on`, onChange: (ev) => report(controller.updateClipEffect(clip.id, e.id, { enabled: ev.currentTarget.checked })) }),
|
|
1801
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.id, onClick: () => setOpen(open === e.id ? null : e.id), children: e.name ?? e.effect }),
|
|
1802
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
|
|
1803
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || i === all.length - 1, "aria-label": "Move down", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i + 1 })), children: "\u2193" }),
|
|
1804
|
+
/* @__PURE__ */ jsx11(
|
|
1655
1805
|
"button",
|
|
1656
1806
|
{
|
|
1657
1807
|
type: "button",
|
|
@@ -1667,12 +1817,12 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1667
1817
|
children: "\u270E"
|
|
1668
1818
|
}
|
|
1669
1819
|
),
|
|
1670
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
|
|
1671
1821
|
] }),
|
|
1672
|
-
open === e.id && /* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1822
|
+
open === e.id && /* @__PURE__ */ jsxs10("div", { className: "mt-1 space-y-2", children: [
|
|
1823
|
+
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
1824
|
+
/* @__PURE__ */ jsx11("span", { className: "w-14 text-[11px]", children: "Opacity" }),
|
|
1825
|
+
/* @__PURE__ */ jsx11(
|
|
1676
1826
|
"input",
|
|
1677
1827
|
{
|
|
1678
1828
|
type: "range",
|
|
@@ -1687,7 +1837,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1687
1837
|
}
|
|
1688
1838
|
)
|
|
1689
1839
|
] }),
|
|
1690
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ jsx11(
|
|
1691
1841
|
EffectControls,
|
|
1692
1842
|
{
|
|
1693
1843
|
provider,
|
|
@@ -1701,13 +1851,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1701
1851
|
)
|
|
1702
1852
|
] })
|
|
1703
1853
|
] }, e.id)) }),
|
|
1704
|
-
!clip.effects?.length && /* @__PURE__ */
|
|
1854
|
+
!clip.effects?.length && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
|
|
1705
1855
|
] })
|
|
1706
1856
|
] }),
|
|
1707
|
-
authoring && /* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
1710
|
-
/* @__PURE__ */
|
|
1857
|
+
authoring && /* @__PURE__ */ jsxs10("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
|
|
1858
|
+
/* @__PURE__ */ jsx11(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
|
|
1859
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
|
|
1860
|
+
/* @__PURE__ */ jsx11(
|
|
1711
1861
|
"button",
|
|
1712
1862
|
{
|
|
1713
1863
|
type: "button",
|
|
@@ -1721,47 +1871,48 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1721
1871
|
children: "Apply to clip"
|
|
1722
1872
|
}
|
|
1723
1873
|
),
|
|
1724
|
-
/* @__PURE__ */
|
|
1874
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: btn7, onClick: () => setAuthoring(null), children: "Close" })
|
|
1725
1875
|
] })
|
|
1726
1876
|
] }),
|
|
1727
|
-
message && /* @__PURE__ */
|
|
1877
|
+
message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
1728
1878
|
] });
|
|
1729
1879
|
}
|
|
1730
1880
|
|
|
1731
1881
|
// src/video-editor/VideoEditor.tsx
|
|
1732
|
-
import { jsx as
|
|
1882
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1733
1883
|
function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, transcriptMode = "panel", showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
|
|
1734
1884
|
const { controller, state } = useVideoEditor(given ?? options ?? {});
|
|
1735
1885
|
useEffects(controller, effects);
|
|
1736
1886
|
const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.type === "adjustment" || c.effects?.length || c.transition?.type === "effect")));
|
|
1737
|
-
|
|
1887
|
+
useEffect8(() => {
|
|
1738
1888
|
if (editable) return;
|
|
1739
1889
|
const was = controller.getState().readOnly;
|
|
1740
1890
|
controller.setReadOnly(true);
|
|
1741
1891
|
return () => controller.setReadOnly(was);
|
|
1742
1892
|
}, [controller, editable]);
|
|
1743
1893
|
const { issues } = state;
|
|
1744
|
-
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */
|
|
1745
|
-
return /* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
editable && /* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
showScopes && /* @__PURE__ */
|
|
1894
|
+
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ jsx12("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ jsx12("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", "data-issue": issue.code, children: issue.message }, i)) });
|
|
1895
|
+
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
|
|
1896
|
+
/* @__PURE__ */ jsxs11("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
|
|
1897
|
+
editable && /* @__PURE__ */ jsx12(MediaBin, { controller, className: "min-w-0" }),
|
|
1898
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
1899
|
+
/* @__PURE__ */ jsx12(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
|
|
1900
|
+
/* @__PURE__ */ jsx12(VideoTransport, { controller, editable }),
|
|
1901
|
+
showScopes && /* @__PURE__ */ jsx12(VideoScopes, { controller })
|
|
1752
1902
|
] }),
|
|
1753
|
-
editable && /* @__PURE__ */
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
effectsShown && /* @__PURE__ */
|
|
1903
|
+
editable && /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-col gap-3", children: [
|
|
1904
|
+
/* @__PURE__ */ jsx12(ClipInspector, { controller, className: "min-w-0" }),
|
|
1905
|
+
effectsShown && /* @__PURE__ */ jsx12(VideoEffectsPanel, { controller, className: "min-w-0" })
|
|
1756
1906
|
] })
|
|
1757
1907
|
] }),
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsx12(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
|
|
1909
|
+
/* @__PURE__ */ jsx12(EditPlanPreview, { controller, editable }),
|
|
1910
|
+
showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ jsx12(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ jsx12(TranscriptPanel, { controller, editable })),
|
|
1761
1911
|
issueList
|
|
1762
1912
|
] });
|
|
1763
1913
|
}
|
|
1764
1914
|
export {
|
|
1915
|
+
ClipCameraMoves,
|
|
1765
1916
|
ClipInspector,
|
|
1766
1917
|
EditPlanPreview,
|
|
1767
1918
|
MediaBin,
|