allyhub 0.10.0 → 0.11.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 +8 -0
- package/dist/commands/dev.js +2 -2
- package/dist/commands/frames/report.js +2 -0
- package/dist/commands/frames.js +11 -9
- package/dist/commands/render.js +2 -2
- package/dist/node_modules/@allyhub/3d-extension/dist/stage-routes.js +1 -1
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/dist/emoji.d.ts +29 -0
- package/dist/node_modules/@allyhub/browser/dist/emoji.js +57 -0
- package/dist/node_modules/@allyhub/browser/dist/picture.d.ts +18 -0
- package/dist/node_modules/@allyhub/browser/dist/picture.js +2 -0
- package/dist/node_modules/@allyhub/browser/package.json +9 -1
- package/dist/node_modules/@allyhub/build/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/kind-build.d.ts +7 -0
- package/dist/node_modules/@allyhub/build/dist/made-notes.d.ts +9 -0
- package/dist/node_modules/@allyhub/build/dist/made-notes.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/project-tool.d.ts +17 -0
- package/dist/node_modules/@allyhub/build/dist/stage-route.d.ts +7 -0
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/exports.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/inputs.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/pages.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/ports.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/respond.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/reveal.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/watcher.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +7 -0
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/html.js +15 -59
- package/dist/node_modules/@allyhub/doc/dist/page.js +1 -1
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +12 -14
- package/dist/node_modules/@allyhub/doc-print/dist/pages.js +5 -5
- package/dist/node_modules/@allyhub/doc-print/dist/print.js +10 -10
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +20 -0
- package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/export.js +4 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +1 -6
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/article-build.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/article-kind.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/build-plugins.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/build.js +5 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/media.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/stage-module.js +82 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/workspace.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +287 -0
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +12 -0
- package/dist/node_modules/@allyhub/linkedin-model/LICENSE +241 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/article-check.js +5 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/article.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/check.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/count.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/edit.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/html.js +19 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/limits.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/little.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/post.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/requests.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/package.json +14 -0
- package/dist/node_modules/@allyhub/linkedin-view/LICENSE +241 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/article.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/fold.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/post.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/text.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/package.json +21 -0
- package/dist/node_modules/@allyhub/linkedin-view/src/style.css +600 -0
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +14 -1
- package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +12 -0
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +4 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +6 -0
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +61 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +0 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +41 -3
- package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +17 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +12 -0
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +1 -5
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/dist/encode.js +1 -1
- package/dist/node_modules/@allyhub/render/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/render/dist/render.js +2 -2
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/report-extension/dist/build.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/check.js +3 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/find.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/index.js +5 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/picture.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/export.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/inline.js +58 -0
- package/dist/node_modules/@allyhub/report-extension/dist/page.js +21 -0
- package/dist/node_modules/@allyhub/report-extension/dist/project-tools.js +21 -0
- package/dist/node_modules/@allyhub/report-extension/dist/styles.js +5 -0
- package/dist/node_modules/@allyhub/report-extension/dist/theme.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/tools.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/workspace.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/package.json +182 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/STYLE.md +132 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.css +105 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.json +17 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/tokens.js +38 -0
- package/dist/node_modules/@allyhub/runtime/dist/compose.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/player/player.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/index.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/viewer.d.ts +6 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/viewer.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/export.js +2 -4
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/export.js +2 -6
- package/dist/node_modules/@allyhub/sheet-extension/package.json +3 -7
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +3 -16
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/install.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +14 -14
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -4
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/dist/preview.js +5 -5
- package/dist/node_modules/@allyhub/website-extension/dist/project-tools.js +2 -2
- package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/dist/build.js +4 -3
- package/dist/node_modules/@allyhub/x-extension/package.json +10 -12
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +12 -10
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-CjAmWsNR.js → abnfDiagram-WEYOIA3C-BKmMA6gn.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-DeeKhyhZ.js → architecture-WOLXFQ4H-BEFBgb4k.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-b32qTaJg.js → architectureDiagram-ZHVYKT53-_u5YfCjY.js} +1 -1
- package/editor-web/assets/{arrow-up-L4YV_65f.js → arrow-up-B5rJbBv0.js} +1 -1
- package/editor-web/assets/article-BUmD3xtR.js +8 -0
- package/editor-web/assets/article-DNioBb3p.js +7 -0
- package/editor-web/assets/{audio-lines-BFcM7G2L.js → audio-lines-CzuzsGjI.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-BNbnMNmw.js → blockDiagram-RJAE7QA3-DybfaO3Z.js} +1 -1
- package/editor-web/assets/bookmark-Dsd3kHJJ.js +1 -0
- package/editor-web/assets/button-eGxLxbv9.js +41 -0
- package/editor-web/assets/{c4Diagram-XDPPPE54-BEuemvMw.js → c4Diagram-XDPPPE54-BfqLHB5i.js} +1 -1
- package/editor-web/assets/channel-TNPgFDrw.js +1 -0
- package/editor-web/assets/chart-C37xvZT2.js +1 -0
- package/editor-web/assets/chart-no-axes-column-BVkeF_Mr.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-Zb5nPx_e.js → chunk-2E7WHVMD-BVp1I_d0.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-DSEM2reX.js → chunk-4EMNKR2T-CTdgWEMr.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BOZa_65H.js → chunk-55XCU76K-7pnsxeaP.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-DeiGeVpB.js → chunk-7S6XSTFO-Dc0Dvkq7.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-fPuQFBJc.js → chunk-AQDTSKZB-VAILIsfx.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-5vdnoak2.js → chunk-DSNLSHJZ-CUDx1Rv5.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-DFF2mZJ1.js → chunk-HAGFOTED-DAoEe-dJ.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-g6-ZLbTg.js → chunk-HNE4Q36P-g0akya12.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-o3hNcHMJ.js → chunk-NQOKRVIF-hTGjzXdJ.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-BQiDI9dK.js → chunk-UHW7PFBP-BgLV8BIJ.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-CJlMXWWz.js → chunk-VQ5W62QI-Bw19OOSD.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-pNBU8dXv.js → chunk-WQQL4CDK-CMST9dyE.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-2x-BiWd-.js → chunk-YZO67HFG-Bbpu36XF.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-etFStEM8.js → chunk-ZAUX2LTX-C48Ri0Gs.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-B3AYRhIY.js → chunk-ZCHMQSOR-DN1g01Oe.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-6y2yX0oq.js → classDiagram-v2-4MYWR3UA-U6jbPr2d.js} +1 -1
- package/editor-web/assets/{collaborator-LRd0hELn.js → collaborator-B1u2td9m.js} +1 -1
- package/editor-web/assets/{createLucideIcon-CPS-TrJJ.js → createLucideIcon-GFZ_fxLc.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-CX4BTQQe.js → cynefin-EF2NZ3EQ-gzkai_7-.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-LbDkOTy3.js → cynefinDiagram-WF24UDRP-DtSekSr6.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-wCKQk7hi.js → dagre-NK4GIZVX-CiUwYVT6.js} +1 -1
- package/editor-web/assets/{diagram-CBK3MWTC-a9fofQwk.js → diagram-CBK3MWTC-r9XHCV-k.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-UCLZWch5.js → diagram-I5XIIV2D-DxVsDZ34.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-CAEe88Lp.js → diagram-ODIL2UCW-B0eNQoHV.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-Cp1o45bs.js → diagram-PFBEJUXE-C7f2MfJT.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-c6OVxDyq.js → diagram-RJA3I4VV-CSXcnvct.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-BVRWslDM.js → diagram-TYUNFSNR-DXzOD_ii.js} +1 -1
- package/editor-web/assets/dist-BGRwhCQO.js +1 -0
- package/editor-web/assets/{dist-DwGhfliS.js → dist-BW4X7BrF.js} +1 -1
- package/editor-web/assets/dist-BgDRE85b.js +2 -0
- package/editor-web/assets/dist-Blq5nJnU.js +24 -0
- package/editor-web/assets/dist-BuWaZ3Y4.js +274 -0
- package/editor-web/assets/dist-C1emZ9wX.js +37 -0
- package/editor-web/assets/dist-CC7OeU1e.js +6 -0
- package/editor-web/assets/{dist-j6ZLVcgf.js → dist-CX-fiPSn.js} +16 -16
- package/editor-web/assets/dist-C_VvG-_9.js +5 -0
- package/editor-web/assets/dist-Ce7HrBxv.js +3 -0
- package/editor-web/assets/dist-D2k6w-_a.js +1 -0
- package/editor-web/assets/dist-DDv_SbKw.js +84 -0
- package/editor-web/assets/dist-DEoEO4zs.js +1 -0
- package/editor-web/assets/dist-DlDxxPIP.js +16 -0
- package/editor-web/assets/dist-Gz6NDS0J.js +4 -0
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-KdOTJgFu.js → ebnfDiagram-V4P3TTPT-Cs4YRvDD.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Cmlrp7qB.js → elk-QONTBCTQ-Bh3LZ9WI.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-CBM7-aQm.js → erDiagram-KYQIGQAA-C4vYTYXp.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-CEoJkbuW.js → eventmodeling-K75KTNOO-BN1kkHWS.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-B04NGsyi.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-D4S6ZSYD.js → ganttDiagram-R7GPNTJY-CA1LkkC5.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-BvkL6RSh.js → gitGraph-VSP46ZUC-Dy5tA7dG.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-lTGguloH.js → gitGraphDiagram-PDYL7XHY-hJIB8EkH.js} +1 -1
- package/editor-web/assets/{hint-BimUgJms.js → hint-B8JpEypy.js} +1 -1
- package/editor-web/assets/index-CgB5osVc.js +28 -0
- package/editor-web/assets/index-Daytem9N.css +2 -0
- package/editor-web/assets/{info-OHQRW6UA-DvKzqNvp.js → info-OHQRW6UA-DvzSf7rQ.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-D7hCpehs.js → infoDiagram-MVDRKAX5-BjIMm4Af.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-Bg93sZQe.js → ishikawaDiagram-HPEHV2GE-Bpz71S40.js} +1 -1
- package/editor-web/assets/{italic-BQBwRTe8.js → italic-D10w8n6C.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-CKm_KONJ.js → journeyDiagram-BOSHW7O7-DAB-pZjD.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-BKknnpTR.js → kanban-definition-FNSA4HC5-cYeyh3P6.js} +1 -1
- package/editor-web/assets/katex-5Z2zF-9g.js +257 -0
- package/editor-web/assets/link-BC5xK1-1.js +1 -0
- package/editor-web/assets/{mermaid-parser.core-BzqkDnqL.js → mermaid-parser.core-req5LE0X.js} +3 -3
- package/editor-web/assets/{mermaid.core-CEpvTOAe.js → mermaid.core-zFwZug4C.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-BJ0qG8Wi.js → mindmap-definition-6OY57UG3-TStWb7DG.js} +1 -1
- package/editor-web/assets/minus-DaWs5i8B.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-ew3kvyFm.js → packet-JDAUHWVQ-smFhVKcB.js} +1 -1
- package/editor-web/assets/palette-BIOudGkm.js +1 -0
- package/editor-web/assets/{pegDiagram-ECIUJNBX-DqUS2xit.js → pegDiagram-ECIUJNBX-DvSNRv0-.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-DTIAMPGm.js → pie-XZMESJXO-qjaGsBZG.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-DoKOE02-.js → pieDiagram-GNMPY74T-Dd9P-Pdc.js} +1 -1
- package/editor-web/assets/play-CrMmPghG.js +1 -0
- package/editor-web/assets/{progress-CPEbDOoN.js → progress-DE4C5_3x.js} +1 -1
- package/editor-web/assets/props-form-CsmDBqzy.js +1 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-DauOpYun.js → quadrantDiagram-D57K4MC3-h2IIKUUA.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-BvMJXUU-.js → radar-ABXABTNO-DlVrSA1d.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-D3jdJmhM.js → railroad-I3PHUGI6-nFbuLAtc.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-Dm8ZpmPj.js → railroad-abnf-LNEFI6M7-Daj8h2iV.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-oc0Du7Ag.js → railroad-ebnf-DWYD2UWJ-eYJyl5PH.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-CMrQL_7U.js → railroad-peg-JR7BVNR7-BTRhKZQq.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-y99z0C7i.js → railroadDiagram-Y72NRBL7-CeLGUjdp.js} +1 -1
- package/editor-web/assets/{react-DztDSW4P.js → react-WA6wlt8S.js} +1 -1
- package/editor-web/assets/{repeat-2-DJi4LW5C.js → repeat-2-VQP1EVOZ.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-jMr_uoF6.js → requirementDiagram-EQYSW5RA-Dmk9XRM5.js} +1 -1
- package/editor-web/assets/{row-ClBisiBs.js → row-BRlEWRrK.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-DcUyx03Q.js → sankeyDiagram-SY24JHO5-Yn4zlrAM.js} +1 -1
- package/editor-web/assets/{schemas-68mjUjP5.js → schemas-VikZYZIK.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-R4X8wRCd.js → sequenceDiagram-BLEHNHQU-BTRnp_PW.js} +1 -1
- package/editor-web/assets/{session-2u9U7koW.js → session-Do9AqS38.js} +1 -1
- package/editor-web/assets/{slides-BByblSSR.js → slides-diTEQ3C5.js} +1 -1
- package/editor-web/assets/{snapshots-C9KV-Y2_.js → snapshots-BUGlKQIB.js} +1 -1
- package/editor-web/assets/{sound-DExlNJbb.js → sound-Bj3o9_Fa.js} +1 -1
- package/editor-web/assets/split-CNU1RHcX.js +3 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-BqvXKbCA.js → stateDiagram-v2-A6IESKWZ-kstrRKv2.js} +1 -1
- package/editor-web/assets/{strikethrough-CyUBnGTl.js → strikethrough-CfXx6IYH.js} +1 -1
- package/editor-web/assets/{svg-lBRT-uhy.js → svg-Cx50MpxK.js} +1 -1
- package/editor-web/assets/{swatch-1c1uVn1z.js → swatch-WeJD41aW.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-hjTXIc6M.js → swimlanes-B3ENRKFQ-DaZsZkeP.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CBZAujYY.js +8 -0
- package/editor-web/assets/{switch-D0K-K8-C.js → switch-N0G_sbqt.js} +1 -1
- package/editor-web/assets/syntax-BVsgRJ4I.js +66 -0
- package/editor-web/assets/syntax-oWsKBWFw.js +1 -0
- package/editor-web/assets/table-B6hVZAMi.js +1 -0
- package/editor-web/assets/{tabs-CxxOnGLR.js → tabs-DIFDqj-l.js} +1 -1
- package/editor-web/assets/{textarea-Fu93tFO3.js → textarea-tEWvBY9p.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-BcSoN4Dq.js → timeline-definition-JXYKGLGB-CLCvY-Yf.js} +1 -1
- package/editor-web/assets/{trash-2-BAKAeziW.js → trash-2-BP6nqpg2.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-CsFN2jrc.js → treeView-D4JQ5SDB-BmN0gwdC.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-DP1eqXJ2.js → treemap-SAJKECNS-DN29G_E_.js} +1 -1
- package/editor-web/assets/{undo-2-DQ5CBmki.js → undo-2-CHR0nvWL.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-BGxa0osF.js → usecaseDiagram-WPOLBNNX-DTRS54cB.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-D2XhTF49.js → vennDiagram-Q3Y3IDCW-DAAc11Hx.js} +1 -1
- package/editor-web/assets/{video-CDbPX4Cr.js → video-BlvmR8BK.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-DM3jMAbZ.js → wardley-7MLQ67FV-B-UYkmdB.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-Bf-DaZEg.js → wardleyDiagram-IVAIDKWA-BmbwCaky.js} +1 -1
- package/editor-web/assets/words-D_4T9Adq.js +3 -0
- package/editor-web/assets/words-WgdEQdYP.js +2 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-dp-mdcWd.js → xychartDiagram-4URNHDU4-ChAfAq1U.js} +1 -1
- package/editor-web/index.html +6 -6
- package/package.json +8 -2
- package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +0 -337
- package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +0 -2
- package/editor-web/assets/alt-DnBZJzEh.js +0 -4
- package/editor-web/assets/article-DLMjAdbP.js +0 -73
- package/editor-web/assets/button-Chk675Xu.js +0 -41
- package/editor-web/assets/channel-EzYq4r0d.js +0 -1
- package/editor-web/assets/chart-Be9Hj5GL.js +0 -1
- package/editor-web/assets/choice-BgmBh4yu.js +0 -1
- package/editor-web/assets/dist--KKyT5zP.js +0 -340
- package/editor-web/assets/dist-1k0MHB3i.js +0 -1
- package/editor-web/assets/dist-B9KHJqL5.js +0 -4
- package/editor-web/assets/dist-BbJyrhIY.js +0 -1
- package/editor-web/assets/dist-CJXCQxQM.js +0 -37
- package/editor-web/assets/dist-D9xQGwe9.js +0 -5
- package/editor-web/assets/dist-DFiLzbx8.js +0 -219
- package/editor-web/assets/dist-DIPV6xfF.js +0 -2
- package/editor-web/assets/dist-Dp-fQMtx.js +0 -6
- package/editor-web/assets/dist-Duw28VxJ.js +0 -16
- package/editor-web/assets/dist-OBE2IIYP.js +0 -24
- package/editor-web/assets/flowDiagram-IUGLLWBU-Xm2E2ib_.js +0 -1
- package/editor-web/assets/index-C-i_iuxN.js +0 -28
- package/editor-web/assets/index-Cxh_Shkm.css +0 -2
- package/editor-web/assets/minus-oPj1GxwA.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-BLfytmPY.js +0 -8
- package/editor-web/assets/syntax-Bih_jv7W.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{cpus as h}from"node:os";import{RenderError as
|
|
2
|
+
import{cpus as h}from"node:os";import{RenderError as g}from"./errors.js";export const VIDEO_TYPES=["mp4","mov","webm","gif","png"],GIF_ENCODE={width:640,fps:15},SHARE_ENCODE={crf:20,maxKbps:8e3,width:1920,height:1080,fps:30};export function shareKbps(e,r,t){const n=e*r*t/(SHARE_ENCODE.width*SHARE_ENCODE.height*SHARE_ENCODE.fps);return Math.max(1,Math.round(SHARE_ENCODE.maxKbps*n))}export function encodeFor(e,r,t){return e!=="mp4"?r:{...(r.codec??"h264")==="h264"?{crf:SHARE_ENCODE.crf}:{},maxBitrate:shareKbps(t.width,t.height,t.fps),...r}}export function encoderOf(e,r,t,n,c=!1,s){const f=r.bits??8,p=r.chroma??"420";if(r.crf!==void 0&&(!Number.isInteger(r.crf)||r.crf<0||r.crf>63))throw new g("bad-crf",`--crf ${String(r.crf)} is not a whole number from 0 to 63.`);const u=(o,i,m=!1)=>`yuv${m?"a":""}${o}p${i===10?"10le":""}`,a=["-colorspace","bt709","-color_primaries","bt709","-color_trc","bt709","-color_range","tv"];switch(e){case"mp4":{if(r.crf!==void 0&&r.crf>51)throw new g("bad-crf",`--crf ${String(r.crf)} is over 51, the most H.264 and H.265 take.`);const o=u(p,f),i=c&&r.maxBitrate!==void 0&&r.maxBitrate>0,m=String(r.maxBitrate??0),b=String((r.maxBitrate??0)*2),x=i&&s!==void 0?`:vbv-init=${String(Math.round(Math.max(.001,Math.min(1,s))*1e4)/1e4)}`:"";return(r.codec??"h264")==="h265"?{rgb:!1,pixFmt:o,args:["-c:v","libx265","-preset","medium","-crf",String(r.crf??20),"-x265-params",`colorprim=bt709:transfer=bt709:colormatrix=bt709:log-level=error${i?`:vbv-maxrate=${m}:vbv-bufsize=${b}:frame-threads=1:wpp=0${x}`:""}${n===void 0?"":`:keyint=${String(n)}:min-keyint=${String(n)}:scenecut=0:open-gop=0`}`,"-tag:v","hvc1",...a,"-pix_fmt",o]}:{rgb:!1,pixFmt:o,args:["-c:v","libx264","-preset",i?"faster":"medium","-crf",String(r.crf??18),...i?["-maxrate",`${m}k`,"-bufsize",`${b}k`]:[],"-bf","0","-x264-params",`colorprim=bt709:transfer=bt709:colormatrix=bt709${i?`:threads=1${x}`:""}`,...a,"-pix_fmt",o]}}case"mov":{const o=t?"yuva444p10le":"yuv422p10le";return{rgb:!1,pixFmt:o,args:["-c:v","prores_ks","-profile:v",t?"4444":"hq",...t?["-alpha_bits","16"]:[],"-vendor","apl0",...a,"-pix_fmt",o]}}case"webm":{const o=t?"yuva420p":u(p,f);return{rgb:!1,pixFmt:o,args:["-c:v","libvpx-vp9","-crf",String(r.crf??30),"-b:v","0","-row-mt","1","-deadline","good","-cpu-used","2",...t?["-auto-alt-ref","0"]:[],...a,"-pix_fmt",o]}}case"gif":return{rgb:!0,pixFmt:"rgb24",args:[]};case"png":return{rgb:!0,pixFmt:t?"rgba":"rgb24",args:["-c:v","png","-pix_fmt",t?"rgba":"rgb24"]}}}export function gopArgs(e,r,t){const n=String(t);return e==="mp4"&&(r??"h264")==="h264"?["-g",n,"-keyint_min",n,"-sc_threshold","0"]:e==="webm"?["-g",n,"-keyint_min",n]:[]}export const HELD_OUT="vheld";export function twoOutputs(e,r){if(!r)return e;const t=e.indexOf("-filter_complex"),n=e.findIndex((s,f)=>s==="[v]"&&e[f-1]==="-map");if(t<0||n<0)throw new Error("A composite's graph was not one mapped as [v].");const c=[...e];return c[t+1]=`${String(e[t+1])};[v]split=2[vone][${HELD_OUT}]`,c[n]="[vone]",c}export const MAX_WORKERS=32;export function autoWorkers(e){const r=Number(process.env.ALLYHUB_RENDER_WORKERS);return Number.isInteger(r)&&r>0?Math.min(r,MAX_WORKERS):Math.max(1,Math.min(4,h().length-2,Math.floor(e/60)))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{renderStills}from"./version.js";export{RenderError}from"./errors.js";export{ffmpegOf,ffprobeOf,runFfmpegWith,toolsOf,write}from"./tools.js";export{ENCODERS,FFMPEG_MINIMUM,FFMPEG_PINNED,compareReleases,ffmpegEncoders,ffmpegHint,ffmpegRelease,ffmpegVersion,findFfmpeg,judgeFfmpeg,requireEncoder,requireFfmpeg,requireTools,versionIn}from"./ffmpeg.js";export{renderVideo}from"./render.js";export{MAX_WORKERS,SHARE_ENCODE,VIDEO_TYPES,autoWorkers,encodeFor,shareKbps}from"./encode.js";export{segmentsOf}from"./segments.js";export{masterOf,mixSound,soundOf}from"./sound.js";export{backgroundStill,finalStill,footageStill,videoFrame}from"./stills.js";export{hasFinalLook,lutFile}from"./look.js";export{compositeArgs,compositeStill,finishGraph,frameAt,partAt,planSources,stillOutput,transparentPng}from"./composite.js";export{ffmpegColor,footagePlane,insetEllipse,keyedGeometry,layersIn,linearExpr,probeSource,roundedBox}from"./footage.js";export{junctionArgs,junctionGroups,junctionStill}from"./junction.js";export{CAPTURE_DEFAULTS,GRAIN_MOST,blurredNoise,captureGraph,captureProblem,capturesAnything,exposureStops,grainAt,grainWeight}from"./capture.js";export{postFilterProblem,postGraph,postReadsTime}from"./post.js";export{ffmpegRuns,postPlaces,postProblems,tryPost}from"./post-probe.js";export{CAP_START,breaksCap,capOf,capRun,overCap,packetSizes}from"./cap.js";export{PartCache,closedPart,drawnKey,junctionDigest,partDigest}from"./parts.js";export{MAX_PARTS,PagePool,Slots,drawInOrder,encoderSlots,partsAtOnce,renderSerial}from"./pool.js";export{renderCaptions,renderCover,renderPdf,renderPng,renderPptx}from"./exports.js";export{blankImage,cropImage,grainSize,pasteImage,readPng,resizeImage,writePng}from"@allyhub/measure";export{CLIP_TYPES,clipTypeOf,writeClip}from"./clip.js";export{DELIVERY_LEAD,parseEncode,throughEncode}from"./delivery.js";
|
|
2
|
+
export{renderStills}from"./version.js";export{RenderError}from"./errors.js";export{ffmpegOf,ffprobeOf,runFfmpegWith,toolsOf,write}from"./tools.js";export{ENCODERS,FFMPEG_MINIMUM,FFMPEG_PINNED,compareReleases,ffmpegEncoders,ffmpegHint,ffmpegRelease,ffmpegVersion,findFfmpeg,judgeFfmpeg,requireEncoder,requireFfmpeg,requireTools,versionIn}from"./ffmpeg.js";export{renderVideo}from"./render.js";export{GIF_ENCODE,MAX_WORKERS,SHARE_ENCODE,VIDEO_TYPES,autoWorkers,encodeFor,shareKbps}from"./encode.js";export{segmentsOf}from"./segments.js";export{masterOf,mixSound,soundOf}from"./sound.js";export{backgroundStill,finalStill,footageStill,videoFrame}from"./stills.js";export{hasFinalLook,lutFile}from"./look.js";export{compositeArgs,compositeStill,finishGraph,frameAt,partAt,planSources,stillOutput,transparentPng}from"./composite.js";export{ffmpegColor,footagePlane,insetEllipse,keyedGeometry,layersIn,linearExpr,probeSource,roundedBox}from"./footage.js";export{junctionArgs,junctionGroups,junctionStill}from"./junction.js";export{CAPTURE_DEFAULTS,GRAIN_MOST,blurredNoise,captureGraph,captureProblem,capturesAnything,exposureStops,grainAt,grainWeight}from"./capture.js";export{postFilterProblem,postGraph,postReadsTime}from"./post.js";export{ffmpegRuns,postPlaces,postProblems,tryPost}from"./post-probe.js";export{CAP_START,breaksCap,capOf,capRun,overCap,packetSizes}from"./cap.js";export{PartCache,closedPart,drawnKey,junctionDigest,partDigest}from"./parts.js";export{MAX_PARTS,PagePool,Slots,drawInOrder,encoderSlots,partsAtOnce,renderSerial}from"./pool.js";export{renderCaptions,renderCover,renderPdf,renderPng,renderPptx}from"./exports.js";export{blankImage,cropImage,grainSize,pasteImage,readPng,resizeImage,writePng}from"@allyhub/measure";export{CLIP_TYPES,clipTypeOf,writeClip}from"./clip.js";export{DELIVERY_LEAD,parseEncode,throughEncode}from"./delivery.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{copyFile as Ye,mkdir as yt,mkdtemp as kt,readdir as bt,readFile as vt,rename as Pt,rm as re,stat as xt,writeFile as Mt}from"node:fs/promises";import{createHash as $t}from"node:crypto";import{tmpdir as jt}from"node:os";import{join as S}from"node:path";import{EXIT as St}from"@allyhub/protocol";import{ALPHA_TYPES as At,comboKey as _t,fpsRational as Ft}from"@allyhub/piece";import{heldTime as Ot,planeAt as Tt}from"@allyhub/video-core";import{CAP_START as Bt,capOf as Et,capRun as Ne,overCap as Ct,packetSizes as qe}from"./cap.js";import{capturesAnything as Dt}from"./capture.js";import{compositeArgs as Rt,planSources as It,transparentPng as Ht}from"./composite.js";import{MAX_WORKERS as Kt,autoWorkers as zt,encodeFor as Wt,encoderOf as Ge,gopArgs as Lt,HELD_OUT as Vt,twoOutputs as Jt}from"./encode.js";import{RenderError as Ut}from"./errors.js";import{ffmpegVersion as Xt}from"./ffmpeg.js";import{junctionArgs as Yt}from"./junction.js";import{lutFile as Nt,pagePlane as qt}from"./look.js";import{PartCache as Gt,closedPart as Qt,drawnKey as Zt,junctionDigest as en,partDigest as tn,place as nn}from"./parts.js";import{PipeFormat as Qe}from"@allyhub/image-render/png";import{PagePool as rn,drawInOrder as on,encoderSlots as an,renderSerial as sn}from"./pool.js";import{postReadsTime as Ze}from"./post.js";import{segmentsOf as cn}from"./segments.js";import{mixSound as fn}from"./sound.js";import{runFfmpegWith as et,toolsOf as un,write as dn}from"./tools.js";const A=a=>Math.round(performance.now()-a)/1e3,de=async(a,y,w,T)=>{await et(a,y,w,!1,T)};function ln(a){const y=new Set;return a.filter(w=>{const T=[w.code,w.message,w.piece,w.output,w.combo?_t(w.combo):"",w.format,w.part,w.where?.file,w.where?.line].join("|");return y.has(T)?!1:(y.add(T),!0)})}const tt=a=>$t("sha256").update(a).digest("hex");export async function renderVideo(a){const{ffmpeg:y,ffprobe:w}=await un(a),T={ffmpeg:y,ffprobe:w},{target:nt,media:X}=a,[B]=a.pages;if(!B)throw new Error("renderVideo draws with at least one page.");const d=a.type??"mp4",I=Wt(d,a.encode??{},B.timeline),M=a.look,Y=M.transparent===!0&&At.includes(d),Se=Ge(d,I,Y),oe=await Nt(X.root,M.post?.lut),H=await kt(S(jt(),"allyhub-render-")),L=[...a.pages],Ae=[],rt=()=>Promise.all(Ae.splice(0).map(q=>q.close?.()??Promise.resolve())),le=[];let N;const V=[],me=performance.now(),h={pages:0,workers:1,concurrency:1,plan:0,parts:0,mix:0,mux:0,total:0,part:[]};try{const q=performance.now(),b=B.timeline,l=b.fps,pe=Ft(l),_e=Math.round(b.duration*l),we=M.motionBlur,_=we?we.samples:1,he=we?.shutter??.5,Fe=await It(X,b,w),P=d==="gif"||d==="png"?"png":d,ge=d==="webm"?["-fflags","+bitexact"]:[],ot=P!=="png"&&!(d==="mp4"&&I.codec==="h265"),E=cn(b,ot),ae=[];Se.rgb?ae.push(`format=${Se.pixFmt}`):ae.push("scale=out_color_matrix=bt709:out_range=tv:flags=neighbor");const G=(e,t=!1,n)=>["-r",pe.text,...Ge(d,I,Y,e,t,n).args,...Lt(d,I.codec,e),...d==="mp4"||d==="mov"?["-video_track_timescale","90000"]:[],...ge],C=d==="mp4"&&I.maxBitrate!==void 0&&I.maxBitrate>0?Et(I.maxBitrate):void 0,at=e=>[...G(e),...C?["over the cap",...G(e,!0)]:[],...ae],Q=a.code,K=P!=="png"&&Q!==void 0&&a.partCache!==!1&&process.env.ALLYHUB_PART_CACHE!=="off"?a.partCache??Gt.of(X.root):void 0,Z=[],Oe=new Map;if(K&&Q){const e=await Xt(y),t=oe?tt(await vt(oe)):null,n=B.reads,o={alpha:Y,samples:_,shutter:he,capture:Dt(M.capture)?M.capture??null:null,post:M.post?.filter??null,lut:t},i=r=>{const u=r.post?.filter,g=o.capture!==null||o.post!==null&&Ze(o.post)||u!==void 0&&Ze(u);return{...o,...u===void 0?{}:{partPost:u},...g?{at:Math.round(r.start*l)}:{}}},s=Math.round(b.duration*l),k=b.parts.at(-1)?.key,m=new Map,O=r=>{const u=B.signs[r.key];if(u===void 0||Qt(Q,u))return Promise.resolve(void 0);let g=m.get(r.key);if(!g){const j=Math.round(r.start*l),c=r.key===k?s:Math.min(s,Math.round(r.end*l)),f=[];for(let z=j;z<c;z++)for(let R=0;R<_;R++)f.push(z/l+(R>0?R*he/(l*_):0));const Me=performance.now();g=B.partSign(r.key,f).then(z=>(h.signs=Math.round(((h.signs??0)+A(Me))*1e3)/1e3,z)),m.set(r.key,g)}return g},x=async(r,u,g,j)=>{const c=B.signs[r.key];if(c===void 0)return;const f=await O(r);return f&&Oe.set(r.key,Zt(Q,f)?"frames":`bundle: ${f.unknown??`a canvas drawn by ${f.owners.join(", ")}, in the piece's own file`}`),tn({root:X.root,code:Q,combo:nt.combo,timeline:b,part:r,sign:c,...f?{drawn:f}:{},media:X.media,reads:n,frames:u,encode:g,look:i(r),ffmpeg:e,...j?{trim:j}:{},...B.gpu===!0?{gpu:!0}:{}})},p=new Map,v=r=>{let u=p.get(r.key);return u||(u=x(r,Math.round(r.end*l)-Math.round(r.start*l),[]),p.set(r.key,u)),u};for(const r of E){const u=at(r.frames);if(!r.junction){Z.push(await x(r.part,r.frames,u,r.trim));continue}const[g,j]=[await v(r.junction.from),await v(r.part)];Z.push(g===void 0||j===void 0?void 0:await en({out:g,in:j,transition:r.junction.transition,fps:l,frames:r.frames,encode:u,ffmpeg:e}))}}const Te=await Promise.all(E.map((e,t)=>{const n=Z[t];return K&&n?K.get(n,P):Promise.resolve(void 0)})),Be=e=>e>0?e*he/(l*_):0,st=(e,t,n)=>e.junction?Ot(t,n/l,l):n/l,Ee=(e,t,n,o)=>Tt(t.part,t.plane,st(e,t.part,n)+Be(o)),ye=E.map(e=>{const t=(e.junction?[e.junction.from,e.part]:[e.part]).map(i=>{const s=[];let k=0;return i.planes.forEach((m,O)=>{const x={part:i,plane:O,images:m.overlay===!0?1:_};let p=0;for(let v=e.first;v<e.first+e.frames;v++)for(let r=0;r<x.images;r++)Ee(e,x,v,r)&&p++;p!==0&&(s.push(x),k+=p)}),{part:i,planes:s.map(m=>m.plane),overlays:s.flatMap(m=>i.planes[m.plane]?.overlay===!0?[m.plane]:[]),groups:s,drawn:k,graphics:k>0}}),n=t.flatMap(i=>i.groups),o=n.length===0?_:n.reduce((i,s)=>i+s.images,0);return{pictures:t,groups:n,per:o,graphics:t.some(i=>i.graphics),drawn:t.reduce((i,s)=>i+s.drawn,0),images:e.frames*o}}),Ce=(e,t,n)=>{let o=n%e.per,i={part:t.part,plane:0,images:_};for(const s of e.groups){if(o<s.images){i=s;break}o-=s.images}return{f:t.first+Math.floor(n/e.per),k:o,group:i}},it=(e,t,n)=>{const o=Ce(e,t,n);return Ee(t,o.group,o.f,o.k)};let ke=0;ye.forEach((e,t)=>{Te[t]===void 0&&(ke+=e.drawn)}),h.plan=A(q);const De=a.openPage===void 0?L.length:Math.max(L.length,ke===0?1:Math.min(a.workers??zt(ke),Kt));h.workers=De;const se=new rn;for(const e of L)se.add(e);const ct=async e=>{const t=[];for(const n of L)for(const o of await n.problems())o.level!=="error"||o.code==="AK-P002"||o.part!==void 0&&!e.has(o.part)||t.push(o);return ln(t)},ft=performance.now(),Re=a.openPage;for(let e=L.length;Re&&e<De;e++){const t=Re().then(n=>{Ae.push(n),L.push(n),se.add(n),h.pages=A(ft)});t.catch(()=>{}),le.push(t)}const ut=sn(),be=a.sound,D=d==="gif"||be===void 0?void 0:S(H,"audio.wav"),Ie=async()=>{if(D===void 0||be===void 0)return;const e=performance.now(),t=await fn({timeline:b,sound:be,out:D,ffmpeg:y});return h.mix=A(e),t};ut||(N=Ie(),N.catch(()=>{}));const dt=Ht(b.width,b.height),He=ye.reduce((e,t)=>e+t.images,0);let J=0,Ke=-1;const ve=()=>{const e=Math.floor(90*J/He);e<=Ke||(Ke=e,a.onProgress?.(.9*J/He))},ee=S(H,"frames");P==="png"&&await yt(ee,{recursive:!0});const ie=E.map((e,t)=>S(H,`segment.${String(t).padStart(4,"0")}.${P}`));let ze=0,We=0;const Pe=new AbortController,F=a.signal?AbortSignal.any([Pe.signal,a.signal]):Pe.signal,Le=an();h.concurrency=Math.max(1,Math.min(Le.limit,Te.filter(e=>e===void 0).length));const lt=performance.now(),Ve=(e,t,n)=>de(y,["-v","error","-y","-i",e,"-map","0:v","-c","copy","-frames:v",String(n),...ge,t]),mt=async(e,t)=>{const n=ye[e];if(!n)return;const o=n.graphics,i=n.images,s={key:t.junction?`${t.junction.from.key}>${t.part.key}`:t.part.key,...t.junction?{junction:!0}:{},frames:t.frames,cached:!1,images:o?i:0,captured:0,reused:0,clear:0,capture:0,ffmpeg:0,waitFrames:0,waitPipe:0,start:0,end:0},k=t.junction?void 0:Oe.get(t.part.key);k!==void 0&&(s.keyed=k),h.part[e]=s;const m={captured:0,reused:0},O=new Map,x=c=>{let f=O.get(c);return f||(f=new Map,O.set(c,f)),f},p=P==="png"?S(ee,"frame.%05d.png"):ie[e]??"",v={...M.capture?{capture:M.capture}:{},...M.post?.filter?{post:M.post.filter}:{},...oe?{lut:oe}:{},tail:ae},r=c=>({planes:n.pictures[c]?.planes??[],overlays:n.pictures[c]?.overlays??[]}),u=c=>Le.run(async()=>{F.throwIfAborted(),s.start=A(me);const f=C?`${c}.held.${P}`:void 0,Me=()=>["-v","error","-y",...Jt(t.junction?Yt({timeline:b,transition:t.junction.transition,first:t.first,frames:t.frames,sources:Fe,alpha:Y,out:r(0),in:r(1),samples:_,...v}):Rt({timeline:b,first:t.first,frames:t.frames,sources:Fe,alpha:Y,planes:n.pictures[0]?.planes??[],overlays:n.pictures[0]?.overlays??[],samples:_,part:t.part,...v}),f!==void 0),...G(t.frames),...P==="png"?["-start_number",String(t.first+1)]:[],c,...f===void 0?[]:["-map",`[${Vt}]`,"-frames:v",String(t.frames),...G(t.frames,!0),f]],z=performance.now();let R=n.drawn<i||n.groups.length>1;for(;;){const $e=new Qe(R);let te=0,W=0;try{await et(y,Me(),o?async ce=>{await on({count:i,ahead:Math.max(8,se.size*4),draw:ne=>{if(!it(n,t,ne))return s.clear++,W++,Promise.resolve(dt);const{f:je,k:fe,group:ue}=Ce(n,t,ne);return se.use([e,ne],async wt=>{F.throwIfAborted();const ht=performance.now(),gt=await wt.frame(je/l,{format:"png",alpha:!0,...qt(ue.part,ue.plane),...t.junction?{part:ue.part.key}:{},reuse:x(ue.part.key),stats:m,...fe>0?{offset:Be(fe)}:{}});return s.capture+=(performance.now()-ht)/1e3,gt})},emit:async ne=>{const je=$e.next(ne),fe=performance.now();await dn(ce,je),s.waitPipe+=(performance.now()-fe)/1e3,J++,te++,ve()},waits:s,signal:F})}:void 0,!1,F);break}catch(ce){if(!(ce instanceof Qe.Mixed)||R)throw f!==void 0&&await re(f,{force:!0}),ce;R=!0}J-=te,s.clear-=W}if(C&&f!==void 0&&(await Ct(c,C,l,T)?(await Pt(f,c),s.held=!0):await re(f,{force:!0})),s.ffmpeg=A(z),o||(J+=i,ve()),o){const $e=new Set(t.junction?[t.junction.from.key,t.part.key]:[t.part.key]),te=await ct($e);if(te.length>0)throw new Ut("draw-failed",`Drawing ${s.key} failed, so it is not rendered: ${te.map(W=>`${W.code} ${W.message}${W.t===void 0?"":` (at ${W.t.toFixed(2)} s)`}`).join("; ")}`,{exit:St.failed,hint:"allyhub frames --at and allyhub inspect layout --at draw that moment; fix what failed and render again."})}}),g=t.keep<t.frames,j=Z[e];if(K&&j){const c=await K.segment(j,P,u);g?await Ve(c.file,p,t.keep):await nn(c.file,p),c.cached&&(t.junction?We++:ze++,s.cached=!0,J+=i,ve())}else if(g){const c=S(H,`whole.${String(e).padStart(4,"0")}.${P}`);await u(c),await Ve(c,p,t.keep),await re(c,{force:!0})}else await u(p);s.captured=m.captured,s.reused=m.reused,s.end=A(me)},Je=(await Promise.allSettled(E.map((e,t)=>mt(t,e).catch(n=>{throw Pe.abort(n),n})))).find(e=>e.status==="rejected");if(Je)throw Je.reason;await Promise.all(le),h.parts=A(lt);const $=await(N??Ie()),xe=$?.loudness;a.onProgress?.(.95),F.throwIfAborted();const pt=performance.now();let U;if(d==="png"){const e=a.out.replace(/\.png$/,"");U=[];const t=(await bt(ee)).filter(n=>/^frame\.\d+\.png$/.test(n)).sort();for(const n of t){F.throwIfAborted();const o=`${e}.${n.slice(6)}`;V.push(o),await Ye(S(ee,n),o),U.push(o)}D&&xe&&(V.push(`${e}.wav`),await Ye(D,`${e}.wav`),U.push(`${e}.wav`))}else if(d==="gif")V.push(a.out),await de(y,["-v","error","-y","-framerate",pe.text,"-start_number","1","-i",S(ee,"frame.%05d.png"),"-filter_complex","split[a][b];[a]palettegen=stats_mode=diff[p];[b][p]paletteuse=dither=sierra2_4a","-r",pe.text,"-loop","0",a.out],void 0,F);else{if(C){const n=C.bufferKbps*1e3;let o=Bt*n;for(const[i,s]of ie.entries()){const k=await qe(s,T);if(!k)continue;const m=Ne(k,C,l,o);if(!m.breaks){o=m.end;continue}const O=G(k.length,!0,o/n),x=r=>de(y,["-v","error","-y","-i",s,"-an",...O,r],void 0,F);let p=S(H,`held.${String(i)}.mp4`);const v=Z[i];K&&v?p=(await K.segment(tt(Buffer.from(JSON.stringify(["held across the join",v,O]))),P,x)).file:await x(p),ie[i]=p,h.capped=(h.capped??0)+1,o=Ne(await qe(p,T)??k,C,l,o).end}}const e=S(H,"segments.txt");await Mt(e,ie.map(n=>`file '${n.replace(/'/g,"'\\''")}'
|
|
3
|
-
`).join(""));const t=
|
|
2
|
+
import{copyFile as Xe,mkdir as kt,mkdtemp as bt,readdir as vt,readFile as Pt,rename as xt,rm as re,stat as Mt,writeFile as $t}from"node:fs/promises";import{createHash as St}from"node:crypto";import{tmpdir as jt}from"node:os";import{join as j}from"node:path";import{EXIT as At}from"@allyhub/protocol";import{ALPHA_TYPES as _t,comboKey as Ft,fpsRational as Ot}from"@allyhub/piece";import{heldTime as Et,planeAt as Tt}from"@allyhub/video-core";import{CAP_START as Bt,capOf as Ct,capRun as Ye,overCap as Dt,packetSizes as Ge}from"./cap.js";import{capturesAnything as Rt}from"./capture.js";import{compositeArgs as It,planSources as Wt,transparentPng as zt}from"./composite.js";import{MAX_WORKERS as Ht,autoWorkers as Kt,encodeFor as Lt,encoderOf as qe,GIF_ENCODE as Qe,gopArgs as Vt,HELD_OUT as Jt,twoOutputs as Nt}from"./encode.js";import{RenderError as Ut}from"./errors.js";import{ffmpegVersion as Xt}from"./ffmpeg.js";import{junctionArgs as Yt}from"./junction.js";import{lutFile as Gt,pagePlane as qt}from"./look.js";import{PartCache as Qt,closedPart as Zt,drawnKey as en,junctionDigest as tn,partDigest as nn,place as rn}from"./parts.js";import{PipeFormat as Ze}from"@allyhub/image-render/png";import{PagePool as on,drawInOrder as an,encoderSlots as sn,renderSerial as cn}from"./pool.js";import{postReadsTime as et}from"./post.js";import{segmentsOf as fn}from"./segments.js";import{mixSound as dn}from"./sound.js";import{runFfmpegWith as tt,toolsOf as un,write as ln}from"./tools.js";const A=a=>Math.round(performance.now()-a)/1e3,ue=async(a,k,w,E)=>{await tt(a,k,w,!1,E)};function mn(a){const k=new Set;return a.filter(w=>{const E=[w.code,w.message,w.piece,w.output,w.combo?Ft(w.combo):"",w.format,w.part,w.where?.file,w.where?.line].join("|");return k.has(E)?!1:(k.add(E),!0)})}const nt=a=>St("sha256").update(a).digest("hex");export async function renderVideo(a){const{ffmpeg:k,ffprobe:w}=await un(a),E={ffmpeg:k,ffprobe:w},{target:rt,media:U}=a,[T]=a.pages;if(!T)throw new Error("renderVideo draws with at least one page.");const l=a.type??"mp4",I=Lt(l,a.encode??{},T.timeline),M=a.look,X=M.transparent===!0&&_t.includes(l),je=qe(l,I,X),oe=await Gt(U.root,M.post?.lut),W=await bt(j(jt(),"allyhub-render-")),L=[...a.pages],Ae=[],ot=()=>Promise.all(Ae.splice(0).map(G=>G.close?.()??Promise.resolve())),le=[];let Y;const V=[],me=performance.now(),h={pages:0,workers:1,concurrency:1,plan:0,parts:0,mix:0,mux:0,total:0,part:[]};try{const G=performance.now(),g=T.timeline,c=g.fps,pe=Ot(c),_e=Math.round(g.duration*c),we=M.motionBlur,_=we?we.samples:1,he=we?.shutter??.5,Fe=await Wt(U,g,w),P=l==="gif"||l==="png"?"png":l,ge=l==="webm"?["-fflags","+bitexact"]:[],at=P!=="png"&&!(l==="mp4"&&I.codec==="h265"),B=fn(g,at),ae=[];je.rgb?ae.push(`format=${je.pixFmt}`):ae.push("scale=out_color_matrix=bt709:out_range=tv:flags=neighbor");const q=(e,t=!1,n)=>["-r",pe.text,...qe(l,I,X,e,t,n).args,...Vt(l,I.codec,e),...l==="mp4"||l==="mov"?["-video_track_timescale","90000"]:[],...ge],C=l==="mp4"&&I.maxBitrate!==void 0&&I.maxBitrate>0?Ct(I.maxBitrate):void 0,st=e=>[...q(e),...C?["over the cap",...q(e,!0)]:[],...ae],Q=a.code,z=P!=="png"&&Q!==void 0&&a.partCache!==!1&&process.env.ALLYHUB_PART_CACHE!=="off"?a.partCache??Qt.of(U.root):void 0,Z=[],Oe=new Map;if(z&&Q){const e=await Xt(k),t=oe?nt(await Pt(oe)):null,n=T.reads,o={alpha:X,samples:_,shutter:he,capture:Rt(M.capture)?M.capture??null:null,post:M.post?.filter??null,lut:t},i=r=>{const u=r.post?.filter,y=o.capture!==null||o.post!==null&&et(o.post)||u!==void 0&&et(u);return{...o,...u===void 0?{}:{partPost:u},...y?{at:Math.round(r.start*c)}:{}}},s=Math.round(g.duration*c),b=g.parts.at(-1)?.key,m=new Map,O=r=>{const u=T.signs[r.key];if(u===void 0||Zt(Q,u))return Promise.resolve(void 0);let y=m.get(r.key);if(!y){const S=Math.round(r.start*c),f=r.key===b?s:Math.min(s,Math.round(r.end*c)),d=[];for(let H=S;H<f;H++)for(let R=0;R<_;R++)d.push(H/c+(R>0?R*he/(c*_):0));const Me=performance.now();y=T.partSign(r.key,d).then(H=>(h.signs=Math.round(((h.signs??0)+A(Me))*1e3)/1e3,H)),m.set(r.key,y)}return y},x=async(r,u,y,S)=>{const f=T.signs[r.key];if(f===void 0)return;const d=await O(r);return d&&Oe.set(r.key,en(Q,d)?"frames":`bundle: ${d.unknown??`a canvas drawn by ${d.owners.join(", ")}, in the piece's own file`}`),nn({root:U.root,code:Q,combo:rt.combo,timeline:g,part:r,sign:f,...d?{drawn:d}:{},media:U.media,reads:n,frames:u,encode:y,look:i(r),ffmpeg:e,...S?{trim:S}:{},...T.gpu===!0?{gpu:!0}:{}})},p=new Map,v=r=>{let u=p.get(r.key);return u||(u=x(r,Math.round(r.end*c)-Math.round(r.start*c),[]),p.set(r.key,u)),u};for(const r of B){const u=st(r.frames);if(!r.junction){Z.push(await x(r.part,r.frames,u,r.trim));continue}const[y,S]=[await v(r.junction.from),await v(r.part)];Z.push(y===void 0||S===void 0?void 0:await tn({out:y,in:S,transition:r.junction.transition,fps:c,frames:r.frames,encode:u,ffmpeg:e}))}}const Ee=await Promise.all(B.map((e,t)=>{const n=Z[t];return z&&n?z.get(n,P):Promise.resolve(void 0)})),Te=e=>e>0?e*he/(c*_):0,it=(e,t,n)=>e.junction?Et(t,n/c,c):n/c,Be=(e,t,n,o)=>Tt(t.part,t.plane,it(e,t.part,n)+Te(o)),ye=B.map(e=>{const t=(e.junction?[e.junction.from,e.part]:[e.part]).map(i=>{const s=[];let b=0;return i.planes.forEach((m,O)=>{const x={part:i,plane:O,images:m.overlay===!0?1:_};let p=0;for(let v=e.first;v<e.first+e.frames;v++)for(let r=0;r<x.images;r++)Be(e,x,v,r)&&p++;p!==0&&(s.push(x),b+=p)}),{part:i,planes:s.map(m=>m.plane),overlays:s.flatMap(m=>i.planes[m.plane]?.overlay===!0?[m.plane]:[]),groups:s,drawn:b,graphics:b>0}}),n=t.flatMap(i=>i.groups),o=n.length===0?_:n.reduce((i,s)=>i+s.images,0);return{pictures:t,groups:n,per:o,graphics:t.some(i=>i.graphics),drawn:t.reduce((i,s)=>i+s.drawn,0),images:e.frames*o}}),Ce=(e,t,n)=>{let o=n%e.per,i={part:t.part,plane:0,images:_};for(const s of e.groups){if(o<s.images){i=s;break}o-=s.images}return{f:t.first+Math.floor(n/e.per),k:o,group:i}},ct=(e,t,n)=>{const o=Ce(e,t,n);return Be(t,o.group,o.f,o.k)};let ke=0;ye.forEach((e,t)=>{Ee[t]===void 0&&(ke+=e.drawn)}),h.plan=A(G);const De=a.openPage===void 0?L.length:Math.max(L.length,ke===0?1:Math.min(a.workers??Kt(ke),Ht));h.workers=De;const se=new on;for(const e of L)se.add(e);const ft=async e=>{const t=[];for(const n of L)for(const o of await n.problems())o.level!=="error"||o.code==="AK-P002"||o.part!==void 0&&!e.has(o.part)||t.push(o);return mn(t)},dt=performance.now(),Re=a.openPage;for(let e=L.length;Re&&e<De;e++){const t=Re().then(n=>{Ae.push(n),L.push(n),se.add(n),h.pages=A(dt)});t.catch(()=>{}),le.push(t)}const ut=cn(),be=a.sound,D=l==="gif"||be===void 0?void 0:j(W,"audio.wav"),Ie=async()=>{if(D===void 0||be===void 0)return;const e=performance.now(),t=await dn({timeline:g,sound:be,out:D,ffmpeg:k});return h.mix=A(e),t};ut||(Y=Ie(),Y.catch(()=>{}));const lt=zt(g.width,g.height),We=ye.reduce((e,t)=>e+t.images,0);let J=0,ze=-1;const ve=()=>{const e=Math.floor(90*J/We);e<=ze||(ze=e,a.onProgress?.(.9*J/We))},ee=j(W,"frames");P==="png"&&await kt(ee,{recursive:!0});const ie=B.map((e,t)=>j(W,`segment.${String(t).padStart(4,"0")}.${P}`));let He=0,Ke=0;const Pe=new AbortController,F=a.signal?AbortSignal.any([Pe.signal,a.signal]):Pe.signal,Le=sn();h.concurrency=Math.max(1,Math.min(Le.limit,Ee.filter(e=>e===void 0).length));const mt=performance.now(),Ve=(e,t,n)=>ue(k,["-v","error","-y","-i",e,"-map","0:v","-c","copy","-frames:v",String(n),...ge,t]),pt=async(e,t)=>{const n=ye[e];if(!n)return;const o=n.graphics,i=n.images,s={key:t.junction?`${t.junction.from.key}>${t.part.key}`:t.part.key,...t.junction?{junction:!0}:{},frames:t.frames,cached:!1,images:o?i:0,captured:0,reused:0,clear:0,capture:0,ffmpeg:0,waitFrames:0,waitPipe:0,start:0,end:0},b=t.junction?void 0:Oe.get(t.part.key);b!==void 0&&(s.keyed=b),h.part[e]=s;const m={captured:0,reused:0},O=new Map,x=f=>{let d=O.get(f);return d||(d=new Map,O.set(f,d)),d},p=P==="png"?j(ee,"frame.%05d.png"):ie[e]??"",v={...M.capture?{capture:M.capture}:{},...M.post?.filter?{post:M.post.filter}:{},...oe?{lut:oe}:{},tail:ae},r=f=>({planes:n.pictures[f]?.planes??[],overlays:n.pictures[f]?.overlays??[]}),u=f=>Le.run(async()=>{F.throwIfAborted(),s.start=A(me);const d=C?`${f}.held.${P}`:void 0,Me=()=>["-v","error","-y",...Nt(t.junction?Yt({timeline:g,transition:t.junction.transition,first:t.first,frames:t.frames,sources:Fe,alpha:X,out:r(0),in:r(1),samples:_,...v}):It({timeline:g,first:t.first,frames:t.frames,sources:Fe,alpha:X,planes:n.pictures[0]?.planes??[],overlays:n.pictures[0]?.overlays??[],samples:_,part:t.part,...v}),d!==void 0),...q(t.frames),...P==="png"?["-start_number",String(t.first+1)]:[],f,...d===void 0?[]:["-map",`[${Jt}]`,"-frames:v",String(t.frames),...q(t.frames,!0),d]],H=performance.now();let R=n.drawn<i||n.groups.length>1;for(;;){const $e=new Ze(R);let te=0,K=0;try{await tt(k,Me(),o?async ce=>{await an({count:i,ahead:Math.max(8,se.size*4),draw:ne=>{if(!ct(n,t,ne))return s.clear++,K++,Promise.resolve(lt);const{f:Se,k:fe,group:de}=Ce(n,t,ne);return se.use([e,ne],async ht=>{F.throwIfAborted();const gt=performance.now(),yt=await ht.frame(Se/c,{format:"png",alpha:!0,...qt(de.part,de.plane),...t.junction?{part:de.part.key}:{},reuse:x(de.part.key),stats:m,...fe>0?{offset:Te(fe)}:{}});return s.capture+=(performance.now()-gt)/1e3,yt})},emit:async ne=>{const Se=$e.next(ne),fe=performance.now();await ln(ce,Se),s.waitPipe+=(performance.now()-fe)/1e3,J++,te++,ve()},waits:s,signal:F})}:void 0,!1,F);break}catch(ce){if(!(ce instanceof Ze.Mixed)||R)throw d!==void 0&&await re(d,{force:!0}),ce;R=!0}J-=te,s.clear-=K}if(C&&d!==void 0&&(await Dt(f,C,c,E)?(await xt(d,f),s.held=!0):await re(d,{force:!0})),s.ffmpeg=A(H),o||(J+=i,ve()),o){const $e=new Set(t.junction?[t.junction.from.key,t.part.key]:[t.part.key]),te=await ft($e);if(te.length>0)throw new Ut("draw-failed",`Drawing ${s.key} failed, so it is not rendered: ${te.map(K=>`${K.code} ${K.message}${K.t===void 0?"":` (at ${K.t.toFixed(2)} s)`}`).join("; ")}`,{exit:At.failed,hint:"allyhub frames --at and allyhub inspect layout --at draw that moment; fix what failed and render again."})}}),y=t.keep<t.frames,S=Z[e];if(z&&S){const f=await z.segment(S,P,u);y?await Ve(f.file,p,t.keep):await rn(f.file,p),f.cached&&(t.junction?Ke++:He++,s.cached=!0,J+=i,ve())}else if(y){const f=j(W,`whole.${String(e).padStart(4,"0")}.${P}`);await u(f),await Ve(f,p,t.keep),await re(f,{force:!0})}else await u(p);s.captured=m.captured,s.reused=m.reused,s.end=A(me)},Je=(await Promise.allSettled(B.map((e,t)=>pt(t,e).catch(n=>{throw Pe.abort(n),n})))).find(e=>e.status==="rejected");if(Je)throw Je.reason;await Promise.all(le),h.parts=A(mt);const $=await(Y??Ie()),xe=$?.loudness;a.onProgress?.(.95),F.throwIfAborted();const wt=performance.now();let N;if(l==="png"){const e=a.out.replace(/\.png$/,"");N=[];const t=(await vt(ee)).filter(n=>/^frame\.\d+\.png$/.test(n)).sort();for(const n of t){F.throwIfAborted();const o=`${e}.${n.slice(6)}`;V.push(o),await Xe(j(ee,n),o),N.push(o)}D&&xe&&(V.push(`${e}.wav`),await Xe(D,`${e}.wav`),N.push(`${e}.wav`))}else if(l==="gif"){V.push(a.out);const e=a.encode?.gifWidth??Qe.width,t=a.encode?.gifFps??Qe.fps,n=e>0&&e<g.width?Math.round(e):g.width,o=t>0&&t<c?t:c,i=o===c?pe.text:String(o);await ue(k,["-v","error","-y","-framerate",pe.text,"-start_number","1","-i",j(ee,"frame.%05d.png"),"-filter_complex",`fps=${i},scale=${String(n)}:-1:flags=lanczos,split[a][b];[a]palettegen=stats_mode=diff[p];[b][p]paletteuse=dither=sierra2_4a`,"-r",i,"-loop","0",a.out],void 0,F)}else{if(C){const n=C.bufferKbps*1e3;let o=Bt*n;for(const[i,s]of ie.entries()){const b=await Ge(s,E);if(!b)continue;const m=Ye(b,C,c,o);if(!m.breaks){o=m.end;continue}const O=q(b.length,!0,o/n),x=r=>ue(k,["-v","error","-y","-i",s,"-an",...O,r],void 0,F);let p=j(W,`held.${String(i)}.mp4`);const v=Z[i];z&&v?p=(await z.segment(nt(Buffer.from(JSON.stringify(["held across the join",v,O]))),P,x)).file:await x(p),ie[i]=p,h.capped=(h.capped??0)+1,o=Ye(await Ge(p,E)??b,C,c,o).end}}const e=j(W,"segments.txt");await $t(e,ie.map(n=>`file '${n.replace(/'/g,"'\\''")}'
|
|
3
|
+
`).join(""));const t=l==="mov"?["-c:a","pcm_s24le"]:l==="webm"?["-c:a","libopus","-b:a",`${String(a.encode?.audioBitrate??160)}k`]:["-c:a","aac","-b:a",`${String(a.encode?.audioBitrate??192)}k`];V.push(a.out),await ue(k,["-v","error","-y","-f","concat","-safe","0","-i",e,...D===void 0?[]:["-i",D],"-map","0:v",...D===void 0?[]:["-map","1:a"],"-c:v","copy",...D===void 0?[]:t,...l==="mp4"||l==="mov"?["-movflags","+faststart"]:[],...ge,a.out],void 0,F)}V.length=0,h.mux=A(wt),a.onProgress?.(1);const Ne=N??[a.out];let Ue=0;for(const e of Ne)Ue+=(await Mt(e)).size;return{out:Ne[0]??a.out,frames:_e,duration:_e/c,bytes:Ue,...xe?{loudness:xe}:{},...$?.gainDb!==void 0?{master:{...$.before?{before:$.before}:{},gainDb:$.gainDb,...$.limited===void 0?{}:{limited:$.limited},target:$.target,...$.rounds===void 0?{}:{rounds:$.rounds}}}:{},...N?{files:N}:{},parts:{total:B.filter(e=>!e.junction).length,cached:He},...B.some(e=>e.junction)?{junctions:{total:B.filter(e=>e.junction).length,cached:Ke}}:{},timings:{...h,total:A(me),part:h.part.map(e=>({...e,capture:Math.round(e.capture*1e3)/1e3,waitFrames:Math.round(e.waitFrames*1e3)/1e3,waitPipe:Math.round(e.waitPipe*1e3)/1e3}))}}}finally{await Promise.allSettled([...le,...Y?[Y]:[]]),await ot(),await Promise.all(V.map(G=>re(G,{force:!0}))),await re(W,{recursive:!0,force:!0})}}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
AllyHub Software License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AllyHub, Inc. ("AllyHub"). All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software (the AllyHub command-line tool, its SDK, runtime and the
|
|
6
|
+
packages they depend on) is proprietary. It is not open source.
|
|
7
|
+
|
|
8
|
+
1. Permitted use. You may install and run the software, unmodified, to make,
|
|
9
|
+
check, preview and render videos and decks, including for commercial
|
|
10
|
+
purposes. What you make with it is yours.
|
|
11
|
+
|
|
12
|
+
2. Restrictions. Except as this license permits or applicable law requires,
|
|
13
|
+
you may not copy, modify, adapt, translate, sublicense, sell, rent, lease,
|
|
14
|
+
publish or otherwise distribute the software, create derivative works of
|
|
15
|
+
it, or reverse engineer, decompile or disassemble it.
|
|
16
|
+
|
|
17
|
+
3. Cloud services. AllyHub's cloud tools (sign-in, research, images, voice,
|
|
18
|
+
video) are separate services governed by AllyHub's terms of service.
|
|
19
|
+
|
|
20
|
+
4. Trademarks. This license grants no right to use the name "AllyHub" or its
|
|
21
|
+
logos.
|
|
22
|
+
|
|
23
|
+
5. No warranty. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
24
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
26
|
+
ALLYHUB BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR ITS USE.
|
|
28
|
+
|
|
29
|
+
6. Third-party code. Parts of the software are adapted from HyperFrames,
|
|
30
|
+
licensed under the Apache License, Version 2.0 (see NOTICE). Those parts
|
|
31
|
+
remain under that license, reproduced below, and nothing in this license
|
|
32
|
+
limits your rights under it.
|
|
33
|
+
|
|
34
|
+
7. Starter components. The starter components in the "components" folder,
|
|
35
|
+
which "allyhub add" copies into your workspace, are licensed under the MIT
|
|
36
|
+
License (see components/LICENSE): once copied, you may change, use and
|
|
37
|
+
share them freely.
|
|
38
|
+
|
|
39
|
+
--------------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
Apache License
|
|
42
|
+
Version 2.0, January 2004
|
|
43
|
+
http://www.apache.org/licenses/
|
|
44
|
+
|
|
45
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
46
|
+
|
|
47
|
+
1. Definitions.
|
|
48
|
+
|
|
49
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
50
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
51
|
+
|
|
52
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
53
|
+
the copyright owner that is granting the License.
|
|
54
|
+
|
|
55
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
56
|
+
other entities that control, are controlled by, or are under common
|
|
57
|
+
control with that entity. For the purposes of this definition,
|
|
58
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
59
|
+
direction or management of such entity, whether by contract or
|
|
60
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
61
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
62
|
+
|
|
63
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
64
|
+
exercising permissions granted by this License.
|
|
65
|
+
|
|
66
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
67
|
+
including but not limited to software source code, documentation
|
|
68
|
+
source, and configuration files.
|
|
69
|
+
|
|
70
|
+
"Object" form shall mean any form resulting from mechanical
|
|
71
|
+
transformation or translation of a Source form, including but
|
|
72
|
+
not limited to compiled object code, generated documentation,
|
|
73
|
+
and conversions to other media types.
|
|
74
|
+
|
|
75
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
76
|
+
Object form, made available under the License, as indicated by a
|
|
77
|
+
copyright notice that is included in or attached to the work
|
|
78
|
+
(an example is provided in the Appendix below).
|
|
79
|
+
|
|
80
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
81
|
+
form, that is based on (or derived from) the Work and for which the
|
|
82
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
83
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
84
|
+
of this License, Derivative Works shall not include works that remain
|
|
85
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
86
|
+
the Work and Derivative Works thereof.
|
|
87
|
+
|
|
88
|
+
"Contribution" shall mean any work of authorship, including
|
|
89
|
+
the original version of the Work and any modifications or additions
|
|
90
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
91
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
92
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
93
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
94
|
+
means any form of electronic, verbal, or written communication sent
|
|
95
|
+
to the Licensor or its representatives, including but not limited to
|
|
96
|
+
communication on electronic mailing lists, source code control systems,
|
|
97
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
98
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
99
|
+
excluding communication that is conspicuously marked or otherwise
|
|
100
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
101
|
+
|
|
102
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
103
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
104
|
+
subsequently incorporated within the Work.
|
|
105
|
+
|
|
106
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
107
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
108
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
109
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
110
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
111
|
+
Work and such Derivative Works in Source or Object form.
|
|
112
|
+
|
|
113
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
114
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
115
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
116
|
+
(except as stated in this section) patent license to make, have made,
|
|
117
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
118
|
+
where such license applies only to those patent claims licensable
|
|
119
|
+
by such Contributor that are necessarily infringed by their
|
|
120
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
121
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
122
|
+
institute patent litigation against any entity (including a
|
|
123
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
124
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
125
|
+
or contributory patent infringement, then any patent licenses
|
|
126
|
+
granted to You under this License for that Work shall terminate
|
|
127
|
+
as of the date such litigation is filed.
|
|
128
|
+
|
|
129
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
130
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
131
|
+
modifications, and in Source or Object form, provided that You
|
|
132
|
+
meet the following conditions:
|
|
133
|
+
|
|
134
|
+
(a) You must give any other recipients of the Work or
|
|
135
|
+
Derivative Works a copy of this License; and
|
|
136
|
+
|
|
137
|
+
(b) You must cause any modified files to carry prominent notices
|
|
138
|
+
stating that You changed the files; and
|
|
139
|
+
|
|
140
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
141
|
+
that You distribute, all copyright, patent, trademark, and
|
|
142
|
+
attribution notices from the Source form of the Work,
|
|
143
|
+
excluding those notices that do not pertain to any part of
|
|
144
|
+
the Derivative Works; and
|
|
145
|
+
|
|
146
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
147
|
+
distribution, then any Derivative Works that You distribute must
|
|
148
|
+
include a readable copy of the attribution notices contained
|
|
149
|
+
within such NOTICE file, excluding those notices that do not
|
|
150
|
+
pertain to any part of the Derivative Works, in at least one
|
|
151
|
+
of the following places: within a NOTICE text file distributed
|
|
152
|
+
as part of the Derivative Works; within the Source form or
|
|
153
|
+
documentation, if provided along with the Derivative Works; or,
|
|
154
|
+
within a display generated by the Derivative Works, if and
|
|
155
|
+
wherever such third-party notices normally appear. The contents
|
|
156
|
+
of the NOTICE file are for informational purposes only and
|
|
157
|
+
do not modify the License. You may add Your own attribution
|
|
158
|
+
notices within Derivative Works that You distribute, alongside
|
|
159
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
160
|
+
that such additional attribution notices cannot be construed
|
|
161
|
+
as modifying the License.
|
|
162
|
+
|
|
163
|
+
You may add Your own copyright statement to Your modifications and
|
|
164
|
+
may provide additional or different license terms and conditions
|
|
165
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
166
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
167
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
168
|
+
the conditions stated in this License.
|
|
169
|
+
|
|
170
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
171
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
172
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
173
|
+
this License, without any additional terms or conditions.
|
|
174
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
175
|
+
the terms of any separate license agreement you may have executed
|
|
176
|
+
with Licensor regarding such Contributions.
|
|
177
|
+
|
|
178
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
179
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
180
|
+
except as required for reasonable and customary use in describing the
|
|
181
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
182
|
+
|
|
183
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
184
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
185
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
186
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
187
|
+
implied, including, without limitation, any warranties or conditions
|
|
188
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
189
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
190
|
+
appropriateness of using or redistributing the Work and assume any
|
|
191
|
+
risks associated with Your exercise of permissions under this License.
|
|
192
|
+
|
|
193
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
194
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
195
|
+
unless required by applicable law (such as deliberate and grossly
|
|
196
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
197
|
+
liable to You for damages, including any direct, indirect, special,
|
|
198
|
+
incidental, or consequential damages of any character arising as a
|
|
199
|
+
result of this License or out of the use or inability to use the
|
|
200
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
201
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
202
|
+
other commercial damages or losses), even if such Contributor
|
|
203
|
+
has been advised of the possibility of such damages.
|
|
204
|
+
|
|
205
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
206
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
207
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
208
|
+
or other liability obligations and/or rights consistent with this
|
|
209
|
+
License. However, in accepting such obligations, You may act only
|
|
210
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
211
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
212
|
+
defend, and hold each Contributor harmless for any liability
|
|
213
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
214
|
+
of your accepting any such warranty or additional liability.
|
|
215
|
+
|
|
216
|
+
END OF TERMS AND CONDITIONS
|
|
217
|
+
|
|
218
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
219
|
+
|
|
220
|
+
To apply the Apache License to your work, attach the following
|
|
221
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
222
|
+
replaced with your own identifying information. (Don't include
|
|
223
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
224
|
+
comment syntax for the file format. We also recommend that a
|
|
225
|
+
file or class name and description of purpose be included on the
|
|
226
|
+
same "printed page" as the copyright notice for easier
|
|
227
|
+
identification within third-party archives.
|
|
228
|
+
|
|
229
|
+
Copyright [yyyy] [name of copyright owner]
|
|
230
|
+
|
|
231
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
232
|
+
you may not use this file except in compliance with the License.
|
|
233
|
+
You may obtain a copy of the License at
|
|
234
|
+
|
|
235
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
236
|
+
|
|
237
|
+
Unless required by applicable law or agreed to in writing, software
|
|
238
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
239
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
240
|
+
See the License for the specific language governing permissions and
|
|
241
|
+
limitations under the License.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{stat as p}from"node:fs/promises";import{join as c}from"node:path";import{startBrowser as l}from"@allyhub/browser";import{problem as s}from"@allyhub/diagnostics";import{reportProblems as f,systemFaces as d}from"./check.js";import{openReport as m}from"./page.js";export const HTML=/\.html?$/iu;export async function readReport(t,e){const o=e.entry,n={where:{file:o}},r=[];return HTML.test(o)?(await p(c(t,o)).catch(()=>{}))?.isFile()||r.push(s("AK-M017",`${o} is not there.`,n)):r.push(s("AK-M017",`${o} is not an HTML file: a report is one page, its file ending in .html.`,n)),{problems:r}}export async function checkReport(t,e){if(((await readReport(t,e)).problems??[]).length>0)return[];const n=await l();try{const r=await m(n,t,e.entry);try{const i=r.findings(),a=i.unsettled===void 0?await d(r.page):[];return f(e.entry,i,a)}finally{await r.close()}}finally{await n.close()}}const u={read:(t,e)=>readReport(e.root,t),check:(t,e)=>checkReport(e.root,t),unreadable:()=>[],render:async(t,e)=>(await import("./export.js")).renderReportFiles(t,e)};export default u;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{problem as p}from"@allyhub/diagnostics";const T=3e3;export async function systemFaces(n){const s=n.session;await s.send("DOM.enable"),await s.send("CSS.enable");const{root:f}=await s.send("DOM.getDocument",{depth:-1}),r=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE","HEAD"]),o=[],c=e=>{if(o.length>=T||r.has(e.nodeName))return;const i=(e.children??[]).filter(a=>a.nodeType===3).map(a=>a.nodeValue).join("").trim();e.nodeType===1&&i!==""&&o.push({node:e,text:i});for(const a of e.children??[])c(a)};c(f);const t=new Map;for(const{node:e,text:i}of o){const a=await s.send("CSS.getPlatformFontsForNode",{nodeId:e.nodeId}).catch(()=>{});for(const l of a?.fonts??[]){if(l.isCustomFont)continue;const d=t.get(l.familyName),u=e.attributes??[],m=S=>{const h=u.indexOf(S);return h>=0&&h%2===0?u[h+1]:void 0},$=m("id"),w=m("class")?.trim().split(/\s+/u)[0],g=`${e.localName}${$?`#${$}`:w?`.${w}`:""}`,y=i.replace(/\s+/gu," ").slice(0,40);t.set(l.familyName,{family:l.familyName,glyphs:(d?.glyphs??0)+l.glyphCount,sample:d?.sample??`${g} "${y}"`})}}return[...t.values()].sort((e,i)=>i.glyphs-e.glyphs)}export function reportProblems(n,s,f){const r={where:{file:n}},o=[],c=new Set;for(const t of s.missing)c.has(t.path)||(c.add(t.path),o.push(p("AK-A001",`${n} asks for ${t.path}, which is not in the project (${String(t.status)}).`,r)));for(const t of new Set(s.outside))o.push(p("AK-N003",`${n} asks for ${t}, outside the project: a report is drawn offline, from its project's files alone. Put the file in the project (a package installed, or a file beside the report) and name it by its path.`,r));for(const t of s.thrown)o.push(p("AK-R001",`${n}: ${t.text.split(`
|
|
3
|
+
`)[0]??t.text}${t.url?` (${t.url.replace(/^https?:\/\/[^/]+\//u,"")}:${String(t.line)})`:""}.`,{where:{file:n,...t.url?{}:{line:t.line}}}));s.unsettled!==void 0&&o.push(p("AK-P004",`${n}: ${s.unsettled}`,r));for(const t of f)o.push(p("AK-L006",`${n} draws ${String(t.glyphs)} glyph${t.glyphs===1?"":"s"} in ${t.family}, a face of this computer and no file of the project (${t.sample}): another computer draws them in its own. Load a face for that text as a file (@font-face).`,r));return o}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{stat as d}from"node:fs/promises";import{join as a,relative as m,resolve as c,sep as l}from"node:path";import{readWork as u}from"@allyhub/build";import{itemIdOf as k,listedWork as h}from"@allyhub/formats";import{HTML as x}from"../build.js";export{reportPicture}from"./picture.js";export{REPORT_DEFAULTS}from"../page.js";export async function findReport(t,p,i){const r=c(p,i),o=m(t,r).split(l).join("/"),n=h((await u(t)).work);if(x.test(r)&&(await d(r).catch(()=>{}))?.isFile())return n.some(e=>e.file===o&&e.kind==="report")?r:void 0;const s=new Set([o,i.replace(/^\.\//u,"").replace(/\/+$/u,"")]),f=n.find(e=>e.kind==="report"&&s.has(k(e.file)));return f===void 0?void 0:a(t,f.file)}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readFile as b}from"node:fs/promises";import{join as f,relative as w}from"node:path";import{z as r}from"zod";import{PROJECT_DIR as $,defineCliCommand as l}from"@allyhub/build";import{CommandError as m,EXIT as h}from"@allyhub/protocol";import{SHARED_DIR as y,StyleError as j,reportStyle as c,reportStyles as d,useReportStyle as g}from"../styles.js";import{findReport as S}from"./find.js";const u=async t=>new m("not-found",`AllyHub brings no report style ${t}.`,{exit:h.notFound,hint:`The report styles: ${(await d()).map(e=>e.name).join(", ")} (allyhub report style list).`}),x=l({input:r.strictObject({}),output:r.looseObject({}),examples:["allyhub report style list"],async run(){const t=(await d()).map(e=>({name:e.name,about:e.about,themes:e.themes}));return{value:{styles:t},text:t.map(e=>`${e.name} ${e.about}
|
|
3
|
+
themes: ${e.themes.join(", ")}`).join(`
|
|
4
|
+
`)}}}),T=l({input:r.strictObject({name:r.string().describe("The report style (allyhub report style list)")}),positional:["name"],output:r.looseObject({}),examples:["allyhub report style show allyhub"],async run(t){const e=await c(t.name);if(!e)throw await u(t.name);const a=await b(f(e.dir,"STYLE.md"),"utf8");return{value:{name:e.name,themes:e.themes,style:a},text:a.trimEnd()}}}),v=l({input:r.strictObject({report:r.string().describe("The report, by its file or its id in allyhub.yaml"),name:r.string().describe("The report style (allyhub report style list)"),force:r.boolean().default(!1).describe("Write style.css and tokens.js again over the report's own; its other files are kept"),dir:$}),positional:["report","name"],output:r.looseObject({}),examples:["allyhub report style use research/channels/channels allyhub","allyhub report style use q3/review.html allyhub --force"],about:{lines:[`Its faces and libraries are copied once into the project's ${y}/<style>/, which every report in it shares; style.css and tokens.js go in the report's style/ folder. Choose a theme on the page: <html data-theme="moss">.`]},async run(t,e){const a=await e.root(t.dir),p=await S(a,e.cwd,t.report);if(p===void 0)throw new m("not-found",`${t.report} is not a report.`,{exit:h.notFound,hint:"Name a report by its file or its id in allyhub.yaml (kind: report)."});const o=await c(t.name);if(!o)throw await u(t.name);const i=w(a,p).split("\\").join("/");let s;try{s=await g(a,i,o,{force:t.force})}catch(n){throw n instanceof j?new m("exists",n.message,{exit:h.usage,hint:"Change it as the report needs, or write it again with --force."}):n}return{value:{report:i,...s,themes:o.themes},text:[`${i}: the ${o.name} report style, ${s.written.join(" and ")}${s.copied.length>0?`; ${String(s.copied.length)} file${s.copied.length===1?"":"s"} copied into ${y}/${o.name}/`:""}.`,"Link them in its <head>:",...s.links.map(n=>` ${n}`),`Themes, on <html data-theme="…">: ${o.themes.join(", ")}. Its words: allyhub report style show ${o.name}.`].join(`
|
|
5
|
+
`)}}}),E={"report style list":x,"report style show":T,"report style use":v};export default E;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{startBrowser as d}from"@allyhub/browser";import{blankImage as p,cropImage as u,pasteImage as w,readPng as h,writePng as f}from"@allyhub/measure";import{openReport as m,pageHeight as b,pagePicture as g}from"../page.js";const l=24,y=[200,200,200,255];export const BANDS={most:6,tall:1.6};export class ReportPictureError extends Error{code;constructor(i){super(i),this.name="ReportPictureError",this.code="no-element"}}function x(n,i){const t=h(n),e=Math.min(BANDS.most,Math.max(1,Math.ceil(t.height/(i*BANDS.tall))));if(e===1)return{png:n,bands:1};const o=Math.ceil(t.height/e),a=p(e*t.width+(e-1)*l,o,[...y]);for(let r=0;r<e;r++){const s=u(t,[0,r*o,t.width,o]);s&&w(a,s,r*(t.width+l),0)}return{png:f(a),bands:e}}export async function reportPicture(n){const i=await d();try{const t=await m(i,n.root,n.file,n);try{const e=t.page,o=await b(e);if(n.at!==void 0){const c=await e.evaluate(`(() => { const el = document.querySelector(${JSON.stringify(n.at)}); if (!el) return null; const r = el.getBoundingClientRect(); if (r.width === 0 || r.height === 0) return null; return { x: r.x + scrollX, y: r.y + scrollY, width: r.width, height: r.height }; })()`);if(!c)throw new ReportPictureError(`Nothing drawn on the page matches ${n.at}.`);return{...await g(e,c),pageHeight:o,bands:1,findings:t.findings()}}const a=await g(e),r=x(a.png,a.width),s=r.bands===1?a:h(r.png);return{png:r.png,width:s.width,height:s.height,pageHeight:o,bands:r.bands,findings:t.findings()}}finally{await t.close()}}finally{await i.close()}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{mkdir as P,readFile as R,writeFile as w}from"node:fs/promises";import{dirname as k,join as F}from"node:path";import{startBrowser as E}from"@allyhub/browser";import{emojiPicturesScript as S}from"@allyhub/browser/emoji";import{InlineError as $,inlineReport as v}from"./inline.js";import{REPORT_DEFAULTS as T,openReport as x,pagePicture as B}from"./page.js";export const REPORT_TYPES=["html","pdf","png"],PAPERS={letter:{width:8.5,height:11},a4:{width:8.27,height:11.69}},RENDER_DEFAULTS={...T,paper:"letter",dark:!1};function d(t,r,i){const e=t[r],n=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(n)&&n>0?n:i}export function viewOf(t){const r=RENDER_DEFAULTS;return{width:d(t,"width",r.width),height:d(t,"height",r.height),scale:d(t,"scale",r.scale),timeout:d(t,"timeout",r.timeout),network:d(t,"network",r.network),quiet:d(t,"quiet",r.quiet),dark:t.dark===!0||t.dark==="true"}}const y=t=>`${(t/1e6).toFixed(1)} MB`,m=(t,r,i)=>({type:t,failure:{code:"report-not-made",message:r,...i===void 0?{}:{hint:i}}});export async function renderReportFiles(t,r){if(r.types.length===0)return[];const{root:i,log:e,types:n,params:u}=r,g=viewOf(u);e?.(`Rendering ${t.entry}…`);const p=[];let l;try{l=await E();let o=0;for(const c of n){if(r.signal?.aborted)break;const s=r.out(c);await P(k(s),{recursive:!0});const f=await L(l,i,t,c,s,g,u,e);p.push(f),r.onProgress?.(++o/n.length)}}finally{await l?.close()}return p}async function L(t,r,i,e,n,u,g,p){const l=e==="pdf",o=await x(t,r,i.entry,{...u,print:l},{keep:e==="html"});try{const c=o.findings();if(c.unsettled!==void 0)return m(e,`${i.entry}: ${c.unsettled}`,"allyhub check names what kept it.");if(e==="html"){const s=await R(F(r,i.entry),"utf8");let f;try{f=v(s,o.url,o.loaded)}catch(a){if(a instanceof $)return m(e,a.message);throw a}await w(n,f);const h=[...o.loaded.values()].filter(a=>a.type==="Font").reduce((a,b)=>a+Math.ceil(b.body.length/3)*4,0);return p?.(`${i.entry}: the HTML file is ${y(Buffer.byteLength(f))}, ${y(h)} of it the ${String([...o.loaded.values()].filter(a=>a.type==="Font").length)} font files the page loaded.`),{type:e,files:[n]}}if(e==="pdf"){await o.page.evaluate(S());const s=g.paper,f=typeof s=="string"?s.toLowerCase():RENDER_DEFAULTS.paper,h=f in PAPERS?PAPERS[f]:PAPERS[RENDER_DEFAULTS.paper],a=await o.page.session.send("Page.printToPDF",{printBackground:!0,preferCSSPageSize:!0,paperWidth:h.width,paperHeight:h.height});return await w(n,Buffer.from(a.data,"base64")),{type:e,files:[n]}}if(e==="png"){const{png:s}=await B(o.page);return await w(n,s),{type:e,files:[n]}}return m(e,`A report is not made into ${e}.`)}finally{await o.close()}}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import C from"dom-serializer";import{Element as O,Text as R,isTag as I}from"domhandler";import{parseDocument as M}from"htmlparser2";export class InlineError extends Error{name="InlineError"}const v=e=>e.replace(/<\/(script)/giu,"<\\/$1"),$=e=>e.replace(/<\/(style)/giu,"<\\/$1"),T=/(?:^|[;\s}])import\s*(?:[\w*{][^'"]*?\sfrom\s*)?["']|(?:^|[^.\w])import\s*\(/mu,F=e=>`data:${e.mime||"application/octet-stream"};base64,${e.body.toString("base64")}`;function k(e,t){const o=e.trim();if(!(o===""||/^(data|blob|javascript|mailto|tel|about):/iu.test(o))&&!o.startsWith("#"))try{const n=new URL(o,t);return n.hash="",n.href}catch{return}}function L(e,t,o){const n=k(t,o),l=n===void 0?void 0:e.files.get(n);return!l||n===void 0?t:(e.used.add(n),F(l))}function S(e,t,o,n=0){return t.replace(/@import\s+(?:url\(\s*)?(["']?)([^"')\s;]+)\1\s*\)?([^;]*);/gu,(f,g,a,b)=>{const p=k(a,o),w=p===void 0?void 0:e.files.get(p);if(!w||p===void 0||n>8)return f;e.used.add(p);const s=S(e,w.body.toString("utf8"),p,n+1),m=b.trim();return m===""?s:`@media ${m} {
|
|
3
|
+
${s}
|
|
4
|
+
}`}).replace(/url\(\s*(["']?)([^"')]+)\1\s*\)/gu,(f,g,a)=>{const b=L(e,a,o);return b===a?f:`url(${g}${b}${g})`})}const H={img:["src"],source:["src"],video:["src","poster"],audio:["src"],track:["src"],input:["src"],embed:["src"],object:["data"],image:["href","xlink:href"],use:[]};function x(e,t){const o={};for(const n of t)o[n.url]=[n.mime,n.body.toString("base64")];return`(() => {
|
|
5
|
+
const BASE = ${JSON.stringify(e)};
|
|
6
|
+
const FILES = ${JSON.stringify(o)};
|
|
7
|
+
const has = (k) => Object.prototype.hasOwnProperty.call(FILES, k);
|
|
8
|
+
// A URL as the page asked for it, as it was where the render drew the
|
|
9
|
+
// page: a relative one from the report's address there; an address on
|
|
10
|
+
// this page's own origin by its path from this page's folder.
|
|
11
|
+
const keyOf = (u) => {
|
|
12
|
+
const s = String(u);
|
|
13
|
+
let abs;
|
|
14
|
+
try {
|
|
15
|
+
if (!/^[a-z][a-z0-9+.-]*:|^\\/\\//iu.test(s)) abs = new URL(s, BASE);
|
|
16
|
+
else {
|
|
17
|
+
const asked = new URL(s, document.baseURI);
|
|
18
|
+
if (asked.origin !== location.origin || asked.protocol !== location.protocol) abs = asked;
|
|
19
|
+
else {
|
|
20
|
+
const from = location.pathname.split("/").slice(0, -1);
|
|
21
|
+
const to = asked.pathname.split("/");
|
|
22
|
+
let i = 0;
|
|
23
|
+
while (i < from.length && i < to.length - 1 && from[i] === to[i]) i++;
|
|
24
|
+
const rel = "../".repeat(from.length - i) + to.slice(i).join("/");
|
|
25
|
+
abs = new URL(rel + asked.search, BASE);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch { return undefined; }
|
|
29
|
+
abs.hash = "";
|
|
30
|
+
return has(abs.href) ? abs.href : undefined;
|
|
31
|
+
};
|
|
32
|
+
const bytes = (b) => Uint8Array.from(atob(b), (c) => c.charCodeAt(0));
|
|
33
|
+
const blobs = new Map();
|
|
34
|
+
const blobOf = (k) => {
|
|
35
|
+
if (!blobs.has(k)) blobs.set(k, URL.createObjectURL(new Blob([bytes(FILES[k][1])], { type: FILES[k][0] })));
|
|
36
|
+
return blobs.get(k);
|
|
37
|
+
};
|
|
38
|
+
const swap = (u) => { const k = keyOf(String(u)); return k ? blobOf(k) : u; };
|
|
39
|
+
const fetch0 = window.fetch.bind(window);
|
|
40
|
+
window.fetch = (input, init) => {
|
|
41
|
+
const u = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
42
|
+
const k = keyOf(u);
|
|
43
|
+
if (!k) return fetch0(input, init);
|
|
44
|
+
return Promise.resolve(new Response(bytes(FILES[k][1]), { status: 200, headers: { "content-type": FILES[k][0] } }));
|
|
45
|
+
};
|
|
46
|
+
const open0 = XMLHttpRequest.prototype.open;
|
|
47
|
+
XMLHttpRequest.prototype.open = function (method, url, ...rest) { return open0.call(this, method, swap(url), ...rest); };
|
|
48
|
+
const props = [[HTMLImageElement, "src"], [HTMLScriptElement, "src"], [HTMLLinkElement, "href"], [HTMLSourceElement, "src"], [HTMLMediaElement, "src"]];
|
|
49
|
+
for (const [C, p] of props) {
|
|
50
|
+
const d = Object.getOwnPropertyDescriptor(C.prototype, p);
|
|
51
|
+
if (d && d.set) Object.defineProperty(C.prototype, p, { ...d, set(v) { d.set.call(this, swap(v)); } });
|
|
52
|
+
}
|
|
53
|
+
const setAttribute0 = Element.prototype.setAttribute;
|
|
54
|
+
Element.prototype.setAttribute = function (name, value) {
|
|
55
|
+
const n = String(name).toLowerCase();
|
|
56
|
+
return setAttribute0.call(this, name, n === "src" || n === "href" || n === "poster" ? swap(value) : value);
|
|
57
|
+
};
|
|
58
|
+
})();`}function*j(e){for(const t of e.children)I(t)&&(yield t,yield*j(t))}const A=e=>e.children.map(t=>t instanceof R?t.data:"").join(""),E=(e,t)=>{const o=new R(t);o.parent=e,e.children=[o]};export function inlineReport(e,t,o){const n={files:o,used:new Set([t])},l=M(e,{decodeEntities:!0}),f=[...j(l)];for(const s of f){const m=s.name.toLowerCase(),i=s.attribs;if(m==="script"){const c=(i.type??"").trim().toLowerCase(),d=c==="module";if(c==="importmap")continue;let r;const h=i.src;if(h!==void 0){const u=k(h,t),y=u===void 0?void 0:o.get(u);if(!y||u===void 0)continue;n.used.add(u),r=y.body.toString("utf8"),delete i.src,delete i.integrity,delete i.crossorigin}else r=A(s);if(d&&T.test(r))throw new InlineError(`${h??"a module script"} imports another file, which a page in one file cannot load: bundle the module into one file, or use a classic script (a library's UMD build, such as chart.umd.min.js).`);h!==void 0&&E(s,v(r));continue}if(m==="link"){const c=(i.rel??"").toLowerCase().split(/\s+/u),d=i.href;if(d===void 0)continue;if(c.includes("stylesheet")){const r=k(d,t),h=r===void 0?void 0:o.get(r);if(!h||r===void 0)continue;n.used.add(r);const u=new O("style",{...i.media===void 0?{}:{media:i.media}});E(u,$(S(n,h.body.toString("utf8"),r))),u.parent=s.parent;const y=s.parent?.children;y&&y.splice(y.indexOf(s),1,u);continue}if(c.includes("preload")||c.includes("modulepreload")){const r=s.parent?.children;r&&r.splice(r.indexOf(s),1);continue}c.some(r=>r==="icon"||r==="apple-touch-icon")&&(i.href=L(n,d,t));continue}if(m==="style"){E(s,$(S(n,A(s),t)));continue}for(const c of H[m]??[])i[c]!==void 0&&(i[c]=L(n,i[c],t));i.srcset!==void 0&&(i.srcset=i.srcset.split(",").map(c=>{const[d,...r]=c.trim().split(/\s+/u);return d===void 0?c:[L(n,d,t),...r].join(" ")}).join(", ")),i.style!==void 0&&(i.style=S(n,i.style,t))}const g=[...o.values()].filter(s=>!n.used.has(s.url)&&s.type!=="Document"&&s.type!=="Font"),a=new O("script",{});E(a,v(x(t,g)));const b=f.find(s=>s.name.toLowerCase()==="head"),p=f.find(s=>s.name.toLowerCase()==="html"),w=b??p??l;return a.parent=w,w.children.unshift(a),C(l,{encodeEntities:"utf8"})}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readFile as x}from"node:fs/promises";import{join as I,posix as S}from"node:path";import{setTimeout as w}from"node:timers/promises";import{openPage as q,startServer as M}from"@allyhub/browser";export const REPORT_DEFAULTS={width:1440,height:900,scale:1,timeout:3e4,network:3e3,quiet:1200};const $=`(() => {
|
|
3
|
+
let s = 0x2f6b9a1d;
|
|
4
|
+
Math.random = () => {
|
|
5
|
+
s = (s + 0x6d2b79f5) | 0;
|
|
6
|
+
let t = Math.imul(s ^ (s >>> 15), 1 | s);
|
|
7
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
8
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
9
|
+
};
|
|
10
|
+
})();`,j=`(async () => {
|
|
11
|
+
await document.fonts.ready;
|
|
12
|
+
await Promise.all(Array.from(document.images).map((i) => i.decode().catch(() => undefined)));
|
|
13
|
+
if (window.allyhubReady) await window.allyhubReady;
|
|
14
|
+
for (const a of document.getAnimations()) {
|
|
15
|
+
const t = a.effect && a.effect.getComputedTiming ? a.effect.getComputedTiming() : undefined;
|
|
16
|
+
if (t && Number.isFinite(t.endTime)) a.finish();
|
|
17
|
+
else { a.pause(); a.currentTime = 0; }
|
|
18
|
+
}
|
|
19
|
+
await document.fonts.ready;
|
|
20
|
+
return true;
|
|
21
|
+
})()`,v=o=>{const i=S.normalize(o.split("\\").join("/"));if(i.startsWith("../")||i.startsWith("/"))throw new Error(`${o} is not inside the project.`);return i};function C(o,i){if(i.startsWith(`${o}/`))try{return decodeURIComponent(new URL(i).pathname.slice(1))}catch{return}}export async function openReport(o,i,c,e={},l={}){const s=REPORT_DEFAULTS,u=e.width??s.width,m=e.height??s.height,p=e.timeout??s.timeout,a=await M([{at:"/",dir:i}]);let n;try{n=await q(o,{width:u,height:m,scale:e.scale??s.scale,allow:a.allow});const r=n.session,g=[],y=new Map,E=new Map,P=[];r.on("Network.responseReceived",t=>{const d=C(a.origin,t.response.url);d!==void 0&&(t.response.status>=400?g.push({path:d,status:t.response.status}):l.keep&&E.set(t.requestId,{url:t.response.url,path:d,type:t.type,mime:t.response.mimeType}))}),r.on("Network.loadingFinished",t=>{const d=E.get(t.requestId);if(!d)return;const{path:k,mime:b}=d;P.push(x(I(i,k)).then(R=>{y.set(d.url,{url:d.url,path:k,mime:b,type:d.type,body:R})}).catch(()=>{}))}),await Promise.all([r.send("Network.enable",{}),r.send("Page.addScriptToEvaluateOnNewDocument",{source:$}),r.send("Emulation.setEmulatedMedia",{media:e.print?"print":"",features:[{name:"prefers-reduced-motion",value:e.motion?"no-preference":"reduce"},{name:"prefers-color-scheme",value:e.dark?"dark":"light"}]})]);const T=`${a.origin}/${v(c).split("/").map(encodeURIComponent).join("/")}`;let h;try{await N(n,T,{timeout:p,network:e.network??s.network,quiet:e.quiet??s.quiet})}catch(t){h=t instanceof Error?t.message:String(t)}await Promise.all(P);const f=n;return{page:f,url:T,origin:a.origin,loaded:y,findings:()=>({missing:[...g],outside:f.refused(),thrown:f.errors(),...h===void 0?{}:{unsettled:h}}),async close(){await f.close(),await a.close()}}}catch(r){throw await n?.close(),await a.close(),r}}async function N(o,i,c){const e=o.session;await e.send("Page.setLifecycleEventsEnabled",{enabled:!0});const l=new AbortController,s=n=>e.once("Page.lifecycleEvent",{match:r=>r.name===n,signal:l.signal}),u=s("load"),m=s("networkIdle"),p=n=>w(c.timeout,void 0,{signal:l.signal}).then(()=>{throw new Error(n)}),a=String(c.timeout/1e3);try{const n=await e.send("Page.navigate",{url:i});if(n.errorText)throw new Error(`It did not load: ${n.errorText}.`);await Promise.race([u,p(`It did not finish loading within ${a} s.`)]),await Promise.race([m,w(c.network,void 0,{signal:l.signal})]),await Promise.race([o.evaluate(j,{timeoutMs:c.timeout}),p(`It did not settle within ${a} s: its fonts, its pictures or window.allyhubReady never finished.`)]),await w(c.quiet)}finally{l.abort(),await Promise.allSettled([u,m])}}export{pageHeight,pagePicture}from"@allyhub/browser/picture";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{randomUUID as y}from"node:crypto";import{defineProjectTool as l}from"@allyhub/build";import{startBrowser as m}from"@allyhub/browser";import{RPC_ERROR as w,RpcError as f}from"@allyhub/protocol";import{openReport as u}from"./page.js";import{REPORT_TOOLS as p}from"./tools.js";async function h(n,e){const t=(await n.items()).find(a=>a.id===e&&a.kind==="report");if(!t)throw new f(w.notFound,`There is no report ${e}.`);return t.entry}const T=`(points) => {
|
|
3
|
+
const part = (e) => e.tagName.toLowerCase() + (e.id ? "#" + e.id : "") +
|
|
4
|
+
[...e.classList].slice(0, 3).map((c) => "." + c).join("");
|
|
5
|
+
const seen = new Set();
|
|
6
|
+
const elements = [];
|
|
7
|
+
for (const p of points) {
|
|
8
|
+
const el = document.elementFromPoint(p.x, p.y);
|
|
9
|
+
if (!el || seen.has(el)) continue;
|
|
10
|
+
seen.add(el);
|
|
11
|
+
const path = [];
|
|
12
|
+
for (let e = el; e && path.length < 5; e = e.parentElement) path.unshift(part(e));
|
|
13
|
+
elements.push({
|
|
14
|
+
selector: path.join(" > "),
|
|
15
|
+
tag: el.tagName.toLowerCase(),
|
|
16
|
+
text: (el.innerText ?? el.textContent ?? "").trim().slice(0, 200),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const inner = elements.filter((e) => e.tag !== "html" && e.tag !== "body");
|
|
20
|
+
return inner.length > 0 ? inner : elements;
|
|
21
|
+
}`,E=30*6e4;class R{held=new Map;async hold(e,t,a){const o=await m();try{const r=await u(o,e,t,a),s=y(),i=setTimeout(()=>{this.release(s)},E);return i.unref(),this.held.set(s,{browser:o,opened:r,timer:i}),s}catch(r){throw await o.close(),r}}page(e){const t=this.held.get(e);if(!t)throw new f(w.notFound,`No page is held as ${e}: it was let go.`);return t.opened.page}async release(e){const t=this.held.get(e);t&&(this.held.delete(e),clearTimeout(t.timer),await t.opened.close().catch(()=>{}),await t.browser.close())}async dispose(){for(const e of[...this.held.keys()])await this.release(e)}}const c=n=>n.held("report/held",()=>new R);async function g(n,e,t,a){const o=await m();try{const r=await u(o,n.root,e,t);try{return await a(r.page)}finally{await r.close()}}finally{await o.close()}}const P={"report/still":l(p["report/still"],async({item:n,width:e,height:t,scale:a,hold:o},r)=>{const s=d=>d.capture({format:"png"});return{image:{mime:"image/png",data:(o!==void 0?await s(c(r).page(o)):await g(r,await h(r,n),{width:e,height:t,scale:a},s)).toString("base64")}}}),"report/at":l(p["report/at"],async({item:n,width:e,height:t,points:a,hold:o},r)=>{const s=d=>d.evaluate(`(${T})(${JSON.stringify(a)})`);return{elements:o!==void 0?await s(c(r).page(o)):await g(r,await h(r,n),{width:e,height:t},s)}}),"report/hold":l(p["report/hold"],async({item:n,width:e,height:t,scale:a},o)=>({hold:await c(o).hold(o.root,await h(o,n),{width:e,height:t,scale:a})})),"report/release":l(p["report/release"],async({hold:n},e)=>(await c(e).release(n),{}))};export default P;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{copyFile as L,mkdir as D,readFile as u,readdir as T,stat as j,writeFile as R}from"node:fs/promises";import{createRequire as q}from"node:module";import{dirname as d,join as r,posix as E,relative as l,sep as m}from"node:path";import{fileURLToPath as N}from"node:url";import{z as n}from"zod";import{themesIn as O}from"./theme.js";export const STYLES_DIR=N(new URL("../styles/",import.meta.url)),SHARED_DIR="assets/report-styles";const F=q(import.meta.url),U=n.object({about:n.string(),theme:n.string(),faces:n.array(n.object({package:n.string(),css:n.array(n.string())})),files:n.array(n.object({package:n.string(),path:n.string()}))}),W=t=>O(t).map(e=>e.name);export async function reportStyles(){const t=(await T(STYLES_DIR,{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name).sort();return Promise.all(t.map(reportStyle))}export async function reportStyle(t){if(!/^[a-z][\w-]*$/u.test(t))return;const e=r(STYLES_DIR,t),s=await u(r(e,"style.json"),"utf8").catch(()=>{});if(s===void 0)return;const a=U.parse(JSON.parse(s)),p=W(await u(r(e,"style.css"),"utf8"));return{name:t,about:a.about,themes:[a.theme,...p.filter(o=>o!==a.theme)],dir:e,spec:a}}function v(t){try{return d(F.resolve(`${t}/package.json`))}catch{let e=d(F.resolve(t));for(;!e.endsWith(`${m}${t.split("/").join(m)}`);){const s=d(e);if(s===e)throw new Error(`${t}'s folder was not found.`);e=s}return e}}const z=(t,e)=>{const s=l(t,e).split(m).join("/");return s.startsWith(".")?s:`./${s}`};async function I(t,e){const[s,a]=await Promise.all([j(t),j(e).catch(()=>{})]);return a?.size===s.size?!1:(await D(d(e),{recursive:!0}),await L(t,e),!0)}function _(t,e,s){const a=[];return{rules:t.replace(/src:\s*([^;]+);/gu,(o,w)=>{const c=/url\(\s*["']?\.\/files\/([^"')]+\.woff2)["']?\s*\)\s*format\(\s*["']([\w-]+)["']\s*\)/u.exec(w);return c?.[1]?(a.push(c[1]),`src: url(${z(s,r(e,c[1]))}) format("${c[2]??"woff2"}");`):o}),files:a}}export class StyleError extends Error{name="StyleError"}export async function useReportStyle(t,e,s,a={}){const p=r(t,E.dirname(e)),o=r(p,"style"),w=r(t,SHARED_DIR,s.name),c=r(w,"faces"),h=r(o,"style.css");if(!a.force&&await j(h).catch(()=>{}))throw new StyleError(`${l(t,h)} is there already: it is the report's own now.`);const y=[],k=[];for(const i of s.spec.faces){const f=v(i.package);for(const x of i.css){const b=_(await u(r(f,x),"utf8"),c,o);k.push(`/* ${i.package}/${x} */
|
|
3
|
+
${b.rules.trim()}`);for(const g of b.files)await I(r(f,"files",g),r(c,g))&&y.push(l(t,r(c,g)))}}const $=[];for(const i of s.spec.files){const f=r(w,E.basename(i.path));await I(r(v(i.package),i.path),f)&&y.push(l(t,f)),$.push(z(p,f))}const P=(await u(r(s.dir,"style.css"),"utf8")).replace("/* @faces */",k.join(`
|
|
4
|
+
|
|
5
|
+
`));await D(o,{recursive:!0}),await R(h,P),await R(r(o,"tokens.js"),await u(r(s.dir,"tokens.js"),"utf8"));const S=i=>l(t,i).split(m).join("/");return{style:s.name,written:[S(h),S(r(o,"tokens.js"))],copied:y.map(i=>i.split(m).join("/")),links:['<link rel="stylesheet" href="style/style.css">','<script src="style/tokens.js"><\/script>',...$.map(i=>`<script src="${i}"><\/script>`)]}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
const l=/^(#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\([^)]*\))$/iu;export function themesIn(n){const t=new Map;for(const e of n.matchAll(/\[data-theme="([\w-]+)"\]\s*\{([^}]*)\}/gu)){const s=e[1]??"";if(s===""||t.has(s))continue;const o=[];for(const c of(e[2]??"").split(";")){const a=c.slice(c.indexOf(":")+1).trim();c.includes(":")&&l.test(a)&&o.push(a)}t.set(s,{name:s,colors:o})}return[...t.values()]}function u(n,t){const e=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'=<>\`]+))`,"iu").exec(n);if(e)return{value:e[1]??e[2]??e[3]??"",at:e.index,length:e[0].length}}export function stylesheetsOf(n){const t=[];for(const e of n.matchAll(/<link\b[^>]*>/giu)){const s=e[0],o=u(s,"rel")?.value.toLowerCase().split(/\s+/u)??[],c=u(s,"href")?.value;o.includes("stylesheet")&&c&&t.push(c)}return t}const i=n=>/<html\b[^>]*>/iu.exec(n);export function themeOf(n){const t=i(n),e=t?u(t[0],"data-theme")?.value:void 0;return e===void 0||e===""?void 0:e}export function withTheme(n,t){const e=i(n);if(!e)return;const s=e.index,o=u(e[0],"data-theme"),c=o?`${e[0].slice(0,o.at)} data-theme="${t}"${e[0].slice(o.at+o.length)}`:`<html data-theme="${t}"${e[0].slice(5)}`;return`${n.slice(0,s)}${c}${n.slice(s+e[0].length)}`}export function pathFrom(n,t){if(/^[a-z][a-z0-9+.-]*:|^\/\//iu.test(t))return;const e=new URL(t,`file:///${n}`),s=decodeURIComponent(e.pathname).replace(/^\/+/u,"");return s===""?void 0:s}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{z as t}from"zod";import{PathSchema as s,method as e,toolCaller as i}from"@allyhub/protocol";const r=t.strictObject({item:s}),a={width:t.number().int().positive().max(4096),height:t.number().int().positive().max(4096)};export const REPORT_TOOLS={"report/still":e(r.extend({...a,scale:t.number().positive().max(4).default(1),hold:t.string().optional()}),t.strictObject({image:t.strictObject({mime:t.string(),data:t.string()})}),"A report's page drawn as the render draws it, at a frame's size from its top: what Mark up lays over a report's frame, which the window cannot read."),"report/hold":e(r.extend({...a,scale:t.number().positive().max(4).default(1)}),t.strictObject({hold:t.string()}),"A report's page opened at a frame's size and kept as it is while a person marks it: report/still and report/at draw and read it as it was, until report/release."),"report/release":e(t.strictObject({hold:t.string()}),t.strictObject({}),"Lets a page held for notes go."),"report/at":e(r.extend({...a,points:t.array(t.strictObject({x:t.number(),y:t.number()})).min(1).max(24),hold:t.string().optional()}),t.strictObject({elements:t.array(t.strictObject({selector:t.string(),tag:t.string(),text:t.string()}))}),"What is at places of a report's page drawn at a frame's size from its top (as report/still draws it): what a person's mark on its frame is on.")},callReportTool=i(REPORT_TOOLS);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readFile as o}from"node:fs/promises";import{join as s}from"node:path";const u={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};export function titleOf(e){const t=/<title[^>]*>([\s\S]*?)<\/title>/iu.exec(e)?.[1]?.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/giu,(r,i)=>i.startsWith("#x")||i.startsWith("#X")?String.fromCodePoint(Number.parseInt(i.slice(2),16)):i.startsWith("#")?String.fromCodePoint(Number.parseInt(i.slice(1),10)):u[i.toLowerCase()]??r).replace(/\s+/gu," ").trim();return t===void 0||t===""?void 0:t}async function a(e,n){const t=await o(s(e,n.entry),"utf8").catch(()=>{});return t===void 0?void 0:titleOf(t)}const c=()=>Promise.resolve({page:{}});export function activate(e){e.subscriptions.push(e.allyhub.kinds.registerKindProvider("report",{title:(n,{root:t})=>a(t,n),snapshot:c}))}
|