@hypit/hypit 0.1.3 → 0.1.5
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 +5 -3
- package/dist/public/caption.d.ts +206 -183
- package/dist/public/composition.d.ts +25 -3
- package/dist/public/endpoint-kit.d.ts +24 -2
- package/dist/public/generation.d.ts +5 -1
- package/dist/public/hyperframes.d.ts +19 -1
- package/dist/public/narrative.d.ts +17 -3
- package/dist/public/performance.d.ts +1590 -0
- package/dist/public/program-space.d.ts +179 -32
- package/dist/public/runtime-kit.d.ts +21 -8
- package/dist/public/sound.d.ts +822 -0
- package/dist/public/speech.d.ts +41 -0
- package/dist/public/studio-adapter.d.ts +107 -16
- package/dist/public/temporal-markup.d.ts +9 -44
- package/dist/public/temporal.d.ts +37 -28
- package/dist/public/{semantic-track.d.ts → timeline.d.ts} +62 -49
- package/examples/README.md +18 -10
- package/examples/minimal-author-package/packages/example-component/preview/preview.svml +19 -12
- package/examples/minimal-author-package/packages/example-component/src/component.ts +5 -5
- package/examples/minimal-author-package/packages/example-component/src/fragment.ts +3 -5
- package/examples/minimal-author-package/packages/example-component/src/manifest.ts +8 -10
- package/examples/minimal-author-package/packages/example-component/src/surface.ts +2 -2
- package/examples/provider-package/README.md +78 -0
- package/examples/provider-package/hypit.runtime.json +12 -0
- package/examples/provider-package/packages/provider-images/package.json +11 -0
- package/examples/provider-package/packages/provider-images/src/activation.ts +24 -0
- package/examples/provider-package/packages/provider-images/src/provider.ts +122 -0
- package/examples/provider-package/packages/provider-images/tsconfig.json +9 -0
- package/examples/semantic-composition/README.md +6 -0
- package/examples/semantic-composition/chat.svml +6 -5
- package/examples/semantic-composition/packages/chat-scene/README.md +3 -3
- package/examples/semantic-composition/packages/chat-scene/src/activation.ts +18 -21
- package/examples/semantic-composition/packages/chat-scene/src/render.ts +4 -4
- package/examples/semantic-composition/packages/performance-styles/README.md +42 -0
- package/examples/semantic-composition/packages/performance-styles/package.json +25 -0
- package/examples/semantic-composition/packages/performance-styles/src/activation.ts +57 -0
- package/examples/semantic-composition/packages/performance-styles/src/render.ts +54 -0
- package/examples/semantic-composition/packages/performance-styles/src/studio.ts +28 -0
- package/examples/semantic-composition/packages/performance-styles/tsconfig.json +18 -0
- package/examples/semantic-composition/packages/responsive-explainer/README.md +16 -9
- package/examples/semantic-composition/packages/responsive-explainer/src/activation.ts +12 -12
- package/examples/semantic-composition/packages/responsive-explainer/src/render.ts +5 -5
- package/examples/semantic-composition/packages/sound-styles/README.md +36 -0
- package/examples/semantic-composition/packages/sound-styles/package.json +25 -0
- package/examples/semantic-composition/packages/sound-styles/src/activation.ts +53 -0
- package/examples/semantic-composition/packages/sound-styles/src/render.ts +14 -0
- package/examples/semantic-composition/packages/sound-styles/tsconfig.json +18 -0
- package/package.json +35 -15
- package/packages/audio-track/README.md +20 -13
- package/packages/audio-track/package.json +1 -1
- package/packages/audio-track/src/component.ts +4 -4
- package/packages/audio-track/src/fragment.ts +6 -5
- package/packages/audio-track/src/index.ts +1 -1
- package/packages/audio-track/src/manifest.ts +17 -16
- package/packages/audio-track/src/program.ts +21 -25
- package/packages/audio-track/src/surface.ts +19 -18
- package/packages/audio-track-studio/README.md +23 -0
- package/packages/audio-track-studio/src/index.ts +33 -19
- package/packages/author-kit/README.md +1 -1
- package/packages/background-removal/README.md +4 -7
- package/packages/browser-capture/package.json +1 -1
- package/packages/build-result/README.md +69 -0
- package/packages/build-result/package.json +2 -1
- package/packages/build-result/src/decode.ts +12 -8
- package/packages/build-result/src/execution-log.ts +17 -0
- package/packages/build-result/src/file-reference.ts +42 -0
- package/packages/build-result/src/index.ts +4 -0
- package/packages/build-result/src/replace-file-windows.ts +58 -0
- package/packages/build-result/src/replace-file.ts +11 -0
- package/packages/build-result/src/store.ts +58 -14
- package/packages/build-result/src/types.ts +41 -8
- package/packages/build-result/src/writer.ts +12 -1
- package/packages/build-result-fs/README.md +23 -1
- package/packages/build-result-s3/README.md +5 -0
- package/packages/build-result-s3/src/repository.ts +23 -5
- package/packages/caption/README.md +61 -73
- package/packages/caption/package.json +3 -2
- package/packages/caption/src/activation.ts +2 -2
- package/packages/caption/src/component.ts +20 -5
- package/packages/caption/src/display.ts +3 -18
- package/packages/caption/src/fragment.ts +3 -7
- package/packages/caption/src/index.ts +6 -5
- package/packages/caption/src/manifest.ts +29 -46
- package/packages/caption/src/style.ts +24 -135
- package/packages/caption/src/surface.ts +12 -92
- package/packages/caption/src/temporalize.ts +18 -53
- package/packages/caption/src/types.ts +8 -35
- package/packages/caption/src/visibility.ts +23 -0
- package/packages/caption-fine/README.md +31 -11
- package/packages/caption-fine/package.json +4 -2
- package/packages/caption-fine/src/component.ts +3 -3
- package/packages/caption-fine/src/fragment.ts +7 -19
- package/packages/caption-fine/src/index.ts +2 -0
- package/packages/caption-fine/src/manifest.ts +27 -18
- package/packages/caption-fine/src/recipe.ts +7 -0
- package/packages/caption-fine/src/render.ts +62 -49
- package/packages/caption-fine/src/schedule.ts +39 -35
- package/packages/caption-fine/src/style.ts +10 -9
- package/packages/caption-fine/src/surface.ts +62 -35
- package/packages/caption-fine/src/types.ts +2 -0
- package/packages/caption-fine-studio/README.md +24 -2
- package/packages/caption-fine-studio/package.json +10 -3
- package/packages/caption-fine-studio/src/activation.ts +3 -3
- package/packages/caption-fine-studio/src/index.ts +61 -40
- package/packages/cli/README.md +81 -3
- package/packages/cli/package.json +1 -0
- package/packages/cli/src/arguments.ts +39 -15
- package/packages/cli/src/build-planning.ts +9 -3
- package/packages/cli/src/command.ts +7 -1
- package/packages/cli/src/commands/environment.ts +66 -27
- package/packages/cli/src/commands/execution.ts +81 -26
- package/packages/cli/src/commands/results.ts +7 -11
- package/packages/cli/src/index.ts +2 -2
- package/packages/cli/src/machine-view.ts +15 -5
- package/packages/cli/src/main.ts +38 -42
- package/packages/cli/src/observation.ts +7 -1
- package/packages/cli/src/output.ts +92 -34
- package/packages/cli/src/result-export.ts +22 -13
- package/packages/cli/src/run-file.ts +19 -8
- package/packages/cli/src/view.ts +64 -18
- package/packages/comment-sticker/README.md +3 -3
- package/packages/comment-sticker/package.json +1 -1
- package/packages/comment-sticker/src/component.ts +4 -4
- package/packages/comment-sticker/src/fragment.ts +5 -4
- package/packages/comment-sticker/src/manifest.ts +7 -6
- package/packages/comment-sticker/src/program.ts +9 -9
- package/packages/comment-sticker/src/surface.ts +6 -7
- package/packages/comment-sticker-studio/src/index.ts +2 -1
- package/packages/compiler-node/src/compiler.ts +1 -0
- package/packages/composition/README.md +21 -0
- package/packages/composition/src/audio-presentation.ts +44 -0
- package/packages/composition/src/index.ts +3 -0
- package/packages/composition/src/schema.ts +8 -3
- package/packages/composition/src/track.ts +15 -1
- package/packages/credential-store-env/README.md +1 -1
- package/packages/deck-track/README.md +3 -3
- package/packages/deck-track/package.json +1 -1
- package/packages/deck-track/src/component.ts +5 -5
- package/packages/deck-track/src/fragment.ts +6 -5
- package/packages/deck-track/src/lower.ts +12 -12
- package/packages/deck-track/src/manifest.ts +8 -7
- package/packages/deck-track/src/program.ts +13 -16
- package/packages/deck-track/src/surface.ts +9 -10
- package/packages/driver-node/src/driver.ts +41 -3
- package/packages/elevenlabs-speech/README.md +27 -0
- package/packages/{provider-xiaomi-mimo → elevenlabs-speech}/package.json +5 -8
- package/packages/elevenlabs-speech/src/activation.ts +26 -0
- package/packages/elevenlabs-speech/src/fragment.ts +11 -0
- package/packages/elevenlabs-speech/src/index.ts +111 -0
- package/packages/elevenlabs-speech/src/surface.ts +167 -0
- package/packages/endpoint-kit/README.md +24 -0
- package/packages/endpoint-kit/src/index.ts +7 -1
- package/packages/estimate/README.md +56 -3
- package/packages/estimate/src/program.ts +7 -8
- package/packages/film/README.md +12 -7
- package/packages/film/package.json +1 -1
- package/packages/film/src/component.ts +4 -4
- package/packages/film/src/fragment.ts +6 -5
- package/packages/film/src/manifest.ts +11 -10
- package/packages/film/src/program.ts +5 -5
- package/packages/film/src/recipe.ts +2 -1
- package/packages/film/src/surface.ts +6 -6
- package/packages/film-studio/package.json +1 -1
- package/packages/film-studio/src/index.ts +2 -2
- package/packages/fishaudio-speech/README.md +33 -0
- package/packages/fishaudio-speech/package.json +21 -0
- package/packages/fishaudio-speech/src/activation.ts +32 -0
- package/packages/fishaudio-speech/src/fragment.ts +11 -0
- package/packages/fishaudio-speech/src/index.ts +156 -0
- package/packages/fishaudio-speech/src/surface.ts +192 -0
- package/packages/fonts-open/README.md +5 -0
- package/packages/fonts-open/package.json +5 -1
- package/packages/fonts-open/src/studio.ts +21 -0
- package/packages/generation/README.md +11 -1
- package/packages/generation/src/mapping.ts +28 -30
- package/packages/gpt-image/README.md +1 -2
- package/packages/grok-imagine/README.md +1 -2
- package/packages/hyperframes/README.md +7 -3
- package/packages/hyperframes/src/browser-program.ts +11 -2
- package/packages/hyperframes/src/document.ts +15 -2
- package/packages/interview-emoji-reveal/README.md +4 -4
- package/packages/interview-emoji-reveal/package.json +1 -1
- package/packages/interview-emoji-reveal/src/component.ts +4 -4
- package/packages/interview-emoji-reveal/src/fragment.ts +6 -5
- package/packages/interview-emoji-reveal/src/manifest.ts +9 -8
- package/packages/interview-emoji-reveal/src/program.ts +14 -14
- package/packages/interview-emoji-reveal/src/surface.ts +8 -9
- package/packages/media-execution/README.md +7 -3
- package/packages/media-execution/src/audio-presentation.ts +23 -0
- package/packages/media-execution/src/execute.ts +2 -0
- package/packages/media-pipeline/README.md +7 -3
- package/packages/media-pipeline/src/audio-plan.ts +4 -1
- package/packages/media-pipeline/src/component.ts +16 -2
- package/packages/media-pipeline/src/manifest.ts +3 -1
- package/packages/media-pipeline/src/types.ts +2 -1
- package/packages/media-track/README.md +14 -47
- package/packages/media-track/package.json +1 -1
- package/packages/media-track/preview/preview.svml +5 -5
- package/packages/media-track/src/author.ts +12 -6
- package/packages/media-track/src/component.ts +10 -16
- package/packages/media-track/src/fragment.ts +8 -7
- package/packages/media-track/src/index.ts +3 -1
- package/packages/media-track/src/lower.ts +7 -7
- package/packages/media-track/src/manifest.ts +16 -38
- package/packages/media-track/src/program.ts +62 -67
- package/packages/media-track/src/sampling.ts +6 -6
- package/packages/media-track/src/sequence.ts +8 -8
- package/packages/media-track/src/surface.ts +25 -43
- package/packages/media-track-studio/README.md +9 -0
- package/packages/media-track-studio/src/index.ts +23 -13
- package/packages/mimo-speech/README.md +1 -1
- package/packages/minimax-h3/README.md +1 -1
- package/packages/nano-banana/README.md +1 -1
- package/packages/narrative/README.md +23 -1
- package/packages/narrative/src/identity.ts +11 -0
- package/packages/narrative/src/index.ts +3 -0
- package/packages/narrative/src/schema.ts +28 -27
- package/packages/narrative/src/selection.ts +52 -0
- package/packages/narrative/src/types.ts +2 -0
- package/packages/package-loader-node/README.md +30 -0
- package/packages/package-loader-node/package.json +5 -2
- package/packages/package-loader-node/src/distribution-resolution.ts +10 -3
- package/packages/package-loader-node/src/index.ts +1 -0
- package/packages/package-loader-node/src/loader.ts +12 -15
- package/packages/package-loader-node/src/location.ts +27 -1
- package/packages/package-loader-node/src/module-scope.ts +183 -0
- package/packages/package-loader-node/src/types.ts +4 -0
- package/packages/performance/README.md +83 -0
- package/packages/performance/package.json +30 -0
- package/packages/performance/src/activation.ts +11 -0
- package/packages/performance/src/component.ts +46 -0
- package/packages/performance/src/index.ts +6 -0
- package/packages/performance/src/manifest.ts +53 -0
- package/packages/{media-track/src/performance.ts → performance/src/media.ts} +9 -10
- package/packages/performance/src/program.ts +51 -0
- package/packages/performance/src/style.ts +35 -0
- package/packages/performance/src/surface.ts +99 -0
- package/packages/performance-studio/README.md +25 -0
- package/packages/performance-studio/package.json +21 -0
- package/packages/performance-studio/src/activation.ts +6 -0
- package/packages/performance-studio/src/index.ts +84 -0
- package/packages/program-space/README.md +9 -18
- package/packages/program-space/src/activation.ts +1 -5
- package/packages/program-space/src/index.ts +2 -11
- package/packages/program-space/src/surface.ts +1 -20
- package/packages/project-context-node/README.md +20 -0
- package/packages/project-context-node/package.json +10 -0
- package/packages/project-context-node/src/index.ts +3 -0
- package/packages/{cli → project-context-node}/src/runtime-selection.ts +7 -2
- package/packages/provider-hyperframes-local/README.md +43 -15
- package/packages/provider-hyperframes-local/src/activation.ts +4 -3
- package/packages/provider-hyperframes-local/src/capture-process.ts +26 -4
- package/packages/provider-hyperframes-local/src/capture.ts +96 -26
- package/packages/provider-hyperframes-local/src/concurrency.ts +86 -0
- package/packages/provider-hyperframes-local/src/opaque-capture.ts +92 -0
- package/packages/provider-hyperframes-local/src/options.ts +2 -0
- package/packages/provider-hyperframes-local/src/program.ts +6 -3
- package/packages/provider-hyperframes-local/src/progress.ts +53 -0
- package/packages/provider-hyperframes-local/src/provider.ts +18 -5
- package/packages/provider-hyperframes-local/src/render.ts +48 -7
- package/packages/provider-hypihub/README.md +48 -17
- package/packages/provider-hypihub/package.json +2 -0
- package/packages/provider-hypihub/src/mapping.ts +31 -7
- package/packages/provider-hypihub/src/oauth.ts +6 -0
- package/packages/provider-hypihub/src/provider.ts +25 -13
- package/packages/provider-hypihub/src/routes.ts +1 -2
- package/packages/provider-hypihub/src/upload.ts +2 -0
- package/packages/provider-media-local/README.md +3 -4
- package/packages/provider-whisperx-local/README.md +57 -0
- package/packages/provider-whisperx-local/src/program.ts +1 -0
- package/packages/provider-whisperx-local/src/provider.ts +3 -0
- package/packages/ranking/README.md +8 -6
- package/packages/ranking/package.json +1 -1
- package/packages/ranking/src/component.ts +6 -6
- package/packages/ranking/src/fragment.ts +11 -7
- package/packages/ranking/src/manifest.ts +21 -14
- package/packages/ranking/src/render.ts +33 -35
- package/packages/ranking/src/schedule.ts +16 -19
- package/packages/ranking/src/surface.ts +12 -13
- package/packages/ranking-studio/README.md +29 -0
- package/packages/ranking-studio/package.json +8 -3
- package/packages/ranking-studio/src/index.ts +71 -12
- package/packages/render-hyperframes/README.md +7 -7
- package/packages/render-hyperframes/package.json +1 -1
- package/packages/render-hyperframes/src/component.ts +11 -1
- package/packages/render-hyperframes/src/fragment.ts +7 -4
- package/packages/render-hyperframes/src/manifest.ts +4 -4
- package/packages/render-hyperframes/src/surface.ts +6 -6
- package/packages/runtime/README.md +8 -1
- package/packages/runtime/src/catalog.ts +2 -0
- package/packages/runtime/src/execution.ts +15 -4
- package/packages/runtime/src/index.ts +2 -1
- package/packages/runtime/src/log.ts +51 -0
- package/packages/runtime/src/types.ts +5 -8
- package/packages/runtime-host-node/README.md +30 -0
- package/packages/runtime-host-node/package.json +1 -0
- package/packages/runtime-host-node/src/index.ts +25 -9
- package/packages/runtime-host-node/src/packages.ts +47 -50
- package/packages/runtime-kit/README.md +5 -0
- package/packages/runtime-kit/src/index.ts +3 -1
- package/packages/runtime-local/README.md +111 -4
- package/packages/runtime-local/src/config.ts +202 -56
- package/packages/runtime-local/src/control.ts +9 -1
- package/packages/runtime-local/src/executor.ts +66 -0
- package/packages/runtime-local/src/host.ts +37 -17
- package/packages/runtime-local/src/log.ts +48 -0
- package/packages/runtime-local/src/programs.ts +41 -25
- package/packages/runtime-local/src/result-writer.ts +2 -0
- package/packages/runtime-local/src/runtime.ts +10 -6
- package/packages/runtime-local/src/supervisor.ts +142 -0
- package/packages/runtime-local/src/types.ts +9 -2
- package/packages/runtime-local/src/worker-process.ts +7 -24
- package/packages/runtime-local/src/worker.ts +55 -83
- package/packages/screen-overlay/README.md +3 -3
- package/packages/screen-overlay/package.json +1 -1
- package/packages/screen-overlay/src/component.ts +3 -3
- package/packages/screen-overlay/src/fragment.ts +5 -4
- package/packages/screen-overlay/src/manifest.ts +7 -6
- package/packages/screen-overlay/src/program.ts +9 -9
- package/packages/screen-overlay/src/surface.ts +6 -7
- package/packages/script/README.md +37 -2
- package/packages/script/src/edit.ts +123 -73
- package/packages/script/src/lexical.ts +40 -6
- package/packages/script/src/manifest.ts +2 -2
- package/packages/script/src/narrative.ts +1 -0
- package/packages/script/src/parser.ts +36 -8
- package/packages/script/src/surface.ts +4 -3
- package/packages/script/src/types.ts +5 -1
- package/packages/script-studio/package.json +9 -3
- package/packages/script-studio/src/index.ts +2 -0
- package/packages/script-studio/src/projection.ts +105 -0
- package/packages/seedance/README.md +30 -1
- package/packages/seedance/src/index.ts +18 -7
- package/packages/seedance/src/surface.ts +17 -4
- package/packages/seedance-kits/README.md +10 -2
- package/packages/seedance-kits/kits/speaker-v1.svs +5 -5
- package/packages/seedream/README.md +1 -1
- package/packages/sound/README.md +81 -0
- package/packages/sound/package.json +25 -0
- package/packages/sound/src/activation.ts +11 -0
- package/packages/sound/src/component.ts +28 -0
- package/packages/sound/src/index.ts +5 -0
- package/packages/sound/src/manifest.ts +47 -0
- package/packages/sound/src/program.ts +84 -0
- package/packages/sound/src/style.ts +34 -0
- package/packages/sound/src/surface.ts +90 -0
- package/packages/sound-studio/README.md +22 -0
- package/packages/sound-studio/package.json +20 -0
- package/packages/sound-studio/src/activation.ts +6 -0
- package/packages/sound-studio/src/index.ts +74 -0
- package/packages/speech/README.md +2 -2
- package/packages/speech-alignment/src/align.ts +45 -21
- package/packages/speech-alignment/src/local.ts +8 -0
- package/packages/speech-alignment/src/locate.ts +1 -1
- package/packages/store-sqlite/README.md +7 -0
- package/packages/store-sqlite/src/store.ts +84 -83
- package/packages/studio/INSPECTOR.md +117 -0
- package/packages/studio/README.md +149 -14
- package/packages/studio/package.json +8 -7
- package/packages/studio/src/build-library.ts +99 -84
- package/packages/studio/src/companion-assembly.ts +1 -0
- package/packages/studio/src/domain.ts +1 -1
- package/packages/studio/src/fallback-companions.ts +3 -3
- package/packages/studio/src/feedback-server.ts +51 -0
- package/packages/studio/src/feedback-store.ts +66 -0
- package/packages/studio/src/feedback.ts +60 -0
- package/packages/studio/src/library-media.ts +19 -0
- package/packages/studio/src/parameter-values.ts +83 -1
- package/packages/studio/src/parameters.ts +132 -43
- package/packages/studio/src/preview/render.ts +5 -1
- package/packages/studio/src/preview/runtime-shim.ts +49 -3
- package/packages/studio/src/programme.ts +14 -30
- package/packages/studio/src/server.ts +66 -34
- package/packages/studio/src/shared.ts +24 -8
- package/packages/studio/src/snapshot.ts +21 -132
- package/packages/studio/src/studio-preflight.ts +3 -3
- package/packages/studio/src/studio-registry.ts +72 -6
- package/packages/studio/src/style.css +342 -190
- package/packages/studio/src/temporal-edit.ts +131 -0
- package/packages/studio/src/ui/artifact-name.ts +80 -0
- package/packages/studio/src/ui/artifact-preview.ts +99 -0
- package/packages/studio/src/ui/comments.ts +233 -0
- package/packages/studio/src/ui/icons.ts +10 -1
- package/packages/studio/src/ui/library.ts +373 -192
- package/packages/studio/src/ui/main.ts +291 -110
- package/packages/studio/src/ui/material-preview.ts +1 -1
- package/packages/studio/src/ui/overlay.ts +31 -26
- package/packages/studio/src/ui/scrub-preview.ts +108 -0
- package/packages/studio/src/ui/sidebar-panel.ts +31 -0
- package/packages/studio/src/ui/stage.ts +188 -9
- package/packages/studio/src/ui/timeline.ts +187 -281
- package/packages/studio/start.ts +19 -5
- package/packages/studio-adapter/README.md +151 -11
- package/packages/studio-adapter/src/index.ts +126 -14
- package/packages/temporal/README.md +6 -6
- package/packages/temporal/package.json +1 -1
- package/packages/temporal/src/component.ts +5 -6
- package/packages/temporal/src/index.ts +8 -6
- package/packages/temporal/src/location.ts +11 -11
- package/packages/temporal/src/projection.ts +19 -19
- package/packages/temporal/src/rational.ts +4 -4
- package/packages/temporal-markup/EDITING.md +183 -0
- package/packages/temporal-markup/README.md +31 -11
- package/packages/temporal-markup/package.json +1 -1
- package/packages/temporal-markup/src/index.ts +20 -25
- package/packages/temporal-markup/src/space.ts +10 -41
- package/packages/timeline/README.md +31 -0
- package/packages/{semantic-track → timeline}/package.json +1 -1
- package/packages/timeline/src/activation.ts +8 -0
- package/packages/timeline/src/component.ts +24 -0
- package/packages/timeline/src/identity.ts +60 -0
- package/packages/timeline/src/index.ts +6 -0
- package/packages/{semantic-track → timeline}/src/location.ts +20 -20
- package/packages/timeline/src/manifest.ts +39 -0
- package/packages/{semantic-track → timeline}/src/projection.ts +14 -14
- package/packages/timeline/src/types.ts +24 -0
- package/packages/timeline-author/README.md +68 -0
- package/packages/{speech-track → timeline-author}/package.json +6 -4
- package/packages/timeline-author/src/activation.ts +22 -0
- package/packages/{speech-track → timeline-author}/src/component.ts +15 -13
- package/packages/{speech-track → timeline-author}/src/fragment.ts +14 -23
- package/packages/timeline-author/src/index.ts +7 -0
- package/packages/timeline-author/src/manifest.ts +78 -0
- package/packages/timeline-author/src/program.ts +107 -0
- package/packages/timeline-author/src/surface.ts +46 -0
- package/packages/timeline-author/src/types.ts +6 -0
- package/packages/typography-track/README.md +4 -4
- package/packages/typography-track/package.json +1 -1
- package/packages/typography-track/src/component.ts +4 -4
- package/packages/typography-track/src/fragment.ts +4 -3
- package/packages/typography-track/src/manifest.ts +11 -9
- package/packages/typography-track/src/program.ts +15 -15
- package/packages/typography-track/src/surface.ts +17 -18
- package/packages/typography-track-studio/package.json +8 -3
- package/packages/typography-track-studio/src/index.ts +5 -1
- package/packages/video-cli/README.md +16 -4
- package/packages/video-cli/package.json +2 -1
- package/packages/video-cli/src/creation.ts +25 -9
- package/packages/video-cli/src/index.ts +1 -1
- package/packages/video-cli/src/studio-distribution.ts +2 -1
- package/packages/volcengine-matting/README.md +3 -3
- package/packages/whisperx/README.md +8 -1
- package/packages/workspace/src/index.ts +2 -0
- package/packages/workspace-fs-node/README.md +4 -1
- package/packages/workspace-fs-node/src/workspace.ts +3 -1
- package/services/whisperx/README.md +14 -0
- package/services/whisperx/pyproject.toml +2 -0
- package/services/whisperx/uv.lock +20 -20
- package/packages/provider-hyperframes-aws-lambda/README.md +0 -30
- package/packages/provider-hyperframes-aws-lambda/package.json +0 -30
- package/packages/provider-hyperframes-aws-lambda/src/activation.ts +0 -97
- package/packages/provider-hyperframes-aws-lambda/src/client.ts +0 -114
- package/packages/provider-hyperframes-aws-lambda/src/index.ts +0 -21
- package/packages/provider-hyperframes-aws-lambda/src/provider.ts +0 -522
- package/packages/provider-kie/README.md +0 -134
- package/packages/provider-kie/package.json +0 -43
- package/packages/provider-kie/src/activation.ts +0 -71
- package/packages/provider-kie/src/index.ts +0 -10
- package/packages/provider-kie/src/mapping.ts +0 -182
- package/packages/provider-kie/src/provider.ts +0 -657
- package/packages/provider-kie/src/routes.ts +0 -150
- package/packages/provider-xiaomi-mimo/README.md +0 -32
- package/packages/provider-xiaomi-mimo/src/activation.ts +0 -57
- package/packages/provider-xiaomi-mimo/src/index.ts +0 -5
- package/packages/provider-xiaomi-mimo/src/provider.ts +0 -214
- package/packages/runtime/src/environment.ts +0 -6
- package/packages/semantic-track/README.md +0 -21
- package/packages/semantic-track/src/activation.ts +0 -8
- package/packages/semantic-track/src/component.ts +0 -24
- package/packages/semantic-track/src/identity.ts +0 -58
- package/packages/semantic-track/src/index.ts +0 -6
- package/packages/semantic-track/src/manifest.ts +0 -38
- package/packages/semantic-track/src/types.ts +0 -26
- package/packages/speech-track/README.md +0 -51
- package/packages/speech-track/src/activation.ts +0 -19
- package/packages/speech-track/src/index.ts +0 -7
- package/packages/speech-track/src/manifest.ts +0 -73
- package/packages/speech-track/src/program.ts +0 -64
- package/packages/speech-track/src/surface.ts +0 -35
- package/packages/speech-track/src/types.ts +0 -6
- package/packages/speech-track-studio/README.md +0 -3
- package/packages/speech-track-studio/package.json +0 -14
- package/packages/speech-track-studio/src/activation.ts +0 -7
- package/packages/speech-track-studio/src/index.ts +0 -40
- /package/packages/{cli → project-context-node}/src/project-context.ts +0 -0
- /package/packages/{speech-track → timeline-author}/preview/Track.png +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { StudioEditHandle, StudioSemanticAnchor, StudioTemporalInstantProjection } from "@hypit/studio-adapter";
|
|
2
|
+
|
|
3
|
+
export type SemanticTarget =
|
|
4
|
+
| { readonly kind: "selection"; readonly startAnchorId: string; readonly endAnchorId: string }
|
|
5
|
+
| { readonly kind: "moment"; readonly anchorId: string };
|
|
6
|
+
|
|
7
|
+
type Span = { readonly startFrame: number; readonly endFrameExclusive: number };
|
|
8
|
+
|
|
9
|
+
/** Project only the semantic write exposed by the handle. This does not invert expressions. */
|
|
10
|
+
export function semanticGestureSpan(
|
|
11
|
+
anchors: readonly StudioSemanticAnchor[], handle: StudioEditHandle, target: SemanticTarget,
|
|
12
|
+
): Span | undefined {
|
|
13
|
+
const semantic = handle.semantic;
|
|
14
|
+
const temporal = handle.temporal;
|
|
15
|
+
if (!semantic || !temporal || target.kind !== semantic.kind) return undefined;
|
|
16
|
+
const byId = new Map(anchors.map((anchor, order) => [anchor.id, { ...anchor, order }]));
|
|
17
|
+
let span: Span;
|
|
18
|
+
if (semantic.kind === "moment" && target.kind === "moment") {
|
|
19
|
+
const previous = byId.get(semantic.anchorId);
|
|
20
|
+
const next = byId.get(target.anchorId);
|
|
21
|
+
if (!previous || !next) return undefined;
|
|
22
|
+
const delta = next.frame - previous.frame;
|
|
23
|
+
span = temporal.kind === "instant"
|
|
24
|
+
? { startFrame: temporal.frame + delta, endFrameExclusive: temporal.frame + delta + 1 }
|
|
25
|
+
: { startFrame: temporal.startFrame + delta, endFrameExclusive: temporal.endFrameExclusive + delta };
|
|
26
|
+
} else if (semantic.kind === "selection" && target.kind === "selection") {
|
|
27
|
+
const start = byId.get(target.startAnchorId);
|
|
28
|
+
const end = byId.get(target.endAnchorId);
|
|
29
|
+
if (!start || !end || start.order > end.order) return undefined;
|
|
30
|
+
if (temporal.kind === "instant") {
|
|
31
|
+
if (temporal.authority.kind !== "semantic") return undefined;
|
|
32
|
+
if (temporal.authority.boundary === "start" && target.endAnchorId !== semantic.endAnchorId
|
|
33
|
+
|| temporal.authority.boundary === "end" && target.startAnchorId !== semantic.startAnchorId) return undefined;
|
|
34
|
+
const frame = temporal.authority.boundary === "start" ? start.frame : end.frame;
|
|
35
|
+
span = { startFrame: frame, endFrameExclusive: frame + 1 };
|
|
36
|
+
} else {
|
|
37
|
+
if (handle.gesture === "trim-start" && target.endAnchorId !== semantic.endAnchorId
|
|
38
|
+
|| handle.gesture === "trim-end" && target.startAnchorId !== semantic.startAnchorId) return undefined;
|
|
39
|
+
if (handle.gesture === "move") {
|
|
40
|
+
const stops = [...new Set(anchors.map((anchor) => anchor.frame))].sort((a, b) => a - b);
|
|
41
|
+
const previousStart = byId.get(semantic.startAnchorId);
|
|
42
|
+
const previousEnd = byId.get(semantic.endAnchorId);
|
|
43
|
+
if (!previousStart || !previousEnd
|
|
44
|
+
|| stops.indexOf(start.frame) - stops.indexOf(previousStart.frame)
|
|
45
|
+
!== stops.indexOf(end.frame) - stops.indexOf(previousEnd.frame)) return undefined;
|
|
46
|
+
}
|
|
47
|
+
span = { startFrame: start.frame, endFrameExclusive: end.frame };
|
|
48
|
+
}
|
|
49
|
+
} else return undefined;
|
|
50
|
+
if (!Number.isSafeInteger(span.startFrame) || span.startFrame < 0
|
|
51
|
+
|| !Number.isSafeInteger(span.endFrameExclusive) || span.endFrameExclusive <= span.startFrame) return undefined;
|
|
52
|
+
if (temporal.kind === "window"
|
|
53
|
+
&& ((handle.gesture === "trim-start" && span.endFrameExclusive !== temporal.endFrameExclusive)
|
|
54
|
+
|| (handle.gesture === "trim-end" && span.startFrame !== temporal.startFrame))) return undefined;
|
|
55
|
+
return span;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A stop is a frame position; coincident anchors remain distinct choices at that stop. */
|
|
59
|
+
export function chooseSemanticGesture(input: {
|
|
60
|
+
readonly anchors: readonly StudioSemanticAnchor[];
|
|
61
|
+
readonly handle: StudioEditHandle;
|
|
62
|
+
readonly pointerStart: number;
|
|
63
|
+
readonly pointerNow: number;
|
|
64
|
+
readonly frameCount: number;
|
|
65
|
+
}): SemanticTarget | undefined {
|
|
66
|
+
const { anchors, handle } = input;
|
|
67
|
+
const semantic = handle.semantic;
|
|
68
|
+
const temporal = handle.temporal;
|
|
69
|
+
if (!semantic || !temporal) return undefined;
|
|
70
|
+
const order = new Map(anchors.map((anchor, index) => [anchor.id, index]));
|
|
71
|
+
const byId = new Map(anchors.map((anchor) => [anchor.id, anchor]));
|
|
72
|
+
const at = new Map<number, StudioSemanticAnchor[]>();
|
|
73
|
+
for (const anchor of anchors) at.set(anchor.frame, [...at.get(anchor.frame) ?? [], anchor]);
|
|
74
|
+
const stops = [...at.keys()].sort((a, b) => a - b);
|
|
75
|
+
const ranked = (choices: readonly StudioSemanticAnchor[], preferred: StudioSemanticAnchor) => [...choices].sort((a, b) =>
|
|
76
|
+
Number(a.id !== preferred.id) - Number(b.id !== preferred.id)
|
|
77
|
+
|| Number(a.kind !== preferred.kind) - Number(b.kind !== preferred.kind)
|
|
78
|
+
|| order.get(a.id)! - order.get(b.id)!);
|
|
79
|
+
const valid = (target: SemanticTarget) => {
|
|
80
|
+
const span = semanticGestureSpan(anchors, handle, target);
|
|
81
|
+
return span !== undefined && (temporal.kind === "instant" ? span.startFrame : span.endFrameExclusive) <= input.frameCount;
|
|
82
|
+
};
|
|
83
|
+
const delta = input.pointerNow - input.pointerStart;
|
|
84
|
+
if (semantic.kind === "moment") {
|
|
85
|
+
const current = byId.get(semantic.anchorId);
|
|
86
|
+
if (!current) return undefined;
|
|
87
|
+
const candidates = ranked(anchors, current).sort((a, b) =>
|
|
88
|
+
Math.abs(a.frame - current.frame - delta) - Math.abs(b.frame - current.frame - delta));
|
|
89
|
+
return candidates.map((anchor): SemanticTarget => ({ kind: "moment", anchorId: anchor.id })).find(valid);
|
|
90
|
+
}
|
|
91
|
+
const start = byId.get(semantic.startAnchorId);
|
|
92
|
+
const end = byId.get(semantic.endAnchorId);
|
|
93
|
+
if (!start || !end) return undefined;
|
|
94
|
+
const target = (a: StudioSemanticAnchor, b: StudioSemanticAnchor): SemanticTarget => ({
|
|
95
|
+
kind: "selection", startAnchorId: a.id, endAnchorId: b.id,
|
|
96
|
+
});
|
|
97
|
+
if (handle.gesture === "move" && temporal.kind === "window") {
|
|
98
|
+
const first = stops.indexOf(start.frame);
|
|
99
|
+
const last = stops.indexOf(end.frame);
|
|
100
|
+
const shifts = stops.map((_, index) => index - first)
|
|
101
|
+
.filter((shift) => last + shift >= 0 && last + shift < stops.length)
|
|
102
|
+
.sort((a, b) => Math.abs(stops[first + a]! - start.frame - delta)
|
|
103
|
+
- Math.abs(stops[first + b]! - start.frame - delta) || Math.abs(a) - Math.abs(b));
|
|
104
|
+
for (const shift of shifts) {
|
|
105
|
+
for (const a of ranked(at.get(stops[first + shift]!)!, start)) {
|
|
106
|
+
for (const b of ranked(at.get(stops[last + shift]!)!, end)) {
|
|
107
|
+
const candidate = target(a, b);
|
|
108
|
+
if (valid(candidate)) return candidate;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const boundary = temporal.kind === "instant" && temporal.authority.kind === "semantic"
|
|
115
|
+
? temporal.authority.boundary : handle.gesture === "trim-start" ? "start" : "end";
|
|
116
|
+
const current = boundary === "start" ? start : end;
|
|
117
|
+
const candidates = ranked(anchors, current).sort((a, b) =>
|
|
118
|
+
Math.abs(a.frame - current.frame - delta) - Math.abs(b.frame - current.frame - delta));
|
|
119
|
+
return candidates.map((anchor) => boundary === "start" ? target(anchor, end) : target(start, anchor)).find(valid);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
/** Keep the reference and write its local frame offset; a bare reference starts at zero. */
|
|
124
|
+
export function formatTemporalPointEdit(
|
|
125
|
+
reference: StudioTemporalInstantProjection["reference"], desired: number, base?: number,
|
|
126
|
+
): string {
|
|
127
|
+
if (reference === "absolute") return `${desired}f`;
|
|
128
|
+
if (base === undefined) throw new Error(`The ${reference} projection base is unavailable.`);
|
|
129
|
+
const offset = desired - base;
|
|
130
|
+
return `${reference}${offset >= 0 ? "+" : ""}${offset}f`;
|
|
131
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Two-line label with an expanding editor; the caller owns persistence. */
|
|
2
|
+
export function createArtifactName(options: {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly editable: boolean;
|
|
5
|
+
readonly select: () => void;
|
|
6
|
+
readonly save: (name: string) => Promise<string>;
|
|
7
|
+
}) {
|
|
8
|
+
const element = document.createElement("div");
|
|
9
|
+
element.className = "artifact-copy";
|
|
10
|
+
const label = document.createElement("button");
|
|
11
|
+
label.type = "button";
|
|
12
|
+
label.className = "artifact-name";
|
|
13
|
+
let name = options.name;
|
|
14
|
+
const text = document.createElement("span");
|
|
15
|
+
text.className = "artifact-name-text";
|
|
16
|
+
text.textContent = name;
|
|
17
|
+
label.append(text);
|
|
18
|
+
label.title = options.editable ? `${name}\nDouble-click or press F2 to rename` : `${name}\nNaming is available when this Build finishes`;
|
|
19
|
+
element.append(label);
|
|
20
|
+
label.addEventListener("click", (event) => { event.stopPropagation(); options.select(); });
|
|
21
|
+
let editing = false;
|
|
22
|
+
|
|
23
|
+
function edit(): void {
|
|
24
|
+
if (editing || !options.editable) return;
|
|
25
|
+
options.select();
|
|
26
|
+
editing = true;
|
|
27
|
+
element.classList.add("editing");
|
|
28
|
+
label.hidden = true;
|
|
29
|
+
const field = document.createElement("textarea");
|
|
30
|
+
field.className = "artifact-name-editor";
|
|
31
|
+
field.value = name;
|
|
32
|
+
field.rows = 1;
|
|
33
|
+
field.setAttribute("aria-label", "Display name");
|
|
34
|
+
const error = document.createElement("span");
|
|
35
|
+
error.className = "artifact-name-error";
|
|
36
|
+
error.setAttribute("role", "status");
|
|
37
|
+
element.append(field, error);
|
|
38
|
+
const resize = () => { field.style.height = "0px"; field.style.height = `${field.scrollHeight + field.offsetHeight - field.clientHeight}px`; };
|
|
39
|
+
resize();
|
|
40
|
+
field.focus();
|
|
41
|
+
field.setSelectionRange(name.length, name.length);
|
|
42
|
+
field.addEventListener("input", resize);
|
|
43
|
+
field.addEventListener("click", (event) => event.stopPropagation());
|
|
44
|
+
let saving = false;
|
|
45
|
+
const close = () => {
|
|
46
|
+
editing = false;
|
|
47
|
+
field.remove();
|
|
48
|
+
error.remove();
|
|
49
|
+
label.hidden = false;
|
|
50
|
+
element.classList.remove("editing");
|
|
51
|
+
};
|
|
52
|
+
const save = async () => {
|
|
53
|
+
if (!editing || saving) return;
|
|
54
|
+
const value = field.value.trim();
|
|
55
|
+
if (value === name) { close(); return; }
|
|
56
|
+
if (value.length === 0) { error.textContent = "Enter a name."; return; }
|
|
57
|
+
saving = true;
|
|
58
|
+
field.readOnly = true;
|
|
59
|
+
error.textContent = "Saving…";
|
|
60
|
+
try {
|
|
61
|
+
name = await options.save(value);
|
|
62
|
+
text.textContent = name;
|
|
63
|
+
label.title = `${name}\nDouble-click or press F2 to rename`;
|
|
64
|
+
close();
|
|
65
|
+
} catch (cause) {
|
|
66
|
+
error.textContent = cause instanceof Error ? cause.message : String(cause);
|
|
67
|
+
} finally {
|
|
68
|
+
saving = false;
|
|
69
|
+
field.readOnly = false;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
field.addEventListener("blur", () => { void save(); });
|
|
73
|
+
field.addEventListener("keydown", (event) => {
|
|
74
|
+
if (event.key === "Escape" && !saving) { event.preventDefault(); event.stopPropagation(); close(); label.focus(); }
|
|
75
|
+
else if (event.key === "Enter" && !event.shiftKey) { event.preventDefault(); void save(); }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
label.addEventListener("dblclick", (event) => { event.preventDefault(); event.stopPropagation(); edit(); });
|
|
79
|
+
return { element, edit };
|
|
80
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { StudioArtifactView } from "../shared.js";
|
|
2
|
+
import { audioPreview } from "./material-preview.js";
|
|
3
|
+
|
|
4
|
+
/** A media viewer only: it does not change the composition or its playhead. */
|
|
5
|
+
export function createArtifactPreview(changed: () => void) {
|
|
6
|
+
const element = document.createElement("div");
|
|
7
|
+
element.className = "stage-artifact";
|
|
8
|
+
element.hidden = true;
|
|
9
|
+
let selected: StudioArtifactView | undefined;
|
|
10
|
+
let media: HTMLMediaElement | undefined;
|
|
11
|
+
let generation = 0;
|
|
12
|
+
|
|
13
|
+
function close(): void {
|
|
14
|
+
generation += 1;
|
|
15
|
+
selected = undefined;
|
|
16
|
+
if (media !== undefined) {
|
|
17
|
+
media.pause();
|
|
18
|
+
media.removeAttribute("src");
|
|
19
|
+
media.load();
|
|
20
|
+
}
|
|
21
|
+
media = undefined;
|
|
22
|
+
element.replaceChildren();
|
|
23
|
+
element.hidden = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function open(artifact: StudioArtifactView, muted: boolean): void {
|
|
27
|
+
close();
|
|
28
|
+
const current = generation;
|
|
29
|
+
selected = artifact;
|
|
30
|
+
element.hidden = false;
|
|
31
|
+
const url = `/__studio/artifact?${new URLSearchParams({ build: artifact.build, output: artifact.output })}`;
|
|
32
|
+
const error = document.createElement("p");
|
|
33
|
+
error.className = "stage-media-error";
|
|
34
|
+
error.hidden = true;
|
|
35
|
+
error.setAttribute("role", "status");
|
|
36
|
+
const failed = () => {
|
|
37
|
+
if (generation !== current) return;
|
|
38
|
+
error.textContent = "This media could not be opened in the browser.";
|
|
39
|
+
error.hidden = false;
|
|
40
|
+
changed();
|
|
41
|
+
};
|
|
42
|
+
if (artifact.mediaType.startsWith("image/")) {
|
|
43
|
+
const image = document.createElement("img");
|
|
44
|
+
image.alt = artifact.displayName ?? artifact.output;
|
|
45
|
+
image.addEventListener("error", failed);
|
|
46
|
+
image.src = url;
|
|
47
|
+
element.append(image);
|
|
48
|
+
} else {
|
|
49
|
+
const audio = artifact.mediaType.startsWith("audio/");
|
|
50
|
+
const player = document.createElement(audio ? "audio" : "video");
|
|
51
|
+
media = player;
|
|
52
|
+
if (player instanceof HTMLVideoElement) player.playsInline = true;
|
|
53
|
+
player.preload = "metadata";
|
|
54
|
+
player.muted = muted;
|
|
55
|
+
for (const event of ["loadedmetadata", "durationchange", "timeupdate", "play", "pause", "ended", "seeking", "seeked"]) {
|
|
56
|
+
player.addEventListener(event, () => { if (generation === current) changed(); });
|
|
57
|
+
}
|
|
58
|
+
player.addEventListener("error", failed);
|
|
59
|
+
player.src = url;
|
|
60
|
+
element.append(player);
|
|
61
|
+
if (audio) {
|
|
62
|
+
const wave = document.createElement("div");
|
|
63
|
+
wave.className = "stage-audio-wave";
|
|
64
|
+
wave.textContent = "Audio";
|
|
65
|
+
element.append(wave);
|
|
66
|
+
void audioPreview(url).then((waveform) => {
|
|
67
|
+
if (generation !== current || waveform === undefined) return;
|
|
68
|
+
const image = document.createElement("img");
|
|
69
|
+
image.src = waveform;
|
|
70
|
+
image.alt = "Audio waveform";
|
|
71
|
+
wave.replaceChildren(image);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
element.append(error);
|
|
76
|
+
changed();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function seek(seconds: number): void {
|
|
80
|
+
if (media === undefined || !Number.isFinite(media.duration)) return;
|
|
81
|
+
media.currentTime = Math.max(0, Math.min(media.duration, seconds));
|
|
82
|
+
changed();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function toggle(): void {
|
|
86
|
+
const player = media;
|
|
87
|
+
if (player === undefined) return;
|
|
88
|
+
if (!player.paused) player.pause();
|
|
89
|
+
else {
|
|
90
|
+
if (player.ended) player.currentTime = 0;
|
|
91
|
+
void player.play().catch(() => changed());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return { element, open, close, seek, toggle,
|
|
96
|
+
get selected() { return selected; },
|
|
97
|
+
get media() { return media; },
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { feedbackClock } from "../feedback.js";
|
|
2
|
+
import type { FeedbackComment, FeedbackMutation, FeedbackView } from "../feedback.js";
|
|
3
|
+
import { icon } from "./icons.js";
|
|
4
|
+
import type { Store } from "./selection.js";
|
|
5
|
+
import type { Stage } from "./stage.js";
|
|
6
|
+
|
|
7
|
+
type Anchor = Pick<FeedbackComment, "at">;
|
|
8
|
+
|
|
9
|
+
export function createComments(store: Store, stage: Stage) {
|
|
10
|
+
const element = document.createElement("aside");
|
|
11
|
+
element.className = "comments-panel";
|
|
12
|
+
element.innerHTML = `
|
|
13
|
+
<div class="pane-heading comments-heading">
|
|
14
|
+
<div class="pane-title">${icon("comments")}<h2>Comments</h2><span data-count></span></div>
|
|
15
|
+
<button type="button" class="comments-icon" data-refresh aria-label="Refresh comments" title="Refresh comments">${icon("refresh")}</button>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="comments-filters" role="group" aria-label="Filter comments">
|
|
18
|
+
<button type="button" data-filter="all" aria-pressed="true">All</button>
|
|
19
|
+
<button type="button" data-filter="open" aria-pressed="false">Open</button>
|
|
20
|
+
<button type="button" data-filter="done" aria-pressed="false">Done</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="comments-error" role="status" aria-live="polite" hidden></div>
|
|
23
|
+
<div class="comments-list" aria-label="Comments"></div>
|
|
24
|
+
<form class="comment-composer">
|
|
25
|
+
<div class="comment-anchor">
|
|
26
|
+
<button type="button" class="comment-time" data-current-time title="Use current frame" aria-label="Use current frame">${icon("when")}<span>00:00.00</span></button>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="comment-input">
|
|
29
|
+
<textarea rows="3" aria-label="Write a comment" placeholder="What would you like to change?" spellcheck="true" enterkeyhint="send"></textarea>
|
|
30
|
+
<div class="comment-input-actions">
|
|
31
|
+
<div class="comment-tools">
|
|
32
|
+
<button type="button" class="comments-icon" aria-label="Emoji — coming later" title="Emoji — coming later" disabled>${icon("smile")}</button>
|
|
33
|
+
<button type="button" class="comments-icon" aria-label="Draw — coming later" title="Draw — coming later" disabled>${icon("edit")}</button>
|
|
34
|
+
</div>
|
|
35
|
+
<button class="comment-submit" type="submit" aria-label="Send comment" title="Send comment (Enter)" disabled>${icon("send")}</button>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</form>`;
|
|
39
|
+
const list = element.querySelector<HTMLElement>(".comments-list")!;
|
|
40
|
+
const form = element.querySelector<HTMLFormElement>("form")!;
|
|
41
|
+
const input = form.querySelector<HTMLTextAreaElement>("textarea")!;
|
|
42
|
+
const submit = form.querySelector<HTMLButtonElement>(".comment-submit")!;
|
|
43
|
+
const counter = element.querySelector<HTMLElement>("[data-count]")!;
|
|
44
|
+
const timeLabel = form.querySelector<HTMLElement>("[data-current-time] span")!;
|
|
45
|
+
const errorView = element.querySelector<HTMLElement>(".comments-error")!;
|
|
46
|
+
let view: FeedbackView | undefined;
|
|
47
|
+
let filter = "all";
|
|
48
|
+
let selected: string | undefined;
|
|
49
|
+
let anchor: Anchor | undefined;
|
|
50
|
+
let busy = false;
|
|
51
|
+
let active = false;
|
|
52
|
+
let fetchId = 0;
|
|
53
|
+
let editing: { id: string; before: FeedbackComment; text: string } | undefined;
|
|
54
|
+
|
|
55
|
+
const showError = (error?: unknown): void => {
|
|
56
|
+
errorView.hidden = error === undefined;
|
|
57
|
+
errorView.textContent = error === undefined ? "" : error instanceof Error ? error.message : String(error);
|
|
58
|
+
};
|
|
59
|
+
const currentAnchor = (): Anchor | undefined => {
|
|
60
|
+
const state = store.current();
|
|
61
|
+
if (state === undefined) return undefined;
|
|
62
|
+
return {
|
|
63
|
+
at: state.playhead.frame * state.snapshot.space.frameRate.denominator / state.snapshot.space.frameRate.numerator,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const renderAnchor = (): void => {
|
|
67
|
+
timeLabel.textContent = feedbackClock(anchor?.at ?? 0);
|
|
68
|
+
submit.disabled = busy || view === undefined || anchor === undefined || input.value.trim().length === 0;
|
|
69
|
+
};
|
|
70
|
+
const capture = (): void => { stage.pause(); anchor = currentAnchor(); renderAnchor(); };
|
|
71
|
+
const button = (name: string, label: string, action: () => void): HTMLButtonElement => {
|
|
72
|
+
const node = document.createElement("button");
|
|
73
|
+
node.type = "button"; node.className = "comments-icon";
|
|
74
|
+
node.innerHTML = icon(name); node.title = label; node.setAttribute("aria-label", label);
|
|
75
|
+
node.disabled = busy;
|
|
76
|
+
node.addEventListener("click", (event) => { event.stopPropagation(); action(); });
|
|
77
|
+
return node;
|
|
78
|
+
};
|
|
79
|
+
const locate = (comment: FeedbackComment): void => {
|
|
80
|
+
stage.pause(); stage.showComposition();
|
|
81
|
+
const state = store.current();
|
|
82
|
+
if (state === undefined) return;
|
|
83
|
+
const frame = Math.round(comment.at * state.snapshot.space.frameRate.numerator / state.snapshot.space.frameRate.denominator);
|
|
84
|
+
store.seek(frame, "video");
|
|
85
|
+
selected = comment.id;
|
|
86
|
+
render();
|
|
87
|
+
};
|
|
88
|
+
const render = (): void => {
|
|
89
|
+
const focusedEdit = list.querySelector<HTMLTextAreaElement>(".comment-edit textarea");
|
|
90
|
+
const cursor = focusedEdit === document.activeElement && focusedEdit !== null
|
|
91
|
+
? { start: focusedEdit.selectionStart, end: focusedEdit.selectionEnd } : undefined;
|
|
92
|
+
counter.textContent = view === undefined ? "" : String(view.comments.length);
|
|
93
|
+
// Notes are appended to the file in submission order. Number that order;
|
|
94
|
+
// time sorting and filters only change where a note is displayed.
|
|
95
|
+
const comments = [...view?.comments ?? []]
|
|
96
|
+
.map((comment, index) => ({ comment, number: index + 1 }))
|
|
97
|
+
.sort((a, b) => a.comment.at - b.comment.at)
|
|
98
|
+
.filter(({ comment }) => filter === "all" || (filter === "done") === (comment.resolved === true));
|
|
99
|
+
list.replaceChildren();
|
|
100
|
+
if (comments.length === 0) {
|
|
101
|
+
const empty = document.createElement("div");
|
|
102
|
+
empty.className = "comments-empty";
|
|
103
|
+
empty.innerHTML = `${icon(filter === "done" ? "check" : "comments")}<strong></strong><p></p>`;
|
|
104
|
+
empty.querySelector("strong")!.textContent = view === undefined ? "Loading comments…" : filter === "done" ? "No completed comments" : filter === "open" ? "All caught up" : "A note starts here";
|
|
105
|
+
empty.querySelector("p")!.textContent = filter === "all" ? "Pause on a frame and describe what you would like to change." : "Switch filters to see the other comments.";
|
|
106
|
+
list.append(empty);
|
|
107
|
+
}
|
|
108
|
+
for (const { comment, number } of comments) {
|
|
109
|
+
const row = document.createElement("article");
|
|
110
|
+
row.className = `comment-card${comment.resolved ? " resolved" : ""}${comment.id === selected ? " selected" : ""}`;
|
|
111
|
+
row.dataset.commentId = comment.id;
|
|
112
|
+
const head = document.createElement("div"); head.className = "comment-card-head";
|
|
113
|
+
const location = document.createElement("button"); location.type = "button"; location.className = "comment-location";
|
|
114
|
+
const label = document.createElement("span"); label.className = "comment-number"; label.textContent = `#${number}`;
|
|
115
|
+
const time = document.createElement("span"); time.className = "comment-time"; time.textContent = feedbackClock(comment.at);
|
|
116
|
+
location.append(time);
|
|
117
|
+
location.title = "Go to this frame"; location.addEventListener("click", () => locate(comment));
|
|
118
|
+
row.addEventListener("click", (event) => {
|
|
119
|
+
if ((event.target as Element).closest("button, form") !== null || window.getSelection()?.isCollapsed === false) return;
|
|
120
|
+
locate(comment);
|
|
121
|
+
});
|
|
122
|
+
const actions = document.createElement("div"); actions.className = "comment-actions";
|
|
123
|
+
const resolve = button("check", comment.resolved ? "Reopen comment" : "Mark complete", () => {
|
|
124
|
+
void mutate({ type: "replace", before: comment, comment: { ...comment, resolved: !comment.resolved } });
|
|
125
|
+
});
|
|
126
|
+
resolve.classList.toggle("is-done", comment.resolved === true);
|
|
127
|
+
resolve.setAttribute("aria-pressed", String(comment.resolved === true));
|
|
128
|
+
actions.append(label, resolve, button("edit", "Edit comment", () => {
|
|
129
|
+
editing = { id: comment.id, before: comment, text: comment.text }; selected = comment.id; render();
|
|
130
|
+
list.querySelector<HTMLTextAreaElement>(".comment-edit textarea")?.focus();
|
|
131
|
+
}), button("trash", "Delete comment", () => { void mutate({ type: "delete", before: comment }); }));
|
|
132
|
+
head.append(location, actions); row.append(head);
|
|
133
|
+
if (editing?.id === comment.id) {
|
|
134
|
+
const edit = document.createElement("form"); edit.className = "comment-edit";
|
|
135
|
+
const text = document.createElement("textarea"); text.rows = 3; text.value = editing.text;
|
|
136
|
+
text.setAttribute("aria-label", "Edit comment text");
|
|
137
|
+
text.addEventListener("input", () => { if (editing !== undefined) editing.text = text.value; });
|
|
138
|
+
const controls = document.createElement("div"); controls.className = "comment-edit-actions";
|
|
139
|
+
const cancel = document.createElement("button"); cancel.type = "button"; cancel.textContent = "Cancel";
|
|
140
|
+
cancel.addEventListener("click", () => { editing = undefined; render(); });
|
|
141
|
+
const save = document.createElement("button"); save.type = "submit"; save.textContent = "Save"; save.disabled = busy;
|
|
142
|
+
controls.append(cancel, save); edit.append(text, controls);
|
|
143
|
+
edit.addEventListener("submit", (event) => {
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
if (editing === undefined || text.value.trim().length === 0) return;
|
|
146
|
+
void mutate({ type: "replace", before: editing.before, comment: { ...editing.before, text: text.value.trim() } }, () => { editing = undefined; });
|
|
147
|
+
}); row.append(edit);
|
|
148
|
+
} else {
|
|
149
|
+
const text = document.createElement("p"); text.className = "comment-text"; text.textContent = comment.text;
|
|
150
|
+
row.append(text);
|
|
151
|
+
}
|
|
152
|
+
list.append(row);
|
|
153
|
+
}
|
|
154
|
+
if (cursor !== undefined) {
|
|
155
|
+
const next = list.querySelector<HTMLTextAreaElement>(".comment-edit textarea");
|
|
156
|
+
next?.focus({ preventScroll: true }); next?.setSelectionRange(cursor.start, cursor.end);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const refresh = async (): Promise<void> => {
|
|
160
|
+
const request = ++fetchId;
|
|
161
|
+
try {
|
|
162
|
+
const response = await fetch("/__studio/feedback");
|
|
163
|
+
const data = await response.json() as FeedbackView & { error?: string };
|
|
164
|
+
if (!response.ok) throw new Error(data.error ?? "Could not read comments.");
|
|
165
|
+
if (request !== fetchId) return;
|
|
166
|
+
if (JSON.stringify(view) !== JSON.stringify(data)) { view = data; render(); }
|
|
167
|
+
showError(); renderAnchor();
|
|
168
|
+
} catch (error) { if (request === fetchId) showError(error); }
|
|
169
|
+
};
|
|
170
|
+
const mutate = async (mutation: FeedbackMutation, saved?: () => void): Promise<void> => {
|
|
171
|
+
if (busy) return;
|
|
172
|
+
busy = true; showError(); renderAnchor();
|
|
173
|
+
try {
|
|
174
|
+
const response = await fetch("/__studio/feedback", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(mutation) });
|
|
175
|
+
const data = await response.json() as FeedbackView & { error?: string };
|
|
176
|
+
if (!response.ok) throw new Error(data.error ?? "Could not save comment.");
|
|
177
|
+
++fetchId; view = data; busy = false; saved?.();
|
|
178
|
+
if (mutation.type === "delete" && selected === mutation.before.id) selected = undefined;
|
|
179
|
+
if (mutation.type === "delete" && editing?.id === mutation.before.id) editing = undefined;
|
|
180
|
+
render();
|
|
181
|
+
} catch (error) { showError(error); }
|
|
182
|
+
finally { busy = false; renderAnchor(); }
|
|
183
|
+
};
|
|
184
|
+
form.addEventListener("submit", (event) => {
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
if (view === undefined || anchor === undefined || input.value.trim().length === 0) return;
|
|
187
|
+
const comment: FeedbackComment = { id: `c-${crypto.randomUUID()}`, run: view.run, ...anchor, text: input.value.trim() };
|
|
188
|
+
void mutate({ type: "add", comment }, () => {
|
|
189
|
+
input.value = ""; input.style.height = ""; selected = comment.id; anchor = currentAnchor();
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
input.addEventListener("focus", () => { if (input.value.length === 0) capture(); else stage.pause(); });
|
|
193
|
+
input.addEventListener("input", () => {
|
|
194
|
+
input.style.height = "auto"; input.style.height = `${Math.min(180, input.scrollHeight)}px`; renderAnchor();
|
|
195
|
+
});
|
|
196
|
+
element.addEventListener("keydown", (event) => {
|
|
197
|
+
if (!(event.target instanceof HTMLTextAreaElement) || event.key !== "Enter") return;
|
|
198
|
+
// Some IMEs report the confirming Enter as keyCode 229 after compositionend.
|
|
199
|
+
if (event.isComposing || event.keyCode === 229 || event.shiftKey || event.altKey) return;
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
event.stopPropagation();
|
|
202
|
+
if (!event.repeat) event.target.form?.requestSubmit();
|
|
203
|
+
});
|
|
204
|
+
document.addEventListener("pointerdown", (event) => {
|
|
205
|
+
if (!active || selected === undefined) return;
|
|
206
|
+
const row = event.target instanceof Element ? event.target.closest(".comment-card") : null;
|
|
207
|
+
if (row?.getAttribute("data-comment-id") === selected) return;
|
|
208
|
+
selected = undefined;
|
|
209
|
+
// Keep the clicked control and any unsaved editor mounted through pointerup.
|
|
210
|
+
list.querySelector(".comment-card.selected")?.classList.remove("selected");
|
|
211
|
+
});
|
|
212
|
+
form.querySelector("[data-current-time]")!.addEventListener("click", capture);
|
|
213
|
+
element.querySelector("[data-refresh]")!.addEventListener("click", () => { void refresh(); });
|
|
214
|
+
element.querySelectorAll<HTMLButtonElement>("[data-filter]").forEach((button) => button.addEventListener("click", () => {
|
|
215
|
+
filter = button.dataset.filter!;
|
|
216
|
+
element.querySelectorAll<HTMLButtonElement>("[data-filter]").forEach((item) => item.setAttribute("aria-pressed", String(item === button)));
|
|
217
|
+
render();
|
|
218
|
+
}));
|
|
219
|
+
store.subscribe(() => {
|
|
220
|
+
if (input.value.length === 0) { anchor = currentAnchor(); renderAnchor(); }
|
|
221
|
+
});
|
|
222
|
+
type Hot = { on(event: string, listener: () => void): void };
|
|
223
|
+
(import.meta as ImportMeta & { hot?: Hot }).hot?.on("studio:feedback-changed", () => { if (active) void refresh(); });
|
|
224
|
+
render();
|
|
225
|
+
return {
|
|
226
|
+
element,
|
|
227
|
+
activate(value: boolean) {
|
|
228
|
+
active = value;
|
|
229
|
+
stage.setReviewMode(value);
|
|
230
|
+
if (active) { stage.showComposition(); anchor ??= currentAnchor(); renderAnchor(); void refresh(); }
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
@@ -2,6 +2,11 @@ const paths: Readonly<Record<string, string>> = {
|
|
|
2
2
|
brand: '<g transform="translate(0 1.282) scale(.091603) translate(-50 -180)"><path fill="currentColor" stroke="none" d="M303.78,277.82c-5.98-8.63-15.83-13.77-26.32-13.77h-93.41c-12.28,0-24.92,7.44-29.6,18.8l-28.26,75.82c-4.6,11.25-4.54,24.05,2.22,34.16,6.79,10.15,19.36,16.15,31.57,16.15h85.98c14.12,0,26.9-8.88,31.84-22.1l29.69-79.57c3.67-9.84,2.29-20.86-3.69-29.48v-.02h-.02ZM252.02,377.25c-.94,2.52-3.39,4.22-6.08,4.22h-83.45c-4.34,0-6.68-2.8-7.49-3.99s-2.5-4.43-.84-8.44l23.85-66.24c2.29-6.35,8.08-10.87,14.82-11.22.33-.02.67-.02,1.02-.02h75.41s12.51,1.42,9.29,14.61l-26.53,71.09h0ZM106.85,361.73s-22.36-11.59-17.66-32.66l29.67-82.23c4.78-13.25,17.36-22.09,31.45-22.09h95.02c6.25,0,12.1,3.03,15.71,8.14l13.89,19.68h-112.97c-8.7,0-16.49,5.41-19.52,13.57l-35.59,95.6h0ZM73.3,323.27s-22.37-11.59-17.66-32.66l29.67-82.23c4.79-13.25,17.37-22.09,31.45-22.09h89.91c6.25,0,12.1,3.03,15.71,8.14l13.89,19.68h-107.84c-8.7,0-16.49,5.41-19.52,13.57l-35.59,95.6h-.02Z"/></g>',
|
|
3
3
|
code: '<path d="M9 7 4 12l5 5M15 7l5 5-5 5M13 4l-2 16"/>',
|
|
4
4
|
edit: '<path d="m4 16-.8 4 4-.8L18.5 8.9 15.1 5.5 4 16Z"/><path d="m13.8 6.8 3.4 3.4"/>',
|
|
5
|
+
studio: '<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M3 14h18M8 4v10M15 14v6"/>',
|
|
6
|
+
comments: '<path d="M6 17H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-8l-5 4v-4Z"/><path d="M7 8h10M7 12h7"/>',
|
|
7
|
+
trash: '<path d="M3 6h18M9 6V3h6v3M6 6l1 15h10l1-15M10 10v7M14 10v7"/>',
|
|
8
|
+
send: '<path d="M12 20V4m-6 6 6-6 6 6"/>',
|
|
9
|
+
smile: '<circle cx="12" cy="12" r="9"/><path d="M8 14a4.5 4.5 0 0 0 8 0M8.5 9h.01M15.5 9h.01"/>',
|
|
5
10
|
eye: '<path d="M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"/><circle cx="12" cy="12" r="2.5"/>',
|
|
6
11
|
preview: '<rect x="3" y="4" width="18" height="14" rx="2"/><path d="m10 8 5 3.5-5 3.5V8ZM8 21h8"/>',
|
|
7
12
|
tune: '<path d="M4 7h10M18 7h2M4 17h2M10 17h10"/><circle cx="16" cy="7" r="2"/><circle cx="8" cy="17" r="2"/>',
|
|
@@ -14,7 +19,6 @@ const paths: Readonly<Record<string, string>> = {
|
|
|
14
19
|
results: '<path d="M4 8v12h16V8M3 4h18v4H3zM9 12h6"/>',
|
|
15
20
|
run: '<circle cx="12" cy="12" r="9"/><path d="m10 8 6 4-6 4V8Z"/>',
|
|
16
21
|
image: '<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="8.5" cy="9" r="2"/><path d="m4 18 5-5 3 3 3-4 5 6"/>',
|
|
17
|
-
sidebarCollapse: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M8 4v16m7-11-3 3 3 3"/>',
|
|
18
22
|
wrap: '<path d="M4 6h16M4 10h12a4 4 0 0 1 0 8h-5m3-3-3 3 3 3M4 14h5M4 18h4"/>',
|
|
19
23
|
timeline: '<path d="M3 6h18M3 12h18M3 18h18"/><path d="M8 4v4M16 10v4M11 16v4"/>',
|
|
20
24
|
minus: '<path d="M5 12h14"/>',
|
|
@@ -40,6 +44,11 @@ const paths: Readonly<Record<string, string>> = {
|
|
|
40
44
|
layers: '<path d="m12 3 9 5-9 5-9-5 9-5Z"/><path d="m3 12 9 5 9-5M3 16l9 5 9-5"/>',
|
|
41
45
|
ranking: '<path d="M5 19V9h4v10M10 19V5h4v14M15 19v-7h4v7M3 19h18"/>',
|
|
42
46
|
refresh: '<path d="M20 7v5h-5M4 17v-5h5"/><path d="M18.5 9a7 7 0 0 0-11.8-2.3L4 9M5.5 15a7 7 0 0 0 11.8 2.3L20 15"/>',
|
|
47
|
+
check: '<circle cx="12" cy="12" r="9"/><path d="m8 12 3 3 5-6"/>',
|
|
48
|
+
alert: '<circle cx="12" cy="12" r="9"/><path d="M12 7v6M12 17h.01"/>',
|
|
49
|
+
arrowRight: '<path d="M5 12h14m-6-6 6 6-6 6"/>',
|
|
50
|
+
close: '<path d="m6 6 12 12M18 6 6 18"/>',
|
|
51
|
+
panel: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M8 4v16M8 9h13"/>',
|
|
43
52
|
};
|
|
44
53
|
|
|
45
54
|
export function icon(name: string, className = "icon"): string {
|