@allyhub/sdk 0.1.0-alpha.7 → 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,148 @@
|
|
|
1
|
+
/** An output's mix levels (`video({ mix })`), LUFS; each default is the audio package's. */
|
|
2
|
+
export interface MixOptions {
|
|
3
|
+
/** Each part's speech; default -16. */
|
|
4
|
+
speech?: number;
|
|
5
|
+
/** The music while speech plays; default -20. */
|
|
6
|
+
music?: number;
|
|
7
|
+
/** The music where nobody speaks; default -16. */
|
|
8
|
+
musicAlone?: number;
|
|
9
|
+
/** Sound effects from files; built-in sounds move by the same amount from the default; default -22. */
|
|
10
|
+
sfx?: number;
|
|
11
|
+
/** Footage's own sound where nobody speaks; default -16. */
|
|
12
|
+
footage?: number;
|
|
13
|
+
/** Footage's own sound while speech plays; default -22. */
|
|
14
|
+
footageUnderSpeech?: number;
|
|
15
|
+
/**
|
|
16
|
+
* How the music dips under words: `db` below its level while speech
|
|
17
|
+
* plays (default -8), going down over `attack` seconds before a word
|
|
18
|
+
* (0.3), back up over `release` after one (1), and staying down
|
|
19
|
+
* through pauses shorter than `hold` (2).
|
|
20
|
+
*/
|
|
21
|
+
duck?: {
|
|
22
|
+
db?: number;
|
|
23
|
+
attack?: number;
|
|
24
|
+
release?: number;
|
|
25
|
+
hold?: number;
|
|
26
|
+
};
|
|
27
|
+
/** The music's fade in at the start and out at the end, seconds; defaults 0.3 and 1.5 (at most a quarter of the video). */
|
|
28
|
+
musicFade?: {
|
|
29
|
+
in?: number;
|
|
30
|
+
out?: number;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The mix's settings with every default filled in. */
|
|
34
|
+
export interface MixLevels {
|
|
35
|
+
speech: number;
|
|
36
|
+
music: number;
|
|
37
|
+
musicAlone: number;
|
|
38
|
+
sfx: number;
|
|
39
|
+
footage: number;
|
|
40
|
+
footageUnderSpeech: number;
|
|
41
|
+
duck: {
|
|
42
|
+
db: number;
|
|
43
|
+
attack: number;
|
|
44
|
+
release: number;
|
|
45
|
+
hold: number;
|
|
46
|
+
};
|
|
47
|
+
musicFade: {
|
|
48
|
+
in: number;
|
|
49
|
+
out: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface MasterOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Integrated loudness, LUFS (-70 to 0); default the platform profile's,
|
|
55
|
+
* else -14. false keeps the mix's own level (peaks still limited).
|
|
56
|
+
*/
|
|
57
|
+
lufs?: number | false;
|
|
58
|
+
/** True-peak ceiling, dBTP (-9 to 0); default -3 (AAC overshoots up to about 2 dB). */
|
|
59
|
+
truePeak?: number;
|
|
60
|
+
}
|
|
61
|
+
/** The master's targets, or false to keep the mix's level (its peaks still limited to `truePeak`). */
|
|
62
|
+
export interface MasterTargets {
|
|
63
|
+
lufs: number | false;
|
|
64
|
+
truePeak: number;
|
|
65
|
+
}
|
|
66
|
+
export declare const BAND_TYPES: readonly ["highpass", "lowpass", "bandpass", "peak", "lowshelf", "highshelf"];
|
|
67
|
+
export type BandType = (typeof BAND_TYPES)[number];
|
|
68
|
+
/**
|
|
69
|
+
* A moment of the film a video-level option names: film seconds, an
|
|
70
|
+
* anchor of any part ("@drop", "@drop+0.2", "@/drop") or a part's key
|
|
71
|
+
* (its start), or a word reference in a part (`{ part, at }`: `at` as a
|
|
72
|
+
* layer's at, from that part's start).
|
|
73
|
+
*/
|
|
74
|
+
export type SoundMoment = number | string | {
|
|
75
|
+
part: string;
|
|
76
|
+
at: number | string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* A band's values from a moment of the film on: `at` is the moment (the
|
|
80
|
+
* music's own reference: film seconds, an anchor, a part or a word in a
|
|
81
|
+
* part), and what it leaves out is the band's own value.
|
|
82
|
+
*/
|
|
83
|
+
export interface BandKey<T = SoundMoment> {
|
|
84
|
+
at: T;
|
|
85
|
+
hz?: number;
|
|
86
|
+
db?: number;
|
|
87
|
+
q?: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* One band of an equalizer: a pass (`highpass`, `lowpass`, `bandpass`,
|
|
91
|
+
* with its `q`, default a Butterworth's 0.707), a `peak` (`db` at `hz`,
|
|
92
|
+
* `q` default 1) or a shelf (`lowshelf`, `highshelf`: `db` under or over
|
|
93
|
+
* `hz`, `q` the shelf's slope, default 1). `keys` move its values over
|
|
94
|
+
* the film's clock (music only).
|
|
95
|
+
*/
|
|
96
|
+
export interface EqBand<T = SoundMoment> {
|
|
97
|
+
type: BandType;
|
|
98
|
+
hz: number;
|
|
99
|
+
db?: number;
|
|
100
|
+
q?: number;
|
|
101
|
+
keys?: BandKey<T>[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A compressor: from `threshold` dB over the stem's loudness (its
|
|
105
|
+
* integrated loudness as shaped so far: 0 is at it, -6 six dB under), the
|
|
106
|
+
* level over it is divided by `ratio`.
|
|
107
|
+
*/
|
|
108
|
+
export interface SoundCompressor {
|
|
109
|
+
threshold: number;
|
|
110
|
+
/** Input dB over the threshold per output dB; default 2. */
|
|
111
|
+
ratio?: number;
|
|
112
|
+
/** The knee's width, dB; default 6. */
|
|
113
|
+
knee?: number;
|
|
114
|
+
/** Seconds to go down, and to come back up; defaults 0.01 and 0.15. */
|
|
115
|
+
attack?: number;
|
|
116
|
+
release?: number;
|
|
117
|
+
/** The detector's window, seconds (0: the peak); default 0.01. */
|
|
118
|
+
window?: number;
|
|
119
|
+
}
|
|
120
|
+
/** How a stem is shaped (`music: { filter, eq, compress }`, a sound's own). */
|
|
121
|
+
export interface SoundShape<T = SoundMoment> {
|
|
122
|
+
/**
|
|
123
|
+
* An ffmpeg audio filter chain run on the file as it is decoded, on the
|
|
124
|
+
* file's own clock ("acompressor=ratio=3,deesser"): one chain, nothing
|
|
125
|
+
* that reads files, makes sound of its own or changes the timing.
|
|
126
|
+
*/
|
|
127
|
+
filter?: string;
|
|
128
|
+
/** Equalizer bands, in order. */
|
|
129
|
+
eq?: EqBand<T>[];
|
|
130
|
+
/** A compressor after the bands. */
|
|
131
|
+
compress?: SoundCompressor;
|
|
132
|
+
}
|
|
133
|
+
/** A shape whose bands do not move (a sound effect's). */
|
|
134
|
+
export type FixedShape = Omit<SoundShape, "eq"> & {
|
|
135
|
+
eq?: Omit<EqBand, "keys">[];
|
|
136
|
+
};
|
|
137
|
+
/** A shape resolved for the mix: its keys at film seconds. */
|
|
138
|
+
export type ResolvedShape = SoundShape<number>;
|
|
139
|
+
/**
|
|
140
|
+
* How a voice was recorded (`video({ mic })`, `part({ mic })`): a setup by
|
|
141
|
+
* name (studio, phone, lav), a setup's options with any value changed, or
|
|
142
|
+
* false (played as it is). Its fields and their checks are the audio
|
|
143
|
+
* package's recording; here it is only carried.
|
|
144
|
+
*/
|
|
145
|
+
export type VoiceSetting = string | Readonly<Record<string, unknown>> | false;
|
|
146
|
+
/** A voice setting resolved over its presets, as the audio package resolves it. */
|
|
147
|
+
export type ResolvedVoice = Readonly<Record<string, unknown>>;
|
|
148
|
+
//# sourceMappingURL=audio-types.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The softness of the person's edge over a treated background when the
|
|
3
|
+
* layer does not say (`background.feather`): px at 1080p.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MATTE_FEATHER = 2;
|
|
6
|
+
/**
|
|
7
|
+
* How far the person's edge is pulled in then (`background.shrink`): px at
|
|
8
|
+
* 1080p. A little, so the rim of the old background the matte keeps round
|
|
9
|
+
* the person does not show against the new one.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MATTE_SHRINK = 4;
|
|
12
|
+
/** The most `background.blur`, `feather` and `shrink` take, px at 1080p. */
|
|
13
|
+
export declare const BACKDROP_BLUR_MAX = 200;
|
|
14
|
+
export declare const MATTE_FEATHER_MAX = 40;
|
|
15
|
+
export declare const MATTE_SHRINK_MAX = 40;
|
|
16
|
+
/**
|
|
17
|
+
* The frame's pixels in one "px at 1080p": a background's lengths (blur,
|
|
18
|
+
* feather, shrink) scale with the format's shorter side, so the same
|
|
19
|
+
* numbers look the same in every format.
|
|
20
|
+
*/
|
|
21
|
+
export declare function backdropUnit(width: number, height: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* A matte's levels are made firm before anything else: under the first
|
|
24
|
+
* (of 0–1) is none of the person, over the second all, a straight ramp
|
|
25
|
+
* between. A matte is a guess, and where it is unsure inside the person (a
|
|
26
|
+
* hand moving in front of the chest comes out at 0.9) the person is not
|
|
27
|
+
* see-through; its edge is then one clean line to soften and pull in.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MATTE_FIRM: readonly [number, number];
|
|
30
|
+
/** The firm level (0–255) of each level of a matte (0–255). */
|
|
31
|
+
export declare function firmLevels(): Uint8ClampedArray;
|
|
32
|
+
/** The same as an ffmpeg expression of `val` (0–255), for the lut filter. */
|
|
33
|
+
export declare function firmLevelsExpr(): string;
|
|
34
|
+
/**
|
|
35
|
+
* How a matte becomes the person's alpha: made firm (firmLevels), blurred
|
|
36
|
+
* by `sigma`, then each level m (0–1) becomes m / (m + gain × (1 − m)).
|
|
37
|
+
*/
|
|
38
|
+
export interface MatteEdge {
|
|
39
|
+
/** Gaussian blur of the matte, its standard deviation in the frame's pixels (0: none). */
|
|
40
|
+
sigma: number;
|
|
41
|
+
/** Over 1 pulls the edge in, under 1 lets it out, 1 leaves it. */
|
|
42
|
+
gain: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* After the blur, a matte's lowest and highest levels count as none and
|
|
46
|
+
* all of the person: a little of each end, so that a level one short of
|
|
47
|
+
* all (the blur's rounding) does not make the whole person see-through
|
|
48
|
+
* once the edge is pulled in.
|
|
49
|
+
*/
|
|
50
|
+
export declare const MATTE_FLOOR = 6;
|
|
51
|
+
/**
|
|
52
|
+
* The person's edge from a matte: `feather` softens it and `shrink` pulls
|
|
53
|
+
* it in (negative: lets it out), both in the frame's pixels; `scale` is
|
|
54
|
+
* the frame's pixels per matte pixel (a matte is smaller than the picture,
|
|
55
|
+
* so its edge, made firm, is still about a fifth of a matte pixel soft).
|
|
56
|
+
*
|
|
57
|
+
* The firm matte is blurred, which makes its edge an S-shaped ramp around
|
|
58
|
+
* where it was, as soft as the feather and the matte's own softness
|
|
59
|
+
* together. Sliding that ramp `shrink` pixels along is, on its levels,
|
|
60
|
+
* m → m / (m + gain × (1 − m)) with gain = exp(1.702 × shrink / softness)
|
|
61
|
+
* (the logistic curve that follows a Gaussian edge within a hundredth). A
|
|
62
|
+
* shrink the ramp is too narrow for (over 1.5 times its softness, where
|
|
63
|
+
* the levels left would be too few) widens the blur.
|
|
64
|
+
*/
|
|
65
|
+
export declare function matteEdge(feather: number, shrink: number, scale: number): MatteEdge;
|
|
66
|
+
/** The person's alpha (0–255) for each level of a blurred matte (0–255). */
|
|
67
|
+
export declare function edgeLevels(edge: MatteEdge): Uint8ClampedArray;
|
|
68
|
+
/**
|
|
69
|
+
* The same levels as an ffmpeg expression of `val` (0–255), for the lut
|
|
70
|
+
* filter.
|
|
71
|
+
*/
|
|
72
|
+
export declare function edgeLevelsExpr(edge: MatteEdge): string;
|
|
73
|
+
/**
|
|
74
|
+
* How much smaller a background is blurred: a blur of standard deviation
|
|
75
|
+
* `sigma` (pixels) holds no detail finer than about a third of it, so the
|
|
76
|
+
* picture is blurred at 1/2, 1/4 or 1/8 of its size and scaled back.
|
|
77
|
+
*/
|
|
78
|
+
export declare function blurStep(sigma: number): 1 | 2 | 4 | 8;
|
|
79
|
+
/**
|
|
80
|
+
* The colour matrix of a background's `desaturate` and `dim` (each 0–1):
|
|
81
|
+
* rows for red, green and blue out, columns for red, green and blue in.
|
|
82
|
+
* The same as CSS `saturate(1 − desaturate) brightness(1 − dim)`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function backdropMatrix(desaturate: number, dim: number): [Row, Row, Row];
|
|
85
|
+
/** A row of a colour matrix: how much of red, green and blue goes into one channel. */
|
|
86
|
+
export type Row = [r: number, g: number, b: number];
|
|
87
|
+
//# sourceMappingURL=backdrop.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 MATTE_FEATHER=2,MATTE_SHRINK=4,BACKDROP_BLUR_MAX=200,MATTE_FEATHER_MAX=40,MATTE_SHRINK_MAX=40;export function backdropUnit(t,o){return Math.min(t,o)/1080}export const MATTE_FIRM=[.25,.75];export function firmLevels(){const t=new Uint8ClampedArray(256),[o,n]=MATTE_FIRM;for(let r=0;r<256;r++)t[r]=Math.round((r/255-o)/(n-o)*255);return t}export function firmLevelsExpr(){const[t,o]=MATTE_FIRM;return`clip((val-${String(t*255)})/${String(o-t)},0,255)`}export const MATTE_FLOOR=6;export function matteEdge(t,o,n){const r=.2*Math.max(0,n),a=Math.max(Math.hypot(t,r),Math.abs(o)/1.5,.001),c=Math.sqrt(Math.max(0,a*a-r*r)),e=s=>Math.round(s*1e4)/1e4;return{sigma:e(c),gain:e(Math.exp(1.702*o/a))}}export function edgeLevels(t){const o=new Uint8ClampedArray(256);for(let n=0;n<256;n++){const r=Math.min(Math.max((n-MATTE_FLOOR)/(255-2*MATTE_FLOOR),0),1);o[n]=Math.round(255*r/(r+t.gain*(1-r)))}return o}export function edgeLevelsExpr(t){const o=255-2*MATTE_FLOOR,n=`clip((val-${String(MATTE_FLOOR)})/${String(o)},0,1)`;return`255*${n}/(${n}+${String(t.gain)}*(1-${n}))`}export function blurStep(t){return t>=24?8:t>=12?4:t>=6?2:1}const i=[.2126,.7152,.0722];export function backdropMatrix(t,o){const n=Math.min(Math.max(t,0),1),r=1-Math.min(Math.max(o,0),1),a=e=>Math.round(e*1e4)/1e4,c=e=>[a(r*(n*i[0]+(e===0?1-n:0))),a(r*(n*i[1]+(e===1?1-n:0))),a(r*(n*i[2]+(e===2?1-n:0)))];return[c(0),c(1),c(2)]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Word } from "./media.js";
|
|
2
|
+
import type { CaptionOptions, CaptionTrackCue, CaptionWord } from "./piece.js";
|
|
3
|
+
import type { PartText, Timeline } from "./timeline.js";
|
|
4
|
+
export interface CaptionCue {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
text: string;
|
|
8
|
+
part: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CaptionLine {
|
|
11
|
+
part: string;
|
|
12
|
+
/** The line as shown, and as spoken. */
|
|
13
|
+
shown: string;
|
|
14
|
+
spoken: string;
|
|
15
|
+
/** The part's words on the film's clock. */
|
|
16
|
+
words: readonly Word[];
|
|
17
|
+
}
|
|
18
|
+
export interface CaptionInput {
|
|
19
|
+
/** Voiced parts in order. */
|
|
20
|
+
lines: CaptionLine[];
|
|
21
|
+
fps: number;
|
|
22
|
+
}
|
|
23
|
+
/** How subtitle cues are cut and timed (srt and vtt, and the player's captions). */
|
|
24
|
+
export interface CaptionCueOptions {
|
|
25
|
+
/** Most characters on a cue's line. */
|
|
26
|
+
maxChars?: number;
|
|
27
|
+
/** Most characters on a line in Chinese, Japanese or Korean. */
|
|
28
|
+
maxCharsCjk?: number;
|
|
29
|
+
/** Shortest a cue lasts, in seconds (unless the next cue starts sooner). */
|
|
30
|
+
minSeconds?: number;
|
|
31
|
+
/** Longest a cue lasts, in seconds. */
|
|
32
|
+
maxSeconds?: number;
|
|
33
|
+
/** Frames left between a cue's end and the next cue's start. */
|
|
34
|
+
gapFrames?: number;
|
|
35
|
+
}
|
|
36
|
+
/** The values captionCues uses for options not given. */
|
|
37
|
+
export declare const CAPTION_CUE_DEFAULTS: Readonly<Required<CaptionCueOptions>>;
|
|
38
|
+
/**
|
|
39
|
+
* The caption lines of a timeline: each voiced part's words (from its
|
|
40
|
+
* take's words file), with the text it says.
|
|
41
|
+
*/
|
|
42
|
+
export declare function speechLines(timeline: Pick<Timeline, "parts">, texts: readonly PartText[], media: Readonly<Record<string, {
|
|
43
|
+
words?: Word[] | undefined;
|
|
44
|
+
}>>): CaptionLine[];
|
|
45
|
+
/**
|
|
46
|
+
* Where a place in a line as shown is in the line as said, both counted in
|
|
47
|
+
* letters and digits (normText). The words the two share are at the same
|
|
48
|
+
* place in both; inside a stretch that differs, the place is in proportion.
|
|
49
|
+
* Two lines with nothing in common are in proportion from end to end.
|
|
50
|
+
*/
|
|
51
|
+
export declare function shownToSpoken(shown: string, spoken: string): (place: number) => number;
|
|
52
|
+
/** Character spans of a line, [from, to): a break never falls inside one. */
|
|
53
|
+
export type KeptSpan = [from: number, to: number];
|
|
54
|
+
/**
|
|
55
|
+
* Where a line says each phrase of `keep` (whole words, matched as said:
|
|
56
|
+
* case, accents and punctuation ignored), as character spans of the line.
|
|
57
|
+
* Chinese, Japanese and Korean phrases match inside the text.
|
|
58
|
+
*/
|
|
59
|
+
export declare function keptSpans(line: string, keep: readonly string[]): KeptSpan[];
|
|
60
|
+
/**
|
|
61
|
+
* Splits a line into caption-sized pieces, keeping their positions. A
|
|
62
|
+
* piece breaks at no position inside a `keep` span: a piece that cannot
|
|
63
|
+
* break elsewhere stays longer than `max`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function splitLine(line: string, max?: number, keep?: readonly KeptSpan[]): {
|
|
66
|
+
text: string;
|
|
67
|
+
from: number;
|
|
68
|
+
to: number;
|
|
69
|
+
}[];
|
|
70
|
+
/**
|
|
71
|
+
* Subtitle cues from the voiced parts' lines: one line per cue, cut at
|
|
72
|
+
* sentence ends, then clauses, then the length; frame-snapped, between
|
|
73
|
+
* minSeconds and maxSeconds long, gapFrames before the next cue.
|
|
74
|
+
* Options not given are CAPTION_CUE_DEFAULTS.
|
|
75
|
+
*/
|
|
76
|
+
export declare function captionCues(input: CaptionInput, options?: CaptionCueOptions): CaptionCue[];
|
|
77
|
+
/**
|
|
78
|
+
* The subtitles (srt, vtt and the player's captions). A piece whose layers
|
|
79
|
+
* read its captions (`ctx.captions(options)`) has its subtitles cut and
|
|
80
|
+
* timed as the captions it burns in, by the options its first such layer
|
|
81
|
+
* asked; a piece without one, by captionCues and CAPTION_CUE_DEFAULTS.
|
|
82
|
+
*/
|
|
83
|
+
export declare function subtitleCues(input: CaptionInput, asked?: CaptionOptions): CaptionCue[];
|
|
84
|
+
/** A cue with its words, on the film's clock. */
|
|
85
|
+
export interface WordCue {
|
|
86
|
+
start: number;
|
|
87
|
+
end: number;
|
|
88
|
+
text: string;
|
|
89
|
+
part: string;
|
|
90
|
+
words: CaptionWord[];
|
|
91
|
+
}
|
|
92
|
+
export interface WordCueOptions {
|
|
93
|
+
fps: number;
|
|
94
|
+
/** Most characters in a cue; default 32 (16 for Chinese, Japanese and Korean). */
|
|
95
|
+
maxChars?: number;
|
|
96
|
+
/** Most words in a cue; default no limit. */
|
|
97
|
+
maxWords?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Phrases a cue never breaks inside ("work harder"), wherever a line
|
|
100
|
+
* says them: the cue around one may run over maxChars or maxWords.
|
|
101
|
+
*/
|
|
102
|
+
keep?: readonly string[];
|
|
103
|
+
/** Seconds: a gap between two cues of a part shorter than this closes; default 0.4. */
|
|
104
|
+
close?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Caption cues with word times, for the burned-in captions track: each
|
|
108
|
+
* voiced part's line (as written; the times from aligning it to the
|
|
109
|
+
* words heard), cut at sentence and clause ends, then by length and word
|
|
110
|
+
* count. A cue never spans two parts. Cues follow each other without a
|
|
111
|
+
* flicker: a gap under `close` (0.4 s) is closed.
|
|
112
|
+
*/
|
|
113
|
+
export declare function wordCues(lines: readonly CaptionLine[], opts: WordCueOptions): WordCue[];
|
|
114
|
+
/**
|
|
115
|
+
* The cues a part shows over its picture [start, end) in film seconds,
|
|
116
|
+
* on the part's clock: cues are clipped to the picture (a J or L cut's
|
|
117
|
+
* speech heard under a neighbour's picture shows there).
|
|
118
|
+
*/
|
|
119
|
+
export declare function cuesIn(cues: readonly WordCue[], start: number, end: number): CaptionTrackCue[];
|
|
120
|
+
export declare function toSrt(cues: readonly CaptionCue[]): string;
|
|
121
|
+
export declare function toVtt(cues: readonly CaptionCue[]): string;
|
|
122
|
+
//# sourceMappingURL=captions.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{changesOf as V}from"./anchors.js";import{normText as p,joinWords as z,ScriptAlignment as v,WordStream as F}from"./words.js";import{speechWords as D}from"./speech.js";export const CAPTION_CUE_DEFAULTS={maxChars:42,maxCharsCjk:16,minSeconds:.8,maxSeconds:6,gapFrames:2};export function speechLines(f,o,c){return f.parts.flatMap(r=>{const s=r.speech,h=s?c[s.file]?.words:void 0;if(!s||!h?.length)return[];const a=D(h,s);if(a.length===0)return[];const n=o.find(t=>t.key===r.key),e=n?.spoken??z(a);return[{part:r.key,shown:e,spoken:n?.speak??e,words:a}]})}export function shownToSpoken(f,o){const c=(s,h)=>p(s.slice(0,h)).length,r=[[0,0]];for(const s of V(f,o))r.push([c(f,s.at),c(o,s.into)]),r.push([c(f,s.at+s.removed),c(o,s.into+s.inserted)]);return r.push([p(f).length,p(o).length]),s=>{for(let h=1;h<r.length;h++){const[a,n]=r[h-1]??[0,0],[e,t]=r[h]??[0,0];if(s>e&&h<r.length-1)continue;if(e<=a)return s<=a?n:t;const u=Math.max(0,Math.min(1,(s-a)/(e-a)));return n+(t-n)*u}return 0}}const b=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,G=/[。!?!?…]|\.(?=\s|$)/u,J=/[,、;:,;:—]/u,H=/[,、;:。,;:.\s]+$/u;export function keptSpans(f,o){const c=[],r=U(f).map(s=>({...s,n:p(s.w)}));for(const s of o){const h=p(s);if(!h)continue;if(b.test(s)){const n=[];Array.from(f).reduce((t,u)=>(p(u)&&n.push(t),t+u.length),0);const e=p(f);for(let t=e.indexOf(h);t>=0;t=e.indexOf(h,t+1)){const u=n[t],x=n[t+h.length-1];u!==void 0&&x!==void 0&&c.push([u,x+1])}continue}const a=s.split(/\s+/u).map(p).filter(Boolean);for(let n=0;n+a.length<=r.length;n++)if(a.every((e,t)=>r[n+t]?.n===e)){const e=r[n],t=r[n+a.length-1];e&&t&&c.push([e.from,t.to])}}return c}const _=(f,o)=>f.some(([c,r])=>o>c&&o<r);export function splitLine(f,o=b.test(f)?CAPTION_CUE_DEFAULTS.maxCharsCjk:CAPTION_CUE_DEFAULTS.maxChars,c=[]){const r=[],s=(a,n)=>{const e=f.slice(a,n),t=e.length-e.trimStart().length,u=e.trim();u&&r.push({text:u,from:a+t,to:a+t+u.length})},h=(a,n,e)=>{const t=f.slice(a,n);if(Array.from(t.trim()).length<=o){s(a,n);return}const x=e===0?G:e===1?J:void 0;if(x){let i=-1;for(let S=1;S<t.length-1;S++)x.test(t[S]??"")&&!_(c,a+S+1)&&(i<0||Math.abs(S-t.length/2)<Math.abs(i-t.length/2))&&(i=S);if(i<0){h(a,n,e+1);return}h(a,a+i+1,e),h(a+i+1,n,e);return}const w=Math.floor(t.length/2),C=i=>i>0&&i<t.length&&!_(c,a+i);let g=-1;if(!b.test(t)){for(let i=w;i>0&&g<0;i--)t[i]===" "&&C(i)&&(g=i);for(let i=w;i<t.length&&g<0;i++)t[i]===" "&&C(i)&&(g=i)}for(let i=0;i<=t.length&&g<0;i++)C(w-i)?g=w-i:C(w+i)&&(g=w+i);if(g<0){s(a,n);return}h(a,a+g,e),h(a+g,n,e)};return h(0,f.length,0),r}export function captionCues(f,o={}){const{lines:c,fps:r}=f,s={...CAPTION_CUE_DEFAULTS,...o},h=[];for(const t of c){if(t.words.length===0)continue;const u=t.words,x=new v(new F(u),[t.spoken]),w=(M,l)=>{const d=u[x.wordAtChar(0,M)];return d?l?d.end:d.start:0};if((x.lines[0]?.length??0)===0)continue;const i=p(t.shown)===p(t.spoken)?M=>M:shownToSpoken(t.shown,t.spoken),S=b.test(t.shown)?s.maxCharsCjk:s.maxChars;for(const M of splitLine(t.shown,S)){const l=Math.round(i(p(t.shown.slice(0,M.from)).length)),d=Math.round(i(p(t.shown.slice(0,M.to)).length)),k=w(l,!1),L=w(Math.max(l,d-1),!0),W=b.test(M.text)?M.text.replace(H,""):M.text.replace(/[,;:]+$/u,"");W&&h.push({start:k,end:Math.max(L,k),text:W,part:t.part})}}const a=1/r,n=t=>Math.round(t*r)/r,e=h.map(t=>({...t,start:n(t.start),end:n(t.end)}));for(let t=0;t<e.length;t++){const u=e[t];if(!u)continue;const x=e[t+1],w=x?x.start-s.gapFrames*a:1/0;u.end=Math.min(Math.max(u.end,u.start+s.minSeconds),u.start+s.maxSeconds,w),u.end<=u.start&&(u.end=u.start+a)}return e}export function subtitleCues(f,o){return o===void 0?captionCues(f):wordCues(f.lines,{...o,fps:f.fps}).map(c=>({start:c.start,end:c.end,text:c.text,part:c.part}))}function U(f){const o=[],c=/\S+/gu;for(let r=c.exec(f);r;r=c.exec(f))o.push({w:r[0],from:r.index,to:r.index+r[0].length});return o}export function wordCues(f,o){const{fps:c}=o,r=[];for(const n of f){if(n.words.length===0)continue;const e=n.words,t=new v(new F(e),[n.spoken]);if((t.lines[0]?.length??0)===0)continue;const x=(l,d)=>{const k=e[t.wordAtChar(0,l)];return k?d?k.end:k.start:0},C=p(n.shown)===p(n.spoken)?l=>l:shownToSpoken(n.shown,n.spoken),g=(l,d)=>{const k=Math.round(C(p(n.shown.slice(0,l)).length)),L=Math.round(C(p(n.shown.slice(0,d)).length));return[x(k,!1),x(Math.max(k,L-1),!0)]},i=b.test(n.shown),S=o.maxChars??(i?16:32),M=keptSpans(n.shown,o.keep??[]);for(const l of splitLine(n.shown,S,M)){const d=(i?[{w:l.text,from:l.from,to:l.to}]:U(n.shown.slice(l.from,l.to)).map(m=>({w:m.w,from:m.from+l.from,to:m.to+l.from}))).filter(m=>p(m.w)!=="");if(d.length===0)continue;const k=o.maxWords&&o.maxWords>0?o.maxWords:d.length,L=Math.ceil(d.length/k),W=Math.ceil(d.length/L),O=[];d.forEach((m,A)=>{const j=d[A-1],E=O.at(-1);E&&j&&_(M,Math.ceil((j.to+m.from)/2))?E.push(m):O.push([m])});const I=[];let $=[];for(const m of O)$.length>0&&$.length+m.length>W&&(I.push($),$=[]),$.push(...m);$.length>0&&I.push($);for(const m of I){const A=m.map(T=>{const[N,K]=g(T.from,T.to);return{text:T.w,start:N,end:Math.max(K,N)}}),j=A[0],E=A.at(-1);if(!j||!E)continue;const B=m.map(T=>T.w).join(i?"":" ").replace(i?H:/[,;:]+$/u,"");r.push({start:j.start,end:E.end,text:B,part:n.part,words:A})}}}const s=n=>Math.round(n*c)/c,h=1/c,a=r.map(n=>({...n,start:s(n.start),end:s(n.end)}));for(let n=0;n<a.length;n++){const e=a[n];if(!e)continue;const t=a[n+1],u=t?.part===e.part;t&&u&&t.start-e.end<(o.close??.4)&&(e.end=t.start),e.end=Math.max(e.end,e.start+Math.min(.5,6*h)),t&&e.end>t.start&&(e.end=t.start),e.end<=e.start&&(e.end=e.start+h)}return a}export function cuesIn(f,o,c){const r=s=>Math.round(s*1e6)/1e6;return f.filter(s=>s.end>o&&s.start<c).map(s=>({start:r(Math.max(s.start,o)-o),end:r(Math.min(s.end,c)-o),text:s.text,words:s.words.map(h=>({text:h.text,start:r(h.start-o),end:r(h.end-o)}))}))}const y=(f,o)=>{const c=Math.round(f*1e3),r=Math.floor(c/36e5),s=Math.floor(c/6e4)%60,h=Math.floor(c/1e3)%60,a=(n,e=2)=>String(n).padStart(e,"0");return`${a(r)}:${a(s)}:${a(h)}${o}${a(c%1e3,3)}`};export function toSrt(f){return f.map((o,c)=>`${String(c+1)}
|
|
3
|
+
${y(o.start,",")} --> ${y(o.end,",")}
|
|
4
|
+
${o.text}
|
|
5
|
+
`).join(`
|
|
6
|
+
`)}export function toVtt(f){return`WEBVTT
|
|
7
|
+
|
|
8
|
+
${f.map(o=>`${y(o.start,".")} --> ${y(o.end,".")}
|
|
9
|
+
${o.text}
|
|
10
|
+
`).join(`
|
|
11
|
+
`)}`}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Combo } from "./matrix.js";
|
|
2
|
+
export declare const CONSOLE_LEVELS: readonly ["log", "info", "warn", "error", "debug"];
|
|
3
|
+
export type ConsoleLevel = (typeof CONSOLE_LEVELS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* What piece code was doing when it printed: loading its files' top level
|
|
6
|
+
* (`module`), running the output's function (`build`), a layer's `mount`
|
|
7
|
+
* or `render`, drawing a cover (`cover`), or anything else, such as a
|
|
8
|
+
* callback that ran later (`other`).
|
|
9
|
+
*/
|
|
10
|
+
export type ConsolePhase = "module" | "build" | "mount" | "render" | "cover" | "other";
|
|
11
|
+
/** Where a console call was made, as the stage knows it. */
|
|
12
|
+
export interface ConsoleWhere {
|
|
13
|
+
phase: ConsolePhase;
|
|
14
|
+
/** The part (or page) whose layer was running. */
|
|
15
|
+
part?: string;
|
|
16
|
+
/** The layer's component name ("custom" for custom()). */
|
|
17
|
+
layer?: string;
|
|
18
|
+
/** The layer's place in its part's `layers`, from 0. */
|
|
19
|
+
index?: number;
|
|
20
|
+
/** render and cover: the part time drawn, seconds from the part's start (render's t). */
|
|
21
|
+
t?: number;
|
|
22
|
+
}
|
|
23
|
+
/** One message: the same text printed at the same place, with its count. */
|
|
24
|
+
export interface ConsoleMessage extends ConsoleWhere {
|
|
25
|
+
level: ConsoleLevel;
|
|
26
|
+
text: string;
|
|
27
|
+
/** render: the latest part time it was printed at, when later than `t`. */
|
|
28
|
+
until?: number;
|
|
29
|
+
/** How many calls printed it. */
|
|
30
|
+
count: number;
|
|
31
|
+
}
|
|
32
|
+
/** What one output × combo × format printed. */
|
|
33
|
+
export interface ConsoleLog {
|
|
34
|
+
messages: ConsoleMessage[];
|
|
35
|
+
/** Calls not kept: their message came after `limit` others. */
|
|
36
|
+
dropped: number;
|
|
37
|
+
}
|
|
38
|
+
/** A message with the output × combo × format it came from. */
|
|
39
|
+
export interface ConsoleEntry extends ConsoleMessage {
|
|
40
|
+
piece: string;
|
|
41
|
+
output: string;
|
|
42
|
+
combo: Combo;
|
|
43
|
+
format: string;
|
|
44
|
+
}
|
|
45
|
+
/** What a command's pages printed, for the CLI. */
|
|
46
|
+
export interface ConsoleReport {
|
|
47
|
+
entries: ConsoleEntry[];
|
|
48
|
+
/** Calls not kept, over every output × combo × format. */
|
|
49
|
+
dropped: number;
|
|
50
|
+
/** The most messages kept per output × combo × format. */
|
|
51
|
+
limit: number;
|
|
52
|
+
}
|
|
53
|
+
/** The most different messages kept per output × combo × format by default. */
|
|
54
|
+
export declare const CONSOLE_LIMIT = 200;
|
|
55
|
+
/** The longest text kept of one call, in characters; the rest is cut with a note. */
|
|
56
|
+
export declare const CONSOLE_TEXT_MAX = 4000;
|
|
57
|
+
/**
|
|
58
|
+
* Collects messages: the same text at the same place counts once (with the
|
|
59
|
+
* earliest and latest part time it was printed at), at most `limit`
|
|
60
|
+
* different ones. Pure: the stage and the host both use it.
|
|
61
|
+
*/
|
|
62
|
+
export declare class ConsoleCollector {
|
|
63
|
+
readonly limit: number;
|
|
64
|
+
private readonly kept;
|
|
65
|
+
private droppedCalls;
|
|
66
|
+
constructor(limit?: number);
|
|
67
|
+
/** Adds one call (or `count` calls, from another collector). */
|
|
68
|
+
add(m: ConsoleWhere & {
|
|
69
|
+
level: ConsoleLevel;
|
|
70
|
+
text: string;
|
|
71
|
+
count?: number;
|
|
72
|
+
until?: number;
|
|
73
|
+
}): void;
|
|
74
|
+
/** Adds what another collector kept and dropped. */
|
|
75
|
+
merge(log: ConsoleLog): void;
|
|
76
|
+
/**
|
|
77
|
+
* What was kept, in order: phase (module, build, mount, render, cover,
|
|
78
|
+
* other), then part in `parts` order, then part time, then first printed.
|
|
79
|
+
*/
|
|
80
|
+
log(parts?: readonly string[]): ConsoleLog;
|
|
81
|
+
}
|
|
82
|
+
/** A value as console.log would show it, on one line where it can be. */
|
|
83
|
+
export declare function consoleValue(v: unknown): string;
|
|
84
|
+
/**
|
|
85
|
+
* The text of one console call: format specifiers in a first string
|
|
86
|
+
* (%s %d %i %f %o %O %j %c %%) take the next arguments, as the browser's
|
|
87
|
+
* console does, and the rest follow separated by spaces. Cut at
|
|
88
|
+
* CONSOLE_TEXT_MAX characters, saying how many more there were.
|
|
89
|
+
*/
|
|
90
|
+
export declare function consoleText(args: readonly unknown[]): string;
|
|
91
|
+
//# sourceMappingURL=console.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 CONSOLE_LEVELS=["log","info","warn","error","debug"];const f={module:0,build:1,mount:2,render:3,cover:4,other:5};export const CONSOLE_LIMIT=200,CONSOLE_TEXT_MAX=4e3;const p=t=>[t.level,t.phase,t.part??"",t.layer??"",t.index??"",t.text].join("\0");export class ConsoleCollector{limit;kept=new Map;droppedCalls=0;constructor(e=CONSOLE_LIMIT){this.limit=Math.max(0,e)}add(e){const r=e.count??1,i=p(e),n=this.kept.get(i);if(n){n.count+=r;const o=[n.t,e.t].filter(s=>s!==void 0),u=[n.until??n.t,e.until??e.t].filter(s=>s!==void 0);if(o.length>0){const s=Math.min(...o),a=Math.max(...u);n.t=s,a>s&&(n.until=a)}return}if(this.kept.size>=this.limit){this.droppedCalls+=r;return}this.kept.set(i,{level:e.level,text:e.text,phase:e.phase,...e.part===void 0?{}:{part:e.part},...e.layer===void 0?{}:{layer:e.layer},...e.index===void 0?{}:{index:e.index},...e.t===void 0?{}:{t:e.t},...e.until!==void 0&&e.t!==void 0&&e.until>e.t?{until:e.until}:{},count:r})}merge(e){for(const r of e.messages)this.add(r);this.droppedCalls+=e.dropped}log(e=[]){const r=new Map(e.map((n,o)=>[n,o]));return{messages:[...this.kept.values()].map((n,o)=>({m:n,i:o})).sort((n,o)=>f[n.m.phase]-f[o.m.phase]||(r.get(n.m.part??"")??-1)-(r.get(o.m.part??"")??-1)||(n.m.t??-1)-(o.m.t??-1)||n.i-o.i).map(({m:n})=>({...n})),dropped:this.droppedCalls}}}function c(t){const e=globalThis.Node;if(!e||!(t instanceof e))return;const r=t;if(r.nodeType===1){const i=[...r.classList??[]].map(n=>`.${n}`).join("");return`<${r.nodeName.toLowerCase()}${i}${r.id?`#${r.id}`:""}>`}return JSON.stringify(r.textContent??"")}function l(t){if(typeof t=="bigint")return`${String(t)}n`;if(typeof t=="function")return`[Function${t.name?` ${t.name}`:""}]`;if(typeof t=="number"&&!Number.isFinite(t))return String(t);if(typeof t!="object"||t===null)return t;if(t instanceof Error)return`${t.name}: ${t.message}`;const e=c(t);return e!==void 0?e:t instanceof Map?{Map:[...t]}:t instanceof Set?{Set:[...t]}:ArrayBuffer.isView(t)&&!(t instanceof DataView)?Array.from(t):t}function d(t){const e=[];try{return JSON.stringify(t,function(r,i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(typeof i!="object"||i===null)return l(i);if(e.includes(i))return"[Circular]";e.push(i);const n=l(i);return n!==i&&typeof n=="object"&&n!==null&&e.push(n),n})}catch{return Object.prototype.toString.call(t)}}export function consoleValue(t){switch(typeof t){case"string":return t;case"number":case"boolean":case"undefined":return String(t);case"bigint":return`${String(t)}n`;case"symbol":return t.toString();case"function":return`[Function${t.name?` ${t.name}`:""}]`;case"object":{if(t===null)return"null";if(t instanceof Error)return`${t.name}: ${t.message}`;const e=c(t);return e!==void 0?e:d(t)}}}export function consoleText(t){const e=[...t],r=[],i=e[0];typeof i=="string"&&i.includes("%")&&(e.shift(),r.push(i.replace(/%([sdifoOjc%])/g,(o,u)=>{if(u==="%")return"%";if(e.length===0)return o;const s=e.shift();if(u==="c")return"";if(u==="d"||u==="i"||u==="f"){const a=typeof s=="symbol"?NaN:Number(s);return String(u==="f"?a:Math.trunc(a))}return consoleValue(s)}))),r.push(...e.map(consoleValue));const n=r.join(" ");return n.length<=CONSOLE_TEXT_MAX?n:`${n.slice(0,CONSOLE_TEXT_MAX)}… (${String(n.length-CONSOLE_TEXT_MAX)} more characters)`}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { MeasuredText } from "./measure.js";
|
|
2
|
+
import type { Box } from "./problem.js";
|
|
3
|
+
/**
|
|
4
|
+
* A style sheet that hides every text's fill and nothing else: borders and
|
|
5
|
+
* icons drawn in `currentColor`, shadows and strokes round letters, and
|
|
6
|
+
* colour emoji stay. What a capture then has at the glyphs is what is
|
|
7
|
+
* behind them.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HIDE_TEXT_CSS: string;
|
|
10
|
+
/**
|
|
11
|
+
* The same, with the strokes and shadows round letters hidden too: what a
|
|
12
|
+
* capture has at the glyphs is then the picture under a text's outline.
|
|
13
|
+
*/
|
|
14
|
+
export declare const HIDE_OUTLINE_CSS = "*{-webkit-text-fill-color:transparent!important;caret-color:transparent!important;transition:none!important}svg text,svg tspan,svg textPath{fill:transparent!important}*{-webkit-text-stroke-color:transparent!important;text-shadow:none!important}";
|
|
15
|
+
/** A colour in sRGB, channels 0–255, alpha 0–1. */
|
|
16
|
+
export type Rgba = [r: number, g: number, b: number, a: number];
|
|
17
|
+
/** One line of a text block's glyphs, as the stage draws it. */
|
|
18
|
+
export interface InkLine {
|
|
19
|
+
/** The line's glyph box in the frame's pixels (not rounded; the frame may cut it). */
|
|
20
|
+
box: Box;
|
|
21
|
+
/** The colour its glyphs are filled with; absent when the fill is not a colour (transparent: a background clipped to the text). */
|
|
22
|
+
fill?: Rgba;
|
|
23
|
+
/** Its text node's opacity, its ancestors' included. */
|
|
24
|
+
opacity: number;
|
|
25
|
+
}
|
|
26
|
+
/** A text block with what its contrast is measured from (LoadedOutput.inks). */
|
|
27
|
+
export interface TextInk {
|
|
28
|
+
text: MeasuredText;
|
|
29
|
+
lines: InkLine[];
|
|
30
|
+
/** Its font size in the frame's pixels (its transforms' scale counted), and its weight. */
|
|
31
|
+
size: number;
|
|
32
|
+
weight: number;
|
|
33
|
+
/** A text-shadow or a stroke round its letters: drawn with the picture behind its fill, so it counts there. */
|
|
34
|
+
shadow?: true;
|
|
35
|
+
stroke?: true;
|
|
36
|
+
}
|
|
37
|
+
/** How the text-contrast fact measures. */
|
|
38
|
+
export interface ContrastOptions {
|
|
39
|
+
/** The low percentile reported beside the minimum and the median (0–100). */
|
|
40
|
+
percentile: number;
|
|
41
|
+
/** The scale the picture behind the text is captured at (0–1 of the frame's pixels). */
|
|
42
|
+
scale: number;
|
|
43
|
+
/** Blocks drawn at a lower opacity (fading in or out) are left out (0: every block). */
|
|
44
|
+
opacity: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The 10th percentile beside the minimum and the median; the picture
|
|
48
|
+
* behind captured at the frame's own pixels; blocks drawn at 90 % opacity
|
|
49
|
+
* or more (whole, as text-time counts it).
|
|
50
|
+
*/
|
|
51
|
+
export declare const CONTRAST_DEFAULTS: Readonly<ContrastOptions>;
|
|
52
|
+
/** The options with the defaults filled in, checked. */
|
|
53
|
+
export declare function contrastOptions(o?: Partial<ContrastOptions>): ContrastOptions;
|
|
54
|
+
/** WCAG 2.1 relative luminance of an sRGB colour (0–1). */
|
|
55
|
+
export declare function luminance(r: number, g: number, b: number): number;
|
|
56
|
+
/** WCAG 2.1 contrast ratio of two luminances: 1 (none) to 21 (black on white). */
|
|
57
|
+
export declare function contrastRatio(la: number, lb: number): number;
|
|
58
|
+
/** A colour drawn at `alpha` over an opaque one. */
|
|
59
|
+
export declare function over(fg: readonly [number, number, number], alpha: number, bg: readonly [number, number, number]): [number, number, number];
|
|
60
|
+
/** #rrggbb, with the alpha as two more digits when under 1. */
|
|
61
|
+
export declare function hexOf(c: readonly number[]): string;
|
|
62
|
+
/** A picture's pixels, RGBA, row by row. */
|
|
63
|
+
export interface Pixels {
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
66
|
+
data: Uint8Array;
|
|
67
|
+
}
|
|
68
|
+
/** Where a picture lies in the frame: its pixel (0, 0) is at frame (x, y), and each of its pixels spans `scale` frame pixels (2: captured at half size). */
|
|
69
|
+
export interface PixelsAt {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
scale: number;
|
|
73
|
+
}
|
|
74
|
+
/** The ratios over the pixels behind a block's glyphs. */
|
|
75
|
+
export interface ContrastStats {
|
|
76
|
+
min: number;
|
|
77
|
+
low: number;
|
|
78
|
+
median: number;
|
|
79
|
+
/** Pixels measured. */
|
|
80
|
+
pixels: number;
|
|
81
|
+
/** The picture behind, #rrggbb: the median of each channel, and the pixel at the minimum. */
|
|
82
|
+
background: {
|
|
83
|
+
median: string;
|
|
84
|
+
atMin: string;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The contrast between each line's fill and every pixel of `behind` inside
|
|
89
|
+
* that line's glyph box (the box in frame pixels; `at` places the picture
|
|
90
|
+
* in the frame): the fill drawn at its alpha × opacity over the pixel,
|
|
91
|
+
* against the pixel. The minimum, the `percentile`th lowest and the
|
|
92
|
+
* median, and the colours behind. Undefined when no line has a colour or
|
|
93
|
+
* no pixel of the picture is inside a line's box.
|
|
94
|
+
*/
|
|
95
|
+
export declare function contrastOver(lines: readonly InkLine[], behind: Pixels, at: PixelsAt, percentile: number): ContrastStats | undefined;
|
|
96
|
+
/** The box round a block's lines, whole frame pixels, inside the frame; undefined when none of it is inside. */
|
|
97
|
+
export declare function linesRegion(lines: readonly InkLine[], width: number, height: number): Box | undefined;
|
|
98
|
+
//# sourceMappingURL=contrast.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 HIDE_TEXT_CSS="*{-webkit-text-fill-color:transparent!important;caret-color:transparent!important;transition:none!important}svg text,svg tspan,svg textPath{fill:transparent!important}",HIDE_OUTLINE_CSS=`${HIDE_TEXT_CSS}*{-webkit-text-stroke-color:transparent!important;text-shadow:none!important}`,CONTRAST_DEFAULTS={percentile:10,scale:1,opacity:.9};export function contrastOptions(o={}){const t=(n,r,a)=>{const e=o[n];return e!==void 0&&Number.isFinite(e)&&e>=r&&e<=a?e:CONTRAST_DEFAULTS[n]};return{percentile:t("percentile",0,100),scale:t("scale",.05,1),opacity:t("opacity",0,1)}}const S=o=>{const t=o/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};export function luminance(o,t,n){return .2126*S(o)+.7152*S(t)+.0722*S(n)}export function contrastRatio(o,t){const n=Math.max(o,t),r=Math.min(o,t);return(n+.05)/(r+.05)}export function over(o,t,n){const r=Math.min(1,Math.max(0,t));return[o[0]*r+n[0]*(1-r),o[1]*r+n[1]*(1-r),o[2]*r+n[2]*(1-r)]}const u=o=>Math.round(Math.min(255,Math.max(0,o))).toString(16).padStart(2,"0");export function hexOf(o){const[t=0,n=0,r=0,a=1]=o;return`#${u(t)}${u(n)}${u(r)}${a<1?u(a*255):""}`}const b=o=>Math.round(o*100)/100;export function contrastOver(o,t,n,r){const a=[],e=[],p=[],x=[];let f=1/0,m=[0,0,0];for(const h of o){const s=h.fill;if(!s)continue;const E=s[3]*h.opacity,[v,T,O,_]=h.box,$=Math.max(0,Math.ceil((v-n.x)/n.scale-.5)),k=Math.max(0,Math.ceil((T-n.y)/n.scale-.5)),A=Math.min(t.width-1,Math.floor((v+O-n.x)/n.scale-.5)),F=Math.min(t.height-1,Math.floor((T+_-n.y)/n.scale-.5));for(let y=k;y<=F;y++)for(let d=$;d<=A;d++){const g=(y*t.width+d)*4,c=[t.data[g]??0,t.data[g+1]??0,t.data[g+2]??0],w=over([s[0],s[1],s[2]],E,c),I=contrastRatio(luminance(w[0],w[1],w[2]),luminance(c[0],c[1],c[2]));a.push(I),e.push(c[0]),p.push(c[1]),x.push(c[2]),I<f&&(f=I,m=c)}}if(a.length===0)return;const l=Float64Array.from(a).sort(),i=h=>l[Math.min(l.length-1,Math.floor(h/100*l.length))]??0,M=h=>{const s=Float64Array.from(h).sort();return s[Math.floor(s.length/2)]??0};return{min:b(l[0]??0),low:b(i(r)),median:b(i(50)),pixels:a.length,background:{median:hexOf([M(e),M(p),M(x)]),atMin:hexOf(m)}}}export function linesRegion(o,t,n){let r=1/0,a=1/0,e=-1/0,p=-1/0;for(const{box:i}of o)r=Math.min(r,i[0]),a=Math.min(a,i[1]),e=Math.max(e,i[0]+i[2]),p=Math.max(p,i[1]+i[3]);const x=Math.max(0,Math.floor(r)),f=Math.max(0,Math.floor(a)),m=Math.min(t,Math.ceil(e)),l=Math.min(n,Math.ceil(p));return m>x&&l>f?[x,f,m-x,l-f]:void 0}
|