@omnimedia/omnitool 1.1.0-91 → 1.1.0-93
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 +132 -3
- package/package.json +1 -1
- package/s/demo/routines/timeline-setup.ts +32 -4
- package/s/driver/parts/compositor.ts +3 -0
- package/s/features/speech/transcribe/transcriber.ts +1 -1
- package/s/features/speech/transcribe/types.ts +8 -4
- package/s/timeline/index.ts +4 -0
- package/s/timeline/parts/captions.ts +90 -0
- package/s/timeline/parts/item.ts +23 -4
- package/s/timeline/renderers/export/parts/cursor.ts +2 -3
- package/s/timeline/renderers/parts/handy.ts +41 -13
- package/s/timeline/renderers/parts/samplers/visual/parts/defaults.ts +2 -1
- package/s/timeline/renderers/parts/samplers/visual/parts/sample.ts +19 -0
- package/s/timeline/sugar/helpers.ts +10 -0
- package/s/timeline/sugar/o.ts +55 -0
- package/x/demo/demo.bundle.min.js +102 -102
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/routines/timeline-setup.js +28 -3
- package/x/demo/routines/timeline-setup.js.map +1 -1
- package/x/driver/parts/compositor.js +3 -0
- package/x/driver/parts/compositor.js.map +1 -1
- package/x/features/speech/transcribe/transcriber.d.ts +1 -1
- package/x/features/speech/transcribe/transcriber.js +1 -1
- package/x/features/speech/transcribe/transcriber.js.map +1 -1
- package/x/features/speech/transcribe/types.d.ts +6 -4
- package/x/index.html +2 -2
- package/x/tests.bundle.min.js +105 -105
- package/x/tests.bundle.min.js.map +4 -4
- package/x/tests.html +1 -1
- package/x/timeline/index.d.ts +4 -0
- package/x/timeline/index.js +4 -0
- package/x/timeline/index.js.map +1 -1
- package/x/timeline/parts/captions.d.ts +40 -0
- package/x/timeline/parts/captions.js +55 -0
- package/x/timeline/parts/captions.js.map +1 -0
- package/x/timeline/parts/item.d.ts +21 -5
- package/x/timeline/parts/item.js +1 -0
- package/x/timeline/parts/item.js.map +1 -1
- package/x/timeline/renderers/export/parts/cursor.d.ts +1 -1
- package/x/timeline/renderers/export/parts/cursor.js +2 -3
- package/x/timeline/renderers/export/parts/cursor.js.map +1 -1
- package/x/timeline/renderers/parts/handy.d.ts +1 -0
- package/x/timeline/renderers/parts/handy.js +27 -13
- package/x/timeline/renderers/parts/handy.js.map +1 -1
- package/x/timeline/renderers/parts/samplers/visual/parts/defaults.js +2 -1
- package/x/timeline/renderers/parts/samplers/visual/parts/defaults.js.map +1 -1
- package/x/timeline/renderers/parts/samplers/visual/parts/sample.js +16 -0
- package/x/timeline/renderers/parts/samplers/visual/parts/sample.js.map +1 -1
- package/x/timeline/sugar/helpers.d.ts +3 -0
- package/x/timeline/sugar/helpers.js +3 -0
- package/x/timeline/sugar/helpers.js.map +1 -1
- package/x/timeline/sugar/o.d.ts +2 -0
- package/x/timeline/sugar/o.js +38 -0
- package/x/timeline/sugar/o.js.map +1 -1
package/s/timeline/sugar/o.ts
CHANGED
|
@@ -5,9 +5,11 @@ import {Media} from "../parts/media.js"
|
|
|
5
5
|
import {Id, TimelineFile} from "../parts/basics.js"
|
|
6
6
|
import {FilterAction, FilterActions} from "../parts/filters.js"
|
|
7
7
|
import {filters, FilterParams, FilterType} from "../parts/filters.js"
|
|
8
|
+
import {Transcription} from "../../features/speech/transcribe/types.js"
|
|
8
9
|
import {Crop, Effect, FilterableItem, Item, Kind, VisualAnimatableItem} from "../parts/item.js"
|
|
9
10
|
import {animationPresets, makeAnimationPresets, visualAnimations} from "../parts/animations/registry.js"
|
|
10
11
|
import {AnimationPreset, PresetAnimateAction, PresetAnimateActions, PresetAnimation, PresetOptions} from "../parts/animations/types.js"
|
|
12
|
+
import {CaptionAction, CaptionActions, captionDuration, CaptionOptions, CaptionPreset, captionPresets, CaptionSourceItem} from "../parts/captions.js"
|
|
11
13
|
import {Anim, AnimateAction, Interpolation, Keyframes, ScalarAnimation, TrackTransform, Transform, TransformAnimation, TransformOptions, Vec2, VisualAnimationInput, VisualAnimationValue, VisualAnimations} from "../types.js"
|
|
12
14
|
|
|
13
15
|
type VisualAnimateActions = {
|
|
@@ -309,6 +311,59 @@ export class O {
|
|
|
309
311
|
return item
|
|
310
312
|
}
|
|
311
313
|
|
|
314
|
+
#makeCaption = (
|
|
315
|
+
transcript: Transcription,
|
|
316
|
+
preset: CaptionPreset,
|
|
317
|
+
options?: CaptionOptions,
|
|
318
|
+
): Item.Caption => {
|
|
319
|
+
const start = options?.start ?? 0
|
|
320
|
+
const duration = options?.duration ?? Math.max(0, captionDuration(transcript, options) - start)
|
|
321
|
+
const item: Item.Caption = {
|
|
322
|
+
id: this.getId(),
|
|
323
|
+
kind: Kind.Caption,
|
|
324
|
+
transcript,
|
|
325
|
+
start,
|
|
326
|
+
duration,
|
|
327
|
+
maxChars: options?.maxChars,
|
|
328
|
+
maxDuration: options?.maxDuration,
|
|
329
|
+
maxSilence: options?.maxSilence,
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
item.styleId = this.textStyle(options?.styles ?? preset.styles).id
|
|
333
|
+
item.spatialId = this.spatial(this.transform(preset.transform)).id
|
|
334
|
+
|
|
335
|
+
this.register(item)
|
|
336
|
+
return item
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
#makeCaptionAction = (preset: CaptionPreset): CaptionAction => {
|
|
340
|
+
const make = (transcript: Transcription, options?: CaptionOptions) =>
|
|
341
|
+
this.#makeCaption(transcript, preset, options)
|
|
342
|
+
|
|
343
|
+
const action = ((item: CaptionSourceItem, transcript: Transcription, options?: CaptionOptions): Item.Stack => {
|
|
344
|
+
const caption = make(transcript, {
|
|
345
|
+
...options,
|
|
346
|
+
start: options?.start ?? item.start,
|
|
347
|
+
duration: options?.duration ?? item.duration,
|
|
348
|
+
})
|
|
349
|
+
return this.stack(caption, item)
|
|
350
|
+
}) as CaptionAction
|
|
351
|
+
|
|
352
|
+
action.make = make
|
|
353
|
+
return action
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
#makeCaptionPresetActions = () => {
|
|
357
|
+
const entries = Object.entries(captionPresets)
|
|
358
|
+
.map(([name, preset]) => [name, this.#makeCaptionAction(preset)])
|
|
359
|
+
return Object.fromEntries(entries) as CaptionActions["presets"]
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
captions = Object.assign(
|
|
363
|
+
this.#makeCaptionAction(captionPresets.default),
|
|
364
|
+
{presets: this.#makeCaptionPresetActions()}
|
|
365
|
+
) as CaptionActions
|
|
366
|
+
|
|
312
367
|
gap = (duration: number): Item.Gap => {
|
|
313
368
|
const item = {
|
|
314
369
|
id: this.getId(),
|