@allyhub/sdk 0.8.0 → 0.10.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/CHANGELOG.md +19 -0
- package/NOTICE +46 -49
- package/dist/dom.d.ts +1 -209
- package/dist/dom.js +1 -1
- package/dist/image.d.ts +2 -0
- package/dist/image.js +2 -0
- package/dist/index.d.ts +1 -21
- package/dist/index.js +1 -1
- package/dist/media.d.ts +1 -5
- package/dist/media.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/levels.d.ts +4 -5
- package/dist/node_modules/@allyhub/audio/dist/levels.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.d.ts +1 -6
- package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.js +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.d.ts +4 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +22 -0
- package/dist/node_modules/@allyhub/chart/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/LICENSE +241 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/fact.d.ts +37 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/fact.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/index.d.ts +4 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +43 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/problem.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.d.ts +30 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/package.json +14 -0
- package/dist/node_modules/@allyhub/formats/dist/contributed.d.ts +126 -0
- package/dist/node_modules/@allyhub/formats/dist/contributed.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/reference.d.ts +7 -12
- package/dist/node_modules/@allyhub/formats/dist/data/reference.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/script.d.ts +9 -4
- package/dist/node_modules/@allyhub/formats/dist/data/script.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +107 -83
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +185 -8
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.d.ts +2 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +42 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/extension.d.ts +91 -0
- package/dist/node_modules/@allyhub/formats/dist/extension.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/files.d.ts +51 -0
- package/dist/node_modules/@allyhub/formats/dist/files.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/index.d.ts +5 -1
- package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +226 -90
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +7 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +96 -42
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/LICENSE +241 -0
- package/dist/node_modules/@allyhub/image-draw/dist/context.d.ts +5 -0
- package/dist/node_modules/@allyhub/image-draw/dist/context.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/contrast.d.ts +13 -0
- package/dist/node_modules/@allyhub/image-draw/dist/contrast.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/env.d.ts +112 -0
- package/dist/node_modules/@allyhub/image-draw/dist/env.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/errors.d.ts +20 -0
- package/dist/node_modules/@allyhub/image-draw/dist/errors.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.d.ts +110 -0
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/guards.d.ts +32 -0
- package/dist/node_modules/@allyhub/image-draw/dist/guards.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/hash.d.ts +3 -0
- package/dist/node_modules/@allyhub/image-draw/dist/hash.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.d.ts +113 -0
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.js +3 -0
- package/dist/node_modules/@allyhub/image-draw/dist/layer-style.d.ts +151 -0
- package/dist/node_modules/@allyhub/image-draw/dist/layer-style.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/paint.d.ts +29 -0
- package/dist/node_modules/@allyhub/image-draw/dist/paint.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/pictures.d.ts +39 -0
- package/dist/node_modules/@allyhub/image-draw/dist/pictures.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/plan.d.ts +52 -0
- package/dist/node_modules/@allyhub/image-draw/dist/plan.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/reads.d.ts +145 -0
- package/dist/node_modules/@allyhub/image-draw/dist/reads.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/shape-path.d.ts +26 -0
- package/dist/node_modules/@allyhub/image-draw/dist/shape-path.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/stage.d.ts +56 -0
- package/dist/node_modules/@allyhub/image-draw/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/styles.d.ts +35 -0
- package/dist/node_modules/@allyhub/image-draw/dist/styles.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/tone.d.ts +53 -0
- package/dist/node_modules/@allyhub/image-draw/dist/tone.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/package.json +14 -0
- package/dist/node_modules/@allyhub/image-measure/LICENSE +241 -0
- package/dist/node_modules/@allyhub/image-measure/dist/contrast.d.ts +43 -0
- package/dist/node_modules/@allyhub/image-measure/dist/contrast.js +2 -0
- package/dist/node_modules/@allyhub/image-measure/dist/layout.d.ts +186 -0
- package/dist/node_modules/@allyhub/image-measure/dist/layout.js +5 -0
- package/dist/node_modules/@allyhub/image-measure/package.json +14 -0
- package/dist/node_modules/@allyhub/image-sdk/LICENSE +241 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/adjustment.d.ts +13 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/adjustment.js +2 -0
- package/dist/{define.d.ts → node_modules/@allyhub/image-sdk/dist/define.d.ts} +21 -4
- package/dist/node_modules/@allyhub/image-sdk/dist/define.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/dom.d.ts +210 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/dom.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/fill.d.ts +21 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/fill.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/group.d.ts +17 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/group.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.d.ts +166 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/media.d.ts +6 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/media.js +2 -0
- package/dist/{messages.d.ts → node_modules/@allyhub/image-sdk/dist/messages.d.ts} +1 -1
- package/dist/node_modules/@allyhub/image-sdk/dist/picture.d.ts +59 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/picture.js +2 -0
- package/dist/{props.d.ts → node_modules/@allyhub/image-sdk/dist/props.d.ts} +4 -4
- package/dist/node_modules/@allyhub/image-sdk/dist/shape.d.ts +34 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/shape.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/stack.d.ts +16 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/stack.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/text-layer.d.ts +38 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/text-layer.js +2 -0
- package/dist/{written.js → node_modules/@allyhub/image-sdk/dist/written.js} +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +19 -0
- package/dist/node_modules/@allyhub/measure/LICENSE +241 -0
- package/dist/node_modules/@allyhub/measure/dist/compare.d.ts +195 -0
- package/dist/node_modules/@allyhub/measure/dist/compare.js +2 -0
- package/dist/node_modules/@allyhub/measure/dist/grain.d.ts +8 -0
- package/dist/node_modules/@allyhub/measure/dist/grain.js +2 -0
- package/dist/node_modules/@allyhub/measure/dist/image.d.ts +16 -0
- package/dist/node_modules/@allyhub/measure/dist/image.js +2 -0
- package/dist/node_modules/@allyhub/measure/dist/index.d.ts +4 -0
- package/dist/node_modules/@allyhub/measure/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/measure/package.json +13 -0
- package/dist/node_modules/@allyhub/ooxml/dist/generated/presets.d.ts +4 -1
- package/dist/node_modules/@allyhub/ooxml/dist/generated/presets.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.d.ts +15 -1
- package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/LICENSE +241 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/anchors.d.ts +1 -9
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/component.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/context.d.ts +39 -0
- package/dist/node_modules/@allyhub/piece/dist/context.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/contrast.d.ts +2 -2
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/export.d.ts +27 -10
- package/dist/node_modules/@allyhub/piece/dist/export.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/formats.d.ts +12 -68
- package/dist/node_modules/@allyhub/piece/dist/formats.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +104 -0
- package/dist/node_modules/@allyhub/piece/dist/index.d.ts +26 -0
- package/dist/node_modules/@allyhub/piece/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layer-style.d.ts +1558 -0
- package/dist/node_modules/@allyhub/piece/dist/layer-style.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +389 -0
- package/dist/node_modules/@allyhub/piece/dist/layer.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +437 -0
- package/dist/node_modules/@allyhub/piece/dist/layout.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/look.d.ts +1 -1
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/media.d.ts +39 -9
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/media.js +1 -1
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/messages.d.ts +6 -0
- package/dist/node_modules/@allyhub/piece/dist/names.d.ts +26 -0
- package/dist/node_modules/@allyhub/piece/dist/names.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/console.d.ts +21 -0
- package/dist/node_modules/@allyhub/piece/dist/page/console.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +3 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +4 -0
- package/dist/node_modules/@allyhub/piece/dist/page/locate.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/picture.d.ts +62 -0
- package/dist/node_modules/@allyhub/piece/dist/picture.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/piece.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/piece.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/script.d.ts +9 -4
- package/dist/node_modules/@allyhub/piece/dist/script.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +131 -0
- package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +291 -0
- package/dist/node_modules/@allyhub/piece/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/version.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/version.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/voice.d.ts +1 -20
- package/dist/node_modules/@allyhub/piece/package.json +18 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +271 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/app.d.ts +3 -10
- package/dist/node_modules/@allyhub/protocol/dist/app.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +337 -0
- package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +12 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +155 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +235 -133
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/files.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +65 -197
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/image.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/image.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +6 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +98 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +274 -0
- package/dist/node_modules/@allyhub/protocol/dist/mail.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +77 -91
- package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/peer.d.ts +59 -0
- package/dist/node_modules/@allyhub/protocol/dist/peer.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.d.ts +21 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +125 -0
- package/dist/node_modules/@allyhub/protocol/dist/presence.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/registry.d.ts +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/shape.d.ts +35 -0
- package/dist/node_modules/@allyhub/protocol/dist/shape.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +2 -8
- package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +70 -40
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +224 -177
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +5 -1
- package/dist/node_modules/@allyhub/runtimes/dist/bundled.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/declared.d.ts +14 -0
- package/dist/node_modules/@allyhub/runtimes/dist/declared.js +2 -0
- package/dist/node_modules/@allyhub/runtimes/dist/ffmpeg.d.ts +15 -0
- package/dist/node_modules/@allyhub/runtimes/dist/ffmpeg.js +2 -0
- package/dist/node_modules/@allyhub/runtimes/dist/index.d.ts +2 -0
- package/dist/node_modules/@allyhub/runtimes/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.d.ts +1 -0
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/manifest.json +0 -82
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/define.d.ts +2 -0
- package/dist/node_modules/@allyhub/scenery/dist/define.js +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
- package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
- package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
- package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
- package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/code.d.ts +4 -4
- package/dist/node_modules/@allyhub/sheet/dist/api/code.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +15 -11
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.d.ts +70 -0
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.d.ts +6 -0
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.d.ts +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/kernels.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/maths.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.d.ts +9 -0
- package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/server.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/types.d.ts +6 -0
- package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/chart.d.ts +9 -0
- package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/file.d.ts +5 -0
- package/dist/node_modules/@allyhub/sheet/dist/file.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/ast.d.ts +12 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/move.d.ts +5 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/generated.d.ts +5 -19
- package/dist/node_modules/@allyhub/sheet/dist/generated.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/import.d.ts +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +5 -5
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.d.ts +88 -3
- package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/patch.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/patch.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/printed.d.ts +19 -0
- package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/sdk.d.ts +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/sdk.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/values.d.ts +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +8 -6
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.d.ts +6 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.d.ts +2 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.d.ts +7 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.js +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.d.ts +12 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.js +3 -2
- package/dist/node_modules/@allyhub/sheet/package.json +5 -1
- package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +23 -7
- package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +101 -11
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +18 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/code.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/connect.d.ts +62 -0
- package/dist/node_modules/@allyhub/slides-core/dist/connect.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +24 -0
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/fact.d.ts +223 -0
- package/dist/node_modules/@allyhub/slides-core/dist/fact.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +4 -4
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.d.ts +4 -2
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/merge.d.ts +5 -5
- package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +25 -4
- package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/path.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +20 -11
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +18 -0
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/stage.d.ts +28 -11
- package/dist/node_modules/@allyhub/slides-core/dist/units.d.ts +3 -6
- package/dist/node_modules/@allyhub/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +5 -1
- package/dist/node_modules/@allyhub/video-core/dist/audio-types.d.ts +1 -2
- package/dist/node_modules/@allyhub/video-core/dist/captions.d.ts +1 -10
- package/dist/node_modules/@allyhub/video-core/dist/captions.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/check.d.ts +62 -0
- package/dist/node_modules/@allyhub/video-core/dist/check.js +2 -0
- package/dist/node_modules/@allyhub/video-core/dist/cut-report.d.ts +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/cut-report.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/edits.d.ts +3 -3
- package/dist/node_modules/@allyhub/video-core/dist/edits.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/fact.d.ts +21 -762
- package/dist/node_modules/@allyhub/video-core/dist/fact.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.d.ts +3 -2
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/index.d.ts +3 -17
- package/dist/node_modules/@allyhub/video-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/measure.d.ts +72 -423
- package/dist/node_modules/@allyhub/video-core/dist/measure.js +1 -4
- package/dist/node_modules/@allyhub/video-core/dist/mix-plan.d.ts +44 -0
- package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +2 -0
- package/dist/node_modules/@allyhub/video-core/dist/motion.d.ts +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/piece.d.ts +24 -432
- package/dist/node_modules/@allyhub/video-core/dist/piece.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/placement.d.ts +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/schema.d.ts +8 -14
- package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/script-edit.d.ts +11 -6
- package/dist/node_modules/@allyhub/video-core/dist/script-edit.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/seams.d.ts +2 -3
- package/dist/node_modules/@allyhub/video-core/dist/sound-under.d.ts +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/sound-under.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/speech.d.ts +2 -4
- package/dist/node_modules/@allyhub/video-core/dist/speech.js +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/stage.d.ts +52 -0
- package/dist/node_modules/@allyhub/video-core/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +18 -136
- package/dist/node_modules/@allyhub/video-core/dist/timeline.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/timing.d.ts +3 -3
- package/dist/node_modules/@allyhub/video-core/dist/timing.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/transcript.d.ts +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/transcript.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/LICENSE +241 -0
- package/dist/node_modules/@allyhub/video-sdk/NOTICE +118 -0
- package/dist/{free.d.ts → node_modules/@allyhub/video-sdk/dist/free.d.ts} +14 -10
- package/dist/node_modules/@allyhub/video-sdk/dist/free.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/index.d.ts +28 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/index.js +2 -0
- package/dist/{input.d.ts → node_modules/@allyhub/video-sdk/dist/input.d.ts} +76 -22
- package/dist/node_modules/@allyhub/video-sdk/dist/input.js +2 -0
- package/dist/{module.d.ts → node_modules/@allyhub/video-sdk/dist/module.d.ts} +6 -4
- package/dist/node_modules/@allyhub/video-sdk/dist/module.js +2 -0
- package/dist/{parts.d.ts → node_modules/@allyhub/video-sdk/dist/parts.d.ts} +15 -6
- package/dist/node_modules/@allyhub/video-sdk/dist/parts.js +2 -0
- package/dist/{phone.d.ts → node_modules/@allyhub/video-sdk/dist/phone.d.ts} +12 -5
- package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +2 -0
- package/dist/{piece.d.ts → node_modules/@allyhub/video-sdk/dist/piece.d.ts} +26 -16
- package/dist/node_modules/@allyhub/video-sdk/dist/piece.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/route.d.ts +46 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/route.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/scenery.d.ts +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/scenery.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/package.json +19 -0
- package/dist/scenery.d.ts +1 -1
- package/dist/scenery.js +1 -1
- package/dist/sheets.d.ts +1 -1
- package/dist/sheets.js +1 -1
- package/dist/slides.d.ts +1 -9
- package/dist/slides.js +1 -1
- package/docs/README.md +10 -6
- package/docs/batches.md +5 -5
- package/docs/canvas.md +28 -0
- package/docs/contract.md +2 -2
- package/docs/defaults.md +298 -22
- package/docs/docs.md +80 -66
- package/docs/footage.md +7 -7
- package/docs/image.md +165 -0
- package/docs/layers.md +22 -13
- package/docs/modeling.md +4 -4
- package/docs/pictures.md +65 -0
- package/docs/project.md +51 -31
- package/docs/scenery.md +14 -15
- package/docs/sheets.md +46 -28
- package/docs/slides.md +121 -67
- package/docs/sound.md +3 -3
- package/docs/speech.md +8 -8
- package/docs/video.md +16 -13
- package/docs/websites.md +4 -4
- package/docs/x.md +73 -0
- package/package.json +7 -2
- package/dist/define.js +0 -2
- package/dist/free.js +0 -2
- package/dist/input.js +0 -2
- package/dist/module.js +0 -2
- package/dist/node_modules/@allyhub/formats/dist/data/comments.d.ts +0 -94
- package/dist/node_modules/@allyhub/formats/dist/data/comments.js +0 -2
- package/dist/node_modules/@allyhub/runtimes/pins/onnxruntime-node/package-lock.json +0 -227
- package/dist/node_modules/@allyhub/runtimes/pins/onnxruntime-node/package.json +0 -8
- package/dist/node_modules/@allyhub/runtimes/pins/sherpa-onnx-node/package-lock.json +0 -105
- package/dist/node_modules/@allyhub/runtimes/pins/sherpa-onnx-node/package.json +0 -8
- package/dist/node_modules/@allyhub/runtimes/pins/tesseract.js/package-lock.json +0 -128
- package/dist/node_modules/@allyhub/runtimes/pins/tesseract.js/package.json +0 -9
- package/dist/node_modules/@allyhub/video-core/dist/export.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/formats.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/gen.d.ts +0 -37
- package/dist/node_modules/@allyhub/video-core/dist/problem.d.ts +0 -278
- package/dist/node_modules/@allyhub/video-core/dist/problem.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/script.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/source.d.ts +0 -7
- package/dist/parts.js +0 -2
- package/dist/phone.js +0 -2
- package/dist/piece.js +0 -2
- /package/dist/node_modules/@allyhub/{sheet → formats}/dist/csv.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{sheet → formats}/dist/csv.js +0 -0
- /package/dist/{fit.d.ts → node_modules/@allyhub/image-sdk/dist/fit.d.ts} +0 -0
- /package/dist/{fit.js → node_modules/@allyhub/image-sdk/dist/fit.js} +0 -0
- /package/dist/{messages.js → node_modules/@allyhub/image-sdk/dist/messages.js} +0 -0
- /package/dist/{props.js → node_modules/@allyhub/image-sdk/dist/props.js} +0 -0
- /package/dist/{text.d.ts → node_modules/@allyhub/image-sdk/dist/text.d.ts} +0 -0
- /package/dist/{text.js → node_modules/@allyhub/image-sdk/dist/text.js} +0 -0
- /package/dist/{written.d.ts → node_modules/@allyhub/image-sdk/dist/written.d.ts} +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/anchors.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/component.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/console.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/console.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/contrast.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/gen.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/look.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/marks.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/marks.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/matrix.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/matrix.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/messages.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/source.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/voice.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/words.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/words.js +0 -0
- /package/dist/{anim.d.ts → node_modules/@allyhub/video-sdk/dist/anim.d.ts} +0 -0
- /package/dist/{anim.js → node_modules/@allyhub/video-sdk/dist/anim.js} +0 -0
- /package/dist/{noise.d.ts → node_modules/@allyhub/video-sdk/dist/noise.d.ts} +0 -0
- /package/dist/{noise.js → node_modules/@allyhub/video-sdk/dist/noise.js} +0 -0
- /package/dist/{paths.d.ts → node_modules/@allyhub/video-sdk/dist/paths.d.ts} +0 -0
- /package/dist/{paths.js → node_modules/@allyhub/video-sdk/dist/paths.js} +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { type CaptionTrackCue, type ContentOptions, type InlineMark, type StageContext } from "@allyhub/piece";
|
|
2
|
+
/** Inline styles: camelCase or `--custom` properties; numbers are pixels. */
|
|
3
|
+
export type Style = Partial<Record<string, string | number>>;
|
|
4
|
+
export declare function h(tag: string, style?: Style, children?: (Node | string)[], cls?: string): HTMLElement;
|
|
5
|
+
export declare function css(el: HTMLElement | SVGElement, style: Style): void;
|
|
6
|
+
/**
|
|
7
|
+
* Chinese has no spaces, so a line can break inside a word. Mark word
|
|
8
|
+
* boundaries (Intl.Segmenter, the browser's own dictionary) with zero-width
|
|
9
|
+
* spaces; with `word-break: keep-all` lines then break only between words.
|
|
10
|
+
*/
|
|
11
|
+
export declare function wordBreaks(value: string): string;
|
|
12
|
+
export declare const text: (v: unknown) => string;
|
|
13
|
+
export declare const list: (v: unknown) => string[];
|
|
14
|
+
export interface Layout {
|
|
15
|
+
W: number;
|
|
16
|
+
H: number;
|
|
17
|
+
/** Type scale: the frame's short side / 1080 (1 in every preset). */
|
|
18
|
+
k: number;
|
|
19
|
+
orient: "landscape" | "portrait" | "square";
|
|
20
|
+
/** The side margin: max(margin, the covered left and right edges). */
|
|
21
|
+
pad: number;
|
|
22
|
+
/** The content box's edges, in the frame's pixels: clear of the covered areas, with a gap. */
|
|
23
|
+
top: number;
|
|
24
|
+
bottom: number;
|
|
25
|
+
left: number;
|
|
26
|
+
right: number;
|
|
27
|
+
}
|
|
28
|
+
/** What layout() may change: the margin and the gaps by the covered edges (see contentEdges). */
|
|
29
|
+
export type LayoutOptions = ContentOptions;
|
|
30
|
+
/**
|
|
31
|
+
* Layout of the stage for the current format: the type scale and the
|
|
32
|
+
* content box (the same box as ctx.content). With the defaults, in
|
|
33
|
+
* pixels: pad = max(margin, safe.left, safe.right), with margin 120 × k
|
|
34
|
+
* in a landscape frame and 84 × k otherwise; top = max(pad, safe.top +
|
|
35
|
+
* 30 × k); bottom = H − max(pad, safe.bottom + 20 × k); left = pad;
|
|
36
|
+
* right = W − pad. `opts` changes the margin and the gaps.
|
|
37
|
+
*/
|
|
38
|
+
export declare function layout(ctx: StageContext, opts?: LayoutOptions): Layout;
|
|
39
|
+
/** A full-stage absolutely positioned box over the content area. */
|
|
40
|
+
export declare function contentBox(L: Layout, style?: Style): HTMLElement;
|
|
41
|
+
/** Text block that keeps its words together and wraps by width. */
|
|
42
|
+
export declare function textBlock(value: string, { size, weight, color, font, lineHeight, align, }: {
|
|
43
|
+
size: number;
|
|
44
|
+
weight?: number;
|
|
45
|
+
color?: string;
|
|
46
|
+
font?: string;
|
|
47
|
+
lineHeight?: number;
|
|
48
|
+
align?: "left" | "center" | "right";
|
|
49
|
+
}): HTMLElement;
|
|
50
|
+
/** How marked() draws each kind of mark, unless it is given another style. */
|
|
51
|
+
export declare const MARK_STYLES: Readonly<Record<InlineMark["kind"], Style>>;
|
|
52
|
+
/**
|
|
53
|
+
* A line with its marks drawn: a span holding the line's runs in order,
|
|
54
|
+
* a plain run as text and a marked one as a span with `data-mark` (its
|
|
55
|
+
* kinds, "strong", "strong em"…) and the style of each kind, `styles`
|
|
56
|
+
* over MARK_STYLES. A string is read with readMarks() (`**strong**`,
|
|
57
|
+
* `*em*`, `~~struck~~`, `` `code` ``); a text already read is taken with
|
|
58
|
+
* the marks it has. Put it in any block: textBlock("", { size }).append(…),
|
|
59
|
+
* h("div", style, [marked(line)]).
|
|
60
|
+
*/
|
|
61
|
+
export declare function marked(value: string | {
|
|
62
|
+
text: string;
|
|
63
|
+
marks?: readonly InlineMark[];
|
|
64
|
+
}, styles?: Partial<Record<InlineMark["kind"], Style>>): HTMLElement;
|
|
65
|
+
/** Children of el by data-ak attribute, in document order. */
|
|
66
|
+
export declare function all(el: HTMLElement, name: string): HTMLElement[];
|
|
67
|
+
export declare function one(el: HTMLElement, name: string): HTMLElement | null;
|
|
68
|
+
export declare function tag(el: HTMLElement, name: string): HTMLElement;
|
|
69
|
+
/**
|
|
70
|
+
* The largest font size in [min, max] at which el fits its width and is at
|
|
71
|
+
* most maxHeight tall. Layout depends only on the format and the text, so
|
|
72
|
+
* mount calls this once.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fitTo(el: HTMLElement, { min, max, maxHeight }: {
|
|
75
|
+
min: number;
|
|
76
|
+
max: number;
|
|
77
|
+
maxHeight: number;
|
|
78
|
+
}): number;
|
|
79
|
+
/** What fitLines searches within, and the box the text must fit. */
|
|
80
|
+
export interface FitLinesOptions {
|
|
81
|
+
/** The most lines the text may take. */
|
|
82
|
+
lines: number;
|
|
83
|
+
/** Smallest font size in px. */
|
|
84
|
+
min: number;
|
|
85
|
+
/** Largest font size in px. */
|
|
86
|
+
max: number;
|
|
87
|
+
/** The box's width in px, set as the element's width. Default: the element's own width (required for a text). */
|
|
88
|
+
width?: number;
|
|
89
|
+
/** The box's height in px: the text is at most this tall too. Default: no limit. */
|
|
90
|
+
height?: number;
|
|
91
|
+
/** How close to the largest size the search gets, in px (default `FIT_LINES_PRECISION`, 0.5). */
|
|
92
|
+
precision?: number;
|
|
93
|
+
}
|
|
94
|
+
/** What fitLines found. */
|
|
95
|
+
export interface FitLines {
|
|
96
|
+
/** The font size, set on the element: the largest that fits, else `min`. */
|
|
97
|
+
size: number;
|
|
98
|
+
/** False when even `min` takes more lines, or is wider or taller than the box. */
|
|
99
|
+
fits: boolean;
|
|
100
|
+
/** The text of each line at that size, as the browser broke it (`textLines`). */
|
|
101
|
+
lines: string[];
|
|
102
|
+
}
|
|
103
|
+
export declare const FIT_LINES_PRECISION = 0.5;
|
|
104
|
+
/**
|
|
105
|
+
* The text of each line of el as the browser broke it, top to bottom:
|
|
106
|
+
* spaces collapsed, zero-width spaces (`wordBreaks`) left out. el must be
|
|
107
|
+
* in the page.
|
|
108
|
+
*/
|
|
109
|
+
export declare function textLines(el: HTMLElement): string[];
|
|
110
|
+
/**
|
|
111
|
+
* The largest font size in [min, max] at which the text takes at most
|
|
112
|
+
* `lines` lines and fits the box's width (no word sticks out) and, given
|
|
113
|
+
* `height`, its height, measured in the page. Pass an element in the page
|
|
114
|
+
* (its font size is set, and its width when `width` is given), or a text and
|
|
115
|
+
* the style it will be drawn with (measured in a hidden element, removed
|
|
116
|
+
* after; `width` is required): set the same style and the size found.
|
|
117
|
+
* Layout depends only on the format and the text, so call it in mount.
|
|
118
|
+
*/
|
|
119
|
+
export declare function fitLines(el: HTMLElement, opts: FitLinesOptions): FitLines;
|
|
120
|
+
export declare function fitLines(text: string, opts: FitLinesOptions & {
|
|
121
|
+
style?: Style;
|
|
122
|
+
}): FitLines;
|
|
123
|
+
type Box = readonly [x: number, y: number, w: number, h: number];
|
|
124
|
+
/** What freeAreas keeps clear of, and where it looks. */
|
|
125
|
+
export interface FreeAreaOptions {
|
|
126
|
+
/**
|
|
127
|
+
* The rectangle to look in, in the frame's pixels; default the content
|
|
128
|
+
* box of layout(ctx) (clear of the covered areas, with its margins).
|
|
129
|
+
*/
|
|
130
|
+
within?: Box;
|
|
131
|
+
/** Keep clear of every face at t (ctx.faces); default true. */
|
|
132
|
+
faces?: boolean;
|
|
133
|
+
/** Keep clear of the text of the layers listed before (ctx.texts); default true. */
|
|
134
|
+
texts?: boolean;
|
|
135
|
+
/** Keep clear of the covered areas (ctx.covered); default true. */
|
|
136
|
+
covered?: boolean;
|
|
137
|
+
/** Pixels kept around each thing avoided; default 24 × the type scale. */
|
|
138
|
+
margin?: number;
|
|
139
|
+
/** Leave out areas lower than this, pixels; default 0. */
|
|
140
|
+
minHeight?: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The empty areas of the frame at part time t: bands across `within`
|
|
144
|
+
* (the content box by default) where no face, other layer's text or
|
|
145
|
+
* covered area is, each `[x, y, w, h]` in the frame's pixels, tallest
|
|
146
|
+
* first. A measurement: use it, or not, as you place things. Draws the
|
|
147
|
+
* layers listed before this one, so call it in mount.
|
|
148
|
+
*/
|
|
149
|
+
export declare function freeAreas(ctx: StageContext, t: number, opts?: FreeAreaOptions): [number, number, number, number][];
|
|
150
|
+
/** A spot for a caption block's top: a place in the content box, or a y in pixels. */
|
|
151
|
+
export type CaptionSpot = "bottom" | "middle" | "top" | number;
|
|
152
|
+
/** What captionTop tries and keeps clear of. */
|
|
153
|
+
export interface CaptionTopOptions {
|
|
154
|
+
/** The spots to try, in order; default ["bottom", "top", "middle"]. */
|
|
155
|
+
prefer?: readonly CaptionSpot[];
|
|
156
|
+
/** Keep clear of faces (ctx.faces); default true. */
|
|
157
|
+
faces?: boolean;
|
|
158
|
+
/** Keep clear of the text of the layers listed before (ctx.texts); default true. */
|
|
159
|
+
texts?: boolean;
|
|
160
|
+
/** Pixels kept from a face; default 24 × the type scale. */
|
|
161
|
+
faceGap?: number;
|
|
162
|
+
/** Pixels kept from other text (often on a panel); default 48 × the type scale. */
|
|
163
|
+
textGap?: number;
|
|
164
|
+
/** Seconds between the moments of the cue it looks at; default 0.1. */
|
|
165
|
+
step?: number;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Where a caption block w × h pixels (centred across the frame) can go
|
|
169
|
+
* for one cue: the first spot in `prefer`, else just above or below
|
|
170
|
+
* another layer's text, clear of that text and of the faces over the
|
|
171
|
+
* whole cue; when none is clear of both, the least text covered, then
|
|
172
|
+
* the least face. Returns the block's top in pixels, inside the content
|
|
173
|
+
* box. A tool: call it in mount, once per cue, if you want a measured
|
|
174
|
+
* place; nothing places captions on its own.
|
|
175
|
+
*/
|
|
176
|
+
export declare function captionTop(ctx: StageContext, L: Layout, cue: Pick<CaptionTrackCue, "start" | "end">, w: number, h: number, opts?: CaptionTopOptions): number;
|
|
177
|
+
/**
|
|
178
|
+
* The look's background and text colours sorted into the lighter and the
|
|
179
|
+
* darker, as variables: text over footage can be light on a dark outline
|
|
180
|
+
* in any look. Measures the look, so call it in mount.
|
|
181
|
+
*/
|
|
182
|
+
export declare function lightDark(el: HTMLElement): {
|
|
183
|
+
light: string;
|
|
184
|
+
dark: string;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Words to stress, as you choose them: matched as said, case, accents
|
|
188
|
+
* and punctuation ignored, whole words; a phrase ("free trial") marks
|
|
189
|
+
* each of its words, and Chinese or Japanese may match inside a word.
|
|
190
|
+
*/
|
|
191
|
+
export type Emphasis = readonly string[];
|
|
192
|
+
/** The emoji a word brings, keyed like Emphasis. */
|
|
193
|
+
export type WordEmoji = Readonly<Record<string, string>>;
|
|
194
|
+
type CueWords = readonly CaptionTrackCue["words"][number][];
|
|
195
|
+
/** For each of a cue's words, whether `emphasis` names it. */
|
|
196
|
+
export declare function emphasized(words: CueWords, emphasis: Emphasis | undefined): boolean[];
|
|
197
|
+
/**
|
|
198
|
+
* For each of a cue's words, the emoji it brings ("" for none): a phrase's
|
|
199
|
+
* goes to its last word, and the first key that names a word wins.
|
|
200
|
+
*/
|
|
201
|
+
export declare function wordEmoji(words: CueWords, emoji: WordEmoji | undefined): string[];
|
|
202
|
+
/**
|
|
203
|
+
* An emoji to draw beside or above a word: in the look's emoji font
|
|
204
|
+
* (`var(--ak-font-emoji)`, colour emoji the stage has, the same on every
|
|
205
|
+
* computer), upright at regular weight, without the capitals or the
|
|
206
|
+
* outline of the line it sits in.
|
|
207
|
+
*/
|
|
208
|
+
export declare function emojiEl(value: string, style?: Style): HTMLElement;
|
|
209
|
+
export {};
|
|
210
|
+
//# sourceMappingURL=dom.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{contentEdges as N,markRuns as I,readMarks as $}from"@allyhub/piece";import{normText as C,WordStream as M}from"@allyhub/piece";import{largestFit as O,lineOf as R,lineSpans as j}from"./fit.js";export function h(t,n={},e=[],o){const r=document.createElement(t);o&&(r.className=o),css(r,n);for(const i of e)r.append(typeof i=="string"?document.createTextNode(i):i);return r}export function css(t,n){for(const[e,o]of Object.entries(n)){if(o===void 0)continue;const r=typeof o=="number"&&!B.has(e)?`${String(o)}px`:String(o);e.startsWith("--")?t.style.setProperty(e,r):t.style.setProperty(e.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`),r)}}const B=new Set(["opacity","zIndex","fontWeight","lineHeight","flex","flexGrow","flexShrink"]),F=/[\u3400-\u9fff\uf900-\ufaff]/;export function wordBreaks(t){if(!F.test(t)||typeof Intl.Segmenter!="function")return t;const n=new Intl.Segmenter("zh",{granularity:"word"});let e="";for(const o of n.segment(t))e&&o.isWordLike&&(e+=""),e+=o.segment;return e}export const text=t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):"",list=t=>Array.isArray(t)?t.map(text):t===void 0?[]:[text(t)];export function layout(t,n={}){const{width:e,height:o,orient:r}=t.dims;return{W:e,H:o,orient:r,...N(t.dims,n)}}export function contentBox(t,n={}){return h("div",{position:"absolute",left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top,display:"flex",flexDirection:"column",justifyContent:"center",...n})}export function textBlock(t,{size:n,weight:e=700,color:o="var(--ak-color-fg)",font:r="var(--ak-font-display)",lineHeight:i=1.15,align:s="left"}){return h("div",{fontFamily:r,fontSize:n,fontWeight:e,color:o,lineHeight:i,textAlign:s,overflowWrap:"break-word",textWrap:"balance",lineBreak:"strict",wordBreak:"keep-all",letterSpacing:e>=700?"-0.01em":"0"},[wordBreaks(t)])}export const MARK_STYLES={strong:{fontWeight:700},em:{color:"var(--ak-color-accent)"},strike:{textDecoration:"line-through"},code:{fontFamily:"var(--ak-font-mono)",fontSize:"0.9em"}};export function marked(t,n={}){const e=typeof t=="string"?$(t):t,o=h("span");for(const r of I(e.text,e.marks)){const i=wordBreaks(r.text);if(r.kinds.length===0){o.append(i);continue}const s={};for(const l of r.kinds)Object.assign(s,n[l]??MARK_STYLES[l]);const f=h("span",s,[i]);f.dataset.mark=r.kinds.join(" "),o.append(f)}return o}export function all(t,n){return Array.from(t.querySelectorAll(`[data-ak="${n}"]`))}export function one(t,n){return t.querySelector(`[data-ak="${n}"]`)}export function tag(t,n){return t.dataset.ak=n,t}export function fitTo(t,{min:n,max:e,maxHeight:o}){const r=()=>t.scrollWidth<=t.clientWidth+1&&t.offsetHeight<=o+1;if(t.style.fontSize=`${String(e)}px`,r())return e;let i=n,s=e;for(;s-i>.5;){const f=(i+s)/2;t.style.fontSize=`${String(f)}px`,r()?i=f:s=f}return t.style.fontSize=`${String(i)}px`,i}export const FIT_LINES_PRECISION=.5;function W(t){const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),e=[];for(let o=n.nextNode();o;o=n.nextNode())o instanceof Text&&e.push(o);return e}function v(t){const n=document.createRange(),e=[];for(const o of W(t)){n.selectNodeContents(o);for(const r of n.getClientRects())e.push(r)}return j(e)}export function textLines(t){const n=v(t);if(n.length===0)return[];const e=n.map(()=>""),o=document.createRange();let r=0;for(const i of W(t)){const s=i.data;for(let f=0;f<s.length;){const l=(s.codePointAt(f)??0)>65535?2:1;o.setStart(i,f),o.setEnd(i,f+l);const m=o.getBoundingClientRect();if(m.height>0){const d=R(m,n);d>=0&&(r=d)}e[r]=(e[r]??"")+s.slice(f,f+l),f+=l}}return e.map(i=>i.replace(/\u200b/g,"").replace(/\s+/g," ").trim())}export function fitLines(t,n){if(typeof t=="string"){if(n.width===void 0)throw new Error("fitLines: a text needs a width");const d=h("div",n.style??{},[t]),x=h("div",{position:"absolute",left:0,top:0,visibility:"hidden",pointerEvents:"none"},[d]);document.body.append(x);try{return fitLines(d,n)}finally{x.remove()}}const e=t,{lines:o,min:r,max:i,width:s,height:f}=n;s!==void 0&&(e.style.width=`${String(s)}px`);const l=d=>(e.style.fontSize=`${String(d)}px`,e.scrollWidth>e.clientWidth+1||f!==void 0&&(e.offsetHeight>f+1||e.scrollHeight>e.clientHeight+1)?!1:v(e).length<=o),m=O(r,i,n.precision??FIT_LINES_PRECISION,l);return e.style.fontSize=`${String(m.size)}px`,{...m,lines:textLines(e)}}const _=(t,n)=>Math.max(0,Math.min(t[0]+t[2],n[0]+n[2])-Math.max(t[0],n[0]))*Math.max(0,Math.min(t[1]+t[3],n[1]+n[3])-Math.max(t[1],n[1]));export function freeAreas(t,n,e={}){const o=layout(t),[r,i,s,f]=e.within??[o.left,o.top,o.right-o.left,o.bottom-o.top],l=i+f,m=e.margin??24*o.k,x=[...e.faces===!1?[]:t.faces(n).map(a=>a.box),...e.texts===!1?[]:t.texts(n).map(a=>a.box),...e.covered===!1?[]:t.covered].filter(a=>a[0]<r+s&&a[0]+a[2]>r).map(a=>[a[1]-m,a[1]+a[3]+m]).sort((a,y)=>a[0]-y[0]),g=[];let p=i;for(const[a,y]of x)if(a>p&&g.push([r,p,s,Math.min(a,l)-p]),p=Math.max(p,y),p>=l)break;return p<l&&g.push([r,p,s,l-p]),g.filter(a=>a[3]>0&&a[3]>=(e.minHeight??0)).sort((a,y)=>y[3]-a[3])}export function captionTop(t,n,e,o,r,i={}){const s=c=>Math.min(Math.max(c,n.top),Math.max(n.top,n.bottom-r)),f=c=>s(c==="top"?n.top:c==="middle"?(n.top+n.bottom-r)/2:c==="bottom"?n.bottom-r:c),l=(i.prefer??["bottom","top","middle"]).map(f),m=Math.max(.02,i.step??.1),d=Math.max(0,e.end-e.start),x=Math.min(200,Math.max(1,Math.ceil(d/m))),g=[],p=[];for(let c=0;c<x;c++){const u=e.start+d*c/x;i.texts!==!1&&g.push(...t.texts(u).map(k=>k.box)),i.faces!==!1&&p.push(...t.faces(u).map(k=>k.box))}const a=(n.W-o)/2,y=i.textGap??48*n.k,T=i.faceGap??24*n.k,b=(c,u,k)=>u.reduce((H,A)=>H+_([a,c-k,o,r+2*k],A),0),z=g.flatMap(([,c,,u])=>[s(c-y-r),s(c+u+y)]).sort((c,u)=>Math.abs(c-(l[0]??0))-Math.abs(u-(l[0]??0)));let w=l[0]??s(n.bottom-r),S=[1/0,1/0];for(const c of[...l,...z]){const u=[b(c,g,y),b(c,p,T)];if(u[0]===0&&u[1]===0)return c;(u[0]<S[0]||u[0]===S[0]&&u[1]<S[1])&&(S=u,w=c)}return w}export function lightDark(t){const n="var(--ak-color-bg)",e="var(--ak-color-fg)",o=s=>{const f=h("span",{color:s,display:"none"});t.append(f);const l=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/.exec(getComputedStyle(f).color);if(f.remove(),!l)return;const[m=0,d=0,x=0]=l.slice(1,4).map(g=>{const p=Number(g)/255;return p<=.04045?p/12.92:((p+.055)/1.055)**2.4});return .2126*m+.7152*d+.0722*x},r=o(n),i=o(e);return r!==void 0&&i!==void 0&&i>r?{light:e,dark:n}:{light:n,dark:e}}const G=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;function E(t,n){const e=C(n),o=[],r=t.words.length-1;for(let i=1;;i++){const s=t.span(e,0,r,i);if(!s)return o;(G.test(e)||t.charOf(s.first)+e.length===t.charOf(s.last+1))&&o.push([s.first,s.last])}}export function emphasized(t,n){const e=t.map(()=>!1);if(!n?.length)return e;const o=new M(t);for(const r of n)for(const[i,s]of E(o,r))e.fill(!0,i,s+1);return e}export function wordEmoji(t,n){const e=t.map(()=>"");if(!n)return e;const o=new M(t);for(const[r,i]of Object.entries(n))for(const[,s]of E(o,r))(e[s]??"")===""&&(e[s]=i);return e}export function emojiEl(t,n={}){const e=h("span",{display:"inline-block",fontFamily:"var(--ak-font-emoji)",fontWeight:400,fontStyle:"normal",fontSynthesis:"none",textTransform:"none",letterSpacing:"0",lineHeight:1,WebkitTextStroke:"0",textShadow:"none",...n},[t]);return e.setAttribute("aria-hidden","true"),e}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Fill, type GraphicLayer } from "@allyhub/piece";
|
|
2
|
+
import { type LayerOptions } from "./define.js";
|
|
3
|
+
import type { Written } from "./written.js";
|
|
4
|
+
export interface FillOptions extends LayerOptions {
|
|
5
|
+
/** A colour ({ color }), a gradient ({ gradient }) or a picture tiled ({ pattern, scale }). */
|
|
6
|
+
fill: Fill;
|
|
7
|
+
}
|
|
8
|
+
/** A fill layer's props. */
|
|
9
|
+
export interface FillProps {
|
|
10
|
+
readonly fill: Fill;
|
|
11
|
+
readonly base: string;
|
|
12
|
+
}
|
|
13
|
+
/** The component name of a fill layer. */
|
|
14
|
+
export declare const FILL = "fill";
|
|
15
|
+
/** Why a fill cannot be painted, or undefined. */
|
|
16
|
+
export declare function paintRefusal(fill: Fill | null | undefined): string | undefined;
|
|
17
|
+
/** A fill layer: fill({ key, fill: { gradient: { stops, angle } }, mask }). */
|
|
18
|
+
export type FillFn = (opts: FillOptions) => GraphicLayer<FillProps>;
|
|
19
|
+
/** fill() for the module `at` names: a pattern's path is from its folder. */
|
|
20
|
+
export declare const fillFor: (at: Written) => FillFn;
|
|
21
|
+
//# sourceMappingURL=fill.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{FillSchema as u,LAYER_BRAND as m,issueOf as p}from"@allyhub/piece";import{gradientRefusal as y,paintCss as g}from"@allyhub/image-draw/paint";import{LayerError as f,splitLayer as w,styleOf as $}from"./define.js";export const FILL="fill";export function paintRefusal(n){if(n&&"gradient"in n)return y(n.gradient,!1)}export const fillFor=n=>e=>{const i=`fill()${e.key===void 0?"":` ${e.key}`}`,t=u.safeParse(e.fill);if(!t.success)throw new f("AK-I003",`${i}: ${p(t.error,"fill")}.`);const l=paintRefusal(e.fill);if(l)throw new f("AK-I007",`${i}: ${l}.`);$(e,"fill","fill()");const[o,c]=w(e);return{[m]:"graphic",...o,kind:"fill",component:FILL,props:{fill:c.fill,base:n.base},mount:(s,a,d)=>{const r=s.ownerDocument.createElement("div");r.dataset.akFill="",Object.assign(r.style,{position:"absolute",inset:"0"}),g(r,a.fill,d,a.base),s.append(r)},render:()=>{}}};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type GraphicLayer } from "@allyhub/piece";
|
|
2
|
+
import { type LayerOptions } from "./define.js";
|
|
3
|
+
export interface GroupOptions extends LayerOptions {
|
|
4
|
+
/** Its layers, back to front, each with its key. */
|
|
5
|
+
layers: GraphicLayer[];
|
|
6
|
+
}
|
|
7
|
+
/** A group's props: its layers. */
|
|
8
|
+
export interface GroupProps {
|
|
9
|
+
readonly layers: readonly GraphicLayer[];
|
|
10
|
+
}
|
|
11
|
+
/** The component name of a group. */
|
|
12
|
+
export declare const GROUP = "group";
|
|
13
|
+
/** A group of layers, nested as written: group({ key, layers: [...], blendMode, opacity, mask, effects }). */
|
|
14
|
+
export declare function group(opts: GroupOptions): GraphicLayer<GroupProps>;
|
|
15
|
+
/** A layer's layers when it is a group, else none. */
|
|
16
|
+
export declare function groupLayers(l: GraphicLayer): readonly GraphicLayer[];
|
|
17
|
+
//# sourceMappingURL=group.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{LAYER_BRAND as f,isGraphicLayer as c}from"@allyhub/piece";import{LayerError as i,splitLayer as l,styleOf as m}from"./define.js";import{mountStack as g}from"./stack.js";export const GROUP="group";export function group(e){m(e,"group","group()");const[a,u]=l(e),p=u.layers;if(!Array.isArray(p))throw new i("AK-I003",`group()${e.key===void 0?"":` ${e.key}`}: layers is a list of layers, back to front.`);p.forEach((r,n)=>{if(!c(r))throw new i("AK-I003",`group() ${e.key??""}: layer ${String(n+1)} is not a layer made by a component, picture(), textLayer(), shape(), fill(), adjustment(), group() or custom().`);const o=r.z;if(o!==void 0&&o!=="front")throw new i("AK-I003",`group() ${e.key??""}: layer ${String(n+1)} has z "${o}": a group's layers are drawn in its order, so z is a layer's of a part alone.`)});const s=new WeakMap;return{[f]:"graphic",...a,kind:"group",component:GROUP,props:{layers:p},mount:(r,n,o)=>{s.set(r,g(r,n.layers,o))},render:(r,n,o,t)=>{for(const y of s.get(r)??[])y.layer.render(y.content,n,y.layer.props,t)},unmount:(r,n,o)=>{for(const t of s.get(r)??[])t.layer.unmount?.(t.content,t.layer.props,o);s.delete(r)}}}export function groupLayers(e){if(e.kind!=="group")return[];const a=e.props.layers;return Array.isArray(a)?a:[]}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { LAYER_BRAND, type BuildContext, type MediaInfo, type GraphicLayer, type LayerTiming, type Matrix } from "@allyhub/piece";
|
|
2
|
+
import { type FillFn } from "./fill.js";
|
|
3
|
+
import { type PictureFn } from "./picture.js";
|
|
4
|
+
import { type ShapeFn } from "./shape.js";
|
|
5
|
+
import { type TextLayerFn } from "./text-layer.js";
|
|
6
|
+
export type { PictureFit, PicturePoint } from "@allyhub/piece";
|
|
7
|
+
export type { PictureFn, PictureOptions } from "./picture.js";
|
|
8
|
+
export { LayerError, custom, defineComponent, type Component, type ComponentDefinition, type CustomOptions, type LayerOptions, type StageContext, } from "./define.js";
|
|
9
|
+
export { group, groupLayers, type GroupOptions } from "./group.js";
|
|
10
|
+
export { adjustment, type AdjustmentOptions } from "./adjustment.js";
|
|
11
|
+
export type { FillFn, FillOptions } from "./fill.js";
|
|
12
|
+
export type { ShapeFn, ShapeOptions } from "./shape.js";
|
|
13
|
+
export type { TextItem, TextLayerFn, TextLayerOptions } from "./text-layer.js";
|
|
14
|
+
export { mountLayer, mountStack } from "./stack.js";
|
|
15
|
+
export { ADJUSTMENT_DEFAULTS, ADJUSTMENT_KINDS, BLEND_DRAWN, BLEND_MODES, EFFECT_DEFAULTS, EFFECT_NAMES, LAYER_STYLE_DEFAULTS, SHAPE_DEFAULTS, TEXT_DEFAULTS, type Adjustment, type BlendMode, type Effects, type Fill, type Gradient, type LayerKind, type LayerMask, type LayerStyle, } from "@allyhub/piece";
|
|
16
|
+
/** A layer of a board: a component's, picture()'s or custom()'s (a footage layer is a video's). */
|
|
17
|
+
export type LayerSpec = GraphicLayer | (LayerTiming & {
|
|
18
|
+
readonly [LAYER_BRAND]: "footage";
|
|
19
|
+
});
|
|
20
|
+
/** Whether a value is a layer a component, picture(), custom() or footage() made. */
|
|
21
|
+
export declare const isLayerSpec: (v: unknown) => v is LayerSpec;
|
|
22
|
+
/** Marks an image image() made. */
|
|
23
|
+
export declare const IMAGE_BRAND = "__allyhubImage";
|
|
24
|
+
/** Marks a board board() made. */
|
|
25
|
+
export declare const BOARD_BRAND = "__allyhubBoard";
|
|
26
|
+
/**
|
|
27
|
+
* The defaults of a board whose height grows with what it holds
|
|
28
|
+
* (`height: "auto"`), each one changeable on the board: pixels.
|
|
29
|
+
*/
|
|
30
|
+
export declare const BOARD_DEFAULTS: {
|
|
31
|
+
/** The height its layers are laid out at before it is measured, and the least it is. */
|
|
32
|
+
readonly minHeight: 64;
|
|
33
|
+
/** The most it grows to; what reaches further is cut. */
|
|
34
|
+
readonly maxHeight: 16384;
|
|
35
|
+
/** Pixels per inch, for print and PSD (Photoshop's 72 for the screen). */
|
|
36
|
+
readonly resolution: 72;
|
|
37
|
+
/** The colour profile a board is drawn in and said to be. */
|
|
38
|
+
readonly colorProfile: "sRGB IEC61966-2.1";
|
|
39
|
+
};
|
|
40
|
+
/** The longest side a board takes, pixels: what one picture the stage draws holds. */
|
|
41
|
+
export declare const MAX_SIDE = 16384;
|
|
42
|
+
export interface BoardOptions {
|
|
43
|
+
/** Its name: unique in the image, the file it renders to (`og.png`), stable across combos. */
|
|
44
|
+
key: string;
|
|
45
|
+
/** Its size, `WIDTHxHEIGHT` in pixels ("1200x630"). Or `width` and `height`. */
|
|
46
|
+
size?: string;
|
|
47
|
+
/** Its width, pixels (with `height`, instead of `size`). */
|
|
48
|
+
width?: number;
|
|
49
|
+
/** Its height, pixels, or "auto": as tall as what its layers hold (a tall detail picture). */
|
|
50
|
+
height?: number | "auto";
|
|
51
|
+
/** A "auto" board's least height, and the height it is laid out at first; default BOARD_DEFAULTS.minHeight. */
|
|
52
|
+
minHeight?: number;
|
|
53
|
+
/** A "auto" board's most height; default BOARD_DEFAULTS.maxHeight. */
|
|
54
|
+
maxHeight?: number;
|
|
55
|
+
/** Its name for people; default its key. */
|
|
56
|
+
title?: string;
|
|
57
|
+
/** What it shows, back to front, each with its name (`key`); a group's layers too, each named once in the board. */
|
|
58
|
+
layers: LayerSpec[];
|
|
59
|
+
/** What is drawn under its layers, a CSS colour or "transparent" (Photoshop's artboard background); default the image's (white, or none when it is transparent). */
|
|
60
|
+
background?: string;
|
|
61
|
+
/** Its resolution for print and PSD, pixels per inch: metadata, nothing drawn changes; default BOARD_DEFAULTS.resolution. */
|
|
62
|
+
resolution?: number;
|
|
63
|
+
/** Its colour profile's name for print and PSD: metadata, it is drawn in sRGB; default BOARD_DEFAULTS.colorProfile. */
|
|
64
|
+
colorProfile?: string;
|
|
65
|
+
}
|
|
66
|
+
/** A board as board() makes it. */
|
|
67
|
+
export type Board = BoardOptions & {
|
|
68
|
+
readonly [BOARD_BRAND]: true;
|
|
69
|
+
};
|
|
70
|
+
/** Whether a value is a board board() made. */
|
|
71
|
+
export declare function isBoard(v: unknown): v is Board;
|
|
72
|
+
/** A board's size as written: whole pixels, or a height that grows. */
|
|
73
|
+
export type BoardSize = {
|
|
74
|
+
readonly width: number;
|
|
75
|
+
readonly height: number;
|
|
76
|
+
} | {
|
|
77
|
+
readonly width: number;
|
|
78
|
+
readonly height: "auto";
|
|
79
|
+
readonly minHeight: number;
|
|
80
|
+
readonly maxHeight: number;
|
|
81
|
+
};
|
|
82
|
+
/** `WIDTHxHEIGHT` as numbers, or undefined. */
|
|
83
|
+
export declare function parseSize(size: string): {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
} | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* A board the size of a picture, as `size` takes it ("4032x3024"): for a
|
|
89
|
+
* board that starts from a photo, the photo its bottom layer
|
|
90
|
+
* (`picture({ key: "photo", src })`, drawn whole at its own pixels). The
|
|
91
|
+
* picture is an import, or what `ctx.asset()` gives; its file is never
|
|
92
|
+
* changed.
|
|
93
|
+
*/
|
|
94
|
+
export declare function fromPicture(src: MediaInfo): string;
|
|
95
|
+
/** A board's size as it writes it; a string says what is wrong. */
|
|
96
|
+
export declare function boardSize(b: BoardOptions): BoardSize | string;
|
|
97
|
+
/**
|
|
98
|
+
* What board() and image() refuse: the rule it breaks (`code`, the
|
|
99
|
+
* image's: AK-I001 a size, AK-I002 a name used twice, AK-I003 a layer) and
|
|
100
|
+
* why. The stage reports it under that rule, at the line that made it.
|
|
101
|
+
*/
|
|
102
|
+
export declare class ImageError extends Error {
|
|
103
|
+
readonly code: string;
|
|
104
|
+
constructor(code: string, message: string);
|
|
105
|
+
}
|
|
106
|
+
/** A board of an image: its key, its size and its layers, each named. */
|
|
107
|
+
export declare function board(opts: BoardOptions): Board;
|
|
108
|
+
/** What an image's boards function receives: its combo, the language's text, the project's media and data. */
|
|
109
|
+
export type ImageContext = BuildContext;
|
|
110
|
+
export interface ImageOptions {
|
|
111
|
+
/** A stable identity. Default: its module's file without its extension, from the project's root. */
|
|
112
|
+
id?: string;
|
|
113
|
+
/** A name for people. Default: its script's `title`, else the folder. */
|
|
114
|
+
title?: string | Record<string, string>;
|
|
115
|
+
/** The matrix, as a video's: `dims` (lang, variants) crossed in full, slots. Each combo is a set of its boards. */
|
|
116
|
+
matrix?: Matrix;
|
|
117
|
+
/** Any key-values: the platform filters and groups by them. */
|
|
118
|
+
meta?: Record<string, unknown>;
|
|
119
|
+
/**
|
|
120
|
+
* Its script, a file per language, from this module's folder: `{locale}`
|
|
121
|
+
* in its name stands for each (`./launch.{locale}.yaml`): its title,
|
|
122
|
+
* each board's words by layer key and a picture's alt text. None: it has
|
|
123
|
+
* no words of its own.
|
|
124
|
+
*/
|
|
125
|
+
script?: string;
|
|
126
|
+
/** Its boards have no background: their files keep the alpha channel (PNG, WebP, AVIF). */
|
|
127
|
+
transparent?: boolean;
|
|
128
|
+
/** Its boards, in order. */
|
|
129
|
+
boards(ctx: ImageContext): Board[] | Promise<Board[]>;
|
|
130
|
+
}
|
|
131
|
+
/** An image as image() makes it: its fields as written, and where. */
|
|
132
|
+
export type Image = ImageOptions & {
|
|
133
|
+
readonly [IMAGE_BRAND]: true;
|
|
134
|
+
readonly kind: "image";
|
|
135
|
+
readonly written: {
|
|
136
|
+
readonly file: string;
|
|
137
|
+
readonly base: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/** Whether a value is an image image() made. */
|
|
141
|
+
export declare function isImage(v: unknown): v is Image;
|
|
142
|
+
/** image() as a module calls it. */
|
|
143
|
+
export type ImageFn = (opts: ImageOptions) => Image;
|
|
144
|
+
/** image() for the module `file` names (a project path; "" the root). */
|
|
145
|
+
export declare const imageFor: (file: string) => ImageFn;
|
|
146
|
+
/** What the build gives the file that imports this entry: image(), picture(), textLayer(), shape() and fill() made for it. */
|
|
147
|
+
export declare const imageSdkFor: (module: {
|
|
148
|
+
file: string;
|
|
149
|
+
}) => {
|
|
150
|
+
image: ImageFn;
|
|
151
|
+
picture: PictureFn;
|
|
152
|
+
textLayer: TextLayerFn;
|
|
153
|
+
shape: ShapeFn;
|
|
154
|
+
fill: FillFn;
|
|
155
|
+
};
|
|
156
|
+
/** An image: the default export of an image's module. Its function returns its boards, in order. */
|
|
157
|
+
export declare const image: ImageFn;
|
|
158
|
+
/** A still on a layer, in CSS's terms: picture({ key, src: photo, fit: "cover", position: [0.62, 0.4] }). */
|
|
159
|
+
export declare const picture: PictureFn;
|
|
160
|
+
/** Photoshop's type layer: textLayer({ key, textItem: { contents: ctx.s("title"), characterStyle: { size: 96 } }, box }). */
|
|
161
|
+
export declare const textLayer: TextLayerFn;
|
|
162
|
+
/** Photoshop's shape layer: shape({ key, shape: "ellipse", box, fill: { color: "#e4572e" }, stroke: { width: 4 } }). */
|
|
163
|
+
export declare const shape: ShapeFn;
|
|
164
|
+
/** Photoshop's fill layer: fill({ key, fill: { gradient: { stops: [...] } } }). */
|
|
165
|
+
export declare const fill: FillFn;
|
|
166
|
+
//# sourceMappingURL=index.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{dirOf as l,projectPath as g}from"@allyhub/formats";import{LAYER_BRAND as u}from"@allyhub/piece";import{isColor as y}from"@allyhub/piece";import{fillFor as p}from"./fill.js";import{groupLayers as w}from"./group.js";import{pictureFor as x}from"./picture.js";import{shapeFor as A}from"./shape.js";import{textLayerFor as $}from"./text-layer.js";import{writtenIn as k}from"./written.js";export{LayerError,custom,defineComponent}from"./define.js";export{group,groupLayers}from"./group.js";export{adjustment}from"./adjustment.js";export{mountLayer,mountStack}from"./stack.js";export{ADJUSTMENT_DEFAULTS,ADJUSTMENT_KINDS,BLEND_DRAWN,BLEND_MODES,EFFECT_DEFAULTS,EFFECT_NAMES,LAYER_STYLE_DEFAULTS,SHAPE_DEFAULTS,TEXT_DEFAULTS}from"@allyhub/piece";export const isLayerSpec=e=>typeof e=="object"&&e!==null&&u in e,IMAGE_BRAND="__allyhubImage",BOARD_BRAND="__allyhubBoard",BOARD_DEFAULTS={minHeight:64,maxHeight:16384,resolution:72,colorProfile:"sRGB IEC61966-2.1"},MAX_SIDE=16384;export function isBoard(e){return typeof e=="object"&&e!==null&&BOARD_BRAND in e}const n=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=MAX_SIDE;export function parseSize(e){const r=/^(\d+)x(\d+)$/u.exec(e.trim());if(!r)return;const t=Number(r[1]),i=Number(r[2]);return n(t)&&n(i)?{width:t,height:i}:void 0}export function fromPicture(e){const{width:r,height:t}=e;if(e.kind!=="image"||r===void 0||t===void 0||!n(r)||!n(t))throw new ImageError("AK-I001",`fromPicture(${JSON.stringify(e.path)}): ${e.kind==="image"?`its size is not known in whole pixels from 1 to ${String(MAX_SIDE)}`:"it is not a still picture"}. Import a still picture (import photo from "../assets/media/photo.jpg"), or give the board its size.`);return`${String(r)}x${String(t)}`}export function boardSize(e){const r=`whole pixels from 1 to ${String(MAX_SIDE)}`;if(e.size!==void 0)return e.width!==void 0||e.height!==void 0?`board ${e.key} gives both size and width/height: give one.`:(typeof e.size=="string"?parseSize(e.size):void 0)??`board ${e.key}: size ${JSON.stringify(e.size)} is not WIDTHxHEIGHT in ${r} ("1200x630").`;if(e.width===void 0&&e.height===void 0)return`board ${e.key} has no size: give size ("1200x630"), or width and height.`;if(!n(e.width))return`board ${e.key}: width is not ${r}.`;if(e.height==="auto"){const t=e.minHeight??BOARD_DEFAULTS.minHeight,i=e.maxHeight??BOARD_DEFAULTS.maxHeight;return!n(t)||!n(i)||t>i?`board ${e.key}: minHeight and maxHeight are ${r}, the least first.`:{width:e.width,height:"auto",minHeight:t,maxHeight:i}}return n(e.height)?{width:e.width,height:e.height}:`board ${e.key}: height is not ${r} or "auto".`}export class ImageError extends Error{code;constructor(r,t){super(t),this.name="ImageError",this.code=r}}export function board(e){if(typeof e.key!="string"||!/^[A-Za-z0-9][\w.-]*$/u.test(e.key))throw new ImageError("AK-I002",`board: key ${JSON.stringify(e.key)} is not a name (letters, digits, - _ and ., from a letter or digit): it names the board's file.`);const r=boardSize(e);if(typeof r=="string")throw new ImageError("AK-I001",`board ${r}`);if(!Array.isArray(e.layers))throw new ImageError("AK-I003",`board ${e.key}: layers is a list of layers.`);if(e.background!==void 0&&e.background!=="transparent"&&!y(e.background))throw new ImageError("AK-I001",`board ${e.key}: background ${JSON.stringify(e.background)} is not a CSS colour or "transparent".`);if(e.resolution!==void 0&&!(typeof e.resolution=="number"&&e.resolution>0&&e.resolution<=1e4))throw new ImageError("AK-I001",`board ${e.key}: resolution is pixels per inch, more than 0.`);if(e.colorProfile!==void 0&&typeof e.colorProfile!="string")throw new ImageError("AK-I001",`board ${e.key}: colorProfile is a profile's name.`);const t=new Set,i=(h,c)=>{h.forEach((s,m)=>{const f=`${c} ${String(m+1)}`;if(!isLayerSpec(s))throw new ImageError("AK-I003",`${f} is not a layer made by a component, picture(), textLayer(), shape(), fill(), adjustment(), group() or custom().`);const o=s.key;if(typeof o!="string"||o==="")throw new ImageError("AK-I003",`${f} has no name: give every layer of a board its key (picture({ key: "photo", … }), Caption({ key: "caption", … })).`);if(!/^[A-Za-z0-9][\w.-]*$/u.test(o))throw new ImageError("AK-I002",`board ${e.key}: layer key ${JSON.stringify(o)} is not a name (letters, digits, - _ and ., from a letter or digit).`);if(t.has(o))throw new ImageError("AK-I002",`board ${e.key}: two layers are named ${o}. Every layer of a board needs its own key, a group's layers too.`);t.add(o);const d=s[u]==="graphic"?w(s):[];d.length>0&&i(d,`board ${e.key}: group ${o}'s layer`)})};return i(e.layers,`board ${e.key}: layer`),{...e,[BOARD_BRAND]:!0}}export function isImage(e){return typeof e=="object"&&e!==null&&IMAGE_BRAND in e}function S(e){const r=g(e);if(r.startsWith("/")||r.split("/").includes(".."))throw new Error(`imageSdkFor: ${JSON.stringify(e)} is not a project path, such as "launch/og.ts".`);return{file:r,base:l(r)}}export const imageFor=e=>r=>{if(typeof r!="object"||typeof r.boards!="function")throw new ImageError("AK-I005",`An image's module exports one image: export default image({ script: "./launch.{locale}.yaml", boards: (ctx) => [ board({ key, size, layers }), … ] }).`);if(r.script!==void 0&&(typeof r.script!="string"||!r.script.includes("{locale}")))throw new ImageError("AK-I005",`An image's script is a file per language: write {locale} in its name for each (./launch.{locale}.yaml), not ${JSON.stringify(r.script)}.`);return{...r,[IMAGE_BRAND]:!0,kind:"image",written:S(e)}},imageSdkFor=e=>{const r=k(e);return{image:imageFor(e.file),picture:x(r),textLayer:$(r),shape:A(r),fill:p(r)}};const a=imageSdkFor({file:""});export const image=a.image,picture=a.picture,textLayer=a.textLayer,shape=a.shape,fill=a.fill;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MediaInfo } from "@allyhub/piece";
|
|
2
|
+
/** A media value. Used by the code the build generates for media imports. */
|
|
3
|
+
export declare function media(info: MediaInfo): MediaInfo;
|
|
4
|
+
/** Whether a value is a media value (an import, or ctx.asset's). */
|
|
5
|
+
export declare function isMedia(v: unknown): v is MediaInfo;
|
|
6
|
+
//# sourceMappingURL=media.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{asUrlString as o}from"@allyhub/piece";import{MEDIA_BRAND as t}from"@allyhub/piece";export function media(r){return o({[t]:!0,...r})}export function isMedia(r){return typeof r=="object"&&r!==null&&t in r}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type GraphicLayer, type MediaInfo, type PictureFit, type PicturePoint } from "@allyhub/piece";
|
|
2
|
+
import { type LayerMask } from "@allyhub/piece";
|
|
3
|
+
import { type LayerOptions } from "./define.js";
|
|
4
|
+
import type { Written } from "./written.js";
|
|
5
|
+
/** A still named by its project path, or as imported. */
|
|
6
|
+
type MediaRef = string | MediaInfo;
|
|
7
|
+
/** A box in shares: x, y, width, height. */
|
|
8
|
+
type Rect = [x: number, y: number, w: number, h: number];
|
|
9
|
+
/** A still's mask: "ellipse" (the ellipse in its box), a picture whose alpha masks it, or a CSS `mask-image` (a gradient); or a mask's object, laid over its box. */
|
|
10
|
+
export type PictureMask = LayerMask;
|
|
11
|
+
export interface PictureOptions extends LayerOptions {
|
|
12
|
+
/** The still: an import, or a path from the module that wrote picture(). PNG, JPEG, WebP, AVIF, GIF or SVG. */
|
|
13
|
+
src: MediaRef;
|
|
14
|
+
/** Where it shows, [x, y, w, h] as fractions of the layer's frame; default all of it. */
|
|
15
|
+
box?: Rect;
|
|
16
|
+
/** How it fills its box, CSS's `object-fit`; default "cover". */
|
|
17
|
+
fit?: PictureFit;
|
|
18
|
+
/**
|
|
19
|
+
* The point of the picture at the same point of the box, as shares (CSS's
|
|
20
|
+
* `object-position` in percentages), default [0.5, 0.5].
|
|
21
|
+
*/
|
|
22
|
+
position?: PicturePoint;
|
|
23
|
+
/** The part of the source shown, [x, y, w, h] as fractions of it, fitted as the whole picture would be. */
|
|
24
|
+
crop?: Rect;
|
|
25
|
+
/** Laid over its box: "ellipse", a picture (an import, or a path with an image's extension) whose alpha masks it, any other CSS `mask-image` value ("linear-gradient(black 60%, transparent)"), or a mask's object (its density, feather, inversion, a path). */
|
|
26
|
+
mask?: PictureMask;
|
|
27
|
+
/** The box's corners: CSS's `border-radius`, a number of the frame's pixels or any CSS value ("50%"). */
|
|
28
|
+
radius?: number | string;
|
|
29
|
+
/** CSS's `filter`: "blur(4px) saturate(0.8)", lengths in the frame's pixels. */
|
|
30
|
+
filter?: string;
|
|
31
|
+
/** What it shows, for a screen reader. */
|
|
32
|
+
alt?: string;
|
|
33
|
+
}
|
|
34
|
+
/** A picture layer's props: its options, and the folder its paths are from. */
|
|
35
|
+
export interface PictureProps extends Omit<PictureOptions, keyof LayerOptions> {
|
|
36
|
+
/** Its mask, laid over its box (the layer's, kept here for its drawing). */
|
|
37
|
+
mask?: PictureMask;
|
|
38
|
+
/** Its blend as CSS names it, drawn on its box (the layer's blend mode when it has no effects). */
|
|
39
|
+
blendCss?: string;
|
|
40
|
+
/** The folder of the module that wrote it, a project path ("" the root). */
|
|
41
|
+
base: string;
|
|
42
|
+
/** A number `radius` is px at 1080p, scaled with the frame's shorter side: footage()'s, for a still. */
|
|
43
|
+
at1080?: true;
|
|
44
|
+
}
|
|
45
|
+
/** The layer's component name. */
|
|
46
|
+
export declare const PICTURE = "picture";
|
|
47
|
+
/** What is wrong with a picture's options, or undefined. */
|
|
48
|
+
export declare function pictureProblem(o: PictureOptions): string | undefined;
|
|
49
|
+
/** The picture layer: a graphic layer whose props are its options and its module's folder. */
|
|
50
|
+
export declare function pictureLayer(opts: PictureOptions, base: string, more?: {
|
|
51
|
+
at1080?: true;
|
|
52
|
+
caller?: string;
|
|
53
|
+
}): GraphicLayer<PictureProps>;
|
|
54
|
+
/** picture({ src, fit, position, … }): a still on the layer. */
|
|
55
|
+
export type PictureFn = (opts: PictureOptions) => GraphicLayer<PictureProps>;
|
|
56
|
+
/** picture() for the module `at` names: its paths are from its folder. */
|
|
57
|
+
export declare const pictureFor: (at: Written) => PictureFn;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=picture.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{LAYER_BRAND as R,MEDIA_BRAND as J,PICTURE_DEFAULTS as C,mediaKindOf as x,pathIn as F,placePicture as D}from"@allyhub/piece";import{applyMask as L,defsOf as v}from"@allyhub/image-draw/layer-style";import{BLEND_DRAWN as B}from"@allyhub/piece";import{splitLayer as G,styleOf as T}from"./define.js";export const PICTURE="picture";const k=["cover","contain","fill","none"],O=e=>typeof e=="object"&&e!==null&&(J in e||"sha256"in e),S=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,$=e=>{if(!Array.isArray(e)||e.length!==4||!e.every(S))return!1;const[t,i,s,n]=e;return t+s<=1+1e-9&&i+n<=1+1e-9&&s>0&&n>0},W=e=>e!=="ellipse"&&x(e)==="image"&&!e.includes("(");export function pictureProblem(e){const t=e.src;if(typeof t!="string"&&!O(t))return`src ${JSON.stringify(t)} is not a still: an import (import photo from "./photo.jpg") or a path from the module.`;const i=typeof t=="string"?t:t.path;if((typeof t=="string"?x(i):t.kind)!=="image")return`src ${i} is not a still (PNG, JPEG, WebP, AVIF, GIF or SVG); a video is footage().`;if(e.fit!==void 0&&!k.includes(e.fit))return`fit ${JSON.stringify(e.fit)} is not one of ${k.map(n=>`"${n}"`).join(", ")}.`;if(e.position!==void 0&&!(Array.isArray(e.position)&&e.position.length===2&&e.position.every(S)))return`position ${JSON.stringify(e.position)} is not [x, y] as shares of the picture (each from 0 to 1).`;if(e.box!==void 0&&!$(e.box))return`box ${JSON.stringify(e.box)} is not [x, y, w, h] as fractions of the frame, inside it.`;if(e.crop!==void 0&&!$(e.crop))return`crop ${JSON.stringify(e.crop)} is not [x, y, w, h] as fractions of the source, inside it.`;if(e.radius!==void 0&&!(typeof e.radius=="number"&&Number.isFinite(e.radius)&&e.radius>=0||typeof e.radius=="string"&&e.radius.trim()!==""))return`radius ${JSON.stringify(e.radius)} is not a number of pixels from 0 or a CSS border-radius.`;if(e.blend!==void 0)return`blend is blendMode, every layer's, by Photoshop's names ("multiply", "screen", "softLight"…)`;if(e.filter!==void 0&&typeof e.filter!="string")return`filter ${JSON.stringify(e.filter)} is not a CSS filter such as "blur(4px) saturate(0.8)".`}function N(e,t,i){if(typeof e!="string"){const n=i.asset(`/${e.path}`);return n.sha256===e.sha256?n:e}const s=F(t,e);return i.asset(s===void 0?e:`/${s}`)}const r=e=>`${String(Math.round(e*1e3)/1e3)}px`;function _(e,t,i){const s=N(t.src,t.base,i);if(!s)return;const n=i.dims.width,f=i.dims.height,[a,d,u,p]=t.box?[t.box[0]*n,t.box[1]*f,t.box[2]*n,t.box[3]*f]:[0,0,n,f],b=D({source:{width:s.width??1,height:s.height??1},box:{width:u,height:p},fit:t.fit,position:t.position??C.position,crop:t.crop}),o=document.createElement("div");o.dataset.akPicture=s.path,Object.assign(o.style,{position:"absolute",left:r(a),top:r(d),width:r(u),height:r(p),overflow:"hidden"}),t.radius!==void 0&&(o.style.borderRadius=typeof t.radius=="number"?r(t.radius*(t.at1080?Math.min(n,f)/1080:1)):t.radius),t.blendCss!==void 0&&(o.style.mixBlendMode=t.blendCss),t.filter!==void 0&&(o.style.filter=t.filter);const m=[],c=H(t.mask);if(c==="ellipse")o.style.clipPath="ellipse(50% 50%)";else if(c!==void 0){const h=typeof c=="string"&&!W(c)?void 0:N(c,t.base,i);m.push(h?`url("${h.url}")`:c)}else if(t.mask!==void 0){const h=L(o,{mask:t.mask,box:[0,0,u,p],frame:{width:u,height:p},defs:v(e),ctx:i,base:t.base});if(h!==void 0)throw new Error(`picture(): mask: ${h}.`)}const y=document.createElement("div"),[g,w,E,P]=b.shown;Object.assign(y.style,{position:"absolute",left:r(g),top:r(w),width:r(E),height:r(P),overflow:"hidden"});const l=document.createElement("img");l.alt=t.alt??"",l.decoding="sync",l.src=s.url;const[A,j,I,M]=b.whole;Object.assign(l.style,{position:"absolute",left:r(A-g),top:r(j-w),width:r(I),height:r(M),maxWidth:"none",maxHeight:"none"}),m.length>0&&Object.assign(o.style,{maskImage:m.join(", "),maskSize:"100% 100%",maskRepeat:"no-repeat"}),y.append(l),o.append(y),e.append(o)}const U=e=>e!==void 0&&Object.values(e).some(t=>t!==void 0&&t.enabled!==!1);function H(e){if(e===void 0)return;if(typeof e=="string"||O(e))return e;const t=e,i=Object.keys(t).filter(s=>t[s]!==void 0);return i.length===1&&i[0]==="src"?t.src:void 0}export function pictureLayer(e,t,i={}){const s=pictureProblem(e);if(s)throw new Error(`${i.caller??"picture()"}: ${s}`);T(e,"pixel",i.caller??"picture()");const[n,f]=G(e);return{[R]:"graphic",...n,kind:"pixel",component:PICTURE,props:{...f,...n.mask===void 0?{}:{mask:n.mask},...(()=>{const a=n.blendMode,d=a===void 0?void 0:B[a];return d&&"css"in d&&a!=="normal"&&!U(n.effects)?{blendCss:d.css}:{}})(),base:t,...i.at1080?{at1080:!0}:{}},mount:(a,d,u)=>{_(a,d,u)},render:()=>{}}}export const pictureFor=e=>t=>pictureLayer(t,e.base);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MediaInfo, MediaKind,
|
|
1
|
+
import type { MediaInfo, MediaKind, PIECE_BRAND, Preset, WordRef } from "@allyhub/piece";
|
|
2
2
|
declare const TIME: unique symbol;
|
|
3
3
|
/**
|
|
4
4
|
* A prop that is a moment (declared time()): seconds from the part's start
|
|
@@ -70,8 +70,8 @@ export declare const text: <const O extends Opts<TextProp> = object>(o?: O) => T
|
|
|
70
70
|
*/
|
|
71
71
|
export declare const time: <const O extends Opts<TimeProp> = object>(o?: O) => TimeProp & O;
|
|
72
72
|
/**
|
|
73
|
-
* Media: an import or ctx.asset(path). In a deck's slides
|
|
74
|
-
* the deck's folder; with `kind: "video"` it may also be a video item of
|
|
73
|
+
* Media: an import or ctx.asset(path). In a deck's slides file, a path from
|
|
74
|
+
* the deck's module's folder; with `kind: "video"` it may also be a video item of
|
|
75
75
|
* the project (its folder), which a layout shows with footage().
|
|
76
76
|
*/
|
|
77
77
|
export declare const asset: <const O extends Opts<AssetProp> = object>(o?: O) => AssetProp & O;
|
|
@@ -86,7 +86,7 @@ export declare const object: <const F extends Record<string, PropSchema>, const
|
|
|
86
86
|
fields: F;
|
|
87
87
|
} & O;
|
|
88
88
|
/** A video a layout shows: a file's media, or a video item of the project. */
|
|
89
|
-
export type VideoValue = MediaInfo |
|
|
89
|
+
export type VideoValue = MediaInfo | Readonly<Record<typeof PIECE_BRAND, true>>;
|
|
90
90
|
/** The value a layout receives for a prop of this schema. */
|
|
91
91
|
export type PropValue<S> = S extends {
|
|
92
92
|
type: "text";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Fill, type GraphicLayer, type ShapeKind, type ShapeStroke } from "@allyhub/piece";
|
|
2
|
+
import { type LayerOptions } from "./define.js";
|
|
3
|
+
import type { Written } from "./written.js";
|
|
4
|
+
export interface ShapeOptions extends LayerOptions {
|
|
5
|
+
/** Photoshop's shape tools: rectangle, ellipse, triangle, polygon, line, or a path. */
|
|
6
|
+
shape: ShapeKind;
|
|
7
|
+
/** Where it lies, [x, y, w, h] as shares of the frame; default all of it. */
|
|
8
|
+
box?: readonly [number, number, number, number];
|
|
9
|
+
/** shape "path": SVG path data in the board's pixels. */
|
|
10
|
+
path?: string;
|
|
11
|
+
/** A rectangle's corners, px. */
|
|
12
|
+
radius?: number;
|
|
13
|
+
/** A polygon's sides, 3 to 100. */
|
|
14
|
+
sides?: number;
|
|
15
|
+
/** A polygon as a star: its inner points' distance, percent of its outer (100, a polygon). */
|
|
16
|
+
starRatio?: number;
|
|
17
|
+
/** Its fill: a colour, a gradient or a pattern; null for none. Default black. */
|
|
18
|
+
fill?: Fill | null;
|
|
19
|
+
/** Its stroke; null or left out for none (a line has one). */
|
|
20
|
+
stroke?: ShapeStroke | null;
|
|
21
|
+
}
|
|
22
|
+
/** A shape layer's props. */
|
|
23
|
+
export interface ShapeProps extends Omit<ShapeOptions, keyof LayerOptions> {
|
|
24
|
+
readonly base: string;
|
|
25
|
+
}
|
|
26
|
+
/** The component name of a shape layer. */
|
|
27
|
+
export declare const SHAPE = "shape";
|
|
28
|
+
/** What is wrong with a shape's options, or undefined. */
|
|
29
|
+
export declare function shapeProblem(o: ShapeOptions): string | undefined;
|
|
30
|
+
/** A shape layer: shape({ key, shape: "ellipse", box, fill: { gradient }, stroke: { color, width } }). */
|
|
31
|
+
export type ShapeFn = (opts: ShapeOptions) => GraphicLayer<ShapeProps>;
|
|
32
|
+
/** shape() for the module `at` names: its paths (a pattern's, a mask's) are from its folder. */
|
|
33
|
+
export declare const shapeFor: (at: Written) => ShapeFn;
|
|
34
|
+
//# sourceMappingURL=shape.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{FillSchema as u,LAYER_BRAND as d,SHAPE_KINDS as c,ShapeStrokeSchema as b,ShareBoxSchema as S,issueOf as x}from"@allyhub/piece";import{drawShape as k,gradientRefusal as $}from"@allyhub/image-draw/paint";import{z as r}from"zod";import{LayerError as m,splitLayer as g,styleOf as y}from"./define.js";import{paintRefusal as A}from"./fill.js";export const SHAPE="shape";const R=r.object({shape:r.enum(c),box:S.optional(),path:r.string().min(1).optional(),radius:r.number().min(0).max(1e5).optional(),sides:r.number().int().min(3).max(100).optional(),starRatio:r.number().min(1).max(100).optional(),fill:u.nullable().optional(),stroke:b.nullable().optional()});export function shapeProblem(s){const{shape:e,box:o,path:a,radius:t,sides:i,starRatio:p,fill:h,stroke:l}=s,n=R.safeParse({shape:e,box:o,path:a,radius:t,sides:i,starRatio:p,fill:h,stroke:l});if(!n.success)return x(n.error);if(e==="path"&&a===void 0)return`shape "path" takes a path: SVG path data in the board's pixels`;if(e!=="path"&&a!==void 0)return`a path is shape "path"'s, not ${e}'s`}export const shapeFor=s=>e=>{const o=`shape()${e.key===void 0?"":` ${e.key}`}`,a=shapeProblem(e);if(a)throw new m("AK-I003",`${o}: ${a}.`);const t=e.fill,i=t&&"gradient"in t?$(t.gradient,!0):A(t);if(i)throw new m("AK-I007",`${o}: ${i}.`);y(e,"shape","shape()");const[p,h]=g(e);return{[d]:"graphic",...p,kind:"shape",component:SHAPE,props:{...h,base:s.base},mount:(l,n,f)=>{k(l,n,f,n.base)},render:()=>{}}};
|