@nodetool-ai/timeline 0.8.1 → 0.8.3
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/.nodetool-build-stamp +1 -1
- package/dist/animation/compile.d.ts.map +1 -1
- package/dist/animation/compile.js +5 -1
- package/dist/animation/compile.js.map +1 -1
- package/dist/authoring.d.ts.map +1 -1
- package/dist/authoring.js +46 -6
- package/dist/authoring.js.map +1 -1
- package/dist/clipAudio.d.ts +32 -0
- package/dist/clipAudio.d.ts.map +1 -0
- package/dist/clipAudio.js +70 -0
- package/dist/clipAudio.js.map +1 -0
- package/dist/clipSpeed.d.ts +17 -0
- package/dist/clipSpeed.d.ts.map +1 -0
- package/dist/clipSpeed.js +58 -0
- package/dist/clipSpeed.js.map +1 -0
- package/dist/composition.d.ts +11 -1
- package/dist/composition.d.ts.map +1 -1
- package/dist/composition.js +58 -12
- package/dist/composition.js.map +1 -1
- package/dist/dropResolve.d.ts +14 -6
- package/dist/dropResolve.d.ts.map +1 -1
- package/dist/dropResolve.js +113 -37
- package/dist/dropResolve.js.map +1 -1
- package/dist/examples/node.d.ts +18 -0
- package/dist/examples/node.d.ts.map +1 -1
- package/dist/examples/node.js +26 -0
- package/dist/examples/node.js.map +1 -1
- package/dist/finish-storyboard.d.ts +36 -0
- package/dist/finish-storyboard.d.ts.map +1 -0
- package/dist/finish-storyboard.js +561 -0
- package/dist/finish-storyboard.js.map +1 -0
- package/dist/fonts/google-fonts-fetch.d.ts +53 -0
- package/dist/fonts/google-fonts-fetch.d.ts.map +1 -0
- package/dist/fonts/google-fonts-fetch.js +184 -0
- package/dist/fonts/google-fonts-fetch.js.map +1 -0
- package/dist/fonts/google-fonts-node.d.ts +32 -0
- package/dist/fonts/google-fonts-node.d.ts.map +1 -0
- package/dist/fonts/google-fonts-node.js +60 -0
- package/dist/fonts/google-fonts-node.js.map +1 -0
- package/dist/fonts/google-fonts.d.ts +111 -0
- package/dist/fonts/google-fonts.d.ts.map +1 -0
- package/dist/fonts/google-fonts.js +184 -0
- package/dist/fonts/google-fonts.js.map +1 -0
- package/dist/fonts/index.d.ts +1 -0
- package/dist/fonts/index.d.ts.map +1 -1
- package/dist/fonts/index.js +1 -0
- package/dist/fonts/index.js.map +1 -1
- package/dist/group.d.ts +16 -4
- package/dist/group.d.ts.map +1 -1
- package/dist/group.js +53 -6
- package/dist/group.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/interchange.d.ts +8 -0
- package/dist/interchange.d.ts.map +1 -1
- package/dist/interchange.js +217 -27
- package/dist/interchange.js.map +1 -1
- package/dist/interchangeImport.d.ts +87 -0
- package/dist/interchangeImport.d.ts.map +1 -0
- package/dist/interchangeImport.js +404 -0
- package/dist/interchangeImport.js.map +1 -0
- package/dist/keyframes.d.ts +12 -1
- package/dist/keyframes.d.ts.map +1 -1
- package/dist/keyframes.js +78 -21
- package/dist/keyframes.js.map +1 -1
- package/dist/linked.d.ts +2 -1
- package/dist/linked.d.ts.map +1 -1
- package/dist/linked.js +19 -11
- package/dist/linked.js.map +1 -1
- package/dist/mediaTrack.d.ts +11 -0
- package/dist/mediaTrack.d.ts.map +1 -1
- package/dist/mediaTrack.js +25 -0
- package/dist/mediaTrack.js.map +1 -1
- package/dist/midi/edit.d.ts +5 -0
- package/dist/midi/edit.d.ts.map +1 -1
- package/dist/midi/edit.js +2 -1
- package/dist/midi/edit.js.map +1 -1
- package/dist/midi/engines/kits.d.ts +2 -0
- package/dist/midi/engines/kits.d.ts.map +1 -1
- package/dist/midi/engines/kits.js +146 -0
- package/dist/midi/engines/kits.js.map +1 -1
- package/dist/midi/grid.d.ts.map +1 -1
- package/dist/midi/grid.js +8 -4
- package/dist/midi/grid.js.map +1 -1
- package/dist/midi/index.d.ts +1 -0
- package/dist/midi/index.d.ts.map +1 -1
- package/dist/midi/index.js +1 -0
- package/dist/midi/index.js.map +1 -1
- package/dist/midi/instrument.d.ts.map +1 -1
- package/dist/midi/instrument.js +5 -0
- package/dist/midi/instrument.js.map +1 -1
- package/dist/midi/presets.d.ts.map +1 -1
- package/dist/midi/presets.js +251 -1
- package/dist/midi/presets.js.map +1 -1
- package/dist/midi/sampler.d.ts +15 -0
- package/dist/midi/sampler.d.ts.map +1 -0
- package/dist/midi/sampler.js +72 -0
- package/dist/midi/sampler.js.map +1 -0
- package/dist/midi/tempo.d.ts.map +1 -1
- package/dist/midi/tempo.js +8 -0
- package/dist/midi/tempo.js.map +1 -1
- package/dist/midi/voice.d.ts +4 -1
- package/dist/midi/voice.d.ts.map +1 -1
- package/dist/midi/voice.js +8 -4
- package/dist/midi/voice.js.map +1 -1
- package/dist/ops/apply.d.ts +15 -1
- package/dist/ops/apply.d.ts.map +1 -1
- package/dist/ops/apply.js +2123 -1090
- package/dist/ops/apply.js.map +1 -1
- package/dist/ops/index.d.ts +3 -2
- package/dist/ops/index.d.ts.map +1 -1
- package/dist/ops/index.js +3 -2
- package/dist/ops/index.js.map +1 -1
- package/dist/ops/op.d.ts +15 -3
- package/dist/ops/op.d.ts.map +1 -1
- package/dist/ops/op.js +17 -8
- package/dist/ops/op.js.map +1 -1
- package/dist/ops/parse.d.ts +6 -0
- package/dist/ops/parse.d.ts.map +1 -0
- package/dist/ops/parse.js +351 -0
- package/dist/ops/parse.js.map +1 -0
- package/dist/ops/serialize.d.ts +9 -1
- package/dist/ops/serialize.d.ts.map +1 -1
- package/dist/ops/serialize.js +19 -2
- package/dist/ops/serialize.js.map +1 -1
- package/dist/ops/types.d.ts +30 -8
- package/dist/ops/types.d.ts.map +1 -1
- package/dist/ops/types.js +2 -5
- package/dist/ops/types.js.map +1 -1
- package/dist/production.d.ts.map +1 -1
- package/dist/production.js +7 -0
- package/dist/production.js.map +1 -1
- package/dist/reassemble.d.ts +3 -1
- package/dist/reassemble.d.ts.map +1 -1
- package/dist/reassemble.js +7 -0
- package/dist/reassemble.js.map +1 -1
- package/dist/render/canvas2d.d.ts +3 -3
- package/dist/render/canvas2d.d.ts.map +1 -1
- package/dist/render/draw.d.ts +72 -3
- package/dist/render/draw.d.ts.map +1 -1
- package/dist/render/draw.js +168 -4
- package/dist/render/draw.js.map +1 -1
- package/dist/render/frameCompositor.d.ts +31 -3
- package/dist/render/frameCompositor.d.ts.map +1 -1
- package/dist/render/frameCompositor.js +58 -10
- package/dist/render/frameCompositor.js.map +1 -1
- package/dist/render/layout.d.ts +27 -3
- package/dist/render/layout.d.ts.map +1 -1
- package/dist/render/layout.js +464 -103
- package/dist/render/layout.js.map +1 -1
- package/dist/render/sceneModel.d.ts +18 -6
- package/dist/render/sceneModel.d.ts.map +1 -1
- package/dist/render/sceneModel.js +288 -93
- package/dist/render/sceneModel.js.map +1 -1
- package/dist/render/svgPath.d.ts +36 -8
- package/dist/render/svgPath.d.ts.map +1 -1
- package/dist/render/svgPath.js +303 -30
- package/dist/render/svgPath.js.map +1 -1
- package/dist/render/temporal.d.ts +9 -1
- package/dist/render/temporal.d.ts.map +1 -1
- package/dist/render/temporal.js +18 -1
- package/dist/render/temporal.js.map +1 -1
- package/dist/render/textLayout.d.ts +42 -0
- package/dist/render/textLayout.d.ts.map +1 -1
- package/dist/render/textLayout.js +59 -4
- package/dist/render/textLayout.js.map +1 -1
- package/dist/render/transform.d.ts +10 -0
- package/dist/render/transform.d.ts.map +1 -1
- package/dist/render/transform.js +15 -5
- package/dist/render/transform.js.map +1 -1
- package/dist/rippleEdit.d.ts +20 -3
- package/dist/rippleEdit.d.ts.map +1 -1
- package/dist/rippleEdit.js +89 -17
- package/dist/rippleEdit.js.map +1 -1
- package/dist/shotLink.d.ts +47 -0
- package/dist/shotLink.d.ts.map +1 -0
- package/dist/shotLink.js +92 -0
- package/dist/shotLink.js.map +1 -0
- package/dist/source-merge.d.ts +84 -0
- package/dist/source-merge.d.ts.map +1 -0
- package/dist/source-merge.js +200 -0
- package/dist/source-merge.js.map +1 -0
- package/dist/splitClip.d.ts.map +1 -1
- package/dist/splitClip.js +16 -2
- package/dist/splitClip.js.map +1 -1
- package/dist/storyboard.d.ts +20 -3
- package/dist/storyboard.d.ts.map +1 -1
- package/dist/storyboard.js +62 -28
- package/dist/storyboard.js.map +1 -1
- package/dist/storyboardDesignFrame.d.ts +15 -0
- package/dist/storyboardDesignFrame.d.ts.map +1 -0
- package/dist/storyboardDesignFrame.js +44 -0
- package/dist/storyboardDesignFrame.js.map +1 -0
- package/dist/storyboardValidation.d.ts +10 -0
- package/dist/storyboardValidation.d.ts.map +1 -0
- package/dist/storyboardValidation.js +47 -0
- package/dist/storyboardValidation.js.map +1 -0
- package/dist/takes.d.ts.map +1 -1
- package/dist/takes.js +15 -2
- package/dist/takes.js.map +1 -1
- package/dist/testing/host-ops.d.ts +16 -0
- package/dist/testing/host-ops.d.ts.map +1 -0
- package/dist/testing/host-ops.js +378 -0
- package/dist/testing/host-ops.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/ops.d.ts +30 -0
- package/dist/testing/ops.d.ts.map +1 -0
- package/dist/testing/ops.js +814 -0
- package/dist/testing/ops.js.map +1 -0
- package/dist/transitionAtCut.d.ts +29 -5
- package/dist/transitionAtCut.d.ts.map +1 -1
- package/dist/transitionAtCut.js +69 -33
- package/dist/transitionAtCut.js.map +1 -1
- package/dist/trimClip.d.ts +5 -8
- package/dist/trimClip.d.ts.map +1 -1
- package/dist/trimClip.js +38 -2
- package/dist/trimClip.js.map +1 -1
- package/dist/types.d.ts +172 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +34 -4
package/dist/shotLink.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline clips linked to storyboard shots.
|
|
3
|
+
*
|
|
4
|
+
* A clip carrying `storyboardBoardId`/`storyboardShotId` plays its shot's
|
|
5
|
+
* selected take. The shot owns the take list (`Shot.clip_versions`) and the
|
|
6
|
+
* selection (`Shot.clip`); the cut follows the selection. These helpers are
|
|
7
|
+
* the editing math behind that: which clips follow a shot, what a clip looks
|
|
8
|
+
* like after its shot's take changes, and where to sample reference frames
|
|
9
|
+
* for a shot derived from a clip.
|
|
10
|
+
*/
|
|
11
|
+
import { sourceRate } from "./sourceRate.js";
|
|
12
|
+
import { clipSourceMsAt } from "./timeRemap.js";
|
|
13
|
+
/** Most reference frames a derived shot samples from one clip. */
|
|
14
|
+
export const MAX_DERIVED_FRAMES = 8;
|
|
15
|
+
/**
|
|
16
|
+
* The clips in a cut that play a shot's take: the video clip and its audio
|
|
17
|
+
* twin. A voiceover clip stamped with the same shot plays a script take
|
|
18
|
+
* instead, so it carries a `scriptLineId` and is left out.
|
|
19
|
+
*/
|
|
20
|
+
export function clipsFollowingShot(clips, boardId, shotId) {
|
|
21
|
+
return clips.filter((clip) => clip.storyboardBoardId === boardId &&
|
|
22
|
+
clip.storyboardShotId === shotId &&
|
|
23
|
+
!clip.scriptLineId &&
|
|
24
|
+
(clip.mediaType === "video" || clip.mediaType === "audio"));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Put a shot's newly selected take on a clip that follows the shot.
|
|
28
|
+
*
|
|
29
|
+
* The clip keeps its place and length. Its source window stays where it was
|
|
30
|
+
* when the take is long enough to hold it; a shorter take slides the window
|
|
31
|
+
* back so it ends on the take's last frame, and a take shorter than the
|
|
32
|
+
* window itself shortens the clip to the whole take. An unknown take length
|
|
33
|
+
* leaves the window alone.
|
|
34
|
+
*
|
|
35
|
+
* Returns `clip` unchanged for a locked clip, a clip that is not video or
|
|
36
|
+
* audio, and a clip already playing the asset.
|
|
37
|
+
*/
|
|
38
|
+
export function applyShotTakeToClip(clip, take) {
|
|
39
|
+
if (clip.locked)
|
|
40
|
+
return clip;
|
|
41
|
+
if (clip.mediaType !== "video" && clip.mediaType !== "audio")
|
|
42
|
+
return clip;
|
|
43
|
+
if (!take.assetId || clip.currentAssetId === take.assetId)
|
|
44
|
+
return clip;
|
|
45
|
+
const next = {
|
|
46
|
+
...clip,
|
|
47
|
+
currentAssetId: take.assetId,
|
|
48
|
+
status: "generated"
|
|
49
|
+
};
|
|
50
|
+
const recorded = (clip.versions ?? []).find((version) => version.assetId === take.assetId);
|
|
51
|
+
if (recorded) {
|
|
52
|
+
next.activeTakeId = recorded.id;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
delete next.activeTakeId;
|
|
56
|
+
}
|
|
57
|
+
const takeMs = take.durationMs;
|
|
58
|
+
if (takeMs === undefined || !Number.isFinite(takeMs) || takeMs <= 0) {
|
|
59
|
+
return next;
|
|
60
|
+
}
|
|
61
|
+
const rate = sourceRate(clip);
|
|
62
|
+
const spanMs = clip.durationMs * rate;
|
|
63
|
+
const inPointMs = clip.inPointMs ?? 0;
|
|
64
|
+
if (inPointMs + spanMs <= takeMs) {
|
|
65
|
+
return next;
|
|
66
|
+
}
|
|
67
|
+
// A curve names source times in the old footage; it cannot be carried onto
|
|
68
|
+
// a window that moved.
|
|
69
|
+
delete next.timeRemap;
|
|
70
|
+
if (spanMs <= takeMs) {
|
|
71
|
+
next.inPointMs = takeMs - spanMs;
|
|
72
|
+
next.outPointMs = takeMs;
|
|
73
|
+
return next;
|
|
74
|
+
}
|
|
75
|
+
next.inPointMs = 0;
|
|
76
|
+
next.outPointMs = takeMs;
|
|
77
|
+
next.durationMs = Math.max(1, Math.floor(takeMs / rate));
|
|
78
|
+
return next;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The source times, in milliseconds, of `count` reference frames spread over
|
|
82
|
+
* what a clip shows: one at the middle of each of `count` equal slices of the
|
|
83
|
+
* clip, mapped through its speed and time remap the way the compositor seeks
|
|
84
|
+
* the video. Sampling slice middles keeps clear of the first and last frames,
|
|
85
|
+
* which can decode black.
|
|
86
|
+
*/
|
|
87
|
+
export function derivedFrameTimesMs(clip, count) {
|
|
88
|
+
const frames = Math.min(MAX_DERIVED_FRAMES, Math.max(1, Math.floor(Number.isFinite(count) ? count : 1)));
|
|
89
|
+
const sliceMs = clip.durationMs / frames;
|
|
90
|
+
return Array.from({ length: frames }, (_, i) => Math.round(clipSourceMsAt(clip, clip.startMs + (i + 0.5) * sliceMs)));
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=shotLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shotLink.js","sourceRoot":"","sources":["../src/shotLink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUhD,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAA8B,EAC9B,OAAe,EACf,MAAc;IAEd,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,iBAAiB,KAAK,OAAO;QAClC,IAAI,CAAC,gBAAgB,KAAK,MAAM;QAChC,CAAC,IAAI,CAAC,YAAY;QAClB,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAkB,EAClB,IAAmB;IAEnB,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC7B,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1E,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC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B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAQC,EACD,KAAa;IAEb,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,kBAAkB,EAClB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC7C,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CACrE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merging a freshly baked build from a timeline's authoring code into the
|
|
3
|
+
* document it is stored on, scene by scene.
|
|
4
|
+
*
|
|
5
|
+
* A scene is the subtree rooted at a `group` clip carrying `sourceScene`
|
|
6
|
+
* (`v.scene()` in `@nodetool-ai/sandbox-timeline` stamps it). Its identity
|
|
7
|
+
* across bakes is its scene *name* — the pack's own id scheme scopes every
|
|
8
|
+
* clip/effect/animation id it mints to the scene name it was built under, so
|
|
9
|
+
* two bakes of unchanged code (or a change confined to another scene) mint
|
|
10
|
+
* the same ids too, which is what lets the editor's selection survive a
|
|
11
|
+
* rebake. `hashSceneSubtree` is a stable hash of the whole subtree (the
|
|
12
|
+
* group plus every descendant, ids included, keys sorted) as one bake left
|
|
13
|
+
* it; `TimelineDocument.source.scenes[name].hash` is the hash the *previous*
|
|
14
|
+
* bake recorded.
|
|
15
|
+
*
|
|
16
|
+
* The merge rule: a scene whose current subtree still hashes to that recorded
|
|
17
|
+
* value has not been touched since the last bake, so the new build replaces
|
|
18
|
+
* it outright. A scene whose hash has moved was hand-edited — in the editor,
|
|
19
|
+
* or through `edit_timeline` — since the last bake, so it is kept as-is and
|
|
20
|
+
* reported as a conflict, unless the caller forces it. A conflict keeps the
|
|
21
|
+
* hash of the last accepted bake, so the scene stays in conflict on every
|
|
22
|
+
* later bake until the caller forces it or the code is detached from it. A
|
|
23
|
+
* scene with no recorded hash (a detached scene) stays untracked. Everything outside
|
|
24
|
+
* every scene's subtree (markers, tempo, camera2d, media tracks, any clip
|
|
25
|
+
* the code placed outside a scene) always comes from the new build — the
|
|
26
|
+
* code is what authors that state, and there is no hand-editable counterpart
|
|
27
|
+
* to protect.
|
|
28
|
+
*
|
|
29
|
+
* Scene *timing* is not simply inherited from whichever side (built or
|
|
30
|
+
* kept) supplied a scene's clips: every chosen scene is reflowed end to end
|
|
31
|
+
* in series order afterward, because a kept scene's hand-edited length can
|
|
32
|
+
* differ from the length the new build assumed when it placed every scene
|
|
33
|
+
* after it. Reflowing is what keeps scenes from overlapping (or leaving a
|
|
34
|
+
* gap) when that happens — see the sort-and-walk at the bottom of
|
|
35
|
+
* `mergeTimelineSource`.
|
|
36
|
+
*/
|
|
37
|
+
import type { TimelineClip } from "./types.js";
|
|
38
|
+
/**
|
|
39
|
+
* The one shape this module needs from a whole timeline document: its clip
|
|
40
|
+
* list, plus whatever else the caller's own document type carries. There is
|
|
41
|
+
* no `TimelineDocument` type in this package — the concrete document shape
|
|
42
|
+
* (`tracks`, `markers`, `source`, …) lives on `@nodetool-ai/models`'
|
|
43
|
+
* `TimelineDocument`, and this package cannot import that without a
|
|
44
|
+
* dependency cycle (models depends on timeline, not the reverse). A caller
|
|
45
|
+
* passes its own document type here; structural typing does the rest.
|
|
46
|
+
*/
|
|
47
|
+
export interface TimelineDocumentLike {
|
|
48
|
+
clips: TimelineClip[];
|
|
49
|
+
storyboardMaterializations?: Array<{
|
|
50
|
+
boardId: string;
|
|
51
|
+
elementKeys: string[];
|
|
52
|
+
stage?: "layout" | "finished";
|
|
53
|
+
}>;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
/** A scene group's own clip plus every descendant, document order. */
|
|
57
|
+
export declare function sceneSubtreeClips(clips: readonly TimelineClip[], groupId: string): TimelineClip[];
|
|
58
|
+
/**
|
|
59
|
+
* A stable hash of one scene's whole subtree. Sorted by clip id before
|
|
60
|
+
* hashing, so a build that emits the same clips in a different order still
|
|
61
|
+
* hashes the same — only the clips' own content and structure identify a
|
|
62
|
+
* scene as unchanged.
|
|
63
|
+
*/
|
|
64
|
+
export declare function hashSceneSubtree(clips: readonly TimelineClip[], groupId: string): string;
|
|
65
|
+
export interface SourceMergeConflict {
|
|
66
|
+
scene: string;
|
|
67
|
+
reason: string;
|
|
68
|
+
}
|
|
69
|
+
/** Per-scene bake bookkeeping the merge recorded, keyed by scene name. */
|
|
70
|
+
export type SourceMergeScenes = Record<string, {
|
|
71
|
+
groupId: string;
|
|
72
|
+
hash: string;
|
|
73
|
+
}>;
|
|
74
|
+
export interface SourceMergeResult {
|
|
75
|
+
document: TimelineDocumentLike;
|
|
76
|
+
conflicts: SourceMergeConflict[];
|
|
77
|
+
scenes: SourceMergeScenes;
|
|
78
|
+
}
|
|
79
|
+
export interface MergeTimelineSourceOptions {
|
|
80
|
+
/** `true` overwrites every scene; an array names just the scenes to force. */
|
|
81
|
+
force?: true | readonly string[];
|
|
82
|
+
}
|
|
83
|
+
export declare function mergeTimelineSource(current: TimelineDocumentLike, built: TimelineDocumentLike, previousScenes: SourceMergeScenes, options?: MergeTimelineSourceOptions): SourceMergeResult;
|
|
84
|
+
//# sourceMappingURL=source-merge.d.ts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AM,EAAE,CAAC;CAClC;AAqBD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,EAC7B,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,iBAAiB,EACjC,OAAO,GAAE,0BAA+B,GACvC,iBAAiB,CA+HnB"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merging a freshly baked build from a timeline's authoring code into the
|
|
3
|
+
* document it is stored on, scene by scene.
|
|
4
|
+
*
|
|
5
|
+
* A scene is the subtree rooted at a `group` clip carrying `sourceScene`
|
|
6
|
+
* (`v.scene()` in `@nodetool-ai/sandbox-timeline` stamps it). Its identity
|
|
7
|
+
* across bakes is its scene *name* — the pack's own id scheme scopes every
|
|
8
|
+
* clip/effect/animation id it mints to the scene name it was built under, so
|
|
9
|
+
* two bakes of unchanged code (or a change confined to another scene) mint
|
|
10
|
+
* the same ids too, which is what lets the editor's selection survive a
|
|
11
|
+
* rebake. `hashSceneSubtree` is a stable hash of the whole subtree (the
|
|
12
|
+
* group plus every descendant, ids included, keys sorted) as one bake left
|
|
13
|
+
* it; `TimelineDocument.source.scenes[name].hash` is the hash the *previous*
|
|
14
|
+
* bake recorded.
|
|
15
|
+
*
|
|
16
|
+
* The merge rule: a scene whose current subtree still hashes to that recorded
|
|
17
|
+
* value has not been touched since the last bake, so the new build replaces
|
|
18
|
+
* it outright. A scene whose hash has moved was hand-edited — in the editor,
|
|
19
|
+
* or through `edit_timeline` — since the last bake, so it is kept as-is and
|
|
20
|
+
* reported as a conflict, unless the caller forces it. A conflict keeps the
|
|
21
|
+
* hash of the last accepted bake, so the scene stays in conflict on every
|
|
22
|
+
* later bake until the caller forces it or the code is detached from it. A
|
|
23
|
+
* scene with no recorded hash (a detached scene) stays untracked. Everything outside
|
|
24
|
+
* every scene's subtree (markers, tempo, camera2d, media tracks, any clip
|
|
25
|
+
* the code placed outside a scene) always comes from the new build — the
|
|
26
|
+
* code is what authors that state, and there is no hand-editable counterpart
|
|
27
|
+
* to protect.
|
|
28
|
+
*
|
|
29
|
+
* Scene *timing* is not simply inherited from whichever side (built or
|
|
30
|
+
* kept) supplied a scene's clips: every chosen scene is reflowed end to end
|
|
31
|
+
* in series order afterward, because a kept scene's hand-edited length can
|
|
32
|
+
* differ from the length the new build assumed when it placed every scene
|
|
33
|
+
* after it. Reflowing is what keeps scenes from overlapping (or leaving a
|
|
34
|
+
* gap) when that happens — see the sort-and-walk at the bottom of
|
|
35
|
+
* `mergeTimelineSource`.
|
|
36
|
+
*/
|
|
37
|
+
import { createHash } from "node:crypto";
|
|
38
|
+
import { stableSerialize } from "./stableSerialize.js";
|
|
39
|
+
/** Every id whose `parentId` chain (transitively) leads back to `rootId`. */
|
|
40
|
+
function descendantIds(clips, rootId) {
|
|
41
|
+
const found = new Set();
|
|
42
|
+
let frontier = new Set([rootId]);
|
|
43
|
+
while (frontier.size > 0) {
|
|
44
|
+
const next = new Set();
|
|
45
|
+
for (const clip of clips) {
|
|
46
|
+
if (clip.id !== rootId &&
|
|
47
|
+
clip.parentId !== undefined &&
|
|
48
|
+
frontier.has(clip.parentId) &&
|
|
49
|
+
!found.has(clip.id)) {
|
|
50
|
+
found.add(clip.id);
|
|
51
|
+
next.add(clip.id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
frontier = next;
|
|
55
|
+
}
|
|
56
|
+
return found;
|
|
57
|
+
}
|
|
58
|
+
/** A scene group's own clip plus every descendant, document order. */
|
|
59
|
+
export function sceneSubtreeClips(clips, groupId) {
|
|
60
|
+
const ids = descendantIds(clips, groupId);
|
|
61
|
+
ids.add(groupId);
|
|
62
|
+
return clips.filter((clip) => ids.has(clip.id));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A stable hash of one scene's whole subtree. Sorted by clip id before
|
|
66
|
+
* hashing, so a build that emits the same clips in a different order still
|
|
67
|
+
* hashes the same — only the clips' own content and structure identify a
|
|
68
|
+
* scene as unchanged.
|
|
69
|
+
*/
|
|
70
|
+
export function hashSceneSubtree(clips, groupId) {
|
|
71
|
+
const subtree = [...sceneSubtreeClips(clips, groupId)].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
72
|
+
return createHash("sha256")
|
|
73
|
+
.update(`v1:${stableSerialize(subtree)}`, "utf8")
|
|
74
|
+
.digest("hex");
|
|
75
|
+
}
|
|
76
|
+
/** Scene group clips, keyed by `sourceScene`. Clips with no `sourceScene` are not scenes. */
|
|
77
|
+
function sceneGroupsByName(clips) {
|
|
78
|
+
const byName = new Map();
|
|
79
|
+
for (const clip of clips) {
|
|
80
|
+
if (typeof clip.sourceScene === "string" && clip.sourceScene !== "") {
|
|
81
|
+
byName.set(clip.sourceScene, clip);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return byName;
|
|
85
|
+
}
|
|
86
|
+
export function mergeTimelineSource(current, built, previousScenes, options = {}) {
|
|
87
|
+
const forceAll = options.force === true;
|
|
88
|
+
const forced = new Set(Array.isArray(options.force) ? options.force : []);
|
|
89
|
+
const builtGroups = sceneGroupsByName(built.clips);
|
|
90
|
+
const currentGroups = sceneGroupsByName(current.clips);
|
|
91
|
+
const builtSceneClipIds = new Set();
|
|
92
|
+
for (const group of builtGroups.values()) {
|
|
93
|
+
for (const clip of sceneSubtreeClips(built.clips, group.id)) {
|
|
94
|
+
builtSceneClipIds.add(clip.id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Everything the new build produced outside a scene subtree — the code is
|
|
98
|
+
// the sole author of it, so it always rides straight through, unshifted.
|
|
99
|
+
const passthroughClips = built.clips.filter((clip) => !builtSceneClipIds.has(clip.id));
|
|
100
|
+
const conflicts = [];
|
|
101
|
+
const scenes = {};
|
|
102
|
+
const chosen = [];
|
|
103
|
+
/** Scenes the build supplied. Their hashes are recorded after the reflow. */
|
|
104
|
+
const accepted = [];
|
|
105
|
+
const sceneNames = new Set([...builtGroups.keys(), ...currentGroups.keys()]);
|
|
106
|
+
for (const name of sceneNames) {
|
|
107
|
+
const builtGroup = builtGroups.get(name);
|
|
108
|
+
const currentGroup = currentGroups.get(name);
|
|
109
|
+
const previous = previousScenes[name];
|
|
110
|
+
const isForced = forceAll || forced.has(name);
|
|
111
|
+
if (builtGroup === undefined) {
|
|
112
|
+
// The new build no longer has this scene.
|
|
113
|
+
if (currentGroup === undefined)
|
|
114
|
+
continue;
|
|
115
|
+
const currentHash = hashSceneSubtree(current.clips, currentGroup.id);
|
|
116
|
+
const untouched = previous !== undefined && previous.hash === currentHash;
|
|
117
|
+
if (untouched || isForced) {
|
|
118
|
+
continue; // Drop it — the build is authoritative for this scene.
|
|
119
|
+
}
|
|
120
|
+
conflicts.push({
|
|
121
|
+
scene: name,
|
|
122
|
+
reason: "edited since the last bake; the new build no longer has this " +
|
|
123
|
+
"scene, so it was kept rather than removed"
|
|
124
|
+
});
|
|
125
|
+
chosen.push({
|
|
126
|
+
group: currentGroup,
|
|
127
|
+
subtree: sceneSubtreeClips(current.clips, currentGroup.id),
|
|
128
|
+
orderMs: currentGroup.startMs
|
|
129
|
+
});
|
|
130
|
+
if (previous !== undefined) {
|
|
131
|
+
scenes[name] = { groupId: currentGroup.id, hash: previous.hash };
|
|
132
|
+
}
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (currentGroup === undefined) {
|
|
136
|
+
// A scene the current document does not have yet.
|
|
137
|
+
chosen.push({
|
|
138
|
+
group: builtGroup,
|
|
139
|
+
subtree: sceneSubtreeClips(built.clips, builtGroup.id),
|
|
140
|
+
orderMs: builtGroup.startMs
|
|
141
|
+
});
|
|
142
|
+
accepted.push(name);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const currentHash = hashSceneSubtree(current.clips, currentGroup.id);
|
|
146
|
+
const untouched = previous !== undefined && previous.hash === currentHash;
|
|
147
|
+
if (untouched || isForced) {
|
|
148
|
+
chosen.push({
|
|
149
|
+
group: builtGroup,
|
|
150
|
+
subtree: sceneSubtreeClips(built.clips, builtGroup.id),
|
|
151
|
+
orderMs: builtGroup.startMs
|
|
152
|
+
});
|
|
153
|
+
accepted.push(name);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
conflicts.push({ scene: name, reason: "edited since the last bake" });
|
|
157
|
+
chosen.push({
|
|
158
|
+
group: currentGroup,
|
|
159
|
+
subtree: sceneSubtreeClips(current.clips, currentGroup.id),
|
|
160
|
+
orderMs: currentGroup.startMs
|
|
161
|
+
});
|
|
162
|
+
if (previous !== undefined) {
|
|
163
|
+
scenes[name] = { groupId: currentGroup.id, hash: previous.hash };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Reflow in series order. A kept (hand-edited) scene's actual length can
|
|
168
|
+
// differ from what the new build assumed when it placed every later scene
|
|
169
|
+
// — trusting each scene's already-carried `startMs` would leave scenes
|
|
170
|
+
// overlapping or gapped. `orderMs` — each scene's un-reflowed `startMs` —
|
|
171
|
+
// decides the sequence: the built document expresses "series order" for
|
|
172
|
+
// every scene the rebuild still has, and a scene the build dropped (kept
|
|
173
|
+
// only because it conflicted) keeps roughly the position it already held.
|
|
174
|
+
// Every chosen scene is then laid end to end again, using its own real
|
|
175
|
+
// duration and its own `transitionIn` overlap — the same arithmetic
|
|
176
|
+
// `v.series()` uses to place scenes in the first place.
|
|
177
|
+
chosen.sort((a, b) => a.orderMs - b.orderMs);
|
|
178
|
+
const resultClips = [...passthroughClips];
|
|
179
|
+
let cursorMs = 0;
|
|
180
|
+
for (const scene of chosen) {
|
|
181
|
+
const overlapMs = scene.group.transitionIn?.durationMs ?? 0;
|
|
182
|
+
const absStart = Math.max(0, cursorMs - overlapMs);
|
|
183
|
+
const delta = absStart - scene.group.startMs;
|
|
184
|
+
for (const clip of scene.subtree) {
|
|
185
|
+
resultClips.push(delta === 0 ? clip : { ...clip, startMs: clip.startMs + delta });
|
|
186
|
+
}
|
|
187
|
+
cursorMs = absStart + scene.group.durationMs;
|
|
188
|
+
}
|
|
189
|
+
// The reflow can move a scene, and its hash includes clip times, so the
|
|
190
|
+
// baseline must describe the placement that is persisted.
|
|
191
|
+
for (const name of accepted) {
|
|
192
|
+
const groupId = builtGroups.get(name).id;
|
|
193
|
+
scenes[name] = { groupId, hash: hashSceneSubtree(resultClips, groupId) };
|
|
194
|
+
}
|
|
195
|
+
const document = { ...built, clips: resultClips };
|
|
196
|
+
if (current.storyboardMaterializations)
|
|
197
|
+
document.storyboardMaterializations = structuredClone(current.storyboardMaterializations);
|
|
198
|
+
return { document, conflicts, scenes };
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=source-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-merge.js","sourceRoot":"","sources":["../src/source-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAkBvD,6EAA6E;AAC7E,SAAS,aAAa,CACpB,KAA8B,EAC9B,MAAc;IAEd,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,IAAI,QAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IACE,IAAI,CAAC,EAAE,KAAK,MAAM;gBAClB,IAAI,CAAC,QAAQ,KAAK,SAAS;gBAC3B,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC3B,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EACnB,CAAC;gBACD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE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U,CAAC;IAC/C,CAAC;IAED,wEAAwE;IACxE,0DAA0D;IAC1D,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GAAyB,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACxE,IAAI,OAAO,CAAC,0BAA0B;QAAE,QAAQ,CAAC,0BAA0B,GAAG,eAAe,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAClI,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACzC,CAAC"}
|
package/dist/splitClip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitClip.d.ts","sourceRoot":"","sources":["../src/splitClip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"splitClip.d.ts","sourceRoot":"","sources":["../src/splitClip.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAgJ5D,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAwFxF"}
|
package/dist/splitClip.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createTimeOrderedUuid } from "./defaults.js";
|
|
|
2
2
|
import { getAnimationPreset } from "./animation/presets.js";
|
|
3
3
|
import { isSourceAnchoredAnimation, sliceSourceAnimation } from "./animation/sourceCurves.js";
|
|
4
4
|
import { sourceRate } from "./sourceRate.js";
|
|
5
|
+
import { isKeyframeAnimation, sliceKeyframeAnimation } from "./keyframes.js";
|
|
5
6
|
import { assertNotTimeRemapped } from "./timeRemap.js";
|
|
6
7
|
/**
|
|
7
8
|
* Partition a clip's animations across a split at `splitMs` (clip-local ms).
|
|
@@ -26,6 +27,10 @@ import { assertNotTimeRemapped } from "./timeRemap.js";
|
|
|
26
27
|
* which half it belongs to: BOTH halves get it, each carrying the stretch of
|
|
27
28
|
* the curve its own source window shows (`animation/sourceCurves.ts`).
|
|
28
29
|
*
|
|
30
|
+
* - The hand-keyframe animation spans the whole clip with `t` normalized over
|
|
31
|
+
* it, so each half gets the stretch of every curve inside its own span
|
|
32
|
+
* ({@link sliceKeyframeAnimation}), not the whole curve squeezed into one.
|
|
33
|
+
*
|
|
29
34
|
* Right-half animations get fresh ids so the two clips edit independently.
|
|
30
35
|
*/
|
|
31
36
|
function splitAnimations(animations, splitMs, source) {
|
|
@@ -39,6 +44,15 @@ function splitAnimations(animations, splitMs, source) {
|
|
|
39
44
|
id: createTimeOrderedUuid()
|
|
40
45
|
});
|
|
41
46
|
}
|
|
47
|
+
else if (isKeyframeAnimation(anim)) {
|
|
48
|
+
const totalMs = source.leftDurationMs + source.rightDurationMs;
|
|
49
|
+
const cutT = totalMs > 0 ? splitMs / totalMs : 0;
|
|
50
|
+
left.push(sliceKeyframeAnimation(anim, 0, cutT, source.leftDurationMs));
|
|
51
|
+
right.push({
|
|
52
|
+
...sliceKeyframeAnimation(anim, cutT, 1, source.rightDurationMs),
|
|
53
|
+
id: createTimeOrderedUuid()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
42
56
|
else if (anim.role === "in") {
|
|
43
57
|
left.push({ ...anim });
|
|
44
58
|
}
|
|
@@ -160,7 +174,7 @@ export function splitClip(clip, atMs) {
|
|
|
160
174
|
delete leftClip.fadeOutMs;
|
|
161
175
|
delete leftClip.fadeOutShape;
|
|
162
176
|
if (captions) {
|
|
163
|
-
leftClip.caption = { words: captions.left };
|
|
177
|
+
leftClip.caption = { ...clip.caption, words: captions.left };
|
|
164
178
|
}
|
|
165
179
|
if (animations) {
|
|
166
180
|
leftClip.animations = animations.left;
|
|
@@ -180,7 +194,7 @@ export function splitClip(clip, atMs) {
|
|
|
180
194
|
delete rightClip.fadeInShape;
|
|
181
195
|
delete rightClip.transitionIn;
|
|
182
196
|
if (captions) {
|
|
183
|
-
rightClip.caption = { words: captions.right };
|
|
197
|
+
rightClip.caption = { ...clip.caption, words: captions.right };
|
|
184
198
|
}
|
|
185
199
|
if (animations) {
|
|
186
200
|
rightClip.animations = animations.right;
|
package/dist/splitClip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitClip.js","sourceRoot":"","sources":["../src/splitClip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIvD
|
|
1
|
+
{"version":3,"file":"splitClip.js","sourceRoot":"","sources":["../src/splitClip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAS,eAAe,CACtB,UAAwC,EACxC,OAAe,EACf,MAMC;IAED,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Q,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/D,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC;IACxC,CAAC;IAED,MAAM,SAAS,GAAiB;QAC9B,GAAG,IAAI;QACP,EAAE,EAAE,qBAAqB,EAAE;QAC3B,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,eAAe;QAC3B,SAAS,EAAE,UAAU;QACrB,UAAU;QACV,QAAQ,EAAE,cAAc;KACzB,CAAC;IACF,6EAA6E;IAC7E,2EAA2E;IAC3E,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC1B,OAAO,SAAS,CAAC,WAAW,CAAC;IAC7B,OAAO,SAAS,CAAC,YAAY,CAAC;IAC9B,IAAI,QAAQ,EAAE,CAAC;QACb,SAAS,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,SAAS,CAAC,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;IAC1C,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/storyboard.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* `buildStoryboardPreviewTimeline` is the same mapping for the in-editor
|
|
19
19
|
* player, where a board that is only half rendered still has to play.
|
|
20
20
|
*/
|
|
21
|
-
import type { Shot } from "@nodetool-ai/protocol";
|
|
21
|
+
import type { ProductionRequirement, Shot } from "@nodetool-ai/protocol";
|
|
22
22
|
import type { TimelineClip, TimelineTrack } from "./types.js";
|
|
23
23
|
/** Clip length used for a shot that carries no duration. */
|
|
24
24
|
export declare const DEFAULT_SHOT_MS = 4000;
|
|
@@ -51,12 +51,17 @@ export interface StoryboardAssemblyInput {
|
|
|
51
51
|
/** Board id stamped onto each clip, linking the cut back to the board. */
|
|
52
52
|
boardId: string;
|
|
53
53
|
shots: Shot[];
|
|
54
|
+
production?: ProductionRequirement;
|
|
54
55
|
/** Voiceover script, laid across the full cut as one draft audio clip. */
|
|
55
56
|
narration?: string | null;
|
|
56
57
|
/** Score direction, laid across the full cut as one draft audio clip. */
|
|
57
58
|
musicPrompt?: string | null;
|
|
58
59
|
}
|
|
59
60
|
export interface AssembledTimeline {
|
|
61
|
+
shotWindows: Map<string, {
|
|
62
|
+
start: number;
|
|
63
|
+
end: number;
|
|
64
|
+
}>;
|
|
60
65
|
tracks: TimelineTrack[];
|
|
61
66
|
clips: TimelineClip[];
|
|
62
67
|
/** Total duration of the shot track in ms. */
|
|
@@ -94,8 +99,19 @@ export interface RetimedShot {
|
|
|
94
99
|
/** Length `duration_seconds` asked for, or the default. */
|
|
95
100
|
directedMs: number;
|
|
96
101
|
}
|
|
97
|
-
/** A shot
|
|
102
|
+
/** A shot has a source compatible with its production strategy. */
|
|
98
103
|
export declare const isAssemblableShot: (shot: Shot) => boolean;
|
|
104
|
+
export type ResolvedShotSource = {
|
|
105
|
+
kind: "still";
|
|
106
|
+
assetId: string;
|
|
107
|
+
} | {
|
|
108
|
+
kind: "video";
|
|
109
|
+
assetId: string;
|
|
110
|
+
} | {
|
|
111
|
+
kind: "graphics";
|
|
112
|
+
};
|
|
113
|
+
/** Policy determines the source before old rendered media is considered. */
|
|
114
|
+
export declare function resolveShotSource(shot: Shot, boardProduction?: ProductionRequirement, coverageAssetId?: string): ResolvedShotSource | null;
|
|
99
115
|
/** Clip length a shot was directed at: its target duration, or the default. */
|
|
100
116
|
export declare const shotDurationMs: (shot: Shot) => number;
|
|
101
117
|
/** Length of the footage a shot's selected clip actually holds, when known. */
|
|
@@ -149,7 +165,7 @@ export interface ShotSourceOptions {
|
|
|
149
165
|
* at its full length would play the whole run and then play the covered slices
|
|
150
166
|
* again after it. The claim is where the owner's own picture ends.
|
|
151
167
|
*/
|
|
152
|
-
export declare function coverageClaims(shots: readonly Shot[],
|
|
168
|
+
export declare function coverageClaims(shots: readonly Shot[], _options?: ShotSourceOptions): Map<string, number>;
|
|
153
169
|
/**
|
|
154
170
|
* Resolve a shot's picture, following {@link Shot.covered_by} one hop.
|
|
155
171
|
*
|
|
@@ -194,6 +210,7 @@ export interface StoryboardPreviewInput {
|
|
|
194
210
|
/** Board id stamped onto each clip. */
|
|
195
211
|
boardId: string;
|
|
196
212
|
shots: Shot[];
|
|
213
|
+
production?: ProductionRequirement;
|
|
197
214
|
}
|
|
198
215
|
export interface StoryboardPreviewTimeline {
|
|
199
216
|
tracks: TimelineTrack[];
|
package/dist/storyboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyboard.d.ts","sourceRoot":"","sources":["../src/storyboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"storyboard.d.ts","sourceRoot":"","sources":["../src/storyboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,4DAA4D;AAC5D,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAYA;AAED,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAgB,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