@hypit/hypit 0.0.1 → 0.1.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/LICENSE +26 -0
- package/README.md +142 -0
- package/bin/hypit.mjs +46 -0
- package/dist/public/artifact.d.ts +75 -0
- package/dist/public/author-kit.d.ts +559 -0
- package/dist/public/browser-capture.d.ts +56 -0
- package/dist/public/caption.d.ts +751 -0
- package/dist/public/composition.d.ts +672 -0
- package/dist/public/endpoint-kit.d.ts +366 -0
- package/dist/public/generation.d.ts +591 -0
- package/dist/public/hyperframes.d.ts +774 -0
- package/dist/public/media.d.ts +708 -0
- package/dist/public/model-kit.d.ts +523 -0
- package/dist/public/narrative.d.ts +315 -0
- package/dist/public/program-space.d.ts +193 -0
- package/dist/public/runtime-kit.d.ts +427 -0
- package/dist/public/semantic-track.d.ts +418 -0
- package/dist/public/spatial.d.ts +1193 -0
- package/dist/public/speech.d.ts +391 -0
- package/dist/public/studio-adapter.d.ts +686 -0
- package/dist/public/svs.d.ts +311 -0
- package/dist/public/temporal-markup.d.ts +343 -0
- package/dist/public/temporal.d.ts +497 -0
- package/dist/public/text.d.ts +817 -0
- package/dist/public/visual-ir.d.ts +98 -0
- package/docs/public/hypit-logo-dark.svg +36 -0
- package/docs/public/hypit-logo-light.svg +38 -0
- package/examples/README.md +24 -0
- package/examples/minimal-author-package/README.md +18 -0
- package/examples/minimal-author-package/packages/example-component/README.md +44 -0
- package/examples/minimal-author-package/packages/example-component/package.json +27 -0
- package/examples/minimal-author-package/packages/example-component/preview/Box.png +0 -0
- package/examples/minimal-author-package/packages/example-component/preview/build.svrun +6 -0
- package/examples/minimal-author-package/packages/example-component/preview/preview.svml +47 -0
- package/examples/minimal-author-package/packages/example-component/preview/recipes.svs +8 -0
- package/examples/minimal-author-package/packages/example-component/src/activation.ts +10 -0
- package/examples/minimal-author-package/packages/example-component/src/component.ts +44 -0
- package/examples/minimal-author-package/packages/example-component/src/fragment.ts +32 -0
- package/examples/minimal-author-package/packages/example-component/src/index.ts +6 -0
- package/examples/minimal-author-package/packages/example-component/src/manifest.ts +82 -0
- package/examples/minimal-author-package/packages/example-component/src/style.ts +13 -0
- package/examples/minimal-author-package/packages/example-component/src/surface.ts +41 -0
- package/examples/minimal-author-package/packages/example-component/src/temporal.ts +6 -0
- package/examples/minimal-author-package/packages/example-component/tsconfig.json +18 -0
- package/examples/semantic-composition/README.md +35 -0
- package/examples/semantic-composition/chat.svml +25 -0
- package/examples/semantic-composition/chat.svrun +6 -0
- package/examples/semantic-composition/chat.svs +4 -0
- package/examples/semantic-composition/hypit.runtime.json +8 -0
- package/examples/semantic-composition/packages/chat-scene/README.md +29 -0
- package/examples/semantic-composition/packages/chat-scene/package.json +11 -0
- package/examples/semantic-composition/packages/chat-scene/src/activation.ts +112 -0
- package/examples/semantic-composition/packages/chat-scene/src/render.ts +64 -0
- package/examples/semantic-composition/packages/chat-scene/tsconfig.json +18 -0
- package/examples/semantic-composition/packages/responsive-explainer/README.md +45 -0
- package/examples/semantic-composition/packages/responsive-explainer/package.json +11 -0
- package/examples/semantic-composition/packages/responsive-explainer/src/activation.ts +90 -0
- package/examples/semantic-composition/packages/responsive-explainer/src/render.ts +68 -0
- package/examples/semantic-composition/packages/responsive-explainer/tsconfig.json +18 -0
- package/package.json +263 -5
- package/packages/artifact/README.md +10 -0
- package/packages/artifact/package.json +16 -0
- package/packages/artifact/src/activation.ts +8 -0
- package/packages/artifact/src/index.ts +24 -0
- package/packages/audio-track/README.md +43 -0
- package/packages/audio-track/package.json +36 -0
- package/packages/audio-track/src/activation.ts +20 -0
- package/packages/audio-track/src/component.ts +40 -0
- package/packages/audio-track/src/fragment.ts +63 -0
- package/packages/audio-track/src/index.ts +7 -0
- package/packages/audio-track/src/manifest.ts +151 -0
- package/packages/audio-track/src/program.ts +254 -0
- package/packages/audio-track/src/surface.ts +187 -0
- package/packages/audio-track/src/types.ts +62 -0
- package/packages/audio-track-studio/README.md +3 -0
- package/packages/audio-track-studio/package.json +14 -0
- package/packages/audio-track-studio/src/activation.ts +7 -0
- package/packages/audio-track-studio/src/index.ts +72 -0
- package/packages/author-kit/README.md +31 -0
- package/packages/author-kit/package.json +16 -0
- package/packages/author-kit/src/index.ts +59 -0
- package/packages/background-removal/README.md +29 -0
- package/packages/background-removal/package.json +16 -0
- package/packages/background-removal/src/activation.ts +18 -0
- package/packages/background-removal/src/component.ts +32 -0
- package/packages/background-removal/src/fragment.ts +18 -0
- package/packages/background-removal/src/index.ts +6 -0
- package/packages/background-removal/src/manifest.ts +45 -0
- package/packages/background-removal/src/program.ts +19 -0
- package/packages/background-removal/src/surface.ts +27 -0
- package/packages/background-removal/src/types.ts +5 -0
- package/packages/browser-capture/README.md +82 -0
- package/packages/browser-capture/package.json +15 -0
- package/packages/browser-capture/src/browser.ts +19 -0
- package/packages/browser-capture/src/index.ts +198 -0
- package/packages/build-result/package.json +13 -0
- package/packages/build-result/src/decode.ts +286 -0
- package/packages/build-result/src/index.ts +25 -0
- package/packages/build-result/src/store.ts +505 -0
- package/packages/build-result/src/types.ts +354 -0
- package/packages/build-result/src/writer.ts +184 -0
- package/packages/build-result-fs/README.md +29 -0
- package/packages/build-result-fs/package.json +17 -0
- package/packages/build-result-fs/src/activation.ts +62 -0
- package/packages/build-result-fs/src/index.ts +1 -0
- package/packages/build-result-kit/README.md +10 -0
- package/packages/build-result-kit/package.json +15 -0
- package/packages/build-result-kit/src/index.ts +144 -0
- package/packages/build-result-s3/README.md +49 -0
- package/packages/build-result-s3/package.json +19 -0
- package/packages/build-result-s3/src/activation.ts +71 -0
- package/packages/build-result-s3/src/client.ts +254 -0
- package/packages/build-result-s3/src/index.ts +4 -0
- package/packages/build-result-s3/src/repository.ts +361 -0
- package/packages/caption/README.md +77 -0
- package/packages/caption/package.json +28 -0
- package/packages/caption/src/activation.ts +17 -0
- package/packages/caption/src/component.ts +38 -0
- package/packages/caption/src/display.ts +111 -0
- package/packages/caption/src/error.ts +9 -0
- package/packages/caption/src/fragment.ts +26 -0
- package/packages/caption/src/index.ts +33 -0
- package/packages/caption/src/manifest.ts +97 -0
- package/packages/caption/src/style.ts +170 -0
- package/packages/caption/src/surface.ts +96 -0
- package/packages/caption/src/temporalize.ts +124 -0
- package/packages/caption/src/types.ts +71 -0
- package/packages/caption-fine/README.md +108 -0
- package/packages/caption-fine/package.json +30 -0
- package/packages/caption-fine/preview/Track.png +0 -0
- package/packages/caption-fine/src/activation.ts +32 -0
- package/packages/caption-fine/src/component.ts +58 -0
- package/packages/caption-fine/src/fragment.ts +112 -0
- package/packages/caption-fine/src/index.ts +19 -0
- package/packages/caption-fine/src/manifest.ts +383 -0
- package/packages/caption-fine/src/recipe.ts +120 -0
- package/packages/caption-fine/src/render.ts +1133 -0
- package/packages/caption-fine/src/schedule.ts +126 -0
- package/packages/caption-fine/src/spacing.ts +69 -0
- package/packages/caption-fine/src/style.ts +370 -0
- package/packages/caption-fine/src/surface.ts +152 -0
- package/packages/caption-fine/src/types.ts +191 -0
- package/packages/caption-fine-studio/README.md +3 -0
- package/packages/caption-fine-studio/package.json +15 -0
- package/packages/caption-fine-studio/src/activation.ts +7 -0
- package/packages/caption-fine-studio/src/index.ts +163 -0
- package/packages/cli/README.md +51 -0
- package/packages/cli/package.json +33 -0
- package/packages/cli/src/arguments.ts +605 -0
- package/packages/cli/src/build-planning.ts +460 -0
- package/packages/cli/src/command.ts +202 -0
- package/packages/cli/src/commands/environment.ts +391 -0
- package/packages/cli/src/commands/execution.ts +321 -0
- package/packages/cli/src/commands/results.ts +187 -0
- package/packages/cli/src/commands/types.ts +9 -0
- package/packages/cli/src/distribution.ts +74 -0
- package/packages/cli/src/index.ts +30 -0
- package/packages/cli/src/machine-view.ts +28 -0
- package/packages/cli/src/main.ts +654 -0
- package/packages/cli/src/oauth.ts +228 -0
- package/packages/cli/src/observation.ts +203 -0
- package/packages/cli/src/output.ts +1007 -0
- package/packages/cli/src/paths.ts +7 -0
- package/packages/cli/src/project-context.ts +38 -0
- package/packages/cli/src/reachability.ts +91 -0
- package/packages/cli/src/result-export.ts +148 -0
- package/packages/cli/src/result-query.ts +46 -0
- package/packages/cli/src/run-file.ts +186 -0
- package/packages/cli/src/runtime-port.ts +13 -0
- package/packages/cli/src/runtime-selection.ts +94 -0
- package/packages/cli/src/runtime-view.ts +15 -0
- package/packages/cli/src/source-discovery.ts +150 -0
- package/packages/cli/src/source-packages.ts +91 -0
- package/packages/cli/src/view.ts +228 -0
- package/packages/comment-sticker/README.md +41 -0
- package/packages/comment-sticker/package.json +29 -0
- package/packages/comment-sticker/preview/Track.png +0 -0
- package/packages/comment-sticker/src/activation.ts +32 -0
- package/packages/comment-sticker/src/author.ts +148 -0
- package/packages/comment-sticker/src/component.ts +97 -0
- package/packages/comment-sticker/src/fragment.ts +124 -0
- package/packages/comment-sticker/src/index.ts +8 -0
- package/packages/comment-sticker/src/manifest.ts +373 -0
- package/packages/comment-sticker/src/program.ts +610 -0
- package/packages/comment-sticker/src/surface.ts +172 -0
- package/packages/comment-sticker/src/types.ts +109 -0
- package/packages/comment-sticker-studio/README.md +3 -0
- package/packages/comment-sticker-studio/package.json +14 -0
- package/packages/comment-sticker-studio/src/activation.ts +7 -0
- package/packages/comment-sticker-studio/src/index.ts +132 -0
- package/packages/compiler-markup-node/README.md +12 -0
- package/packages/compiler-markup-node/package.json +22 -0
- package/packages/compiler-markup-node/src/index.ts +59 -0
- package/packages/compiler-node/README.md +60 -0
- package/packages/compiler-node/package.json +25 -0
- package/packages/compiler-node/src/compiler.ts +207 -0
- package/packages/compiler-node/src/error.ts +11 -0
- package/packages/compiler-node/src/graph-query.ts +51 -0
- package/packages/compiler-node/src/index.ts +27 -0
- package/packages/compiler-node/src/modules.ts +107 -0
- package/packages/compiler-node/src/run.ts +355 -0
- package/packages/component-kit/README.md +97 -0
- package/packages/component-kit/package.json +13 -0
- package/packages/component-kit/src/index.ts +155 -0
- package/packages/composition/README.md +53 -0
- package/packages/composition/package.json +29 -0
- package/packages/composition/src/activation.ts +3 -0
- package/packages/composition/src/component.ts +10 -0
- package/packages/composition/src/index.ts +18 -0
- package/packages/composition/src/manifest.ts +13 -0
- package/packages/composition/src/schema.ts +194 -0
- package/packages/composition/src/track.ts +1403 -0
- package/packages/core/README.md +22 -0
- package/packages/core/package.json +13 -0
- package/packages/core/src/error.ts +12 -0
- package/packages/core/src/graph.ts +341 -0
- package/packages/core/src/index.ts +32 -0
- package/packages/core/src/link.ts +240 -0
- package/packages/core/src/machine.ts +60 -0
- package/packages/core/src/plan.ts +504 -0
- package/packages/core/src/reducer.ts +428 -0
- package/packages/core/src/reference.ts +25 -0
- package/packages/core/src/slice.ts +108 -0
- package/packages/credential-store-env/README.md +11 -0
- package/packages/credential-store-env/package.json +17 -0
- package/packages/credential-store-env/src/activation.ts +25 -0
- package/packages/credential-store-env/src/index.ts +23 -0
- package/packages/credential-store-os/README.md +13 -0
- package/packages/credential-store-os/package.json +22 -0
- package/packages/credential-store-os/runtime/windows-credential.ps1 +59 -0
- package/packages/credential-store-os/src/activation.ts +32 -0
- package/packages/credential-store-os/src/index.ts +2 -0
- package/packages/credential-store-os/src/store.ts +196 -0
- package/packages/deck-track/README.md +52 -0
- package/packages/deck-track/package.json +35 -0
- package/packages/deck-track/preview/DepthStack.png +0 -0
- package/packages/deck-track/src/activation.ts +32 -0
- package/packages/deck-track/src/author.ts +217 -0
- package/packages/deck-track/src/component.ts +86 -0
- package/packages/deck-track/src/fragment.ts +148 -0
- package/packages/deck-track/src/index.ts +16 -0
- package/packages/deck-track/src/lower.ts +370 -0
- package/packages/deck-track/src/manifest.ts +438 -0
- package/packages/deck-track/src/program.ts +367 -0
- package/packages/deck-track/src/surface.ts +286 -0
- package/packages/deck-track/src/types.ts +119 -0
- package/packages/deck-track-studio/README.md +3 -0
- package/packages/deck-track-studio/package.json +14 -0
- package/packages/deck-track-studio/src/activation.ts +7 -0
- package/packages/deck-track-studio/src/index.ts +134 -0
- package/packages/driver-node/README.md +23 -0
- package/packages/driver-node/package.json +18 -0
- package/packages/driver-node/src/driver.ts +616 -0
- package/packages/driver-node/src/index.ts +10 -0
- package/packages/driver-node/src/planning.ts +67 -0
- package/packages/driver-node/src/registry.ts +234 -0
- package/packages/driver-node/src/resources.ts +36 -0
- package/packages/driver-node/src/types.ts +69 -0
- package/packages/elaborator/README.md +74 -0
- package/packages/elaborator/package.json +16 -0
- package/packages/elaborator/src/author.ts +308 -0
- package/packages/elaborator/src/fragment.ts +505 -0
- package/packages/elaborator/src/frontend-facet.ts +30 -0
- package/packages/elaborator/src/index.ts +78 -0
- package/packages/elaborator/src/source.ts +608 -0
- package/packages/endpoint-kit/README.md +111 -0
- package/packages/endpoint-kit/package.json +14 -0
- package/packages/endpoint-kit/src/index.ts +488 -0
- package/packages/estimate/README.md +32 -0
- package/packages/estimate/package.json +20 -0
- package/packages/estimate/src/activation.ts +11 -0
- package/packages/estimate/src/index.ts +16 -0
- package/packages/estimate/src/manifest.ts +34 -0
- package/packages/estimate/src/policy.ts +70 -0
- package/packages/estimate/src/program.ts +196 -0
- package/packages/estimate/src/types.ts +15 -0
- package/packages/film/README.md +49 -0
- package/packages/film/package.json +34 -0
- package/packages/film/src/activation.ts +16 -0
- package/packages/film/src/component.ts +61 -0
- package/packages/film/src/fragment.ts +83 -0
- package/packages/film/src/index.ts +11 -0
- package/packages/film/src/manifest.ts +152 -0
- package/packages/film/src/program.ts +110 -0
- package/packages/film/src/recipe.ts +24 -0
- package/packages/film/src/surface.ts +146 -0
- package/packages/film/src/types.ts +26 -0
- package/packages/film-studio/package.json +16 -0
- package/packages/film-studio/src/activation.ts +8 -0
- package/packages/film-studio/src/index.ts +17 -0
- package/packages/fonts-open/README.md +77 -0
- package/packages/fonts-open/package.json +130 -0
- package/packages/fonts-open/src/activation.ts +30 -0
- package/packages/fonts-open/src/catalog.ts +317 -0
- package/packages/fonts-open/src/index.ts +13 -0
- package/packages/fonts-open/src/manifest.ts +83 -0
- package/packages/fonts-open/src/surface.ts +239 -0
- package/packages/generation/README.md +19 -0
- package/packages/generation/package.json +23 -0
- package/packages/generation/src/activation.ts +9 -0
- package/packages/generation/src/component.ts +77 -0
- package/packages/generation/src/identity.ts +80 -0
- package/packages/generation/src/index.ts +79 -0
- package/packages/generation/src/manifest.ts +65 -0
- package/packages/generation/src/mapping.ts +231 -0
- package/packages/generation/src/ports.ts +222 -0
- package/packages/generation/src/request.ts +427 -0
- package/packages/generation/src/schema.ts +62 -0
- package/packages/generation/src/types.ts +17 -0
- package/packages/gpt-image/README.md +54 -0
- package/packages/gpt-image/package.json +34 -0
- package/packages/gpt-image/src/activation.ts +39 -0
- package/packages/gpt-image/src/fragment.ts +101 -0
- package/packages/gpt-image/src/index.ts +203 -0
- package/packages/gpt-image/src/surface.ts +194 -0
- package/packages/gpt-image-kits/README.md +44 -0
- package/packages/gpt-image-kits/kits/phone-ugc-v1.svs +34 -0
- package/packages/gpt-image-kits/package.json +15 -0
- package/packages/grok-imagine/README.md +21 -0
- package/packages/grok-imagine/package.json +21 -0
- package/packages/grok-imagine/src/activation.ts +29 -0
- package/packages/grok-imagine/src/index.ts +174 -0
- package/packages/grok-imagine/src/surface.ts +149 -0
- package/packages/host/README.md +5 -0
- package/packages/host/package.json +10 -0
- package/packages/host/src/facet.ts +6 -0
- package/packages/host/src/frontend.ts +56 -0
- package/packages/host/src/index.ts +9 -0
- package/packages/hyperframes/README.md +69 -0
- package/packages/hyperframes/package.json +36 -0
- package/packages/hyperframes/src/activation.ts +8 -0
- package/packages/hyperframes/src/browser-program.ts +79 -0
- package/packages/hyperframes/src/component.ts +32 -0
- package/packages/hyperframes/src/document.ts +827 -0
- package/packages/hyperframes/src/fragment.ts +32 -0
- package/packages/hyperframes/src/index.ts +13 -0
- package/packages/hyperframes/src/manifest.ts +67 -0
- package/packages/hyperframes/src/project.ts +118 -0
- package/packages/hyperframes/src/text.ts +1179 -0
- package/packages/hyperframes/src/types.ts +38 -0
- package/packages/image-compose/README.md +25 -0
- package/packages/image-compose/package.json +18 -0
- package/packages/image-compose/src/activation.ts +21 -0
- package/packages/image-compose/src/component.ts +100 -0
- package/packages/image-compose/src/fragment.ts +54 -0
- package/packages/image-compose/src/index.ts +10 -0
- package/packages/image-compose/src/manifest.ts +119 -0
- package/packages/image-compose/src/program.ts +75 -0
- package/packages/image-compose/src/surface.ts +83 -0
- package/packages/image-compose/src/types.ts +22 -0
- package/packages/image-transform/README.md +29 -0
- package/packages/image-transform/package.json +21 -0
- package/packages/image-transform/src/activation.ts +33 -0
- package/packages/image-transform/src/component.ts +67 -0
- package/packages/image-transform/src/fragment.ts +25 -0
- package/packages/image-transform/src/index.ts +13 -0
- package/packages/image-transform/src/manifest.ts +209 -0
- package/packages/image-transform/src/program.ts +23 -0
- package/packages/image-transform/src/surface.ts +216 -0
- package/packages/image-transform/src/types.ts +20 -0
- package/packages/interview-emoji-reveal/README.md +39 -0
- package/packages/interview-emoji-reveal/package.json +23 -0
- package/packages/interview-emoji-reveal/preview/Track.png +0 -0
- package/packages/interview-emoji-reveal/src/activation.ts +14 -0
- package/packages/interview-emoji-reveal/src/component.ts +45 -0
- package/packages/interview-emoji-reveal/src/fragment.ts +62 -0
- package/packages/interview-emoji-reveal/src/index.ts +16 -0
- package/packages/interview-emoji-reveal/src/manifest.ts +174 -0
- package/packages/interview-emoji-reveal/src/program.ts +242 -0
- package/packages/interview-emoji-reveal/src/style.ts +47 -0
- package/packages/interview-emoji-reveal/src/surface.ts +110 -0
- package/packages/interview-emoji-reveal/src/types.ts +52 -0
- package/packages/markup/README.md +81 -0
- package/packages/markup/package.json +16 -0
- package/packages/markup/src/element.ts +39 -0
- package/packages/markup/src/error.ts +20 -0
- package/packages/markup/src/frontend.ts +518 -0
- package/packages/markup/src/host-facet.ts +115 -0
- package/packages/markup/src/index.ts +25 -0
- package/packages/markup/src/registry.ts +83 -0
- package/packages/markup/src/syntax.ts +271 -0
- package/packages/markup/src/types.ts +246 -0
- package/packages/media/README.md +37 -0
- package/packages/media/package.json +19 -0
- package/packages/media/src/activation.ts +38 -0
- package/packages/media/src/component.ts +16 -0
- package/packages/media/src/frame-range.ts +33 -0
- package/packages/media/src/identity.ts +227 -0
- package/packages/media/src/index.ts +15 -0
- package/packages/media/src/manifest.ts +122 -0
- package/packages/media/src/render.ts +140 -0
- package/packages/media/src/schema.ts +69 -0
- package/packages/media/src/surface.ts +150 -0
- package/packages/media/src/types.ts +121 -0
- package/packages/media-execution/README.md +28 -0
- package/packages/media-execution/package.json +17 -0
- package/packages/media-execution/src/execute.ts +1322 -0
- package/packages/media-execution/src/index.ts +16 -0
- package/packages/media-execution/src/probe.ts +315 -0
- package/packages/media-execution/src/surface.ts +286 -0
- package/packages/media-execution/src/toolchain.ts +81 -0
- package/packages/media-execution/src/webp.ts +200 -0
- package/packages/media-pipeline/README.md +113 -0
- package/packages/media-pipeline/package.json +27 -0
- package/packages/media-pipeline/src/activation.ts +47 -0
- package/packages/media-pipeline/src/audio-plan.ts +113 -0
- package/packages/media-pipeline/src/component.ts +373 -0
- package/packages/media-pipeline/src/fragment.ts +167 -0
- package/packages/media-pipeline/src/index.ts +46 -0
- package/packages/media-pipeline/src/manifest.ts +653 -0
- package/packages/media-pipeline/src/operations.ts +248 -0
- package/packages/media-pipeline/src/selection.ts +110 -0
- package/packages/media-pipeline/src/surface.ts +389 -0
- package/packages/media-pipeline/src/types.ts +175 -0
- package/packages/media-track/README.md +197 -0
- package/packages/media-track/package.json +29 -0
- package/packages/media-track/preview/Track.png +0 -0
- package/packages/media-track/preview/build.svrun +5 -0
- package/packages/media-track/preview/flush.png +0 -0
- package/packages/media-track/preview/preview.svml +47 -0
- package/packages/media-track/preview/recipes.svs +23 -0
- package/packages/media-track/preview/rounded.png +0 -0
- package/packages/media-track/src/activation.ts +20 -0
- package/packages/media-track/src/author.ts +317 -0
- package/packages/media-track/src/component.ts +162 -0
- package/packages/media-track/src/fragment.ts +57 -0
- package/packages/media-track/src/index.ts +65 -0
- package/packages/media-track/src/layers.ts +308 -0
- package/packages/media-track/src/lower.ts +335 -0
- package/packages/media-track/src/manifest.ts +624 -0
- package/packages/media-track/src/motion.ts +387 -0
- package/packages/media-track/src/performance.ts +37 -0
- package/packages/media-track/src/presentation.ts +35 -0
- package/packages/media-track/src/program.ts +565 -0
- package/packages/media-track/src/sampling.ts +118 -0
- package/packages/media-track/src/sequence.ts +403 -0
- package/packages/media-track/src/sounds.ts +71 -0
- package/packages/media-track/src/surface.ts +668 -0
- package/packages/media-track/src/types.ts +311 -0
- package/packages/media-track-studio/README.md +3 -0
- package/packages/media-track-studio/package.json +15 -0
- package/packages/media-track-studio/src/activation.ts +7 -0
- package/packages/media-track-studio/src/index.ts +235 -0
- package/packages/mimo-speech/README.md +33 -0
- package/packages/mimo-speech/package.json +21 -0
- package/packages/mimo-speech/src/activation.ts +32 -0
- package/packages/mimo-speech/src/fragment.ts +11 -0
- package/packages/mimo-speech/src/index.ts +160 -0
- package/packages/mimo-speech/src/surface.ts +193 -0
- package/packages/minimax-h3/README.md +21 -0
- package/packages/minimax-h3/package.json +21 -0
- package/packages/minimax-h3/src/activation.ts +14 -0
- package/packages/minimax-h3/src/index.ts +188 -0
- package/packages/minimax-h3/src/surface.ts +87 -0
- package/packages/model-kit/README.md +52 -0
- package/packages/model-kit/package.json +19 -0
- package/packages/model-kit/src/index.ts +728 -0
- package/packages/nano-banana/README.md +23 -0
- package/packages/nano-banana/package.json +21 -0
- package/packages/nano-banana/src/activation.ts +14 -0
- package/packages/nano-banana/src/index.ts +172 -0
- package/packages/nano-banana/src/surface.ts +120 -0
- package/packages/narrative/README.md +7 -0
- package/packages/narrative/package.json +17 -0
- package/packages/narrative/src/activation.ts +7 -0
- package/packages/narrative/src/component.ts +33 -0
- package/packages/narrative/src/identity.ts +131 -0
- package/packages/narrative/src/index.ts +11 -0
- package/packages/narrative/src/manifest.ts +30 -0
- package/packages/narrative/src/schema.ts +89 -0
- package/packages/narrative/src/types.ts +141 -0
- package/packages/package-loader-node/README.md +23 -0
- package/packages/package-loader-node/package.json +15 -0
- package/packages/package-loader-node/src/contribution.ts +97 -0
- package/packages/package-loader-node/src/distribution-resolution.ts +146 -0
- package/packages/package-loader-node/src/index.ts +27 -0
- package/packages/package-loader-node/src/loader.ts +301 -0
- package/packages/package-loader-node/src/location.ts +279 -0
- package/packages/package-loader-node/src/types.ts +60 -0
- package/packages/program-space/README.md +20 -0
- package/packages/program-space/package.json +17 -0
- package/packages/program-space/src/activation.ts +19 -0
- package/packages/program-space/src/index.ts +107 -0
- package/packages/program-space/src/surface.ts +55 -0
- package/packages/protocol/README.md +11 -0
- package/packages/protocol/package.json +10 -0
- package/packages/protocol/src/build-id.ts +52 -0
- package/packages/protocol/src/build.ts +265 -0
- package/packages/protocol/src/canonical.ts +37 -0
- package/packages/protocol/src/error.ts +11 -0
- package/packages/protocol/src/identity.ts +59 -0
- package/packages/protocol/src/index.ts +9 -0
- package/packages/protocol/src/module.ts +67 -0
- package/packages/protocol/src/value.ts +88 -0
- package/packages/provider-hyperframes-aws-lambda/README.md +30 -0
- package/packages/provider-hyperframes-aws-lambda/package.json +30 -0
- package/packages/provider-hyperframes-aws-lambda/src/activation.ts +97 -0
- package/packages/provider-hyperframes-aws-lambda/src/client.ts +114 -0
- package/packages/provider-hyperframes-aws-lambda/src/index.ts +21 -0
- package/packages/provider-hyperframes-aws-lambda/src/provider.ts +522 -0
- package/packages/provider-hyperframes-local/README.md +129 -0
- package/packages/provider-hyperframes-local/package.json +34 -0
- package/packages/provider-hyperframes-local/src/activation.ts +107 -0
- package/packages/provider-hyperframes-local/src/capture-process.ts +110 -0
- package/packages/provider-hyperframes-local/src/capture-worker.ts +17 -0
- package/packages/provider-hyperframes-local/src/capture.ts +184 -0
- package/packages/provider-hyperframes-local/src/index.ts +10 -0
- package/packages/provider-hyperframes-local/src/options.ts +19 -0
- package/packages/provider-hyperframes-local/src/output.ts +73 -0
- package/packages/provider-hyperframes-local/src/process.ts +83 -0
- package/packages/provider-hyperframes-local/src/program.ts +58 -0
- package/packages/provider-hyperframes-local/src/provider.ts +62 -0
- package/packages/provider-hyperframes-local/src/render.ts +114 -0
- package/packages/provider-hyperframes-local/src/sampling.ts +89 -0
- package/packages/provider-hypihub/README.md +143 -0
- package/packages/provider-hypihub/package.json +26 -0
- package/packages/provider-hypihub/src/activation.ts +91 -0
- package/packages/provider-hypihub/src/index.ts +2 -0
- package/packages/provider-hypihub/src/mapping.ts +145 -0
- package/packages/provider-hypihub/src/oauth.ts +113 -0
- package/packages/provider-hypihub/src/provider.ts +566 -0
- package/packages/provider-hypihub/src/routes.ts +134 -0
- package/packages/provider-hypihub/src/upload.ts +402 -0
- package/packages/provider-image-opencv-local/README.md +16 -0
- package/packages/provider-image-opencv-local/package.json +27 -0
- package/packages/provider-image-opencv-local/runtime/raster_execute.py +299 -0
- package/packages/provider-image-opencv-local/src/activation.ts +61 -0
- package/packages/provider-image-opencv-local/src/deployment.ts +68 -0
- package/packages/provider-image-opencv-local/src/index.ts +2 -0
- package/packages/provider-image-opencv-local/src/program.ts +60 -0
- package/packages/provider-image-opencv-local/src/provider.ts +155 -0
- package/packages/provider-kie/README.md +134 -0
- package/packages/provider-kie/package.json +43 -0
- package/packages/provider-kie/src/activation.ts +71 -0
- package/packages/provider-kie/src/index.ts +10 -0
- package/packages/provider-kie/src/mapping.ts +182 -0
- package/packages/provider-kie/src/provider.ts +657 -0
- package/packages/provider-kie/src/routes.ts +150 -0
- package/packages/provider-media-local/README.md +58 -0
- package/packages/provider-media-local/package.json +28 -0
- package/packages/provider-media-local/src/activation.ts +65 -0
- package/packages/provider-media-local/src/index.ts +2 -0
- package/packages/provider-media-local/src/program.ts +19 -0
- package/packages/provider-media-local/src/provider.ts +150 -0
- package/packages/provider-whisperx-local/README.md +44 -0
- package/packages/provider-whisperx-local/package.json +27 -0
- package/packages/provider-whisperx-local/src/activation.ts +93 -0
- package/packages/provider-whisperx-local/src/index.ts +5 -0
- package/packages/provider-whisperx-local/src/program.ts +157 -0
- package/packages/provider-whisperx-local/src/provider.ts +191 -0
- package/packages/provider-xiaomi-mimo/README.md +32 -0
- package/packages/provider-xiaomi-mimo/package.json +24 -0
- package/packages/provider-xiaomi-mimo/src/activation.ts +57 -0
- package/packages/provider-xiaomi-mimo/src/index.ts +5 -0
- package/packages/provider-xiaomi-mimo/src/provider.ts +214 -0
- package/packages/ranking/README.md +67 -0
- package/packages/ranking/package.json +33 -0
- package/packages/ranking/preview/Column.svg +29 -0
- package/packages/ranking/preview/TierBoard.png +0 -0
- package/packages/ranking/preview/TierBoard.svg +36 -0
- package/packages/ranking/preview/TopThree.png +0 -0
- package/packages/ranking/src/activation.ts +38 -0
- package/packages/ranking/src/component.ts +271 -0
- package/packages/ranking/src/fragment.ts +206 -0
- package/packages/ranking/src/index.ts +26 -0
- package/packages/ranking/src/manifest.ts +807 -0
- package/packages/ranking/src/render.ts +698 -0
- package/packages/ranking/src/schedule.ts +895 -0
- package/packages/ranking/src/style.ts +272 -0
- package/packages/ranking/src/surface.ts +322 -0
- package/packages/ranking/src/tier.ts +176 -0
- package/packages/ranking/src/types.ts +277 -0
- package/packages/ranking-studio/README.md +3 -0
- package/packages/ranking-studio/package.json +14 -0
- package/packages/ranking-studio/src/activation.ts +7 -0
- package/packages/ranking-studio/src/index.ts +255 -0
- package/packages/raster/README.md +7 -0
- package/packages/raster/package.json +14 -0
- package/packages/raster/src/activation.ts +7 -0
- package/packages/raster/src/index.ts +7 -0
- package/packages/raster/src/manifest.ts +14 -0
- package/packages/raster/src/program.ts +128 -0
- package/packages/raster/src/schema.ts +53 -0
- package/packages/raster/src/types.ts +61 -0
- package/packages/render-hyperframes/README.md +58 -0
- package/packages/render-hyperframes/package.json +33 -0
- package/packages/render-hyperframes/src/activation.ts +18 -0
- package/packages/render-hyperframes/src/component.ts +37 -0
- package/packages/render-hyperframes/src/fragment.ts +73 -0
- package/packages/render-hyperframes/src/index.ts +6 -0
- package/packages/render-hyperframes/src/manifest.ts +100 -0
- package/packages/render-hyperframes/src/product.ts +29 -0
- package/packages/render-hyperframes/src/surface.ts +65 -0
- package/packages/resource-store-fs/README.md +13 -0
- package/packages/resource-store-fs/package.json +14 -0
- package/packages/resource-store-fs/src/index.ts +2 -0
- package/packages/resource-store-fs/src/store.ts +154 -0
- package/packages/resource-store-s3/README.md +15 -0
- package/packages/resource-store-s3/package.json +15 -0
- package/packages/resource-store-s3/src/client.ts +138 -0
- package/packages/resource-store-s3/src/index.ts +10 -0
- package/packages/resource-store-s3/src/store.ts +258 -0
- package/packages/run/README.md +23 -0
- package/packages/run/package.json +16 -0
- package/packages/run/src/candidate.ts +33 -0
- package/packages/run/src/facet.ts +59 -0
- package/packages/run/src/frontend-facet.ts +23 -0
- package/packages/run/src/frontend.ts +62 -0
- package/packages/run/src/graph.ts +65 -0
- package/packages/run/src/index.ts +33 -0
- package/packages/run/src/registry.ts +24 -0
- package/packages/run/src/resolve.ts +213 -0
- package/packages/run/src/types.ts +147 -0
- package/packages/run-markup/README.md +60 -0
- package/packages/run-markup/package.json +22 -0
- package/packages/run-markup/src/activation.ts +10 -0
- package/packages/run-markup/src/frontend.ts +16 -0
- package/packages/run-markup/src/index.ts +5 -0
- package/packages/run-markup/src/syntax.ts +304 -0
- package/packages/runtime/README.md +39 -0
- package/packages/runtime/package.json +15 -0
- package/packages/runtime/src/capacity.ts +51 -0
- package/packages/runtime/src/catalog.ts +30 -0
- package/packages/runtime/src/credentials.ts +124 -0
- package/packages/runtime/src/environment.ts +6 -0
- package/packages/runtime/src/execution.ts +125 -0
- package/packages/runtime/src/index.ts +24 -0
- package/packages/runtime/src/operations.ts +99 -0
- package/packages/runtime/src/scheduler.ts +281 -0
- package/packages/runtime/src/submission.ts +24 -0
- package/packages/runtime/src/types.ts +157 -0
- package/packages/runtime-host-node/README.md +25 -0
- package/packages/runtime-host-node/package.json +19 -0
- package/packages/runtime-host-node/src/index.ts +421 -0
- package/packages/runtime-host-node/src/packages.ts +158 -0
- package/packages/runtime-kit/README.md +42 -0
- package/packages/runtime-kit/package.json +16 -0
- package/packages/runtime-kit/src/index.ts +307 -0
- package/packages/runtime-kit/src/request-deadline.ts +17 -0
- package/packages/runtime-local/README.md +119 -0
- package/packages/runtime-local/package.json +33 -0
- package/packages/runtime-local/src/actions.ts +20 -0
- package/packages/runtime-local/src/config.ts +1229 -0
- package/packages/runtime-local/src/control.ts +120 -0
- package/packages/runtime-local/src/credentials.ts +61 -0
- package/packages/runtime-local/src/host.ts +174 -0
- package/packages/runtime-local/src/index.ts +36 -0
- package/packages/runtime-local/src/process-control.ts +59 -0
- package/packages/runtime-local/src/process-logs.ts +33 -0
- package/packages/runtime-local/src/programs.ts +441 -0
- package/packages/runtime-local/src/result-writer.ts +246 -0
- package/packages/runtime-local/src/runtime.ts +342 -0
- package/packages/runtime-local/src/types.ts +100 -0
- package/packages/runtime-local/src/worker-process.ts +343 -0
- package/packages/runtime-local/src/worker.ts +449 -0
- package/packages/screen-overlay/README.md +17 -0
- package/packages/screen-overlay/package.json +31 -0
- package/packages/screen-overlay/preview/Track.png +0 -0
- package/packages/screen-overlay/src/activation.ts +15 -0
- package/packages/screen-overlay/src/component.ts +20 -0
- package/packages/screen-overlay/src/fragment.ts +40 -0
- package/packages/screen-overlay/src/index.ts +7 -0
- package/packages/screen-overlay/src/manifest.ts +305 -0
- package/packages/screen-overlay/src/program.ts +321 -0
- package/packages/screen-overlay/src/surface.ts +90 -0
- package/packages/screen-overlay/src/types.ts +69 -0
- package/packages/screen-overlay-studio/README.md +3 -0
- package/packages/screen-overlay-studio/package.json +14 -0
- package/packages/screen-overlay-studio/src/activation.ts +7 -0
- package/packages/screen-overlay-studio/src/index.ts +80 -0
- package/packages/script/README.md +137 -0
- package/packages/script/package.json +22 -0
- package/packages/script/src/activation.ts +20 -0
- package/packages/script/src/edit.ts +174 -0
- package/packages/script/src/error.ts +13 -0
- package/packages/script/src/format.ts +83 -0
- package/packages/script/src/index.ts +20 -0
- package/packages/script/src/lexical.ts +133 -0
- package/packages/script/src/manifest.ts +95 -0
- package/packages/script/src/narrative.ts +232 -0
- package/packages/script/src/parser.ts +850 -0
- package/packages/script/src/surface.ts +132 -0
- package/packages/script/src/types.ts +125 -0
- package/packages/script-studio/package.json +13 -0
- package/packages/script-studio/src/activation.ts +8 -0
- package/packages/script-studio/src/index.ts +61 -0
- package/packages/seedance/README.md +19 -0
- package/packages/seedance/package.json +22 -0
- package/packages/seedance/src/activation.ts +38 -0
- package/packages/seedance/src/fragment.ts +46 -0
- package/packages/seedance/src/index.ts +329 -0
- package/packages/seedance/src/surface.ts +355 -0
- package/packages/seedance-kits/README.md +153 -0
- package/packages/seedance-kits/kits/broll-v1.svs +52 -0
- package/packages/seedance-kits/kits/call-v1.svs +55 -0
- package/packages/seedance-kits/kits/camera-reference-v1.svs +9 -0
- package/packages/seedance-kits/kits/motion-reference-v1.svs +9 -0
- package/packages/seedance-kits/kits/podcast-v1.svs +55 -0
- package/packages/seedance-kits/kits/speaker-v1.svs +136 -0
- package/packages/seedance-kits/kits/street-interview-v1.svs +49 -0
- package/packages/seedance-kits/package.json +24 -0
- package/packages/seedream/README.md +21 -0
- package/packages/seedream/package.json +21 -0
- package/packages/seedream/src/activation.ts +12 -0
- package/packages/seedream/src/index.ts +162 -0
- package/packages/seedream/src/surface.ts +84 -0
- package/packages/semantic-take-adjust/package.json +21 -0
- package/packages/semantic-take-adjust/src/activation.ts +22 -0
- package/packages/semantic-take-adjust/src/component.ts +31 -0
- package/packages/semantic-take-adjust/src/fragment.ts +24 -0
- package/packages/semantic-take-adjust/src/index.ts +12 -0
- package/packages/semantic-take-adjust/src/manifest.ts +57 -0
- package/packages/semantic-take-adjust/src/program.ts +49 -0
- package/packages/semantic-take-adjust/src/surface.ts +96 -0
- package/packages/semantic-take-adjust/src/types.ts +9 -0
- package/packages/semantic-track/README.md +21 -0
- package/packages/semantic-track/package.json +22 -0
- package/packages/semantic-track/src/activation.ts +8 -0
- package/packages/semantic-track/src/component.ts +24 -0
- package/packages/semantic-track/src/identity.ts +58 -0
- package/packages/semantic-track/src/index.ts +6 -0
- package/packages/semantic-track/src/location.ts +81 -0
- package/packages/semantic-track/src/manifest.ts +38 -0
- package/packages/semantic-track/src/projection.ts +71 -0
- package/packages/semantic-track/src/types.ts +26 -0
- package/packages/source/README.md +13 -0
- package/packages/source/package.json +13 -0
- package/packages/source/src/header.ts +80 -0
- package/packages/source/src/index.ts +17 -0
- package/packages/source/src/unit.ts +38 -0
- package/packages/spatial/README.md +77 -0
- package/packages/spatial/package.json +24 -0
- package/packages/spatial/src/activation.ts +43 -0
- package/packages/spatial/src/author.ts +59 -0
- package/packages/spatial/src/component.ts +45 -0
- package/packages/spatial/src/fragment.ts +36 -0
- package/packages/spatial/src/geometry.ts +238 -0
- package/packages/spatial/src/index.ts +37 -0
- package/packages/spatial/src/manifest.ts +341 -0
- package/packages/spatial/src/region-timeline.ts +69 -0
- package/packages/spatial/src/schema.ts +47 -0
- package/packages/spatial/src/surface.ts +319 -0
- package/packages/spatial/src/types.ts +101 -0
- package/packages/speech/README.md +16 -0
- package/packages/speech/package.json +19 -0
- package/packages/speech/src/activation.ts +7 -0
- package/packages/speech/src/component.ts +43 -0
- package/packages/speech/src/identity.ts +73 -0
- package/packages/speech/src/index.ts +6 -0
- package/packages/speech/src/manifest.ts +30 -0
- package/packages/speech/src/materialize.ts +103 -0
- package/packages/speech/src/schema.ts +42 -0
- package/packages/speech/src/types.ts +54 -0
- package/packages/speech-alignment/README.md +29 -0
- package/packages/speech-alignment/package.json +25 -0
- package/packages/speech-alignment/src/activation.ts +8 -0
- package/packages/speech-alignment/src/align.ts +235 -0
- package/packages/speech-alignment/src/component.ts +37 -0
- package/packages/speech-alignment/src/error.ts +9 -0
- package/packages/speech-alignment/src/index.ts +7 -0
- package/packages/speech-alignment/src/local.ts +64 -0
- package/packages/speech-alignment/src/locate.ts +473 -0
- package/packages/speech-alignment/src/manifest.ts +37 -0
- package/packages/speech-alignment/src/normalize.ts +79 -0
- package/packages/speech-alignment/src/types.ts +30 -0
- package/packages/speech-evidence/README.md +3 -0
- package/packages/speech-evidence/package.json +16 -0
- package/packages/speech-evidence/src/activation.ts +3 -0
- package/packages/speech-evidence/src/index.ts +102 -0
- package/packages/speech-track/README.md +51 -0
- package/packages/speech-track/package.json +28 -0
- package/packages/speech-track/preview/Track.png +0 -0
- package/packages/speech-track/src/activation.ts +19 -0
- package/packages/speech-track/src/component.ts +45 -0
- package/packages/speech-track/src/fragment.ts +74 -0
- package/packages/speech-track/src/index.ts +7 -0
- package/packages/speech-track/src/manifest.ts +73 -0
- package/packages/speech-track/src/program.ts +64 -0
- package/packages/speech-track/src/surface.ts +35 -0
- package/packages/speech-track/src/types.ts +6 -0
- package/packages/speech-track-studio/README.md +3 -0
- package/packages/speech-track-studio/package.json +14 -0
- package/packages/speech-track-studio/src/activation.ts +7 -0
- package/packages/speech-track-studio/src/index.ts +40 -0
- package/packages/store-sqlite/README.md +14 -0
- package/packages/store-sqlite/package.json +18 -0
- package/packages/store-sqlite/src/index.ts +2 -0
- package/packages/store-sqlite/src/store.ts +1101 -0
- package/packages/studio/README.md +125 -0
- package/packages/studio/index.html +10 -0
- package/packages/studio/package.json +50 -0
- package/packages/studio/src/build-library.ts +281 -0
- package/packages/studio/src/companion-assembly.ts +39 -0
- package/packages/studio/src/compile.ts +166 -0
- package/packages/studio/src/domain.ts +139 -0
- package/packages/studio/src/execute.ts +57 -0
- package/packages/studio/src/fallback-companions.ts +98 -0
- package/packages/studio/src/observe.ts +202 -0
- package/packages/studio/src/parameter-values.ts +81 -0
- package/packages/studio/src/parameters.ts +550 -0
- package/packages/studio/src/preview/render.ts +51 -0
- package/packages/studio/src/preview/runtime-shim.ts +184 -0
- package/packages/studio/src/programme.ts +276 -0
- package/packages/studio/src/run.ts +85 -0
- package/packages/studio/src/server.ts +725 -0
- package/packages/studio/src/session.ts +111 -0
- package/packages/studio/src/shared.ts +315 -0
- package/packages/studio/src/snapshot.ts +454 -0
- package/packages/studio/src/source-transaction.ts +57 -0
- package/packages/studio/src/storyboard.ts +133 -0
- package/packages/studio/src/studio-preflight.ts +198 -0
- package/packages/studio/src/studio-registry.ts +406 -0
- package/packages/studio/src/studio-trace.ts +136 -0
- package/packages/studio/src/style.css +1525 -0
- package/packages/studio/src/surface-preview.ts +35 -0
- package/packages/studio/src/temporal-graph.ts +227 -0
- package/packages/studio/src/ui/code.ts +450 -0
- package/packages/studio/src/ui/icons.ts +51 -0
- package/packages/studio/src/ui/library.ts +378 -0
- package/packages/studio/src/ui/main.ts +1001 -0
- package/packages/studio/src/ui/markers.ts +152 -0
- package/packages/studio/src/ui/material-preview.ts +176 -0
- package/packages/studio/src/ui/overlay.ts +144 -0
- package/packages/studio/src/ui/resize.ts +74 -0
- package/packages/studio/src/ui/selection.ts +178 -0
- package/packages/studio/src/ui/stage.ts +231 -0
- package/packages/studio/src/ui/syntax.ts +195 -0
- package/packages/studio/src/ui/timeline.ts +1041 -0
- package/packages/studio/src/ui/writeback.ts +10 -0
- package/packages/studio/src/ui/zoom.ts +129 -0
- package/packages/studio/start.ts +143 -0
- package/packages/studio-adapter/README.md +186 -0
- package/packages/studio-adapter/package.json +14 -0
- package/packages/studio-adapter/src/index.ts +850 -0
- package/packages/svs/README.md +37 -0
- package/packages/svs/package.json +21 -0
- package/packages/svs/src/activation.ts +11 -0
- package/packages/svs/src/format.ts +16 -0
- package/packages/svs/src/frontend.ts +33 -0
- package/packages/svs/src/index.ts +5 -0
- package/packages/svs/src/manifest.ts +17 -0
- package/packages/svs/src/parser.ts +279 -0
- package/packages/svs/src/types.ts +26 -0
- package/packages/temporal/README.md +31 -0
- package/packages/temporal/package.json +20 -0
- package/packages/temporal/src/activation.ts +9 -0
- package/packages/temporal/src/component.ts +68 -0
- package/packages/temporal/src/index.ts +110 -0
- package/packages/temporal/src/location.ts +67 -0
- package/packages/temporal/src/projection.ts +280 -0
- package/packages/temporal/src/rational.ts +80 -0
- package/packages/temporal/src/sample.ts +43 -0
- package/packages/temporal/src/schedule.ts +52 -0
- package/packages/temporal/src/types.ts +124 -0
- package/packages/temporal-markup/README.md +75 -0
- package/packages/temporal-markup/package.json +18 -0
- package/packages/temporal-markup/src/index.ts +537 -0
- package/packages/temporal-markup/src/space.ts +59 -0
- package/packages/text/README.md +59 -0
- package/packages/text/package.json +21 -0
- package/packages/text/src/activation.ts +33 -0
- package/packages/text/src/component.ts +72 -0
- package/packages/text/src/fragment.ts +57 -0
- package/packages/text/src/frontend.ts +39 -0
- package/packages/text/src/index.ts +27 -0
- package/packages/text/src/manifest.ts +170 -0
- package/packages/text/src/program.ts +418 -0
- package/packages/text/src/surface.ts +212 -0
- package/packages/text/src/svs.ts +189 -0
- package/packages/text/src/types.ts +82 -0
- package/packages/transport-aws-lambda/README.md +20 -0
- package/packages/transport-aws-lambda/package.json +14 -0
- package/packages/transport-aws-lambda/src/index.ts +131 -0
- package/packages/typography-track/README.md +50 -0
- package/packages/typography-track/package.json +34 -0
- package/packages/typography-track/preview/Mask.png +0 -0
- package/packages/typography-track/preview/Track.png +0 -0
- package/packages/typography-track/src/activation.ts +36 -0
- package/packages/typography-track/src/component.ts +93 -0
- package/packages/typography-track/src/fragment.ts +30 -0
- package/packages/typography-track/src/index.ts +11 -0
- package/packages/typography-track/src/manifest.ts +556 -0
- package/packages/typography-track/src/program.ts +622 -0
- package/packages/typography-track/src/surface.ts +842 -0
- package/packages/typography-track/src/types.ts +109 -0
- package/packages/typography-track-studio/README.md +3 -0
- package/packages/typography-track-studio/package.json +14 -0
- package/packages/typography-track-studio/src/activation.ts +7 -0
- package/packages/typography-track-studio/src/index.ts +116 -0
- package/packages/validation/README.md +11 -0
- package/packages/validation/package.json +15 -0
- package/packages/validation/src/index.ts +100 -0
- package/packages/video-cli/README.md +181 -0
- package/packages/video-cli/package.json +37 -0
- package/packages/video-cli/src/capture.ts +174 -0
- package/packages/video-cli/src/cli.ts +109 -0
- package/packages/video-cli/src/compiler.ts +32 -0
- package/packages/video-cli/src/creation.ts +449 -0
- package/packages/video-cli/src/distribution.ts +88 -0
- package/packages/video-cli/src/index.ts +50 -0
- package/packages/video-cli/src/media.ts +701 -0
- package/packages/video-cli/src/package-selection.ts +34 -0
- package/packages/video-cli/src/process.ts +71 -0
- package/packages/video-cli/src/studio-distribution.ts +19 -0
- package/packages/video-cli/src/transcript.ts +71 -0
- package/packages/video-cli/src/vocabulary.ts +386 -0
- package/packages/visual-ir/README.md +36 -0
- package/packages/visual-ir/package.json +16 -0
- package/packages/visual-ir/src/activation.ts +3 -0
- package/packages/visual-ir/src/index.ts +7 -0
- package/packages/visual-ir/src/style.ts +222 -0
- package/packages/volcengine-matting/README.md +89 -0
- package/packages/volcengine-matting/package.json +16 -0
- package/packages/volcengine-matting/src/activation.ts +13 -0
- package/packages/volcengine-matting/src/index.ts +45 -0
- package/packages/volcengine-matting/src/surface.ts +48 -0
- package/packages/whisperx/README.md +34 -0
- package/packages/whisperx/package.json +28 -0
- package/packages/whisperx/src/activation.ts +18 -0
- package/packages/whisperx/src/component.ts +64 -0
- package/packages/whisperx/src/evidence.ts +69 -0
- package/packages/whisperx/src/fragment.ts +76 -0
- package/packages/whisperx/src/index.ts +14 -0
- package/packages/whisperx/src/manifest.ts +92 -0
- package/packages/whisperx/src/surface.ts +90 -0
- package/packages/whisperx/src/transcript.ts +97 -0
- package/packages/whisperx/src/types.ts +9 -0
- package/packages/workspace/README.md +4 -0
- package/packages/workspace/package.json +14 -0
- package/packages/workspace/src/index.ts +38 -0
- package/packages/workspace-fs-node/README.md +13 -0
- package/packages/workspace-fs-node/package.json +15 -0
- package/packages/workspace-fs-node/src/index.ts +6 -0
- package/packages/workspace-fs-node/src/workspace.ts +226 -0
- package/packages/yt-dlp/README.md +31 -0
- package/packages/yt-dlp/package.json +10 -0
- package/packages/yt-dlp/src/download.ts +104 -0
- package/packages/yt-dlp/src/index.ts +1 -0
- package/services/image-opencv/README.md +33 -0
- package/services/image-opencv/package.json +14 -0
- package/services/image-opencv/pyproject.toml +13 -0
- package/services/image-opencv/uv.lock +56 -0
- package/services/whisperx/README.md +82 -0
- package/services/whisperx/package.json +15 -0
- package/services/whisperx/pyproject.toml +26 -0
- package/services/whisperx/src/hypit_whisperx_service/__init__.py +6 -0
- package/services/whisperx/src/hypit_whisperx_service/__main__.py +29 -0
- package/services/whisperx/src/hypit_whisperx_service/application.py +88 -0
- package/services/whisperx/src/hypit_whisperx_service/audio.py +66 -0
- package/services/whisperx/src/hypit_whisperx_service/check.py +35 -0
- package/services/whisperx/src/hypit_whisperx_service/config.py +81 -0
- package/services/whisperx/src/hypit_whisperx_service/engine.py +173 -0
- package/services/whisperx/src/hypit_whisperx_service/prepare.py +19 -0
- package/services/whisperx/src/hypit_whisperx_service/resources.py +41 -0
- package/services/whisperx/src/hypit_whisperx_service/server.py +101 -0
- package/services/whisperx/uv.lock +3381 -0
- package/services/yt-dlp/README.md +19 -0
- package/services/yt-dlp/package.json +14 -0
- package/services/yt-dlp/pyproject.toml +13 -0
- package/services/yt-dlp/uv.lock +23 -0
- package/index.js +0 -1
|
@@ -0,0 +1,827 @@
|
|
|
1
|
+
import { assertCompositableSurfaceRef } from "@hypit/media";
|
|
2
|
+
import type { CompositableSurfaceRef, FontArtifactRef } from "@hypit/media";
|
|
3
|
+
import { programSpaceFrameCount } from "@hypit/program-space";
|
|
4
|
+
import type { ProgramSpace } from "@hypit/program-space";
|
|
5
|
+
import { assertCompositionIdentity } from "@hypit/composition";
|
|
6
|
+
import type {
|
|
7
|
+
Composition,
|
|
8
|
+
Track,
|
|
9
|
+
VisualAnimation,
|
|
10
|
+
VisualAttribute,
|
|
11
|
+
VisualElement,
|
|
12
|
+
VisualPresent,
|
|
13
|
+
VisualSamplingRational,
|
|
14
|
+
VisualSamplingSegment,
|
|
15
|
+
VisualStyleDeclaration,
|
|
16
|
+
VisualTrack,
|
|
17
|
+
} from "@hypit/composition";
|
|
18
|
+
import { canonicalStringify, isResourceId } from "@hypit/protocol";
|
|
19
|
+
import type { BlobRef, ResourceId } from "@hypit/protocol";
|
|
20
|
+
import { VISUAL_IR_V1 } from "@hypit/visual-ir";
|
|
21
|
+
import { readBrowserProgram, browserProgramHtml, browserProgramScript } from "./browser-program.js";
|
|
22
|
+
|
|
23
|
+
import type {
|
|
24
|
+
ResourceUrlResolver,
|
|
25
|
+
HyperframesDocument,
|
|
26
|
+
HyperframesFrameSpan,
|
|
27
|
+
} from "./types.js";
|
|
28
|
+
import {
|
|
29
|
+
collectTerminalTextFonts,
|
|
30
|
+
renderGlyphPaintedString,
|
|
31
|
+
renderTerminalTextElement,
|
|
32
|
+
terminalTextLayoutScript,
|
|
33
|
+
} from "./text.js";
|
|
34
|
+
|
|
35
|
+
const NANOSECONDS = 1_000_000_000n;
|
|
36
|
+
const RESOURCE_URI = /hypit-resource:\/\/(res_[a-zA-Z0-9._:-]+)/gu;
|
|
37
|
+
const SURFACE_RESOURCE = /data-hypit-surface-resource="(res_[a-zA-Z0-9._:-]+)"/gu;
|
|
38
|
+
|
|
39
|
+
function escapeHtml(value: string): string {
|
|
40
|
+
return value
|
|
41
|
+
.replaceAll("&", "&")
|
|
42
|
+
.replaceAll("<", "<")
|
|
43
|
+
.replaceAll(">", ">")
|
|
44
|
+
.replaceAll('"', """)
|
|
45
|
+
.replaceAll("'", "'");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function frameSeconds(frame: number, numerator: number, denominator: number): string {
|
|
49
|
+
const nanos = BigInt(frame) * BigInt(denominator) * NANOSECONDS / BigInt(numerator);
|
|
50
|
+
const whole = nanos / NANOSECONDS;
|
|
51
|
+
const remainder = nanos % NANOSECONDS;
|
|
52
|
+
if (remainder === 0n) return String(whole);
|
|
53
|
+
return `${whole}.${String(remainder).padStart(9, "0").replace(/0+$/u, "")}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function fpsDecimal(numerator: number, denominator: number): string {
|
|
57
|
+
const scale = 1_000_000_000_000n;
|
|
58
|
+
const scaled = BigInt(numerator) * scale / BigInt(denominator);
|
|
59
|
+
const whole = scaled / scale;
|
|
60
|
+
const remainder = scaled % scale;
|
|
61
|
+
if (remainder === 0n) return String(whole);
|
|
62
|
+
return `${whole}.${String(remainder).padStart(12, "0").replace(/0+$/u, "")}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function fpsRational(numerator: number, denominator: number): string {
|
|
66
|
+
return denominator === 1 ? String(numerator) : `${numerator}/${denominator}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function rationalDecimal(numerator: bigint, denominator: bigint): string {
|
|
70
|
+
if (denominator <= 0n) throw new Error("HyperFrames rational denominator must be positive.");
|
|
71
|
+
const scale = 1_000_000_000_000n;
|
|
72
|
+
const scaled = numerator * scale / denominator;
|
|
73
|
+
const whole = scaled / scale;
|
|
74
|
+
const remainder = scaled % scale;
|
|
75
|
+
if (remainder === 0n) return String(whole);
|
|
76
|
+
return `${whole}.${String(remainder).padStart(12, "0").replace(/0+$/u, "")}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function sourceSeconds(frame: VisualSamplingRational, frameRate: VisualSamplingRational): string {
|
|
80
|
+
return rationalDecimal(
|
|
81
|
+
BigInt(frame.numerator) * BigInt(frameRate.denominator),
|
|
82
|
+
BigInt(frame.denominator) * BigInt(frameRate.numerator),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function sourcePosition(segment: VisualSamplingSegment, offset: number): {
|
|
87
|
+
readonly position: VisualSamplingRational;
|
|
88
|
+
readonly cycle: bigint;
|
|
89
|
+
} {
|
|
90
|
+
const denominator = BigInt(segment.sourceFrame.denominator) * BigInt(segment.rate.denominator);
|
|
91
|
+
const raw = BigInt(segment.sourceFrame.numerator) * BigInt(segment.rate.denominator)
|
|
92
|
+
+ BigInt(offset) * BigInt(segment.rate.numerator) * BigInt(segment.sourceFrame.denominator);
|
|
93
|
+
if (segment.loop === undefined) {
|
|
94
|
+
if (raw < 0n || raw > BigInt(Number.MAX_SAFE_INTEGER) || denominator > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
95
|
+
throw new Error("HyperFrames visual sampling exceeds safe arithmetic.");
|
|
96
|
+
}
|
|
97
|
+
return { position: { numerator: Number(raw), denominator: Number(denominator) }, cycle: 0n };
|
|
98
|
+
}
|
|
99
|
+
const start = BigInt(segment.loop.startFrame) * denominator;
|
|
100
|
+
const length = BigInt(segment.loop.endFrameExclusive - segment.loop.startFrame) * denominator;
|
|
101
|
+
const delta = raw - start;
|
|
102
|
+
const cycle = delta / length;
|
|
103
|
+
const wrapped = ((delta % length) + length) % length;
|
|
104
|
+
const numerator = start + wrapped;
|
|
105
|
+
if (numerator > BigInt(Number.MAX_SAFE_INTEGER) || denominator > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
106
|
+
throw new Error("HyperFrames visual sampling exceeds safe arithmetic.");
|
|
107
|
+
}
|
|
108
|
+
return { position: { numerator: Number(numerator), denominator: Number(denominator) }, cycle };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function samplingRuns(segment: VisualSamplingSegment): Array<{
|
|
112
|
+
readonly startFrame: number;
|
|
113
|
+
readonly endFrameExclusive: number;
|
|
114
|
+
readonly sourceFrame: VisualSamplingRational;
|
|
115
|
+
}> {
|
|
116
|
+
const length = segment.target.endFrameExclusive - segment.target.startFrame;
|
|
117
|
+
const runs: Array<{ startFrame: number; endFrameExclusive: number; sourceFrame: VisualSamplingRational }> = [];
|
|
118
|
+
// HyperFrames and HTMLMediaElement require a positive playback rate. A held
|
|
119
|
+
// visual frame is therefore represented as one independently addressed
|
|
120
|
+
// target-frame clip per Program frame. Every clip starts at the same exact
|
|
121
|
+
// source position; no browser-specific zero-rate behavior is assumed.
|
|
122
|
+
if (segment.rate.numerator === 0) {
|
|
123
|
+
const source = sourcePosition(segment, 0).position;
|
|
124
|
+
for (let offset = 0; offset < length; offset += 1) {
|
|
125
|
+
runs.push({
|
|
126
|
+
startFrame: segment.target.startFrame + offset,
|
|
127
|
+
endFrameExclusive: segment.target.startFrame + offset + 1,
|
|
128
|
+
sourceFrame: source,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return runs;
|
|
132
|
+
}
|
|
133
|
+
let runStart = 0;
|
|
134
|
+
let runSource = sourcePosition(segment, 0);
|
|
135
|
+
for (let offset = 1; offset < length; offset += 1) {
|
|
136
|
+
const next = sourcePosition(segment, offset);
|
|
137
|
+
if (next.cycle !== runSource.cycle) {
|
|
138
|
+
runs.push({
|
|
139
|
+
startFrame: segment.target.startFrame + runStart,
|
|
140
|
+
endFrameExclusive: segment.target.startFrame + offset,
|
|
141
|
+
sourceFrame: runSource.position,
|
|
142
|
+
});
|
|
143
|
+
runStart = offset;
|
|
144
|
+
runSource = next;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
runs.push({
|
|
148
|
+
startFrame: segment.target.startFrame + runStart,
|
|
149
|
+
endFrameExclusive: segment.target.endFrameExclusive,
|
|
150
|
+
sourceFrame: runSource.position,
|
|
151
|
+
});
|
|
152
|
+
return runs;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function sampledPlaybackRate(
|
|
156
|
+
rate: VisualSamplingRational,
|
|
157
|
+
sourceFrameRate: VisualSamplingRational,
|
|
158
|
+
programNumerator: number,
|
|
159
|
+
programDenominator: number,
|
|
160
|
+
): string {
|
|
161
|
+
// Zero-rate segments have already been split into one-frame clips above.
|
|
162
|
+
// Their media clock may advance inside that single frame, while every
|
|
163
|
+
// independently rendered target frame still starts at the exact held source.
|
|
164
|
+
if (rate.numerator === 0) return "1";
|
|
165
|
+
return rationalDecimal(
|
|
166
|
+
BigInt(rate.numerator) * BigInt(programNumerator) * BigInt(sourceFrameRate.denominator),
|
|
167
|
+
BigInt(rate.denominator) * BigInt(programDenominator) * BigInt(sourceFrameRate.numerator),
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function percentage(frame: number, totalFrames: number): string {
|
|
172
|
+
const scale = 1_000_000_000n;
|
|
173
|
+
const scaled = BigInt(frame) * 100n * scale / BigInt(totalFrames);
|
|
174
|
+
const whole = scaled / scale;
|
|
175
|
+
const remainder = scaled % scale;
|
|
176
|
+
if (remainder === 0n) return `${whole}%`;
|
|
177
|
+
return `${whole}.${String(remainder).padStart(9, "0").replace(/0+$/u, "")}%`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function hyperframesResourceUri(resource: ResourceId): string {
|
|
181
|
+
if (!isResourceId(resource)) throw new Error("HyperFrames Resource id is invalid.");
|
|
182
|
+
return `hypit-resource://${resource}`;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function css(style: readonly VisualStyleDeclaration[]): string {
|
|
186
|
+
return style.map(({ name, value }) => `${name}:${String(value)}`).join(";");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function pixelDimension(style: readonly VisualStyleDeclaration[], name: string): number | undefined {
|
|
190
|
+
const value = style.find((declaration) => declaration.name === name)?.value;
|
|
191
|
+
if (typeof value !== "string") return undefined;
|
|
192
|
+
const match = /^(?:0|[1-9][0-9]*(?:\.[0-9]+)?)px$/u.exec(value);
|
|
193
|
+
if (match === null) return undefined;
|
|
194
|
+
const parsed = Number.parseFloat(value.slice(0, -2));
|
|
195
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function attributes(values: readonly VisualAttribute[] | undefined): string {
|
|
199
|
+
return (values ?? []).map(({ name, value }) => ` ${name}="${escapeHtml(value)}"`).join("");
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
type StableDomId = (parts: readonly string[]) => string;
|
|
203
|
+
|
|
204
|
+
/** Allocate short document-local names in first-use order; authored ids stay in data attributes. */
|
|
205
|
+
function createStableDomId(): StableDomId {
|
|
206
|
+
const ids = new Map<string, string>();
|
|
207
|
+
return (parts) => {
|
|
208
|
+
const key = canonicalStringify(parts);
|
|
209
|
+
const existing = ids.get(key);
|
|
210
|
+
if (existing !== undefined) return existing;
|
|
211
|
+
const id = `hypit-${ids.size + 1}`;
|
|
212
|
+
ids.set(key, id);
|
|
213
|
+
return id;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function exactFontFamily(font: FontArtifactRef, stableId: StableDomId): string {
|
|
218
|
+
return stableId(["font", canonicalStringify(font)]);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function exactFontStyle(element: VisualElement, stableId: StableDomId): string[] {
|
|
222
|
+
if (element.kind !== "text") return [];
|
|
223
|
+
const first = element.fonts[0]!;
|
|
224
|
+
return [
|
|
225
|
+
`font-family:${element.fonts.map((font) => exactFontFamily(font, stableId)).join(",")}`,
|
|
226
|
+
`font-weight:${first.weight}`,
|
|
227
|
+
`font-style:${first.style}`,
|
|
228
|
+
"font-synthesis:none",
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function renderElement(
|
|
233
|
+
element: VisualElement,
|
|
234
|
+
children: ReadonlyMap<string, readonly VisualElement[]>,
|
|
235
|
+
context: {
|
|
236
|
+
readonly trackId: string;
|
|
237
|
+
readonly presentId: string;
|
|
238
|
+
readonly presentStart: string;
|
|
239
|
+
readonly presentDuration: string;
|
|
240
|
+
readonly presentDurationFrames: number;
|
|
241
|
+
readonly presentStartFrame: number;
|
|
242
|
+
readonly programNumerator: number;
|
|
243
|
+
readonly programDenominator: number;
|
|
244
|
+
readonly stackIndex: number;
|
|
245
|
+
readonly emittedFilterIds: Set<string>;
|
|
246
|
+
readonly stableId: StableDomId;
|
|
247
|
+
},
|
|
248
|
+
): string {
|
|
249
|
+
const id = context.stableId([context.trackId, context.presentId, element.id]);
|
|
250
|
+
const animationName = element.animation === undefined
|
|
251
|
+
? undefined
|
|
252
|
+
: context.stableId(["animation", context.trackId, context.presentId, element.id]);
|
|
253
|
+
const animationProperties = element.animation === undefined
|
|
254
|
+
? []
|
|
255
|
+
: [...new Set(element.animation.keyframes.flatMap((keyframe) => keyframe.style.map((declaration) => declaration.name)))].sort();
|
|
256
|
+
const animationDurationFrames = element.animation === undefined
|
|
257
|
+
? context.presentDurationFrames
|
|
258
|
+
: Math.max(context.presentDurationFrames, element.animation.keyframes.at(-1)?.atFrame ?? 0);
|
|
259
|
+
const animationDuration = frameSeconds(animationDurationFrames, context.programNumerator, context.programDenominator);
|
|
260
|
+
const inlineStyle = [
|
|
261
|
+
css(element.style),
|
|
262
|
+
...exactFontStyle(element, context.stableId),
|
|
263
|
+
...(animationName === undefined ? [] : [
|
|
264
|
+
`animation-name:${animationName}`,
|
|
265
|
+
`animation-duration:${animationDuration}s`,
|
|
266
|
+
"animation-fill-mode:both",
|
|
267
|
+
// An independently launched render worker may begin at any frame. Keep
|
|
268
|
+
// CSS animations inert from first paint so HyperFrames' exact seek is
|
|
269
|
+
// the only clock; otherwise page-load time leaks into the first frame of
|
|
270
|
+
// each partition before the runtime pauses the animation.
|
|
271
|
+
"animation-play-state:paused",
|
|
272
|
+
"animation-timing-function:linear",
|
|
273
|
+
]),
|
|
274
|
+
].filter(Boolean).join(";");
|
|
275
|
+
const commonAttributes = `id="${id}" data-hypit-element-id="${escapeHtml(element.id)}"${attributes(element.attributes)}`;
|
|
276
|
+
const animationAttributes = animationName === undefined
|
|
277
|
+
? ""
|
|
278
|
+
: ` data-hypit-frame-animation data-hypit-animation-start-frame="${context.presentStartFrame}" data-hypit-animation-duration-frames="${animationDurationFrames}" data-hypit-animation-sample-frames="${context.presentDurationFrames}" data-hypit-animation-properties="${animationProperties.join(",")}"`;
|
|
279
|
+
const common = `${commonAttributes}${animationAttributes} style="${escapeHtml(inlineStyle)}"`;
|
|
280
|
+
if (element.kind === "mask") {
|
|
281
|
+
const direct = children.get(element.id) ?? [];
|
|
282
|
+
const maskRoot = direct.find((child) => child.id === element.maskElement);
|
|
283
|
+
const contentRoot = direct.find((child) => child.id === element.contentElement);
|
|
284
|
+
if (maskRoot === undefined || contentRoot === undefined || direct.length !== 2) {
|
|
285
|
+
throw new Error(`Local mask ${element.id} is missing its declared owned roots.`);
|
|
286
|
+
}
|
|
287
|
+
const maskId = context.stableId([context.trackId, context.presentId, element.id, "mask"]);
|
|
288
|
+
const maskWidth = pixelDimension(element.style, "width");
|
|
289
|
+
const maskHeight = pixelDimension(element.style, "height");
|
|
290
|
+
const viewport = maskWidth === undefined || maskHeight === undefined
|
|
291
|
+
? ""
|
|
292
|
+
: ` viewBox="0 0 ${maskWidth} ${maskHeight}" preserveAspectRatio="none"`;
|
|
293
|
+
const renderOwned = (child: VisualElement) => renderElement(child, children, context);
|
|
294
|
+
if ((children.get(maskRoot.id) ?? []).length !== 0) {
|
|
295
|
+
throw new Error(`Local mask ${element.id} mask source must be one terminal owned element.`);
|
|
296
|
+
}
|
|
297
|
+
const maskSource = (() => {
|
|
298
|
+
if (maskRoot.kind === "text") {
|
|
299
|
+
const alignment = maskRoot.style.find((declaration) => declaration.name === "text-align")?.value;
|
|
300
|
+
const anchor = alignment === "right" || alignment === "end" ? "end" : alignment === "left" || alignment === "start" ? "start" : "middle";
|
|
301
|
+
const blockAlignment = maskRoot.style.find((declaration) => declaration.name === "align-items")?.value;
|
|
302
|
+
const paddingLeft = pixelDimension(maskRoot.style, "padding-left") ?? 0;
|
|
303
|
+
const paddingRight = pixelDimension(maskRoot.style, "padding-right") ?? 0;
|
|
304
|
+
const paddingTop = pixelDimension(maskRoot.style, "padding-top") ?? 0;
|
|
305
|
+
const paddingBottom = pixelDimension(maskRoot.style, "padding-bottom") ?? 0;
|
|
306
|
+
const x = maskWidth === undefined
|
|
307
|
+
? anchor === "start" ? "0" : anchor === "end" ? "100%" : "50%"
|
|
308
|
+
: String(anchor === "start" ? paddingLeft : anchor === "end" ? maskWidth - paddingRight : (paddingLeft + maskWidth - paddingRight) / 2);
|
|
309
|
+
const y = maskHeight === undefined
|
|
310
|
+
? blockAlignment === "flex-start" ? "0" : blockAlignment === "flex-end" ? "100%" : "50%"
|
|
311
|
+
: String(blockAlignment === "flex-start" ? paddingTop : blockAlignment === "flex-end" ? maskHeight - paddingBottom : (paddingTop + maskHeight - paddingBottom) / 2);
|
|
312
|
+
const baseline = blockAlignment === "flex-start" ? "text-before-edge" : blockAlignment === "flex-end" ? "text-after-edge" : "central";
|
|
313
|
+
const textStyle = [css(maskRoot.style), ...exactFontStyle(maskRoot, context.stableId), "fill:currentColor"].filter(Boolean).join(";");
|
|
314
|
+
return `<text${attributes(maskRoot.attributes)} x="${x}" y="${y}" text-anchor="${anchor}" dominant-baseline="${baseline}" style="${escapeHtml(textStyle)}">${escapeHtml(maskRoot.text)}</text>`;
|
|
315
|
+
}
|
|
316
|
+
if (maskRoot.kind === "text-flow" || maskRoot.kind === "path-text") {
|
|
317
|
+
return `<foreignObject x="0" y="0" width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:100%;height:100%">${renderOwned(maskRoot)}</div></foreignObject>`;
|
|
318
|
+
}
|
|
319
|
+
if (maskRoot.kind === "image") {
|
|
320
|
+
return `<image x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" href="${escapeHtml(hyperframesResourceUri(maskRoot.artifact.resource))}" style="${escapeHtml(css(maskRoot.style))}"/>`;
|
|
321
|
+
}
|
|
322
|
+
if (maskRoot.kind === "surface" && maskRoot.surface.timing.kind === "still") {
|
|
323
|
+
return `<image data-hypit-surface-resource="${maskRoot.surface.artifact.resource}" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" href="${escapeHtml(hyperframesResourceUri(maskRoot.surface.artifact.resource))}" style="${escapeHtml(css(maskRoot.style))}"/>`;
|
|
324
|
+
}
|
|
325
|
+
throw new Error(`Local mask ${element.id} requires a terminal owned text, image or still Surface mask source.`);
|
|
326
|
+
})();
|
|
327
|
+
return `<svg ${common}${viewport} width="100%" height="100%" overflow="visible"><defs><mask id="${maskId}" x="0" y="0" width="100%" height="100%" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" style="mask-type:${element.mode}">${maskSource}</mask></defs><foreignObject x="0" y="0" width="100%" height="100%" mask="url(#${maskId})"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:100%;height:100%">${renderOwned(contentRoot)}</div></foreignObject></svg>`;
|
|
328
|
+
}
|
|
329
|
+
if (element.kind === "program") {
|
|
330
|
+
const program = readBrowserProgram(element.program);
|
|
331
|
+
const slots = new Map((children.get(element.id) ?? []).map(child => [child.id, renderElement(child, children, context)]));
|
|
332
|
+
return `<div ${common}>${browserProgramHtml(program, slots)}</div>`;
|
|
333
|
+
}
|
|
334
|
+
const descendants = (children.get(element.id) ?? [])
|
|
335
|
+
.map((child) => renderElement(child, children, context))
|
|
336
|
+
.join("");
|
|
337
|
+
if (element.kind === "box") return `<div ${common}>${descendants}</div>`;
|
|
338
|
+
const textContext = {
|
|
339
|
+
trackId: context.trackId,
|
|
340
|
+
presentId: context.presentId,
|
|
341
|
+
durationFrames: context.presentDurationFrames,
|
|
342
|
+
durationSeconds: context.presentDuration,
|
|
343
|
+
presentStartFrame: context.presentStartFrame,
|
|
344
|
+
programNumerator: context.programNumerator,
|
|
345
|
+
programDenominator: context.programDenominator,
|
|
346
|
+
escape: escapeHtml,
|
|
347
|
+
stableId: context.stableId,
|
|
348
|
+
exactFontFamily: (font: FontArtifactRef) => exactFontFamily(font, context.stableId),
|
|
349
|
+
baseStyle: inlineStyle,
|
|
350
|
+
commonAttributes,
|
|
351
|
+
emittedFilterIds: context.emittedFilterIds,
|
|
352
|
+
};
|
|
353
|
+
if (element.kind === "text") {
|
|
354
|
+
const body = element.paints === undefined
|
|
355
|
+
? escapeHtml(element.text)
|
|
356
|
+
: renderGlyphPaintedString(element.text, element.paints, textContext);
|
|
357
|
+
return `<div ${common}>${body}${descendants}</div>`;
|
|
358
|
+
}
|
|
359
|
+
if (element.kind === "text-flow" || element.kind === "path-text") {
|
|
360
|
+
return renderTerminalTextElement(element, textContext);
|
|
361
|
+
}
|
|
362
|
+
if ((element.kind === "video" || element.kind === "surface") && element.sampling !== undefined) {
|
|
363
|
+
const artifact = element.kind === "surface" ? element.surface.artifact : element.artifact;
|
|
364
|
+
const source = escapeHtml(hyperframesResourceUri(artifact.resource));
|
|
365
|
+
let part = 0;
|
|
366
|
+
return element.sampling.segments.flatMap((segment) => samplingRuns(segment).map((run) => {
|
|
367
|
+
part += 1;
|
|
368
|
+
const startFrame = context.presentStartFrame + run.startFrame;
|
|
369
|
+
const durationFrames = run.endFrameExclusive - run.startFrame;
|
|
370
|
+
const partId = `${id}-sample-${String(part).padStart(4, "0")}`;
|
|
371
|
+
const media = [
|
|
372
|
+
`id="${partId}"`,
|
|
373
|
+
`data-hypit-element-id="${escapeHtml(element.id)}"`,
|
|
374
|
+
`data-hypit-sampling-part="${part}"`,
|
|
375
|
+
`data-start="${frameSeconds(startFrame, context.programNumerator, context.programDenominator)}"`,
|
|
376
|
+
`data-duration="${frameSeconds(durationFrames, context.programNumerator, context.programDenominator)}"`,
|
|
377
|
+
`data-track-index="${context.stackIndex}"`,
|
|
378
|
+
`data-media-start="${sourceSeconds(run.sourceFrame, element.sampling!.sourceFrameRate)}"`,
|
|
379
|
+
`data-playback-rate="${sampledPlaybackRate(segment.rate, element.sampling!.sourceFrameRate, context.programNumerator, context.programDenominator)}"`,
|
|
380
|
+
`data-hypit-source-frame="${run.sourceFrame.numerator}/${run.sourceFrame.denominator}"`,
|
|
381
|
+
`data-hypit-source-rate="${segment.rate.numerator}/${segment.rate.denominator}"`,
|
|
382
|
+
`data-hypit-start-frame="${startFrame}"`,
|
|
383
|
+
`data-hypit-end-frame="${startFrame + durationFrames}"`,
|
|
384
|
+
`data-hypit-source-fps="${element.sampling!.sourceFrameRate.numerator}/${element.sampling!.sourceFrameRate.denominator}"`,
|
|
385
|
+
`style="${escapeHtml(inlineStyle)}"`,
|
|
386
|
+
attributes(element.attributes).trim(),
|
|
387
|
+
"muted",
|
|
388
|
+
"playsinline",
|
|
389
|
+
...(element.kind === "surface" ? [
|
|
390
|
+
`data-hypit-surface-resource="${element.surface.artifact.resource}"`,
|
|
391
|
+
`data-hypit-alpha-mode="${element.surface.alphaMode}"`,
|
|
392
|
+
`data-hypit-color-space="${element.surface.colorSpace}"`,
|
|
393
|
+
`width="${element.surface.width}"`,
|
|
394
|
+
`height="${element.surface.height}"`,
|
|
395
|
+
] : []),
|
|
396
|
+
].filter(Boolean).join(" ");
|
|
397
|
+
return `<video ${media} src="${source}"></video>`;
|
|
398
|
+
})).join("");
|
|
399
|
+
}
|
|
400
|
+
if (element.kind === "surface") {
|
|
401
|
+
const source = escapeHtml(hyperframesResourceUri(element.surface.artifact.resource));
|
|
402
|
+
const surface = [
|
|
403
|
+
`data-hypit-surface-resource="${element.surface.artifact.resource}"`,
|
|
404
|
+
`data-start="${context.presentStart}"`,
|
|
405
|
+
`data-duration="${context.presentDuration}"`,
|
|
406
|
+
`data-track-index="${context.stackIndex}"`,
|
|
407
|
+
`data-hypit-alpha-mode="${element.surface.alphaMode}"`,
|
|
408
|
+
`data-hypit-color-space="${element.surface.colorSpace}"`,
|
|
409
|
+
`width="${element.surface.width}"`,
|
|
410
|
+
`height="${element.surface.height}"`,
|
|
411
|
+
].join(" ");
|
|
412
|
+
if (element.surface.timing.kind === "still") return `<img ${common} ${surface} src="${source}"/>`;
|
|
413
|
+
const timing = element.surface.timing;
|
|
414
|
+
const exact = `data-hypit-start-frame="${context.presentStartFrame}" data-hypit-end-frame="${context.presentStartFrame + timing.frameCount}" data-hypit-source-frame="0/1" data-hypit-source-rate="1/1" data-hypit-source-fps="${timing.frameRate.numerator}/${timing.frameRate.denominator}"`;
|
|
415
|
+
return `<video ${common} ${surface} ${exact} muted playsinline src="${source}"></video>`;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const media = [
|
|
419
|
+
`data-start="${context.presentStart}"`,
|
|
420
|
+
`data-duration="${context.presentDuration}"`,
|
|
421
|
+
`data-track-index="${context.stackIndex}"`,
|
|
422
|
+
element.kind === "video" && element.muted !== false ? "muted" : "",
|
|
423
|
+
element.kind === "video" ? "playsinline" : "",
|
|
424
|
+
].filter(Boolean).join(" ");
|
|
425
|
+
const source = escapeHtml(hyperframesResourceUri(element.artifact.resource));
|
|
426
|
+
if (element.kind === "image") return `<img ${common} ${media} src="${source}"/>`;
|
|
427
|
+
const exact = `data-hypit-start-frame="${context.presentStartFrame}" data-hypit-end-frame="${context.presentStartFrame + context.presentDurationFrames}" data-hypit-source-frame="0/1" data-hypit-source-rate="1/1" data-hypit-source-fps="${context.programNumerator}/${context.programDenominator}"`;
|
|
428
|
+
return `<video ${common} ${media} ${exact} src="${source}">${descendants}</video>`;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function renderVisualPresent(
|
|
432
|
+
track: VisualTrack,
|
|
433
|
+
present: VisualPresent,
|
|
434
|
+
stackIndex: number,
|
|
435
|
+
numerator: number,
|
|
436
|
+
denominator: number,
|
|
437
|
+
emittedFilterIds: Set<string>,
|
|
438
|
+
stableId: StableDomId,
|
|
439
|
+
): string {
|
|
440
|
+
const start = frameSeconds(present.span.startFrame, numerator, denominator);
|
|
441
|
+
const duration = frameSeconds(present.span.endFrameExclusive - present.span.startFrame, numerator, denominator);
|
|
442
|
+
const children = new Map<string, VisualElement[]>();
|
|
443
|
+
for (const element of present.elements) {
|
|
444
|
+
if (element.parent === undefined) continue;
|
|
445
|
+
const siblings = children.get(element.parent) ?? [];
|
|
446
|
+
siblings.push(element);
|
|
447
|
+
children.set(element.parent, siblings);
|
|
448
|
+
}
|
|
449
|
+
for (const siblings of children.values()) siblings.sort((left, right) => left.order - right.order || left.id.localeCompare(right.id));
|
|
450
|
+
const root = present.elements.find((element) => element.parent === undefined)!;
|
|
451
|
+
const contents = renderElement(root, children, {
|
|
452
|
+
trackId: track.id,
|
|
453
|
+
presentId: present.id,
|
|
454
|
+
presentStart: start,
|
|
455
|
+
presentDuration: duration,
|
|
456
|
+
presentDurationFrames: present.span.endFrameExclusive - present.span.startFrame,
|
|
457
|
+
presentStartFrame: present.span.startFrame,
|
|
458
|
+
programNumerator: numerator,
|
|
459
|
+
programDenominator: denominator,
|
|
460
|
+
stackIndex,
|
|
461
|
+
emittedFilterIds,
|
|
462
|
+
stableId,
|
|
463
|
+
});
|
|
464
|
+
return `<div class="clip hypit-visual-present" data-hypit-track-id="${escapeHtml(track.id)}" data-hypit-present-id="${escapeHtml(present.id)}" data-hypit-stack-order="${present.stacking.order}" data-hypit-stack-tie="${escapeHtml(present.stacking.tieBreak)}" data-track-index="${stackIndex}" data-start="${start}" data-duration="${duration}" style="position:absolute;inset:0;z-index:${stackIndex};overflow:hidden;pointer-events:none">${contents}</div>`;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function renderAnimationRules(track: VisualTrack, present: VisualPresent, stableId: StableDomId): string[] {
|
|
468
|
+
const presentDurationFrames = present.span.endFrameExclusive - present.span.startFrame;
|
|
469
|
+
return present.elements.flatMap((element) => {
|
|
470
|
+
if (element.animation === undefined) return [];
|
|
471
|
+
const durationFrames = Math.max(presentDurationFrames, element.animation.keyframes.at(-1)?.atFrame ?? 0);
|
|
472
|
+
const name = stableId(["animation", track.id, present.id, element.id]);
|
|
473
|
+
const keyframes: VisualAnimation["keyframes"] = element.animation.keyframes.at(-1)?.atFrame === durationFrames
|
|
474
|
+
? element.animation.keyframes
|
|
475
|
+
: [...element.animation.keyframes, {
|
|
476
|
+
atFrame: durationFrames,
|
|
477
|
+
style: element.animation.keyframes.at(-1)!.style,
|
|
478
|
+
}];
|
|
479
|
+
const frames = keyframes.map((keyframe) => {
|
|
480
|
+
const easing = keyframe.easing === undefined ? "" : `;animation-timing-function:${keyframe.easing}`;
|
|
481
|
+
return `${percentage(keyframe.atFrame, durationFrames)}{${css(keyframe.style)}${easing}}`;
|
|
482
|
+
}).join("");
|
|
483
|
+
return [`@keyframes ${name}{${frames}}`];
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function orderedVisualPresents(tracks: readonly Track[]): Array<{ readonly track: VisualTrack; readonly present: VisualPresent }> {
|
|
488
|
+
return tracks
|
|
489
|
+
.filter((track): track is VisualTrack => track.kind === "visual")
|
|
490
|
+
.flatMap((track) => track.presents.map((present) => ({ track, present })))
|
|
491
|
+
.sort((left, right) => left.present.stacking.order - right.present.stacking.order
|
|
492
|
+
|| left.present.stacking.tieBreak.localeCompare(right.present.stacking.tieBreak)
|
|
493
|
+
|| left.present.span.startFrame - right.present.span.startFrame
|
|
494
|
+
|| left.track.id.localeCompare(right.track.id)
|
|
495
|
+
|| left.present.id.localeCompare(right.present.id));
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function collectArtifacts(composition: Composition): BlobRef[] {
|
|
499
|
+
const artifacts = new Map<ResourceId, BlobRef>();
|
|
500
|
+
const add = (artifact: Pick<BlobRef, "resource" | "size" | "mediaType">): void => {
|
|
501
|
+
const next: BlobRef = {
|
|
502
|
+
kind: "blob",
|
|
503
|
+
resource: artifact.resource,
|
|
504
|
+
size: artifact.size,
|
|
505
|
+
mediaType: artifact.mediaType,
|
|
506
|
+
};
|
|
507
|
+
const existing = artifacts.get(artifact.resource);
|
|
508
|
+
if (existing !== undefined && (existing.size !== next.size || existing.mediaType !== next.mediaType)) {
|
|
509
|
+
throw new Error(`HyperFrames Artifact ${artifact.resource} has conflicting metadata.`);
|
|
510
|
+
}
|
|
511
|
+
artifacts.set(artifact.resource, next);
|
|
512
|
+
};
|
|
513
|
+
for (const track of composition.tracks) {
|
|
514
|
+
if (track.kind === "audio") continue;
|
|
515
|
+
for (const present of track.presents) {
|
|
516
|
+
for (const element of present.elements) {
|
|
517
|
+
if (element.kind === "image" || element.kind === "video") add(element.artifact);
|
|
518
|
+
if (element.kind === "surface") add(element.surface.artifact);
|
|
519
|
+
if (element.kind === "program") for (const artifact of element.program.artifacts) add(artifact);
|
|
520
|
+
if (element.kind === "text") {
|
|
521
|
+
for (const font of element.fonts ?? []) {
|
|
522
|
+
for (const source of font.sources) add(source.artifact);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (element.kind === "text-flow" || element.kind === "path-text") {
|
|
526
|
+
for (const font of collectTerminalTextFonts(element)) {
|
|
527
|
+
for (const source of font.sources) add(source.artifact);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return [...artifacts.values()].sort((left, right) => left.resource.localeCompare(right.resource));
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function collectSurfaces(composition: Composition): CompositableSurfaceRef[] {
|
|
537
|
+
const surfaces = new Map<ResourceId, CompositableSurfaceRef>();
|
|
538
|
+
for (const track of composition.tracks) {
|
|
539
|
+
if (track.kind !== "visual") continue;
|
|
540
|
+
for (const present of track.presents) {
|
|
541
|
+
for (const element of present.elements) {
|
|
542
|
+
if (element.kind !== "surface") continue;
|
|
543
|
+
const surface = structuredClone(element.surface);
|
|
544
|
+
const existing = surfaces.get(surface.artifact.resource);
|
|
545
|
+
if (existing !== undefined && canonicalStringify(existing) !== canonicalStringify(surface)) {
|
|
546
|
+
throw new Error(`HyperFrames Surface ${surface.artifact.resource} has conflicting declarations.`);
|
|
547
|
+
}
|
|
548
|
+
surfaces.set(surface.artifact.resource, surface);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return [...surfaces.values()].sort((left, right) =>
|
|
553
|
+
left.artifact.resource.localeCompare(right.artifact.resource));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function collectFonts(composition: Composition): FontArtifactRef[] {
|
|
557
|
+
const fonts = new Map<string, FontArtifactRef>();
|
|
558
|
+
for (const track of composition.tracks) {
|
|
559
|
+
if (track.kind !== "visual") continue;
|
|
560
|
+
for (const present of track.presents) {
|
|
561
|
+
for (const element of present.elements) {
|
|
562
|
+
if (element.kind !== "text") continue;
|
|
563
|
+
for (const font of element.fonts ?? []) fonts.set(canonicalStringify(font), font);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
for (const track of composition.tracks) {
|
|
568
|
+
if (track.kind !== "visual") continue;
|
|
569
|
+
for (const present of track.presents) {
|
|
570
|
+
for (const element of present.elements) {
|
|
571
|
+
if (element.kind !== "text-flow" && element.kind !== "path-text") continue;
|
|
572
|
+
for (const font of collectTerminalTextFonts(element)) fonts.set(canonicalStringify(font), font);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return [...fonts.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([, font]) => font);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function fontFormat(mediaType: string): string {
|
|
580
|
+
if (mediaType === "font/woff2") return "woff2";
|
|
581
|
+
if (mediaType === "font/woff") return "woff";
|
|
582
|
+
if (mediaType === "font/otf") return "opentype";
|
|
583
|
+
return "truetype";
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function renderFontFaces(composition: Composition, stableId: StableDomId): string {
|
|
587
|
+
return collectFonts(composition).flatMap((font) => font.sources.map((source) => [
|
|
588
|
+
"@font-face{",
|
|
589
|
+
`font-family:${exactFontFamily(font, stableId)};`,
|
|
590
|
+
`src:url(\"${hyperframesResourceUri(source.artifact.resource)}\") format(\"${fontFormat(source.artifact.mediaType)}\");`,
|
|
591
|
+
`font-weight:${font.weight};`,
|
|
592
|
+
`font-style:${font.style};`,
|
|
593
|
+
"font-display:block;",
|
|
594
|
+
...(source.unicodeRange === undefined ? [] : [`unicode-range:${source.unicodeRange};`]),
|
|
595
|
+
"}",
|
|
596
|
+
].join(""))).join("\n ");
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function hasTerminalText(composition: Composition): boolean {
|
|
600
|
+
return composition.tracks.some((track) => track.kind === "visual"
|
|
601
|
+
&& track.presents.some((present) => present.elements.some((element) =>
|
|
602
|
+
element.kind === "text-flow" || element.kind === "path-text")));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function hasFrameAnimations(composition: Composition): boolean {
|
|
606
|
+
return composition.tracks.some((track) => track.kind === "visual"
|
|
607
|
+
&& track.presents.some((present) => present.elements.some((element) => element.animation !== undefined)));
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function frameAnimationRuntime(numerator: number, denominator: number): string {
|
|
611
|
+
return String.raw`
|
|
612
|
+
(() => {
|
|
613
|
+
const numerator = ${numerator};
|
|
614
|
+
const denominator = ${denominator};
|
|
615
|
+
const millisecondsPerFrame = denominator * 1000 / numerator;
|
|
616
|
+
const timelines = [];
|
|
617
|
+
for (const element of document.querySelectorAll("[data-hypit-frame-animation]")) {
|
|
618
|
+
void element.getBoundingClientRect();
|
|
619
|
+
const animation = element.getAnimations()[0];
|
|
620
|
+
if (animation === undefined) throw new Error("Visual IR frame animation did not materialize.");
|
|
621
|
+
const start = Number(element.getAttribute("data-hypit-animation-start-frame"));
|
|
622
|
+
const duration = Number(element.getAttribute("data-hypit-animation-duration-frames"));
|
|
623
|
+
const sampleDuration = Number(element.getAttribute("data-hypit-animation-sample-frames"));
|
|
624
|
+
const properties = String(element.getAttribute("data-hypit-animation-properties") || "")
|
|
625
|
+
.split(",").filter(Boolean);
|
|
626
|
+
const frames = [];
|
|
627
|
+
for (let frame = 0; frame <= sampleDuration; frame += 1) {
|
|
628
|
+
animation.currentTime = frame * millisecondsPerFrame;
|
|
629
|
+
animation.pause();
|
|
630
|
+
const style = getComputedStyle(element);
|
|
631
|
+
frames.push(properties.map((property) => [property, style.getPropertyValue(property)]));
|
|
632
|
+
}
|
|
633
|
+
animation.cancel();
|
|
634
|
+
element.style.animationName = "none";
|
|
635
|
+
timelines.push({ element, start, duration: sampleDuration, frames });
|
|
636
|
+
}
|
|
637
|
+
const applyFrame = (time) => {
|
|
638
|
+
const programFrame = Math.max(0, Math.round(Number(time || 0) * numerator / denominator));
|
|
639
|
+
for (const timeline of timelines) {
|
|
640
|
+
const localFrame = Math.max(0, Math.min(timeline.duration, programFrame - timeline.start));
|
|
641
|
+
for (const [property, value] of timeline.frames[localFrame]) {
|
|
642
|
+
timeline.element.style.setProperty(property, value);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
void document.documentElement.getBoundingClientRect();
|
|
646
|
+
};
|
|
647
|
+
applyFrame(0);
|
|
648
|
+
window.addEventListener("hf-seek", (event) => applyFrame(event.detail?.time));
|
|
649
|
+
})();`;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function emitHtml(composition: Composition, programSpace: ProgramSpace): string {
|
|
653
|
+
const { numerator, denominator } = programSpace.frameRate;
|
|
654
|
+
const visuals = orderedVisualPresents(composition.tracks);
|
|
655
|
+
// One document, one set of glyph filter definitions: every Present writes only what is not
|
|
656
|
+
// already there, and references resolve across the document regardless of where they landed.
|
|
657
|
+
const emittedFilterIds = new Set<string>();
|
|
658
|
+
const stableId = createStableDomId();
|
|
659
|
+
const visualHtml = visuals.map(({ track, present }, index) => renderVisualPresent(track, present, index, numerator, denominator, emittedFilterIds, stableId)).join("\n ");
|
|
660
|
+
const animationCss = visuals.flatMap(({ track, present }) => renderAnimationRules(track, present, stableId)).join("\n ");
|
|
661
|
+
const fontCss = renderFontFaces(composition, stableId);
|
|
662
|
+
const programs = visuals.flatMap(({ track, present }) => present.elements.flatMap(element => element.kind !== "program" ? [] : [{
|
|
663
|
+
id: stableId([track.id, present.id, element.id]),
|
|
664
|
+
startFrame: present.span.startFrame,
|
|
665
|
+
durationFrames: present.span.endFrameExclusive - present.span.startFrame,
|
|
666
|
+
program: readBrowserProgram(element.program),
|
|
667
|
+
}]));
|
|
668
|
+
const programCss = programs.map(entry => `@scope (#${entry.id}) { ${entry.program.css ?? ""} }`).join("\n");
|
|
669
|
+
const programRuntime = programs.length === 0 ? "" : `<script>${browserProgramScript(programs, numerator, denominator)}</script>`;
|
|
670
|
+
const duration = frameSeconds(programSpaceFrameCount(programSpace), numerator, denominator);
|
|
671
|
+
const fps = fpsRational(numerator, denominator);
|
|
672
|
+
const frameCount = programSpaceFrameCount(programSpace);
|
|
673
|
+
const textRuntime = hasTerminalText(composition)
|
|
674
|
+
? `\n <script>\n ${terminalTextLayoutScript}\n </script>`
|
|
675
|
+
: "";
|
|
676
|
+
const animationRuntime = hasFrameAnimations(composition)
|
|
677
|
+
? `\n <script>\n ${frameAnimationRuntime(numerator, denominator)}\n </script>`
|
|
678
|
+
: "";
|
|
679
|
+
return `<!doctype html>
|
|
680
|
+
<html>
|
|
681
|
+
<head>
|
|
682
|
+
<meta charset="utf-8"/>
|
|
683
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
684
|
+
<style>
|
|
685
|
+
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:${composition.canvas.clearColor}}
|
|
686
|
+
[data-composition-id]{position:relative;overflow:hidden;background:${composition.canvas.clearColor}}
|
|
687
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
688
|
+
${fontCss}
|
|
689
|
+
${animationCss}
|
|
690
|
+
${programCss}
|
|
691
|
+
</style>
|
|
692
|
+
</head>
|
|
693
|
+
<body>
|
|
694
|
+
<div data-composition-id="${escapeHtml(composition.id)}" data-start="0" data-no-timeline data-width="${composition.canvas.width}" data-height="${composition.canvas.height}" data-duration="${duration}" data-fps="${fps}" data-hypit-frame-count="${frameCount}">
|
|
695
|
+
${visualHtml}
|
|
696
|
+
</div>${programRuntime}${animationRuntime}${textRuntime}
|
|
697
|
+
</body>
|
|
698
|
+
</html>
|
|
699
|
+
`;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function normalizedDocument(value: HyperframesDocument): HyperframesDocument {
|
|
703
|
+
return {
|
|
704
|
+
visualIr: value.visualIr,
|
|
705
|
+
frameRate: { ...value.frameRate },
|
|
706
|
+
frameCount: value.frameCount,
|
|
707
|
+
canvas: { ...value.canvas },
|
|
708
|
+
artifacts: [...value.artifacts]
|
|
709
|
+
.map((artifact) => ({ ...artifact }))
|
|
710
|
+
.sort((left, right) => left.resource.localeCompare(right.resource)),
|
|
711
|
+
surfaces: [...value.surfaces]
|
|
712
|
+
.map((surface) => structuredClone(surface))
|
|
713
|
+
.sort((left, right) => left.artifact.resource.localeCompare(right.artifact.resource)),
|
|
714
|
+
html: value.html,
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export function compileHyperframesDocument(composition: Composition, programSpace: ProgramSpace): HyperframesDocument {
|
|
719
|
+
assertCompositionIdentity(composition, programSpace);
|
|
720
|
+
const content = normalizedDocument({
|
|
721
|
+
visualIr: VISUAL_IR_V1,
|
|
722
|
+
frameRate: { ...programSpace.frameRate },
|
|
723
|
+
frameCount: programSpaceFrameCount(programSpace),
|
|
724
|
+
canvas: {
|
|
725
|
+
width: composition.canvas.width,
|
|
726
|
+
height: composition.canvas.height,
|
|
727
|
+
},
|
|
728
|
+
artifacts: collectArtifacts(composition),
|
|
729
|
+
surfaces: collectSurfaces(composition),
|
|
730
|
+
html: emitHtml(composition, programSpace),
|
|
731
|
+
});
|
|
732
|
+
return content;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export function assertHyperframesDocument(document: HyperframesDocument): void {
|
|
736
|
+
if (document.visualIr !== VISUAL_IR_V1) throw new Error("Unsupported HyperframesDocument visual IR.");
|
|
737
|
+
if (
|
|
738
|
+
!Number.isSafeInteger(document.frameRate.numerator)
|
|
739
|
+
|| document.frameRate.numerator <= 0
|
|
740
|
+
|| !Number.isSafeInteger(document.frameRate.denominator)
|
|
741
|
+
|| document.frameRate.denominator <= 0
|
|
742
|
+
|| !Number.isSafeInteger(document.frameCount)
|
|
743
|
+
|| document.frameCount <= 0
|
|
744
|
+
|| !Number.isSafeInteger(document.canvas.width)
|
|
745
|
+
|| document.canvas.width <= 0
|
|
746
|
+
|| !Number.isSafeInteger(document.canvas.height)
|
|
747
|
+
|| document.canvas.height <= 0
|
|
748
|
+
) {
|
|
749
|
+
throw new Error("HyperframesDocument frame domain or canvas is invalid.");
|
|
750
|
+
}
|
|
751
|
+
if (!document.html.startsWith("<!doctype html>")) throw new Error("HyperframesDocument HTML is invalid.");
|
|
752
|
+
const declared = [...document.artifacts];
|
|
753
|
+
if (declared.some((item) => item.kind !== "blob" || !isResourceId(item.resource)
|
|
754
|
+
|| !Number.isSafeInteger(item.size) || item.size < 0 || item.mediaType.length === 0)
|
|
755
|
+
|| new Set(declared.map((item) => item.resource)).size !== declared.length) {
|
|
756
|
+
throw new Error("HyperframesDocument Artifact set is invalid.");
|
|
757
|
+
}
|
|
758
|
+
const referenced = [...document.html.matchAll(RESOURCE_URI)].map((match) => match[1] as ResourceId);
|
|
759
|
+
const actual = [...new Set(referenced)].sort();
|
|
760
|
+
if (JSON.stringify(actual) !== JSON.stringify(declared.map((item) => item.resource).sort())) {
|
|
761
|
+
throw new Error("HyperframesDocument Artifact placeholders do not match its declared dependencies.");
|
|
762
|
+
}
|
|
763
|
+
if (!Array.isArray(document.surfaces)) throw new Error("HyperframesDocument Surface set is invalid.");
|
|
764
|
+
const surfaceArtifacts = new Set<string>();
|
|
765
|
+
for (const [index, surface] of document.surfaces.entries()) {
|
|
766
|
+
assertCompositableSurfaceRef(surface, `HyperframesDocument.surfaces.${index}`);
|
|
767
|
+
if (surfaceArtifacts.has(surface.artifact.resource)) {
|
|
768
|
+
throw new Error("HyperframesDocument Surface set repeats an Artifact.");
|
|
769
|
+
}
|
|
770
|
+
surfaceArtifacts.add(surface.artifact.resource);
|
|
771
|
+
const artifact = declared.find((item) => item.resource === surface.artifact.resource);
|
|
772
|
+
if (artifact === undefined
|
|
773
|
+
|| artifact.size !== surface.artifact.size
|
|
774
|
+
|| artifact.mediaType !== surface.artifact.mediaType) {
|
|
775
|
+
throw new Error("HyperframesDocument Surface is not bound to its declared Artifact.");
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
const referencedSurfaces = [...new Set(
|
|
779
|
+
[...document.html.matchAll(SURFACE_RESOURCE)].map((match) => match[1]!),
|
|
780
|
+
)].sort();
|
|
781
|
+
if (JSON.stringify(referencedSurfaces) !== JSON.stringify([...surfaceArtifacts].sort())) {
|
|
782
|
+
throw new Error("HyperframesDocument Surface markers do not match its typed dependencies.");
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/** Validate one independently renderable frame index without parsing generated HTML. */
|
|
787
|
+
export function assertHyperframesFrameIndex(document: HyperframesDocument, frame: number): void {
|
|
788
|
+
assertHyperframesDocument(document);
|
|
789
|
+
if (!Number.isSafeInteger(frame) || frame < 0 || frame >= document.frameCount) {
|
|
790
|
+
throw new Error(`HyperFrames frame ${frame} is outside [0, ${document.frameCount}).`);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/** Validate a Provider-owned half-open chunk of the document's exact frame domain. */
|
|
795
|
+
export function assertHyperframesFrameSpan(
|
|
796
|
+
document: HyperframesDocument,
|
|
797
|
+
span: HyperframesFrameSpan,
|
|
798
|
+
): void {
|
|
799
|
+
assertHyperframesDocument(document);
|
|
800
|
+
if (
|
|
801
|
+
!Number.isSafeInteger(span.startFrame)
|
|
802
|
+
|| !Number.isSafeInteger(span.endFrameExclusive)
|
|
803
|
+
|| span.startFrame < 0
|
|
804
|
+
|| span.endFrameExclusive <= span.startFrame
|
|
805
|
+
|| span.endFrameExclusive > document.frameCount
|
|
806
|
+
) {
|
|
807
|
+
throw new Error(
|
|
808
|
+
`HyperFrames frame span [${span.startFrame}, ${span.endFrameExclusive}) is outside [0, ${document.frameCount}).`,
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/** Runtime-only URL materialization. The returned HTML is intentionally not a new compiled Record. */
|
|
814
|
+
export function materializeHyperframesHtml(
|
|
815
|
+
document: HyperframesDocument,
|
|
816
|
+
resolve: ResourceUrlResolver,
|
|
817
|
+
): string {
|
|
818
|
+
assertHyperframesDocument(document);
|
|
819
|
+
const artifacts = new Map(document.artifacts.map((artifact) => [artifact.resource, artifact]));
|
|
820
|
+
return document.html.replace(RESOURCE_URI, (_uri, resource: ResourceId) => {
|
|
821
|
+
const artifact = artifacts.get(resource);
|
|
822
|
+
if (artifact === undefined) throw new Error(`HyperFrames Resource ${resource} is undeclared.`);
|
|
823
|
+
return escapeHtml(resolve(artifact));
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export const hyperframesTime = { frameSeconds, fpsDecimal, fpsRational } as const;
|