@allyhub/sdk 0.1.0-alpha.8 → 0.2.0-next.0
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/NOTICE +85 -0
- package/client.d.ts +45 -1
- package/dist/anim.js +2 -75
- package/dist/define.d.ts +10 -4
- package/dist/define.js +2 -95
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +2 -457
- package/dist/fit.js +2 -60
- package/dist/free.d.ts +18 -0
- package/dist/free.js +2 -0
- package/dist/index.d.ts +28 -13
- package/dist/index.js +2 -11
- package/dist/input.d.ts +306 -0
- package/dist/input.js +2 -0
- package/dist/media.d.ts +3 -6
- package/dist/media.js +2 -27
- package/dist/messages.d.ts +3 -2
- package/dist/messages.js +2 -2
- package/dist/module.d.ts +24 -0
- package/dist/module.js +2 -0
- package/dist/noise.js +2 -233
- package/dist/parts.d.ts +97 -21
- package/dist/parts.js +2 -414
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +2 -720
- package/dist/phone.d.ts +26 -0
- package/dist/phone.js +2 -0
- package/dist/piece.d.ts +106 -35
- package/dist/piece.js +2 -38
- package/dist/props.d.ts +1 -1
- package/dist/props.js +2 -35
- package/dist/scenery.d.ts +2 -0
- package/dist/scenery.js +2 -0
- package/dist/text.js +2 -38
- package/dist/written.d.ts +12 -0
- package/dist/written.js +2 -0
- package/docs/README.md +18 -0
- package/docs/batches.md +148 -0
- package/docs/contract.md +51 -0
- package/docs/defaults.md +703 -0
- package/docs/docs.md +148 -0
- package/docs/footage.md +249 -0
- package/docs/layers.md +317 -0
- package/docs/modeling.md +143 -0
- package/docs/project.md +265 -0
- package/docs/scenery.md +308 -0
- package/docs/sheets.md +119 -0
- package/docs/slides.md +111 -0
- package/docs/sound.md +170 -0
- package/docs/speech.md +289 -0
- package/docs/video.md +265 -0
- package/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +52 -0
- package/node_modules/@allyhub-next/audio/dist/at-cut.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/decode.d.ts +33 -0
- package/node_modules/@allyhub-next/audio/dist/decode.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/envelope.d.ts +37 -0
- package/node_modules/@allyhub-next/audio/dist/envelope.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/index.d.ts +17 -0
- package/node_modules/@allyhub-next/audio/dist/index.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/levels.d.ts +97 -0
- package/node_modules/@allyhub-next/audio/dist/levels.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/master.d.ts +29 -0
- package/node_modules/@allyhub-next/audio/dist/master.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/music.d.ts +11 -0
- package/node_modules/@allyhub-next/audio/dist/music.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +39 -0
- package/node_modules/@allyhub-next/audio/dist/node/decode.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +25 -0
- package/node_modules/@allyhub-next/audio/dist/node/ebur128.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +31 -0
- package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/index.d.ts +8 -0
- package/node_modules/@allyhub-next/audio/dist/node/index.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +18 -0
- package/node_modules/@allyhub-next/audio/dist/node/loudness.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/master.d.ts +42 -0
- package/node_modules/@allyhub-next/audio/dist/node/master.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +60 -0
- package/node_modules/@allyhub-next/audio/dist/node/measure.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +31 -0
- package/node_modules/@allyhub-next/audio/dist/node/mix.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/plan.d.ts +143 -0
- package/node_modules/@allyhub-next/audio/dist/plan.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recorded.d.ts +26 -0
- package/node_modules/@allyhub-next/audio/dist/recorded.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +47 -0
- package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +89 -0
- package/node_modules/@allyhub-next/audio/dist/recording/chain.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +64 -0
- package/node_modules/@allyhub-next/audio/dist/recording/dynamics.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +26 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fft.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +42 -0
- package/node_modules/@allyhub-next/audio/dist/recording/filters.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +56 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fit.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +10 -0
- package/node_modules/@allyhub-next/audio/dist/recording/index.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +12 -0
- package/node_modules/@allyhub-next/audio/dist/recording/loudness.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +67 -0
- package/node_modules/@allyhub-next/audio/dist/recording/measure.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +32 -0
- package/node_modules/@allyhub-next/audio/dist/recording/mic.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +27 -0
- package/node_modules/@allyhub-next/audio/dist/recording/noise.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +64 -0
- package/node_modules/@allyhub-next/audio/dist/recording/presets.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +78 -0
- package/node_modules/@allyhub-next/audio/dist/recording/room.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +111 -0
- package/node_modules/@allyhub-next/audio/dist/recording/setup.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +3 -0
- package/node_modules/@allyhub-next/audio/dist/recording/vec.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/render.d.ts +26 -0
- package/node_modules/@allyhub-next/audio/dist/render.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/sfx.d.ts +10 -0
- package/node_modules/@allyhub-next/audio/dist/sfx.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/shape.d.ts +118 -0
- package/node_modules/@allyhub-next/audio/dist/shape.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/voice.d.ts +45 -0
- package/node_modules/@allyhub-next/audio/dist/voice.js +2 -0
- package/node_modules/@allyhub-next/audio/package.json +17 -0
- package/node_modules/@allyhub-next/formats/dist/data/comments.d.ts +94 -0
- package/node_modules/@allyhub-next/formats/dist/data/comments.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/config.d.ts +10 -0
- package/node_modules/@allyhub-next/formats/dist/data/config.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/edits.d.ts +28 -0
- package/node_modules/@allyhub-next/formats/dist/data/edits.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/elements.d.ts +6 -0
- package/node_modules/@allyhub-next/formats/dist/data/elements.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/faces.d.ts +38 -0
- package/node_modules/@allyhub-next/formats/dist/data/faces.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/file.d.ts +11 -0
- package/node_modules/@allyhub-next/formats/dist/data/file.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/gen.d.ts +31 -0
- package/node_modules/@allyhub-next/formats/dist/data/gen.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/messages.d.ts +34 -0
- package/node_modules/@allyhub-next/formats/dist/data/messages.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/reference.d.ts +676 -0
- package/node_modules/@allyhub-next/formats/dist/data/reference.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/script.d.ts +37 -0
- package/node_modules/@allyhub-next/formats/dist/data/script.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +214 -0
- package/node_modules/@allyhub-next/formats/dist/data/sheet.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/words.d.ts +25 -0
- package/node_modules/@allyhub-next/formats/dist/data/words.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/index.d.ts +16 -0
- package/node_modules/@allyhub-next/formats/dist/index.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/items.d.ts +94 -0
- package/node_modules/@allyhub-next/formats/dist/items.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/layout.d.ts +50 -0
- package/node_modules/@allyhub-next/formats/dist/layout.js +5 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +301 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.js +2 -0
- package/node_modules/@allyhub-next/formats/package.json +14 -0
- package/node_modules/@allyhub-next/formats/schemas/comments.schema.json +152 -0
- package/node_modules/@allyhub-next/formats/schemas/config.schema.json +43 -0
- package/node_modules/@allyhub-next/formats/schemas/edits.schema.json +112 -0
- package/node_modules/@allyhub-next/formats/schemas/elements.schema.json +33 -0
- package/node_modules/@allyhub-next/formats/schemas/gen.schema.json +97 -0
- package/node_modules/@allyhub-next/formats/schemas/interpretation.schema.json +125 -0
- package/node_modules/@allyhub-next/formats/schemas/items.json +75 -0
- package/node_modules/@allyhub-next/formats/schemas/messages.schema.json +11 -0
- package/node_modules/@allyhub-next/formats/schemas/script.schema.json +162 -0
- package/node_modules/@allyhub-next/formats/schemas/sheet.schema.json +395 -0
- package/node_modules/@allyhub-next/formats/schemas/words.schema.json +63 -0
- package/node_modules/@allyhub-next/protocol/dist/app.d.ts +98 -0
- package/node_modules/@allyhub-next/protocol/dist/app.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +116 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +59 -0
- package/node_modules/@allyhub-next/protocol/dist/cli.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +272 -0
- package/node_modules/@allyhub-next/protocol/dist/cloud.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +405 -0
- package/node_modules/@allyhub-next/protocol/dist/editor.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/files.d.ts +101 -0
- package/node_modules/@allyhub-next/protocol/dist/files.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/index.d.ts +12 -0
- package/node_modules/@allyhub-next/protocol/dist/index.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/jsonrpc.d.ts +83 -0
- package/node_modules/@allyhub-next/protocol/dist/jsonrpc.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +53 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/runtimes.d.ts +93 -0
- package/node_modules/@allyhub-next/protocol/dist/runtimes.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/teams.d.ts +67 -0
- package/node_modules/@allyhub-next/protocol/dist/teams.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +345 -0
- package/node_modules/@allyhub-next/protocol/dist/tools.js +2 -0
- package/node_modules/@allyhub-next/protocol/package.json +13 -0
- package/node_modules/@allyhub-next/runtimes/dist/bundled.d.ts +10 -0
- package/node_modules/@allyhub-next/runtimes/dist/bundled.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/download.d.ts +15 -0
- package/node_modules/@allyhub-next/runtimes/dist/download.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/errors.d.ts +16 -0
- package/node_modules/@allyhub-next/runtimes/dist/errors.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/home.d.ts +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/home.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/index.d.ts +9 -0
- package/node_modules/@allyhub-next/runtimes/dist/index.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
- package/node_modules/@allyhub-next/runtimes/dist/lock.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/manifest.d.ts +3 -0
- package/node_modules/@allyhub-next/runtimes/dist/manifest.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +63 -0
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -0
- package/node_modules/@allyhub-next/runtimes/dist/unpack.d.ts +7 -0
- package/node_modules/@allyhub-next/runtimes/dist/unpack.js +2 -0
- package/node_modules/@allyhub-next/runtimes/manifest.json +395 -0
- package/node_modules/@allyhub-next/runtimes/package.json +14 -0
- package/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +153 -0
- package/node_modules/@allyhub-next/scenery/NOTICE +42 -0
- package/node_modules/@allyhub-next/scenery/dist/aim.d.ts +55 -0
- package/node_modules/@allyhub-next/scenery/dist/aim.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/bake.d.ts +203 -0
- package/node_modules/@allyhub-next/scenery/dist/bake.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/camera.d.ts +150 -0
- package/node_modules/@allyhub-next/scenery/dist/camera.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/curve.d.ts +40 -0
- package/node_modules/@allyhub-next/scenery/dist/curve.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/define.d.ts +164 -0
- package/node_modules/@allyhub-next/scenery/dist/define.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/fit.d.ts +64 -0
- package/node_modules/@allyhub-next/scenery/dist/fit.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/glass.d.ts +34 -0
- package/node_modules/@allyhub-next/scenery/dist/glass.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/handheld.d.ts +184 -0
- package/node_modules/@allyhub-next/scenery/dist/handheld.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/hull.d.ts +23 -0
- package/node_modules/@allyhub-next/scenery/dist/hull.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/index.d.ts +22 -0
- package/node_modules/@allyhub-next/scenery/dist/index.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/lens.d.ts +48 -0
- package/node_modules/@allyhub-next/scenery/dist/lens.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/moire.d.ts +136 -0
- package/node_modules/@allyhub-next/scenery/dist/moire.js +93 -0
- package/node_modules/@allyhub-next/scenery/dist/motion.d.ts +48 -0
- package/node_modules/@allyhub-next/scenery/dist/motion.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/move.d.ts +260 -0
- package/node_modules/@allyhub-next/scenery/dist/move.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/noise.d.ts +41 -0
- package/node_modules/@allyhub-next/scenery/dist/noise.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/phone.d.ts +34 -0
- package/node_modules/@allyhub-next/scenery/dist/phone.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/report.d.ts +677 -0
- package/node_modules/@allyhub-next/scenery/dist/report.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/screen-focus.d.ts +55 -0
- package/node_modules/@allyhub-next/scenery/dist/screen-focus.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/screen.d.ts +71 -0
- package/node_modules/@allyhub-next/scenery/dist/screen.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/solve.d.ts +82 -0
- package/node_modules/@allyhub-next/scenery/dist/solve.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/timing.d.ts +26 -0
- package/node_modules/@allyhub-next/scenery/dist/timing.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/vec.d.ts +19 -0
- package/node_modules/@allyhub-next/scenery/dist/vec.js +2 -0
- package/node_modules/@allyhub-next/scenery/package.json +13 -0
- package/node_modules/@allyhub-next/video-core/dist/anchors.d.ts +164 -0
- package/node_modules/@allyhub-next/video-core/dist/anchors.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/audio-types.d.ts +148 -0
- package/node_modules/@allyhub-next/video-core/dist/audio-types.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/backdrop.d.ts +87 -0
- package/node_modules/@allyhub-next/video-core/dist/backdrop.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/captions.d.ts +122 -0
- package/node_modules/@allyhub-next/video-core/dist/captions.js +11 -0
- package/node_modules/@allyhub-next/video-core/dist/console.d.ts +91 -0
- package/node_modules/@allyhub-next/video-core/dist/console.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/contrast.d.ts +98 -0
- package/node_modules/@allyhub-next/video-core/dist/contrast.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/cut-report.d.ts +77 -0
- package/node_modules/@allyhub-next/video-core/dist/cut-report.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/edit.d.ts +77 -0
- package/node_modules/@allyhub-next/video-core/dist/edit.js +13 -0
- package/node_modules/@allyhub-next/video-core/dist/edits.d.ts +163 -0
- package/node_modules/@allyhub-next/video-core/dist/edits.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/export.d.ts +96 -0
- package/node_modules/@allyhub-next/video-core/dist/export.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/fact.d.ts +965 -0
- package/node_modules/@allyhub-next/video-core/dist/fact.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/footage-motion.d.ts +168 -0
- package/node_modules/@allyhub-next/video-core/dist/footage-motion.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/formats.d.ts +240 -0
- package/node_modules/@allyhub-next/video-core/dist/formats.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/gen.d.ts +37 -0
- package/node_modules/@allyhub-next/video-core/dist/gen.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/index.d.ts +40 -0
- package/node_modules/@allyhub-next/video-core/dist/index.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/look.d.ts +66 -0
- package/node_modules/@allyhub-next/video-core/dist/look.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/marks.d.ts +34 -0
- package/node_modules/@allyhub-next/video-core/dist/marks.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/matrix.d.ts +289 -0
- package/node_modules/@allyhub-next/video-core/dist/matrix.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/measure.d.ts +465 -0
- package/node_modules/@allyhub-next/video-core/dist/measure.js +5 -0
- package/node_modules/@allyhub-next/video-core/dist/media.d.ts +226 -0
- package/node_modules/@allyhub-next/video-core/dist/media.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/messages.d.ts +88 -0
- package/node_modules/@allyhub-next/video-core/dist/messages.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/motion.d.ts +56 -0
- package/node_modules/@allyhub-next/video-core/dist/motion.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/music.d.ts +110 -0
- package/node_modules/@allyhub-next/video-core/dist/music.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/piece.d.ts +1146 -0
- package/node_modules/@allyhub-next/video-core/dist/piece.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/placement.d.ts +37 -0
- package/node_modules/@allyhub-next/video-core/dist/placement.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +262 -0
- package/node_modules/@allyhub-next/video-core/dist/problem.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/render-types.d.ts +49 -0
- package/node_modules/@allyhub-next/video-core/dist/render-types.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/schema.d.ts +352 -0
- package/node_modules/@allyhub-next/video-core/dist/schema.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/script-edit.d.ts +176 -0
- package/node_modules/@allyhub-next/video-core/dist/script-edit.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/script.d.ts +67 -0
- package/node_modules/@allyhub-next/video-core/dist/script.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/seams.d.ts +214 -0
- package/node_modules/@allyhub-next/video-core/dist/seams.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/slides.d.ts +37 -0
- package/node_modules/@allyhub-next/video-core/dist/slides.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/sound-under.d.ts +72 -0
- package/node_modules/@allyhub-next/video-core/dist/sound-under.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/speech.d.ts +83 -0
- package/node_modules/@allyhub-next/video-core/dist/speech.js +5 -0
- package/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +616 -0
- package/node_modules/@allyhub-next/video-core/dist/timeline.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/timing.d.ts +88 -0
- package/node_modules/@allyhub-next/video-core/dist/timing.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/transcript.d.ts +288 -0
- package/node_modules/@allyhub-next/video-core/dist/transcript.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/transition.d.ts +289 -0
- package/node_modules/@allyhub-next/video-core/dist/transition.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/voice.d.ts +175 -0
- package/node_modules/@allyhub-next/video-core/dist/voice.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/words.d.ts +128 -0
- package/node_modules/@allyhub-next/video-core/dist/words.js +2 -0
- package/node_modules/@allyhub-next/video-core/package.json +14 -0
- package/package.json +52 -41
- package/README.md +0 -17
- package/dist/anim.d.ts.map +0 -1
- package/dist/anim.js.map +0 -1
- package/dist/define.d.ts.map +0 -1
- package/dist/define.js.map +0 -1
- package/dist/dom.d.ts.map +0 -1
- package/dist/dom.js.map +0 -1
- package/dist/fit.d.ts.map +0 -1
- package/dist/fit.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/media.d.ts.map +0 -1
- package/dist/media.js.map +0 -1
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js.map +0 -1
- package/dist/noise.d.ts.map +0 -1
- package/dist/noise.js.map +0 -1
- package/dist/parts.d.ts.map +0 -1
- package/dist/parts.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/piece.d.ts.map +0 -1
- package/dist/piece.js.map +0 -1
- package/dist/props.d.ts.map +0 -1
- package/dist/props.js.map +0 -1
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js.map +0 -1
- /package/{LICENSE → LICENSE.md} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type ResolvedCamera } from "./camera.js";
|
|
2
|
+
import { type Px } from "./screen.js";
|
|
3
|
+
import type { Vec3 } from "./vec.js";
|
|
4
|
+
/** What screenFocus needs to know about a screen and its camera. */
|
|
5
|
+
export interface ScreenFocusOptions {
|
|
6
|
+
/** The camera, resolved, with its aperture and focus (dof). */
|
|
7
|
+
camera: ResolvedCamera;
|
|
8
|
+
/** The content's corners in the scenery: top left, top right, bottom right, bottom left. */
|
|
9
|
+
corners: readonly [Vec3, Vec3, Vec3, Vec3];
|
|
10
|
+
/** The same corners on the frame, px. */
|
|
11
|
+
quad: readonly [Px, Px, Px, Px];
|
|
12
|
+
/** The content's size, px. */
|
|
13
|
+
size: readonly [number, number];
|
|
14
|
+
/** The frame's height, px (what blurDiameter counts in). */
|
|
15
|
+
frameHeight: number;
|
|
16
|
+
/** The most Gaussian levels mixed; 1 blurs the whole screen by its mean. */
|
|
17
|
+
levels: number;
|
|
18
|
+
/** The widest circle of confusion drawn, frame px (the scenery's own pass stops there too). */
|
|
19
|
+
most?: number;
|
|
20
|
+
/** How many places along the gradient the weights are given at. */
|
|
21
|
+
samples?: number;
|
|
22
|
+
}
|
|
23
|
+
/** A screen's blur as the filter draws it. */
|
|
24
|
+
export interface ScreenFocus {
|
|
25
|
+
/** Each level's Gaussian, standard deviation in content px (0: sharp). */
|
|
26
|
+
sigmas: number[];
|
|
27
|
+
/**
|
|
28
|
+
* Where the depth gradient runs, content px: 0 at `from`, 1 at `to`,
|
|
29
|
+
* each point by its projection on the line between them.
|
|
30
|
+
*/
|
|
31
|
+
from: Px;
|
|
32
|
+
to: Px;
|
|
33
|
+
/** Each level's weight at `samples` evenly spaced places from 0 to 1; they sum to 1 at each. */
|
|
34
|
+
weights: number[][];
|
|
35
|
+
/** The circle of confusion across the screen, frame px: the least and the most. */
|
|
36
|
+
diameter: {
|
|
37
|
+
least: number;
|
|
38
|
+
most: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** screenFocus's defaults. */
|
|
42
|
+
export declare const SCREEN_FOCUS_DEFAULTS: {
|
|
43
|
+
/** Gaussian levels a screen's content is mixed from. */
|
|
44
|
+
levels: number;
|
|
45
|
+
/** Places along the gradient the weights are given at. */
|
|
46
|
+
samples: number;
|
|
47
|
+
/** Below this standard deviation (content px) a screen is left sharp. */
|
|
48
|
+
sharp: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* How a camera with an aperture blurs a screen, or undefined when it does
|
|
52
|
+
* not (no aperture, or sharp all over).
|
|
53
|
+
*/
|
|
54
|
+
export declare function screenFocus(o: ScreenFocusOptions): ScreenFocus | undefined;
|
|
55
|
+
//# sourceMappingURL=screen-focus.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{blurDiameter as tt}from"./camera.js";import{apply as g,homography as st}from"./screen.js";export const SCREEN_FOCUS_DEFAULTS={levels:8,samples:65,sharp:.05};const nt=(n,e)=>n[0]*e[0]+n[1]*e[1]+n[2]*e[2];export function screenFocus(n){const{camera:e}=n;if(!e.dof)return;const[c,r]=n.size,m=st(c,r,n.quad);if(!m||c<=0||r<=0)return;const M=t=>nt([t[0]-e.position[0],t[1]-e.position[1],t[2]-e.position[2]],e.forward),[T,j,,k]=n.corners,x=M(T),h=(M(j)-x)/c,p=(M(k)-x)/r,E=(t,s)=>x+h*t+p*s,B=n.most??1/0,F=(t,s)=>Math.min(tt(e,E(t,s),n.frameHeight),B),G=(t,s)=>{const[f,u]=g(m,t-.5,s),[Q,V]=g(m,t+.5,s),[W,X]=g(m,t,s-.5),[Y,Z]=g(m,t,s+.5),$=((Q-f)*(Z-X)-(V-u)*(Y-W))/(4*.5*.5);return Math.sqrt(Math.abs($))},J=(t,s)=>F(t,s)/4/Math.max(G(t,s),1e-6),O=[[0,0],[c,0],[c,r],[0,r]],y=O.map(([t,s])=>E(t,s)),A=Math.min(...y),S=Math.max(...y),d=O[y.indexOf(A)]??[0,0],U=h*h+p*p,q=Math.max(2,Math.round(n.samples??SCREEN_FOCUS_DEFAULTS.samples)),b=U>1e-18?(S-A)/U:0,o=[d[0],d[1]],l=[d[0]+h*b,d[1]+p*b],C=Array.from({length:q},(t,s)=>{const i=s/(q-1),f=o[0]+(l[0]-o[0])*i,u=o[1]+(l[1]-o[1])*i;return{sigma:J(f,u),diameter:F(f,u)}}),D=e.dof.focus,K=D>A&&D<S,I=C.map(t=>t.diameter),z={least:K?0:Math.min(...I),most:Math.max(...I)},a=C.map(t=>t.sigma),H=Math.min(...a),v=Math.max(...a);if(v<SCREEN_FOCUS_DEFAULTS.sharp)return;const w=Math.max(1,Math.round(n.levels));if(w===1||v-H<.25||b===0)return{sigmas:[a.reduce((s,i)=>s+i,0)/a.length],from:o,to:l,weights:[a.map(()=>1)],diameter:z};const _=t=>Math.log1p(t),L=_(H),N=(_(v)-L)/(w-1),R=Array.from({length:w},(t,s)=>L+N*s),P=R.map(t=>a.map(s=>Math.max(0,1-Math.abs(_(s)-t)/N)));return{sigmas:R.map(t=>Math.max(0,Math.expm1(t))),from:o,to:l,weights:P,diameter:z}}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** A point on the frame, px from the top left. */
|
|
2
|
+
export type Px = readonly [number, number];
|
|
3
|
+
/**
|
|
4
|
+
* The 3 × 3 homography (row-major, h22 = 1) that maps the rectangle's
|
|
5
|
+
* corners (0, 0), (w, 0), (w, h), (0, h) to q[0], q[1], q[2], q[3].
|
|
6
|
+
* Undefined when the quad is degenerate (three corners in a line).
|
|
7
|
+
*/
|
|
8
|
+
export declare function homography(w: number, h: number, q: readonly [Px, Px, Px, Px]): number[] | undefined;
|
|
9
|
+
/** Where the homography sends a point. */
|
|
10
|
+
export declare function apply(m: readonly number[], x: number, y: number): Px;
|
|
11
|
+
/** The homography as a CSS transform, for an element w × h with transform-origin 0 0. */
|
|
12
|
+
export declare function matrix3d(m: readonly number[]): string;
|
|
13
|
+
/** What a screen measures on a frame: its share of it, how much its content is enlarged, how far it is turned. */
|
|
14
|
+
export interface ScreenOnFrame {
|
|
15
|
+
/** Its corners on the frame, px: top left, top right, bottom right, bottom left of its content. */
|
|
16
|
+
corners: readonly [Px, Px, Px, Px];
|
|
17
|
+
/** The share of the frame it covers: the quad clipped to the frame (what shows), 0–1. */
|
|
18
|
+
share: number;
|
|
19
|
+
/** Frame pixels per content pixel, the least and the most across the screen (below 1: shrunk). */
|
|
20
|
+
scale: {
|
|
21
|
+
least: number;
|
|
22
|
+
most: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Degrees between the screen's face and the line to the camera, at the
|
|
26
|
+
* centre of what the frame shows of it (0: square on there).
|
|
27
|
+
*/
|
|
28
|
+
angle: number;
|
|
29
|
+
}
|
|
30
|
+
/** A polygon clipped to the rectangle [0, w] × [0, h] (Sutherland–Hodgman). */
|
|
31
|
+
export declare function clipToFrame(poly: readonly Px[], w: number, h: number): Px[];
|
|
32
|
+
/**
|
|
33
|
+
* Where on a screen's face the centre of what a frame shows of it is, as
|
|
34
|
+
* shares of its width and height from its top left (0.5, 0.5: its own
|
|
35
|
+
* centre, as it is whenever the whole face is on the frame). Undefined
|
|
36
|
+
* when none of it is on the frame.
|
|
37
|
+
*/
|
|
38
|
+
export declare function shownCentre(corners: readonly [Px, Px, Px, Px], frame: readonly [number, number]): [number, number] | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* How a w × h screen sits on a frame of fw × fh px, from its corners and
|
|
41
|
+
* the angle of its face to the view.
|
|
42
|
+
*/
|
|
43
|
+
export declare function screenOnFrame(w: number, h: number, corners: readonly [Px, Px, Px, Px], frame: readonly [number, number], angle: number): ScreenOnFrame;
|
|
44
|
+
/**
|
|
45
|
+
* The steady light a scenery already has from a screen drawn in it
|
|
46
|
+
* (screen({ inScenery: { light: { base } } })): a bake's, an area light's on
|
|
47
|
+
* its face, a probe's pane of it. Its radiance is `color` (a hex colour,
|
|
48
|
+
* sRGB as a light's colour is, or linear RGB) times `brightness`
|
|
49
|
+
* (scene-linear, the units of inScenery's own brightness; default that
|
|
50
|
+
* brightness, so `{}` is the screen's white).
|
|
51
|
+
*/
|
|
52
|
+
export interface ScreenLightBase {
|
|
53
|
+
brightness?: number;
|
|
54
|
+
color?: string | readonly [number, number, number];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A screen drawn in the scenery lights what is near it: its picture cut into
|
|
58
|
+
* this many cells across and down, each a uniformly bright polygon, for its
|
|
59
|
+
* diffuse light (screen({ inScenery: { light: { cells } } })), reflected by
|
|
60
|
+
* the materials it lights (`specular`; false: its diffuse light alone),
|
|
61
|
+
* and all of it added (`base`: null), or only what it differs by from the
|
|
62
|
+
* steady light the scenery already has from it (`base`, ScreenLightBase).
|
|
63
|
+
*/
|
|
64
|
+
export declare const SCREEN_LIGHT_DEFAULTS: {
|
|
65
|
+
cells: readonly [number, number];
|
|
66
|
+
specular: boolean;
|
|
67
|
+
base: ScreenLightBase | null;
|
|
68
|
+
};
|
|
69
|
+
/** What is wrong with a screen light's base, or undefined. */
|
|
70
|
+
export declare function screenLightBaseProblem(base: unknown): string | undefined;
|
|
71
|
+
//# sourceMappingURL=screen.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
export function homography(n,o,e){const[[i,s],[t,r],[c,f],[u,h]]=e,d=t-c,l=u-c,a=r-f,p=h-f,g=i-t+c-u,y=s-r+f-h,M=d*p-l*a;if(Math.abs(M)<1e-12)return;const b=(g*p-l*y)/M,m=(d*y-g*a)/M,N=t-i+b*t,O=u-i+m*u,S=i,$=r-s+b*r,A=h-s+m*h,j=s;return[N/n,O/o,S,$/n,A/o,j,b/n,m/o,1]}export function apply(n,o,e){const i=(n[6]??0)*o+(n[7]??0)*e+(n[8]??1);return[((n[0]??0)*o+(n[1]??0)*e+(n[2]??0))/i,((n[3]??0)*o+(n[4]??0)*e+(n[5]??0))/i]}export function matrix3d(n){const[o,e,i,s,t,r,c,f,u]=n.map(h=>Object.is(h,-0)?0:h);return`matrix3d(${[o,s,0,c,e,t,0,f,0,0,1,0,i,r,0,u].map(h=>String(h??0)).join(",")})`}const E=n=>{let o=0;return n.forEach((e,i)=>{const s=n[(i+1)%n.length]??e;o+=e[0]*s[1]-s[0]*e[1]}),Math.abs(o)/2};export function clipToFrame(n,o,e){const i=[[t=>t[0]>=0,(t,r)=>x(t,r,(t[0]-0)/(t[0]-r[0]))],[t=>t[0]<=o,(t,r)=>x(t,r,(t[0]-o)/(t[0]-r[0]))],[t=>t[1]>=0,(t,r)=>x(t,r,(t[1]-0)/(t[1]-r[1]))],[t=>t[1]<=e,(t,r)=>x(t,r,(t[1]-e)/(t[1]-r[1]))]];let s=[...n];for(const[t,r]of i){const c=s;if(s=[],c.forEach((f,u)=>{const h=c[(u+c.length-1)%c.length]??f;t(f)?(t(h)||s.push(r(h,f)),s.push(f)):t(h)&&s.push(r(h,f))}),s.length===0)break}return s}function v(n){const[o=0,e=0,i=0,s=0,t=0,r=0,c=0,f=0,u=0]=n,h=t*u-r*f,d=-(s*u-r*c),l=s*f-t*c,a=o*h+e*d+i*l;if(!(Math.abs(a)<1e-12))return[h/a,-(e*u-i*f)/a,(e*r-i*t)/a,d/a,(o*u-i*c)/a,-(o*r-i*s)/a,l/a,-(o*f-e*c)/a,(o*t-e*s)/a]}export function shownCentre(n,o){const e=clipToFrame(n,o[0],o[1]),i=E(n),s=E(e);if(!(s>0))return;if(s>=i*(1-1e-6))return[.5,.5];let t=0,r=0,c=0;e.forEach((a,p)=>{const g=e[(p+1)%e.length]??a,y=a[0]*g[1]-g[0]*a[1];c+=y,t+=(a[0]+g[0])*y,r+=(a[1]+g[1])*y});const f=homography(1,1,n),u=f?v(f):void 0;if(!u||c===0)return[.5,.5];const[h,d]=apply(u,t/(3*c),r/(3*c)),l=a=>Math.min(Math.max(a,0),1);return[l(h),l(d)]}const x=(n,o,e)=>[n[0]+(o[0]-n[0])*e,n[1]+(o[1]-n[1])*e];export function screenOnFrame(n,o,e,i,s){const[t,r,c,f]=e,u=(l,a)=>Math.hypot(a[0]-l[0],a[1]-l[1]),h=[Math.sqrt(u(t,r)/n*(u(t,f)/o)),Math.sqrt(u(r,t)/n*(u(r,c)/o)),Math.sqrt(u(c,f)/n*(u(c,r)/o)),Math.sqrt(u(f,c)/n*(u(f,t)/o))],d=l=>Math.round(l*1e4)/1e4;return{corners:e,share:d(E(clipToFrame(e,i[0],i[1]))/(i[0]*i[1])),scale:{least:d(Math.min(...h)),most:d(Math.max(...h))},angle:Math.round(s*100)/100}}export const SCREEN_LIGHT_DEFAULTS={cells:[8,5],specular:!0,base:null};const F=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;export function screenLightBaseProblem(n){if(typeof n!="object"||n===null||Array.isArray(n))return`${JSON.stringify(n)} is not { brightness?, color? }`;const{brightness:o,color:e,...i}=n,s=Object.keys(i);if(s.length>0)return`it takes brightness and color, not ${s.join(", ")}`;if(o!==void 0&&!(typeof o=="number"&&Number.isFinite(o)&&o>=0))return`its brightness ${JSON.stringify(o)} is not a number of 0 or more`;if(e!==void 0){if(typeof e=="string")return F.test(e)?void 0:`its color ${JSON.stringify(e)} is not a hex colour ("#808080")`;if(!(Array.isArray(e)&&e.length===3&&e.every(t=>typeof t=="number"&&Number.isFinite(t)&&t>=0)))return`its color ${JSON.stringify(e)} is not a hex colour ("#808080") or three linear numbers of 0 or more`}}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type CameraState } from "./camera.js";
|
|
2
|
+
import type { LensFrame } from "./lens.js";
|
|
3
|
+
import { type Vec3 } from "./vec.js";
|
|
4
|
+
/** A point of the scenery and the pixel it lands on, from the picture's top left. */
|
|
5
|
+
export interface SolvePoint {
|
|
6
|
+
scenery: Vec3;
|
|
7
|
+
px: readonly [number, number];
|
|
8
|
+
/** What it is, for the residuals: "laptop top left". */
|
|
9
|
+
name?: string;
|
|
10
|
+
/** Default 1. */
|
|
11
|
+
weight?: number;
|
|
12
|
+
}
|
|
13
|
+
/** A line of the scenery, through two of its points, that passes through a pixel. */
|
|
14
|
+
export interface SolveLine {
|
|
15
|
+
scenery: readonly [Vec3, Vec3];
|
|
16
|
+
px: readonly [number, number];
|
|
17
|
+
name?: string;
|
|
18
|
+
weight?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const SOLVE_PARAMS: readonly ["x", "y", "z", "yaw", "pitch", "roll", "lens"];
|
|
21
|
+
export type SolveParam = (typeof SOLVE_PARAMS)[number];
|
|
22
|
+
export declare const SOLVE_DEFAULTS: {
|
|
23
|
+
/** The 35 mm-equivalent lens when it is fixed and nothing else gives one: a phone's main camera. */
|
|
24
|
+
lens: number;
|
|
25
|
+
lensFrame: "phone";
|
|
26
|
+
/** What is solved for: everything but the lens. */
|
|
27
|
+
free: readonly SolveParam[];
|
|
28
|
+
/** Iterations of each start. */
|
|
29
|
+
iterations: number;
|
|
30
|
+
/** An eigenvalue of the scaled normal matrix under this share of the largest: a direction the correspondences do not fix. */
|
|
31
|
+
degenerate: number;
|
|
32
|
+
};
|
|
33
|
+
export interface SolveOptions {
|
|
34
|
+
/** The picture's size, px. */
|
|
35
|
+
frame: readonly [number, number];
|
|
36
|
+
points?: readonly SolvePoint[];
|
|
37
|
+
lines?: readonly SolveLine[];
|
|
38
|
+
/** The lens, 35 mm-equivalent (its start when free); default SOLVE_DEFAULTS.lens. */
|
|
39
|
+
lens?: number;
|
|
40
|
+
/** What the lens is measured on; default "phone". */
|
|
41
|
+
lensFrame?: LensFrame;
|
|
42
|
+
/** The parameters solved for; the others keep their start. Default all but the lens. */
|
|
43
|
+
free?: readonly SolveParam[];
|
|
44
|
+
/** A camera to start from (its lens too, unless `lens` is given); without it, a grid of starts round the points. */
|
|
45
|
+
from?: CameraState;
|
|
46
|
+
iterations?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface SolveResidual {
|
|
49
|
+
kind: "point" | "line";
|
|
50
|
+
name?: string;
|
|
51
|
+
/** The pixel measured. */
|
|
52
|
+
px: readonly [number, number];
|
|
53
|
+
/** A point: where the camera puts it; a line: the nearest point of the line on the picture. */
|
|
54
|
+
drawn: readonly [number, number];
|
|
55
|
+
/** How far apart, px. */
|
|
56
|
+
distance: number;
|
|
57
|
+
}
|
|
58
|
+
export interface SolveResult {
|
|
59
|
+
/** The camera, ready to write: position, yaw, pitch, roll, lens and its frame. Absent when nothing could be solved. */
|
|
60
|
+
camera?: CameraState;
|
|
61
|
+
residuals: SolveResidual[];
|
|
62
|
+
/** Root mean square of the residuals' distances, px. */
|
|
63
|
+
rms?: number;
|
|
64
|
+
/** What the correspondences do not fix, a sentence each: the camera holds there only by its start. */
|
|
65
|
+
undetermined: string[];
|
|
66
|
+
/**
|
|
67
|
+
* How far each free parameter moves for 1 px of error in each measured
|
|
68
|
+
* value, one standard deviation (from the Jacobian at the solution):
|
|
69
|
+
* metres for x, y and z, degrees for the angles, mm for the lens. A
|
|
70
|
+
* parameter the correspondences barely fix moves far: a lens of 5 m
|
|
71
|
+
* that fits as well as one of 26 mm. Absent where nothing is fixed.
|
|
72
|
+
*/
|
|
73
|
+
spread?: Partial<Record<SolveParam, number>>;
|
|
74
|
+
/** Why there is no camera at all. */
|
|
75
|
+
missing?: string;
|
|
76
|
+
/** The starts tried, and the iterations of the best. */
|
|
77
|
+
starts: number;
|
|
78
|
+
iterations: number;
|
|
79
|
+
}
|
|
80
|
+
/** The camera that puts the points and lines where they were measured. */
|
|
81
|
+
export declare function solveCamera(o: SolveOptions): SolveResult;
|
|
82
|
+
//# sourceMappingURL=solve.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{project as K,resolveCamera as V,yawPitchOf as D}from"./camera.js";import{cross as L,DEG as j,dot as Y,length as Q,normalize as W,sub as C}from"./vec.js";export const SOLVE_PARAMS=["x","y","z","yaw","pitch","roll","lens"],SOLVE_DEFAULTS={lens:26,lensFrame:"phone",free:["x","y","z","yaw","pitch","roll"],iterations:200,degenerate:1e-9};const O=1e4;function R(r,i){return{position:[r[0]??0,r[1]??0,r[2]??0],yaw:r[3]??0,pitch:r[4]??0,roll:r[5]??0,lens:Math.exp(r[6]??Math.log(SOLVE_DEFAULTS.lens)),lensFrame:i}}function T(r,i,a){const o=K(r,a);if(o.depth>r.near)return[(o.x+1)/2*i[0],(1-o.y)/2*i[1]]}function X(r){const i=o=>O*Math.sqrt(o??1),a=(o,l)=>({kind:o,...l.name===void 0?{}:{name:l.name},px:l.px,drawn:[Number.NaN,Number.NaN],distance:Number.POSITIVE_INFINITY});return{residuals:[...r.points.flatMap(o=>[i(o.weight),i(o.weight)]),...r.lines.map(o=>i(o.weight))],list:[...r.points.map(o=>a("point",o)),...r.lines.map(o=>a("line",o))]}}function B(r,i){const a=R(r,i.lensFrame);if(Math.abs(a.pitch??0)>=89.9||!((a.lens??0)>.5))return X(i);const o=V(a,i.frame[0]/i.frame[1]),l=[],e=[];for(const t of i.points){const s=Math.sqrt(t.weight??1),n=T(o,i.frame,t.scenery);if(!n){l.push(O*s,O*s),e.push({kind:"point",...t.name===void 0?{}:{name:t.name},px:t.px,drawn:[Number.NaN,Number.NaN],distance:Number.POSITIVE_INFINITY});continue}l.push((n[0]-t.px[0])*s,(n[1]-t.px[1])*s),e.push({kind:"point",...t.name===void 0?{}:{name:t.name},px:t.px,drawn:n,distance:Math.hypot(n[0]-t.px[0],n[1]-t.px[1])})}for(const t of i.lines){const s=Math.sqrt(t.weight??1),n=T(o,i.frame,t.scenery[0]),c=T(o,i.frame,t.scenery[1]),u=n&&c?Math.hypot(c[0]-n[0],c[1]-n[1]):0;if(!n||!c||u<1e-9){l.push(O*s),e.push({kind:"line",...t.name===void 0?{}:{name:t.name},px:t.px,drawn:[Number.NaN,Number.NaN],distance:Number.POSITIVE_INFINITY});continue}const d=(c[0]-n[0])/u,f=(c[1]-n[1])/u,g=t.px[0]-n[0],M=t.px[1]-n[1],m=g*f-M*d,p=g*d+M*f;l.push(m*s),e.push({kind:"line",...t.name===void 0?{}:{name:t.name},px:t.px,drawn:[n[0]+d*p,n[1]+f*p],distance:Math.abs(m)})}return{residuals:l,list:e}}const G=r=>r.reduce((i,a)=>i+a*a,0),Z=[1e-5,1e-5,1e-5,1e-4,1e-4,1e-4,1e-5];function H(r,i,a){const o=i.map(e=>{const t=Z[e]??1e-5,s=[...r],n=[...r];s[e]=(s[e]??0)+t,n[e]=(n[e]??0)-t;const c=a(s),u=a(n);return c.map((d,f)=>(d-(u[f]??0))/(2*t))}),l=o[0]?.length??0;return Array.from({length:l},(e,t)=>o.map(s=>s[t]??0))}function U(r,i){const a=i.length,o=r.map((e,t)=>[...e,i[t]??0]);for(let e=0;e<a;e++){let t=e;for(let c=e+1;c<a;c++)Math.abs(o[c]?.[e]??0)>Math.abs(o[t]?.[e]??0)&&(t=c);const s=o[t],n=o[e];if(!s||!n||Math.abs(s[e]??0)<1e-300)return;o[t]=n,o[e]=s;for(let c=e+1;c<a;c++){const u=o[c];if(!u)continue;const d=(u[e]??0)/(s[e]??1);for(let f=e;f<=a;f++)u[f]=(u[f]??0)-d*(s[f]??0)}}const l=new Array(a).fill(0);for(let e=a-1;e>=0;e--){const t=o[e];if(!t)return;let s=t[a]??0;for(let n=e+1;n<a;n++)s-=(t[n]??0)*(l[n]??0);l[e]=s/(t[e]??1)}return l}function P(r,i){const a=r[0]?.length??0,o=Array.from({length:a},()=>new Array(a).fill(0)),l=new Array(a).fill(0);return r.forEach((e,t)=>{for(let s=0;s<a;s++){l[s]=(l[s]??0)+(e[s]??0)*(i[t]??0);const n=o[s];if(n)for(let c=0;c<a;c++)n[c]=(n[c]??0)+(e[s]??0)*(e[c]??0)}}),{a:o,g:l}}function tt(r,i,a,o){let l=[...r],e=a(l),t=G(e),s=.001,n=0;for(;n<o;n++){const c=H(l,i,a),{a:u,g:d}=P(c,e);let f=!1;for(let g=0;g<12;g++){const M=u.map((x,b)=>x.map((S,h)=>b===h?S+s*Math.max(S,1e-12):S)),m=U(M,d.map(x=>-x));if(!m){s*=10;continue}const p=[...l];i.forEach((x,b)=>{p[x]=(p[x]??0)+(m[b]??0)});const y=a(p),I=G(y);if(I<t){const x=t-I;if(l=p,e=y,t=I,s=Math.max(s/3,1e-12),f=!0,x<1e-12*Math.max(1,t))return{p:l,cost:t,iterations:n+1};break}s*=4}if(!f)break}return{p:l,cost:t,iterations:n}}function nt(r){const i=r.length,a=r.map(t=>[...t]),o=Array.from({length:i},(t,s)=>Array.from({length:i},(n,c)=>s===c?1:0)),l=(t,s,n)=>t[s]?.[n]??0,e=(t,s,n,c)=>{const u=t[s];u&&(u[n]=c)};for(let t=0;t<100;t++){let s=0;for(let n=0;n<i;n++)for(let c=n+1;c<i;c++)s+=l(a,n,c)**2;if(s<1e-30)break;for(let n=0;n<i;n++)for(let c=n+1;c<i;c++){const u=l(a,n,c);if(Math.abs(u)<1e-300)continue;const d=(l(a,c,c)-l(a,n,n))/(2*u),f=Math.sign(d||1)/(Math.abs(d)+Math.sqrt(d*d+1)),g=1/Math.sqrt(f*f+1),M=f*g;for(let m=0;m<i;m++){const p=l(a,m,n),y=l(a,m,c);e(a,m,n,g*p-M*y),e(a,m,c,M*p+g*y)}for(let m=0;m<i;m++){const p=l(a,n,m),y=l(a,c,m);e(a,n,m,g*p-M*y),e(a,c,m,M*p+g*y)}for(let m=0;m<i;m++){const p=l(o,m,n),y=l(o,m,c);e(o,m,n,g*p-M*y),e(o,m,c,M*p+g*y)}}}return{values:Array.from({length:i},(t,s)=>l(a,s,s)),vectors:Array.from({length:i},(t,s)=>Array.from({length:i},(n,c)=>l(o,c,s)))}}function et(r,i,a){const o=V(r,i),{yaw:l,pitch:e}=D(o.forward),t=W(L(o.forward,[0,1,0])),s=L(t,o.forward),n=Math.atan2(-Y(o.up,t),Y(o.up,s))/j;return[...r.position,l,e,n,Math.log(a)]}function st(r,i){const a=Math.max(r.length,1),o=[r.reduce((t,s)=>t+s[0],0)/a,r.reduce((t,s)=>t+s[1],0)/a,r.reduce((t,s)=>t+s[2],0)/a],l=Math.max(.05,...r.map(t=>Q(C(t,o)))),e=[];for(const t of[1.5,3,6])for(const s of[-35,0,35,70])for(let n=0;n<360;n+=30){const c=s*j,u=n*j,d=l*t,f=[o[0]+d*Math.cos(c)*Math.sin(u),o[1]+d*Math.sin(c),o[2]+d*Math.cos(c)*Math.cos(u)],{yaw:g,pitch:M}=D(C(o,f));e.push([...f,g,M,0,Math.log(i)])}return e}const $=r=>Math.round(r*1e4)/1e4,N=r=>Math.round(r*100)/100;export function solveCamera(r){const i=r.points??[],a=r.lines??[],o=r.lensFrame??SOLVE_DEFAULTS.lensFrame,l=r.free??SOLVE_DEFAULTS.free,e=SOLVE_PARAMS.flatMap((h,w)=>l.includes(h)?[w]:[]),t=r.iterations??SOLVE_DEFAULTS.iterations,s=i.length*2+a.length;if(e.length===0)return{residuals:[],undetermined:[],missing:"Nothing is free to solve for.",starts:0,iterations:0};if(s<e.length)return{residuals:[],undetermined:[],missing:`${String(s)} measured value${s===1?"":"s"} (a point gives 2, a line 1) for ${String(e.length)} free parameters (${e.map(h=>SOLVE_PARAMS[h]).join(", ")}): give more points or lines, or fix some (the lens is fixed unless freed).`,starts:0,iterations:0};const n=r.frame[0]/r.frame[1],c=r.lens??r.from?.lens??SOLVE_DEFAULTS.lens,u=h=>B(h,{frame:r.frame,points:i,lines:a,lensFrame:o}).residuals,d=r.from?[et(r.from,n,c)]:st([...i.map(h=>h.scenery),...a.flatMap(h=>[...h.scenery])],c);let f;for(const h of d){const w=tt(h,e,u,t);(!f||w.cost<f.cost-1e-9)&&(f=w)}if(!f)return{residuals:[],undetermined:[],missing:"No start could be drawn.",starts:d.length,iterations:0};const g=B(f.p,{frame:r.frame,points:i,lines:a,lensFrame:o}),M=H(f.p,e,u),m=e.map((h,w)=>Math.sqrt(M.reduce((k,v)=>k+(v[w]??0)**2,0))),p=[];if(m.forEach((h,w)=>{h<1e-9&&p.push(`${SOLVE_PARAMS[e[w]??0]??""} changes nothing measured`)}),p.length===0){const h=M.map(_=>_.map((F,q)=>F/(m[q]??1))),{a:w}=P(h,new Array(h.length).fill(0)),k=nt(w),v=Math.max(...k.values.map(Math.abs));k.values.forEach((_,F)=>{if(Math.abs(_)>v*SOLVE_DEFAULTS.degenerate)return;const q=(k.vectors[F]??[]).map((A,E)=>[Math.abs(A),SOLVE_PARAMS[e[E]??0]??""]).filter(([A])=>A>.3).map(([,A])=>A);p.push(`${q.join(" with ")} ${q.length>1?"trade against each other":"is not fixed"}: the correspondences change too little along it`)})}let y;if(p.length===0){const{a:h}=P(M,new Array(M.length).fill(0)),w=e.length,k={};for(let v=0;v<w;v++){const _=Array.from({length:w},(z,J)=>J===v?1:0),q=U(h.map(z=>[...z]),_)?.[v];if(q===void 0||!(q>=0))continue;const A=Math.sqrt(q),E=SOLVE_PARAMS[e[v]??0];E!==void 0&&(k[E]=E==="lens"?N(Math.exp(f.p[6]??0)*A):E==="x"||E==="y"||E==="z"?$(A):N(A))}Object.keys(k).length>0&&(y=k)}const I=g.list.filter(h=>Number.isFinite(h.distance)),x=g.list.length-I.length;x>0&&p.push(`${String(x)} correspondence${x===1?" is":"s are"} behind the camera it found`);const b=R(f.p,o);return{camera:{position:[$(b.position[0]),$(b.position[1]),$(b.position[2])],yaw:N(b.yaw??0),pitch:N(b.pitch??0),roll:N(b.roll??0),lens:N(b.lens??c),lensFrame:o},residuals:g.list.map(h=>({...h,drawn:[N(h.drawn[0]),N(h.drawn[1])],distance:N(h.distance)})),...I.length===0?{}:{rms:N(Math.sqrt(I.reduce((h,w)=>h+w.distance**2,0)/I.length))},undetermined:p,...y?{spread:y}:{},starts:d.length,iterations:f.iterations}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a stretch runs: one of the SDK's eases by name, `smooth`, or a
|
|
3
|
+
* function on 0–1.
|
|
4
|
+
*/
|
|
5
|
+
export type Ease = "linear" | "in" | "out" | "in-out" | "smooth" | ((x: number) => number);
|
|
6
|
+
/**
|
|
7
|
+
* Eased progress on [0, 1]. `in`, `out` and `in-out` are the SDK's cubic
|
|
8
|
+
* eases (`in-out` runs at three times its mean speed half way); `smooth`
|
|
9
|
+
* is smoothstep, still at both ends and at one and a half times its mean
|
|
10
|
+
* speed half way, a camera's move.
|
|
11
|
+
*/
|
|
12
|
+
export declare function easeValue(ease: Ease | undefined, x: number): number;
|
|
13
|
+
/** A key of a number: its time, its value, and how the stretch arriving at it runs. */
|
|
14
|
+
export interface NumberKey {
|
|
15
|
+
t: number;
|
|
16
|
+
v: number;
|
|
17
|
+
ease?: Ease;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A number over time through keys in time order (times strictly
|
|
21
|
+
* increasing). Before the first key it is the first value, after the last
|
|
22
|
+
* the last. Stretches whose arriving key has an ease run by it; the rest
|
|
23
|
+
* run by a monotone cubic through each unbroken run of them.
|
|
24
|
+
*/
|
|
25
|
+
export declare function timedNumber(keys: readonly NumberKey[]): (t: number) => number;
|
|
26
|
+
//# sourceMappingURL=timing.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
export function easeValue(e,u){const n=Math.min(Math.max(u,0),1);if(typeof e=="function")return e(n);switch(e??"linear"){case"linear":return n;case"in":return n*n*n;case"out":return 1-(1-n)**3;case"in-out":return n<.5?4*n*n*n:1-(-2*n+2)**3/2;case"smooth":return n*n*(3-2*n)}}const m=e=>e>0?1:e<0?-1:0;function x(e,u){const n=e.length,l=[],s=[];for(let t=0;t+1<n;t++){const o=(e[t+1]??0)-(e[t]??0);l.push(o),s.push(((u[t+1]??0)-(u[t]??0))/o)}if(n===2)return[s[0]??0,s[0]??0];const a=new Array(n).fill(0);for(let t=1;t+1<n;t++){const[o,i,f,c]=[s[t-1]??0,s[t]??0,l[t-1]??0,l[t]??0];if(m(o)*m(i)<=0)continue;const h=2*c+f,p=c+2*f;a[t]=(h+p)/(h/o+p/i)}const r=(t,o,i,f)=>{let c=((2*t+o)*i-t*f)/(t+o);return m(c)!==m(i)?c=0:m(i)!==m(f)&&Math.abs(c)>3*Math.abs(i)&&(c=3*i),c};return a[0]=r(l[0]??0,l[1]??0,s[0]??0,s[1]??0),a[n-1]=r(l[n-2]??0,l[n-3]??0,s[n-2]??0,s[n-3]??0),a}export function timedNumber(e){const u=e[0];if(!u)throw new Error("A value over time needs at least one key.");for(let r=1;r<e.length;r++){const[t,o]=[e[r-1],e[r]];if(!t||!o||!(o.t>t.t))throw new Error(`Keys must be in time order with different times: ${String(t?.t)} s is followed by ${String(o?.t)} s.`)}const n=[],l=[];let s=0;for(;s+1<e.length;){if(e[s+1]?.ease!==void 0){n.push(-1),s++;continue}let r=s;for(;r+1<e.length&&e[r+1]?.ease===void 0;)r++;const t=e.slice(s,r+1);l.push({from:s,slopes:x(t.map(o=>o.t),t.map(o=>o.v))});for(let o=s;o<r;o++)n.push(l.length-1);s=r}const a=e.at(-1)??u;return r=>{if(!(r>u.t))return u.v;if(r>=a.t)return a.v;let t=0,o=e.length-2;for(;t<o;){const d=t+o+1>>1;(e[d]?.t??0)<=r?t=d:o=d-1}const i=e[t]??u,f=e[t+1]??a,c=f.t-i.t,h=(r-i.t)/c,p=n[t]??-1,w=l[p];if(p<0||!w)return i.v+(f.v-i.v)*easeValue(f.ease,h);const g=(w.slopes[t-w.from]??0)*c,M=(w.slopes[t+1-w.from]??0)*c,v=h*h,b=v*h;return(2*b-3*v+1)*i.v+(b-2*v+h)*g+(-2*b+3*v)*f.v+(b-v)*M}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A point or a direction in world space: metres, Y up. */
|
|
2
|
+
export type Vec3 = readonly [number, number, number];
|
|
3
|
+
export declare const add: (a: Vec3, b: Vec3) => Vec3;
|
|
4
|
+
export declare const sub: (a: Vec3, b: Vec3) => Vec3;
|
|
5
|
+
export declare const scale: (a: Vec3, k: number) => Vec3;
|
|
6
|
+
/** a + b·k. */
|
|
7
|
+
export declare const addScaled: (a: Vec3, b: Vec3, k: number) => Vec3;
|
|
8
|
+
export declare const dot: (a: Vec3, b: Vec3) => number;
|
|
9
|
+
export declare const cross: (a: Vec3, b: Vec3) => Vec3;
|
|
10
|
+
export declare const length: (a: Vec3) => number;
|
|
11
|
+
export declare const distance: (a: Vec3, b: Vec3) => number;
|
|
12
|
+
/** The unit vector along a; a zero vector stays zero. */
|
|
13
|
+
export declare function normalize(a: Vec3): Vec3;
|
|
14
|
+
export declare const lerp3: (a: Vec3, b: Vec3, x: number) => Vec3;
|
|
15
|
+
export declare const isFinite3: (a: Vec3) => boolean;
|
|
16
|
+
/** v turned about the unit axis k by `angle` radians (Rodrigues). */
|
|
17
|
+
export declare function rotate(v: Vec3, k: Vec3, angle: number): Vec3;
|
|
18
|
+
export declare const DEG: number;
|
|
19
|
+
//# sourceMappingURL=vec.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
export const add=(t,o)=>[t[0]+o[0],t[1]+o[1],t[2]+o[2]],sub=(t,o)=>[t[0]-o[0],t[1]-o[1],t[2]-o[2]],scale=(t,o)=>[t[0]*o,t[1]*o,t[2]*o],addScaled=(t,o,n)=>[t[0]+o[0]*n,t[1]+o[1]*n,t[2]+o[2]*n],dot=(t,o)=>t[0]*o[0]+t[1]*o[1]+t[2]*o[2],cross=(t,o)=>[t[1]*o[2]-t[2]*o[1],t[2]*o[0]-t[0]*o[2],t[0]*o[1]-t[1]*o[0]],length=t=>Math.hypot(t[0],t[1],t[2]),distance=(t,o)=>length(sub(t,o));export function normalize(t){const o=length(t);return o===0?[0,0,0]:scale(t,1/o)}export const lerp3=(t,o,n)=>[t[0]+(o[0]-t[0])*n,t[1]+(o[1]-t[1])*n,t[2]+(o[2]-t[2])*n],isFinite3=t=>Number.isFinite(t[0])&&Number.isFinite(t[1])&&Number.isFinite(t[2]);export function rotate(t,o,n){const e=Math.cos(n),s=Math.sin(n),c=cross(o,t),r=dot(o,t)*(1-e);return[t[0]*e+c[0]*s+o[0]*r,t[1]*e+c[1]*s+o[1]*r,t[2]*e+c[2]*s+o[2]*r]}export const DEG=Math.PI/180;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { Word } from "./media.js";
|
|
2
|
+
/**
|
|
3
|
+
* A named place in a line, in characters of the line as shown: a point at
|
|
4
|
+
* `at`, or the stretch from `at` to `end`.
|
|
5
|
+
*/
|
|
6
|
+
export interface TextAnchor {
|
|
7
|
+
name: string;
|
|
8
|
+
at: number;
|
|
9
|
+
end?: number;
|
|
10
|
+
}
|
|
11
|
+
/** A piece of a line, `at` to `end` of it as shown, that is said as `speak`. */
|
|
12
|
+
export interface SpokenSpan {
|
|
13
|
+
at: number;
|
|
14
|
+
end: number;
|
|
15
|
+
speak: string;
|
|
16
|
+
}
|
|
17
|
+
/** A line read: its words as shown, with its anchors and what is said another way. */
|
|
18
|
+
export interface SaidLine {
|
|
19
|
+
text: string;
|
|
20
|
+
anchors: TextAnchor[];
|
|
21
|
+
spans: SpokenSpan[];
|
|
22
|
+
}
|
|
23
|
+
/** An anchor's name: letters, digits, `_` and `-`. */
|
|
24
|
+
export declare const ANCHOR_NAME: RegExp;
|
|
25
|
+
/** `text` has something that reads as an anchor. */
|
|
26
|
+
export declare const hasAnchors: (text: string) => boolean;
|
|
27
|
+
/** `text` has something that reads as <shown|said>. */
|
|
28
|
+
export declare const hasSpans: (text: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A line as written, read: its words as shown, the anchors by where they
|
|
31
|
+
* sit in those words, the pieces said another way, and what is wrong. A
|
|
32
|
+
* start hugs the word after it and an end the word before it, wherever the
|
|
33
|
+
* spaces were written; one space goes with an anchor that had spaces both
|
|
34
|
+
* sides. Every anchor is returned, also a name written twice, so a draft
|
|
35
|
+
* that is wrong for a moment loses nothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readAnchors(raw: string): SaidLine & {
|
|
38
|
+
problems: string[];
|
|
39
|
+
};
|
|
40
|
+
/** A line as written, read (see readAnchors), without what is wrong with it. */
|
|
41
|
+
export declare function readLine(raw: string): SaidLine;
|
|
42
|
+
/**
|
|
43
|
+
* The line as said: each <shown|said> piece by its said side. `at` gives
|
|
44
|
+
* the place in it of a place in the line as shown; `end` asks for the end
|
|
45
|
+
* of a stretch, which stops before a piece that is only said, where a
|
|
46
|
+
* start goes past it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function spokenLine(line: SaidLine): {
|
|
49
|
+
text: string;
|
|
50
|
+
at(place: number, end: boolean): number;
|
|
51
|
+
/** The way back: the place in the line as shown of a place in the line as said. */
|
|
52
|
+
shown(place: number, end: boolean): number;
|
|
53
|
+
};
|
|
54
|
+
/** The line as written: its words with each anchor and each <shown|said> at its place. */
|
|
55
|
+
export declare function writeAnchors(text: string, anchors: readonly TextAnchor[], spans?: readonly SpokenSpan[]): string;
|
|
56
|
+
/** A line read, as written. */
|
|
57
|
+
export declare const writeLine: (line: SaidLine) => string;
|
|
58
|
+
/** A line as written, as its words are shown: no anchors, each piece by its shown side. */
|
|
59
|
+
export declare const withoutAnchors: (raw: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* The anchors after `removed` characters at `at` gave way to `inserted`
|
|
62
|
+
* new ones. An anchor stays with the words it was on: what is typed at a
|
|
63
|
+
* point or at a stretch's start goes after it, what is typed at a
|
|
64
|
+
* stretch's end goes inside. An anchor whose words went stays at the place
|
|
65
|
+
* they were; none is ever dropped.
|
|
66
|
+
*/
|
|
67
|
+
export declare function spliceAnchors(anchors: readonly TextAnchor[], at: number, removed: number, inserted: number): TextAnchor[];
|
|
68
|
+
/**
|
|
69
|
+
* The pieces said another way after the same change. A piece keeps what
|
|
70
|
+
* is typed over its own words and nothing typed beside it, unless `grow`
|
|
71
|
+
* says what was typed at its end, or at its start, goes on the same word
|
|
72
|
+
* (a digit after a digit). One whose shown words all went goes with them;
|
|
73
|
+
* a piece that is only said stays.
|
|
74
|
+
*/
|
|
75
|
+
export declare function spliceSpans(spans: readonly SpokenSpan[], at: number, removed: number, inserted: number, grow?: {
|
|
76
|
+
start?: boolean;
|
|
77
|
+
end?: boolean;
|
|
78
|
+
}): SpokenSpan[];
|
|
79
|
+
/**
|
|
80
|
+
* A line with `removed` characters at `at` giving way to `insert`. What is
|
|
81
|
+
* typed right at the edge of a piece said another way joins it when it
|
|
82
|
+
* goes on the same word: "4" after "1" is "14", a space or a new word is not.
|
|
83
|
+
*/
|
|
84
|
+
export declare function editLine(line: SaidLine, at: number, removed: number, insert: string): SaidLine;
|
|
85
|
+
/**
|
|
86
|
+
* The words of a line from `from` to `to`, trimmed, as a line of their
|
|
87
|
+
* own: with the anchors that start there (a stretch that runs on ends
|
|
88
|
+
* where these words do) and the pieces said another way that are whole in it.
|
|
89
|
+
*/
|
|
90
|
+
export declare function sliceLine(line: SaidLine, from: number, to: number): SaidLine;
|
|
91
|
+
/** Two lines as one, a space between their words. */
|
|
92
|
+
export declare function joinLines(a: SaidLine, b: SaidLine): SaidLine;
|
|
93
|
+
/** A stretch of a text that gave way: `removed` characters at `at`, for `inserted` at `into` of the new text. */
|
|
94
|
+
export interface TextChange {
|
|
95
|
+
at: number;
|
|
96
|
+
removed: number;
|
|
97
|
+
into: number;
|
|
98
|
+
inserted: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Where `after` differs from `before`: each stretch of `before` that gave
|
|
102
|
+
* way (`removed` characters at `at`) and how many took its place (at
|
|
103
|
+
* `into` of `after`), first to last. The longest run of pieces the two
|
|
104
|
+
* share stays; lines too long to compare so are one change in the middle.
|
|
105
|
+
*/
|
|
106
|
+
export declare function changesOf(before: string, after: string): TextChange[];
|
|
107
|
+
/**
|
|
108
|
+
* The anchors of a line whose words changed from `before` to `after`:
|
|
109
|
+
* the words the two share keep their anchors, and where they differ the
|
|
110
|
+
* anchors go by spliceAnchors.
|
|
111
|
+
*/
|
|
112
|
+
export declare function moveAnchors(anchors: readonly TextAnchor[], before: string, after: string): TextAnchor[];
|
|
113
|
+
/** A line with new words: its anchors and pieces moved with the words the two share. */
|
|
114
|
+
export declare function rewordLine(line: SaidLine, words: string): SaidLine;
|
|
115
|
+
/**
|
|
116
|
+
* A line as written with new words, what is written in it moved with
|
|
117
|
+
* them: for a text changed whole (a field of a table, an input method's text).
|
|
118
|
+
*/
|
|
119
|
+
export declare function rewordAnchored(raw: string, words: string): string;
|
|
120
|
+
/**
|
|
121
|
+
* An anchor's place in the line as spoken: counted in the letters and
|
|
122
|
+
* digits before it (normText), which is how a line is matched to the words
|
|
123
|
+
* of its sound.
|
|
124
|
+
*/
|
|
125
|
+
export interface LineAnchor {
|
|
126
|
+
name: string;
|
|
127
|
+
at: number;
|
|
128
|
+
end?: number;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Anchors by the letters and digits before them. `through` is what the
|
|
132
|
+
* line goes through before it is said (its {name} variables filled), given
|
|
133
|
+
* the words up to an anchor.
|
|
134
|
+
*/
|
|
135
|
+
export declare function lineAnchors(text: string, anchors: readonly TextAnchor[], through?: (text: string) => string): LineAnchor[];
|
|
136
|
+
/** "@form", "@/free", "@form+0.2": an anchor's name, which end, and a shift in seconds. */
|
|
137
|
+
export interface ParsedAnchorRef {
|
|
138
|
+
name: string;
|
|
139
|
+
end: boolean;
|
|
140
|
+
shift: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A reference that names an anchor, read against the names a line has: a
|
|
144
|
+
* whole name wins over a name with a shift ("@step-2" is the anchor
|
|
145
|
+
* step-2 when there is one, else step shifted two seconds back).
|
|
146
|
+
* Undefined when it does not start with "@".
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseAnchorRef(ref: string, names?: ReadonlySet<string>): ParsedAnchorRef | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* A line with one end of an anchor moved to a moment of its sound: to the
|
|
151
|
+
* start of the word that starts nearest `t` (or, for the end of a stretch,
|
|
152
|
+
* the end of the word that ends nearest). `words` are the words of the
|
|
153
|
+
* line's sound, on the clock `t` is on. Undefined when the line has no
|
|
154
|
+
* such anchor or end, has no sound, or the stretch would be left with no
|
|
155
|
+
* words in it.
|
|
156
|
+
*/
|
|
157
|
+
export declare function anchorAtTime(line: SaidLine, name: string, end: boolean, words: readonly Word[], t: number): SaidLine | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* What is wrong with writing `value` over `before` as a move of anchors:
|
|
160
|
+
* the two must have the same words and the same pieces said another way,
|
|
161
|
+
* and the same anchors by name, each still readable. Undefined when it is one.
|
|
162
|
+
*/
|
|
163
|
+
export declare function anchorMoveProblem(before: string, value: string): string | undefined;
|
|
164
|
+
//# sourceMappingURL=anchors.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{normText as w,ScriptAlignment as O,WordStream as y}from"./words.js";export const ANCHOR_NAME=/^[A-Za-z0-9_-]+$/;const H=/@\{(\/?)([^{}]*)\}|<([^<>|\n]*)\|([^<>\n]*)>/g,M=/\s/u;export const hasAnchors=n=>/@\{[^{}]*\}/.test(n),hasSpans=n=>/<[^<>|\n]*\|[^<>\n]*>/.test(n);export function readAnchors(n){const e=[],a=[],s=[],o=[],h=new Set;let r="",c=0,u=!1;const t=d=>{r+=u?d.replace(/^[ \t]+/,""):d,u=!1};for(const d of n.matchAll(H)){if(d[3]!==void 0){const m=d[3].trim(),x=(d[4]??"").trim();if(m===""&&x===""){e.push("<|> shows nothing and says nothing");continue}hasAnchors(d[0])&&e.push(`${d[0]} has an anchor inside: write the anchor before the <`),t(n.slice(c,d.index)),c=d.index+d[0].length,s.push({at:r.length,end:r.length+m.length,speak:x}),r+=m;continue}const p=d[2]??"";if(!ANCHOR_NAME.test(p)){e.push(`${d[0]} is not an anchor: a name has only letters, digits, _ and -`);continue}if(t(n.slice(c,d.index)),c=d.index+d[0].length,u=r===""||M.test(r.slice(-1)),d[1]==="/"){let m=o.length-1;for(;m>=0&&o[m]?.name!==p;)m--;const x=o[m];if(!x){e.push(`@{/${p}} ends an anchor that did not start`);continue}o.splice(m,1),x.end=r.length;continue}h.has(p)&&e.push(`the anchor ${p} is there twice`),h.add(p);const A={name:p,at:r.length};a.push(A),o.push(A)}t(n.slice(c));const f=a.map(d=>E(r,d)),i=spokenLine({text:r,anchors:f,spans:s});for(const d of f)d.end!==void 0&&w(i.text.slice(i.at(d.at,!1),i.at(d.end,!0)))===""&&e.push(`the anchor ${d.name} has no words between its two ends`);return{text:r,anchors:f,spans:s,problems:e}}export function readLine(n){const{text:e,anchors:a,spans:s}=readAnchors(n);return{text:e,anchors:a,spans:s}}function E(n,e){const a=r=>Math.max(0,Math.min(r,n.length)),s=e.end===void 0?n.length:Math.max(a(e.at),a(e.end));let o=a(e.at);for(;o<s&&M.test(n.charAt(o));)o++;if(e.end===void 0)return{name:e.name,at:o};let h=s;for(;h>o&&M.test(n.charAt(h-1));)h--;return{name:e.name,at:o,end:h}}export function spokenLine(n){const e=[...n.spans].sort((r,c)=>r.at-c.at||r.end-c.end);let a="",s=0;for(const r of e)a+=n.text.slice(s,r.at)+r.speak,s=r.end;return a+=n.text.slice(s),{text:a,at:(r,c)=>{let u=0;for(const t of e){const f=t.speak.length-(t.end-t.at);if(t.end<r||t.end===r&&(t.at<r||!c))u+=f;else if(t.at<r&&r<t.end)return c?t.end+u+f:t.at+u}return r+u},shown:(r,c)=>{let u=0;for(const t of e){const f=t.at+u,i=f+t.speak.length;if(c?r<=f:r<f)break;if(c?r<=i:r<i)return c?t.end:t.at;u+=t.speak.length-(t.end-t.at)}return r-u}}}export function writeAnchors(n,e,a=[]){if(e.length===0&&a.length===0)return n;const s=t=>Math.max(0,Math.min(t,n.length)),o=a.map(t=>({at:s(t.at),end:Math.max(s(t.at),s(t.end)),speak:t.speak})).sort((t,f)=>t.at-f.at||t.end-f.end),h=(t,f)=>{const i=o.find(d=>d.at<t&&t<d.end);return i?f?i.end:i.at:t},r=[];e.forEach((t,f)=>{const{name:i,at:d,end:p}=E(n,t),A=h(d,!1);if(r.push({pos:A,rank:2,order:f,token:`@{${i}}`}),p===void 0)return;const m=Math.max(A,h(p,!0));r.push({pos:m,rank:m===A?3:0,order:f,token:`@{/${i}}`})}),o.forEach((t,f)=>{r.push({pos:t.at,rank:t.end===t.at?1:4,order:f,token:`<${n.slice(t.at,t.end)}|${t.speak}>`,until:t.end})}),r.sort((t,f)=>t.pos-f.pos||t.rank-f.rank||t.order-f.order);let c="",u=0;for(const t of r)t.pos<u||(c+=n.slice(u,t.pos)+t.token,u=t.until??t.pos);return c+n.slice(u)}export const writeLine=n=>writeAnchors(n.text,n.anchors,n.spans),withoutAnchors=n=>hasAnchors(n)||hasSpans(n)?readAnchors(n).text:n;export function spliceAnchors(n,e,a,s){const o=e+a,h=c=>c<=e?c:c<o?e:c-a+s,r=c=>c<e?c:c<=o?e+s:c-a+s;return n.map(c=>{const u=h(c.at);return c.end===void 0?{name:c.name,at:u}:{name:c.name,at:u,end:Math.max(u,r(c.end))}})}export function spliceSpans(n,e,a,s,o={}){const h=e+a,r=i=>i-a+s,c=o.end===!0&&a===0&&n.some(i=>i.end===e&&i.at<e),u=o.start===!0&&a===0&&!c,t=i=>i<e?i:i===e?a>0||u?i:i+s:i<h?e+s:r(i),f=i=>i<e?i:i===e?c?i+s:i:i<h?e:i===h?e+s:r(i);return n.flatMap(i=>{if(i.end===i.at){const A=i.at<=e?i.at:i.at<h?e:r(i.at);return[{at:A,end:A,speak:i.speak}]}const d=t(i.at),p=f(i.end);return p>d?[{at:d,end:p,speak:i.speak}]:[]})}const j=/^(?![\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}])[\p{L}\p{N}]$/u;export function editLine(n,e,a,s){const o=c=>c!==void 0&&j.test(c),h=c=>/^./su.exec(c)?.[0],r=c=>/.$/su.exec(c)?.[0];return{text:n.text.slice(0,e)+s+n.text.slice(e+a),anchors:spliceAnchors(n.anchors,e,a,s.length),spans:spliceSpans(n.spans,e,a,s.length,{end:o(h(s))&&o(r(n.text.slice(0,e))),start:o(r(s))&&o(h(n.text.slice(e)))})}}export function sliceLine(n,e,a){const s=n.text.slice(e,a),o=s.trim(),h=s.length-s.trimStart().length,r=t=>Math.max(0,Math.min(t-e-h,o.length)),c=a>=n.text.length,u=t=>t>=e&&(t<a||c);return{text:o,anchors:n.anchors.filter(t=>u(t.at)).map(t=>({name:t.name,at:r(t.at),...t.end===void 0?{}:{end:r(t.end)}})),spans:n.spans.filter(t=>u(t.at)&&t.end<=a).map(t=>({at:r(t.at),end:r(t.end),speak:t.speak}))}}export function joinLines(n,e){const a=[n.text,e.text].filter(o=>o!=="").join(" "),s=a.length-e.text.length;return{text:a,anchors:[...n.anchors,...e.anchors.map(o=>({name:o.name,at:o.at+s,...o.end===void 0?{}:{end:o.end+s}}))],spans:[...n.spans,...e.spans.map(o=>({at:o.at+s,end:o.end+s,speak:o.speak}))]}}const N=/\s+|[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]|[\p{L}\p{N}]+|./gsu,C=4e5;export function changesOf(n,e){const a=n.match(N)??[],s=e.match(N)??[];let o=0;for(;o<a.length&&o<s.length&&a[o]===s[o];)o++;let h=0;for(;h<a.length-o&&h<s.length-o&&a[a.length-1-h]===s[s.length-1-h];)h++;const r=a.length-o-h,c=s.length-o-h,u=(k,g,$)=>{let L=0;for(let S=g;S<$;S++)L+=(k[S]??"").length;return L},t=u(a,0,o);if(r===0&&c===0)return[];if(r===0||c===0||r*c>C)return[{at:t,removed:u(a,o,o+r),into:t,inserted:u(s,o,o+c)}];const f=c+1,i=new Int32Array((r+1)*f);for(let k=r-1;k>=0;k--)for(let g=c-1;g>=0;g--)i[k*f+g]=a[o+k]===s[o+g]?(i[(k+1)*f+g+1]??0)+1:Math.max(i[(k+1)*f+g]??0,i[k*f+g+1]??0);const d=[];let p=t,A=t,m,x=0,l=0;for(;x<r||l<c;){const k=a[o+x],g=s[o+l];if(x<r&&l<c&&k===g){m=void 0,p+=(k??"").length,A+=(g??"").length,x++,l++;continue}m||(m={at:p,removed:0,into:A,inserted:0},d.push(m)),l>=c||x<r&&(i[(x+1)*f+l]??0)>=(i[x*f+l+1]??0)?(m.removed+=(k??"").length,p+=(k??"").length,x++):(m.inserted+=(g??"").length,A+=(g??"").length,l++)}return d}export function moveAnchors(n,e,a){return n.length===0||e===a?[...n]:changesOf(e,a).reduceRight((s,o)=>spliceAnchors(s,o.at,o.removed,o.inserted),[...n])}export function rewordLine(n,e){return n.text===e?n:changesOf(n.text,e).reduceRight((a,s)=>editLine(a,s.at,s.removed,e.slice(s.into,s.into+s.inserted)),n)}export function rewordAnchored(n,e){return!hasAnchors(n)&&!hasSpans(n)?e:writeLine(rewordLine(readLine(n),e))}export function lineAnchors(n,e,a=s=>s){const s=o=>w(a(n.slice(0,o))).length;return e.map(o=>({name:o.name,at:s(o.at),...o.end===void 0?{}:{end:s(o.end)}}))}export function parseAnchorRef(n,e=new Set){const a=/^@(\/?)(.+)$/su.exec(n.trim());if(!a?.[2])return;const s=a[1]==="/",o=a[2];if(e.has(o))return{name:o,end:s,shift:0};const h=/^(.+?)([+-]\d*\.?\d+)$/su.exec(o);return h?.[1]&&h[2]?{name:h[1],end:s,shift:Number(h[2])}:{name:o,end:s,shift:0}}export function anchorAtTime(n,e,a,s,o){const h=n.anchors.find(l=>l.name===e);if(!h||a&&h.end===void 0||s.length===0)return;const r=spokenLine(n),c=new O(new y(s),[r.text]),u=c.lines[0]?.length??0;if(u===0)return;const t=[],f=[];let i=0;for(const l of r.text.matchAll(/./gsu)){const k=w(l[0]).length;for(let g=0;g<k;g++)t.push(i),f.push(i+l[0].length);i+=l[0].length}const d=l=>c.wordAtChar(0,l);let p;const A=(l,k)=>{if(k===void 0)return;const g=Math.abs(k-o);(!p||g<p.off)&&(p={place:l,off:g})};for(let l=0;l<u;l++)a?(l===u-1||d(l+1)!==d(l))&&A(f[l]??r.text.length,s[d(l)]?.end):(l===0||d(l-1)!==d(l))&&A(t[l]??0,s[d(l)]?.start);if(!a&&h.end===void 0&&A(r.text.length,s.at(-1)?.end),!p)return;const m=r.shown(p.place,a),x=a?{name:e,at:h.at,end:m}:{name:e,at:m,...h.end===void 0?{}:{end:h.end}};if(!(x.end!==void 0&&w(r.text.slice(r.at(x.at,!1),r.at(x.end,!0)))===""))return{text:n.text,spans:n.spans,anchors:n.anchors.map(l=>l===h?x:l)}}export function anchorMoveProblem(n,e){const a=readAnchors(n),s=readAnchors(e);if(s.problems.length>0)return s.problems.join("; ");if(a.text!==s.text||JSON.stringify(a.spans)!==JSON.stringify(s.spans))return"moving an anchor changes no words";const o=h=>h.anchors.map(r=>`${r.name}${r.end===void 0?"":"…"}`).sort().join(" ");return o(a)===o(s)?void 0:"moving an anchor adds and removes none"}
|