@tangle-network/agent-app 0.61.4 → 0.62.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/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
- package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
- package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
- package/dist/VaultPane-AYW7CO33.js +8 -0
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +0 -82
- package/dist/agent-profiles/index.js +1 -21
- package/dist/agent-profiles/self-management.d.ts +0 -55
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/index.js +1 -3
- package/dist/alerting/slack.d.ts +6 -79
- package/dist/app-auth/drizzle.d.ts +17 -271
- package/dist/app-auth/drizzle.js +6 -2
- package/dist/app-auth/drizzle.js.map +1 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/assets/types.d.ts +2 -1
- package/dist/assistant/AssistantPanel.d.ts +1 -1
- package/dist/assistant/index.js +635 -392
- package/dist/assistant/index.js.map +1 -1
- package/dist/billing/identity-locks.d.ts +5 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/brand-extraction/types.d.ts +2 -1
- package/dist/chat-react/index.js +6 -5
- package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
- package/dist/chat-routes/draft-persistence.d.ts +2 -14
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +853 -773
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
- package/dist/chat-routes/stored-attachments.d.ts +18 -0
- package/dist/chat-routes/turn-admission.d.ts +1 -1
- package/dist/chat-routes/turn-execution.d.ts +2 -2
- package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
- package/dist/chat-store/core.d.ts +19 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/store.d.ts +3 -29
- package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
- package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
- package/dist/chunk-52SDU43B.js.map +1 -0
- package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
- package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
- package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
- package/dist/chunk-6JEDSKFH.js.map +1 -0
- package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
- package/dist/chunk-6OG4244Y.js.map +1 -0
- package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
- package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
- package/dist/chunk-76MPX7JQ.js.map +1 -0
- package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
- package/dist/chunk-7ISHKBAD.js.map +1 -0
- package/dist/chunk-7PULOECS.js +22 -0
- package/dist/chunk-7PULOECS.js.map +1 -0
- package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
- package/dist/chunk-CPVGRQ43.js.map +1 -0
- package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
- package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
- package/dist/chunk-EFQUAWWF.js.map +1 -0
- package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
- package/dist/chunk-ELX5YITO.js.map +1 -0
- package/dist/chunk-FGAROAUF.js +19 -0
- package/dist/chunk-FGAROAUF.js.map +1 -0
- package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
- package/dist/chunk-FTNGGR37.js.map +1 -0
- package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
- package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
- package/dist/chunk-GIEUZBQQ.js.map +1 -0
- package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
- package/dist/chunk-IVBREL7A.js.map +1 -0
- package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
- package/dist/chunk-JBXNU5WD.js.map +1 -0
- package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
- package/dist/chunk-JRCZHDRG.js.map +1 -0
- package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
- package/dist/chunk-JRW6LCIA.js.map +1 -0
- package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
- package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
- package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
- package/dist/chunk-MRZP65DZ.js.map +1 -0
- package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
- package/dist/chunk-OODZCBSM.js.map +1 -0
- package/dist/chunk-P4RRC4AO.js +47 -0
- package/dist/chunk-P4RRC4AO.js.map +1 -0
- package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
- package/dist/chunk-PCAY23GS.js.map +1 -0
- package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
- package/dist/chunk-PEJ5OP5B.js.map +1 -0
- package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
- package/dist/chunk-PIPNDZ6H.js.map +1 -0
- package/dist/{chunk-L7LQRJGD.js → chunk-TCJ4TMOW.js} +37 -33
- package/dist/{chunk-L7LQRJGD.js.map → chunk-TCJ4TMOW.js.map} +1 -1
- package/dist/chunk-UHSUY6H6.js +79 -0
- package/dist/chunk-UHSUY6H6.js.map +1 -0
- package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
- package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
- package/dist/chunk-UW2DKTEM.js.map +1 -0
- package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
- package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
- package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
- package/dist/chunk-VYBTQK25.js.map +1 -0
- package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
- package/dist/chunk-W2BV2XOC.js.map +1 -0
- package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
- package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
- package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
- package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
- package/dist/chunk-Y3GO6SG3.js.map +1 -0
- package/dist/chunk-ZAMHLXNS.js +56 -0
- package/dist/chunk-ZAMHLXNS.js.map +1 -0
- package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
- package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
- package/dist/chunk-ZOS3D26Z.js +72 -0
- package/dist/chunk-ZOS3D26Z.js.map +1 -0
- package/dist/design-canvas/index.js +32 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
- package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
- package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
- package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
- package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
- package/dist/design-canvas-react/contracts.d.ts +2 -2
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +9 -7
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/eval/calibration.d.ts +1 -38
- package/dist/eval/index.d.ts +2 -4
- package/dist/eval/index.js +0 -84
- package/dist/eval/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/session-selection.d.ts +2 -2
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/result.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +4 -4
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +1 -1
- package/dist/launch-invariants/cli.js +4 -4
- package/dist/launch-invariants/index.js +3 -3
- package/dist/launch-invariants/testing.js +4 -4
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
- package/dist/mention-editor-4BKBMWIK.js.map +1 -0
- package/dist/missions/index.js +144 -137
- package/dist/missions/index.js.map +1 -1
- package/dist/operator/index.js +1 -1
- package/dist/peer-floors/check.js +1 -1
- package/dist/peer-floors/cli.js +6 -14
- package/dist/peer-floors/cli.js.map +1 -1
- package/dist/peer-floors/source-entries.d.ts +6 -0
- package/dist/platform/index.js +10 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.js +1 -422
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/server.d.ts +0 -1
- package/dist/profile-editor/server.js +0 -1
- package/dist/profile-editor/server.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/record/drizzle.js +156 -148
- package/dist/record/drizzle.js.map +1 -1
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/router-turn.js +3 -3
- package/dist/sandbox/index.js +5 -5
- package/dist/sequences/drizzle.js +5 -15
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +1 -0
- package/dist/sequences/index.js +18 -14
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/row-mapping.d.ts +7 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
- package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
- package/dist/sequences-react/components/glyphs.d.ts +12 -21
- package/dist/sequences-react/components/index.d.ts +0 -2
- package/dist/sequences-react/components/interaction-math.d.ts +3 -3
- package/dist/sequences-react/contracts.d.ts +1 -1
- package/dist/sequences-react/engine/snap.d.ts +2 -2
- package/dist/sequences-react/index.js +4 -4
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/settings-react/index.js +13 -30
- package/dist/settings-react/index.js.map +1 -1
- package/dist/settings-react/timezone-picker.d.ts +0 -6
- package/dist/signoff/browser-budget.d.ts +6 -1
- package/dist/signoff/cli.d.ts +0 -7
- package/dist/signoff/cli.js +1 -2
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +5 -25
- package/dist/skills/marketplace.d.ts +1 -75
- package/dist/skills-placement/box.js +3 -4
- package/dist/skills-placement/box.js.map +1 -1
- package/dist/skills-placement/index.js +3 -4
- package/dist/spend/cli-args.d.ts +1 -1
- package/dist/spend/cli.js +3 -3
- package/dist/spend/cli.js.map +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/stories/design-canvas/fixtures.d.ts +1 -14
- package/dist/stream/index.js +17 -17
- package/dist/studio/generation.d.ts +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.js +353 -184
- package/dist/studio-react/index.js.map +1 -1
- package/dist/studio-react/studio-composer.d.ts +1 -5
- package/dist/studio-react/studio-history-screen.d.ts +1 -1
- package/dist/teams/invitations-api.d.ts +3 -3
- package/dist/teams/invitations-api.js +74 -72
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/member-sync.d.ts +2 -0
- package/dist/teams/members-api.d.ts +2 -2
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/index.js +28 -45
- package/dist/teams-react/index.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-arguments.d.ts +1 -1
- package/dist/trace/index.d.ts +1 -18
- package/dist/trace/index.js +1 -36
- package/dist/trace/index.js.map +1 -1
- package/dist/trace/mission-flow.d.ts +1 -59
- package/dist/turn-health/index.d.ts +1 -1
- package/dist/turn-health/index.js +2 -2
- package/dist/turn-health/sink.d.ts +2 -1
- package/dist/turn-trace/index.js +2 -4
- package/dist/turn-trace/recorder.d.ts +0 -2
- package/dist/vault/VaultPane.d.ts +0 -20
- package/dist/vault/VaultPaneOperations.d.ts +318 -0
- package/dist/vault/index.js +2 -1
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +1 -2
- package/dist/web-react/agent-profile-editor.js +6 -5
- package/dist/web-react/chat-composer.d.ts +1 -1
- package/dist/web-react/durable-plan-flow.d.ts +6 -1
- package/dist/web-react/editor-glyphs.d.ts +12 -0
- package/dist/web-react/focus-navigation.d.ts +12 -0
- package/dist/web-react/history-controls.d.ts +37 -0
- package/dist/web-react/index.js +36 -34
- package/dist/web-react/interaction-question-card.d.ts +1 -1
- package/dist/web-react/record-grid-writes.d.ts +31 -0
- package/dist/web-react/record-grid.d.ts +1 -48
- package/dist/web-react/session-history-panel.d.ts +1 -9
- package/dist/web-react/use-document-dark.d.ts +1 -0
- package/dist/workspace-export/engine.d.ts +1 -6
- package/dist/workspace-export/index.js +198 -185
- package/dist/workspace-export/index.js.map +1 -1
- package/dist/workspace-export/routes.d.ts +1 -1
- package/dist/workspace-react/index.js +9 -8
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +1 -11
- package/dist/VaultPane-RXL3WLA2.js +0 -7
- package/dist/agent-profiles/reaper.d.ts +0 -31
- package/dist/agent-profiles/reaper.js +0 -29
- package/dist/agent-profiles/reaper.js.map +0 -1
- package/dist/chunk-4ZSLX3LY.js.map +0 -1
- package/dist/chunk-5IM2CLYX.js.map +0 -1
- package/dist/chunk-6OSJNJA2.js +0 -251
- package/dist/chunk-6OSJNJA2.js.map +0 -1
- package/dist/chunk-6PRQ45QE.js.map +0 -1
- package/dist/chunk-6ZIC6OG5.js.map +0 -1
- package/dist/chunk-BDEBQ4WO.js +0 -38
- package/dist/chunk-BDEBQ4WO.js.map +0 -1
- package/dist/chunk-BOQ4HVVH.js.map +0 -1
- package/dist/chunk-F2VX6TTJ.js.map +0 -1
- package/dist/chunk-FPNZMIAW.js.map +0 -1
- package/dist/chunk-HN6MZ2XL.js.map +0 -1
- package/dist/chunk-J2BBYVGF.js.map +0 -1
- package/dist/chunk-KJODHPWM.js.map +0 -1
- package/dist/chunk-LTWJYNEC.js +0 -100
- package/dist/chunk-LTWJYNEC.js.map +0 -1
- package/dist/chunk-LXYQOOXU.js.map +0 -1
- package/dist/chunk-MEKOWH5E.js.map +0 -1
- package/dist/chunk-NHYRIM4I.js.map +0 -1
- package/dist/chunk-NMZUW6VJ.js.map +0 -1
- package/dist/chunk-ORQD4AUO.js.map +0 -1
- package/dist/chunk-R4X5474U.js.map +0 -1
- package/dist/chunk-RL3Z747H.js.map +0 -1
- package/dist/chunk-TXUAGSFR.js.map +0 -1
- package/dist/chunk-UCCSJX64.js.map +0 -1
- package/dist/chunk-VJBFCNAU.js.map +0 -1
- package/dist/chunk-WSEXFTN4.js.map +0 -1
- package/dist/chunk-Y43PXON2.js.map +0 -1
- package/dist/chunk-ZBB5KQ6B.js.map +0 -1
- package/dist/eval/parity.d.ts +0 -74
- package/dist/mention-editor-B23OMFT2.js.map +0 -1
- package/dist/profile/humanizer-skill.d.ts +0 -23
- package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
- package/dist/sequences-react/components/BrandMark.d.ts +0 -10
- package/dist/skills/marketplace-drizzle.d.ts +0 -121
- package/dist/skills/marketplace-drizzle.js +0 -34
- package/dist/skills/marketplace-drizzle.js.map +0 -1
- package/dist/teams-react/components/BrandMark.d.ts +0 -10
- /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
- /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
- /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
- /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
- /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
- /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
- /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
- /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
- /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
- /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
- /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
- /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
- /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LockGlyph,
|
|
3
|
+
MagnetGlyph,
|
|
4
|
+
MinusGlyph,
|
|
5
|
+
PlusGlyph,
|
|
6
|
+
RedoGlyph,
|
|
7
|
+
UndoGlyph,
|
|
8
|
+
createEditorGlyph
|
|
9
|
+
} from "./chunk-P4RRC4AO.js";
|
|
1
10
|
import {
|
|
2
11
|
MIN_SEQUENCE_CLIP_FRAMES,
|
|
3
12
|
assertClipFitsSequence,
|
|
@@ -9,6 +18,113 @@ import {
|
|
|
9
18
|
snapshotFrame,
|
|
10
19
|
trackIntervals
|
|
11
20
|
} from "./chunk-SISVELAA.js";
|
|
21
|
+
import {
|
|
22
|
+
BrandMark
|
|
23
|
+
} from "./chunk-7PULOECS.js";
|
|
24
|
+
|
|
25
|
+
// src/sequences-react/components/TimelineHistory.ts
|
|
26
|
+
var HISTORY_MIRROR_LIMIT = 200;
|
|
27
|
+
function createTimelineHistoryHandlers({
|
|
28
|
+
clipIdAliasesRef,
|
|
29
|
+
setCommitError,
|
|
30
|
+
canWrite,
|
|
31
|
+
stack,
|
|
32
|
+
historyRef,
|
|
33
|
+
onApplyOperations
|
|
34
|
+
}) {
|
|
35
|
+
function resolveClipId(clipId) {
|
|
36
|
+
return clipIdAliasesRef.current.get(clipId) ?? clipId;
|
|
37
|
+
}
|
|
38
|
+
function reconcileCreatedClipIds(operations, createdLocalIds, results) {
|
|
39
|
+
if (createdLocalIds.length === 0 || !Array.isArray(results)) return;
|
|
40
|
+
if (results.length !== operations.length) {
|
|
41
|
+
setCommitError(
|
|
42
|
+
`onApplyOperations returned ${results.length} results for ${operations.length} operations \u2014 clip-id reconciliation skipped`
|
|
43
|
+
);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let cursor = 0;
|
|
47
|
+
operations.forEach((operation, index) => {
|
|
48
|
+
if (operation.type !== "place_clip" && operation.type !== "add_caption" && operation.type !== "split_clip") return;
|
|
49
|
+
const localId = createdLocalIds[cursor];
|
|
50
|
+
cursor += 1;
|
|
51
|
+
const result = results[index];
|
|
52
|
+
if (localId !== void 0 && result !== void 0 && result.kind === "clip") {
|
|
53
|
+
clipIdAliasesRef.current.set(localId, result.clip.id);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function commitCommand(command, createdLocalIds = []) {
|
|
58
|
+
if (!canWrite) return;
|
|
59
|
+
try {
|
|
60
|
+
stack.execute(command);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
setCommitError(error instanceof Error ? error.message : String(error));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const history = historyRef.current;
|
|
66
|
+
const entry = { command, createdLocalIds };
|
|
67
|
+
history.done.push(entry);
|
|
68
|
+
if (history.done.length > HISTORY_MIRROR_LIMIT) history.done.splice(0, history.done.length - HISTORY_MIRROR_LIMIT);
|
|
69
|
+
history.undone = [];
|
|
70
|
+
setCommitError(null);
|
|
71
|
+
const operations = command.operations();
|
|
72
|
+
void onApplyOperations(operations).then((results) => reconcileCreatedClipIds(operations, createdLocalIds, results)).catch((error) => {
|
|
73
|
+
const mirror = historyRef.current;
|
|
74
|
+
if (mirror.done[mirror.done.length - 1] === entry && stack.canUndo()) {
|
|
75
|
+
stack.undo();
|
|
76
|
+
mirror.done.pop();
|
|
77
|
+
}
|
|
78
|
+
setCommitError(error instanceof Error ? error.message : String(error));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function undoLast() {
|
|
82
|
+
const history = historyRef.current;
|
|
83
|
+
const entry = history.done[history.done.length - 1];
|
|
84
|
+
if (!entry || !stack.canUndo()) return;
|
|
85
|
+
try {
|
|
86
|
+
stack.undo();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
setCommitError(`Undo failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
history.done.pop();
|
|
92
|
+
history.undone.push(entry);
|
|
93
|
+
void onApplyOperations(entry.command.inverseOperations()).catch((error) => {
|
|
94
|
+
const mirror = historyRef.current;
|
|
95
|
+
if (mirror.undone[mirror.undone.length - 1] === entry && stack.canRedo()) {
|
|
96
|
+
stack.redo();
|
|
97
|
+
mirror.undone.pop();
|
|
98
|
+
mirror.done.push(entry);
|
|
99
|
+
}
|
|
100
|
+
setCommitError(error instanceof Error ? error.message : String(error));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function redoLast() {
|
|
104
|
+
const history = historyRef.current;
|
|
105
|
+
const entry = history.undone[history.undone.length - 1];
|
|
106
|
+
if (!entry || !stack.canRedo()) return;
|
|
107
|
+
try {
|
|
108
|
+
stack.redo();
|
|
109
|
+
} catch (error) {
|
|
110
|
+
setCommitError(`Redo failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
history.undone.pop();
|
|
114
|
+
history.done.push(entry);
|
|
115
|
+
const operations = entry.command.operations();
|
|
116
|
+
void onApplyOperations(operations).then((results) => reconcileCreatedClipIds(operations, entry.createdLocalIds, results)).catch((error) => {
|
|
117
|
+
const mirror = historyRef.current;
|
|
118
|
+
if (mirror.done[mirror.done.length - 1] === entry && stack.canUndo()) {
|
|
119
|
+
stack.undo();
|
|
120
|
+
mirror.done.pop();
|
|
121
|
+
mirror.undone.push(entry);
|
|
122
|
+
}
|
|
123
|
+
setCommitError(error instanceof Error ? error.message : String(error));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return { resolveClipId, reconcileCreatedClipIds, commitCommand, undoLast, redoLast };
|
|
127
|
+
}
|
|
12
128
|
|
|
13
129
|
// src/sequences-react/components/TimelineEditor.tsx
|
|
14
130
|
import { useEffect as useEffect3, useMemo as useMemo3, useRef as useRef3, useState as useState3, useSyncExternalStore } from "react";
|
|
@@ -1339,7 +1455,7 @@ function sourceDurationFrames(clip, fps) {
|
|
|
1339
1455
|
if (clip.media?.durationSeconds !== void 0) return Math.round(clip.media.durationSeconds * fps);
|
|
1340
1456
|
return void 0;
|
|
1341
1457
|
}
|
|
1342
|
-
function
|
|
1458
|
+
function useTimelineClipChipViewState(props) {
|
|
1343
1459
|
const { clip, track, fps, zoom, selected, canWrite, tabbable, frameProvider } = props;
|
|
1344
1460
|
const rootRef = useRef2(null);
|
|
1345
1461
|
const gestureRef = useRef2(null);
|
|
@@ -1358,152 +1474,26 @@ function TimelineClipChip(props) {
|
|
|
1358
1474
|
};
|
|
1359
1475
|
const geometry = clipChipGeometry({ startFrame: shown.startFrame, durationFrames: shown.durationFrames, zoom });
|
|
1360
1476
|
const interactive = canWrite && !track.locked;
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1382
|
-
}
|
|
1383
|
-
gestureRef.current = {
|
|
1384
|
-
kind,
|
|
1385
|
-
pointerId: event.pointerId,
|
|
1386
|
-
originClientX: event.clientX,
|
|
1387
|
-
origin: { startFrame: clip.startFrame, durationFrames: clip.durationFrames, sourceInFrame: clip.sourceInFrame },
|
|
1388
|
-
laneTargets: kind === "move" ? collectLaneTargets() : [],
|
|
1389
|
-
originTrackId: clip.trackId
|
|
1390
|
-
};
|
|
1391
|
-
document.body.style.cursor = kind === "move" ? "grabbing" : "ew-resize";
|
|
1392
|
-
document.body.style.userSelect = "none";
|
|
1393
|
-
}
|
|
1394
|
-
function applyPreview(next) {
|
|
1395
|
-
previewRef.current = next;
|
|
1396
|
-
setPreview(next);
|
|
1397
|
-
}
|
|
1398
|
-
function updateGesture(event) {
|
|
1399
|
-
const gesture = gestureRef.current;
|
|
1400
|
-
if (!gesture || event.pointerId !== gesture.pointerId) return;
|
|
1401
|
-
const deltaFrames = framesFromPixelDelta(event.clientX - gesture.originClientX, zoom);
|
|
1402
|
-
const moved = previewRef.current?.moved || Math.abs(event.clientX - gesture.originClientX) > 3;
|
|
1403
|
-
if (gesture.kind === "move") {
|
|
1404
|
-
const candidate = moveDragStartFrame({
|
|
1405
|
-
originStartFrame: gesture.origin.startFrame,
|
|
1406
|
-
durationFrames: gesture.origin.durationFrames,
|
|
1407
|
-
deltaFrames,
|
|
1408
|
-
sequenceDurationFrames: props.sequenceDurationFrames
|
|
1409
|
-
});
|
|
1410
|
-
const snapped2 = props.snapMove({ startFrame: candidate, durationFrames: gesture.origin.durationFrames, clipId: clip.id });
|
|
1411
|
-
const startFrame = moveDragStartFrame({
|
|
1412
|
-
originStartFrame: snapped2.startFrame,
|
|
1413
|
-
durationFrames: gesture.origin.durationFrames,
|
|
1414
|
-
deltaFrames: 0,
|
|
1415
|
-
sequenceDurationFrames: props.sequenceDurationFrames
|
|
1416
|
-
});
|
|
1417
|
-
props.onSnapPointChange(startFrame === snapped2.startFrame ? snapped2.point : null);
|
|
1418
|
-
const lane = gesture.laneTargets.find((target) => event.clientY >= target.top && event.clientY < target.bottom);
|
|
1419
|
-
applyPreview({
|
|
1420
|
-
startFrame,
|
|
1421
|
-
durationFrames: gesture.origin.durationFrames,
|
|
1422
|
-
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1423
|
-
trackId: lane?.trackId ?? gesture.originTrackId,
|
|
1424
|
-
translateY: lane?.offsetY ?? 0,
|
|
1425
|
-
moved
|
|
1426
|
-
});
|
|
1427
|
-
return;
|
|
1428
|
-
}
|
|
1429
|
-
if (gesture.kind === "trim-start") {
|
|
1430
|
-
const raw = trimStartDrag({
|
|
1431
|
-
originStartFrame: gesture.origin.startFrame,
|
|
1432
|
-
originDurationFrames: gesture.origin.durationFrames,
|
|
1433
|
-
originSourceInFrame: gesture.origin.sourceInFrame,
|
|
1434
|
-
deltaFrames
|
|
1435
|
-
});
|
|
1436
|
-
const snapped2 = props.snapEdge({ frame: raw.startFrame, clipId: clip.id });
|
|
1437
|
-
const clamped2 = trimStartDrag({
|
|
1438
|
-
originStartFrame: gesture.origin.startFrame,
|
|
1439
|
-
originDurationFrames: gesture.origin.durationFrames,
|
|
1440
|
-
originSourceInFrame: gesture.origin.sourceInFrame,
|
|
1441
|
-
deltaFrames: snapped2.frame - gesture.origin.startFrame
|
|
1442
|
-
});
|
|
1443
|
-
props.onSnapPointChange(clamped2.startFrame === snapped2.frame ? snapped2.point : null);
|
|
1444
|
-
applyPreview({ ...clamped2, trackId: gesture.originTrackId, translateY: 0, moved });
|
|
1445
|
-
return;
|
|
1446
|
-
}
|
|
1447
|
-
const rawEnd = gesture.origin.startFrame + trimEndDrag({
|
|
1448
|
-
originStartFrame: gesture.origin.startFrame,
|
|
1449
|
-
originDurationFrames: gesture.origin.durationFrames,
|
|
1450
|
-
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1451
|
-
deltaFrames,
|
|
1452
|
-
sequenceDurationFrames: props.sequenceDurationFrames,
|
|
1453
|
-
sourceDurationFrames: sourceDurationFrames(clip, fps)
|
|
1454
|
-
}).durationFrames;
|
|
1455
|
-
const snapped = props.snapEdge({ frame: rawEnd, clipId: clip.id });
|
|
1456
|
-
const clamped = trimEndDrag({
|
|
1457
|
-
originStartFrame: gesture.origin.startFrame,
|
|
1458
|
-
originDurationFrames: gesture.origin.durationFrames,
|
|
1459
|
-
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1460
|
-
deltaFrames: snapped.frame - (gesture.origin.startFrame + gesture.origin.durationFrames),
|
|
1461
|
-
sequenceDurationFrames: props.sequenceDurationFrames,
|
|
1462
|
-
sourceDurationFrames: sourceDurationFrames(clip, fps)
|
|
1463
|
-
});
|
|
1464
|
-
props.onSnapPointChange(gesture.origin.startFrame + clamped.durationFrames === snapped.frame ? snapped.point : null);
|
|
1465
|
-
applyPreview({
|
|
1466
|
-
startFrame: gesture.origin.startFrame,
|
|
1467
|
-
durationFrames: clamped.durationFrames,
|
|
1468
|
-
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1469
|
-
trackId: gesture.originTrackId,
|
|
1470
|
-
translateY: 0,
|
|
1471
|
-
moved
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
function endGestureCleanup() {
|
|
1475
|
-
gestureRef.current = null;
|
|
1476
|
-
previewRef.current = null;
|
|
1477
|
-
setPreview(null);
|
|
1478
|
-
props.onSnapPointChange(null);
|
|
1479
|
-
document.body.style.cursor = "";
|
|
1480
|
-
document.body.style.userSelect = "";
|
|
1481
|
-
}
|
|
1482
|
-
function finishGesture(event) {
|
|
1483
|
-
const gesture = gestureRef.current;
|
|
1484
|
-
if (!gesture || event.pointerId !== gesture.pointerId) return;
|
|
1485
|
-
const finalPreview = previewRef.current;
|
|
1486
|
-
const kind = gesture.kind;
|
|
1487
|
-
const origin = gesture.origin;
|
|
1488
|
-
const originTrackId = gesture.originTrackId;
|
|
1489
|
-
endGestureCleanup();
|
|
1490
|
-
if (!finalPreview || !finalPreview.moved) {
|
|
1491
|
-
props.onSelect(clip.id, event.shiftKey);
|
|
1492
|
-
return;
|
|
1493
|
-
}
|
|
1494
|
-
if (kind === "move") {
|
|
1495
|
-
if (finalPreview.startFrame === origin.startFrame && finalPreview.trackId === originTrackId) return;
|
|
1496
|
-
props.onCommitMove({ clipId: clip.id, startFrame: finalPreview.startFrame, trackId: finalPreview.trackId });
|
|
1497
|
-
return;
|
|
1498
|
-
}
|
|
1499
|
-
if (finalPreview.startFrame === origin.startFrame && finalPreview.durationFrames === origin.durationFrames) return;
|
|
1500
|
-
props.onCommitTrim({
|
|
1501
|
-
clipId: clip.id,
|
|
1502
|
-
startFrame: finalPreview.startFrame,
|
|
1503
|
-
durationFrames: finalPreview.durationFrames,
|
|
1504
|
-
sourceInFrame: finalPreview.sourceInFrame
|
|
1505
|
-
});
|
|
1506
|
-
}
|
|
1477
|
+
const {
|
|
1478
|
+
collectLaneTargets,
|
|
1479
|
+
beginGesture,
|
|
1480
|
+
applyPreview,
|
|
1481
|
+
updateGesture,
|
|
1482
|
+
endGestureCleanup,
|
|
1483
|
+
finishGesture
|
|
1484
|
+
} = createClipGestureHandlers({
|
|
1485
|
+
rootRef,
|
|
1486
|
+
track,
|
|
1487
|
+
interactive,
|
|
1488
|
+
editingText,
|
|
1489
|
+
gestureRef,
|
|
1490
|
+
clip,
|
|
1491
|
+
previewRef,
|
|
1492
|
+
setPreview,
|
|
1493
|
+
zoom,
|
|
1494
|
+
props,
|
|
1495
|
+
fps
|
|
1496
|
+
});
|
|
1507
1497
|
useEffect2(() => {
|
|
1508
1498
|
if (!preview) return;
|
|
1509
1499
|
function onKeyDown(event) {
|
|
@@ -1610,6 +1600,61 @@ function TimelineClipChip(props) {
|
|
|
1610
1600
|
props.onFocusStep(clip.id, 1);
|
|
1611
1601
|
}
|
|
1612
1602
|
}
|
|
1603
|
+
return {
|
|
1604
|
+
rootRef,
|
|
1605
|
+
clip,
|
|
1606
|
+
selected,
|
|
1607
|
+
tabbable,
|
|
1608
|
+
handleKeyDown,
|
|
1609
|
+
track,
|
|
1610
|
+
dragging,
|
|
1611
|
+
interactive,
|
|
1612
|
+
geometry,
|
|
1613
|
+
shown,
|
|
1614
|
+
beginGesture,
|
|
1615
|
+
updateGesture,
|
|
1616
|
+
finishGesture,
|
|
1617
|
+
endGestureCleanup,
|
|
1618
|
+
isCaption,
|
|
1619
|
+
setEditingText,
|
|
1620
|
+
isAudioMedia,
|
|
1621
|
+
waveformRef,
|
|
1622
|
+
isVisualMedia,
|
|
1623
|
+
posterRef,
|
|
1624
|
+
fps,
|
|
1625
|
+
editingText,
|
|
1626
|
+
commitText
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
function TimelineClipChip(props) {
|
|
1630
|
+
const view = useTimelineClipChipViewState(props);
|
|
1631
|
+
return /* @__PURE__ */ jsx5(TimelineClipChipView, { ...view });
|
|
1632
|
+
}
|
|
1633
|
+
function TimelineClipChipView({
|
|
1634
|
+
rootRef,
|
|
1635
|
+
clip,
|
|
1636
|
+
selected,
|
|
1637
|
+
tabbable,
|
|
1638
|
+
handleKeyDown,
|
|
1639
|
+
track,
|
|
1640
|
+
dragging,
|
|
1641
|
+
interactive,
|
|
1642
|
+
geometry,
|
|
1643
|
+
shown,
|
|
1644
|
+
beginGesture,
|
|
1645
|
+
updateGesture,
|
|
1646
|
+
finishGesture,
|
|
1647
|
+
endGestureCleanup,
|
|
1648
|
+
isCaption,
|
|
1649
|
+
setEditingText,
|
|
1650
|
+
isAudioMedia,
|
|
1651
|
+
waveformRef,
|
|
1652
|
+
isVisualMedia,
|
|
1653
|
+
posterRef,
|
|
1654
|
+
fps,
|
|
1655
|
+
editingText,
|
|
1656
|
+
commitText
|
|
1657
|
+
}) {
|
|
1613
1658
|
return /* @__PURE__ */ jsxs3(
|
|
1614
1659
|
"div",
|
|
1615
1660
|
{
|
|
@@ -1694,93 +1739,229 @@ function TimelineClipChip(props) {
|
|
|
1694
1739
|
}
|
|
1695
1740
|
);
|
|
1696
1741
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1742
|
+
function createClipGestureHandlers({
|
|
1743
|
+
rootRef,
|
|
1744
|
+
track,
|
|
1745
|
+
interactive,
|
|
1746
|
+
editingText,
|
|
1747
|
+
gestureRef,
|
|
1748
|
+
clip,
|
|
1749
|
+
previewRef,
|
|
1750
|
+
setPreview,
|
|
1751
|
+
zoom,
|
|
1752
|
+
props,
|
|
1753
|
+
fps
|
|
1754
|
+
}) {
|
|
1755
|
+
function collectLaneTargets() {
|
|
1756
|
+
const root = rootRef.current?.closest("[data-timeline-tracks]");
|
|
1757
|
+
const originLane = rootRef.current?.closest("[data-lane-track]");
|
|
1758
|
+
if (!root || !originLane) return [];
|
|
1759
|
+
const originTop = originLane.getBoundingClientRect().top;
|
|
1760
|
+
const targets = [];
|
|
1761
|
+
for (const lane of Array.from(root.querySelectorAll("[data-lane-track]"))) {
|
|
1762
|
+
if (lane.dataset.laneKind !== track.kind || lane.dataset.laneLocked === "true") continue;
|
|
1763
|
+
const rect = lane.getBoundingClientRect();
|
|
1764
|
+
const trackId = lane.dataset.laneTrack;
|
|
1765
|
+
if (!trackId) continue;
|
|
1766
|
+
targets.push({ trackId, top: rect.top, bottom: rect.bottom, offsetY: rect.top - originTop });
|
|
1767
|
+
}
|
|
1768
|
+
return targets;
|
|
1769
|
+
}
|
|
1770
|
+
function beginGesture(event, kind) {
|
|
1771
|
+
if (!interactive || event.button !== 0 || editingText !== null) return;
|
|
1772
|
+
event.preventDefault();
|
|
1773
|
+
event.stopPropagation();
|
|
1774
|
+
if (typeof event.currentTarget.setPointerCapture === "function") {
|
|
1775
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1776
|
+
}
|
|
1777
|
+
gestureRef.current = {
|
|
1778
|
+
kind,
|
|
1779
|
+
pointerId: event.pointerId,
|
|
1780
|
+
originClientX: event.clientX,
|
|
1781
|
+
origin: { startFrame: clip.startFrame, durationFrames: clip.durationFrames, sourceInFrame: clip.sourceInFrame },
|
|
1782
|
+
laneTargets: kind === "move" ? collectLaneTargets() : [],
|
|
1783
|
+
originTrackId: clip.trackId
|
|
1784
|
+
};
|
|
1785
|
+
document.body.style.cursor = kind === "move" ? "grabbing" : "ew-resize";
|
|
1786
|
+
document.body.style.userSelect = "none";
|
|
1787
|
+
}
|
|
1788
|
+
function applyPreview(next) {
|
|
1789
|
+
previewRef.current = next;
|
|
1790
|
+
setPreview(next);
|
|
1791
|
+
}
|
|
1792
|
+
function updateGesture(event) {
|
|
1793
|
+
const gesture = gestureRef.current;
|
|
1794
|
+
if (!gesture || event.pointerId !== gesture.pointerId) return;
|
|
1795
|
+
const deltaFrames = framesFromPixelDelta(event.clientX - gesture.originClientX, zoom);
|
|
1796
|
+
const moved = previewRef.current?.moved || Math.abs(event.clientX - gesture.originClientX) > 3;
|
|
1797
|
+
if (gesture.kind === "move") {
|
|
1798
|
+
const candidate = moveDragStartFrame({
|
|
1799
|
+
originStartFrame: gesture.origin.startFrame,
|
|
1800
|
+
durationFrames: gesture.origin.durationFrames,
|
|
1801
|
+
deltaFrames,
|
|
1802
|
+
sequenceDurationFrames: props.sequenceDurationFrames
|
|
1803
|
+
});
|
|
1804
|
+
const snapped2 = props.snapMove({ startFrame: candidate, durationFrames: gesture.origin.durationFrames, clipId: clip.id });
|
|
1805
|
+
const startFrame = moveDragStartFrame({
|
|
1806
|
+
originStartFrame: snapped2.startFrame,
|
|
1807
|
+
durationFrames: gesture.origin.durationFrames,
|
|
1808
|
+
deltaFrames: 0,
|
|
1809
|
+
sequenceDurationFrames: props.sequenceDurationFrames
|
|
1810
|
+
});
|
|
1811
|
+
props.onSnapPointChange(startFrame === snapped2.startFrame ? snapped2.point : null);
|
|
1812
|
+
const lane = gesture.laneTargets.find((target) => event.clientY >= target.top && event.clientY < target.bottom);
|
|
1813
|
+
applyPreview({
|
|
1814
|
+
startFrame,
|
|
1815
|
+
durationFrames: gesture.origin.durationFrames,
|
|
1816
|
+
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1817
|
+
trackId: lane?.trackId ?? gesture.originTrackId,
|
|
1818
|
+
translateY: lane?.offsetY ?? 0,
|
|
1819
|
+
moved
|
|
1820
|
+
});
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
if (gesture.kind === "trim-start") {
|
|
1824
|
+
const raw = trimStartDrag({
|
|
1825
|
+
originStartFrame: gesture.origin.startFrame,
|
|
1826
|
+
originDurationFrames: gesture.origin.durationFrames,
|
|
1827
|
+
originSourceInFrame: gesture.origin.sourceInFrame,
|
|
1828
|
+
deltaFrames
|
|
1829
|
+
});
|
|
1830
|
+
const snapped2 = props.snapEdge({ frame: raw.startFrame, clipId: clip.id });
|
|
1831
|
+
const clamped2 = trimStartDrag({
|
|
1832
|
+
originStartFrame: gesture.origin.startFrame,
|
|
1833
|
+
originDurationFrames: gesture.origin.durationFrames,
|
|
1834
|
+
originSourceInFrame: gesture.origin.sourceInFrame,
|
|
1835
|
+
deltaFrames: snapped2.frame - gesture.origin.startFrame
|
|
1836
|
+
});
|
|
1837
|
+
props.onSnapPointChange(clamped2.startFrame === snapped2.frame ? snapped2.point : null);
|
|
1838
|
+
applyPreview({ ...clamped2, trackId: gesture.originTrackId, translateY: 0, moved });
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
const rawEnd = gesture.origin.startFrame + trimEndDrag({
|
|
1842
|
+
originStartFrame: gesture.origin.startFrame,
|
|
1843
|
+
originDurationFrames: gesture.origin.durationFrames,
|
|
1844
|
+
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1845
|
+
deltaFrames,
|
|
1846
|
+
sequenceDurationFrames: props.sequenceDurationFrames,
|
|
1847
|
+
sourceDurationFrames: sourceDurationFrames(clip, fps)
|
|
1848
|
+
}).durationFrames;
|
|
1849
|
+
const snapped = props.snapEdge({ frame: rawEnd, clipId: clip.id });
|
|
1850
|
+
const clamped = trimEndDrag({
|
|
1851
|
+
originStartFrame: gesture.origin.startFrame,
|
|
1852
|
+
originDurationFrames: gesture.origin.durationFrames,
|
|
1853
|
+
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1854
|
+
deltaFrames: snapped.frame - (gesture.origin.startFrame + gesture.origin.durationFrames),
|
|
1855
|
+
sequenceDurationFrames: props.sequenceDurationFrames,
|
|
1856
|
+
sourceDurationFrames: sourceDurationFrames(clip, fps)
|
|
1857
|
+
});
|
|
1858
|
+
props.onSnapPointChange(gesture.origin.startFrame + clamped.durationFrames === snapped.frame ? snapped.point : null);
|
|
1859
|
+
applyPreview({
|
|
1860
|
+
startFrame: gesture.origin.startFrame,
|
|
1861
|
+
durationFrames: clamped.durationFrames,
|
|
1862
|
+
sourceInFrame: gesture.origin.sourceInFrame,
|
|
1863
|
+
trackId: gesture.originTrackId,
|
|
1864
|
+
translateY: 0,
|
|
1865
|
+
moved
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
function endGestureCleanup() {
|
|
1869
|
+
gestureRef.current = null;
|
|
1870
|
+
previewRef.current = null;
|
|
1871
|
+
setPreview(null);
|
|
1872
|
+
props.onSnapPointChange(null);
|
|
1873
|
+
document.body.style.cursor = "";
|
|
1874
|
+
document.body.style.userSelect = "";
|
|
1875
|
+
}
|
|
1876
|
+
function finishGesture(event) {
|
|
1877
|
+
const gesture = gestureRef.current;
|
|
1878
|
+
if (!gesture || event.pointerId !== gesture.pointerId) return;
|
|
1879
|
+
const finalPreview = previewRef.current;
|
|
1880
|
+
const kind = gesture.kind;
|
|
1881
|
+
const origin = gesture.origin;
|
|
1882
|
+
const originTrackId = gesture.originTrackId;
|
|
1883
|
+
endGestureCleanup();
|
|
1884
|
+
if (!finalPreview || !finalPreview.moved) {
|
|
1885
|
+
props.onSelect(clip.id, event.shiftKey);
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
if (kind === "move") {
|
|
1889
|
+
if (finalPreview.startFrame === origin.startFrame && finalPreview.trackId === originTrackId) return;
|
|
1890
|
+
props.onCommitMove({ clipId: clip.id, startFrame: finalPreview.startFrame, trackId: finalPreview.trackId });
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
if (finalPreview.startFrame === origin.startFrame && finalPreview.durationFrames === origin.durationFrames) return;
|
|
1894
|
+
props.onCommitTrim({
|
|
1895
|
+
clipId: clip.id,
|
|
1896
|
+
startFrame: finalPreview.startFrame,
|
|
1897
|
+
durationFrames: finalPreview.durationFrames,
|
|
1898
|
+
sourceInFrame: finalPreview.sourceInFrame
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
return { collectLaneTargets, beginGesture, applyPreview, updateGesture, endGestureCleanup, finishGesture };
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// src/sequences-react/components/glyphs.tsx
|
|
1905
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1906
|
+
var FilmGlyph = createEditorGlyph(
|
|
1907
|
+
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1707
1908
|
/* @__PURE__ */ jsx6("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1708
1909
|
/* @__PURE__ */ jsx6("path", { d: "M7 3v18M17 3v18M3 8h4M3 16h4M17 8h4M17 16h4" })
|
|
1709
1910
|
] })
|
|
1710
1911
|
);
|
|
1711
|
-
var AudioGlyph =
|
|
1912
|
+
var AudioGlyph = createEditorGlyph(
|
|
1712
1913
|
/* @__PURE__ */ jsx6("path", { d: "M2 12h2l2-7 3 14 3-9 2 5 2-3h6" })
|
|
1713
1914
|
);
|
|
1714
|
-
var CaptionGlyph =
|
|
1915
|
+
var CaptionGlyph = createEditorGlyph(
|
|
1715
1916
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1716
1917
|
/* @__PURE__ */ jsx6("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1717
1918
|
/* @__PURE__ */ jsx6("path", { d: "M6 13h4M6 16h8M14 13h4" })
|
|
1718
1919
|
] })
|
|
1719
1920
|
);
|
|
1720
|
-
var ReferenceGlyph =
|
|
1921
|
+
var ReferenceGlyph = createEditorGlyph(
|
|
1721
1922
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1722
1923
|
/* @__PURE__ */ jsx6("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1723
1924
|
/* @__PURE__ */ jsx6("circle", { cx: "9", cy: "9", r: "2" }),
|
|
1724
1925
|
/* @__PURE__ */ jsx6("path", { d: "m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21" })
|
|
1725
1926
|
] })
|
|
1726
1927
|
);
|
|
1727
|
-
var AgentGlyph =
|
|
1928
|
+
var AgentGlyph = createEditorGlyph(
|
|
1728
1929
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1729
1930
|
/* @__PURE__ */ jsx6("rect", { x: "4", y: "8", width: "16", height: "12", rx: "2" }),
|
|
1730
1931
|
/* @__PURE__ */ jsx6("path", { d: "M12 8V4M8 4h8M9 13v2M15 13v2" })
|
|
1731
1932
|
] })
|
|
1732
1933
|
);
|
|
1733
|
-
var
|
|
1734
|
-
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1735
|
-
/* @__PURE__ */ jsx6("rect", { x: "5", y: "11", width: "14", height: "10", rx: "2" }),
|
|
1736
|
-
/* @__PURE__ */ jsx6("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
|
|
1737
|
-
] })
|
|
1738
|
-
);
|
|
1739
|
-
var MutedGlyph = glyph(
|
|
1934
|
+
var MutedGlyph = createEditorGlyph(
|
|
1740
1935
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1741
1936
|
/* @__PURE__ */ jsx6("path", { d: "M11 5 6 9H2v6h4l5 4z" }),
|
|
1742
1937
|
/* @__PURE__ */ jsx6("path", { d: "m23 9-6 6M17 9l6 6" })
|
|
1743
1938
|
] })
|
|
1744
1939
|
);
|
|
1745
|
-
var PlayGlyph =
|
|
1940
|
+
var PlayGlyph = createEditorGlyph(
|
|
1746
1941
|
/* @__PURE__ */ jsx6("path", { d: "m6 4 14 8-14 8z", fill: "currentColor", stroke: "none" })
|
|
1747
1942
|
);
|
|
1748
|
-
var PauseGlyph =
|
|
1943
|
+
var PauseGlyph = createEditorGlyph(
|
|
1749
1944
|
/* @__PURE__ */ jsx6("path", { d: "M7 4h3v16H7zM14 4h3v16h-3z", fill: "currentColor", stroke: "none" })
|
|
1750
1945
|
);
|
|
1751
|
-
var
|
|
1752
|
-
/* @__PURE__ */ jsx6("path", { d: "M3 7v6h6M3 13a9 9 0 1 0 3-7.7" })
|
|
1753
|
-
);
|
|
1754
|
-
var RedoGlyph = glyph(
|
|
1755
|
-
/* @__PURE__ */ jsx6("path", { d: "M21 7v6h-6M21 13a9 9 0 1 1-3-7.7" })
|
|
1756
|
-
);
|
|
1757
|
-
var MagnetGlyph = glyph(
|
|
1758
|
-
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1759
|
-
/* @__PURE__ */ jsx6("path", { d: "m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3z" }),
|
|
1760
|
-
/* @__PURE__ */ jsx6("path", { d: "m5 8 4 4M12 15l4 4" })
|
|
1761
|
-
] })
|
|
1762
|
-
);
|
|
1763
|
-
var ScissorsGlyph = glyph(
|
|
1946
|
+
var ScissorsGlyph = createEditorGlyph(
|
|
1764
1947
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1765
1948
|
/* @__PURE__ */ jsx6("circle", { cx: "6", cy: "6", r: "3" }),
|
|
1766
1949
|
/* @__PURE__ */ jsx6("circle", { cx: "6", cy: "18", r: "3" }),
|
|
1767
1950
|
/* @__PURE__ */ jsx6("path", { d: "M20 4 8.12 15.88M14.47 14.48 20 20M8.12 8.12 12 12" })
|
|
1768
1951
|
] })
|
|
1769
1952
|
);
|
|
1770
|
-
var CaptionPlusGlyph =
|
|
1953
|
+
var CaptionPlusGlyph = createEditorGlyph(
|
|
1771
1954
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1772
1955
|
/* @__PURE__ */ jsx6("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1773
1956
|
/* @__PURE__ */ jsx6("path", { d: "M12 9v6M9 12h6" })
|
|
1774
1957
|
] })
|
|
1775
1958
|
);
|
|
1776
|
-
var ExportGlyph =
|
|
1959
|
+
var ExportGlyph = createEditorGlyph(
|
|
1777
1960
|
/* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1778
1961
|
/* @__PURE__ */ jsx6("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1779
1962
|
/* @__PURE__ */ jsx6("path", { d: "M12 3v12M8 7l4-4 4 4" })
|
|
1780
1963
|
] })
|
|
1781
1964
|
);
|
|
1782
|
-
var PlusGlyph = glyph(/* @__PURE__ */ jsx6("path", { d: "M12 5v14M5 12h14" }));
|
|
1783
|
-
var MinusGlyph = glyph(/* @__PURE__ */ jsx6("path", { d: "M5 12h14" }));
|
|
1784
1965
|
|
|
1785
1966
|
// src/sequences-react/components/TimelineTrackRow.tsx
|
|
1786
1967
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -1853,26 +2034,8 @@ function TimelineTrackRow(props) {
|
|
|
1853
2034
|
] });
|
|
1854
2035
|
}
|
|
1855
2036
|
|
|
1856
|
-
// src/sequences-react/components/BrandMark.tsx
|
|
1857
|
-
import { lazy, Suspense } from "react";
|
|
1858
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1859
|
-
function MarkSpacer({ size }) {
|
|
1860
|
-
return /* @__PURE__ */ jsx8("span", { "aria-hidden": true, style: { display: "inline-block", width: size, height: size } });
|
|
1861
|
-
}
|
|
1862
|
-
var LazyKnot = lazy(async () => {
|
|
1863
|
-
try {
|
|
1864
|
-
const mod = await import("./brand/index.js");
|
|
1865
|
-
return { default: mod.TangleKnot };
|
|
1866
|
-
} catch {
|
|
1867
|
-
return { default: MarkSpacer };
|
|
1868
|
-
}
|
|
1869
|
-
});
|
|
1870
|
-
function BrandMark({ size, className }) {
|
|
1871
|
-
return /* @__PURE__ */ jsx8(Suspense, { fallback: /* @__PURE__ */ jsx8(MarkSpacer, { size }), children: /* @__PURE__ */ jsx8(LazyKnot, { size, className }) });
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
2037
|
// src/sequences-react/components/TimelineEmptyState.tsx
|
|
1875
|
-
import { jsx as
|
|
2038
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1876
2039
|
var DOOR_BUTTON = "flex min-h-[44px] items-center gap-2 rounded-md border border-[var(--border-default)] bg-[var(--bg-input)] px-3.5 py-2 text-xs font-medium text-[var(--text-secondary)] transition hover:border-[var(--brand-primary)] hover:text-[var(--text-primary)]";
|
|
1877
2040
|
function TimelineEmptyState(props) {
|
|
1878
2041
|
const labels = { ...DEFAULT_TIMELINE_LABELS, ...props.labels };
|
|
@@ -1893,19 +2056,19 @@ function TimelineEmptyState(props) {
|
|
|
1893
2056
|
className: "sticky left-0 flex min-h-[6rem] flex-col items-center justify-center gap-3 px-6 py-9 text-center",
|
|
1894
2057
|
style: { width: "100%" },
|
|
1895
2058
|
children: [
|
|
1896
|
-
/* @__PURE__ */
|
|
2059
|
+
/* @__PURE__ */ jsx8(BrandMark, { size: 28, className: "shrink-0 opacity-90" }),
|
|
1897
2060
|
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", children: [
|
|
1898
|
-
/* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm font-semibold text-[var(--text-primary)]", children: labels.emptyTitle }),
|
|
2062
|
+
/* @__PURE__ */ jsx8("p", { className: "max-w-sm text-xs text-[var(--text-muted)]", children: labels.emptyBody })
|
|
1900
2063
|
] }),
|
|
1901
|
-
doors.length > 0 ? /* @__PURE__ */
|
|
2064
|
+
doors.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap items-center justify-center gap-2 pt-1", children: doors.map(({ key, label, primary, icon: Icon, onClick }) => /* @__PURE__ */ jsxs6(
|
|
1902
2065
|
"button",
|
|
1903
2066
|
{
|
|
1904
2067
|
type: "button",
|
|
1905
2068
|
onClick,
|
|
1906
2069
|
className: primary ? "flex min-h-[44px] items-center gap-2 rounded-md bg-[var(--brand-primary)] px-3.5 py-2 text-xs font-semibold text-[hsl(var(--primary-foreground))] transition hover:opacity-90" : DOOR_BUTTON,
|
|
1907
2070
|
children: [
|
|
1908
|
-
/* @__PURE__ */
|
|
2071
|
+
/* @__PURE__ */ jsx8(Icon, { className: "h-4 w-4 shrink-0" }),
|
|
1909
2072
|
label
|
|
1910
2073
|
]
|
|
1911
2074
|
},
|
|
@@ -1917,7 +2080,7 @@ function TimelineEmptyState(props) {
|
|
|
1917
2080
|
}
|
|
1918
2081
|
|
|
1919
2082
|
// src/sequences-react/components/TimelineGhostLanes.tsx
|
|
1920
|
-
import { jsx as
|
|
2083
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1921
2084
|
function GhostLane({
|
|
1922
2085
|
label,
|
|
1923
2086
|
icon: Icon,
|
|
@@ -1930,23 +2093,23 @@ function GhostLane({
|
|
|
1930
2093
|
{
|
|
1931
2094
|
className: `sticky left-0 z-10 flex w-36 shrink-0 items-center gap-2 border-r border-[var(--border-soft)] bg-[var(--bg-input)] px-2.5 ${height}`,
|
|
1932
2095
|
children: [
|
|
1933
|
-
/* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
2096
|
+
/* @__PURE__ */ jsx9(Icon, { className: "h-3.5 w-3.5 shrink-0 text-[var(--text-muted)]" }),
|
|
2097
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate text-xs font-medium text-[var(--text-muted)]", children: label })
|
|
1935
2098
|
]
|
|
1936
2099
|
}
|
|
1937
2100
|
),
|
|
1938
|
-
/* @__PURE__ */
|
|
2101
|
+
/* @__PURE__ */ jsx9("div", { className: `${height}`, style: { width: `${laneWidth}px` } })
|
|
1939
2102
|
] });
|
|
1940
2103
|
}
|
|
1941
2104
|
function TimelineGhostLanes({ laneWidth, videoLabel, captionLabel }) {
|
|
1942
2105
|
return /* @__PURE__ */ jsxs7("div", { "data-timeline-ghost-lanes": true, "aria-hidden": true, className: "pointer-events-none absolute inset-0", children: [
|
|
1943
|
-
/* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ jsx9(GhostLane, { label: videoLabel, icon: FilmGlyph, height: "h-16", laneWidth }),
|
|
2107
|
+
/* @__PURE__ */ jsx9(GhostLane, { label: captionLabel, icon: CaptionGlyph, height: "h-9", laneWidth })
|
|
1945
2108
|
] });
|
|
1946
2109
|
}
|
|
1947
2110
|
|
|
1948
2111
|
// src/sequences-react/components/TimelineSmallScreenGate.tsx
|
|
1949
|
-
import { jsx as
|
|
2112
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1950
2113
|
function TimelineSmallScreenGate({ labels }) {
|
|
1951
2114
|
const copy = { ...DEFAULT_TIMELINE_LABELS, ...labels };
|
|
1952
2115
|
return /* @__PURE__ */ jsxs8(
|
|
@@ -1955,16 +2118,16 @@ function TimelineSmallScreenGate({ labels }) {
|
|
|
1955
2118
|
"data-timeline-small-screen": true,
|
|
1956
2119
|
className: "flex h-full min-h-0 flex-col items-center justify-center gap-3 bg-[var(--bg-input)] px-8 py-12 text-center text-[var(--text-primary)] sm:hidden",
|
|
1957
2120
|
children: [
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
2121
|
+
/* @__PURE__ */ jsx10(BrandMark, { size: 32, className: "shrink-0 opacity-90" }),
|
|
2122
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm font-semibold", children: copy.smallScreenTitle }),
|
|
2123
|
+
/* @__PURE__ */ jsx10("p", { className: "max-w-xs text-sm text-[var(--text-muted)]", children: copy.smallScreenBody })
|
|
1961
2124
|
]
|
|
1962
2125
|
}
|
|
1963
2126
|
);
|
|
1964
2127
|
}
|
|
1965
2128
|
|
|
1966
2129
|
// src/sequences-react/components/ZoomControl.tsx
|
|
1967
|
-
import { jsx as
|
|
2130
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1968
2131
|
function zoomPercent(zoom, fitZoom) {
|
|
1969
2132
|
const base = fitZoom && fitZoom > 0 ? fitZoom : 1;
|
|
1970
2133
|
return Math.round(zoom / base * 100);
|
|
@@ -1981,17 +2144,17 @@ function ZoomControl({ zoomMath, zoom, onZoomChange, fitZoom }) {
|
|
|
1981
2144
|
onZoomChange(zoomMath.sliderToZoom(clamped));
|
|
1982
2145
|
}
|
|
1983
2146
|
return /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1.5", children: [
|
|
1984
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ jsx11(
|
|
1985
2148
|
"button",
|
|
1986
2149
|
{
|
|
1987
2150
|
type: "button",
|
|
1988
2151
|
"aria-label": "Zoom out",
|
|
1989
2152
|
onClick: () => setSlider(slider - sliderStep * 10),
|
|
1990
2153
|
className: ZOOM_STEP_BUTTON,
|
|
1991
|
-
children: /* @__PURE__ */
|
|
2154
|
+
children: /* @__PURE__ */ jsx11(MinusGlyph, { className: "h-3.5 w-3.5" })
|
|
1992
2155
|
}
|
|
1993
2156
|
),
|
|
1994
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx11(
|
|
1995
2158
|
"input",
|
|
1996
2159
|
{
|
|
1997
2160
|
type: "range",
|
|
@@ -2005,14 +2168,14 @@ function ZoomControl({ zoomMath, zoom, onZoomChange, fitZoom }) {
|
|
|
2005
2168
|
className: "hidden h-1 w-24 cursor-pointer accent-[var(--brand-primary)] sm:block"
|
|
2006
2169
|
}
|
|
2007
2170
|
),
|
|
2008
|
-
/* @__PURE__ */
|
|
2171
|
+
/* @__PURE__ */ jsx11(
|
|
2009
2172
|
"button",
|
|
2010
2173
|
{
|
|
2011
2174
|
type: "button",
|
|
2012
2175
|
"aria-label": "Zoom in",
|
|
2013
2176
|
onClick: () => setSlider(slider + sliderStep * 10),
|
|
2014
2177
|
className: ZOOM_STEP_BUTTON,
|
|
2015
|
-
children: /* @__PURE__ */
|
|
2178
|
+
children: /* @__PURE__ */ jsx11(PlusGlyph, { className: "h-3.5 w-3.5" })
|
|
2016
2179
|
}
|
|
2017
2180
|
),
|
|
2018
2181
|
/* @__PURE__ */ jsxs9(
|
|
@@ -2032,9 +2195,8 @@ function ZoomControl({ zoomMath, zoom, onZoomChange, fitZoom }) {
|
|
|
2032
2195
|
}
|
|
2033
2196
|
|
|
2034
2197
|
// src/sequences-react/components/TimelineEditor.tsx
|
|
2035
|
-
import { Fragment as Fragment3, jsx as
|
|
2198
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2036
2199
|
var SEQUENCE_MEDIA_DRAG_TYPE = "application/x-sequence-media";
|
|
2037
|
-
var HISTORY_MIRROR_LIMIT = 200;
|
|
2038
2200
|
var MIN_ZOOM = 5e-3;
|
|
2039
2201
|
var MAX_ZOOM = 24;
|
|
2040
2202
|
var TRACK_HEADER_PX = 144;
|
|
@@ -2058,7 +2220,7 @@ function parseMediaDragPayload(raw) {
|
|
|
2058
2220
|
}
|
|
2059
2221
|
return parsed;
|
|
2060
2222
|
}
|
|
2061
|
-
function
|
|
2223
|
+
function useTimelineEditorViewState(props) {
|
|
2062
2224
|
const { canWrite, onApplyOperations } = props;
|
|
2063
2225
|
const fps = props.timeline.sequence.fps;
|
|
2064
2226
|
const durationFrames = props.timeline.sequence.durationFrames;
|
|
@@ -2164,97 +2326,379 @@ function TimelineEditor(props) {
|
|
|
2164
2326
|
}, [timeline.clips]);
|
|
2165
2327
|
const historyRef = useRef3({ done: [], undone: [] });
|
|
2166
2328
|
const clipIdAliasesRef = useRef3(/* @__PURE__ */ new Map());
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2329
|
+
const {
|
|
2330
|
+
resolveClipId,
|
|
2331
|
+
reconcileCreatedClipIds,
|
|
2332
|
+
commitCommand,
|
|
2333
|
+
undoLast,
|
|
2334
|
+
redoLast
|
|
2335
|
+
} = createTimelineHistoryHandlers({
|
|
2336
|
+
clipIdAliasesRef,
|
|
2337
|
+
setCommitError,
|
|
2338
|
+
canWrite,
|
|
2339
|
+
stack,
|
|
2340
|
+
historyRef,
|
|
2341
|
+
onApplyOperations
|
|
2342
|
+
});
|
|
2343
|
+
const {
|
|
2344
|
+
handleCommitMove,
|
|
2345
|
+
handleCommitTrim,
|
|
2346
|
+
handleCommitText,
|
|
2347
|
+
deleteSelection,
|
|
2348
|
+
deleteClip,
|
|
2349
|
+
focusStepClip,
|
|
2350
|
+
stepPlayhead,
|
|
2351
|
+
nudgeSelectedClip,
|
|
2352
|
+
splittableClip,
|
|
2353
|
+
splitAtPlayhead,
|
|
2354
|
+
addCaptionAtPlayhead,
|
|
2355
|
+
selectClip
|
|
2356
|
+
} = createTimelineEditHandlers({
|
|
2357
|
+
stack,
|
|
2358
|
+
commitCommand,
|
|
2359
|
+
resolveClipId,
|
|
2360
|
+
selectedClips,
|
|
2361
|
+
setSelectedClipIds,
|
|
2362
|
+
orderedClipIds,
|
|
2363
|
+
trackViewportRef,
|
|
2364
|
+
playheadFrameRef,
|
|
2365
|
+
clock,
|
|
2366
|
+
canWrite,
|
|
2367
|
+
selectedClipIds,
|
|
2368
|
+
playheadFrame,
|
|
2369
|
+
setCommitError,
|
|
2370
|
+
fps
|
|
2371
|
+
});
|
|
2372
|
+
function snapMove(candidate) {
|
|
2373
|
+
if (!snapEnabled) return { startFrame: candidate.startFrame, point: null };
|
|
2374
|
+
const points = collectSnapPoints(timeline, playheadFrame);
|
|
2375
|
+
const exclude = (point) => point.clipId === candidate.clipId;
|
|
2376
|
+
return chooseMoveSnap({
|
|
2377
|
+
candidateStartFrame: candidate.startFrame,
|
|
2378
|
+
durationFrames: candidate.durationFrames,
|
|
2379
|
+
startSnap: applySnap(candidate.startFrame, points, { zoom, exclude }),
|
|
2380
|
+
endSnap: applySnap(candidate.startFrame + candidate.durationFrames, points, { zoom, exclude })
|
|
2187
2381
|
});
|
|
2188
2382
|
}
|
|
2189
|
-
function
|
|
2190
|
-
if (!
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
return;
|
|
2196
|
-
}
|
|
2197
|
-
const history = historyRef.current;
|
|
2198
|
-
const entry = { command, createdLocalIds };
|
|
2199
|
-
history.done.push(entry);
|
|
2200
|
-
if (history.done.length > HISTORY_MIRROR_LIMIT) history.done.splice(0, history.done.length - HISTORY_MIRROR_LIMIT);
|
|
2201
|
-
history.undone = [];
|
|
2202
|
-
setCommitError(null);
|
|
2203
|
-
const operations = command.operations();
|
|
2204
|
-
void onApplyOperations(operations).then((results) => reconcileCreatedClipIds(operations, createdLocalIds, results)).catch((error) => {
|
|
2205
|
-
const mirror = historyRef.current;
|
|
2206
|
-
if (mirror.done[mirror.done.length - 1] === entry && stack.canUndo()) {
|
|
2207
|
-
stack.undo();
|
|
2208
|
-
mirror.done.pop();
|
|
2209
|
-
}
|
|
2210
|
-
setCommitError(error instanceof Error ? error.message : String(error));
|
|
2383
|
+
function snapEdge(candidate) {
|
|
2384
|
+
if (!snapEnabled) return { frame: candidate.frame, point: null };
|
|
2385
|
+
const points = collectSnapPoints(timeline, playheadFrame);
|
|
2386
|
+
const result = applySnap(candidate.frame, points, {
|
|
2387
|
+
zoom,
|
|
2388
|
+
exclude: (point) => point.clipId === candidate.clipId
|
|
2211
2389
|
});
|
|
2390
|
+
return { frame: result.frame, point: result.point };
|
|
2212
2391
|
}
|
|
2213
|
-
function
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
try {
|
|
2218
|
-
stack.undo();
|
|
2219
|
-
} catch (error) {
|
|
2220
|
-
setCommitError(`Undo failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
2221
|
-
return;
|
|
2222
|
-
}
|
|
2223
|
-
history.done.pop();
|
|
2224
|
-
history.undone.push(entry);
|
|
2225
|
-
void onApplyOperations(entry.command.inverseOperations()).catch((error) => {
|
|
2226
|
-
const mirror = historyRef.current;
|
|
2227
|
-
if (mirror.undone[mirror.undone.length - 1] === entry && stack.canRedo()) {
|
|
2228
|
-
stack.redo();
|
|
2229
|
-
mirror.undone.pop();
|
|
2230
|
-
mirror.done.push(entry);
|
|
2231
|
-
}
|
|
2232
|
-
setCommitError(error instanceof Error ? error.message : String(error));
|
|
2233
|
-
});
|
|
2392
|
+
function togglePlayback() {
|
|
2393
|
+
if (clock.isPlaying()) clock.pause();
|
|
2394
|
+
else clock.play();
|
|
2395
|
+
setIsPlaying(clock.isPlaying());
|
|
2234
2396
|
}
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
} catch (error) {
|
|
2242
|
-
setCommitError(`Redo failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
2243
|
-
return;
|
|
2244
|
-
}
|
|
2245
|
-
history.undone.pop();
|
|
2246
|
-
history.done.push(entry);
|
|
2247
|
-
const operations = entry.command.operations();
|
|
2248
|
-
void onApplyOperations(operations).then((results) => reconcileCreatedClipIds(operations, entry.createdLocalIds, results)).catch((error) => {
|
|
2249
|
-
const mirror = historyRef.current;
|
|
2250
|
-
if (mirror.done[mirror.done.length - 1] === entry && stack.canUndo()) {
|
|
2251
|
-
stack.undo();
|
|
2252
|
-
mirror.done.pop();
|
|
2253
|
-
mirror.undone.push(entry);
|
|
2397
|
+
useEffect3(() => {
|
|
2398
|
+
function onKeyDown(event) {
|
|
2399
|
+
if (event.code === "Space" && !isTypingTarget(event.target)) {
|
|
2400
|
+
event.preventDefault();
|
|
2401
|
+
togglePlayback();
|
|
2402
|
+
return;
|
|
2254
2403
|
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2404
|
+
if ((event.key === "Delete" || event.key === "Backspace") && !isTypingTarget(event.target)) {
|
|
2405
|
+
if (!canWrite) return;
|
|
2406
|
+
event.preventDefault();
|
|
2407
|
+
deleteSelection();
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && !isTypingTarget(event.target)) {
|
|
2411
|
+
const direction = event.key === "ArrowLeft" ? -1 : 1;
|
|
2412
|
+
if (event.altKey) {
|
|
2413
|
+
event.preventDefault();
|
|
2414
|
+
nudgeSelectedClip(direction);
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
if (event.target instanceof Element && event.target.closest("[data-clip-id]")) return;
|
|
2418
|
+
event.preventDefault();
|
|
2419
|
+
stepPlayhead(direction * (event.shiftKey ? 10 : 1));
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
const mod = event.metaKey || event.ctrlKey;
|
|
2423
|
+
if (!mod || isTypingTarget(event.target)) return;
|
|
2424
|
+
if (event.key.toLowerCase() === "z") {
|
|
2425
|
+
event.preventDefault();
|
|
2426
|
+
if (event.shiftKey) redoLast();
|
|
2427
|
+
else undoLast();
|
|
2428
|
+
} else if (event.key.toLowerCase() === "y") {
|
|
2429
|
+
event.preventDefault();
|
|
2430
|
+
redoLast();
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
window.addEventListener("keydown", onKeyDown);
|
|
2434
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2435
|
+
});
|
|
2436
|
+
const { handleTrackAreaDragOver, handleTrackAreaDrop } = createTimelineDropHandlers({
|
|
2437
|
+
canWrite,
|
|
2438
|
+
setCommitError,
|
|
2439
|
+
stack,
|
|
2440
|
+
zoom,
|
|
2441
|
+
fps,
|
|
2442
|
+
commitCommand,
|
|
2443
|
+
resolveClipId
|
|
2444
|
+
});
|
|
2445
|
+
const timelineWidth = timeline.sequence.durationFrames * zoom;
|
|
2446
|
+
return {
|
|
2447
|
+
props,
|
|
2448
|
+
timeline,
|
|
2449
|
+
clock,
|
|
2450
|
+
frameProvider,
|
|
2451
|
+
isPlaying,
|
|
2452
|
+
togglePlayback,
|
|
2453
|
+
playheadFrame,
|
|
2454
|
+
fps,
|
|
2455
|
+
stack,
|
|
2456
|
+
canWrite,
|
|
2457
|
+
undoLast,
|
|
2458
|
+
redoLast,
|
|
2459
|
+
snapEnabled,
|
|
2460
|
+
setSnapEnabled,
|
|
2461
|
+
labels,
|
|
2462
|
+
splittableClip,
|
|
2463
|
+
splitAtPlayhead,
|
|
2464
|
+
addCaptionAtPlayhead,
|
|
2465
|
+
zoomMath,
|
|
2466
|
+
zoom,
|
|
2467
|
+
setZoom,
|
|
2468
|
+
fitZoom,
|
|
2469
|
+
commitError,
|
|
2470
|
+
setCommitError,
|
|
2471
|
+
trackViewportRef,
|
|
2472
|
+
handleTrackAreaDragOver,
|
|
2473
|
+
handleTrackAreaDrop,
|
|
2474
|
+
timelineWidth,
|
|
2475
|
+
sortedTracks,
|
|
2476
|
+
clipsByTrack,
|
|
2477
|
+
selectedClipIds,
|
|
2478
|
+
tabbableClipId,
|
|
2479
|
+
snapMove,
|
|
2480
|
+
snapEdge,
|
|
2481
|
+
setActiveSnapPoint,
|
|
2482
|
+
selectClip,
|
|
2483
|
+
deleteClip,
|
|
2484
|
+
focusStepClip,
|
|
2485
|
+
handleCommitMove,
|
|
2486
|
+
handleCommitTrim,
|
|
2487
|
+
handleCommitText,
|
|
2488
|
+
activeSnapPoint,
|
|
2489
|
+
selectedClips
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
function TimelineEditor(props) {
|
|
2493
|
+
const view = useTimelineEditorViewState(props);
|
|
2494
|
+
return /* @__PURE__ */ jsx12(TimelineEditorView, { ...view });
|
|
2495
|
+
}
|
|
2496
|
+
function TimelineEditorView({
|
|
2497
|
+
props,
|
|
2498
|
+
timeline,
|
|
2499
|
+
clock,
|
|
2500
|
+
frameProvider,
|
|
2501
|
+
isPlaying,
|
|
2502
|
+
togglePlayback,
|
|
2503
|
+
playheadFrame,
|
|
2504
|
+
fps,
|
|
2505
|
+
stack,
|
|
2506
|
+
canWrite,
|
|
2507
|
+
undoLast,
|
|
2508
|
+
redoLast,
|
|
2509
|
+
snapEnabled,
|
|
2510
|
+
setSnapEnabled,
|
|
2511
|
+
labels,
|
|
2512
|
+
splittableClip,
|
|
2513
|
+
splitAtPlayhead,
|
|
2514
|
+
addCaptionAtPlayhead,
|
|
2515
|
+
zoomMath,
|
|
2516
|
+
zoom,
|
|
2517
|
+
setZoom,
|
|
2518
|
+
fitZoom,
|
|
2519
|
+
commitError,
|
|
2520
|
+
setCommitError,
|
|
2521
|
+
trackViewportRef,
|
|
2522
|
+
handleTrackAreaDragOver,
|
|
2523
|
+
handleTrackAreaDrop,
|
|
2524
|
+
timelineWidth,
|
|
2525
|
+
sortedTracks,
|
|
2526
|
+
clipsByTrack,
|
|
2527
|
+
selectedClipIds,
|
|
2528
|
+
tabbableClipId,
|
|
2529
|
+
snapMove,
|
|
2530
|
+
snapEdge,
|
|
2531
|
+
setActiveSnapPoint,
|
|
2532
|
+
selectClip,
|
|
2533
|
+
deleteClip,
|
|
2534
|
+
focusStepClip,
|
|
2535
|
+
handleCommitMove,
|
|
2536
|
+
handleCommitTrim,
|
|
2537
|
+
handleCommitText,
|
|
2538
|
+
activeSnapPoint,
|
|
2539
|
+
selectedClips
|
|
2540
|
+
}) {
|
|
2541
|
+
return /* @__PURE__ */ jsxs10("div", { className: `flex h-full min-h-0 flex-col bg-[var(--bg-input)] text-[var(--text-primary)] ${props.className ?? ""}`, children: [
|
|
2542
|
+
/* @__PURE__ */ jsx12(TimelineSmallScreenGate, { labels: props.labels }),
|
|
2543
|
+
/* @__PURE__ */ jsxs10("div", { className: "hidden min-h-0 flex-1 flex-col sm:flex lg:flex-row", children: [
|
|
2544
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
2545
|
+
/* @__PURE__ */ jsx12(PreviewCanvas, { timeline, clock, frameProvider }),
|
|
2546
|
+
/* @__PURE__ */ jsxs10("div", { "aria-label": "Timeline controls", className: "flex h-11 shrink-0 items-center gap-1.5 overflow-x-auto border-y border-[var(--border-default)] px-2", children: [
|
|
2547
|
+
/* @__PURE__ */ jsx12(
|
|
2548
|
+
"button",
|
|
2549
|
+
{
|
|
2550
|
+
type: "button",
|
|
2551
|
+
"aria-label": isPlaying ? "Pause" : "Play",
|
|
2552
|
+
onClick: togglePlayback,
|
|
2553
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-[var(--brand-primary)] text-[hsl(var(--primary-foreground))] transition hover:opacity-90",
|
|
2554
|
+
children: isPlaying ? /* @__PURE__ */ jsx12(PauseGlyph, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx12(PlayGlyph, { className: "h-4 w-4" })
|
|
2555
|
+
}
|
|
2556
|
+
),
|
|
2557
|
+
/* @__PURE__ */ jsxs10("span", { className: "shrink-0 font-mono text-xs tabular-nums text-[var(--text-secondary)]", children: [
|
|
2558
|
+
formatTimecode(playheadFrame, fps),
|
|
2559
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-[var(--text-muted)]", children: [
|
|
2560
|
+
" / ",
|
|
2561
|
+
formatTimecode(timeline.sequence.durationFrames, fps)
|
|
2562
|
+
] })
|
|
2563
|
+
] }),
|
|
2564
|
+
/* @__PURE__ */ jsx12("div", { className: CLUSTER_DIVIDER }),
|
|
2565
|
+
/* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Undo", disabled: !stack.canUndo() || !canWrite, onClick: undoLast, className: TRANSPORT_BUTTON, children: /* @__PURE__ */ jsx12(UndoGlyph, { className: "h-3.5 w-3.5" }) }),
|
|
2566
|
+
/* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Redo", disabled: !stack.canRedo() || !canWrite, onClick: redoLast, className: TRANSPORT_BUTTON, children: /* @__PURE__ */ jsx12(RedoGlyph, { className: "h-3.5 w-3.5" }) }),
|
|
2567
|
+
/* @__PURE__ */ jsx12(
|
|
2568
|
+
"button",
|
|
2569
|
+
{
|
|
2570
|
+
type: "button",
|
|
2571
|
+
"aria-label": "Toggle snapping",
|
|
2572
|
+
"aria-pressed": snapEnabled,
|
|
2573
|
+
onClick: () => setSnapEnabled((current) => !current),
|
|
2574
|
+
className: `${TRANSPORT_BUTTON} ${snapEnabled ? "border-[var(--brand-primary)] text-[var(--brand-primary)] hover:text-[var(--brand-primary)]" : ""}`,
|
|
2575
|
+
children: /* @__PURE__ */ jsx12(MagnetGlyph, { className: "h-3.5 w-3.5" })
|
|
2576
|
+
}
|
|
2577
|
+
),
|
|
2578
|
+
canWrite ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2579
|
+
/* @__PURE__ */ jsx12("div", { className: CLUSTER_DIVIDER }),
|
|
2580
|
+
/* @__PURE__ */ jsxs10("button", { type: "button", "aria-label": labels.splitClipAriaLabel, disabled: !splittableClip, onClick: splitAtPlayhead, className: EDIT_TOOL_BUTTON, children: [
|
|
2581
|
+
/* @__PURE__ */ jsx12(ScissorsGlyph, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2582
|
+
/* @__PURE__ */ jsx12("span", { className: "hidden md:inline", children: labels.splitClip })
|
|
2583
|
+
] }),
|
|
2584
|
+
/* @__PURE__ */ jsxs10("button", { type: "button", "aria-label": labels.addCaptionAriaLabel, onClick: addCaptionAtPlayhead, className: EDIT_TOOL_BUTTON, children: [
|
|
2585
|
+
/* @__PURE__ */ jsx12(CaptionPlusGlyph, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2586
|
+
/* @__PURE__ */ jsx12("span", { className: "hidden md:inline", children: labels.addCaption })
|
|
2587
|
+
] })
|
|
2588
|
+
] }) : null,
|
|
2589
|
+
/* @__PURE__ */ jsx12("div", { className: "min-w-2 flex-1" }),
|
|
2590
|
+
/* @__PURE__ */ jsx12(ZoomControl, { zoomMath, zoom, onZoomChange: setZoom, fitZoom }),
|
|
2591
|
+
props.onCreateExport ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2592
|
+
/* @__PURE__ */ jsx12("div", { className: CLUSTER_DIVIDER }),
|
|
2593
|
+
/* @__PURE__ */ jsxs10(
|
|
2594
|
+
"button",
|
|
2595
|
+
{
|
|
2596
|
+
type: "button",
|
|
2597
|
+
"aria-label": labels.createExport,
|
|
2598
|
+
onClick: props.onCreateExport,
|
|
2599
|
+
className: "flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[var(--brand-primary)] px-2.5 text-xs font-semibold text-[var(--brand-primary)] transition hover:bg-[hsl(var(--primary)/0.1)]",
|
|
2600
|
+
children: [
|
|
2601
|
+
/* @__PURE__ */ jsx12(ExportGlyph, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2602
|
+
/* @__PURE__ */ jsx12("span", { className: "hidden md:inline", children: labels.createExport })
|
|
2603
|
+
]
|
|
2604
|
+
}
|
|
2605
|
+
)
|
|
2606
|
+
] }) : null
|
|
2607
|
+
] }),
|
|
2608
|
+
commitError ? /* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-3 py-1.5 text-xs text-[var(--text-danger)]", role: "alert", children: [
|
|
2609
|
+
/* @__PURE__ */ jsx12("span", { className: "min-w-0 truncate", children: commitError }),
|
|
2610
|
+
/* @__PURE__ */ jsx12("button", { type: "button", onClick: () => setCommitError(null), className: "shrink-0 underline-offset-2 hover:underline", children: "Dismiss" })
|
|
2611
|
+
] }) : null,
|
|
2612
|
+
props.renderAssetShelf ? /* @__PURE__ */ jsx12("div", { className: "shrink-0 border-b border-[var(--border-default)]", children: props.renderAssetShelf() }) : null,
|
|
2613
|
+
/* @__PURE__ */ jsx12(
|
|
2614
|
+
"div",
|
|
2615
|
+
{
|
|
2616
|
+
ref: trackViewportRef,
|
|
2617
|
+
"data-timeline-tracks": true,
|
|
2618
|
+
className: "relative max-h-60 min-h-[6rem] shrink-0 overflow-auto overscroll-x-contain",
|
|
2619
|
+
onDragOver: handleTrackAreaDragOver,
|
|
2620
|
+
onDrop: handleTrackAreaDrop,
|
|
2621
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "relative", style: { width: `${TRACK_HEADER_PX + timelineWidth}px`, minWidth: "100%" }, children: [
|
|
2622
|
+
/* @__PURE__ */ jsxs10("div", { className: "sticky top-0 z-20 flex", children: [
|
|
2623
|
+
/* @__PURE__ */ jsx12("div", { className: "sticky left-0 z-30 w-36 shrink-0 border-b border-r border-[var(--border-default)] bg-[var(--bg-input)]" }),
|
|
2624
|
+
/* @__PURE__ */ jsx12(TimelineRuler, { fps, durationFrames: timeline.sequence.durationFrames, zoom, onScrub: (frame) => clock.seek(frame) })
|
|
2625
|
+
] }),
|
|
2626
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative", children: [
|
|
2627
|
+
sortedTracks.length === 0 ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2628
|
+
/* @__PURE__ */ jsx12(
|
|
2629
|
+
TimelineGhostLanes,
|
|
2630
|
+
{
|
|
2631
|
+
laneWidth: timelineWidth,
|
|
2632
|
+
videoLabel: labels.ghostVideoLane,
|
|
2633
|
+
captionLabel: labels.ghostCaptionLane
|
|
2634
|
+
}
|
|
2635
|
+
),
|
|
2636
|
+
/* @__PURE__ */ jsx12(
|
|
2637
|
+
TimelineEmptyState,
|
|
2638
|
+
{
|
|
2639
|
+
labels: props.labels,
|
|
2640
|
+
brandedExport: props.brandedExport,
|
|
2641
|
+
...props.onStartFromTemplate ? { onStartFromTemplate: props.onStartFromTemplate } : {},
|
|
2642
|
+
...props.onAddClip ? { onAddClip: props.onAddClip } : {},
|
|
2643
|
+
...props.onAskAgent ? { onAskAgent: props.onAskAgent } : {}
|
|
2644
|
+
}
|
|
2645
|
+
)
|
|
2646
|
+
] }) : null,
|
|
2647
|
+
sortedTracks.map((track) => /* @__PURE__ */ jsx12(
|
|
2648
|
+
TimelineTrackRow,
|
|
2649
|
+
{
|
|
2650
|
+
track,
|
|
2651
|
+
clips: clipsByTrack.get(track.id) ?? [],
|
|
2652
|
+
fps,
|
|
2653
|
+
zoom,
|
|
2654
|
+
sequenceDurationFrames: timeline.sequence.durationFrames,
|
|
2655
|
+
selectedClipIds: new Set(selectedClipIds),
|
|
2656
|
+
tabbableClipId,
|
|
2657
|
+
canWrite,
|
|
2658
|
+
frameProvider,
|
|
2659
|
+
snapMove,
|
|
2660
|
+
snapEdge,
|
|
2661
|
+
onSnapPointChange: setActiveSnapPoint,
|
|
2662
|
+
onSelectClip: selectClip,
|
|
2663
|
+
onRequestDeleteClip: deleteClip,
|
|
2664
|
+
onFocusStepClip: focusStepClip,
|
|
2665
|
+
onCommitMove: handleCommitMove,
|
|
2666
|
+
onCommitTrim: handleCommitTrim,
|
|
2667
|
+
onCommitText: handleCommitText,
|
|
2668
|
+
onLaneSeek: (frame) => clock.seek(frame)
|
|
2669
|
+
},
|
|
2670
|
+
track.id
|
|
2671
|
+
)),
|
|
2672
|
+
/* @__PURE__ */ jsxs10("div", { className: "pointer-events-none absolute inset-y-0", style: { left: `${TRACK_HEADER_PX}px`, width: `${timelineWidth}px` }, children: [
|
|
2673
|
+
/* @__PURE__ */ jsx12(TimelinePlayhead, { frame: playheadFrame, zoom }),
|
|
2674
|
+
/* @__PURE__ */ jsx12(SnapIndicatorLine, { point: activeSnapPoint, zoom })
|
|
2675
|
+
] })
|
|
2676
|
+
] })
|
|
2677
|
+
] })
|
|
2678
|
+
}
|
|
2679
|
+
)
|
|
2680
|
+
] }),
|
|
2681
|
+
props.renderSidePanel ? /* @__PURE__ */ jsx12("aside", { className: "flex max-h-72 shrink-0 flex-col overflow-hidden border-t border-[var(--border-default)] lg:max-h-none lg:w-80 lg:border-l lg:border-t-0", children: props.renderSidePanel({ selectedClips, playheadFrame }) }) : null
|
|
2682
|
+
] })
|
|
2683
|
+
] });
|
|
2684
|
+
}
|
|
2685
|
+
var TimelineEditor_default = TimelineEditor;
|
|
2686
|
+
function createTimelineEditHandlers({
|
|
2687
|
+
stack,
|
|
2688
|
+
commitCommand,
|
|
2689
|
+
resolveClipId,
|
|
2690
|
+
selectedClips,
|
|
2691
|
+
setSelectedClipIds,
|
|
2692
|
+
orderedClipIds,
|
|
2693
|
+
trackViewportRef,
|
|
2694
|
+
playheadFrameRef,
|
|
2695
|
+
clock,
|
|
2696
|
+
canWrite,
|
|
2697
|
+
selectedClipIds,
|
|
2698
|
+
playheadFrame,
|
|
2699
|
+
setCommitError,
|
|
2700
|
+
fps
|
|
2701
|
+
}) {
|
|
2258
2702
|
function handleCommitMove(input) {
|
|
2259
2703
|
const current = stack.getState().timeline;
|
|
2260
2704
|
const clip = current.clips.find((candidate) => candidate.id === input.clipId);
|
|
@@ -2389,70 +2833,30 @@ function TimelineEditor(props) {
|
|
|
2389
2833
|
return current.includes(clipId) ? current.filter((id) => id !== clipId) : [...current, clipId];
|
|
2390
2834
|
});
|
|
2391
2835
|
}
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
}
|
|
2417
|
-
useEffect3(() => {
|
|
2418
|
-
function onKeyDown(event) {
|
|
2419
|
-
if (event.code === "Space" && !isTypingTarget(event.target)) {
|
|
2420
|
-
event.preventDefault();
|
|
2421
|
-
togglePlayback();
|
|
2422
|
-
return;
|
|
2423
|
-
}
|
|
2424
|
-
if ((event.key === "Delete" || event.key === "Backspace") && !isTypingTarget(event.target)) {
|
|
2425
|
-
if (!canWrite) return;
|
|
2426
|
-
event.preventDefault();
|
|
2427
|
-
deleteSelection();
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && !isTypingTarget(event.target)) {
|
|
2431
|
-
const direction = event.key === "ArrowLeft" ? -1 : 1;
|
|
2432
|
-
if (event.altKey) {
|
|
2433
|
-
event.preventDefault();
|
|
2434
|
-
nudgeSelectedClip(direction);
|
|
2435
|
-
return;
|
|
2436
|
-
}
|
|
2437
|
-
if (event.target instanceof Element && event.target.closest("[data-clip-id]")) return;
|
|
2438
|
-
event.preventDefault();
|
|
2439
|
-
stepPlayhead(direction * (event.shiftKey ? 10 : 1));
|
|
2440
|
-
return;
|
|
2441
|
-
}
|
|
2442
|
-
const mod = event.metaKey || event.ctrlKey;
|
|
2443
|
-
if (!mod || isTypingTarget(event.target)) return;
|
|
2444
|
-
if (event.key.toLowerCase() === "z") {
|
|
2445
|
-
event.preventDefault();
|
|
2446
|
-
if (event.shiftKey) redoLast();
|
|
2447
|
-
else undoLast();
|
|
2448
|
-
} else if (event.key.toLowerCase() === "y") {
|
|
2449
|
-
event.preventDefault();
|
|
2450
|
-
redoLast();
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
window.addEventListener("keydown", onKeyDown);
|
|
2454
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2455
|
-
});
|
|
2836
|
+
return {
|
|
2837
|
+
handleCommitMove,
|
|
2838
|
+
handleCommitTrim,
|
|
2839
|
+
handleCommitText,
|
|
2840
|
+
deleteSelection,
|
|
2841
|
+
deleteClip,
|
|
2842
|
+
focusStepClip,
|
|
2843
|
+
stepPlayhead,
|
|
2844
|
+
nudgeSelectedClip,
|
|
2845
|
+
splittableClip,
|
|
2846
|
+
splitAtPlayhead,
|
|
2847
|
+
addCaptionAtPlayhead,
|
|
2848
|
+
selectClip
|
|
2849
|
+
};
|
|
2850
|
+
}
|
|
2851
|
+
function createTimelineDropHandlers({
|
|
2852
|
+
canWrite,
|
|
2853
|
+
setCommitError,
|
|
2854
|
+
stack,
|
|
2855
|
+
zoom,
|
|
2856
|
+
fps,
|
|
2857
|
+
commitCommand,
|
|
2858
|
+
resolveClipId
|
|
2859
|
+
}) {
|
|
2456
2860
|
function handleTrackAreaDragOver(event) {
|
|
2457
2861
|
if (!canWrite || !event.dataTransfer.types.includes(SEQUENCE_MEDIA_DRAG_TYPE)) return;
|
|
2458
2862
|
event.preventDefault();
|
|
@@ -2502,152 +2906,8 @@ function TimelineEditor(props) {
|
|
|
2502
2906
|
[clipId]
|
|
2503
2907
|
);
|
|
2504
2908
|
}
|
|
2505
|
-
|
|
2506
|
-
return /* @__PURE__ */ jsxs10("div", { className: `flex h-full min-h-0 flex-col bg-[var(--bg-input)] text-[var(--text-primary)] ${props.className ?? ""}`, children: [
|
|
2507
|
-
/* @__PURE__ */ jsx13(TimelineSmallScreenGate, { labels: props.labels }),
|
|
2508
|
-
/* @__PURE__ */ jsxs10("div", { className: "hidden min-h-0 flex-1 flex-col sm:flex lg:flex-row", children: [
|
|
2509
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
2510
|
-
/* @__PURE__ */ jsx13(PreviewCanvas, { timeline, clock, frameProvider }),
|
|
2511
|
-
/* @__PURE__ */ jsxs10("div", { "aria-label": "Timeline controls", className: "flex h-11 shrink-0 items-center gap-1.5 overflow-x-auto border-y border-[var(--border-default)] px-2", children: [
|
|
2512
|
-
/* @__PURE__ */ jsx13(
|
|
2513
|
-
"button",
|
|
2514
|
-
{
|
|
2515
|
-
type: "button",
|
|
2516
|
-
"aria-label": isPlaying ? "Pause" : "Play",
|
|
2517
|
-
onClick: togglePlayback,
|
|
2518
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-[var(--brand-primary)] text-[hsl(var(--primary-foreground))] transition hover:opacity-90",
|
|
2519
|
-
children: isPlaying ? /* @__PURE__ */ jsx13(PauseGlyph, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx13(PlayGlyph, { className: "h-4 w-4" })
|
|
2520
|
-
}
|
|
2521
|
-
),
|
|
2522
|
-
/* @__PURE__ */ jsxs10("span", { className: "shrink-0 font-mono text-xs tabular-nums text-[var(--text-secondary)]", children: [
|
|
2523
|
-
formatTimecode(playheadFrame, fps),
|
|
2524
|
-
/* @__PURE__ */ jsxs10("span", { className: "text-[var(--text-muted)]", children: [
|
|
2525
|
-
" / ",
|
|
2526
|
-
formatTimecode(timeline.sequence.durationFrames, fps)
|
|
2527
|
-
] })
|
|
2528
|
-
] }),
|
|
2529
|
-
/* @__PURE__ */ jsx13("div", { className: CLUSTER_DIVIDER }),
|
|
2530
|
-
/* @__PURE__ */ jsx13("button", { type: "button", "aria-label": "Undo", disabled: !stack.canUndo() || !canWrite, onClick: undoLast, className: TRANSPORT_BUTTON, children: /* @__PURE__ */ jsx13(UndoGlyph, { className: "h-3.5 w-3.5" }) }),
|
|
2531
|
-
/* @__PURE__ */ jsx13("button", { type: "button", "aria-label": "Redo", disabled: !stack.canRedo() || !canWrite, onClick: redoLast, className: TRANSPORT_BUTTON, children: /* @__PURE__ */ jsx13(RedoGlyph, { className: "h-3.5 w-3.5" }) }),
|
|
2532
|
-
/* @__PURE__ */ jsx13(
|
|
2533
|
-
"button",
|
|
2534
|
-
{
|
|
2535
|
-
type: "button",
|
|
2536
|
-
"aria-label": "Toggle snapping",
|
|
2537
|
-
"aria-pressed": snapEnabled,
|
|
2538
|
-
onClick: () => setSnapEnabled((current) => !current),
|
|
2539
|
-
className: `${TRANSPORT_BUTTON} ${snapEnabled ? "border-[var(--brand-primary)] text-[var(--brand-primary)] hover:text-[var(--brand-primary)]" : ""}`,
|
|
2540
|
-
children: /* @__PURE__ */ jsx13(MagnetGlyph, { className: "h-3.5 w-3.5" })
|
|
2541
|
-
}
|
|
2542
|
-
),
|
|
2543
|
-
canWrite ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2544
|
-
/* @__PURE__ */ jsx13("div", { className: CLUSTER_DIVIDER }),
|
|
2545
|
-
/* @__PURE__ */ jsxs10("button", { type: "button", "aria-label": labels.splitClipAriaLabel, disabled: !splittableClip, onClick: splitAtPlayhead, className: EDIT_TOOL_BUTTON, children: [
|
|
2546
|
-
/* @__PURE__ */ jsx13(ScissorsGlyph, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2547
|
-
/* @__PURE__ */ jsx13("span", { className: "hidden md:inline", children: labels.splitClip })
|
|
2548
|
-
] }),
|
|
2549
|
-
/* @__PURE__ */ jsxs10("button", { type: "button", "aria-label": labels.addCaptionAriaLabel, onClick: addCaptionAtPlayhead, className: EDIT_TOOL_BUTTON, children: [
|
|
2550
|
-
/* @__PURE__ */ jsx13(CaptionPlusGlyph, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2551
|
-
/* @__PURE__ */ jsx13("span", { className: "hidden md:inline", children: labels.addCaption })
|
|
2552
|
-
] })
|
|
2553
|
-
] }) : null,
|
|
2554
|
-
/* @__PURE__ */ jsx13("div", { className: "min-w-2 flex-1" }),
|
|
2555
|
-
/* @__PURE__ */ jsx13(ZoomControl, { zoomMath, zoom, onZoomChange: setZoom, fitZoom }),
|
|
2556
|
-
props.onCreateExport ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2557
|
-
/* @__PURE__ */ jsx13("div", { className: CLUSTER_DIVIDER }),
|
|
2558
|
-
/* @__PURE__ */ jsxs10(
|
|
2559
|
-
"button",
|
|
2560
|
-
{
|
|
2561
|
-
type: "button",
|
|
2562
|
-
"aria-label": labels.createExport,
|
|
2563
|
-
onClick: props.onCreateExport,
|
|
2564
|
-
className: "flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[var(--brand-primary)] px-2.5 text-xs font-semibold text-[var(--brand-primary)] transition hover:bg-[hsl(var(--primary)/0.1)]",
|
|
2565
|
-
children: [
|
|
2566
|
-
/* @__PURE__ */ jsx13(ExportGlyph, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2567
|
-
/* @__PURE__ */ jsx13("span", { className: "hidden md:inline", children: labels.createExport })
|
|
2568
|
-
]
|
|
2569
|
-
}
|
|
2570
|
-
)
|
|
2571
|
-
] }) : null
|
|
2572
|
-
] }),
|
|
2573
|
-
commitError ? /* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-3 py-1.5 text-xs text-[var(--text-danger)]", role: "alert", children: [
|
|
2574
|
-
/* @__PURE__ */ jsx13("span", { className: "min-w-0 truncate", children: commitError }),
|
|
2575
|
-
/* @__PURE__ */ jsx13("button", { type: "button", onClick: () => setCommitError(null), className: "shrink-0 underline-offset-2 hover:underline", children: "Dismiss" })
|
|
2576
|
-
] }) : null,
|
|
2577
|
-
props.renderAssetShelf ? /* @__PURE__ */ jsx13("div", { className: "shrink-0 border-b border-[var(--border-default)]", children: props.renderAssetShelf() }) : null,
|
|
2578
|
-
/* @__PURE__ */ jsx13(
|
|
2579
|
-
"div",
|
|
2580
|
-
{
|
|
2581
|
-
ref: trackViewportRef,
|
|
2582
|
-
"data-timeline-tracks": true,
|
|
2583
|
-
className: "relative max-h-60 min-h-[6rem] shrink-0 overflow-auto overscroll-x-contain",
|
|
2584
|
-
onDragOver: handleTrackAreaDragOver,
|
|
2585
|
-
onDrop: handleTrackAreaDrop,
|
|
2586
|
-
children: /* @__PURE__ */ jsxs10("div", { className: "relative", style: { width: `${TRACK_HEADER_PX + timelineWidth}px`, minWidth: "100%" }, children: [
|
|
2587
|
-
/* @__PURE__ */ jsxs10("div", { className: "sticky top-0 z-20 flex", children: [
|
|
2588
|
-
/* @__PURE__ */ jsx13("div", { className: "sticky left-0 z-30 w-36 shrink-0 border-b border-r border-[var(--border-default)] bg-[var(--bg-input)]" }),
|
|
2589
|
-
/* @__PURE__ */ jsx13(TimelineRuler, { fps, durationFrames: timeline.sequence.durationFrames, zoom, onScrub: (frame) => clock.seek(frame) })
|
|
2590
|
-
] }),
|
|
2591
|
-
/* @__PURE__ */ jsxs10("div", { className: "relative", children: [
|
|
2592
|
-
sortedTracks.length === 0 ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2593
|
-
/* @__PURE__ */ jsx13(
|
|
2594
|
-
TimelineGhostLanes,
|
|
2595
|
-
{
|
|
2596
|
-
laneWidth: timelineWidth,
|
|
2597
|
-
videoLabel: labels.ghostVideoLane,
|
|
2598
|
-
captionLabel: labels.ghostCaptionLane
|
|
2599
|
-
}
|
|
2600
|
-
),
|
|
2601
|
-
/* @__PURE__ */ jsx13(
|
|
2602
|
-
TimelineEmptyState,
|
|
2603
|
-
{
|
|
2604
|
-
labels: props.labels,
|
|
2605
|
-
brandedExport: props.brandedExport,
|
|
2606
|
-
...props.onStartFromTemplate ? { onStartFromTemplate: props.onStartFromTemplate } : {},
|
|
2607
|
-
...props.onAddClip ? { onAddClip: props.onAddClip } : {},
|
|
2608
|
-
...props.onAskAgent ? { onAskAgent: props.onAskAgent } : {}
|
|
2609
|
-
}
|
|
2610
|
-
)
|
|
2611
|
-
] }) : null,
|
|
2612
|
-
sortedTracks.map((track) => /* @__PURE__ */ jsx13(
|
|
2613
|
-
TimelineTrackRow,
|
|
2614
|
-
{
|
|
2615
|
-
track,
|
|
2616
|
-
clips: clipsByTrack.get(track.id) ?? [],
|
|
2617
|
-
fps,
|
|
2618
|
-
zoom,
|
|
2619
|
-
sequenceDurationFrames: timeline.sequence.durationFrames,
|
|
2620
|
-
selectedClipIds: new Set(selectedClipIds),
|
|
2621
|
-
tabbableClipId,
|
|
2622
|
-
canWrite,
|
|
2623
|
-
frameProvider,
|
|
2624
|
-
snapMove,
|
|
2625
|
-
snapEdge,
|
|
2626
|
-
onSnapPointChange: setActiveSnapPoint,
|
|
2627
|
-
onSelectClip: selectClip,
|
|
2628
|
-
onRequestDeleteClip: deleteClip,
|
|
2629
|
-
onFocusStepClip: focusStepClip,
|
|
2630
|
-
onCommitMove: handleCommitMove,
|
|
2631
|
-
onCommitTrim: handleCommitTrim,
|
|
2632
|
-
onCommitText: handleCommitText,
|
|
2633
|
-
onLaneSeek: (frame) => clock.seek(frame)
|
|
2634
|
-
},
|
|
2635
|
-
track.id
|
|
2636
|
-
)),
|
|
2637
|
-
/* @__PURE__ */ jsxs10("div", { className: "pointer-events-none absolute inset-y-0", style: { left: `${TRACK_HEADER_PX}px`, width: `${timelineWidth}px` }, children: [
|
|
2638
|
-
/* @__PURE__ */ jsx13(TimelinePlayhead, { frame: playheadFrame, zoom }),
|
|
2639
|
-
/* @__PURE__ */ jsx13(SnapIndicatorLine, { point: activeSnapPoint, zoom })
|
|
2640
|
-
] })
|
|
2641
|
-
] })
|
|
2642
|
-
] })
|
|
2643
|
-
}
|
|
2644
|
-
)
|
|
2645
|
-
] }),
|
|
2646
|
-
props.renderSidePanel ? /* @__PURE__ */ jsx13("aside", { className: "flex max-h-72 shrink-0 flex-col overflow-hidden border-t border-[var(--border-default)] lg:max-h-none lg:w-80 lg:border-l lg:border-t-0", children: props.renderSidePanel({ selectedClips, playheadFrame }) }) : null
|
|
2647
|
-
] })
|
|
2648
|
-
] });
|
|
2909
|
+
return { handleTrackAreaDragOver, handleTrackAreaDrop };
|
|
2649
2910
|
}
|
|
2650
|
-
var TimelineEditor_default = TimelineEditor;
|
|
2651
2911
|
|
|
2652
2912
|
export {
|
|
2653
2913
|
DEFAULT_TIMELINE_LABELS,
|
|
@@ -2696,7 +2956,6 @@ export {
|
|
|
2696
2956
|
TimelineRuler,
|
|
2697
2957
|
TimelineClipChip,
|
|
2698
2958
|
TimelineTrackRow,
|
|
2699
|
-
BrandMark,
|
|
2700
2959
|
TimelineEmptyState,
|
|
2701
2960
|
TimelineGhostLanes,
|
|
2702
2961
|
TimelineSmallScreenGate,
|
|
@@ -2705,4 +2964,4 @@ export {
|
|
|
2705
2964
|
TimelineEditor,
|
|
2706
2965
|
TimelineEditor_default
|
|
2707
2966
|
};
|
|
2708
|
-
//# sourceMappingURL=chunk-
|
|
2967
|
+
//# sourceMappingURL=chunk-IVBREL7A.js.map
|