@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,842 @@
|
|
|
1
|
+
import { createTemporalSpace, resolveTemporalContext } from "@hypit/temporal-markup";
|
|
2
|
+
import { programSpaceTypes } from "@hypit/program-space";
|
|
3
|
+
import { compositionTypes } from "@hypit/composition";
|
|
4
|
+
import type {
|
|
5
|
+
VisualColorPaint,
|
|
6
|
+
VisualStyleDeclaration,
|
|
7
|
+
VisualTextDocument,
|
|
8
|
+
VisualTextPaintLayer,
|
|
9
|
+
VisualTextRunStyle,
|
|
10
|
+
VisualTextSequenceAnimation,
|
|
11
|
+
VisualTextTypography,
|
|
12
|
+
} from "@hypit/composition";
|
|
13
|
+
import {
|
|
14
|
+
assertFontArtifactRef,
|
|
15
|
+
assertFontStackRef,
|
|
16
|
+
mediaTypes,
|
|
17
|
+
} from "@hypit/media";
|
|
18
|
+
import type { FontArtifactRef, FontStackRef } from "@hypit/media";
|
|
19
|
+
import { spatialTypes } from "@hypit/spatial";
|
|
20
|
+
import { sealGraphFragment } from "@hypit/elaborator";
|
|
21
|
+
import type { AuthorValueRef, FragmentOperation, GraphFragment } from "@hypit/elaborator";
|
|
22
|
+
import { svsRecipeType } from "@hypit/svs";
|
|
23
|
+
import type { SvsRecipe } from "@hypit/svs";
|
|
24
|
+
import { textTypes } from "@hypit/text";
|
|
25
|
+
import type {
|
|
26
|
+
StructuredElement,
|
|
27
|
+
StructuredSurfaceHandler,
|
|
28
|
+
SurfaceComponentDraft,
|
|
29
|
+
SurfaceRecordDraft,
|
|
30
|
+
SurfaceResolvedReference,
|
|
31
|
+
MarkupAttributeValue,
|
|
32
|
+
} from "@hypit/markup";
|
|
33
|
+
import { temporalTypes } from "@hypit/temporal";
|
|
34
|
+
import { createTemporalWindowProjection, temporalWindowAttributeNames } from "@hypit/temporal-markup";
|
|
35
|
+
|
|
36
|
+
import { typographyTrackProducers, typographyTrackTypes } from "./manifest.js";
|
|
37
|
+
import {
|
|
38
|
+
sealTextItemSpec,
|
|
39
|
+
sealPlainTextItemSpec,
|
|
40
|
+
sealTextMaskSpec,
|
|
41
|
+
sealTextMotion,
|
|
42
|
+
sealTextStyle,
|
|
43
|
+
sealTypographyTrackHeader,
|
|
44
|
+
stillTextMotion,
|
|
45
|
+
} from "./program.js";
|
|
46
|
+
import type { TextItemSpec, TextMotion, TextStyle } from "./types.js";
|
|
47
|
+
|
|
48
|
+
const input = (name: string) => ({ kind: "fragment-input" as const, name });
|
|
49
|
+
const operation = (id: string) => ({ kind: "fragment-operation" as const, operation: id });
|
|
50
|
+
|
|
51
|
+
function localName(name: string): string {
|
|
52
|
+
return name.slice(name.lastIndexOf(":") + 1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function sameType(left: SurfaceResolvedReference["type"], right: SurfaceResolvedReference["type"]): boolean {
|
|
56
|
+
return left.module.name === right.module.name && left.module.version === right.module.version && left.name === right.name;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function allowed(element: StructuredElement, names: readonly string[], required: readonly string[] = []): void {
|
|
60
|
+
const unknown = Object.keys(element.attributes).filter((name) => !names.includes(name));
|
|
61
|
+
if (unknown.length > 0) throw new Error(`${element.name} does not accept ${unknown[0]}.`);
|
|
62
|
+
const missing = required.filter((name) => element.attributes[name] === undefined);
|
|
63
|
+
if (missing.length > 0) throw new Error(`${element.name} requires ${missing.join(", ")}.`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function empty(element: StructuredElement): void {
|
|
67
|
+
if (element.children.some((child) => child.kind === "element" || child.value.trim())) {
|
|
68
|
+
throw new Error(`${element.name} must be empty.`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function enumText<const T extends string>(
|
|
73
|
+
element: StructuredElement,
|
|
74
|
+
name: string,
|
|
75
|
+
values: readonly T[],
|
|
76
|
+
fallback?: T,
|
|
77
|
+
): T {
|
|
78
|
+
const value = text(element, name, fallback);
|
|
79
|
+
if (!values.includes(value as T)) throw new Error(`${element.name}.${name} must be ${values.join(" or ")}.`);
|
|
80
|
+
return value as T;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function text(element: StructuredElement, name: string, fallback?: string): string {
|
|
84
|
+
const value = element.attributes[name];
|
|
85
|
+
if (value === undefined && fallback !== undefined) return fallback;
|
|
86
|
+
if (typeof value !== "string" || !value.trim()) throw new Error(`${element.name}.${name} must be text.`);
|
|
87
|
+
return value.trim();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function optionalText(element: StructuredElement, name: string): string | undefined {
|
|
91
|
+
const value = element.attributes[name];
|
|
92
|
+
if (value === undefined) return undefined;
|
|
93
|
+
if (typeof value !== "string" || !value.trim()) throw new Error(`${element.name}.${name} must be text.`);
|
|
94
|
+
return value.trim();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function numeric(element: StructuredElement, name: string, fallback?: number): number {
|
|
98
|
+
const raw = optionalText(element, name);
|
|
99
|
+
if (raw === undefined && fallback !== undefined) return fallback;
|
|
100
|
+
const value = Number(raw);
|
|
101
|
+
if (!Number.isFinite(value)) throw new Error(`${element.name}.${name} must be finite.`);
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function integer(element: StructuredElement, name: string, fallback?: number): number {
|
|
106
|
+
const value = numeric(element, name, fallback);
|
|
107
|
+
if (!Number.isSafeInteger(value)) throw new Error(`${element.name}.${name} must be a safe integer.`);
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function booleanValue(value: unknown, label: string, fallback: boolean): boolean {
|
|
112
|
+
if (value === undefined) return fallback;
|
|
113
|
+
if (value === true || value === "true") return true;
|
|
114
|
+
if (value === false || value === "false") return false;
|
|
115
|
+
throw new Error(`${label} must be true or false.`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function reference(
|
|
119
|
+
raw: MarkupAttributeValue | undefined,
|
|
120
|
+
label: string,
|
|
121
|
+
expected: SurfaceResolvedReference["type"],
|
|
122
|
+
resolve: (path: string) => SurfaceResolvedReference | undefined,
|
|
123
|
+
): SurfaceResolvedReference {
|
|
124
|
+
if (typeof raw !== "object" || raw.kind !== "reference") throw new Error(`${label} must be a reference.`);
|
|
125
|
+
const result = resolve(raw.path);
|
|
126
|
+
if (result === undefined || !sameType(result.type, expected)) throw new Error(`${label} cannot resolve the required type.`);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function oneOfReference(
|
|
131
|
+
raw: MarkupAttributeValue | undefined,
|
|
132
|
+
label: string,
|
|
133
|
+
expected: readonly SurfaceResolvedReference["type"][],
|
|
134
|
+
resolve: (path: string) => SurfaceResolvedReference | undefined,
|
|
135
|
+
): SurfaceResolvedReference {
|
|
136
|
+
if (typeof raw !== "object" || raw.kind !== "reference") throw new Error(`${label} must be a reference.`);
|
|
137
|
+
const result = resolve(raw.path);
|
|
138
|
+
if (result === undefined || !expected.some((type) => sameType(result.type, type))) {
|
|
139
|
+
throw new Error(`${label} cannot resolve one of the required types.`);
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function inline<T>(value: SurfaceResolvedReference, label: string): T {
|
|
145
|
+
if (value.record?.value.kind !== "inline") throw new Error(`${label} must reference an authored inline Record.`);
|
|
146
|
+
return value.record.value.value as unknown as T;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function recipe(value: SurfaceResolvedReference, label: string): SvsRecipe {
|
|
150
|
+
if (!sameType(value.type, svsRecipeType)) throw new Error(`${label} must reference an SVS Recipe.`);
|
|
151
|
+
return inline<SvsRecipe>(value, label);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function propNumber(value: SvsRecipe, name: string, fallback?: number): number {
|
|
155
|
+
const result = value.properties[name];
|
|
156
|
+
if (result === undefined && fallback !== undefined) return fallback;
|
|
157
|
+
if (typeof result !== "number" || !Number.isFinite(result)) throw new Error(`Text Recipe ${name} must be a number.`);
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function propString(value: SvsRecipe, name: string, fallback?: string): string {
|
|
162
|
+
const result = value.properties[name];
|
|
163
|
+
if (result === undefined && fallback !== undefined) return fallback;
|
|
164
|
+
if (typeof result !== "string" || !result.trim()) throw new Error(`Text Recipe ${name} must be text.`);
|
|
165
|
+
return result.trim();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function propBoolean(value: SvsRecipe, name: string, fallback: boolean): boolean {
|
|
169
|
+
return booleanValue(value.properties[name], `Text Recipe ${name}`, fallback);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function exactFonts(
|
|
173
|
+
element: StructuredElement,
|
|
174
|
+
resolve: (path: string) => SurfaceResolvedReference | undefined,
|
|
175
|
+
): FontArtifactRef[] {
|
|
176
|
+
const raw = element.attributes.font;
|
|
177
|
+
if (raw === undefined) throw new Error(`${element.name}.font must reference one exact FontArtifactRef or FontStackRef.`);
|
|
178
|
+
const resolved = oneOfReference(raw, `${element.name}.font`, [mediaTypes.fontArtifact, mediaTypes.fontStack], resolve);
|
|
179
|
+
if (sameType(resolved.type, mediaTypes.fontArtifact)) {
|
|
180
|
+
const font = inline<FontArtifactRef>(resolved, `${element.name}.font`);
|
|
181
|
+
assertFontArtifactRef(font, `${element.name}.font`);
|
|
182
|
+
return [font];
|
|
183
|
+
}
|
|
184
|
+
const stack = inline<FontStackRef>(resolved, `${element.name}.font`);
|
|
185
|
+
assertFontStackRef(stack, `${element.name}.font`);
|
|
186
|
+
return [...stack.faces];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function splitNumbers(value: string, label: string, count: 1 | 2 | 4): number[] {
|
|
190
|
+
const result = value.trim().split(/\s+/u).map(Number);
|
|
191
|
+
if (![1, 2, 4].includes(result.length) || result.some((item) => !Number.isFinite(item) || item < 0)) {
|
|
192
|
+
throw new Error(`${label} must contain one, two or four non-negative numbers.`);
|
|
193
|
+
}
|
|
194
|
+
if (count === 1) return [result[0]!];
|
|
195
|
+
if (count === 2) return result.length === 1 ? [result[0]!, result[0]!] : [result[0]!, result[1]!];
|
|
196
|
+
if (result.length === 1) return [result[0]!, result[0]!, result[0]!, result[0]!];
|
|
197
|
+
if (result.length === 2) return [result[0]!, result[1]!, result[0]!, result[1]!];
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function gradientStops(element: StructuredElement): Array<{ readonly offset: number; readonly color: string; readonly opacity: number }> {
|
|
202
|
+
const stops = element.children.flatMap((child) => {
|
|
203
|
+
if (child.kind === "text") {
|
|
204
|
+
if (child.value.trim()) throw new Error(`${element.name} accepts only Stop children.`);
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
if (localName(child.name) !== "Stop") throw new Error(`${element.name} accepts only Stop children.`);
|
|
208
|
+
allowed(child, ["offset", "color", "opacity"], ["offset", "color"]);
|
|
209
|
+
if (child.children.some((nested) => nested.kind === "element" || nested.value.trim())) throw new Error(`${child.name} must be empty.`);
|
|
210
|
+
return [{ offset: numeric(child, "offset"), color: text(child, "color"), opacity: numeric(child, "opacity", 1) }];
|
|
211
|
+
});
|
|
212
|
+
if (stops.length < 2) throw new Error(`${element.name} requires at least two Stops.`);
|
|
213
|
+
let previous = -1;
|
|
214
|
+
for (const [index, stop] of stops.entries()) {
|
|
215
|
+
if (stop.offset < 0 || stop.offset > 1 || stop.offset < previous || stop.opacity < 0 || stop.opacity > 1) {
|
|
216
|
+
throw new Error(`${element.name}.Stop.${index + 1} must have ordered offsets and normalized opacity.`);
|
|
217
|
+
}
|
|
218
|
+
previous = stop.offset;
|
|
219
|
+
}
|
|
220
|
+
return stops;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function gradient(element: StructuredElement): VisualColorPaint {
|
|
224
|
+
const name = localName(element.name);
|
|
225
|
+
if (name === "Linear") {
|
|
226
|
+
allowed(element, ["angle"], ["angle"]);
|
|
227
|
+
return { kind: "linear-gradient", angleDeg: numeric(element, "angle"), stops: gradientStops(element) };
|
|
228
|
+
}
|
|
229
|
+
if (name === "Radial") {
|
|
230
|
+
allowed(element, ["x", "y"], ["x", "y"]);
|
|
231
|
+
const center = { x: numeric(element, "x"), y: numeric(element, "y") };
|
|
232
|
+
if (center.x < 0 || center.x > 1 || center.y < 0 || center.y > 1) {
|
|
233
|
+
throw new Error(`${element.name} center must be normalized.`);
|
|
234
|
+
}
|
|
235
|
+
return { kind: "radial-gradient", center, stops: gradientStops(element) };
|
|
236
|
+
}
|
|
237
|
+
throw new Error(`${element.name} is not a gradient.`);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function paintFrom(element: StructuredElement, structuralChildren: readonly string[] = []): VisualColorPaint {
|
|
241
|
+
const color = optionalText(element, "color");
|
|
242
|
+
const gradients = element.children.filter((child): child is StructuredElement => child.kind === "element" && ["Linear", "Radial"].includes(localName(child.name)));
|
|
243
|
+
const unknown = element.children.filter((child): child is StructuredElement => child.kind === "element" && ![...structuralChildren, "Linear", "Radial"].includes(localName(child.name)));
|
|
244
|
+
if (unknown.length > 0) throw new Error(`${element.name} does not accept ${unknown[0]!.name}.`);
|
|
245
|
+
if (color !== undefined && gradients.length > 0) throw new Error(`${element.name} cannot combine color with a gradient.`);
|
|
246
|
+
if (gradients.length > 1) throw new Error(`${element.name} accepts one gradient.`);
|
|
247
|
+
if (color !== undefined) return { kind: "solid", color };
|
|
248
|
+
if (gradients[0] !== undefined) return gradient(gradients[0]);
|
|
249
|
+
throw new Error(`${element.name} requires color or one Linear/Radial child.`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function parseBox(element: StructuredElement): VisualTextPaintLayer {
|
|
253
|
+
allowed(element, [
|
|
254
|
+
"target", "continuity", "color", "padding", "radius", "border-color", "border-width", "border-style",
|
|
255
|
+
], ["target"]);
|
|
256
|
+
const target = text(element, "target") as Extract<VisualTextPaintLayer, { kind: "box" }>["target"];
|
|
257
|
+
if (!["frame", "content", "paragraph", "line", "run", "word", "grapheme"].includes(target)) throw new Error(`${element.name}.target is invalid.`);
|
|
258
|
+
const continuity = enumText(element, "continuity", ["isolated", "joined"] as const, "isolated");
|
|
259
|
+
if (continuity === "joined" && !["line", "word", "grapheme"].includes(target)) {
|
|
260
|
+
throw new Error(`${element.name}.continuity joined is invalid for ${target}.`);
|
|
261
|
+
}
|
|
262
|
+
const padding = splitNumbers(text(element, "padding", "0"), `${element.name}.padding`, 4);
|
|
263
|
+
const radius = splitNumbers(text(element, "radius", "0"), `${element.name}.radius`, 4);
|
|
264
|
+
const borderWidth = splitNumbers(text(element, "border-width", "0"), `${element.name}.border-width`, 4);
|
|
265
|
+
const shadows: Extract<VisualTextPaintLayer, { kind: "box" }>["decoration"]["shadows"][number][] = [];
|
|
266
|
+
let tail: Extract<VisualTextPaintLayer, { kind: "box" }>["decoration"]["tail"];
|
|
267
|
+
for (const child of element.children) {
|
|
268
|
+
if (child.kind === "text") {
|
|
269
|
+
if (child.value.trim()) throw new Error(`${element.name} accepts only gradient, BoxShadow and Tail children.`);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const name = localName(child.name);
|
|
273
|
+
if (name === "Linear" || name === "Radial") continue;
|
|
274
|
+
if (name === "BoxShadow") {
|
|
275
|
+
allowed(child, ["color", "x", "y", "blur", "spread"], ["color"]);
|
|
276
|
+
const blurPx = numeric(child, "blur", 0);
|
|
277
|
+
if (blurPx < 0) throw new Error(`${child.name}.blur must not be negative.`);
|
|
278
|
+
shadows.push({ paint: paintFrom(child), offsetX: numeric(child, "x", 0), offsetY: numeric(child, "y", 0), blurPx, spreadPx: numeric(child, "spread", 0) });
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if (name === "Tail") {
|
|
282
|
+
if (tail !== undefined) throw new Error(`${element.name} accepts one Tail.`);
|
|
283
|
+
allowed(child, ["side", "offset", "width", "height", "color"], ["side", "offset", "width", "height", "color"]);
|
|
284
|
+
empty(child);
|
|
285
|
+
const widthPx = numeric(child, "width");
|
|
286
|
+
const heightPx = numeric(child, "height");
|
|
287
|
+
if (widthPx < 0 || heightPx < 0) throw new Error(`${child.name} dimensions must not be negative.`);
|
|
288
|
+
tail = { side: enumText(child, "side", ["top", "right", "bottom", "left"] as const), offset: numeric(child, "offset"), widthPx, heightPx, paint: paintFrom(child) };
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const fill = element.attributes.color === undefined && !element.children.some((child) => child.kind === "element" && ["Linear", "Radial"].includes(localName(child.name)))
|
|
293
|
+
? undefined : paintFrom(element, ["BoxShadow", "Tail"]);
|
|
294
|
+
const borderColor = optionalText(element, "border-color");
|
|
295
|
+
return {
|
|
296
|
+
kind: "box", target, continuity,
|
|
297
|
+
decoration: {
|
|
298
|
+
...(fill === undefined ? {} : { fill }),
|
|
299
|
+
...(borderColor === undefined || borderWidth.every((value) => value === 0) ? {} : {
|
|
300
|
+
border: {
|
|
301
|
+
paint: { kind: "solid", color: borderColor },
|
|
302
|
+
widthsPx: { top: borderWidth[0]!, right: borderWidth[1]!, bottom: borderWidth[2]!, left: borderWidth[3]! },
|
|
303
|
+
style: text(element, "border-style", "solid") as "solid" | "dashed" | "dotted",
|
|
304
|
+
},
|
|
305
|
+
}),
|
|
306
|
+
paddingPx: { top: padding[0]!, right: padding[1]!, bottom: padding[2]!, left: padding[3]! },
|
|
307
|
+
radiiPx: { topLeft: radius[0]!, topRight: radius[1]!, bottomRight: radius[2]!, bottomLeft: radius[3]! },
|
|
308
|
+
shadows,
|
|
309
|
+
...(tail === undefined ? {} : { tail }),
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function parsePaintLayer(element: StructuredElement): VisualTextPaintLayer {
|
|
315
|
+
const name = localName(element.name);
|
|
316
|
+
if (name === "Fill") {
|
|
317
|
+
allowed(element, ["color"]);
|
|
318
|
+
return { kind: "fill", paint: paintFrom(element) };
|
|
319
|
+
}
|
|
320
|
+
if (name === "Stroke") {
|
|
321
|
+
allowed(element, ["color", "width", "placement"], ["width", "placement"]);
|
|
322
|
+
const placement = enumText(element, "placement", ["inside", "center", "outside"] as const);
|
|
323
|
+
const widthPx = numeric(element, "width");
|
|
324
|
+
if (widthPx < 0) throw new Error(`${element.name}.width must not be negative.`);
|
|
325
|
+
return { kind: "stroke", paint: paintFrom(element), widthPx, placement };
|
|
326
|
+
}
|
|
327
|
+
if (name === "Shadow") {
|
|
328
|
+
allowed(element, ["color", "x", "y", "blur", "spread"], ["x", "y", "blur"]);
|
|
329
|
+
const blurPx = numeric(element, "blur");
|
|
330
|
+
if (blurPx < 0) throw new Error(`${element.name}.blur must not be negative.`);
|
|
331
|
+
return { kind: "shadow", paint: paintFrom(element), offsetX: numeric(element, "x"), offsetY: numeric(element, "y"), blurPx, spreadPx: numeric(element, "spread", 0) };
|
|
332
|
+
}
|
|
333
|
+
if (name === "Glow") {
|
|
334
|
+
allowed(element, ["color", "blur", "spread"], ["blur"]);
|
|
335
|
+
const blurPx = numeric(element, "blur");
|
|
336
|
+
const spreadPx = numeric(element, "spread", 0);
|
|
337
|
+
if (blurPx < 0 || spreadPx < 0) throw new Error(`${element.name} blur and spread must not be negative.`);
|
|
338
|
+
return { kind: "glow", paint: paintFrom(element), blurPx, spreadPx };
|
|
339
|
+
}
|
|
340
|
+
if (name === "Box") return parseBox(element);
|
|
341
|
+
throw new Error(`${element.name} is not a Text Paint layer.`);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const STYLE_PROPERTIES = new Set([
|
|
345
|
+
"stack-order", "size", "weight", "font-style", "line-height", "tracking", "word-spacing",
|
|
346
|
+
"kerning", "synthesis", "language", "direction", "writing-mode", "baseline-shift", "vertical-align", "tab-size", "indent",
|
|
347
|
+
"paragraph-before", "paragraph-after", "transform", "caps", "cjk-spacing", "punctuation-trim",
|
|
348
|
+
"fill", "inline-size", "block-size", "padding", "align", "block-align", "wrap", "overflow",
|
|
349
|
+
"max-lines", "minimum-scale", "clip", "columns", "column-gap", "metric-edge",
|
|
350
|
+
"point-anchor-inline", "point-anchor-block", "path-side", "path-orientation", "path-start-margin",
|
|
351
|
+
"path-end-margin", "path-align", "path-reverse", "path-overflow",
|
|
352
|
+
]);
|
|
353
|
+
|
|
354
|
+
export const decodeTypographyStyleSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
|
|
355
|
+
allowed(element, ["id", "recipe", "font"], ["id", "recipe", "font"]);
|
|
356
|
+
const id = text(element, "id");
|
|
357
|
+
const value = recipe(reference(element.attributes.recipe, `${element.name}.recipe`, svsRecipeType, resolveReference), `${element.name}.recipe`);
|
|
358
|
+
const unknown = Object.keys(value.properties).filter((name) => !STYLE_PROPERTIES.has(name));
|
|
359
|
+
if (unknown.length > 0) throw new Error(`Text Recipe does not accept ${unknown[0]}.`);
|
|
360
|
+
const fonts = exactFonts(element, resolveReference);
|
|
361
|
+
const padding = splitNumbers(propString(value, "padding", "0"), "Text Recipe padding", 4);
|
|
362
|
+
const overflow = propString(value, "overflow", "visible") as TextStyle["area"]["overflow"];
|
|
363
|
+
const paints: VisualTextPaintLayer[] = [];
|
|
364
|
+
const axes: VisualTextTypography["axes"][number][] = [];
|
|
365
|
+
const features: VisualTextTypography["features"][number][] = [];
|
|
366
|
+
const decorations: VisualTextTypography["decorations"][number][] = [];
|
|
367
|
+
if (value.properties.fill !== undefined) paints.push({ kind: "fill", paint: { kind: "solid", color: propString(value, "fill") } });
|
|
368
|
+
for (const child of element.children) {
|
|
369
|
+
if (child.kind === "text") {
|
|
370
|
+
if (child.value.trim()) throw new Error(`${element.name} accepts only Paint children.`);
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
const name = localName(child.name);
|
|
374
|
+
if (name === "Axis") {
|
|
375
|
+
allowed(child, ["tag", "value"], ["tag", "value"]);
|
|
376
|
+
empty(child);
|
|
377
|
+
const tag = text(child, "tag");
|
|
378
|
+
if (!/^[\x20-\x7e]{4}$/u.test(tag) || axes.some((axis) => axis.tag === tag)) throw new Error(`${child.name}.tag must be one unique four-byte OpenType tag.`);
|
|
379
|
+
axes.push({ tag, value: numeric(child, "value") });
|
|
380
|
+
} else if (name === "Feature") {
|
|
381
|
+
allowed(child, ["tag", "enabled"], ["tag", "enabled"]);
|
|
382
|
+
empty(child);
|
|
383
|
+
const tag = text(child, "tag");
|
|
384
|
+
if (!/^[\x20-\x7e]{4}$/u.test(tag) || features.some((feature) => feature.tag === tag)) throw new Error(`${child.name}.tag must be one unique four-byte OpenType tag.`);
|
|
385
|
+
features.push({ tag, enabled: booleanValue(child.attributes.enabled, `${child.name}.enabled`, false) });
|
|
386
|
+
} else if (name === "Decoration") {
|
|
387
|
+
allowed(child, ["line", "color", "style", "thickness", "offset", "skip-ink"], ["line"]);
|
|
388
|
+
const line = enumText(child, "line", ["underline", "overline", "line-through"] as const);
|
|
389
|
+
if (decorations.some((decoration) => decoration.line === line)) throw new Error(`${child.name}.line ${line} is repeated.`);
|
|
390
|
+
const thicknessPx = child.attributes.thickness === undefined ? undefined : numeric(child, "thickness");
|
|
391
|
+
if (thicknessPx !== undefined && thicknessPx < 0) throw new Error(`${child.name}.thickness must not be negative.`);
|
|
392
|
+
decorations.push({
|
|
393
|
+
line,
|
|
394
|
+
paint: paintFrom(child),
|
|
395
|
+
style: enumText(child, "style", ["solid", "double", "dotted", "dashed", "wavy"] as const, "solid"),
|
|
396
|
+
...(thicknessPx === undefined ? {} : { thicknessPx }),
|
|
397
|
+
...(child.attributes.offset === undefined ? {} : { offsetPx: numeric(child, "offset") }),
|
|
398
|
+
skipInk: booleanValue(child.attributes["skip-ink"], `${child.name}.skip-ink`, true),
|
|
399
|
+
});
|
|
400
|
+
} else paints.push(parsePaintLayer(child));
|
|
401
|
+
}
|
|
402
|
+
if (!paints.some((paint) => paint.kind === "fill" || paint.kind === "stroke")) {
|
|
403
|
+
throw new Error(`${element.name} requires at least one visible glyph Fill or Stroke.`);
|
|
404
|
+
}
|
|
405
|
+
const style = sealTextStyle({
|
|
406
|
+
id,
|
|
407
|
+
stackingOrder: propNumber(value, "stack-order"),
|
|
408
|
+
typography: {
|
|
409
|
+
fonts,
|
|
410
|
+
sizePx: propNumber(value, "size"), weight: propNumber(value, "weight", 400),
|
|
411
|
+
style: propString(value, "font-style", "normal") as "normal" | "italic" | "oblique",
|
|
412
|
+
axes, features, synthesis: propString(value, "synthesis", "none") as TextStyle["typography"]["synthesis"],
|
|
413
|
+
kerning: propString(value, "kerning", "auto") as TextStyle["typography"]["kerning"],
|
|
414
|
+
trackingPx: propNumber(value, "tracking", 0), wordSpacingPx: propNumber(value, "word-spacing", 0),
|
|
415
|
+
lineHeight: propNumber(value, "line-height", 1.2),
|
|
416
|
+
...(value.properties.language === undefined ? {} : { language: propString(value, "language") }),
|
|
417
|
+
direction: propString(value, "direction", "auto") as TextStyle["typography"]["direction"],
|
|
418
|
+
writingMode: propString(value, "writing-mode", "horizontal-tb") as TextStyle["typography"]["writingMode"],
|
|
419
|
+
baselineShiftPx: propNumber(value, "baseline-shift", 0), tabSize: propNumber(value, "tab-size", 4),
|
|
420
|
+
indentationPx: propNumber(value, "indent", 0), paragraphBeforePx: propNumber(value, "paragraph-before", 0),
|
|
421
|
+
paragraphAfterPx: propNumber(value, "paragraph-after", 0),
|
|
422
|
+
transform: propString(value, "transform", "none") as TextStyle["typography"]["transform"],
|
|
423
|
+
variantCaps: propString(value, "caps", "normal") as TextStyle["typography"]["variantCaps"],
|
|
424
|
+
verticalAlign: propString(value, "vertical-align", "baseline") as TextStyle["typography"]["verticalAlign"],
|
|
425
|
+
decorations,
|
|
426
|
+
cjk: {
|
|
427
|
+
textSpacing: propString(value, "cjk-spacing", "normal") as "normal" | "none",
|
|
428
|
+
punctuationTrim: propString(value, "punctuation-trim", "none") as "none" | "start" | "end" | "adjacent" | "all",
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
paints,
|
|
432
|
+
area: {
|
|
433
|
+
inlineSize: propString(value, "inline-size", "fixed") as "hug" | "fixed",
|
|
434
|
+
blockSize: propString(value, "block-size", "fixed") as "hug" | "fixed",
|
|
435
|
+
paddingPx: { inlineStart: padding[3]!, inlineEnd: padding[1]!, blockStart: padding[0]!, blockEnd: padding[2]! },
|
|
436
|
+
inlineAlign: propString(value, "align", "center") as TextStyle["area"]["inlineAlign"],
|
|
437
|
+
blockAlign: propString(value, "block-align", "center") as TextStyle["area"]["blockAlign"],
|
|
438
|
+
wrap: propString(value, "wrap", "word") as TextStyle["area"]["wrap"],
|
|
439
|
+
overflow,
|
|
440
|
+
...(value.properties["max-lines"] === undefined ? {} : { maxLines: propNumber(value, "max-lines") }),
|
|
441
|
+
...(overflow !== "shrink" ? {} : { minimumScale: propNumber(value, "minimum-scale") }),
|
|
442
|
+
clipToFrame: propBoolean(value, "clip", false), columns: propNumber(value, "columns", 1),
|
|
443
|
+
columnGapPx: propNumber(value, "column-gap", 0),
|
|
444
|
+
metricEdge: propString(value, "metric-edge", "line-box") as TextStyle["area"]["metricEdge"],
|
|
445
|
+
},
|
|
446
|
+
point: {
|
|
447
|
+
anchorInline: propString(value, "point-anchor-inline", "center") as TextStyle["point"]["anchorInline"],
|
|
448
|
+
anchorBlock: propString(value, "point-anchor-block", "center") as TextStyle["point"]["anchorBlock"],
|
|
449
|
+
},
|
|
450
|
+
path: {
|
|
451
|
+
side: propString(value, "path-side", "left") as "left" | "right",
|
|
452
|
+
orientation: propString(value, "path-orientation", "follow") as "follow" | "upright",
|
|
453
|
+
startMarginPx: propNumber(value, "path-start-margin", 0), endMarginPx: propNumber(value, "path-end-margin", 0),
|
|
454
|
+
align: propString(value, "path-align", "start") as "start" | "center" | "end",
|
|
455
|
+
reverse: propBoolean(value, "path-reverse", false), overflow: propString(value, "path-overflow", "visible") as "visible" | "clip",
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
return { records: [{ id, type: typographyTrackTypes.style, value: { kind: "inline", value: style }, range: element.range }], components: [], fragments: [] };
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
function keyframeStyle(element: StructuredElement): VisualStyleDeclaration[] {
|
|
462
|
+
const result: VisualStyleDeclaration[] = [];
|
|
463
|
+
const x = numeric(element, "x", 0);
|
|
464
|
+
const y = numeric(element, "y", 0);
|
|
465
|
+
const scale = numeric(element, "scale", 1);
|
|
466
|
+
const rotate = numeric(element, "rotate", 0);
|
|
467
|
+
const skewX = numeric(element, "skew-x", 0);
|
|
468
|
+
const skewY = numeric(element, "skew-y", 0);
|
|
469
|
+
if (["x", "y", "scale", "rotate", "skew-x", "skew-y"].some((name) => element.attributes[name] !== undefined)) {
|
|
470
|
+
result.push({ name: "transform", value: `translate(${x}px,${y}px) scale(${scale}) rotate(${rotate}deg) skew(${skewX}deg,${skewY}deg)` });
|
|
471
|
+
}
|
|
472
|
+
if (element.attributes.opacity !== undefined) result.push({ name: "opacity", value: numeric(element, "opacity") });
|
|
473
|
+
if (element.attributes.blur !== undefined) result.push({ name: "filter", value: `blur(${numeric(element, "blur")}px)` });
|
|
474
|
+
if (element.attributes.color !== undefined) result.push({ name: "color", value: text(element, "color") });
|
|
475
|
+
if (["clip-top", "clip-right", "clip-bottom", "clip-left"].some((name) => element.attributes[name] !== undefined)) {
|
|
476
|
+
result.push({ name: "clip-path", value: `inset(${numeric(element, "clip-top", 0)}% ${numeric(element, "clip-right", 0)}% ${numeric(element, "clip-bottom", 0)}% ${numeric(element, "clip-left", 0)}%)` });
|
|
477
|
+
}
|
|
478
|
+
if (result.length === 0) throw new Error(`${element.name} must animate at least one property.`);
|
|
479
|
+
return result;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const KEYFRAME_ATTRIBUTES = ["at", "easing", "x", "y", "scale", "rotate", "skew-x", "skew-y", "opacity", "blur", "color", "clip-top", "clip-right", "clip-bottom", "clip-left"] as const;
|
|
483
|
+
|
|
484
|
+
export const decodeTypographyMotionSurface: StructuredSurfaceHandler = ({ element }) => {
|
|
485
|
+
allowed(element, ["id"], ["id"]);
|
|
486
|
+
const id = text(element, "id");
|
|
487
|
+
const itemKeyframes: NonNullable<TextMotion["item"]>["keyframes"][number][] = [];
|
|
488
|
+
const pathKeyframes: NonNullable<TextMotion["pathMargin"]>["keyframes"][number][] = [];
|
|
489
|
+
const sequences: VisualTextSequenceAnimation[] = [];
|
|
490
|
+
for (const child of element.children) {
|
|
491
|
+
if (child.kind === "text") {
|
|
492
|
+
if (child.value.trim()) throw new Error(`${element.name} accepts ItemKeyframe, PathKeyframe and Sequence children.`);
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
const name = localName(child.name);
|
|
496
|
+
if (name === "ItemKeyframe") {
|
|
497
|
+
allowed(child, KEYFRAME_ATTRIBUTES, ["at"]);
|
|
498
|
+
if (child.children.some((nested) => nested.kind === "element" || nested.value.trim())) throw new Error(`${child.name} must be empty.`);
|
|
499
|
+
itemKeyframes.push({ atFrame: integer(child, "at"), ...(child.attributes.easing === undefined ? {} : { easing: text(child, "easing") as "linear" | "ease-in" | "ease-out" | "ease-in-out" }), style: keyframeStyle(child) });
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (name === "PathKeyframe") {
|
|
503
|
+
allowed(child, ["at", "margin", "easing"], ["at", "margin"]);
|
|
504
|
+
pathKeyframes.push({ atFrame: integer(child, "at"), startMarginPx: numeric(child, "margin"), ...(child.attributes.easing === undefined ? {} : { easing: text(child, "easing") as "linear" | "ease-in" | "ease-out" | "ease-in-out" }) });
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
if (name !== "Sequence") throw new Error(`${element.name} does not accept ${child.name}.`);
|
|
508
|
+
allowed(child, ["id", "unit", "start-index", "end-index", "order", "start-frame", "duration-frames", "stagger-frames", "cycles", "seed"], ["id", "unit", "start-index", "end-index", "duration-frames"]);
|
|
509
|
+
const keyframes = child.children.flatMap((nested) => {
|
|
510
|
+
if (nested.kind === "text") {
|
|
511
|
+
if (nested.value.trim()) throw new Error(`${child.name} accepts only Keyframe children.`);
|
|
512
|
+
return [];
|
|
513
|
+
}
|
|
514
|
+
if (localName(nested.name) !== "Keyframe") throw new Error(`${child.name} accepts only Keyframe children.`);
|
|
515
|
+
allowed(nested, KEYFRAME_ATTRIBUTES, ["at"]);
|
|
516
|
+
return [{ atProgress: numeric(nested, "at"), ...(nested.attributes.easing === undefined ? {} : { easing: text(nested, "easing") as "linear" | "ease-in" | "ease-out" | "ease-in-out" }), style: keyframeStyle(nested) }];
|
|
517
|
+
});
|
|
518
|
+
sequences.push({
|
|
519
|
+
id: text(child, "id"), unit: text(child, "unit") as VisualTextSequenceAnimation["unit"],
|
|
520
|
+
range: { start: integer(child, "start-index"), endExclusive: integer(child, "end-index") },
|
|
521
|
+
order: text(child, "order", "forward") as VisualTextSequenceAnimation["order"],
|
|
522
|
+
startFrame: integer(child, "start-frame", 0), unitDurationFrames: integer(child, "duration-frames"),
|
|
523
|
+
staggerFrames: integer(child, "stagger-frames", 0), cycles: integer(child, "cycles", 1),
|
|
524
|
+
...(child.attributes.seed === undefined ? {} : { seed: integer(child, "seed") }), keyframes,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
const motion = sealTextMotion({
|
|
528
|
+
id,
|
|
529
|
+
...(itemKeyframes.length === 0 ? {} : { item: { keyframes: itemKeyframes } }),
|
|
530
|
+
sequences,
|
|
531
|
+
...(pathKeyframes.length === 0 ? {} : { pathMargin: { keyframes: pathKeyframes } }),
|
|
532
|
+
});
|
|
533
|
+
return { records: [{ id, type: typographyTrackTypes.motion, value: { kind: "inline", value: motion }, range: element.range }], components: [], fragments: [] };
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
function dedent(value: string): string {
|
|
537
|
+
const lines = value.replace(/^\n/u, "").replace(/\n\s*$/u, "").split("\n");
|
|
538
|
+
const indentation = lines.filter((line) => line.trim()).reduce((min, line) => Math.min(min, /^\s*/u.exec(line)?.[0].length ?? 0), Number.POSITIVE_INFINITY);
|
|
539
|
+
return lines.map((line) => line.slice(Number.isFinite(indentation) ? indentation : 0)).join("\n");
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function runStyle(value: SurfaceResolvedReference): VisualTextRunStyle {
|
|
543
|
+
const style = inline<TextStyle>(value, "Text inline Style");
|
|
544
|
+
return { typography: style.typography, paints: style.paints };
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function paragraph(element: StructuredElement, index: number, resolve: (path: string) => SurfaceResolvedReference | undefined): VisualTextDocument["paragraphs"][number] {
|
|
548
|
+
allowed(element, ["id", "style"]);
|
|
549
|
+
const inlines: VisualTextDocument["paragraphs"][number]["inlines"][number][] = [];
|
|
550
|
+
// Source indentation belongs to the file, not to the words. An item's own direct text is dedented
|
|
551
|
+
// and a paragraph's was not, so the same copy read differently depending only on whether it was
|
|
552
|
+
// written inside <P>. Dedent the paragraph as one block, with each nested element standing in as a
|
|
553
|
+
// zero-width mark: measuring the common indentation line by line needs the runs in their places,
|
|
554
|
+
// and a Span in the middle of a line would otherwise look like a line of its own.
|
|
555
|
+
const mark = "\u0000";
|
|
556
|
+
const merged: (typeof element.children)[number][] = [];
|
|
557
|
+
for (const child of element.children) {
|
|
558
|
+
const previous = merged.at(-1);
|
|
559
|
+
if (child.kind === "text" && previous?.kind === "text") {
|
|
560
|
+
merged[merged.length - 1] = { ...previous, value: `${previous.value}${child.value}` };
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
merged.push(child);
|
|
564
|
+
}
|
|
565
|
+
const segments = dedent(merged.map((child) => child.kind === "text" ? child.value : mark).join("")).split(mark);
|
|
566
|
+
// One segment lies before each mark and one after the last, so a text run reads the segment at the
|
|
567
|
+
// current mark and only a nested element moves on to the next.
|
|
568
|
+
let segmentIndex = 0;
|
|
569
|
+
let inlineIndex = 0;
|
|
570
|
+
for (const child of merged) {
|
|
571
|
+
inlineIndex += 1;
|
|
572
|
+
if (child.kind === "text") {
|
|
573
|
+
const value = segments[segmentIndex] ?? child.value;
|
|
574
|
+
if (value.length > 0) inlines.push({ kind: "text", id: `run-${inlineIndex}`, text: value });
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
segmentIndex += 1;
|
|
578
|
+
const name = localName(child.name);
|
|
579
|
+
if (name === "Break") {
|
|
580
|
+
allowed(child, []);
|
|
581
|
+
// A break carries nothing, and text written inside one was being dropped without a word.
|
|
582
|
+
empty(child);
|
|
583
|
+
inlines.push({ kind: "break", id: `break-${inlineIndex}` });
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
if (name !== "Span") throw new Error(`${element.name} accepts text, Span and Break children.`);
|
|
587
|
+
allowed(child, ["id", "style", "language", "direction"]);
|
|
588
|
+
if (child.children.some((nested) => nested.kind === "element")) throw new Error(`${child.name} cannot contain nested elements.`);
|
|
589
|
+
const spanText = child.children.map((nested) => nested.kind === "text" ? nested.value : "").join("");
|
|
590
|
+
if (spanText.length === 0) throw new Error(`${child.name} cannot be empty.`);
|
|
591
|
+
const styleRef = child.attributes.style === undefined ? undefined : reference(child.attributes.style, `${child.name}.style`, typographyTrackTypes.style, resolve);
|
|
592
|
+
inlines.push({
|
|
593
|
+
kind: "text", id: optionalText(child, "id") ?? `run-${inlineIndex}`, text: spanText,
|
|
594
|
+
...(styleRef === undefined ? {} : { style: runStyle(styleRef) }),
|
|
595
|
+
...(child.attributes.language === undefined ? {} : { language: text(child, "language") }),
|
|
596
|
+
...(child.attributes.direction === undefined ? {} : { direction: enumText(child, "direction", ["auto", "ltr", "rtl"] as const) }),
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
if (inlines.length === 0) throw new Error(`${element.name} cannot be empty.`);
|
|
600
|
+
const styleRef = element.attributes.style === undefined ? undefined : reference(element.attributes.style, `${element.name}.style`, typographyTrackTypes.style, resolve);
|
|
601
|
+
return { id: optionalText(element, "id") ?? `paragraph-${index}`, inlines, ...(styleRef === undefined ? {} : { style: runStyle(styleRef) }) };
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function document(element: StructuredElement, resolve: (path: string) => SurfaceResolvedReference | undefined): VisualTextDocument {
|
|
605
|
+
const paragraphChildren = element.children.filter((child): child is StructuredElement => child.kind === "element" && localName(child.name) === "P");
|
|
606
|
+
if (paragraphChildren.length > 0) {
|
|
607
|
+
const invalid = element.children.find((child) => child.kind === "element" ? localName(child.name) !== "P" : child.value.trim().length > 0);
|
|
608
|
+
if (invalid !== undefined) throw new Error(`${element.name} cannot mix P children with direct text.`);
|
|
609
|
+
return { paragraphs: paragraphChildren.map((child, index) => paragraph(child, index + 1, resolve)) };
|
|
610
|
+
}
|
|
611
|
+
if (element.children.some((child) => child.kind === "element")) throw new Error(`${element.name} direct content accepts no nested elements; use P and Span.`);
|
|
612
|
+
const content = dedent(element.children.map((child) => child.kind === "text" ? child.value : "").join(""));
|
|
613
|
+
if (!content.trim()) throw new Error(`${element.name} requires text content.`);
|
|
614
|
+
return { paragraphs: [{ id: "paragraph-1", inlines: [{ kind: "text", id: "run-1", text: content }] }] };
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
type FragmentItem = {
|
|
618
|
+
readonly suffix: string;
|
|
619
|
+
readonly windowName: string;
|
|
620
|
+
readonly placementKind: "point" | "area" | "path";
|
|
621
|
+
readonly geometryName: string;
|
|
622
|
+
readonly specName: string;
|
|
623
|
+
readonly contentName?: string;
|
|
624
|
+
readonly styleName: string;
|
|
625
|
+
readonly motionName: string;
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
function createTrackFragment(id: string, items: readonly FragmentItem[]): GraphFragment {
|
|
629
|
+
const operations: FragmentOperation[] = [
|
|
630
|
+
{ id: "text:set:empty", producer: typographyTrackProducers.createSet, inputs: {}, result: { kind: "output", name: "set" } },
|
|
631
|
+
];
|
|
632
|
+
let current = "text:set:empty";
|
|
633
|
+
for (const [index, item] of items.entries()) {
|
|
634
|
+
const bind = `text:placement:${String(index + 1).padStart(4, "0")}`;
|
|
635
|
+
operations.push({
|
|
636
|
+
id: bind,
|
|
637
|
+
producer: item.placementKind === "point" ? typographyTrackProducers.bindPoint : item.placementKind === "area" ? typographyTrackProducers.bindArea : typographyTrackProducers.bindPath,
|
|
638
|
+
inputs: { [item.placementKind === "point" ? "point" : item.placementKind === "area" ? "frame" : "path"]: input(item.geometryName) },
|
|
639
|
+
result: { kind: "output", name: "placement" },
|
|
640
|
+
});
|
|
641
|
+
const materialized = `text:content:${String(index + 1).padStart(4, "0")}`;
|
|
642
|
+
if (item.contentName !== undefined) {
|
|
643
|
+
operations.push({
|
|
644
|
+
id: materialized,
|
|
645
|
+
producer: typographyTrackProducers.materializePlainItem,
|
|
646
|
+
inputs: { spec: input(item.specName), content: input(item.contentName) },
|
|
647
|
+
result: { kind: "output", name: "spec" },
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
const append = `text:set:append:${String(index + 1).padStart(4, "0")}`;
|
|
651
|
+
const common = {
|
|
652
|
+
set: operation(current), header: input("header"), space: input("space"), placement: operation(bind),
|
|
653
|
+
spec: item.contentName === undefined ? input(item.specName) : operation(materialized),
|
|
654
|
+
style: input(item.styleName), motion: input(item.motionName), window: input(item.windowName),
|
|
655
|
+
};
|
|
656
|
+
operations.push({ id: append, producer: typographyTrackProducers.appendItem, inputs: common, result: { kind: "output", name: "set" } });
|
|
657
|
+
current = append;
|
|
658
|
+
}
|
|
659
|
+
operations.push(
|
|
660
|
+
{ id: "text:finalize", producer: typographyTrackProducers.finalize, inputs: { header: input("header"), set: operation(current) }, result: { kind: "output", name: "program" } },
|
|
661
|
+
{ id: "text:render", producer: typographyTrackProducers.render, inputs: { space: input("space"), program: operation("text:finalize") }, result: { kind: "output", name: "track" } },
|
|
662
|
+
);
|
|
663
|
+
const inputEntries = [
|
|
664
|
+
{ name: "space", type: programSpaceTypes.programSpace },
|
|
665
|
+
{ name: "header", type: typographyTrackTypes.header },
|
|
666
|
+
...items.flatMap((item) => [
|
|
667
|
+
{ name: item.geometryName, type: item.placementKind === "point" ? spatialTypes.point : item.placementKind === "area" ? spatialTypes.frame : spatialTypes.path },
|
|
668
|
+
{ name: item.specName, type: item.contentName === undefined ? typographyTrackTypes.itemSpec : typographyTrackTypes.plainItemSpec },
|
|
669
|
+
...(item.contentName === undefined ? [] : [{ name: item.contentName, type: textTypes.text }]),
|
|
670
|
+
{ name: item.styleName, type: typographyTrackTypes.style },
|
|
671
|
+
{ name: item.motionName, type: typographyTrackTypes.motion },
|
|
672
|
+
{ name: item.windowName, type: temporalTypes.window },
|
|
673
|
+
]),
|
|
674
|
+
];
|
|
675
|
+
const inputs = [...new Map(inputEntries.map((value) => [value.name, value])).values()];
|
|
676
|
+
return sealGraphFragment({
|
|
677
|
+
inputs,
|
|
678
|
+
operations,
|
|
679
|
+
exports: [
|
|
680
|
+
{
|
|
681
|
+
name: "program", type: typographyTrackTypes.program, root: operation("text:finalize"),
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: "track", type: compositionTypes.visualTrack, root: operation("text:render"),
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
export const decodeTypographyTrackSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
|
|
691
|
+
allowed(element, ["id", "semantic", "space"], ["id"]);
|
|
692
|
+
const id = text(element, "id");
|
|
693
|
+
const context = resolveTemporalContext({ element, resolveReference });
|
|
694
|
+
const time = createTemporalSpace({ id: id, element, ...context });
|
|
695
|
+
const headerId = `${id}.__header`;
|
|
696
|
+
const records: SurfaceRecordDraft[] = [{
|
|
697
|
+
id: headerId, type: typographyTrackTypes.header,
|
|
698
|
+
value: { kind: "inline", value: sealTypographyTrackHeader({ id }) }, range: element.range,
|
|
699
|
+
}];
|
|
700
|
+
const defaultMotionId = `${id}.__still-motion`;
|
|
701
|
+
records.push({ id: defaultMotionId, type: typographyTrackTypes.motion, value: { kind: "inline", value: stillTextMotion(defaultMotionId) }, range: element.range });
|
|
702
|
+
const temporalComponents: SurfaceComponentDraft[] = [...time.components];
|
|
703
|
+
const temporalFragments: ReturnType<typeof createTemporalWindowProjection>["fragments"][number][] = [...time.fragments];
|
|
704
|
+
const items: Array<FragmentItem & {
|
|
705
|
+
readonly geometry: SurfaceResolvedReference;
|
|
706
|
+
readonly style: SurfaceResolvedReference;
|
|
707
|
+
readonly motion: AuthorValueRef;
|
|
708
|
+
readonly window: ReturnType<typeof createTemporalWindowProjection>["ref"];
|
|
709
|
+
readonly content?: SurfaceResolvedReference;
|
|
710
|
+
readonly specId: string;
|
|
711
|
+
}> = [];
|
|
712
|
+
const sharedInputNames = new Map<string, string>();
|
|
713
|
+
const sharedInputName = (prefix: string, ref: AuthorValueRef, suffix: string): string => {
|
|
714
|
+
const key = `${prefix}:${JSON.stringify(ref)}`;
|
|
715
|
+
const existing = sharedInputNames.get(key);
|
|
716
|
+
if (existing !== undefined) return existing;
|
|
717
|
+
const name = `item-${suffix}-${prefix}`;
|
|
718
|
+
sharedInputNames.set(key, name);
|
|
719
|
+
return name;
|
|
720
|
+
};
|
|
721
|
+
for (const child of element.children) {
|
|
722
|
+
if (child.kind === "text") {
|
|
723
|
+
if (child.value.trim()) throw new Error(`${element.name} accepts Point, Area and Path children.`);
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
const form = localName(child.name);
|
|
727
|
+
if (form !== "Point" && form !== "Area" && form !== "Path") throw new Error(`${element.name} accepts Point, Area and Path children.`);
|
|
728
|
+
const index = items.length + 1;
|
|
729
|
+
const suffix = String(index).padStart(4, "0");
|
|
730
|
+
allowed(child, [
|
|
731
|
+
"id", "content", "placement", "style", "motion", ...temporalWindowAttributeNames,
|
|
732
|
+
], ["id", "placement", "style"]);
|
|
733
|
+
const itemId = text(child, "id");
|
|
734
|
+
const temporal = createTemporalWindowProjection({ id: itemId, element: child, ...context, space: time.space, resolveReference });
|
|
735
|
+
records.push(...temporal.records); temporalComponents.push(...temporal.components); temporalFragments.push(...temporal.fragments);
|
|
736
|
+
const placementKind = form.toLowerCase() as "point" | "area" | "path";
|
|
737
|
+
const geometry = reference(child.attributes.placement, `${child.name}.placement`, placementKind === "point" ? spatialTypes.point : placementKind === "area" ? spatialTypes.frame : spatialTypes.path, resolveReference);
|
|
738
|
+
const style = reference(child.attributes.style, `${child.name}.style`, typographyTrackTypes.style, resolveReference);
|
|
739
|
+
const motionRef = child.attributes.motion === undefined
|
|
740
|
+
? ({ kind: "record", id: defaultMotionId } as const)
|
|
741
|
+
: reference(child.attributes.motion, `${child.name}.motion`, typographyTrackTypes.motion, resolveReference).ref;
|
|
742
|
+
const specId = `${id}.item.${suffix}.spec`;
|
|
743
|
+
const windowName = `item-${suffix}-window`;
|
|
744
|
+
const content = child.attributes.content === undefined
|
|
745
|
+
? undefined
|
|
746
|
+
: reference(child.attributes.content, `${child.name}.content`, textTypes.text, resolveReference);
|
|
747
|
+
if (content !== undefined) empty(child);
|
|
748
|
+
const spec = content === undefined
|
|
749
|
+
? sealTextItemSpec({
|
|
750
|
+
id: itemId,
|
|
751
|
+
document: document(child, resolveReference),
|
|
752
|
+
})
|
|
753
|
+
: sealPlainTextItemSpec({
|
|
754
|
+
id: itemId,
|
|
755
|
+
});
|
|
756
|
+
records.push({
|
|
757
|
+
id: specId,
|
|
758
|
+
type: content === undefined ? typographyTrackTypes.itemSpec : typographyTrackTypes.plainItemSpec,
|
|
759
|
+
value: { kind: "inline", value: spec }, range: child.range,
|
|
760
|
+
});
|
|
761
|
+
items.push({
|
|
762
|
+
suffix, placementKind, windowName,
|
|
763
|
+
geometryName: sharedInputName("geometry", geometry.ref, suffix), specName: `item-${suffix}-spec`,
|
|
764
|
+
styleName: sharedInputName("style", style.ref, suffix), motionName: sharedInputName("motion", motionRef, suffix),
|
|
765
|
+
...(content === undefined ? {} : { contentName: sharedInputName("content", content.ref, suffix), content }),
|
|
766
|
+
geometry, style, motion: motionRef, specId, window: temporal.ref,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
if (items.length === 0) throw new Error(`${element.name} requires at least one Point, Area or Path.`);
|
|
770
|
+
const fragmentItems: FragmentItem[] = items.map(({ suffix, placementKind, geometryName, specName, styleName, motionName, contentName, windowName }) => ({
|
|
771
|
+
suffix, placementKind, geometryName, specName, styleName, motionName, windowName,
|
|
772
|
+
...(contentName === undefined ? {} : { contentName }),
|
|
773
|
+
}));
|
|
774
|
+
const fragment = createTrackFragment(id, fragmentItems);
|
|
775
|
+
return {
|
|
776
|
+
records,
|
|
777
|
+
components: [...temporalComponents, {
|
|
778
|
+
id, fragment: fragment.id,
|
|
779
|
+
inputs: {
|
|
780
|
+
space: time.space.ref, header: { kind: "record", id: headerId },
|
|
781
|
+
...Object.fromEntries(items.flatMap((item) => [
|
|
782
|
+
[item.geometryName, item.geometry.ref], [item.specName, { kind: "record" as const, id: item.specId }],
|
|
783
|
+
[item.windowName, item.window],
|
|
784
|
+
[item.styleName, item.style.ref], [item.motionName, item.motion],
|
|
785
|
+
...(item.content === undefined ? [] : [[item.contentName!, item.content.ref] as const]),
|
|
786
|
+
])),
|
|
787
|
+
},
|
|
788
|
+
outputs: { program: `${id}.program`, track: `${id}.track` }, range: element.range,
|
|
789
|
+
}],
|
|
790
|
+
fragments: [...temporalFragments, fragment],
|
|
791
|
+
exports: [`${id}.program`, `${id}.track`],
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
function createMaskFragment(id: string): GraphFragment {
|
|
796
|
+
const inputs = [
|
|
797
|
+
{ name: "space", type: programSpaceTypes.programSpace },
|
|
798
|
+
{ name: "program", type: typographyTrackTypes.program },
|
|
799
|
+
{ name: "material", type: mediaTypes.compositableSurface },
|
|
800
|
+
{ name: "spec", type: typographyTrackTypes.maskSpec },
|
|
801
|
+
];
|
|
802
|
+
return sealGraphFragment({
|
|
803
|
+
inputs,
|
|
804
|
+
operations: [
|
|
805
|
+
{
|
|
806
|
+
id: "text-mask:render", producer: typographyTrackProducers.renderMask,
|
|
807
|
+
inputs: { space: input("space"), program: input("program"), material: input("material"), spec: input("spec") },
|
|
808
|
+
result: { kind: "output", name: "track" },
|
|
809
|
+
},
|
|
810
|
+
],
|
|
811
|
+
exports: [{
|
|
812
|
+
name: "track", type: compositionTypes.visualTrack, root: operation("text-mask:render"),
|
|
813
|
+
}],
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
export const decodeTypographyMaskSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
|
|
818
|
+
allowed(element, ["id", "semantic", "space", "text", "material", "mode", "fit"], ["id", "text", "material"]);
|
|
819
|
+
empty(element);
|
|
820
|
+
const id = text(element, "id");
|
|
821
|
+
const context = resolveTemporalContext({ element, resolveReference });
|
|
822
|
+
const time = createTemporalSpace({ id: id, element, ...context });
|
|
823
|
+
const program = reference(element.attributes.text, `${element.name}.text`, typographyTrackTypes.program, resolveReference);
|
|
824
|
+
const material = reference(element.attributes.material, `${element.name}.material`, mediaTypes.compositableSurface, resolveReference);
|
|
825
|
+
const specId = `${id}.__spec`;
|
|
826
|
+
const spec = sealTextMaskSpec({
|
|
827
|
+
id,
|
|
828
|
+
mode: enumText(element, "mode", ["alpha", "luminance"] as const, "alpha"),
|
|
829
|
+
materialFit: enumText(element, "fit", ["contain", "cover", "fill"] as const, "cover"),
|
|
830
|
+
});
|
|
831
|
+
const fragment = createMaskFragment(id);
|
|
832
|
+
return {
|
|
833
|
+
records: [{ id: specId, type: typographyTrackTypes.maskSpec, value: { kind: "inline", value: spec }, range: element.range }],
|
|
834
|
+
components: [...time.components, {
|
|
835
|
+
id, fragment: fragment.id,
|
|
836
|
+
inputs: { space: time.space.ref, program: program.ref, material: material.ref, spec: { kind: "record", id: specId } },
|
|
837
|
+
outputs: { track: `${id}.track` }, range: element.range,
|
|
838
|
+
}],
|
|
839
|
+
fragments: [...time.fragments, fragment],
|
|
840
|
+
exports: [`${id}.track`],
|
|
841
|
+
};
|
|
842
|
+
};
|