@pixerate/editor-react 0.104.0 → 0.106.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/chart/index.cjs +2 -0
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-ZHMATFBB.js → chunk-FUR7LCDM.js} +3 -0
- package/dist/index.cjs +2 -0
- package/dist/index.js +1 -1
- package/dist/video-editor/EditPlanPreview.d.cts +16 -0
- package/dist/video-editor/EditPlanPreview.d.ts +16 -0
- package/dist/video-editor/TranscriptEditor.d.cts +20 -0
- package/dist/video-editor/TranscriptEditor.d.ts +20 -0
- package/dist/video-editor/VideoEditor.d.cts +7 -1
- package/dist/video-editor/VideoEditor.d.ts +7 -1
- package/dist/video-editor/VideoTransport.d.cts +2 -1
- package/dist/video-editor/VideoTransport.d.ts +2 -1
- package/dist/video-editor/index.cjs +1053 -260
- package/dist/video-editor/index.d.cts +3 -0
- package/dist/video-editor/index.d.ts +3 -0
- package/dist/video-editor/index.js +437 -69
- package/dist/video-editor/useTranscriptVideo.d.cts +8 -0
- package/dist/video-editor/useTranscriptVideo.d.ts +8 -0
- package/dist/video-editor/useVideoEditor.d.cts +12 -1
- package/dist/video-editor/useVideoEditor.d.ts +12 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
EffectAuthoringEditor,
|
|
2
3
|
EffectParameters,
|
|
3
4
|
EffectsBrowser,
|
|
4
5
|
useEffectDescription,
|
|
@@ -19,6 +20,8 @@ import {
|
|
|
19
20
|
VideoEditorController,
|
|
20
21
|
createVideoEditorToolProvider,
|
|
21
22
|
createVideoEffectsToolProvider,
|
|
23
|
+
createVideoDialogueToolProvider,
|
|
24
|
+
createVideoMusicToolProvider,
|
|
22
25
|
createVideoEditorDocument
|
|
23
26
|
} from "@pixerate/editor/video-editor";
|
|
24
27
|
function useVideoEditorController(options = {}) {
|
|
@@ -73,6 +76,20 @@ function useVideoEffectsTools(registry, controller, options = {}) {
|
|
|
73
76
|
return registry.register(createVideoEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
|
|
74
77
|
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
75
78
|
}
|
|
79
|
+
function useVideoDialogueTools(registry, controller, options = {}) {
|
|
80
|
+
const { id, namespace, readOnly, playbackSurface } = options;
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!registry) return;
|
|
83
|
+
return registry.register(createVideoDialogueToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
|
|
84
|
+
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
85
|
+
}
|
|
86
|
+
function useVideoMusicTools(registry, controller, options = {}) {
|
|
87
|
+
const { id, namespace, readOnly, playbackSurface } = options;
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!registry) return;
|
|
90
|
+
return registry.register(createVideoMusicToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
|
|
91
|
+
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
92
|
+
}
|
|
76
93
|
|
|
77
94
|
// src/video-editor/VideoPreview.tsx
|
|
78
95
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
@@ -171,7 +188,7 @@ function VideoScopes({ controller, scopes = VIDEO_SCOPE_KINDS, width = 256, heig
|
|
|
171
188
|
}
|
|
172
189
|
|
|
173
190
|
// src/video-editor/VideoTransport.tsx
|
|
174
|
-
import { formatVideoTimecode, parseVideoPreviewScale, VIDEO_PREVIEW_SCALE_OPTIONS, videoProjectHasProxies } from "@pixerate/editor/video-editor";
|
|
191
|
+
import { formatVideoTimecode, parseVideoPreviewScale, VIDEO_PREVIEW_SCALE_OPTIONS, videoAddAdjustmentEdits, videoProjectHasProxies } from "@pixerate/editor/video-editor";
|
|
175
192
|
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
176
193
|
var btn = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
|
|
177
194
|
function VideoTransport({ controller, editable = true, className = "" }) {
|
|
@@ -215,6 +232,24 @@ function VideoTransport({ controller, editable = true, className = "" }) {
|
|
|
215
232
|
children: "Ripple delete"
|
|
216
233
|
}
|
|
217
234
|
),
|
|
235
|
+
/* @__PURE__ */ jsx3(
|
|
236
|
+
"button",
|
|
237
|
+
{
|
|
238
|
+
type: "button",
|
|
239
|
+
className: btn,
|
|
240
|
+
onClick: () => {
|
|
241
|
+
const r = controller.apply(videoAddAdjustmentEdits(project, time), "Add adjustment clip");
|
|
242
|
+
if (r.ok) {
|
|
243
|
+
const added = r.outcomes[r.outcomes.length - 1].clip;
|
|
244
|
+
if (added) controller.select([added]);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
disabled: !canEdit,
|
|
248
|
+
title: "Add an adjustment clip at the playhead over every track: its grade, effects and mask change the pictures underneath",
|
|
249
|
+
"data-add-adjustment": "",
|
|
250
|
+
children: "Adjustment"
|
|
251
|
+
}
|
|
252
|
+
),
|
|
218
253
|
/* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.undo(), disabled: !canEdit || !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
|
|
219
254
|
/* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.redo(), disabled: !canEdit || !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" })
|
|
220
255
|
] })
|
|
@@ -617,7 +652,14 @@ import {
|
|
|
617
652
|
videoSpeedRampEdit,
|
|
618
653
|
videoTransitionAudioCurve,
|
|
619
654
|
videoKeyframeToggleEdit,
|
|
620
|
-
videoKeyframeValueEdit
|
|
655
|
+
videoKeyframeValueEdit,
|
|
656
|
+
videoClipHeading,
|
|
657
|
+
videoMaskEdit,
|
|
658
|
+
videoSkinProtectionEdits,
|
|
659
|
+
VIDEO_ADJUSTMENT_SCOPES,
|
|
660
|
+
VIDEO_ADJUSTMENT_SCOPE_LABELS,
|
|
661
|
+
VIDEO_MASK_SHAPES,
|
|
662
|
+
VIDEO_MASK_SHAPE_LABELS
|
|
621
663
|
} from "@pixerate/editor/video-editor";
|
|
622
664
|
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
623
665
|
var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
@@ -697,6 +739,26 @@ function LutControls({ controller, clip, disabled }) {
|
|
|
697
739
|
}
|
|
698
740
|
}
|
|
699
741
|
) }),
|
|
742
|
+
lut && /* @__PURE__ */ jsx5(Row, { label: "Protect skin", name: "grade.lut.preserveSkinTones", children: /* @__PURE__ */ jsx5(
|
|
743
|
+
Commit,
|
|
744
|
+
{
|
|
745
|
+
type: "number",
|
|
746
|
+
min: 0,
|
|
747
|
+
max: 1,
|
|
748
|
+
step: 0.1,
|
|
749
|
+
value: String(lut.preserveSkinTones ?? 0),
|
|
750
|
+
"aria-label": "Protect skin tones",
|
|
751
|
+
title: "How much of the LUT to hold back on skin tones (0 to 1)",
|
|
752
|
+
disabled,
|
|
753
|
+
onCommit: (raw) => {
|
|
754
|
+
const n = Number(raw);
|
|
755
|
+
if (raw.trim() && Number.isFinite(n)) {
|
|
756
|
+
const r = controller.apply(videoSkinProtectionEdits(controller.getProject(), [clip.id], n), n > 0 ? "Protect skin tones" : "Stop protecting skin tones");
|
|
757
|
+
setMessage(r.ok ? null : r.error);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
) }),
|
|
700
762
|
message && /* @__PURE__ */ jsx5("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
|
|
701
763
|
] });
|
|
702
764
|
}
|
|
@@ -736,7 +798,7 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
736
798
|
const transition = clip.transition;
|
|
737
799
|
return /* @__PURE__ */ jsxs4("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
|
|
738
800
|
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
739
|
-
/* @__PURE__ */ jsx5("span", { className: "font-medium", children: clip
|
|
801
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium", children: videoClipHeading(clip) }),
|
|
740
802
|
/* @__PURE__ */ jsx5("code", { className: "text-muted-foreground", children: clip.id }),
|
|
741
803
|
at.track.locked && /* @__PURE__ */ jsx5("span", { className: "text-amber-500", children: "locked track" })
|
|
742
804
|
] }),
|
|
@@ -822,6 +884,87 @@ function ClipInspector({ controller, className = "" }) {
|
|
|
822
884
|
) }, c.key)),
|
|
823
885
|
/* @__PURE__ */ jsx5(LutControls, { controller, clip, disabled })
|
|
824
886
|
] }),
|
|
887
|
+
clip.type === "adjustment" && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
888
|
+
/* @__PURE__ */ jsx5(Row, { label: "Changes", name: "scope", children: /* @__PURE__ */ jsx5(
|
|
889
|
+
"select",
|
|
890
|
+
{
|
|
891
|
+
className: field,
|
|
892
|
+
value: clip.scope ?? "underneath",
|
|
893
|
+
disabled,
|
|
894
|
+
"aria-label": "Adjustment scope",
|
|
895
|
+
onChange: (e) => {
|
|
896
|
+
const scope = e.target.value;
|
|
897
|
+
const target = project.tracks.find((t) => t.kind === "video" && t.id !== at.track.id)?.id;
|
|
898
|
+
if (scope === "track") controller.apply({ op: "update_clip", clip: clip.id, set: { scope, targetTrack: clip.targetTrack ?? target ?? at.track.id } }, "Change adjustment scope");
|
|
899
|
+
else controller.apply({ op: "update_clip", clip: clip.id, ...scope === "underneath" ? { remove: ["scope", "targetTrack"] } : { set: { scope }, remove: ["targetTrack"] } }, "Change adjustment scope");
|
|
900
|
+
},
|
|
901
|
+
children: VIDEO_ADJUSTMENT_SCOPES.map((s) => /* @__PURE__ */ jsx5("option", { value: s, children: VIDEO_ADJUSTMENT_SCOPE_LABELS[s] }, s))
|
|
902
|
+
}
|
|
903
|
+
) }),
|
|
904
|
+
clip.scope === "track" && /* @__PURE__ */ jsx5(Row, { label: "Track", name: "targetTrack", children: /* @__PURE__ */ jsx5("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__ */ jsx5("option", { value: t.id, children: t.name ?? t.id }, t.id)) }) })
|
|
905
|
+
] }),
|
|
906
|
+
at.track.kind === "video" && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
907
|
+
/* @__PURE__ */ jsx5(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ jsxs4(
|
|
908
|
+
"select",
|
|
909
|
+
{
|
|
910
|
+
className: field,
|
|
911
|
+
value: clip.mask?.shape ?? "",
|
|
912
|
+
disabled,
|
|
913
|
+
"aria-label": "Mask shape",
|
|
914
|
+
onChange: (e) => {
|
|
915
|
+
const shape = e.target.value;
|
|
916
|
+
const points = [
|
|
917
|
+
{ x: 0.5, y: 0.2 },
|
|
918
|
+
{ x: 0.8, y: 0.8 },
|
|
919
|
+
{ x: 0.2, y: 0.8 }
|
|
920
|
+
];
|
|
921
|
+
const { points: _p, cornerRadius: _c, ...rest } = clip.mask ?? { shape: "ellipse" };
|
|
922
|
+
controller.apply(videoMaskEdit(clip.id, shape ? { ...rest, shape, ...shape === "polygon" ? { points } : {} } : null), shape ? "Mask clip" : "Remove mask");
|
|
923
|
+
},
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsx5("option", { value: "", children: "None" }),
|
|
926
|
+
VIDEO_MASK_SHAPES.map((s) => /* @__PURE__ */ jsx5("option", { value: s, children: VIDEO_MASK_SHAPE_LABELS[s] }, s))
|
|
927
|
+
]
|
|
928
|
+
}
|
|
929
|
+
) }),
|
|
930
|
+
clip.mask && [
|
|
931
|
+
["width", "Mask width", 0.05],
|
|
932
|
+
["height", "Mask height", 0.05],
|
|
933
|
+
["feather", "Feather (px)", 5],
|
|
934
|
+
["rotation", "Mask angle", 5]
|
|
935
|
+
].map(([key, label, step]) => /* @__PURE__ */ jsx5(Row, { label, name: `mask.${key}`, children: /* @__PURE__ */ jsx5(
|
|
936
|
+
Commit,
|
|
937
|
+
{
|
|
938
|
+
type: "number",
|
|
939
|
+
step,
|
|
940
|
+
min: key === "rotation" ? void 0 : 0,
|
|
941
|
+
value: clip.mask[key] === void 0 ? "" : String(clip.mask[key]),
|
|
942
|
+
placeholder: key === "feather" || key === "rotation" ? "0" : "0.5",
|
|
943
|
+
"aria-label": label,
|
|
944
|
+
disabled,
|
|
945
|
+
onCommit: (raw) => {
|
|
946
|
+
const n = Number(raw);
|
|
947
|
+
if (raw.trim() && !Number.isFinite(n)) return;
|
|
948
|
+
const { [key]: _old, ...rest } = clip.mask;
|
|
949
|
+
controller.apply(videoMaskEdit(clip.id, raw.trim() ? { ...rest, [key]: n } : rest), "Change mask");
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
) }, key)),
|
|
953
|
+
clip.mask && /* @__PURE__ */ jsx5(Row, { label: "Invert mask", name: "mask.inverted", children: /* @__PURE__ */ jsx5(
|
|
954
|
+
"input",
|
|
955
|
+
{
|
|
956
|
+
type: "checkbox",
|
|
957
|
+
className: "justify-self-start",
|
|
958
|
+
checked: !!clip.mask.inverted,
|
|
959
|
+
disabled,
|
|
960
|
+
"aria-label": "Invert mask",
|
|
961
|
+
onChange: (e) => {
|
|
962
|
+
const { inverted: _i, ...rest } = clip.mask;
|
|
963
|
+
controller.apply(videoMaskEdit(clip.id, e.target.checked ? { ...rest, inverted: true } : rest), "Invert mask");
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
) })
|
|
967
|
+
] }),
|
|
825
968
|
at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ jsx5(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ jsxs4(
|
|
826
969
|
"select",
|
|
827
970
|
{
|
|
@@ -1224,17 +1367,197 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
|
|
|
1224
1367
|
] });
|
|
1225
1368
|
}
|
|
1226
1369
|
|
|
1370
|
+
// src/video-editor/TranscriptEditor.tsx
|
|
1371
|
+
import React7, { useState as useState6 } from "react";
|
|
1372
|
+
|
|
1373
|
+
// src/video-editor/useTranscriptVideo.ts
|
|
1374
|
+
import { useEffect as useEffect5, useRef as useRef5, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
1375
|
+
import { TranscriptVideoController } from "@pixerate/editor/video-editor";
|
|
1376
|
+
function useTranscriptVideoController(controller, options = {}) {
|
|
1377
|
+
const ref = useRef5(null);
|
|
1378
|
+
const key = `${options.track ?? ""}|${options.planFirst ? 1 : 0}`;
|
|
1379
|
+
if (!ref.current || ref.current.editor !== controller || ref.current.key !== key) {
|
|
1380
|
+
ref.current?.transcript.destroy();
|
|
1381
|
+
ref.current = { key, editor: controller, transcript: new TranscriptVideoController(controller, options) };
|
|
1382
|
+
}
|
|
1383
|
+
const transcript = ref.current.transcript;
|
|
1384
|
+
useEffect5(() => () => transcript.destroy(), [transcript]);
|
|
1385
|
+
return transcript;
|
|
1386
|
+
}
|
|
1387
|
+
function useTranscriptVideoState(transcript) {
|
|
1388
|
+
return useSyncExternalStore3(transcript.subscribe, transcript.getState, transcript.getState);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// src/video-editor/TranscriptEditor.tsx
|
|
1392
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1393
|
+
var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1394
|
+
var CHIP = {
|
|
1395
|
+
filler: "bg-amber-400/30 text-amber-700 dark:text-amber-300",
|
|
1396
|
+
pause: "bg-sky-400/25 text-sky-700 dark:text-sky-300",
|
|
1397
|
+
repetition: "bg-violet-400/25 text-violet-700 dark:text-violet-300"
|
|
1398
|
+
};
|
|
1399
|
+
var KIND_LABEL = { filler: "filler", pause: "pause", repetition: "repeat" };
|
|
1400
|
+
function TranscriptEditor({ controller, track, planFirst = false, editable = true, className = "" }) {
|
|
1401
|
+
const transcript = useTranscriptVideoController(controller, { track, planFirst });
|
|
1402
|
+
const state = useTranscriptVideoState(transcript);
|
|
1403
|
+
const [anchor, setAnchor] = useState6(null);
|
|
1404
|
+
const canEdit = editable && state.editable;
|
|
1405
|
+
const { words, current, selection, disfluencies, flags } = state;
|
|
1406
|
+
if (!words.length)
|
|
1407
|
+
return /* @__PURE__ */ jsx8("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." });
|
|
1408
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
|
|
1409
|
+
/* @__PURE__ */ jsx8(
|
|
1410
|
+
"div",
|
|
1411
|
+
{
|
|
1412
|
+
className: "max-h-56 overflow-y-auto leading-6",
|
|
1413
|
+
role: "listbox",
|
|
1414
|
+
"aria-label": "Transcript",
|
|
1415
|
+
"aria-multiselectable": "true",
|
|
1416
|
+
tabIndex: 0,
|
|
1417
|
+
onKeyDown: (e) => {
|
|
1418
|
+
if (canEdit && selection && (e.key === "Delete" || e.key === "Backspace")) {
|
|
1419
|
+
e.preventDefault();
|
|
1420
|
+
transcript.deleteSelection();
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
children: words.map((w, i) => {
|
|
1424
|
+
const selected = !!selection && i >= selection[0] && i <= selection[1];
|
|
1425
|
+
const kinds = flags[i];
|
|
1426
|
+
return /* @__PURE__ */ jsxs7(React7.Fragment, { children: [
|
|
1427
|
+
/* @__PURE__ */ jsx8(
|
|
1428
|
+
"span",
|
|
1429
|
+
{
|
|
1430
|
+
role: "option",
|
|
1431
|
+
"aria-selected": selected,
|
|
1432
|
+
tabIndex: -1,
|
|
1433
|
+
className: `cursor-pointer rounded px-0.5 ${selected ? "bg-rose-500/30" : i === current ? "bg-amber-400/50" : kinds?.length ? CHIP[kinds[0]] : "hover:bg-muted"}`,
|
|
1434
|
+
"data-word": i,
|
|
1435
|
+
"data-current": i === current ? "" : void 0,
|
|
1436
|
+
"data-selected": selected ? "" : void 0,
|
|
1437
|
+
"data-disfluency": kinds?.join(" ") || void 0,
|
|
1438
|
+
title: kinds?.length ? kinds.map((k) => KIND_LABEL[k]).join(", ") : void 0,
|
|
1439
|
+
onClick: (e) => {
|
|
1440
|
+
if (e.shiftKey && anchor !== null) transcript.select(anchor, i);
|
|
1441
|
+
else {
|
|
1442
|
+
setAnchor(i);
|
|
1443
|
+
transcript.select(i);
|
|
1444
|
+
transcript.seekToWord(i);
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
children: w.word
|
|
1448
|
+
}
|
|
1449
|
+
),
|
|
1450
|
+
kinds?.includes("pause") ? /* @__PURE__ */ jsx8("span", { className: "mx-0.5 text-sky-500", "aria-hidden": "true", children: "\u23F8" }) : " "
|
|
1451
|
+
] }, `${w.clip}:${w.index}`);
|
|
1452
|
+
})
|
|
1453
|
+
}
|
|
1454
|
+
),
|
|
1455
|
+
canEdit && /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1456
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: btn5, disabled: !selection, onClick: () => transcript.deleteSelection(), "data-delete-words": "", children: planFirst ? "Propose deleting words" : "Delete words" }),
|
|
1457
|
+
/* @__PURE__ */ jsxs7("button", { type: "button", className: btn5, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
|
|
1458
|
+
"Plan cleanup (",
|
|
1459
|
+
disfluencies.length,
|
|
1460
|
+
")"
|
|
1461
|
+
] })
|
|
1462
|
+
] }),
|
|
1463
|
+
disfluencies.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ jsxs7("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
|
|
1464
|
+
/* @__PURE__ */ jsxs7("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
|
|
1465
|
+
KIND_LABEL[d.kind],
|
|
1466
|
+
": ",
|
|
1467
|
+
d.kind === "pause" ? `${((d.to - d.from) / 1e3).toFixed(1)} s` : d.text
|
|
1468
|
+
] }),
|
|
1469
|
+
canEdit && /* @__PURE__ */ jsx8("button", { type: "button", "aria-label": `Cut ${KIND_LABEL[d.kind]} ${d.text}`, onClick: () => transcript.removeDisfluency(i), "data-cut-disfluency": i, children: "\u2715" })
|
|
1470
|
+
] }, `${d.kind}:${d.from}`)) }),
|
|
1471
|
+
state.error && /* @__PURE__ */ jsx8("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: state.error })
|
|
1472
|
+
] });
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
// src/video-editor/EditPlanPreview.tsx
|
|
1476
|
+
import { useState as useState7 } from "react";
|
|
1477
|
+
import { describeVideoEditPlan, formatVideoSeconds as formatVideoSeconds4 } from "@pixerate/editor/video-editor";
|
|
1478
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1479
|
+
var btn6 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
|
|
1480
|
+
function EditPlanPreview({ controller, editable = true, className = "" }) {
|
|
1481
|
+
const state = useVideoEditorState(controller);
|
|
1482
|
+
const [message, setMessage] = useState7(null);
|
|
1483
|
+
if (!state.plans.length) return null;
|
|
1484
|
+
const total = Math.max(1, state.duration);
|
|
1485
|
+
return /* @__PURE__ */ jsxs8("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
|
+
state.plans.map((plan) => {
|
|
1487
|
+
const s = plan.summary;
|
|
1488
|
+
const stale = controller.isPlanStale(plan.id);
|
|
1489
|
+
return /* @__PURE__ */ jsxs8("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
|
|
1490
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
1491
|
+
/* @__PURE__ */ jsx9("h3", { className: "flex-1 font-semibold", children: plan.title }),
|
|
1492
|
+
/* @__PURE__ */ jsxs8("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
|
|
1493
|
+
s.durationDelta < 0 ? "\u2212" : s.durationDelta > 0 ? "+" : "\xB1",
|
|
1494
|
+
formatVideoSeconds4(Math.abs(s.durationDelta))
|
|
1495
|
+
] })
|
|
1496
|
+
] }),
|
|
1497
|
+
plan.description && /* @__PURE__ */ jsx9("p", { className: "text-muted-foreground", children: plan.description }),
|
|
1498
|
+
/* @__PURE__ */ jsxs8("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
|
|
1499
|
+
describeVideoEditPlan(plan),
|
|
1500
|
+
" \xB7 ",
|
|
1501
|
+
formatVideoSeconds4(s.durationBefore),
|
|
1502
|
+
" \u2192 ",
|
|
1503
|
+
formatVideoSeconds4(s.durationAfter)
|
|
1504
|
+
] }),
|
|
1505
|
+
plan.ranges && plan.ranges.length > 0 && /* @__PURE__ */ jsx9("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__ */ jsx9(
|
|
1506
|
+
"button",
|
|
1507
|
+
{
|
|
1508
|
+
type: "button",
|
|
1509
|
+
className: "absolute top-0 h-full bg-rose-500/70 hover:bg-rose-600",
|
|
1510
|
+
style: { left: `${r.from / total * 100}%`, width: `${Math.max(0.4, (r.to - r.from) / total * 100)}%` },
|
|
1511
|
+
title: `${r.reason ? `${r.reason}: ` : ""}${r.text ?? ""} (${formatVideoSeconds4(r.from)})`,
|
|
1512
|
+
"aria-label": `Go to ${r.reason ?? "cut"} at ${formatVideoSeconds4(r.from)}`,
|
|
1513
|
+
onClick: () => controller.seek(r.from)
|
|
1514
|
+
},
|
|
1515
|
+
i
|
|
1516
|
+
)) }),
|
|
1517
|
+
s.newIssues.length > 0 && /* @__PURE__ */ jsxs8("p", { className: "text-amber-600", children: [
|
|
1518
|
+
"It would add ",
|
|
1519
|
+
s.newIssues.length,
|
|
1520
|
+
" problem",
|
|
1521
|
+
s.newIssues.length > 1 ? "s" : "",
|
|
1522
|
+
": ",
|
|
1523
|
+
s.newIssues[0].message
|
|
1524
|
+
] }),
|
|
1525
|
+
stale && /* @__PURE__ */ jsx9("p", { className: "text-amber-600", "data-plan-stale": "", children: "The project changed since this plan was made; it is checked again when accepted." }),
|
|
1526
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
|
|
1527
|
+
/* @__PURE__ */ jsx9(
|
|
1528
|
+
"button",
|
|
1529
|
+
{
|
|
1530
|
+
type: "button",
|
|
1531
|
+
className: btn6,
|
|
1532
|
+
disabled: !editable || state.readOnly,
|
|
1533
|
+
"data-accept-plan": "",
|
|
1534
|
+
onClick: () => {
|
|
1535
|
+
const r = controller.applyPlan(plan.id);
|
|
1536
|
+
setMessage(r.ok ? null : r.error);
|
|
1537
|
+
},
|
|
1538
|
+
children: "Accept plan"
|
|
1539
|
+
}
|
|
1540
|
+
),
|
|
1541
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: btn6, "data-discard-plan": "", onClick: () => (controller.discardPlan(plan.id), setMessage(null)), children: "Discard" })
|
|
1542
|
+
] })
|
|
1543
|
+
] }, plan.id);
|
|
1544
|
+
}),
|
|
1545
|
+
message && /* @__PURE__ */ jsx9("p", { className: "text-red-500", role: "alert", "data-plan-error": "", children: message })
|
|
1546
|
+
] });
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1227
1549
|
// src/video-editor/VideoEditor.tsx
|
|
1228
|
-
import { useEffect as
|
|
1550
|
+
import { useEffect as useEffect7 } from "react";
|
|
1229
1551
|
|
|
1230
1552
|
// src/video-editor/VideoEffectsPanel.tsx
|
|
1231
|
-
import { useState as
|
|
1553
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1232
1554
|
import {
|
|
1233
1555
|
findVideoClip as findVideoClip2,
|
|
1234
|
-
isVideoKeyframes
|
|
1556
|
+
isVideoKeyframes,
|
|
1557
|
+
openVideoClipEffectAuthoring
|
|
1235
1558
|
} from "@pixerate/editor/video-editor";
|
|
1236
|
-
import { Fragment as Fragment6, jsx as
|
|
1237
|
-
var
|
|
1559
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1560
|
+
var btn7 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
1238
1561
|
var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => isVideoKeyframes(v)).map(([k]) => k));
|
|
1239
1562
|
function EffectControls({
|
|
1240
1563
|
provider,
|
|
@@ -1246,21 +1569,23 @@ function EffectControls({
|
|
|
1246
1569
|
onPreset
|
|
1247
1570
|
}) {
|
|
1248
1571
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1249
|
-
if (!provider) return /* @__PURE__ */
|
|
1572
|
+
if (!provider) return /* @__PURE__ */ jsxs9("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
1250
1573
|
'No effects provider: "',
|
|
1251
1574
|
name ?? effect,
|
|
1252
1575
|
'" is kept and shown as a placeholder.'
|
|
1253
1576
|
] });
|
|
1254
|
-
if (error) return /* @__PURE__ */
|
|
1255
|
-
if (!description) return /* @__PURE__ */
|
|
1256
|
-
return /* @__PURE__ */
|
|
1577
|
+
if (error) return /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-amber-500", children: error });
|
|
1578
|
+
if (!description) return /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
1579
|
+
return /* @__PURE__ */ jsx10(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
1257
1580
|
}
|
|
1258
1581
|
function VideoEffectsPanel({ controller, className = "" }) {
|
|
1259
1582
|
const state = useVideoEditorState(controller);
|
|
1260
1583
|
const provider = state.effectsProvider;
|
|
1261
|
-
const [browse, setBrowse] =
|
|
1262
|
-
const [message, setMessage] =
|
|
1263
|
-
const [open, setOpen] =
|
|
1584
|
+
const [browse, setBrowse] = useState8(null);
|
|
1585
|
+
const [message, setMessage] = useState8(null);
|
|
1586
|
+
const [open, setOpen] = useState8(null);
|
|
1587
|
+
const [authoring, setAuthoring] = useState8(null);
|
|
1588
|
+
useEffect6(() => () => authoring?.dispose(), [authoring]);
|
|
1264
1589
|
const selected = state.selection[0];
|
|
1265
1590
|
const at = selected ? findVideoClip2(state.project, selected) : null;
|
|
1266
1591
|
const clip = at?.clip ?? null;
|
|
@@ -1271,18 +1596,18 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1271
1596
|
if (!track) return setMessage("Add a video track first.");
|
|
1272
1597
|
report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
|
|
1273
1598
|
};
|
|
1274
|
-
return /* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1276
|
-
/* @__PURE__ */
|
|
1277
|
-
/* @__PURE__ */
|
|
1599
|
+
return /* @__PURE__ */ jsxs9("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
|
|
1600
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1601
|
+
/* @__PURE__ */ jsx10("h3", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
1602
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
|
|
1278
1603
|
] }),
|
|
1279
|
-
!provider && /* @__PURE__ */
|
|
1280
|
-
browse === "generator" && /* @__PURE__ */
|
|
1281
|
-
!clip && /* @__PURE__ */
|
|
1282
|
-
clip && /* @__PURE__ */
|
|
1283
|
-
clip.type === "effect" && /* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1604
|
+
!provider && /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
|
|
1605
|
+
browse === "generator" && /* @__PURE__ */ jsx10(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
|
|
1606
|
+
!clip && /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
|
|
1607
|
+
clip && /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
1608
|
+
clip.type === "effect" && /* @__PURE__ */ jsxs9("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
1609
|
+
/* @__PURE__ */ jsx10("div", { className: "font-medium", children: clip.name ?? clip.effect }),
|
|
1610
|
+
/* @__PURE__ */ jsx10(
|
|
1286
1611
|
EffectControls,
|
|
1287
1612
|
{
|
|
1288
1613
|
provider,
|
|
@@ -1295,13 +1620,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1295
1620
|
}
|
|
1296
1621
|
)
|
|
1297
1622
|
] }),
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1301
|
-
clip.transition?.type === "effect" ? /* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-1", "data-effect-part": "transition", children: [
|
|
1624
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1625
|
+
/* @__PURE__ */ jsx10("span", { className: "flex-1 font-medium", children: "Transition in" }),
|
|
1626
|
+
clip.transition?.type === "effect" ? /* @__PURE__ */ jsx10("button", { type: "button", className: btn7, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ jsx10("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
|
|
1302
1627
|
] }),
|
|
1303
|
-
browse === "transition" && /* @__PURE__ */
|
|
1304
|
-
clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */
|
|
1628
|
+
browse === "transition" && /* @__PURE__ */ jsx10(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
|
|
1629
|
+
clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ jsx10(
|
|
1305
1630
|
EffectControls,
|
|
1306
1631
|
{
|
|
1307
1632
|
provider,
|
|
@@ -1314,24 +1639,40 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1314
1639
|
}
|
|
1315
1640
|
)
|
|
1316
1641
|
] }),
|
|
1317
|
-
/* @__PURE__ */
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1642
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-1", "data-effect-part": "stack", children: [
|
|
1643
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1644
|
+
/* @__PURE__ */ jsx10("span", { className: "flex-1 font-medium", children: "On this clip" }),
|
|
1645
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
|
|
1321
1646
|
] }),
|
|
1322
|
-
browse === "clip" && /* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1647
|
+
browse === "clip" && /* @__PURE__ */ jsx10(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
|
|
1648
|
+
/* @__PURE__ */ jsx10("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ jsxs9("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
|
|
1649
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1650
|
+
/* @__PURE__ */ jsx10("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 })) }),
|
|
1651
|
+
/* @__PURE__ */ jsx10("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 }),
|
|
1652
|
+
/* @__PURE__ */ jsx10("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" }),
|
|
1653
|
+
/* @__PURE__ */ jsx10("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" }),
|
|
1654
|
+
/* @__PURE__ */ jsx10(
|
|
1655
|
+
"button",
|
|
1656
|
+
{
|
|
1657
|
+
type: "button",
|
|
1658
|
+
className: btn7,
|
|
1659
|
+
disabled: disabled || !provider,
|
|
1660
|
+
"aria-label": `Author ${e.name ?? e.effect}`,
|
|
1661
|
+
title: "Tune and keyframe it in the effect authoring editor",
|
|
1662
|
+
"data-author-effect": e.id,
|
|
1663
|
+
onClick: () => void openVideoClipEffectAuthoring(controller, clip.id, e.id).then(
|
|
1664
|
+
(a) => setAuthoring(a),
|
|
1665
|
+
(err) => setMessage(err instanceof Error ? err.message : String(err))
|
|
1666
|
+
),
|
|
1667
|
+
children: "\u270E"
|
|
1668
|
+
}
|
|
1669
|
+
),
|
|
1670
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
|
|
1330
1671
|
] }),
|
|
1331
|
-
open === e.id && /* @__PURE__ */
|
|
1332
|
-
/* @__PURE__ */
|
|
1333
|
-
/* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */
|
|
1672
|
+
open === e.id && /* @__PURE__ */ jsxs9("div", { className: "mt-1 space-y-2", children: [
|
|
1673
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
|
|
1674
|
+
/* @__PURE__ */ jsx10("span", { className: "w-14 text-[11px]", children: "Opacity" }),
|
|
1675
|
+
/* @__PURE__ */ jsx10(
|
|
1335
1676
|
"input",
|
|
1336
1677
|
{
|
|
1337
1678
|
type: "range",
|
|
@@ -1346,7 +1687,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1346
1687
|
}
|
|
1347
1688
|
)
|
|
1348
1689
|
] }),
|
|
1349
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ jsx10(
|
|
1350
1691
|
EffectControls,
|
|
1351
1692
|
{
|
|
1352
1693
|
provider,
|
|
@@ -1360,48 +1701,71 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1360
1701
|
)
|
|
1361
1702
|
] })
|
|
1362
1703
|
] }, e.id)) }),
|
|
1363
|
-
!clip.effects?.length && /* @__PURE__ */
|
|
1704
|
+
!clip.effects?.length && /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
|
|
1364
1705
|
] })
|
|
1365
1706
|
] }),
|
|
1366
|
-
|
|
1707
|
+
authoring && /* @__PURE__ */ jsxs9("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
|
|
1708
|
+
/* @__PURE__ */ jsx10(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
|
|
1709
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
|
|
1710
|
+
/* @__PURE__ */ jsx10(
|
|
1711
|
+
"button",
|
|
1712
|
+
{
|
|
1713
|
+
type: "button",
|
|
1714
|
+
className: btn7,
|
|
1715
|
+
disabled,
|
|
1716
|
+
"data-apply-authoring": "",
|
|
1717
|
+
onClick: () => void authoring.commit().then((r) => {
|
|
1718
|
+
setMessage(r.ok ? r.notes?.join(" ") ?? null : r.error);
|
|
1719
|
+
if (r.ok) setAuthoring(null);
|
|
1720
|
+
}),
|
|
1721
|
+
children: "Apply to clip"
|
|
1722
|
+
}
|
|
1723
|
+
),
|
|
1724
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: btn7, onClick: () => setAuthoring(null), children: "Close" })
|
|
1725
|
+
] })
|
|
1726
|
+
] }),
|
|
1727
|
+
message && /* @__PURE__ */ jsx10("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
1367
1728
|
] });
|
|
1368
1729
|
}
|
|
1369
1730
|
|
|
1370
1731
|
// src/video-editor/VideoEditor.tsx
|
|
1371
|
-
import { jsx as
|
|
1372
|
-
function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
|
|
1732
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1733
|
+
function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, transcriptMode = "panel", showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
|
|
1373
1734
|
const { controller, state } = useVideoEditor(given ?? options ?? {});
|
|
1374
1735
|
useEffects(controller, effects);
|
|
1375
|
-
const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.effects?.length || c.transition?.type === "effect")));
|
|
1376
|
-
|
|
1736
|
+
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
|
+
useEffect7(() => {
|
|
1377
1738
|
if (editable) return;
|
|
1378
1739
|
const was = controller.getState().readOnly;
|
|
1379
1740
|
controller.setReadOnly(true);
|
|
1380
1741
|
return () => controller.setReadOnly(was);
|
|
1381
1742
|
}, [controller, editable]);
|
|
1382
1743
|
const { issues } = state;
|
|
1383
|
-
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */
|
|
1384
|
-
return /* @__PURE__ */
|
|
1385
|
-
/* @__PURE__ */
|
|
1386
|
-
editable && /* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
/* @__PURE__ */
|
|
1390
|
-
showScopes && /* @__PURE__ */
|
|
1744
|
+
const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ jsx11("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)) });
|
|
1745
|
+
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
|
|
1746
|
+
/* @__PURE__ */ jsxs10("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
|
|
1747
|
+
editable && /* @__PURE__ */ jsx11(MediaBin, { controller, className: "min-w-0" }),
|
|
1748
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
1749
|
+
/* @__PURE__ */ jsx11(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
|
|
1750
|
+
/* @__PURE__ */ jsx11(VideoTransport, { controller, editable }),
|
|
1751
|
+
showScopes && /* @__PURE__ */ jsx11(VideoScopes, { controller })
|
|
1391
1752
|
] }),
|
|
1392
|
-
editable && /* @__PURE__ */
|
|
1393
|
-
/* @__PURE__ */
|
|
1394
|
-
effectsShown && /* @__PURE__ */
|
|
1753
|
+
editable && /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-3", children: [
|
|
1754
|
+
/* @__PURE__ */ jsx11(ClipInspector, { controller, className: "min-w-0" }),
|
|
1755
|
+
effectsShown && /* @__PURE__ */ jsx11(VideoEffectsPanel, { controller, className: "min-w-0" })
|
|
1395
1756
|
] })
|
|
1396
1757
|
] }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
|
|
1758
|
+
/* @__PURE__ */ jsx11(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
|
|
1759
|
+
/* @__PURE__ */ jsx11(EditPlanPreview, { controller, editable }),
|
|
1760
|
+
showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ jsx11(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ jsx11(TranscriptPanel, { controller, editable })),
|
|
1399
1761
|
issueList
|
|
1400
1762
|
] });
|
|
1401
1763
|
}
|
|
1402
1764
|
export {
|
|
1403
1765
|
ClipInspector,
|
|
1766
|
+
EditPlanPreview,
|
|
1404
1767
|
MediaBin,
|
|
1768
|
+
TranscriptEditor,
|
|
1405
1769
|
TranscriptPanel,
|
|
1406
1770
|
VideoEditor,
|
|
1407
1771
|
VideoEffectsPanel,
|
|
@@ -1409,9 +1773,13 @@ export {
|
|
|
1409
1773
|
VideoScopes,
|
|
1410
1774
|
VideoTimeline,
|
|
1411
1775
|
VideoTransport,
|
|
1776
|
+
useTranscriptVideoController,
|
|
1777
|
+
useTranscriptVideoState,
|
|
1778
|
+
useVideoDialogueTools,
|
|
1412
1779
|
useVideoEditor,
|
|
1413
1780
|
useVideoEditorController,
|
|
1414
1781
|
useVideoEditorState,
|
|
1415
1782
|
useVideoEditorTools,
|
|
1416
|
-
useVideoEffectsTools
|
|
1783
|
+
useVideoEffectsTools,
|
|
1784
|
+
useVideoMusicTools
|
|
1417
1785
|
};
|