@nodetool-ai/timeline 0.8.1
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/README.md +55 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/animation/bakedAnimation.d.ts +84 -0
- package/dist/animation/bakedAnimation.d.ts.map +1 -0
- package/dist/animation/bakedAnimation.js +95 -0
- package/dist/animation/bakedAnimation.js.map +1 -0
- package/dist/animation/beat.d.ts +7 -0
- package/dist/animation/beat.d.ts.map +1 -0
- package/dist/animation/beat.js +36 -0
- package/dist/animation/beat.js.map +1 -0
- package/dist/animation/compile.d.ts +184 -0
- package/dist/animation/compile.d.ts.map +1 -0
- package/dist/animation/compile.js +312 -0
- package/dist/animation/compile.js.map +1 -0
- package/dist/animation/custom.d.ts +183 -0
- package/dist/animation/custom.d.ts.map +1 -0
- package/dist/animation/custom.js +583 -0
- package/dist/animation/custom.js.map +1 -0
- package/dist/animation/easing.d.ts +34 -0
- package/dist/animation/easing.d.ts.map +1 -0
- package/dist/animation/easing.js +332 -0
- package/dist/animation/easing.js.map +1 -0
- package/dist/animation/index.d.ts +20 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/index.js.map +1 -0
- package/dist/animation/links.d.ts +33 -0
- package/dist/animation/links.d.ts.map +1 -0
- package/dist/animation/links.js +126 -0
- package/dist/animation/links.js.map +1 -0
- package/dist/animation/presets.d.ts +86 -0
- package/dist/animation/presets.d.ts.map +1 -0
- package/dist/animation/presets.js +642 -0
- package/dist/animation/presets.js.map +1 -0
- package/dist/animation/sample.d.ts +145 -0
- package/dist/animation/sample.d.ts.map +1 -0
- package/dist/animation/sample.js +390 -0
- package/dist/animation/sample.js.map +1 -0
- package/dist/animation/simplify.d.ts +70 -0
- package/dist/animation/simplify.d.ts.map +1 -0
- package/dist/animation/simplify.js +278 -0
- package/dist/animation/simplify.js.map +1 -0
- package/dist/animation/sourceCurves.d.ts +45 -0
- package/dist/animation/sourceCurves.d.ts.map +1 -0
- package/dist/animation/sourceCurves.js +168 -0
- package/dist/animation/sourceCurves.js.map +1 -0
- package/dist/animation/styleTracks.d.ts +23 -0
- package/dist/animation/styleTracks.d.ts.map +1 -0
- package/dist/animation/styleTracks.js +341 -0
- package/dist/animation/styleTracks.js.map +1 -0
- package/dist/animation/types.d.ts +269 -0
- package/dist/animation/types.d.ts.map +1 -0
- package/dist/animation/types.js +173 -0
- package/dist/animation/types.js.map +1 -0
- package/dist/animation/typewriter.d.ts +8 -0
- package/dist/animation/typewriter.d.ts.map +1 -0
- package/dist/animation/typewriter.js +32 -0
- package/dist/animation/typewriter.js.map +1 -0
- package/dist/audioFade.d.ts +73 -0
- package/dist/audioFade.d.ts.map +1 -0
- package/dist/audioFade.js +134 -0
- package/dist/audioFade.js.map +1 -0
- package/dist/authoredStyles.d.ts +61 -0
- package/dist/authoredStyles.d.ts.map +1 -0
- package/dist/authoredStyles.js +90 -0
- package/dist/authoredStyles.js.map +1 -0
- package/dist/authoring.d.ts +50 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +207 -0
- package/dist/authoring.js.map +1 -0
- package/dist/beats.d.ts +103 -0
- package/dist/beats.d.ts.map +1 -0
- package/dist/beats.js +228 -0
- package/dist/beats.js.map +1 -0
- package/dist/clone.d.ts +32 -0
- package/dist/clone.d.ts.map +1 -0
- package/dist/clone.js +53 -0
- package/dist/clone.js.map +1 -0
- package/dist/composition.d.ts +87 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +253 -0
- package/dist/composition.js.map +1 -0
- package/dist/crop.d.ts +48 -0
- package/dist/crop.d.ts.map +1 -0
- package/dist/crop.js +75 -0
- package/dist/crop.js.map +1 -0
- package/dist/defaults.d.ts +142 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +335 -0
- package/dist/defaults.js.map +1 -0
- package/dist/dependencyHash.d.ts +14 -0
- package/dist/dependencyHash.d.ts.map +1 -0
- package/dist/dependencyHash.js +19 -0
- package/dist/dependencyHash.js.map +1 -0
- package/dist/dropResolve.d.ts +40 -0
- package/dist/dropResolve.d.ts.map +1 -0
- package/dist/dropResolve.js +137 -0
- package/dist/dropResolve.js.map +1 -0
- package/dist/examples/node.d.ts +11 -0
- package/dist/examples/node.d.ts.map +1 -0
- package/dist/examples/node.js +87 -0
- package/dist/examples/node.js.map +1 -0
- package/dist/extension.d.ts +52 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +269 -0
- package/dist/extension.js.map +1 -0
- package/dist/extensionRequest.d.ts +40 -0
- package/dist/extensionRequest.d.ts.map +1 -0
- package/dist/extensionRequest.js +135 -0
- package/dist/extensionRequest.js.map +1 -0
- package/dist/fill-text.d.ts +30 -0
- package/dist/fill-text.d.ts.map +1 -0
- package/dist/fill-text.js +73 -0
- package/dist/fill-text.js.map +1 -0
- package/dist/fonts/catalog.d.ts +97 -0
- package/dist/fonts/catalog.d.ts.map +1 -0
- package/dist/fonts/catalog.js +276 -0
- package/dist/fonts/catalog.js.map +1 -0
- package/dist/fonts/css.d.ts +24 -0
- package/dist/fonts/css.d.ts.map +1 -0
- package/dist/fonts/css.js +50 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/index.d.ts +10 -0
- package/dist/fonts/index.d.ts.map +1 -0
- package/dist/fonts/index.js +10 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/register-node.d.ts +45 -0
- package/dist/fonts/register-node.d.ts.map +1 -0
- package/dist/fonts/register-node.js +71 -0
- package/dist/fonts/register-node.js.map +1 -0
- package/dist/generatedMatte.d.ts +86 -0
- package/dist/generatedMatte.d.ts.map +1 -0
- package/dist/generatedMatte.js +152 -0
- package/dist/generatedMatte.js.map +1 -0
- package/dist/generative.d.ts +145 -0
- package/dist/generative.d.ts.map +1 -0
- package/dist/generative.js +396 -0
- package/dist/generative.js.map +1 -0
- package/dist/group.d.ts +47 -0
- package/dist/group.d.ts.map +1 -0
- package/dist/group.js +131 -0
- package/dist/group.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/interchange.d.ts +47 -0
- package/dist/interchange.d.ts.map +1 -0
- package/dist/interchange.js +158 -0
- package/dist/interchange.js.map +1 -0
- package/dist/keyframes.d.ts +44 -0
- package/dist/keyframes.d.ts.map +1 -0
- package/dist/keyframes.js +148 -0
- package/dist/keyframes.js.map +1 -0
- package/dist/lineDelivery.d.ts +108 -0
- package/dist/lineDelivery.d.ts.map +1 -0
- package/dist/lineDelivery.js +154 -0
- package/dist/lineDelivery.js.map +1 -0
- package/dist/linked.d.ts +41 -0
- package/dist/linked.d.ts.map +1 -0
- package/dist/linked.js +166 -0
- package/dist/linked.js.map +1 -0
- package/dist/lipSyncRequest.d.ts +65 -0
- package/dist/lipSyncRequest.d.ts.map +1 -0
- package/dist/lipSyncRequest.js +73 -0
- package/dist/lipSyncRequest.js.map +1 -0
- package/dist/measureClipDurations.d.ts +7 -0
- package/dist/measureClipDurations.d.ts.map +1 -0
- package/dist/measureClipDurations.js +17 -0
- package/dist/measureClipDurations.js.map +1 -0
- package/dist/mediaTrack.d.ts +120 -0
- package/dist/mediaTrack.d.ts.map +1 -0
- package/dist/mediaTrack.js +269 -0
- package/dist/mediaTrack.js.map +1 -0
- package/dist/midi/cacheKey.d.ts +25 -0
- package/dist/midi/cacheKey.d.ts.map +1 -0
- package/dist/midi/cacheKey.js +54 -0
- package/dist/midi/cacheKey.js.map +1 -0
- package/dist/midi/edit.d.ts +48 -0
- package/dist/midi/edit.d.ts.map +1 -0
- package/dist/midi/edit.js +93 -0
- package/dist/midi/edit.js.map +1 -0
- package/dist/midi/engines/bl1.d.ts +29 -0
- package/dist/midi/engines/bl1.d.ts.map +1 -0
- package/dist/midi/engines/bl1.js +128 -0
- package/dist/midi/engines/bl1.js.map +1 -0
- package/dist/midi/engines/dr1.d.ts +28 -0
- package/dist/midi/engines/dr1.d.ts.map +1 -0
- package/dist/midi/engines/dr1.js +101 -0
- package/dist/midi/engines/dr1.js.map +1 -0
- package/dist/midi/engines/dsp.d.ts +126 -0
- package/dist/midi/engines/dsp.d.ts.map +1 -0
- package/dist/midi/engines/dsp.js +371 -0
- package/dist/midi/engines/dsp.js.map +1 -0
- package/dist/midi/engines/index.d.ts +13 -0
- package/dist/midi/engines/index.d.ts.map +1 -0
- package/dist/midi/engines/index.js +13 -0
- package/dist/midi/engines/index.js.map +1 -0
- package/dist/midi/engines/kits.d.ts +12 -0
- package/dist/midi/engines/kits.d.ts.map +1 -0
- package/dist/midi/engines/kits.js +121 -0
- package/dist/midi/engines/kits.js.map +1 -0
- package/dist/midi/engines/wavetables.d.ts +45 -0
- package/dist/midi/engines/wavetables.d.ts.map +1 -0
- package/dist/midi/engines/wavetables.js +334 -0
- package/dist/midi/engines/wavetables.js.map +1 -0
- package/dist/midi/engines/wt1.d.ts +30 -0
- package/dist/midi/engines/wt1.d.ts.map +1 -0
- package/dist/midi/engines/wt1.js +91 -0
- package/dist/midi/engines/wt1.js.map +1 -0
- package/dist/midi/grid.d.ts +51 -0
- package/dist/midi/grid.d.ts.map +1 -0
- package/dist/midi/grid.js +104 -0
- package/dist/midi/grid.js.map +1 -0
- package/dist/midi/index.d.ts +20 -0
- package/dist/midi/index.d.ts.map +1 -0
- package/dist/midi/index.js +20 -0
- package/dist/midi/index.js.map +1 -0
- package/dist/midi/instrument.d.ts +32 -0
- package/dist/midi/instrument.d.ts.map +1 -0
- package/dist/midi/instrument.js +73 -0
- package/dist/midi/instrument.js.map +1 -0
- package/dist/midi/notes.d.ts +46 -0
- package/dist/midi/notes.d.ts.map +1 -0
- package/dist/midi/notes.js +121 -0
- package/dist/midi/notes.js.map +1 -0
- package/dist/midi/notesEdit.d.ts +94 -0
- package/dist/midi/notesEdit.d.ts.map +1 -0
- package/dist/midi/notesEdit.js +159 -0
- package/dist/midi/notesEdit.js.map +1 -0
- package/dist/midi/presets.d.ts +29 -0
- package/dist/midi/presets.d.ts.map +1 -0
- package/dist/midi/presets.js +281 -0
- package/dist/midi/presets.js.map +1 -0
- package/dist/midi/tempo.d.ts +27 -0
- package/dist/midi/tempo.d.ts.map +1 -0
- package/dist/midi/tempo.js +57 -0
- package/dist/midi/tempo.js.map +1 -0
- package/dist/midi/ticks.d.ts +25 -0
- package/dist/midi/ticks.d.ts.map +1 -0
- package/dist/midi/ticks.js +35 -0
- package/dist/midi/ticks.js.map +1 -0
- package/dist/midi/voice.d.ts +148 -0
- package/dist/midi/voice.d.ts.map +1 -0
- package/dist/midi/voice.js +348 -0
- package/dist/midi/voice.js.map +1 -0
- package/dist/midi/wav.d.ts +14 -0
- package/dist/midi/wav.d.ts.map +1 -0
- package/dist/midi/wav.js +51 -0
- package/dist/midi/wav.js.map +1 -0
- package/dist/model3d.d.ts +41 -0
- package/dist/model3d.d.ts.map +1 -0
- package/dist/model3d.js +39 -0
- package/dist/model3d.js.map +1 -0
- package/dist/model3dBake.d.ts +80 -0
- package/dist/model3dBake.d.ts.map +1 -0
- package/dist/model3dBake.js +127 -0
- package/dist/model3dBake.js.map +1 -0
- package/dist/ops/apply.d.ts +32 -0
- package/dist/ops/apply.d.ts.map +1 -0
- package/dist/ops/apply.js +1595 -0
- package/dist/ops/apply.js.map +1 -0
- package/dist/ops/index.d.ts +13 -0
- package/dist/ops/index.d.ts.map +1 -0
- package/dist/ops/index.js +13 -0
- package/dist/ops/index.js.map +1 -0
- package/dist/ops/op.d.ts +407 -0
- package/dist/ops/op.d.ts.map +1 -0
- package/dist/ops/op.js +61 -0
- package/dist/ops/op.js.map +1 -0
- package/dist/ops/serialize.d.ts +77 -0
- package/dist/ops/serialize.d.ts.map +1 -0
- package/dist/ops/serialize.js +81 -0
- package/dist/ops/serialize.js.map +1 -0
- package/dist/ops/types.d.ts +150 -0
- package/dist/ops/types.d.ts.map +1 -0
- package/dist/ops/types.js +12 -0
- package/dist/ops/types.js.map +1 -0
- package/dist/pathSampling.d.ts +51 -0
- package/dist/pathSampling.d.ts.map +1 -0
- package/dist/pathSampling.js +111 -0
- package/dist/pathSampling.js.map +1 -0
- package/dist/placement/index.d.ts +2 -0
- package/dist/placement/index.d.ts.map +1 -0
- package/dist/placement/index.js +2 -0
- package/dist/placement/index.js.map +1 -0
- package/dist/placement/resolveTrackPlacement.d.ts +40 -0
- package/dist/placement/resolveTrackPlacement.d.ts.map +1 -0
- package/dist/placement/resolveTrackPlacement.js +71 -0
- package/dist/placement/resolveTrackPlacement.js.map +1 -0
- package/dist/production.d.ts +99 -0
- package/dist/production.d.ts.map +1 -0
- package/dist/production.js +328 -0
- package/dist/production.js.map +1 -0
- package/dist/reassemble.d.ts +68 -0
- package/dist/reassemble.d.ts.map +1 -0
- package/dist/reassemble.js +187 -0
- package/dist/reassemble.js.map +1 -0
- package/dist/recipe.d.ts +24 -0
- package/dist/recipe.d.ts.map +1 -0
- package/dist/recipe.js +89 -0
- package/dist/recipe.js.map +1 -0
- package/dist/recordedVoiceReplacement.d.ts +70 -0
- package/dist/recordedVoiceReplacement.d.ts.map +1 -0
- package/dist/recordedVoiceReplacement.js +82 -0
- package/dist/recordedVoiceReplacement.js.map +1 -0
- package/dist/reframe.d.ts +31 -0
- package/dist/reframe.d.ts.map +1 -0
- package/dist/reframe.js +227 -0
- package/dist/reframe.js.map +1 -0
- package/dist/render/canvas2d.d.ts +419 -0
- package/dist/render/canvas2d.d.ts.map +1 -0
- package/dist/render/canvas2d.js +1392 -0
- package/dist/render/canvas2d.js.map +1 -0
- package/dist/render/color.d.ts +26 -0
- package/dist/render/color.d.ts.map +1 -0
- package/dist/render/color.js +305 -0
- package/dist/render/color.js.map +1 -0
- package/dist/render/cpuLegacyEffects.d.ts +17 -0
- package/dist/render/cpuLegacyEffects.d.ts.map +1 -0
- package/dist/render/cpuLegacyEffects.js +347 -0
- package/dist/render/cpuLegacyEffects.js.map +1 -0
- package/dist/render/cpuVisualEffects.d.ts +13 -0
- package/dist/render/cpuVisualEffects.d.ts.map +1 -0
- package/dist/render/cpuVisualEffects.js +388 -0
- package/dist/render/cpuVisualEffects.js.map +1 -0
- package/dist/render/cubeLut.d.ts +12 -0
- package/dist/render/cubeLut.d.ts.map +1 -0
- package/dist/render/cubeLut.js +81 -0
- package/dist/render/cubeLut.js.map +1 -0
- package/dist/render/curveFitting.d.ts +28 -0
- package/dist/render/curveFitting.d.ts.map +1 -0
- package/dist/render/curveFitting.js +94 -0
- package/dist/render/curveFitting.js.map +1 -0
- package/dist/render/draw.d.ts +265 -0
- package/dist/render/draw.d.ts.map +1 -0
- package/dist/render/draw.js +929 -0
- package/dist/render/draw.js.map +1 -0
- package/dist/render/effects.d.ts +120 -0
- package/dist/render/effects.d.ts.map +1 -0
- package/dist/render/effects.js +804 -0
- package/dist/render/effects.js.map +1 -0
- package/dist/render/frameCompositor.d.ts +502 -0
- package/dist/render/frameCompositor.d.ts.map +1 -0
- package/dist/render/frameCompositor.js +1331 -0
- package/dist/render/frameCompositor.js.map +1 -0
- package/dist/render/index.d.ts +27 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +27 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/layout.d.ts +17 -0
- package/dist/render/layout.d.ts.map +1 -0
- package/dist/render/layout.js +197 -0
- package/dist/render/layout.js.map +1 -0
- package/dist/render/model3dBakeSamples.d.ts +45 -0
- package/dist/render/model3dBakeSamples.d.ts.map +1 -0
- package/dist/render/model3dBakeSamples.js +68 -0
- package/dist/render/model3dBakeSamples.js.map +1 -0
- package/dist/render/motionBlur.d.ts +170 -0
- package/dist/render/motionBlur.d.ts.map +1 -0
- package/dist/render/motionBlur.js +193 -0
- package/dist/render/motionBlur.js.map +1 -0
- package/dist/render/sceneModel.d.ts +577 -0
- package/dist/render/sceneModel.d.ts.map +1 -0
- package/dist/render/sceneModel.js +1460 -0
- package/dist/render/sceneModel.js.map +1 -0
- package/dist/render/shapeGeometry.d.ts +81 -0
- package/dist/render/shapeGeometry.d.ts.map +1 -0
- package/dist/render/shapeGeometry.js +460 -0
- package/dist/render/shapeGeometry.js.map +1 -0
- package/dist/render/spatial.d.ts +9 -0
- package/dist/render/spatial.d.ts.map +1 -0
- package/dist/render/spatial.js +58 -0
- package/dist/render/spatial.js.map +1 -0
- package/dist/render/svgPath.d.ts +80 -0
- package/dist/render/svgPath.d.ts.map +1 -0
- package/dist/render/svgPath.js +199 -0
- package/dist/render/svgPath.js.map +1 -0
- package/dist/render/temporal.d.ts +6 -0
- package/dist/render/temporal.d.ts.map +1 -0
- package/dist/render/temporal.js +74 -0
- package/dist/render/temporal.js.map +1 -0
- package/dist/render/textLayout.d.ts +159 -0
- package/dist/render/textLayout.d.ts.map +1 -0
- package/dist/render/textLayout.js +301 -0
- package/dist/render/textLayout.js.map +1 -0
- package/dist/render/trackEffects.d.ts +23 -0
- package/dist/render/trackEffects.d.ts.map +1 -0
- package/dist/render/trackEffects.js +93 -0
- package/dist/render/trackEffects.js.map +1 -0
- package/dist/render/transform.d.ts +54 -0
- package/dist/render/transform.d.ts.map +1 -0
- package/dist/render/transform.js +222 -0
- package/dist/render/transform.js.map +1 -0
- package/dist/render/transition.d.ts +109 -0
- package/dist/render/transition.d.ts.map +1 -0
- package/dist/render/transition.js +351 -0
- package/dist/render/transition.js.map +1 -0
- package/dist/retarget.d.ts +73 -0
- package/dist/retarget.d.ts.map +1 -0
- package/dist/retarget.js +305 -0
- package/dist/retarget.js.map +1 -0
- package/dist/rippleEdit.d.ts +83 -0
- package/dist/rippleEdit.d.ts.map +1 -0
- package/dist/rippleEdit.js +184 -0
- package/dist/rippleEdit.js.map +1 -0
- package/dist/scene.d.ts +28 -0
- package/dist/scene.d.ts.map +1 -0
- package/dist/scene.js +28 -0
- package/dist/scene.js.map +1 -0
- package/dist/script-link.d.ts +52 -0
- package/dist/script-link.d.ts.map +1 -0
- package/dist/script-link.js +78 -0
- package/dist/script-link.js.map +1 -0
- package/dist/script.d.ts +52 -0
- package/dist/script.d.ts.map +1 -0
- package/dist/script.js +93 -0
- package/dist/script.js.map +1 -0
- package/dist/snap.d.ts +2 -0
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +21 -0
- package/dist/snap.js.map +1 -0
- package/dist/snapping/buildSnapPoints.d.ts +16 -0
- package/dist/snapping/buildSnapPoints.d.ts.map +1 -0
- package/dist/snapping/buildSnapPoints.js +39 -0
- package/dist/snapping/buildSnapPoints.js.map +1 -0
- package/dist/snapping/index.d.ts +3 -0
- package/dist/snapping/index.d.ts.map +1 -0
- package/dist/snapping/index.js +3 -0
- package/dist/snapping/index.js.map +1 -0
- package/dist/snapping/resolveSnap.d.ts +19 -0
- package/dist/snapping/resolveSnap.d.ts.map +1 -0
- package/dist/snapping/resolveSnap.js +39 -0
- package/dist/snapping/resolveSnap.js.map +1 -0
- package/dist/sourceRate.d.ts +12 -0
- package/dist/sourceRate.d.ts.map +1 -0
- package/dist/sourceRate.js +13 -0
- package/dist/sourceRate.js.map +1 -0
- package/dist/spatialVideoRequest.d.ts +91 -0
- package/dist/spatialVideoRequest.d.ts.map +1 -0
- package/dist/spatialVideoRequest.js +175 -0
- package/dist/spatialVideoRequest.js.map +1 -0
- package/dist/splitClip.d.ts +3 -0
- package/dist/splitClip.d.ts.map +1 -0
- package/dist/splitClip.js +190 -0
- package/dist/splitClip.js.map +1 -0
- package/dist/stableSerialize.d.ts +11 -0
- package/dist/stableSerialize.d.ts.map +1 -0
- package/dist/stableSerialize.js +31 -0
- package/dist/stableSerialize.js.map +1 -0
- package/dist/staleSet.d.ts +41 -0
- package/dist/staleSet.d.ts.map +1 -0
- package/dist/staleSet.js +106 -0
- package/dist/staleSet.js.map +1 -0
- package/dist/storyboard.d.ts +221 -0
- package/dist/storyboard.d.ts.map +1 -0
- package/dist/storyboard.js +417 -0
- package/dist/storyboard.js.map +1 -0
- package/dist/subtitles.d.ts +61 -0
- package/dist/subtitles.d.ts.map +1 -0
- package/dist/subtitles.js +92 -0
- package/dist/subtitles.js.map +1 -0
- package/dist/takes.d.ts +76 -0
- package/dist/takes.d.ts.map +1 -0
- package/dist/takes.js +238 -0
- package/dist/takes.js.map +1 -0
- package/dist/timeRemap.d.ts +101 -0
- package/dist/timeRemap.d.ts.map +1 -0
- package/dist/timeRemap.js +183 -0
- package/dist/timeRemap.js.map +1 -0
- package/dist/trackOrder.d.ts +38 -0
- package/dist/trackOrder.d.ts.map +1 -0
- package/dist/trackOrder.js +54 -0
- package/dist/trackOrder.js.map +1 -0
- package/dist/transitionAtCut.d.ts +89 -0
- package/dist/transitionAtCut.d.ts.map +1 -0
- package/dist/transitionAtCut.js +217 -0
- package/dist/transitionAtCut.js.map +1 -0
- package/dist/trimClip.d.ts +13 -0
- package/dist/trimClip.d.ts.map +1 -0
- package/dist/trimClip.js +60 -0
- package/dist/trimClip.js.map +1 -0
- package/dist/types.d.ts +1772 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +84 -0
- package/dist/types.js.map +1 -0
- package/fonts/BebasNeue-Regular.ttf +0 -0
- package/fonts/Inter-ExtraBold.ttf +0 -0
- package/fonts/Inter-Italic-Variable.ttf +0 -0
- package/fonts/Inter-SemiBold.ttf +0 -0
- package/fonts/Inter-Variable.ttf +0 -0
- package/fonts/JetBrainsMono-Italic-Variable.ttf +0 -0
- package/fonts/JetBrainsMono-Variable.ttf +0 -0
- package/fonts/Lora-Italic-Variable.ttf +0 -0
- package/fonts/Lora-Variable.ttf +0 -0
- package/fonts/OFL-BebasNeue.txt +93 -0
- package/fonts/OFL-Inter.txt +93 -0
- package/fonts/OFL-JetBrainsMono.txt +93 -0
- package/fonts/OFL-Lora.txt +93 -0
- package/fonts/OFL-PlayfairDisplay.txt +93 -0
- package/fonts/OFL-SpaceGrotesk.txt +93 -0
- package/fonts/PlayfairDisplay-Italic-Variable.ttf +0 -0
- package/fonts/PlayfairDisplay-Variable.ttf +0 -0
- package/fonts/SpaceGrotesk-Variable.ttf +0 -0
- package/package.json +108 -0
package/dist/clone.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloning an approved cut for a recast board.
|
|
3
|
+
*
|
|
4
|
+
* A director approves one cut: shot clips laid down in order, plus whatever
|
|
5
|
+
* else was edited on top — a text overlay, a music bed, a logo sting. When a
|
|
6
|
+
* board is recast for another SKU, the copy should inherit that cut rather than
|
|
7
|
+
* a bare assembly of its own shots.
|
|
8
|
+
*
|
|
9
|
+
* {@link cloneTimelineForBoard} is the first half: a new sequence in which the
|
|
10
|
+
* clips owned by the source board point at the copy instead, with their media
|
|
11
|
+
* cleared so nothing plays the template's footage. The second half is the
|
|
12
|
+
* re-assemble, which fills those clips from the copy's renders and — through
|
|
13
|
+
* `foreignTimelineParts` (`reassemble.ts`), which keeps every clip the board
|
|
14
|
+
* does not own — leaves the overlay and the music bed exactly where they were.
|
|
15
|
+
*/
|
|
16
|
+
import { createTimeOrderedUuid } from "./defaults.js";
|
|
17
|
+
/** A clip re-stamped onto the destination board, with the source's media gone. */
|
|
18
|
+
function recloneClip(clip, boardId) {
|
|
19
|
+
const next = {
|
|
20
|
+
...clip,
|
|
21
|
+
storyboardBoardId: boardId,
|
|
22
|
+
status: "draft",
|
|
23
|
+
versions: []
|
|
24
|
+
};
|
|
25
|
+
delete next.currentAssetId;
|
|
26
|
+
delete next.thumbnailAssetId;
|
|
27
|
+
delete next.waveformAssetId;
|
|
28
|
+
delete next.dependencyHash;
|
|
29
|
+
delete next.lastGeneratedHash;
|
|
30
|
+
return next;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A copy of `seq` whose shot clips belong to `to.boardId`.
|
|
34
|
+
*
|
|
35
|
+
* The copy takes a fresh sequence id and stamps `templateId` with the source's,
|
|
36
|
+
* so the lineage is readable from the row. Every clip carrying
|
|
37
|
+
* `storyboardBoardId === from.boardId` is re-stamped and emptied of media;
|
|
38
|
+
* every other clip, every track, and every marker is copied verbatim, because
|
|
39
|
+
* they are the edit the director approved and no re-assemble should rebuild
|
|
40
|
+
* them.
|
|
41
|
+
*/
|
|
42
|
+
export function cloneTimelineForBoard(seq, from, to) {
|
|
43
|
+
const now = new Date().toISOString();
|
|
44
|
+
return {
|
|
45
|
+
...seq,
|
|
46
|
+
id: createTimeOrderedUuid(),
|
|
47
|
+
templateId: seq.id,
|
|
48
|
+
clips: seq.clips.map((clip) => clip.storyboardBoardId === from.boardId ? recloneClip(clip, to.boardId) : clip),
|
|
49
|
+
createdAt: now,
|
|
50
|
+
updatedAt: now
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../src/clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,kFAAkF;AAClF,SAAS,WAAW,CAAC,IAAkB,EAAE,OAAe;IACtD,MAAM,IAAI,GAAiB;QACzB,GAAG,IAAI;QACP,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,EAAE;KACb,CAAC;IACF,OAAO,IAAI,CAAC,cAAc,CAAC;IAC3B,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC7B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC5B,OAAO,IAAI,CAAC,cAAc,CAAC;IAC3B,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAqB,EACrB,IAAyB,EACzB,EAAuB;IAEvB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO;QACL,GAAG,GAAG;QACN,EAAE,EAAE,qBAAqB,EAAE;QAC3B,UAAU,EAAE,GAAG,CAAC,EAAE;QAClB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5B,IAAI,CAAC,iBAAiB,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/E;QACD,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compositions — a stored group of clips with named parameters.
|
|
3
|
+
*
|
|
4
|
+
* A composition is a document fragment, not a second renderer (AS6): the group
|
|
5
|
+
* clip and its children are ordinary {@link TimelineClip}s, and instantiating
|
|
6
|
+
* one copies them into the target document with fresh ids. Child times are
|
|
7
|
+
* stored relative to the group's start, so a template drops in at any timecode.
|
|
8
|
+
*
|
|
9
|
+
* A parameter names a value inside a child by JSON pointer — `/1/textStyle/text`
|
|
10
|
+
* is the text of the second child. The pointer is resolved against the children
|
|
11
|
+
* array, so a template's parameters survive a rename and break loudly when the
|
|
12
|
+
* child they addressed is gone.
|
|
13
|
+
*/
|
|
14
|
+
import type { TimelineClip } from "./types.js";
|
|
15
|
+
/** The value kinds a composition parameter carries. */
|
|
16
|
+
export declare const COMPOSITION_PARAM_TYPES: readonly ["string", "number", "color", "boolean"];
|
|
17
|
+
export type CompositionParamType = (typeof COMPOSITION_PARAM_TYPES)[number];
|
|
18
|
+
export type CompositionParamValue = string | number | boolean;
|
|
19
|
+
export interface CompositionParam {
|
|
20
|
+
type: CompositionParamType;
|
|
21
|
+
/** The value the template ships with — what a caller gets by not passing one. */
|
|
22
|
+
default: CompositionParamValue;
|
|
23
|
+
/**
|
|
24
|
+
* JSON pointer into {@link TimelineComposition.children}, e.g.
|
|
25
|
+
* `/1/textStyle/text`. The leading segment is the child's index.
|
|
26
|
+
*/
|
|
27
|
+
path: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface TimelineComposition {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
params: Record<string, CompositionParam>;
|
|
35
|
+
/** The group clip. Its `startMs` is the origin child times are relative to. */
|
|
36
|
+
group: TimelineClip;
|
|
37
|
+
/** The group's children, times relative to the group start. */
|
|
38
|
+
children: TimelineClip[];
|
|
39
|
+
}
|
|
40
|
+
export interface InstantiateCompositionOptions {
|
|
41
|
+
/** Where the group lands on the timeline. */
|
|
42
|
+
startMs: number;
|
|
43
|
+
/** Track for the group. Children keep their own tracks unless this is set. */
|
|
44
|
+
trackId?: string;
|
|
45
|
+
params?: Record<string, CompositionParamValue>;
|
|
46
|
+
/** Id minter, for a deterministic test. Defaults to the document's own. */
|
|
47
|
+
newId?: () => string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether a value matches a parameter's declared type. `color` is a string
|
|
51
|
+
* shaped like a CSS hex colour: a template's colour slot feeds a canvas fill,
|
|
52
|
+
* and an arbitrary string there paints nothing rather than failing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function compositionValueMatchesType(type: CompositionParamType, value: unknown): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Check a composition's parameters against its own children: every pointer must
|
|
57
|
+
* address something that exists, and every default must match its declared
|
|
58
|
+
* type. Returns the problems, empty when the template is sound.
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateCompositionParams(composition: TimelineComposition): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Copy a composition into a document as fresh clips: the group first, then its
|
|
63
|
+
* children, each with a new id, the group's start applied, and the template's
|
|
64
|
+
* parameters written in.
|
|
65
|
+
*
|
|
66
|
+
* Throws when a parameter is unknown to the template, is of the wrong type, or
|
|
67
|
+
* addresses a child field that is not there. All three are authoring mistakes
|
|
68
|
+
* whose only symptom otherwise is a title that never says what it was asked to.
|
|
69
|
+
*/
|
|
70
|
+
export declare function instantiateComposition(composition: TimelineComposition, options: InstantiateCompositionOptions): TimelineClip[];
|
|
71
|
+
export interface ExtractCompositionSource {
|
|
72
|
+
clips: readonly TimelineClip[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Turn a group already on the timeline into a reusable composition: the group
|
|
76
|
+
* clip plus every clip parented to it, child times rebased to the group start.
|
|
77
|
+
*
|
|
78
|
+
* The parameters are the caller's — a template is a statement about which
|
|
79
|
+
* values are meant to vary, which nothing in a document records — and each one
|
|
80
|
+
* is checked against the extracted children before the composition is returned.
|
|
81
|
+
*/
|
|
82
|
+
export declare function extractComposition(doc: ExtractCompositionSource, groupId: string, params?: Record<string, CompositionParam>, meta?: {
|
|
83
|
+
id?: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
}): TimelineComposition;
|
|
87
|
+
//# sourceMappingURL=composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,YAClC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,CACD,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,iFAAiF;IACjF,OAAO,EAAE,qBAAqB,CAAC;IAC/B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,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4
|
+
* A composition is a document fragment, not a second renderer (AS6): the group
|
|
5
|
+
* clip and its children are ordinary {@link TimelineClip}s, and instantiating
|
|
6
|
+
* one copies them into the target document with fresh ids. Child times are
|
|
7
|
+
* stored relative to the group's start, so a template drops in at any timecode.
|
|
8
|
+
*
|
|
9
|
+
* A parameter names a value inside a child by JSON pointer — `/1/textStyle/text`
|
|
10
|
+
* is the text of the second child. The pointer is resolved against the children
|
|
11
|
+
* array, so a template's parameters survive a rename and break loudly when the
|
|
12
|
+
* child they addressed is gone.
|
|
13
|
+
*/
|
|
14
|
+
import { makeClip } from "./defaults.js";
|
|
15
|
+
/** The value kinds a composition parameter carries. */
|
|
16
|
+
export const COMPOSITION_PARAM_TYPES = [
|
|
17
|
+
"string",
|
|
18
|
+
"number",
|
|
19
|
+
"color",
|
|
20
|
+
"boolean"
|
|
21
|
+
];
|
|
22
|
+
/** A pointer's segments, with JSON Pointer's `~1`/`~0` escapes undone. */
|
|
23
|
+
function pointerSegments(pointer) {
|
|
24
|
+
if (pointer === "" || pointer === "/")
|
|
25
|
+
return [];
|
|
26
|
+
if (!pointer.startsWith("/")) {
|
|
27
|
+
throw new Error(`Composition parameter path "${pointer}" must be a JSON pointer starting with "/".`);
|
|
28
|
+
}
|
|
29
|
+
return pointer
|
|
30
|
+
.slice(1)
|
|
31
|
+
.split("/")
|
|
32
|
+
.map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
33
|
+
}
|
|
34
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
35
|
+
/**
|
|
36
|
+
* Walk a pointer to its parent container and report the leaf key, or null when
|
|
37
|
+
* the container does not exist. A pointer whose container is missing addresses
|
|
38
|
+
* nothing at all, which is the failure a caller has to be told about — a
|
|
39
|
+
* template that silently writes nowhere renders the default forever.
|
|
40
|
+
*/
|
|
41
|
+
function resolveCompositionPointer(children, pointer) {
|
|
42
|
+
const segments = pointerSegments(pointer);
|
|
43
|
+
if (segments.length === 0)
|
|
44
|
+
return null;
|
|
45
|
+
let cursor = children;
|
|
46
|
+
for (const segment of segments.slice(0, -1)) {
|
|
47
|
+
if (Array.isArray(cursor)) {
|
|
48
|
+
const index = Number(segment);
|
|
49
|
+
if (!Number.isInteger(index) || index < 0 || index >= cursor.length) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
cursor = cursor[index];
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (!isRecord(cursor))
|
|
56
|
+
return null;
|
|
57
|
+
cursor = cursor[segment];
|
|
58
|
+
}
|
|
59
|
+
if (!isRecord(cursor) && !Array.isArray(cursor))
|
|
60
|
+
return null;
|
|
61
|
+
return {
|
|
62
|
+
container: cursor,
|
|
63
|
+
key: segments[segments.length - 1]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const HEX_COLOR = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
|
|
67
|
+
/**
|
|
68
|
+
* Whether a value matches a parameter's declared type. `color` is a string
|
|
69
|
+
* shaped like a CSS hex colour: a template's colour slot feeds a canvas fill,
|
|
70
|
+
* and an arbitrary string there paints nothing rather than failing.
|
|
71
|
+
*/
|
|
72
|
+
export function compositionValueMatchesType(type, value) {
|
|
73
|
+
switch (type) {
|
|
74
|
+
case "string":
|
|
75
|
+
return typeof value === "string";
|
|
76
|
+
case "number":
|
|
77
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
78
|
+
case "boolean":
|
|
79
|
+
return typeof value === "boolean";
|
|
80
|
+
case "color":
|
|
81
|
+
return typeof value === "string" && HEX_COLOR.test(value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check a composition's parameters against its own children: every pointer must
|
|
86
|
+
* address something that exists, and every default must match its declared
|
|
87
|
+
* type. Returns the problems, empty when the template is sound.
|
|
88
|
+
*/
|
|
89
|
+
export function validateCompositionParams(composition) {
|
|
90
|
+
const problems = [];
|
|
91
|
+
for (const [name, param] of Object.entries(composition.params ?? {})) {
|
|
92
|
+
if (!COMPOSITION_PARAM_TYPES.includes(param.type)) {
|
|
93
|
+
problems.push(`Parameter "${name}" has type "${param.type}"; expected one of ${COMPOSITION_PARAM_TYPES.join(", ")}.`);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
let resolved;
|
|
97
|
+
try {
|
|
98
|
+
resolved = resolveCompositionPointer(composition.children, param.path);
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
problems.push(e instanceof Error ? e.message : String(e));
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!resolved) {
|
|
105
|
+
problems.push(`Parameter "${name}" points at ${param.path}, which no child of "${composition.name}" has.`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (!compositionValueMatchesType(param.type, param.default)) {
|
|
109
|
+
problems.push(`Parameter "${name}" is declared ${param.type} but its default is ${JSON.stringify(param.default)}.`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return problems;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Copy a composition into a document as fresh clips: the group first, then its
|
|
116
|
+
* children, each with a new id, the group's start applied, and the template's
|
|
117
|
+
* parameters written in.
|
|
118
|
+
*
|
|
119
|
+
* Throws when a parameter is unknown to the template, is of the wrong type, or
|
|
120
|
+
* addresses a child field that is not there. All three are authoring mistakes
|
|
121
|
+
* whose only symptom otherwise is a title that never says what it was asked to.
|
|
122
|
+
*/
|
|
123
|
+
export function instantiateComposition(composition, options) {
|
|
124
|
+
const mint = options.newId ?? (() => makeClip().id);
|
|
125
|
+
const children = composition.children.map((child) => structuredClone(child));
|
|
126
|
+
const supplied = options.params ?? {};
|
|
127
|
+
const applied = {};
|
|
128
|
+
for (const [name, param] of Object.entries(composition.params ?? {})) {
|
|
129
|
+
const value = Object.prototype.hasOwnProperty.call(supplied, name)
|
|
130
|
+
? supplied[name]
|
|
131
|
+
: param.default;
|
|
132
|
+
if (!compositionValueMatchesType(param.type, value)) {
|
|
133
|
+
throw new Error(`Parameter "${name}" of composition "${composition.name}" is ${param.type}; got ${JSON.stringify(value)}.`);
|
|
134
|
+
}
|
|
135
|
+
const target = resolveCompositionPointer(children, param.path);
|
|
136
|
+
if (!target) {
|
|
137
|
+
throw new Error(`Parameter "${name}" of composition "${composition.name}" points at ${param.path}, which no child has.`);
|
|
138
|
+
}
|
|
139
|
+
if (Array.isArray(target.container)) {
|
|
140
|
+
target.container[Number(target.key)] = value;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
target.container[target.key] = value;
|
|
144
|
+
}
|
|
145
|
+
applied[name] = value;
|
|
146
|
+
}
|
|
147
|
+
for (const name of Object.keys(supplied)) {
|
|
148
|
+
if (!Object.prototype.hasOwnProperty.call(composition.params ?? {}, name)) {
|
|
149
|
+
const known = Object.keys(composition.params ?? {});
|
|
150
|
+
throw new Error(`Composition "${composition.name}" has no parameter "${name}". ` +
|
|
151
|
+
(known.length > 0
|
|
152
|
+
? `Its parameters: ${known.join(", ")}.`
|
|
153
|
+
: "It declares none."));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const groupId = mint();
|
|
157
|
+
const idMap = new Map([[composition.group.id, groupId]]);
|
|
158
|
+
for (const child of children) {
|
|
159
|
+
idMap.set(child.id, mint());
|
|
160
|
+
}
|
|
161
|
+
const remapId = (id) => idMap.get(id) ?? id;
|
|
162
|
+
const remapReferences = (clip) => {
|
|
163
|
+
if (clip.layout) {
|
|
164
|
+
if (clip.layout.children)
|
|
165
|
+
clip.layout.children = clip.layout.children.map(remapId);
|
|
166
|
+
if (clip.layout.targetClipId)
|
|
167
|
+
clip.layout.targetClipId = remapId(clip.layout.targetClipId);
|
|
168
|
+
}
|
|
169
|
+
if (clip.animationLinks) {
|
|
170
|
+
clip.animationLinks = clip.animationLinks.map((link) => "sourceClipId" in link ? { ...link, sourceClipId: remapId(link.sourceClipId) } : link);
|
|
171
|
+
}
|
|
172
|
+
if (clip.matte)
|
|
173
|
+
clip.matte.sourceClipId = remapId(clip.matte.sourceClipId);
|
|
174
|
+
if (clip.sourceClipId)
|
|
175
|
+
clip.sourceClipId = remapId(clip.sourceClipId);
|
|
176
|
+
};
|
|
177
|
+
const group = {
|
|
178
|
+
...structuredClone(composition.group),
|
|
179
|
+
id: groupId,
|
|
180
|
+
startMs: options.startMs,
|
|
181
|
+
compositionId: composition.id,
|
|
182
|
+
compositionParams: applied
|
|
183
|
+
};
|
|
184
|
+
if (options.trackId)
|
|
185
|
+
group.trackId = options.trackId;
|
|
186
|
+
delete group.parentId;
|
|
187
|
+
remapReferences(group);
|
|
188
|
+
const out = [group];
|
|
189
|
+
for (const child of children) {
|
|
190
|
+
const instance = {
|
|
191
|
+
...child,
|
|
192
|
+
id: remapId(child.id),
|
|
193
|
+
startMs: options.startMs + child.startMs,
|
|
194
|
+
trackId: options.trackId ?? child.trackId,
|
|
195
|
+
parentId: groupId,
|
|
196
|
+
compositionId: composition.id,
|
|
197
|
+
compositionParams: applied
|
|
198
|
+
};
|
|
199
|
+
remapReferences(instance);
|
|
200
|
+
out.push(instance);
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Turn a group already on the timeline into a reusable composition: the group
|
|
206
|
+
* clip plus every clip parented to it, child times rebased to the group start.
|
|
207
|
+
*
|
|
208
|
+
* The parameters are the caller's — a template is a statement about which
|
|
209
|
+
* values are meant to vary, which nothing in a document records — and each one
|
|
210
|
+
* is checked against the extracted children before the composition is returned.
|
|
211
|
+
*/
|
|
212
|
+
export function extractComposition(doc, groupId, params = {}, meta = {}) {
|
|
213
|
+
const group = doc.clips.find((clip) => clip.id === groupId);
|
|
214
|
+
if (!group) {
|
|
215
|
+
throw new Error(`No clip with id "${groupId}" is in this timeline.`);
|
|
216
|
+
}
|
|
217
|
+
if (group.mediaType !== "group") {
|
|
218
|
+
throw new Error(`"${group.name}" is a ${group.mediaType} clip, not a group — only a group can become a composition.`);
|
|
219
|
+
}
|
|
220
|
+
const children = doc.clips
|
|
221
|
+
.filter((clip) => clip.parentId === groupId)
|
|
222
|
+
.map((clip) => {
|
|
223
|
+
const copy = structuredClone(clip);
|
|
224
|
+
copy.startMs = clip.startMs - group.startMs;
|
|
225
|
+
// The group is implicit in a template, so a child does not name it.
|
|
226
|
+
// Instantiating parents every child to the group it mints.
|
|
227
|
+
delete copy.parentId;
|
|
228
|
+
delete copy.compositionId;
|
|
229
|
+
delete copy.compositionParams;
|
|
230
|
+
return copy;
|
|
231
|
+
});
|
|
232
|
+
const groupTemplate = structuredClone(group);
|
|
233
|
+
groupTemplate.startMs = 0;
|
|
234
|
+
delete groupTemplate.compositionId;
|
|
235
|
+
delete groupTemplate.compositionParams;
|
|
236
|
+
delete groupTemplate.parentId;
|
|
237
|
+
const composition = {
|
|
238
|
+
id: meta.id ?? group.compositionId ?? makeClip().id,
|
|
239
|
+
name: meta.name ?? group.name,
|
|
240
|
+
params,
|
|
241
|
+
group: groupTemplate,
|
|
242
|
+
children
|
|
243
|
+
};
|
|
244
|
+
if (meta.description !== undefined) {
|
|
245
|
+
composition.description = meta.description;
|
|
246
|
+
}
|
|
247
|
+
const problems = validateCompositionParams(composition);
|
|
248
|
+
if (problems.length > 0) {
|
|
249
|
+
throw new Error(problems.join(" "));
|
|
250
|
+
}
|
|
251
|
+
return composition;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,uDAAuD;AACvD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,SAAS;CACD,CAAC;AAuCX,0EAA0E;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C3D,OAAO,IAAI,CAAC,QAAQ,CAAC;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;QAC1B,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEL,MAAM,aAAa,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC7C,aAAa,CAAC,OAAO,GAAG,CAAC,CAAC;IAC1B,OAAO,aAAa,CAAC,aAAa,CAAC;IACnC,OAAO,aAAa,CAAC,iBAAiB,CAAC;IACvC,OAAO,aAAa,CAAC,QAAQ,CAAC;IAE9B,MAAM,WAAW,GAAwB;QACvC,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,CAAC,aAAa,IAAI,QAAQ,EAAE,CAAC,EAAE;QACnD,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI;QAC7B,MAAM;QACN,KAAK,EAAE,aAAa;QACpB,QAAQ;KACT,CAAC;IACF,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACnC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IAC7C,CAAC;IACD,MAAM,QAAQ,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;IACxD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/crop.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* crop — the source rectangle a clip keeps, in one place.
|
|
3
|
+
*
|
|
4
|
+
* A crop is stored as four normalized insets ({@link ClipCrop}) and every
|
|
5
|
+
* surface needs the same thing from them: the pixel rectangle to read, and
|
|
6
|
+
* whether there is anything to do at all. Both compositors, the scene model
|
|
7
|
+
* and the validator go through here, so a crop cannot round one way in the
|
|
8
|
+
* preview and another in the export.
|
|
9
|
+
*
|
|
10
|
+
* **The kept rectangle becomes the clip's picture.** Cropping is applied to the
|
|
11
|
+
* source before anything else looks at it — the contain fit is computed from
|
|
12
|
+
* the cropped size, the transform places the cropped frame, the border radius
|
|
13
|
+
* rounds its corners, and the masks and effects run on its pixels. That is what
|
|
14
|
+
* separates a crop from a rect {@link ClipMask}, which hides part of a layer
|
|
15
|
+
* that stays exactly where it was.
|
|
16
|
+
*/
|
|
17
|
+
import type { ClipCrop } from "./types.js";
|
|
18
|
+
/** A source rectangle in pixels, as {@link cropRectPx} resolves one. */
|
|
19
|
+
export interface CropRectPx {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Whether these insets ask for anything. Absent, all-zero, and degenerate
|
|
27
|
+
* insets all answer false — a crop that keeps nothing is treated as no crop
|
|
28
|
+
* rather than as a blank frame, which is the same call `cropRectPx` makes.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasCrop(crop: ClipCrop | undefined): crop is ClipCrop;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the insets leave a picture. `left + right >= 1` on either axis keeps
|
|
33
|
+
* nothing; the validator reports that as `crop_degenerate` and the renderers
|
|
34
|
+
* fall back to the whole source, so a slider dragged to the end shows the
|
|
35
|
+
* uncropped shot rather than a hole in the timeline.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isCropUsable(crop: ClipCrop | undefined): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The source rectangle to read, in pixels, for a source of this size.
|
|
40
|
+
*
|
|
41
|
+
* The rectangle is snapped to whole pixels and is always at least 1×1 inside
|
|
42
|
+
* the source: a GPU copy and a `drawImage` both reject a zero-sized or
|
|
43
|
+
* out-of-bounds region, and a crop that rounds to nothing is an edit the user
|
|
44
|
+
* cannot see anyway. Returns the whole source when there is no usable crop, so
|
|
45
|
+
* a caller can hand the result straight to a draw without branching.
|
|
46
|
+
*/
|
|
47
|
+
export declare function cropRectPx(crop: ClipCrop | undefined, sourceWidth: number, sourceHeight: number): CropRectPx;
|
|
48
|
+
//# sourceMappingURL=crop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop.d.ts","sourceRoot":"","sources":["../src/crop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,wEAAwE;AACxE,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CASpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAOhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,UAAU,CAgBZ"}
|
package/dist/crop.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* crop — the source rectangle a clip keeps, in one place.
|
|
3
|
+
*
|
|
4
|
+
* A crop is stored as four normalized insets ({@link ClipCrop}) and every
|
|
5
|
+
* surface needs the same thing from them: the pixel rectangle to read, and
|
|
6
|
+
* whether there is anything to do at all. Both compositors, the scene model
|
|
7
|
+
* and the validator go through here, so a crop cannot round one way in the
|
|
8
|
+
* preview and another in the export.
|
|
9
|
+
*
|
|
10
|
+
* **The kept rectangle becomes the clip's picture.** Cropping is applied to the
|
|
11
|
+
* source before anything else looks at it — the contain fit is computed from
|
|
12
|
+
* the cropped size, the transform places the cropped frame, the border radius
|
|
13
|
+
* rounds its corners, and the masks and effects run on its pixels. That is what
|
|
14
|
+
* separates a crop from a rect {@link ClipMask}, which hides part of a layer
|
|
15
|
+
* that stays exactly where it was.
|
|
16
|
+
*/
|
|
17
|
+
/** Insets below this are rounding noise from a drag, not an edit. */
|
|
18
|
+
const CROP_EPSILON = 1e-4;
|
|
19
|
+
/**
|
|
20
|
+
* Whether these insets ask for anything. Absent, all-zero, and degenerate
|
|
21
|
+
* insets all answer false — a crop that keeps nothing is treated as no crop
|
|
22
|
+
* rather than as a blank frame, which is the same call `cropRectPx` makes.
|
|
23
|
+
*/
|
|
24
|
+
export function hasCrop(crop) {
|
|
25
|
+
if (!crop)
|
|
26
|
+
return false;
|
|
27
|
+
if (!isCropUsable(crop))
|
|
28
|
+
return false;
|
|
29
|
+
return (crop.left > CROP_EPSILON ||
|
|
30
|
+
crop.right > CROP_EPSILON ||
|
|
31
|
+
crop.top > CROP_EPSILON ||
|
|
32
|
+
crop.bottom > CROP_EPSILON);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether the insets leave a picture. `left + right >= 1` on either axis keeps
|
|
36
|
+
* nothing; the validator reports that as `crop_degenerate` and the renderers
|
|
37
|
+
* fall back to the whole source, so a slider dragged to the end shows the
|
|
38
|
+
* uncropped shot rather than a hole in the timeline.
|
|
39
|
+
*/
|
|
40
|
+
export function isCropUsable(crop) {
|
|
41
|
+
if (!crop)
|
|
42
|
+
return false;
|
|
43
|
+
const { left, right, top, bottom } = crop;
|
|
44
|
+
if (![left, right, top, bottom].every((v) => Number.isFinite(v) && v >= 0)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return left + right < 1 - CROP_EPSILON && top + bottom < 1 - CROP_EPSILON;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The source rectangle to read, in pixels, for a source of this size.
|
|
51
|
+
*
|
|
52
|
+
* The rectangle is snapped to whole pixels and is always at least 1×1 inside
|
|
53
|
+
* the source: a GPU copy and a `drawImage` both reject a zero-sized or
|
|
54
|
+
* out-of-bounds region, and a crop that rounds to nothing is an edit the user
|
|
55
|
+
* cannot see anyway. Returns the whole source when there is no usable crop, so
|
|
56
|
+
* a caller can hand the result straight to a draw without branching.
|
|
57
|
+
*/
|
|
58
|
+
export function cropRectPx(crop, sourceWidth, sourceHeight) {
|
|
59
|
+
const full = { x: 0, y: 0, width: sourceWidth, height: sourceHeight };
|
|
60
|
+
if (sourceWidth <= 0 || sourceHeight <= 0)
|
|
61
|
+
return full;
|
|
62
|
+
if (!hasCrop(crop))
|
|
63
|
+
return full;
|
|
64
|
+
const x = Math.floor(crop.left * sourceWidth);
|
|
65
|
+
const y = Math.floor(crop.top * sourceHeight);
|
|
66
|
+
const width = Math.round((1 - crop.left - crop.right) * sourceWidth);
|
|
67
|
+
const height = Math.round((1 - crop.top - crop.bottom) * sourceHeight);
|
|
68
|
+
return {
|
|
69
|
+
x: Math.min(x, sourceWidth - 1),
|
|
70
|
+
y: Math.min(y, sourceHeight - 1),
|
|
71
|
+
width: Math.max(1, Math.min(width, sourceWidth - x)),
|
|
72
|
+
height: Math.max(1, Math.min(height, sourceHeight - y))
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=crop.js.map
|
package/dist/crop.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop.js","sourceRoot":"","sources":["../src/crop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,qEAAqE;AACrE,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAA0B;IAChD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,OAAO,CACL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