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{glassProblems as D,moireCamera as R,moireProblems as A,PANEL_DEFAULTS as L,project as M,resolveCamera as j,SCREEN_FOCUS_DEFAULTS as P,SCREEN_LIGHT_DEFAULTS as x,screenLightBaseProblem as z}from"@allyhub/scenery";import{isPiece as B,LAYER_BRAND as O}from"@allyhub/piece";import{bakeFile as I,DRAWN_OVER_RULE as J,ruleOf as H,SCENERY_RULES as W}from"../allyhub.js";import{sceneryFileOf as G}from"../module.js";import{gradeLayer as q}from"./grade.js";import{drawMoire as V}from"./moire.js";import{answerFor as Y}from"./queries.js";import{blurScreen as K,drawScreen as X,mountScreen as Z,placeInScenery as Q,screenEdge as ee,screenFocusOf as re,screenTo as ne,stackByDepth as se}from"./screens.js";import{cameraOf as te,coded as $,refScenery as k,registry as v,ruled as F,sceneryAtFilm as ie,sceneryTime as N}from"./state.js";import{SCREEN as oe}from"./types.js";export{stackByDepth}from"./screens.js";export{markScenery,sceneryFileOf}from"../module.js";export{PHONE_CAMERA,phoneCamera,aimAt,aimed,AIM_DEFAULTS,AUTO_EXPOSURE_DEFAULTS,AUTOFOCUS_DEFAULTS,BAKE_DEFAULTS,blend,CAMERA_DEFAULTS,cameraProblems,cutsOf,defineScenery,diagonalLens,directionOf,easeValue,exposureOf,fieldOfView,FIT_DEFAULTS,fitCamera,focusScreen,GLASS_DEFAULTS,handheld,HANDHELD_DEFAULTS,keys,lensForVertical,mixCameras,orbit,PANEL_DEFAULTS,path,PATH_DEFAULTS,project,resolveCamera,rise,SCREEN_LIGHT_DEFAULTS,SENSOR_DEFAULTS,shots,STABILIZER_DEFAULTS,withCuts,SCENERY_RENDERER_DEFAULTS,yawPitchOf}from"@allyhub/scenery";export const SCREEN_DEFAULTS={size:[1920,1080],background:"#000000"};function ae(t){if(t===!1)return!1;const r=typeof t=="object"?t:{},e=r.brightness??1;if(!(Number.isFinite(e)&&e>=0))throw new Error(`screen()'s inScenery brightness ${String(e)} is not a number of 0 or more.`);const i=r.light??!0;if(i===!1)return{brightness:e,light:!1};const s=(typeof i=="object"?i.cells:void 0)??[...x.cells];if(s.length!==2||!s.every(a=>Number.isInteger(a)&&a>=1&&a<=32))throw new Error(`screen()'s inScenery light cells ${JSON.stringify(s)} are not two whole numbers from 1 to 32 (across, down).`);const c=(typeof i=="object"?i.specular:void 0)??x.specular;if(typeof c!="boolean")throw new Error(`screen()'s inScenery light specular ${JSON.stringify(c)} is not true or false.`);const o=(typeof i=="object"?i.base:void 0)??x.base;if(o!==null){const a=z(o);if(a!==void 0)throw new Error(`screen()'s inScenery light base: ${a}.`)}const l=o;return{brightness:e,light:{cells:[s[0]??1,s[1]??1],specular:c,base:l?{brightness:l.brightness??e,color:typeof l.color=="string"?l.color:l.color?[...l.color]:"#ffffff"}:null}}}export function screen(t,r={}){if((r.start!==void 0||r.cue!==void 0)&&r.time!==void 0)throw new Error("screen() takes start and cue, or time, not both.");if(r.cues!==void 0){if(r.start!==void 0||r.cue!==void 0||r.time!==void 0)throw new Error("screen() takes cues, or start and cue, or time: one way to time it.");if(Object.keys(r.cues).length===0)throw new Error(`screen()'s cues is empty: give the screen's moments and where each plays, { "@click": "@press" }.`);for(const[a,h]of Object.entries(r.cues)){if(!(a.trim().startsWith("@")?!0:Number.isFinite(Number(a)))||Array.isArray(t)&&a.trim().startsWith("@"))throw new Error(`screen()'s cue key ${JSON.stringify(a)}: ${Array.isArray(t)?`layers' moments are seconds of the screen's time, as a string ("2.5")`:`a video's own reference ("@click") or seconds of its time as a string ("2.5")`}.`);if(!(typeof h=="number"&&Number.isFinite(h))&&!(typeof h=="string"&&h.trim()!==""))throw new Error(`screen()'s cue ${JSON.stringify(a)} plays at ${JSON.stringify(h)}: a reference of the film ("@press") or a scenery time in seconds.`)}}if(typeof r.cue=="number"&&!Number.isFinite(r.cue))throw new Error(`screen()'s cue ${String(r.cue)} is not a number of seconds.`);if(typeof r.cue=="string"&&Array.isArray(t))throw new Error(`screen()'s cue "${r.cue}" is a reference: only a video has references of its own. Give layers' cue in seconds of the screen's time.`);const e=r.background??SCREEN_DEFAULTS.background,i={[oe]:!0,time:r.time??{},...r.start!==void 0?{start:r.start}:{},...r.cue!==void 0?{cue:r.cue}:{},...r.cues!==void 0?{cues:{...r.cues}}:{},background:e==="transparent"?null:e,...r.pixels?{pixels:{...r.pixels}}:{},...r.glass?{glass:{...r.glass}}:{},inScenery:ae(r.inScenery)},s=A(void 0,r.pixels);if(s.length>0)throw new Error(`screen()'s ${s.join(" ")}`);const c=D(r.glass);if(c.length>0)throw new Error(`screen()'s ${c.join(" ")}`);if(!Array.isArray(t)){if(!B(t))throw new Error('screen() shows a video item (its piece, imported: import demo from "../demo/video") or graphic layers.');if(r.size!==void 0||r.dur!==void 0)throw new Error("screen() with a video takes its size and length from the video: its own format, and its length.");return{...i,video:t,layers:[],size:SCREEN_DEFAULTS.size}}const o=t;for(const a of o)if(a[O]!=="graphic")throw new Error("screen() takes graphic layers (components, custom()), or a video item whose own layers include footage.");const l=r.size??SCREEN_DEFAULTS.size;if(!(l[0]>0&&l[1]>0))throw new Error(`screen()'s size ${JSON.stringify(l)} is not two sizes in px.`);return{...i,layers:o,size:l,...r.dur!==void 0?{dur:r.dur}:{}}}export const SCENERY_LAYER_DEFAULTS={scale:1,name:"scenery",focusLevels:P.levels};const T=new WeakMap,U=new WeakMap,_=new WeakMap,ce=()=>{const t=import.meta.url;return new URL("../three-libs/",t).href};function le(t,r,e){const i=G(t);return{assetUrl:s=>r.asset(`/${s.replace(/^\/+/,"")}`).url,...i===void 0?{}:{module:i},decoders:ce(),seed:e,onProblem:s=>{r.report?.({code:H(s.kind),level:s.level,message:s.message})},bakeUrl:(s,c)=>r.optionalAsset?.(`/${I(s,c)}`)?.url,...r.realTimers?{timers:r.realTimers}:{}}}function de(t,r,e){let i=U.get(t);return i||(i=Promise.all([import("../page/page.js"),import("../signature.js")]).then(async([{SceneryPage:s},{signatureOf:c}])=>{const o={page:await s.open(t,le(t,r,e)),sign:c};return _.set(t,o),o}),U.set(t,i)),i}function fe(t,r){const e=r.canvas;e.parentNode!==t.el&&t.el.insertBefore(e,t.canvas),e.dataset.akSign="the scenery's renderer",Object.assign(e.style,{position:"absolute",left:t.canvas.style.left,top:t.canvas.style.top,width:t.canvas.style.width,height:t.canvas.style.height,clipPath:"inset(0 calc(100% - 1px) calc(100% - 1px) 0)",pointerEvents:"none"})}export function scenery(t,r){const{at:e,until:i,dur:s,z:c,...o}=r,l={...e===void 0?{}:{at:e},...i===void 0?{}:{until:i},...s===void 0?{}:{dur:s},...c===void 0?{}:{z:c}},a=o.box===void 0||o.box==="full"?[0,0,1,1]:o.box;if(a.some(p=>!Number.isFinite(p))||a[2]<=0||a[3]<=0||a[0]+a[2]>1+1e-9||a[1]+a[3]>1+1e-9)throw new Error(`scenery()'s box ${JSON.stringify(a)} is not inside the frame: [x, y, width, height] as fractions, x + width and y + height at most 1.`);const h=o.quality?.scale??SCENERY_LAYER_DEFAULTS.scale;if(!(h>0&&h<=4))throw new Error(`scenery()'s quality.scale ${String(h)} is outside (0, 4].`);const u=o.quality?.focusLevels??SCENERY_LAYER_DEFAULTS.focusLevels;if(!(Number.isInteger(u)&&u>=1&&u<=16))throw new Error(`scenery()'s quality.focusLevels ${String(u)} is not a whole number from 1 to 16.`);const d=A(o.sensor,void 0);if(d.length>0)throw new Error(`scenery()'s ${d.join(" ")}`);const f=o.background;return{[O]:"graphic",...l,component:"scenery",props:{scenery:t,camera:o.camera,box:a,...f===void 0?{}:{background:f==="transparent"?null:f},time:o.time??{},scale:h,focusLevels:u,...o.sensor?{sensor:{...o.sensor}}:{},name:o.name??SCENERY_LAYER_DEFAULTS.name,screens:o.screens??{},props:o.props??[]},mount(p,y,w){F(()=>{he(p,y,w)})},render(p,y){F(()=>{me(p,y)})}}}function he(t,r,e){const{width:i,height:s}=e.dims,c={x:Math.round(r.box[0]*i),y:Math.round(r.box[1]*s),w:Math.max(1,Math.round(r.box[2]*i)),h:Math.max(1,Math.round(r.box[3]*s))},o=document.createElement("canvas"),l=e.sceneryScale??r.scale;o.width=Math.max(1,Math.round(c.w*l)),o.height=Math.max(1,Math.round(c.h*l)),Object.assign(o.style,{position:"absolute",left:`${String(c.x)}px`,top:`${String(c.y)}px`,width:`${String(c.w)}px`,height:`${String(c.h)}px`});const a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:o.style.left,top:o.style.top,width:o.style.width,height:o.style.height,overflow:"hidden",isolation:"isolate"});const h=g=>ie(r,(e.film?.start??0)+g);t.appendChild(a);const u=Object.entries(r.screens).map(([g,n])=>Z(a,g,n,e,h,m=>k(r,e,m)));let d;r.sensor&&u.length>0&&(d=document.createElement("canvas"),d.width=c.w,d.height=c.h,d.dataset.akSign="the scenery's moiré",Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",width:`${String(c.w)}px`,height:`${String(c.h)}px`,zIndex:"100000",mixBlendMode:"multiply",pointerEvents:"none"}),a.appendChild(d)),u.length===0&&a.remove(),t.appendChild(o);const f={props:r,ctx:e,el:t,canvas:o,px:c,screens:u,time:g=>k(r,e,g),...d?{moire:d}:{}};T.set(t,f),Y(f);const p=v.get(r.name)??[];p.push(f),v.set(r.name,p);const y=g=>Promise.all(r.props.map(n=>g.props.add(n))),w=g=>{throw $(g)},E=_.get(r.scenery);if(E){f.page=E.page,f.sign=E.sign,r.props.length>0&&e.wait(y(E.page).catch(w));return}e.wait(de(r.scenery,e,r.name).then(async({page:g,sign:n})=>{await y(g),f.page=g,f.sign=n}).catch(w))}function me(t,r){const e=T.get(t);if(!e?.page)return;const i=e.page,s=N(e,r),c=e.px.w/e.px.h,o=i.stateFrom(te(e),s,c,e.time);i.props.show(e.props.props,s);const l=i.aim(o,c),{width:a,height:h}=e.canvas,u=i.screens.drawsElements,d=u?e.screens.filter(n=>n.spec.inScenery!==!1):[];if(!u&&!e.fellBack){const n=e.screens.filter(m=>m.spec.inScenery!==!1);n.length>0&&(e.fellBack=!0,e.ctx.report?.({code:J,level:"warn",message:`The screens ${n.map(m=>`"${m.mesh}"`).join(", ")} of the scenery layer "${e.props.name}" are drawn over the scenery, unlit and untoned, not in it: this page cannot draw an element into the scenery's canvas (Chrome's HTML-in-Canvas is missing or turned off, or the scenery draws with WebGPU). AllyHub's own Chrome, which allyhub frames, check and exports use, has it: when allyhub check does not report this, only this page's preview is affected, so change nothing. screen(…, { inScenery: false }) would take the scenery's light and a sensor's moiré out of the export too.`}))}const f=e.screens.filter(n=>!d.includes(n)).map(n=>n.mesh),p=e.screens.map(n=>i.screens.quad(n.mesh,l.resolved,[e.px.w,e.px.h]));q(e,e.props.sensor?.grade,Math.max(0,...e.screens.map(n=>i.screens.share(n.mesh,l.resolved,[e.px.w,e.px.h]))));const y=Math.ceil(2/(e.canvas.height/e.px.h))+1;d.length>0&&fe(e,i);const w=[];if(e.screens.forEach((n,m)=>{if(d.includes(n)){const b=n.spec.pixels?.density??L.density,C=n.spec.pixels?.mesh??L.mesh,S=n.spec.inScenery;i.screens.show(n.mesh,n.el,{brightness:S===!1?1:S.brightness,light:S===!1?!1:S.light,...e.moire&&e.props.sensor?{factor:e.moire}:{}}),Q(n,p[m],b,C),w.push(ne(n,s));return}X(n,s,p[m]),ee(n,p[m],y),K(n,re(e,n,p[m],l.resolved))}),se(e.screens.map((n,m)=>({el:n.el,depth:p[m]?.depth}))),e.sign&&(e.canvas.dataset.akSign=e.sign(i.scene,l.camera,[a,h],`${e.props.background===void 0?"the scenery's":e.props.background??"none"}|${f.join(",")}${l.resolved.dof?`|f/${String(l.resolved.dof.aperture)}@${String(l.resolved.dof.focus)}:${String(l.resolved.dof.lens)}`:""}${e.props.sensor?`|sensor ${JSON.stringify(e.props.sensor)} ${JSON.stringify(e.screens.map(n=>n.spec.pixels??null))}`:""}${e.screens.some(n=>n.spec.glass)?`|glass ${JSON.stringify(e.screens.map(n=>n.spec.glass??null))}`:""}${d.length>0?`|in scenery ${JSON.stringify(d.map(n=>[n.mesh,n.spec.inScenery]))}`:""}`)),e.ctx.layoutOnly===!0)return;e.moire&&e.props.sensor&&V(e,p,l.resolved,R(l.resolved,[e.ctx.dims.width,e.ctx.dims.height],e.px.h,e.props.sensor,[e.px.x,e.px.y]));const E=new Map(e.screens.flatMap(n=>n.spec.glass?[[n.mesh,n.spec.glass]]:[])),g=()=>{const n=i.drawer.inPlace(l.camera,a,h,e.props.background,f,l.resolved.dof,E.size>0?E:void 0,d.map(b=>b.mesh)),m=e.canvas.getContext("2d");if(m&&(m.clearRect(0,0,a,h),m.drawImage(n,0,0,a,h),i.lost))throw Object.assign(new Error(`The scenery's WebGL context was lost (the browser's GPU process failed): its picture at ${r.toFixed(3)} s is empty.`),{code:W.renderer})};if(d.length===0){g();return}e.ctx.wait(Promise.all(w).then(()=>i.screens.paint([a,h])).then(g).catch(n=>{throw $(n)}))}export function projectScenery(t,r,e,i){const s=v.get(t)?.find(f=>f.el.parentElement===i.parentElement&&f.ctx.layer.start<=e&&e<f.ctx.layer.end&&f.page),c=s?.page;if(!s||!c)return;const o=N(s,e),l=s.px.w/s.px.h,a=c.stateFrom(s.props.camera,o,l,s.time);c.props.show(s.props.props,o);const h=j(a,l,f=>c.pointOf(f)),u=typeof r=="string"?c.pointOf(r):r,d=M(h,u);return{x:s.px.x+(d.x+1)/2*s.px.w,y:s.px.y+(1-d.y)/2*s.px.h,inView:d.inView,depth:d.depth}}
|
|
2
|
+
import{glassProblems as D,moireCamera as R,moireProblems as A,PANEL_DEFAULTS as L,project as M,resolveCamera as P,SCREEN_FOCUS_DEFAULTS as j,SCREEN_LIGHT_DEFAULTS as x,screenLightBaseProblem as z}from"@allyhub/scenery";import{isPiece as B,LAYER_BRAND as O}from"@allyhub/piece";import{bakeFile as I,DRAWN_OVER_RULE as J,ruleOf as H,SCENERY_RULES as W}from"../allyhub.js";import{sceneryFileOf as G}from"../module.js";import{gradeLayer as q}from"./grade.js";import{drawMoire as V}from"./moire.js";import{answerFor as Y}from"./queries.js";import{blurScreen as K,drawScreen as X,mountScreen as Z,placeInScenery as Q,screenEdge as ee,screenFocusOf as re,screenTo as ne,stackByDepth as se}from"./screens.js";import{cameraOf as te,coded as $,refScenery as k,registry as v,ruled as F,sceneryAtFilm as oe,sceneryTime as N}from"./state.js";import{SCREEN as ie}from"./types.js";export{stackByDepth}from"./screens.js";export{markScenery,sceneryFileOf}from"../module.js";export{PHONE_CAMERA,phoneCamera,aimAt,aimed,AIM_DEFAULTS,AUTO_EXPOSURE_DEFAULTS,AUTOFOCUS_DEFAULTS,BAKE_DEFAULTS,blend,CAMERA_DEFAULTS,cameraProblems,cutsOf,defineScenery,diagonalLens,directionOf,easeValue,exposureOf,fieldOfView,FIT_DEFAULTS,fitCamera,focusScreen,GLASS_DEFAULTS,handheld,HANDHELD_DEFAULTS,keys,lensForVertical,mixCameras,orbit,PANEL_DEFAULTS,path,PATH_DEFAULTS,project,resolveCamera,rise,SCREEN_LIGHT_DEFAULTS,SENSOR_DEFAULTS,shots,STABILIZER_DEFAULTS,withCuts,SCENERY_RENDERER_DEFAULTS,yawPitchOf}from"@allyhub/scenery";export const SCREEN_DEFAULTS={size:[1920,1080],background:"#000000"};function ae(t){if(t===!1)return!1;const r=typeof t=="object"?t:{},e=r.brightness??1;if(!(Number.isFinite(e)&&e>=0))throw new Error(`screen()'s inScenery brightness ${String(e)} is not a number of 0 or more.`);const o=r.light??!0;if(o===!1)return{brightness:e,light:!1};const s=(typeof o=="object"?o.cells:void 0)??[...x.cells];if(s.length!==2||!s.every(a=>Number.isInteger(a)&&a>=1&&a<=32))throw new Error(`screen()'s inScenery light cells ${JSON.stringify(s)} are not two whole numbers from 1 to 32 (across, down).`);const c=(typeof o=="object"?o.specular:void 0)??x.specular;if(typeof c!="boolean")throw new Error(`screen()'s inScenery light specular ${JSON.stringify(c)} is not true or false.`);const i=(typeof o=="object"?o.base:void 0)??x.base;if(i!==null){const a=z(i);if(a!==void 0)throw new Error(`screen()'s inScenery light base: ${a}.`)}const l=i;return{brightness:e,light:{cells:[s[0]??1,s[1]??1],specular:c,base:l?{brightness:l.brightness??e,color:typeof l.color=="string"?l.color:l.color?[...l.color]:"#ffffff"}:null}}}export function screen(t,r={}){if((r.start!==void 0||r.cue!==void 0)&&r.time!==void 0)throw new Error("screen() takes start and cue, or time, not both.");if(r.cues!==void 0){if(r.start!==void 0||r.cue!==void 0||r.time!==void 0)throw new Error("screen() takes cues, or start and cue, or time: one way to time it.");if(Object.keys(r.cues).length===0)throw new Error(`screen()'s cues is empty: give the screen's moments and where each plays, { "@click": "@press" }.`);for(const[a,h]of Object.entries(r.cues)){if(!(a.trim().startsWith("@")?!0:Number.isFinite(Number(a)))||Array.isArray(t)&&a.trim().startsWith("@"))throw new Error(`screen()'s cue key ${JSON.stringify(a)}: ${Array.isArray(t)?`layers' moments are seconds of the screen's time, as a string ("2.5")`:`a video's own reference ("@click") or seconds of its time as a string ("2.5")`}.`);if(!(typeof h=="number"&&Number.isFinite(h))&&!(typeof h=="string"&&h.trim()!==""))throw new Error(`screen()'s cue ${JSON.stringify(a)} plays at ${JSON.stringify(h)}: a reference of the film ("@press") or a scenery time in seconds.`)}}if(typeof r.cue=="number"&&!Number.isFinite(r.cue))throw new Error(`screen()'s cue ${String(r.cue)} is not a number of seconds.`);if(typeof r.cue=="string"&&Array.isArray(t))throw new Error(`screen()'s cue "${r.cue}" is a reference: only a video has references of its own. Give layers' cue in seconds of the screen's time.`);const e=r.background??SCREEN_DEFAULTS.background,o={[ie]:!0,time:r.time??{},...r.start!==void 0?{start:r.start}:{},...r.cue!==void 0?{cue:r.cue}:{},...r.cues!==void 0?{cues:{...r.cues}}:{},background:e==="transparent"?null:e,...r.pixels?{pixels:{...r.pixels}}:{},...r.glass?{glass:{...r.glass}}:{},inScenery:ae(r.inScenery)},s=A(void 0,r.pixels);if(s.length>0)throw new Error(`screen()'s ${s.join(" ")}`);const c=D(r.glass);if(c.length>0)throw new Error(`screen()'s ${c.join(" ")}`);if(!Array.isArray(t)){if(!B(t))throw new Error('screen() shows a video item (its piece, imported: import demo from "../demo/video") or graphic layers.');if(r.size!==void 0||r.dur!==void 0)throw new Error("screen() with a video takes its size and length from the video: its own format, and its length.");return{...o,video:t,layers:[],size:SCREEN_DEFAULTS.size}}const i=t;for(const a of i)if(a[O]!=="graphic")throw new Error("screen() takes graphic layers (components, custom()), or a video item whose own layers include footage.");const l=r.size??SCREEN_DEFAULTS.size;if(!(l[0]>0&&l[1]>0))throw new Error(`screen()'s size ${JSON.stringify(l)} is not two sizes in px.`);return{...o,layers:i,size:l,...r.dur!==void 0?{dur:r.dur}:{}}}export const SCENERY_LAYER_DEFAULTS={scale:1,name:"scenery",focusLevels:j.levels};const T=new WeakMap,U=new WeakMap,_=new WeakMap,ce=()=>{const t=import.meta.url;return new URL("../three-libs/",t).href};function le(t,r,e){const o=G(t);return{assetUrl:s=>r.asset(`/${s.replace(/^\/+/,"")}`).url,...o===void 0?{}:{module:o},decoders:ce(),seed:e,onProblem:s=>{r.report?.({code:H(s.kind),level:s.level,message:s.message})},bakeUrl:(s,c)=>r.optionalAsset?.(`/${I(s,c)}`)?.url,...r.realTimers?{timers:r.realTimers}:{}}}function de(t,r,e){let o=U.get(t);return o||(o=Promise.all([import("../page/page.js"),import("../signature.js")]).then(async([{SceneryPage:s},{signatureOf:c}])=>{const i={page:await s.open(t,le(t,r,e)),sign:c};return _.set(t,i),i}),U.set(t,o)),o}function fe(t,r){const e=r.canvas;e.parentNode!==t.el&&t.el.insertBefore(e,t.canvas),e.dataset.akSign="the scenery's renderer",Object.assign(e.style,{position:"absolute",left:t.canvas.style.left,top:t.canvas.style.top,width:t.canvas.style.width,height:t.canvas.style.height,clipPath:"inset(0 calc(100% - 1px) calc(100% - 1px) 0)",pointerEvents:"none"})}export function scenery(t,r){const{at:e,until:o,dur:s,z:c,...i}=r,l={...e===void 0?{}:{at:e},...o===void 0?{}:{until:o},...s===void 0?{}:{dur:s},...c===void 0?{}:{z:c}},a=i.box===void 0||i.box==="full"?[0,0,1,1]:i.box;if(a.some(p=>!Number.isFinite(p))||a[2]<=0||a[3]<=0||a[0]+a[2]>1+1e-9||a[1]+a[3]>1+1e-9)throw new Error(`scenery()'s box ${JSON.stringify(a)} is not inside the frame: [x, y, width, height] as fractions, x + width and y + height at most 1.`);const h=i.quality?.scale??SCENERY_LAYER_DEFAULTS.scale;if(!(h>0&&h<=4))throw new Error(`scenery()'s quality.scale ${String(h)} is outside (0, 4].`);const u=i.quality?.focusLevels??SCENERY_LAYER_DEFAULTS.focusLevels;if(!(Number.isInteger(u)&&u>=1&&u<=16))throw new Error(`scenery()'s quality.focusLevels ${String(u)} is not a whole number from 1 to 16.`);const d=A(i.sensor,void 0);if(d.length>0)throw new Error(`scenery()'s ${d.join(" ")}`);const f=i.background;return{[O]:"graphic",...l,component:"scenery",props:{scenery:t,camera:i.camera,box:a,...f===void 0?{}:{background:f==="transparent"?null:f},time:i.time??{},scale:h,focusLevels:u,...i.sensor?{sensor:{...i.sensor}}:{},name:i.name??SCENERY_LAYER_DEFAULTS.name,screens:i.screens??{},props:i.props??[]},mount(p,y,w){F(()=>{he(p,y,w)})},render(p,y){F(()=>{me(p,y)})}}}function he(t,r,e){const{width:o,height:s}=e.dims,c={x:Math.round(r.box[0]*o),y:Math.round(r.box[1]*s),w:Math.max(1,Math.round(r.box[2]*o)),h:Math.max(1,Math.round(r.box[3]*s))},i=document.createElement("canvas"),l=e.sceneryScale??r.scale;i.width=Math.max(1,Math.round(c.w*l)),i.height=Math.max(1,Math.round(c.h*l)),Object.assign(i.style,{position:"absolute",left:`${String(c.x)}px`,top:`${String(c.y)}px`,width:`${String(c.w)}px`,height:`${String(c.h)}px`});const a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:i.style.left,top:i.style.top,width:i.style.width,height:i.style.height,overflow:"hidden",isolation:"isolate"});const h=g=>oe(r,(e.film?.start??0)+g);t.appendChild(a);const u=Object.entries(r.screens).map(([g,n])=>Z(a,g,n,e,h,m=>k(r,e,m)));let d;r.sensor&&u.length>0&&(d=document.createElement("canvas"),d.width=c.w,d.height=c.h,d.dataset.akSign="the scenery's moiré",Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",width:`${String(c.w)}px`,height:`${String(c.h)}px`,zIndex:"100000",mixBlendMode:"multiply",pointerEvents:"none"}),a.appendChild(d)),u.length===0&&a.remove(),t.appendChild(i);const f={props:r,ctx:e,el:t,canvas:i,px:c,screens:u,time:g=>k(r,e,g),...d?{moire:d}:{}};T.set(t,f),Y(f);const p=v.get(r.name)??[];p.push(f),v.set(r.name,p);const y=g=>Promise.all(r.props.map(n=>g.props.add(n))),w=g=>{throw $(g)},E=_.get(r.scenery);if(E){f.page=E.page,f.sign=E.sign,r.props.length>0&&e.wait(y(E.page).catch(w));return}e.wait(de(r.scenery,e,r.name).then(async({page:g,sign:n})=>{await y(g),f.page=g,f.sign=n}).catch(w))}function me(t,r){const e=T.get(t);if(!e?.page)return;const o=e.page,s=N(e,r),c=e.px.w/e.px.h,i=o.stateFrom(te(e),s,c,e.time);o.props.show(e.props.props,s);const l=o.aim(i,c),{width:a,height:h}=e.canvas,u=o.screens.drawsElements,d=u?e.screens.filter(n=>n.spec.inScenery!==!1):[];if(!u&&!e.fellBack){const n=e.screens.filter(m=>m.spec.inScenery!==!1);n.length>0&&(e.fellBack=!0,e.ctx.report?.({code:J,level:"warn",ofPage:!0,message:`The screens ${n.map(m=>`"${m.mesh}"`).join(", ")} of the scenery layer "${e.props.name}" are drawn over the scenery, unlit and untoned, not in it: this page cannot draw an element into the scenery's canvas (Chrome's HTML-in-Canvas is missing or turned off, or the scenery draws with WebGPU). AllyHub's own Chrome, which allyhub frames, check and exports use, has it: when allyhub check does not report this, only this page's preview is affected, so change nothing. screen(…, { inScenery: false }) would take the scenery's light and a sensor's moiré out of the export too.`}))}const f=e.screens.filter(n=>!d.includes(n)).map(n=>n.mesh),p=e.screens.map(n=>o.screens.quad(n.mesh,l.resolved,[e.px.w,e.px.h]));q(e,e.props.sensor?.grade,Math.max(0,...e.screens.map(n=>o.screens.share(n.mesh,l.resolved,[e.px.w,e.px.h]))));const y=Math.ceil(2/(e.canvas.height/e.px.h))+1;d.length>0&&fe(e,o);const w=[];if(e.screens.forEach((n,m)=>{if(d.includes(n)){const b=n.spec.pixels?.density??L.density,C=n.spec.pixels?.mesh??L.mesh,S=n.spec.inScenery;o.screens.show(n.mesh,n.el,{brightness:S===!1?1:S.brightness,light:S===!1?!1:S.light,...e.moire&&e.props.sensor?{factor:e.moire}:{}}),Q(n,p[m],b,C),w.push(ne(n,s));return}X(n,s,p[m]),ee(n,p[m],y),K(n,re(e,n,p[m],l.resolved))}),se(e.screens.map((n,m)=>({el:n.el,depth:p[m]?.depth}))),e.sign&&(e.canvas.dataset.akSign=e.sign(o.scene,l.camera,[a,h],`${e.props.background===void 0?"the scenery's":e.props.background??"none"}|${f.join(",")}${l.resolved.dof?`|f/${String(l.resolved.dof.aperture)}@${String(l.resolved.dof.focus)}:${String(l.resolved.dof.lens)}`:""}${e.props.sensor?`|sensor ${JSON.stringify(e.props.sensor)} ${JSON.stringify(e.screens.map(n=>n.spec.pixels??null))}`:""}${e.screens.some(n=>n.spec.glass)?`|glass ${JSON.stringify(e.screens.map(n=>n.spec.glass??null))}`:""}${d.length>0?`|in scenery ${JSON.stringify(d.map(n=>[n.mesh,n.spec.inScenery]))}`:""}`)),e.ctx.layoutOnly===!0)return;e.moire&&e.props.sensor&&V(e,p,l.resolved,R(l.resolved,[e.ctx.dims.width,e.ctx.dims.height],e.px.h,e.props.sensor,[e.px.x,e.px.y]));const E=new Map(e.screens.flatMap(n=>n.spec.glass?[[n.mesh,n.spec.glass]]:[])),g=()=>{const n=o.drawer.inPlace(l.camera,a,h,e.props.background,f,l.resolved.dof,E.size>0?E:void 0,d.map(b=>b.mesh)),m=e.canvas.getContext("2d");if(m&&(m.clearRect(0,0,a,h),m.drawImage(n,0,0,a,h),o.lost))throw Object.assign(new Error(`The scenery's WebGL context was lost (the browser's GPU process failed): its picture at ${r.toFixed(3)} s is empty.`),{code:W.renderer})};if(d.length===0){g();return}e.ctx.wait(Promise.all(w).then(()=>o.screens.paint([a,h])).then(g).catch(n=>{throw $(n)}))}export function projectScenery(t,r,e,o){const s=v.get(t)?.find(f=>f.el.parentElement===o.parentElement&&f.ctx.layer.start<=e&&e<f.ctx.layer.end&&f.page),c=s?.page;if(!s||!c)return;const i=N(s,e),l=s.px.w/s.px.h,a=c.stateFrom(s.props.camera,i,l,s.time);c.props.show(s.props.props,i);const h=P(a,l,f=>c.pointOf(f)),u=typeof r=="string"?c.pointOf(r):r,d=M(h,u);return{x:s.px.x+(d.x+1)/2*s.px.w,y:s.px.y+(1-d.y)/2*s.px.h,inView:d.inView,depth:d.depth}}
|
|
@@ -38,6 +38,12 @@ export interface PickedObject {
|
|
|
38
38
|
size: [number, number, number];
|
|
39
39
|
/** Where the pointer met it, world space, m. */
|
|
40
40
|
point: [number, number, number];
|
|
41
|
+
/**
|
|
42
|
+
* Its box as the camera sees it: the outline round its eight corners, in
|
|
43
|
+
* px of the viewer (its edge for a person who picks it; its silhouette is
|
|
44
|
+
* later). None where a corner is behind the camera.
|
|
45
|
+
*/
|
|
46
|
+
screen?: [number, number][];
|
|
41
47
|
}
|
|
42
48
|
/** What the viewer tells the page that embeds it. */
|
|
43
49
|
export type ViewerEvent = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{Box3 as
|
|
2
|
+
import{Box3 as wt,Mesh as bt,PerspectiveCamera as ht,Raycaster as Mt,Vector2 as vt,Vector3 as p}from"three";import{fitCamera as kt}from"@allyhub/scenery";import{ownFrame as zt,ownTimers as q}from"./clock.js";import{SceneryPage as Et}from"./page/page.js";const U=c=>{zt(c)},S=()=>q.now();export const VIEWER_DEFAULTS={orbitSpeed:.3,maxElevation:89,dollyPerNotch:.12,minDistance:.02,maxDistance:200,lens:30,flyMs:450,wheelRestMs:150,fill:.8,clickSlop:4,marks:!0,markColor:"#1471e2"};const Q=c=>c*Math.PI/180,pt=c=>[Math.round(c.x*1e3)/1e3,Math.round(c.y*1e3)/1e3,Math.round(c.z*1e3)/1e3],_=c=>c*180/Math.PI;function Ct(c,f){const k=Math.hypot(36,24)/Math.hypot(f,1);return _(2*Math.atan(k/(2*c)))}function G(c){const f=Q(c.elevation),d=Q(c.azimuth);return new p(c.target.x+c.distance*Math.cos(f)*Math.sin(d),c.target.y+c.distance*Math.sin(f),c.target.z+c.distance*Math.cos(f)*Math.cos(d))}function Y(c,f){const d=c.clone().sub(f),k=Math.max(d.length(),1e-4);return{target:f.clone(),azimuth:_(Math.atan2(d.x,d.z)),elevation:_(Math.asin(Math.max(-1,Math.min(1,d.y/k)))),distance:k}}function St(c){const f=[];for(let d=c;d?.parent;d=d.parent)d.name&&f.unshift(d);return f}const jt=(c,f)=>c.length===f.length&&c.every((d,k)=>d===f[k]);function P(c){return new wt().setFromObject(c)}export async function startViewer(c,f,d,k={},M=()=>{},$){const u={...VIEWER_DEFAULTS,...k},w=await Et.open(c,f),H=()=>0;w.pose(0,H);const h=w.renderer.domElement;h.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:grab",getComputedStyle(d).position==="static"&&(d.style.position="relative"),d.style.overflow="hidden",d.appendChild(h);const J=t=>{const e=document.createElement("div");e.style.cssText=`position:absolute;pointer-events:none;border:1.5px ${t?"dashed":"solid"} ${u.markColor};border-radius:4px;display:none`;const n=document.createElement("div");return n.style.cssText=`position:absolute;left:-1px;bottom:100%;margin-bottom:4px;font:12px/1.3 system-ui,sans-serif;color:#fff;background:${u.markColor};padding:2px 6px;border-radius:4px;white-space:nowrap`,e.appendChild(n),d.appendChild(e),{box:e,label:n}},mt=J(!0),ut=J(!1),R=P(w.scene),Z=R.isEmpty()?new p:R.getCenter(new p),ft=R.isEmpty()?1:Math.max(R.getSize(new p).length()/2,.05);let l={target:Z,azimuth:25,elevation:20,distance:ft*2.4};const B=w.named.cameras,tt=Object.keys(B)[0];let b=new ht(40,1,.01,500);const j=()=>{const t=d.getBoundingClientRect();return{w:Math.max(1,t.width),h:Math.max(1,t.height)}},et=t=>{const e=B[t];if(!e)return;const{w:n,h:r}=j(),a=w.aim(e,n/r),s=a.camera.position.clone(),o=new p(0,0,-1).applyQuaternion(a.camera.quaternion),i=typeof e.target=="string"?new p(...w.pointOf(e.target)):Array.isArray(e.target)?new p(...e.target):s.clone().add(o.multiplyScalar(Math.max(s.distanceTo(Z),.1)));return Y(s,i)};$?l=Y(new p(...$.position),new p(...$.target)):tt&&(l=et(tt)??l);let x=[],v=[],N=!1;const yt=t=>{const e=t[t.length-1];if(!e)return null;const n=P(e);if(n.isEmpty())return null;const{w:r,h:a}=j();let s=1/0,o=1/0,i=-1/0,m=-1/0;for(let O=0;O<8;O++){const I=new p(O&1?n.max.x:n.min.x,O&2?n.max.y:n.min.y,O&4?n.max.z:n.min.z).project(b);if(I.z>1)return null;s=Math.min(s,(I.x+1)/2*r),o=Math.min(o,(1-I.y)/2*a),i=Math.max(i,(I.x+1)/2*r),m=Math.max(m,(1-I.y)/2*a)}const g=4,C=Math.max(0,s-g),K=Math.max(0,o-g),lt=Math.min(r,i+g),dt=Math.min(a,m+g);return lt<=C||dt<=K?null:{x:C,y:K,width:lt-C,height:dt-K}},nt=(t,e)=>{const n=yt(e);return!n||!u.marks?(t.box.style.display="none",n):(t.box.style.display="block",t.box.style.left=`${String(n.x)}px`,t.box.style.top=`${String(n.y)}px`,t.box.style.width=`${String(n.width)}px`,t.box.style.height=`${String(n.height)}px`,t.label.textContent=e.map(r=>r.name).join(" › "),n)},F=()=>{N=!1;const{w:t,h:e}=j(),n=Math.min(window.devicePixelRatio||1,2),r=S();b=new ht(Ct(u.lens,t/e),t/e,Math.max(.005,l.distance/500),Math.max(50,l.distance*50)),b.position.copy(G(l)),b.lookAt(l.target),b.updateMatrixWorld(!0),w.pose(0,H),w.drawer.inPlace(b,Math.round(t*n),Math.round(e*n)),h.style.width="100%",h.style.height="100%";const a=nt(mt,jt(v,x)?[]:v),s=nt(ut,x);M({type:"place",hover:a,select:s}),M({type:"drawn",ms:S()-r})},z=()=>{N||(N=!0,U(F))};let L=0;const A=t=>{const e={...l,target:l.target.clone()},n=++L,r=S();let a=t.azimuth-e.azimuth;a=((a+180)%360+360)%360-180;const s=()=>{if(n!==L)return;const o=Math.min(1,(S()-r)/u.flyMs),i=o<.5?4*o*o*o:1-(-2*o+2)**3/2;l={target:e.target.clone().lerp(t.target,i),azimuth:e.azimuth+a*i,elevation:e.elevation+(t.elevation-e.elevation)*i,distance:e.distance*(t.distance/e.distance)**i},F(),o<1?U(s):D()};U(s)},D=()=>{M({type:"camera",camera:{position:pt(G(l)),target:pt(l.target),lens:u.lens},framed:E.length>0})},ot=new Mt,T=(t,e)=>{const n=d.getBoundingClientRect(),r=new vt((t-n.left)/n.width*2-1,-((e-n.top)/n.height)*2+1);ot.setFromCamera(r,b);const a=ot.intersectObject(w.scene,!0);for(const s of a){if(!(s.object instanceof bt)||!s.object.visible)continue;let o=!0;for(let m=s.object;m;m=m.parent)m.visible||(o=!1);if(!o)continue;const i=St(s.object);if(i.length>0)return{path:i,point:s.point}}return null},X=(t,e)=>{const n=t[t.length-1]??w.scene,r=P(n).getSize(new p),a=o=>Math.round(o*1e3)/1e3,s=gt(P(n));return{path:t.map(o=>o.name),name:n.name,size:[a(r.x),a(r.y),a(r.z)],point:[a(e.x),a(e.y),a(e.z)],...s?{screen:s}:{}}},gt=t=>{const e=d.getBoundingClientRect(),n=[];for(const o of[t.min.x,t.max.x])for(const i of[t.min.y,t.max.y])for(const m of[t.min.z,t.max.z]){const g=new p(o,i,m).project(b);if(!Number.isFinite(g.x)||!Number.isFinite(g.y)||g.z>1)return;n.push([(g.x+1)/2*e.width,(1-g.y)/2*e.height])}n.sort((o,i)=>o[0]-i[0]||o[1]-i[1]);const r=(o,i,m)=>(i[0]-o[0])*(m[1]-o[1])-(i[1]-o[1])*(m[0]-o[0]),a=o=>{const i=[];for(const m of o){for(;i.length>=2;){const g=i.at(-2),C=i.at(-1);if(!g||!C||r(g,C,m)>0)break;i.pop()}i.push(m)}return i.pop(),i},s=[...a(n),...a([...n].reverse())];return s.length>=3?s.map(([o,i])=>[Math.round(o*10)/10,Math.round(i*10)/10]):void 0},V=t=>t.slice(0,1);let y;h.addEventListener("contextmenu",t=>{t.preventDefault()}),h.addEventListener("pointerdown",t=>{h.setPointerCapture(t.pointerId),L++,y={x:t.clientX,y:t.clientY,moved:!1,pan:t.button===2||t.button===1||t.shiftKey,id:t.pointerId},h.style.cursor="grabbing"}),h.addEventListener("pointermove",t=>{if(y?.id===t.pointerId){const r=t.clientX-y.x,a=t.clientY-y.y;if(!y.moved&&Math.hypot(r,a)<u.clickSlop)return;if(y.moved=!0,y.x=t.clientX,y.y=t.clientY,y.pan){const{h:s}=j(),o=2*l.distance*Math.tan(Q(b.fov)/2)/s,i=new p().setFromMatrixColumn(b.matrixWorld,0),m=new p().setFromMatrixColumn(b.matrixWorld,1);l.target.add(i.multiplyScalar(-r*o)),l.target.add(m.multiplyScalar(a*o))}else l.azimuth-=r*u.orbitSpeed,l.elevation=Math.max(-u.maxElevation,Math.min(u.maxElevation,l.elevation+a*u.orbitSpeed));z();return}const e=T(t.clientX,t.clientY),n=e?V(e.path):[];(n.length!==v.length||n.some((r,a)=>r!==v[a]))&&(v=n,h.style.cursor=v.length?"pointer":"grab",M({type:"hover",object:e&&n.length?X(n,e.point):null}),z())});const at=t=>{if(y?.id!==t.pointerId)return;const e=!y.moved&&!y.pan,n=y.moved;if(y=void 0,h.style.cursor=v.length?"pointer":"grab",n&&D(),!e)return;const r=T(t.clientX,t.clientY);x=r?V(r.path):[],M({type:"select",object:r&&x.length?X(x,r.point):null}),z()};h.addEventListener("pointerup",at),h.addEventListener("pointercancel",at),h.addEventListener("pointerleave",()=>{v.length&&(v=[],M({type:"hover",object:null}),z())});let it;const rt=(t,e)=>{L++;const n=t/100*(e?4:1);l.distance=Math.max(u.minDistance,Math.min(u.maxDistance,l.distance*(1+u.dollyPerNotch)**n)),z(),q.clearTimeout(it),it=q.setTimeout(D,u.wheelRestMs)};h.addEventListener("wheel",t=>{t.preventDefault(),rt(t.deltaY,t.ctrlKey)},{passive:!1}),new ResizeObserver(z).observe(d);const E=[],W=t=>{const e=P(t);if(e.isEmpty())return;const n=e.getCenter(new p),{w:r,h:a}=j(),s=l.target.clone().sub(G(l));let o;try{const i=kt({boxes:[{min:e.min.toArray(),max:e.max.toArray()}],aspect:r/a,direction:s.toArray(),aim:n.toArray(),lens:u.lens,fill:u.fill,near:Math.max(.005,e.getSize(new p).length()/500)});o=new p(...i.position)}catch{return}E.push({...l,target:l.target.clone()}),A(Y(o,n))},st=t=>{const e=[];let n=w.scene;for(const r of t){let a;if(n.traverse(s=>{!a&&s!==n&&s.name===r&&(a=s)}),!a)return[];e.push(a),n=a}return e},ct=t=>{switch(t.type){case"camera":{const e=et(t.name);e&&(E.push({...l,target:l.target.clone()}),A(e));return}case"view":{E.push({...l,target:l.target.clone()}),A(Y(new p(...t.position),new p(...t.target)));return}case"wheel":rt(t.deltaY,t.ctrlKey);return;case"frame":{const e=st(t.path).pop();e&&W(e);return}case"shot":{F();const e=document.createElement("canvas");e.width=h.width,e.height=h.height;const n=e.getContext("2d");n&&(n.fillStyle=getComputedStyle(document.body).backgroundColor,n.fillRect(0,0,e.width,e.height),n.drawImage(h,0,0)),M({type:"shot",picture:e.toDataURL("image/webp",.9)});return}case"pick":{const e=T(t.x,t.y);M({type:"picked",id:t.id,object:e?X(e.path,e.point):null});return}case"back":{const e=E.pop();e&&A(e);return}case"select":x=t.path?st(t.path):[],z();return}};window.addEventListener("keydown",t=>{if(t.key==="Escape")E.length?ct({type:"back"}):x.length&&(x=x.slice(0,-1),M({type:"select",object:null}),z());else if((t.key==="f"||t.key==="F")&&x.length){const e=x[x.length-1];e&&W(e)}}),h.addEventListener("dblclick",t=>{const e=T(t.clientX,t.clientY),n=e?V(e.path).pop():void 0;n&&W(n)});const xt=S();return F(),M({type:"ready",cameras:Object.keys(B),ms:S()-xt}),D(),{command:ct}}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{writeCsv as
|
|
3
|
-
`,bom:r.bom??!0,finalNewline:!0})}
|
|
4
|
-
`)}
|
|
5
|
-
`}export function tableRows(t,n,r={}){const{sheet:o,at:e}=n,s=[];for(let i=0;i<n.rows;i++){const u={};for(const c of n.columns){const a=e.row+1+i,f=e.col+c.index;u[c.name]=dataValue(t.value(o,a,f),p(o,a,f),r.values)}s.push(u)}return s}export function jsonOf(t,n={}){const{wb:r}=t,o={};for(const e of r.sheets){const s={};for(const i of e.tables)s[i.name]=tableRows(t,i,n);o[e.name]={rows:g(e,(i,u)=>dataValue(t.value(e,i,u),p(e,i,u),n.values)),...e.tables.length>0?{tables:s}:{}}}return{...r.title===void 0?{}:{title:r.title},sheets:o}}
|
|
2
|
+
import{writeCsv as b}from"@allyhub/formats";import{isDateCode as x,shownValue as p}from"./format.js";import{CellError as h,dateOf as k}from"./values.js";const y=t=>(t.split(";")[0]??"").replace(/"[^"]*"|\\.|_.|\*./gu,"").replace(/\[(?![hms]+\])[^\]]*\]/giu,""),d=new Map;function $(t){if(t===void 0)return;if(d.has(t))return d.get(t);let n;if(x(t)){const r=y(t).toLowerCase(),e=/\[(h+|m+|s+)\]/u.test(r),o=[...r.matchAll(/\[?([ydhms])\1*\]?|am\/pm|a\/p/gu)].map(u=>u[0]);let s=!1,i=!1,f=!1;for(const[u,c]of o.entries()){const a=c.replace(/[[\]]/gu,"")[0];if(a==="y"||a==="d")s=!0;else if(a==="h"||c.includes("/"))i=!0;else if(a==="s")i=!0,f=!0;else if(a==="m"){const M=o[u-1]?.replace(/[[\]]/gu,"")[0],S=o[u+1]?.replace(/[[\]]/gu,"")[0];c.startsWith("[")||M==="h"||S==="s"?i=!0:s=!0}}e?n={kind:"duration",seconds:f}:s&&i?n={kind:"datetime",seconds:f}:i?n={kind:"time",seconds:f}:s&&(n={kind:"date",seconds:!1})}return d.set(t,n),n}const m=864e5,A=2958465,l=(t,n=2)=>String(t).padStart(n,"0");export const excelNumber=t=>t===0?0:Number(t.toPrecision(15));function g(t,n,r=2){const e=Math.floor(t/1e3),o=t%1e3;let s=`${l(Math.floor(e/3600),r)}:${l(Math.floor(e/60)%60)}`;return(n||e%60!==0||o!==0)&&(s+=`:${l(e%60)}`),o!==0&&(s+=`.${l(o,3).replace(/0+$/u,"")}`),s}function T(t){const n=t<0?"-":"";let r=Math.abs(t);const e=Math.floor(r/36e5);r-=e*36e5;const o=Math.floor(r/6e4);r-=o*6e4;const s=[e>0?`${String(e)}H`:"",o>0?`${String(o)}M`:"",r>0?`${String(r/1e3)}S`:""].join("");return`${n}PT${s||"0S"}`}function w(t,n,r){const e=Math.round(t*m);if(n.kind==="duration")return r==="json"?T(e):`${e<0?"-":""}${g(Math.abs(e),n.seconds,1)}`;if(t<0||t>=A+1)return;const o=Math.floor(e/m),s=g(e-o*m,n.seconds||r==="json");if(o===0||n.kind==="time")return s;if(o===60)return;const{year:i,month:f,day:u}=k(o),c=`${l(i,4)}-${l(f)}-${l(u)}`;return n.kind==="date"?c:`${c}${r==="json"?"T":" "}${s}`}export function csvText(t,n,r="data"){if(t===null)return"";if(r==="shown")return p(t,n);if(typeof t=="boolean")return t?"TRUE":"FALSE";if(t instanceof h)return t.code;if(typeof t=="string")return t;const e=$(n);return(e&&w(t,e,"csv"))??String(excelNumber(t))}export function dataValue(t,n,r="data"){if(t===null)return null;if(r==="shown")return p(t,n);if(t instanceof h)return t.code;if(typeof t!="number")return t;const e=$(n);return(e&&w(t,e,"json"))??excelNumber(t)}const _=(t,n,r)=>t.lookAt(n,r).format;function j(t,n){const r=t.used;if(!r)return[];const e=[];for(let o=0;o<=r.bottom;o++){const s=[];for(let i=0;i<=r.right;i++)s.push(n(o,i));e.push(s)}return e}export function csvOf(t,n,r={}){const e=j(n,(o,s)=>csvText(t.value(n,o,s),_(n,o,s),r.values));return b(e,{delimiter:",",newline:`\r
|
|
3
|
+
`,bom:r.bom??!0,finalNewline:!0})}export function tableRows(t,n,r={}){const{sheet:e,at:o}=n,s=[];for(let i=0;i<n.rows;i++){const f={};for(const u of n.columns){const c=o.row+1+i,a=o.col+u.index;f[u.name]=dataValue(t.value(e,c,a),_(e,c,a),r.values)}s.push(f)}return s}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export*from"./address.js";export{patchCsv}from"./patch.js";export{printedFacts,printedLines}from"./printed.js";export*from"./values.js";export*from"./workbook.js";export*from"./calc/remote.js";export*from"./calc/server.js";export{CODE as SHEET_CODE,ENTRY as SHEET_ENTRY,codeOf,dataFilesOf,readSheetFile}from"./file.js";export{GENERATED,ordinarySheet,typedNumbers,withGenerated}from"./generated.js";export{applyScenario,cellOfName,scenarioNames,scenariosByCell}from"./scenario.js";export{fileCells,hasFiles,isPicture,pictureHeight,pictureSize}from"./files.js";export*from"./formula/ast.js";export{parseFormula}from"./formula/parse.js";export{printFormula,sheetPrefix}from"./formula/print.js";export{moveFormula}from"./formula/move.js";export{rewriteFormula}from"./formula/rewrite.js";export{Calc,ITERATION_DEFAULTS,seededRandom}from"./calc/engine.js";export{analyse}from"./calc/analyse.js";export{FUNCTIONS}from"./calc/functions/index.js";export{Reference}from"./calc/types.js";export{checkWorkbook,placeName}from"./check.js";export{csvOf,csvText,dataValue,excelNumber,
|
|
2
|
+
export*from"./address.js";export{patchCsv}from"./patch.js";export{printedFacts,printedLines}from"./printed.js";export*from"./values.js";export*from"./workbook.js";export*from"./calc/remote.js";export*from"./calc/server.js";export{CODE as SHEET_CODE,ENTRY as SHEET_ENTRY,codeOf,dataFilesOf,readSheetFile}from"./file.js";export{GENERATED,ordinarySheet,typedNumbers,withGenerated}from"./generated.js";export{applyScenario,cellOfName,scenarioNames,scenariosByCell}from"./scenario.js";export{fileCells,hasFiles,isPicture,pictureHeight,pictureSize}from"./files.js";export*from"./formula/ast.js";export{parseFormula}from"./formula/parse.js";export{printFormula,sheetPrefix}from"./formula/print.js";export{moveFormula}from"./formula/move.js";export{rewriteFormula}from"./formula/rewrite.js";export{Calc,ITERATION_DEFAULTS,seededRandom}from"./calc/engine.js";export{analyse}from"./calc/analyse.js";export{FUNCTIONS}from"./calc/functions/index.js";export{Reference}from"./calc/types.js";export{checkWorkbook,placeName}from"./check.js";export{csvOf,csvText,dataValue,excelNumber,tableRows}from"./export.js";export{generalForms,generalText,isDateCode,shownColor,shownValue}from"./format.js";export{DEFAULT_COLUMN_WIDTH,DEFAULT_ROW_HEIGHT,headerFooterHtml,sheetHtml,SheetPrint}from"./html.js";export{PAPERS,PRINT_DEFAULTS,paginate}from"./paginate.js";export{DEFAULT_TABLE_STYLE,tableStyleLook,tableStyleOf}from"./table-style.js";export{PROFILE_TOP,profileTable}from"./profile.js";export{importRows}from"./import.js";export{patchYaml,writeYaml}from"./write.js";export*from"./edit.js";export*from"./arrange.js";export{NO_LOOK,autoFill,copyLooks,fillDownTo,moveCells,pasteLooks}from"./fill.js";export{seriesAfter}from"./series.js";export{compareForSort,hasHeader,sortCells,sortedOrder,sortedRows}from"./sort.js";export{filterChoices,filteredRows,regionAround}from"./filter.js";export{Rules,colorBetween,compareValues,holds,iconShape}from"./rules.js";export{choicesIn,invalidCells,joinChoices,listValues,separatorOf,valid}from"./validate.js";export{freeColumn,restructure,tableShape,uniqueColumn,withColumnsUpTo}from"./structure.js";export{SHEET_CHART_DEFAULTS,chartAfter,chartDataRange,chartDef,chartOfRange,chartPlace,chartSize,chartSvg,readDataRange}from"./chart.js";export{INSPECT_DEFAULTS,SHEET_FACT_KINDS,inspectWorkbook}from"./inspect.js";export{DIFF_DEFAULTS,diffWorkbooks}from"./diff.js";
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFileSync as _}from"node:fs";import{mkdir as
|
|
3
|
-
`))});if(!p
|
|
4
|
-
|
|
5
|
-
${j(a,s,c)}`:j(a,s,c)).join(`
|
|
6
|
-
`)]):m.push([o,`${JSON.stringify(D(a,c),null,2)}
|
|
7
|
-
`]);for(const[s,d]of m)await b(s,d),u.push({type:n,files:[s]})}return u}
|
|
2
|
+
import{readFileSync as _}from"node:fs";import{mkdir as j,writeFile as x}from"node:fs/promises";import{basename as S,dirname as b,join as F,posix as $}from"node:path";import{nodeLending as L}from"@allyhub/build";import{readSheetSource as R,workbookFiles as T}from"./code.js";import{printPage as k,printPdf as A,SHEET_FONT as v,sheetFontsCss as E}from"@allyhub/doc-print";import{checkWorkbook as H,csvOf as z,printedLines as D,seededRandom as G,sheetHtml as U,SheetPrint as W}from"@allyhub/sheet";import{writeXlsx as I}from"@allyhub/sheet/xlsx";export const SHEET_TYPES=["xlsx","pdf","png","csv"];export function csvNames(n){const e=new Set;return n.map((t,i)=>{const s=t.normalize("NFC").replace(/[\\/:*?"<>|\p{Cc}]+/gu,"-").replace(/\s+/gu," ").trim().replace(/^\.+/u,"")||String(i+1);let a=s;for(let r=2;e.has(a.toLowerCase());r++)a=`${s} (${String(r)})`;return e.add(a.toLowerCase()),a})}export const PNG_ROWS=700,PNG_COLUMNS=200;const M=1e4,J=40;function X(n){const e=n.values,t=n.bom;return{...e==="data"||e==="shown"?{values:e}:{},...typeof t=="boolean"?{bom:t}:{}}}function Y(n){const e=[];let t=0,i=0;return n.job.pages.forEach((s,a)=>{const r=(s.down.to-s.down.from+s.of.titleRows.length)*(s.across.to-s.across.from+s.of.titleCols.length);a>t&&(i+r>M||a-t>=J)&&(e.push([t,a]),t=a,i=0),i+=r}),t<n.job.pages.length&&e.push([t,n.job.pages.length]),e}function q(){const n=Number(process.env.SOURCE_DATE_EPOCH);return Number.isFinite(n)&&n>0?new Date(n*1e3):new Date}export async function printSheet(n,e){const t=new W(n,e.picture===void 0?{}:{file:e.picture}),i=Y(t),s=e.date??q();return await A({file:e.file,title:e.title,tagged:!1,...e.signal===void 0?{}:{signal:e.signal},parts:{count:Math.max(1,i.length),html:async a=>{const[r,u]=i[a]??[0,0],p=t.html(r,u,{name:e.name,date:s,font:v});return p.replace("<style>",`<style>${await E(p)}`)}}}),t.job.pages.length}export async function renderSheet(n,e){const t=e.prepared.sheets.find(o=>o.place===n.id);if(!t||e.types.length===0)return[];const{root:i,log:s}=e,a=X(e.params);s?.(`Rendering ${t.file}…`);const r=await R(i,t.file,{lend:await L(e.prepared.kinds,i)});if(r.failed)return s?.(`${t.file}: its code does not run. allyhub check says why.`),[];const{workbook:u,calc:p}=H(T(i,r),{random:G([r.text,...r.csv.values(),r.generated?JSON.stringify(r.generated):""].join(`
|
|
3
|
+
`))});if(!u||!p)return[];const h=o=>{const c=$.normalize($.join(t.dir,o));try{return c.startsWith("..")?void 0:new Uint8Array(_(F(i,c)))}catch{return}},m=[],C=u.sheets.length>1,g=t.place;for(const o of e.types){const c=e.out(o);await j(b(c),{recursive:!0});const w=S(c,`.${o}`),N=u.title??t.title??S(t.place);if(o==="pdf"){await printSheet(p,{file:c,name:w,title:N,picture:h}),m.push({type:o,files:[c]});continue}if(o==="png"){const l=U(p,{font:v,file:h,rows:PNG_ROWS,columns:PNG_COLUMNS,headings:!1}),f=l.cut.map(d=>`${g}.png: ${d}`);await k({html:l.html.replace("<style>",`<style>${await E(l.html)}`),out:b(c),name:w,types:["png"],width:l.width+48,pictureCss:"body{padding:24px}"}),m.push({type:o,files:[c],...f.length?{notes:f}:{}});continue}if(o==="xlsx"){const{bytes:l,left:f}=I(p,{file:h});await x(c,l);for(const d of D(`${g}.xlsx`,p))s?.(d);m.push({type:o,files:[c],...f.length?{notes:f.map(d=>`${g}.xlsx does not hold ${d}.`)}:{}});continue}if(o!=="csv")continue;const y=[],P=c.slice(0,-`.${o}`.length),O=csvNames(u.sheets.map(l=>l.name));u.sheets.forEach((l,f)=>{y.push([C?`${P}-${O[f]??String(f+1)}.csv`:c,z(p,l,a)])});for(const[l,f]of y)await x(l,f),m.push({type:o,files:[l]})}return m}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/sheet-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./code": {
|
|
@@ -72,9 +72,7 @@
|
|
|
72
72
|
"xlsx",
|
|
73
73
|
"pdf",
|
|
74
74
|
"png",
|
|
75
|
-
"csv"
|
|
76
|
-
"md",
|
|
77
|
-
"json"
|
|
75
|
+
"csv"
|
|
78
76
|
],
|
|
79
77
|
"extras": []
|
|
80
78
|
},
|
|
@@ -83,9 +81,7 @@
|
|
|
83
81
|
"xlsx",
|
|
84
82
|
"pdf",
|
|
85
83
|
"png",
|
|
86
|
-
"csv"
|
|
87
|
-
"md",
|
|
88
|
-
"json"
|
|
84
|
+
"csv"
|
|
89
85
|
],
|
|
90
86
|
"defaults": [
|
|
91
87
|
"xlsx"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as f}from"node:fs/promises";import{dirname as m}from"node:path";import{RenderError as p,renderStills as u,requireTools as l}from"@allyhub/render";import{OpenedFilm as g}from"@allyhub/video-measure";import{renderDeckPptx as h}from"./deck-pptx.js";import{deckOf as d}from"./deck-info.js";const w=["pdf","pptx","png"];function
|
|
2
|
+
import{mkdir as f}from"node:fs/promises";import{dirname as m}from"node:path";import{RenderError as p,renderStills as u,requireTools as l}from"@allyhub/render";import{OpenedFilm as g}from"@allyhub/video-measure";import{renderDeckPptx as h}from"./deck-pptx.js";import{deckOf as d}from"./deck-info.js";const w=["pdf","pptx","png"];function x(e){const t=e.piece.title;return typeof t=="string"?t:t===void 0?void 0:t[e.target.combo.lang??""]??Object.values(t)[0]}export async function deckReady(e,t){const n=t.codec;await l(e,typeof n=="string"?n:void 0)}async function y(e,t,n,i){const o=i.params;if(t==="pptx"&&d(e.piece)&&o.pptx!=="picture"){const s=o.slide,c=await h(e,n,typeof s=="number"?{only:s}:{});if(c)return i.onProgress?.(1),{type:t,...c};if(typeof s=="number")throw new p("no-slide",`${e.target.piece} has no slide ${String(s)} to write alone.`)}if(!w.includes(t))throw new p("unknown-type",`A deck is not made into ${t}: pdf, png or pptx.`);const r=x(e),a=await u(e,t,{out:n,...o.steps===!0?{steps:!0}:{},...d(e.piece)&&(t==="png"||t==="pptx")?{stills:s=>e.partStills(s.map(c=>({part:c.part.key,step:c.step,width:e.timeline.width,format:"png"})))}:{},...r===void 0?{}:{title:r}});return i.onProgress?.(1),{type:t,files:a.files??[a.out]}}export async function renderDeck(e){if(!e.version)throw new Error("A deck's files are made from a version.");const t=new g(e.version),n=[];for(const i of e.types){const o=e.out(i);await f(m(o),{recursive:!0});try{n.push(await y(t,i,o,e))}catch(r){if(e.signal?.aborted||!(r instanceof p))throw r;n.push({type:i,failure:{code:r.code,message:r.message,...r.hint?{hint:r.hint}:{}}})}}return n}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/slides-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./tools": {
|
|
@@ -78,20 +78,8 @@
|
|
|
78
78
|
"pdf",
|
|
79
79
|
"png"
|
|
80
80
|
],
|
|
81
|
-
"extras": [
|
|
82
|
-
"cover"
|
|
83
|
-
],
|
|
81
|
+
"extras": [],
|
|
84
82
|
"options": [
|
|
85
|
-
{
|
|
86
|
-
"name": "pptx",
|
|
87
|
-
"only": [
|
|
88
|
-
"pptx"
|
|
89
|
-
],
|
|
90
|
-
"values": [
|
|
91
|
-
"native",
|
|
92
|
-
"picture"
|
|
93
|
-
]
|
|
94
|
-
},
|
|
95
83
|
{
|
|
96
84
|
"name": "steps",
|
|
97
85
|
"only": [
|
|
@@ -105,8 +93,7 @@
|
|
|
105
93
|
"types": [
|
|
106
94
|
"pdf",
|
|
107
95
|
"png",
|
|
108
|
-
"pptx"
|
|
109
|
-
"cover"
|
|
96
|
+
"pptx"
|
|
110
97
|
],
|
|
111
98
|
"defaults": [
|
|
112
99
|
"pdf"
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
2
|
import{adjustmentDefaults as R,chartDrawing as I,colorRgb as P,CONNECTOR_STYLE as B,DECK_FONTS as G,EMU_PER_PT as w,isConnectorGeometry as Z,Pt as U,runLang as W}from"@allyhub/slides-core";import{presetOutline as C}from"@allyhub/ooxml/geometry";export const SHAPE_ATTR="data-ak-shape",LINE_WIDTH=U(.75),SINGLE_SPACING=1.2,MIN_FONT_SCALE=.25;export function themeCss(e){const t={};for(const[i,r]of Object.entries(e.colors))t[`--ak-theme-${i}`]=r;return t["--ak-theme-major"]=y(e.fonts.major,A),t["--ak-theme-minor"]=y(e.fonts.minor,A),t["--ak-theme-major-ea"]=y(e.fonts.major_east_asian,_),t["--ak-theme-minor-ea"]=y(e.fonts.minor_east_asian,_),t}const _='"Noto Sans SC", sans-serif',A=`"${G.minor}", ${_}`,y=(e,t)=>e.includes(",")||e.includes('"')?e:`"${e}", ${t}`;export const colorCss=(e,t)=>e==null?"transparent":P(e,t);const O=e=>e===void 0?void 0:e==="+mj-lt"?"var(--ak-theme-major)":e==="+mn-lt"?"var(--ak-theme-minor)":y(e,A),K={l:"left",ctr:"center",r:"right",just:"justify"},q={t:"flex-start",ctr:"center",b:"flex-end"},J=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\u2E80-\u2FDF\u3000-\u303F\uFF00-\uFFEF]/u,V=/[\u2018\u2019\u201C\u201D\u2026\u2014\u2013\u2025\u00B7]/u;export function eastAsianRuns(e,t){const i=[];for(const r of e){const o=J.test(r)||t&&V.test(r),n=i.at(-1);n?.ea===o?n.text+=r:i.push({text:r,ea:o})}return i}const h=e=>`calc(${String(e)}px * var(--ak-fit, 1))`;function M(e,t,i,r){if(!t)return;const o=O(t.name);o&&(e.style.fontFamily=o),t.size!==void 0&&(e.style.fontSize=h(t.size*i)),t.bold!==void 0&&(e.style.fontWeight=t.bold?"700":"400"),t.italic!==void 0&&(e.style.fontStyle=t.italic?"italic":"normal"),(t.underline!==void 0||t.strike!==void 0||t.link)&&(e.style.textDecorationLine=[t.underline===!0||t.link!==void 0?"underline":"",t.strike===!0?"line-through":""].filter(n=>n!=="").join(" ")||"none"),t.highlight!==void 0&&(e.style.backgroundColor=t.highlight),t.baseline!==void 0&&t.baseline!==0&&(e.style.fontSize=t.size===void 0?"0.66em":h(t.size*i*.66),e.style.verticalAlign=`${String(t.baseline/.66)}em`),t.spacing!==void 0&&(e.style.letterSpacing=h(t.spacing*i)),t.link!==void 0?e.style.color=colorCss("hlink",r):t.color!==void 0&&(e.style.color=colorCss(t.color,r))}function Y(){if(document.getElementById("ak-bullet-style"))return;const e=document.createElement("style");e.id="ak-bullet-style",e.textContent="[data-ak-bullet]::before{content:attr(data-ak-bullet)}",document.head.append(e)}export function paragraphStyle(e,t){const i=t[e.level]??t[0];if(!i)throw new Error("A text style has nine levels.");return{...i,...e.alignment===void 0?{}:{alignment:e.alignment},...e.line_spacing===void 0?{}:{line_spacing:e.line_spacing},...e.space_before===void 0?{}:{space_before:e.space_before},...e.space_after===void 0?{}:{space_after:e.space_after},...e.margin_left===void 0?{}:{margin_left:e.margin_left},...e.indent===void 0?{}:{indent:e.indent},...e.numbered===void 0?{}:{numbered:e.numbered},font:{...i.font,...e.font}}}export function numberText(e,t){const i=o=>(o>26?i(Math.floor((o-1)/26)):"")+String.fromCharCode(97+(o-1)%26),r=o=>{const n=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];let s="",a=o;for(const[c,d]of n)for(;a>=c;)s+=d,a-=c;return s};return e==="arabicParenR"?`${String(t)})`:e==="alphaLcPeriod"?`${i(t)}.`:e==="alphaUcPeriod"?`${i(t).toUpperCase()}.`:e==="romanLcPeriod"?`${r(t)}.`:e==="romanUcPeriod"?`${r(t).toUpperCase()}.`:`${String(t)}.`}export function paragraphLabels(e,t){const i=[];return e.map(r=>{const o=paragraphStyle(r,t);i.length=r.level+1,o.numbered===void 0?i[r.level]=0:i[r.level]=(i[r.level]??0)+1;const n=r.runs.some(s=>s.text!==""&&s.text!=="\v");return o.numbered===void 0?n?o.bullet?.char:void 0:numberText(o.numbered,i[r.level]??1)})}export function paragraphElement(e,t,i,r,o,n){const s=paragraphStyle(e,i),a=document.createElement("div");a.dataset.akParagraph=String(t),a.dataset.akLevel=String(e.level);const c=e.runs.map(l=>l.font?.size??s.font.size),d=(c.length>0?Math.max(...c):s.font.size)*o,u="lines"in s.line_spacing?String(s.line_spacing.lines*SINGLE_SPACING):h(s.line_spacing.fixed*o),f=s.numbered===void 0&&r!==void 0;if(Object.assign(a.style,{position:"relative",textAlign:K[s.alignment],paddingLeft:`${String(s.margin_left*o)}px`,textIndent:f?"0px":`${String(s.indent*o)}px`,marginTop:t===0?"0px":h(s.space_before*o),marginBottom:h(s.space_after*o),lineHeight:u,fontSize:h(d),minHeight:"lines"in s.line_spacing?h(d*s.line_spacing.lines*SINGLE_SPACING):u}),M(a,s.font,o,n),a.style.fontSize=h(d),r!==void 0){Y();const l=document.createElement("span");l.dataset.akBullet=r;const m=s.numbered===void 0?s.bullet?.font:void 0;Object.assign(l.style,{position:"absolute",left:`${String((s.margin_left+s.indent)*o)}px`,...m===void 0?{}:{fontFamily:O(m)}}),a.append(l)}return a}export const exactSpacing=(e,t)=>!("lines"in paragraphStyle(e,t).line_spacing);export function runElement(e,t,i,r=!1,o){const n=document.createElement("span");M(n,e.font,t,i);const s=e.text===void 0?o:W(e.text,o);return s!==void 0&&s!==o&&(n.lang=s),r&&(n.style.lineHeight="0"),e.font?.link!==void 0&&(n.dataset.akLink=e.font.link),n}export function eastAsianFace(e,t){return`var(--ak-theme-${(e.font?.name??t)==="+mj-lt"?"major":"minor"}-ea)`}function Q(e,t,i,r,o){const n=isCjk(r);e.replaceChildren();const s=t.paragraphs.length>0?t.paragraphs:[{runs:[],level:0}],a=paragraphLabels(s,t.style.levels);s.forEach((c,d)=>{const u=paragraphElement(c,d,t.style.levels,a[d],i,o),f=paragraphStyle(c,t.style.levels).font.name,l=exactSpacing(c,t.style.levels);for(const m of c.runs){const g=runElement(m,i,o,l,r),b=eastAsianFace(m,f);for(const p of eastAsianRuns(m.text.replaceAll("\v",`
|
|
3
|
-
`),n)){if(!p.ea){g.append(p.text);continue}const S=document.createElement("span");S.style.fontFamily=b,S.textContent=p.text,g.append(S)}u.append(g)}e.append(u)})}export const isCjk=e=>e!==void 0&&/^(zh|ja|ko)(-|$)/iu.test(e);function v(e,t,i,r,o){const{style:n}=e,s=n.auto_size==="shape",a=document.createElement("div");a.dataset.akText="",a.dataset.akAutofit=n.auto_size;const c=s?void 0:o;Object.assign(a.style,{position:s?"relative":"absolute",inset:s?"auto":c?`${String(c.top)}px calc(100% - ${String(c.right)}px) calc(100% - ${String(c.bottom)}px) ${String(c.left)}px`:"0px",minHeight:c?`${String(c.bottom-c.top)}px`:"100%",display:"flex",flexDirection:"column",justifyContent:q[n.vertical_anchor],padding:`${String(n.margins.top*t)}px ${String(n.margins.right*t)}px ${String(n.margins.bottom*t)}px ${String(n.margins.left*t)}px`,whiteSpace:n.word_wrap?"pre-wrap":"pre",overflowWrap:"break-word",boxSizing:"border-box"});const d=document.createElement("div");if(d.dataset.akBody="",a.append(d),Q(d,e,t,i,r),!n.word_wrap){Object.assign(d.style,{display:"flex",flexDirection:"column"});for(const u of d.children){if(!(u instanceof HTMLElement))continue;const f=u.style.textAlign;Object.assign(u.style,{width:"max-content",minWidth:"100%",boxSizing:"border-box",alignSelf:f==="center"?"center":f==="right"?"flex-end":"flex-start"})}}return i!==void 0&&(a.lang=i),isCjk(i)&&(a.dataset.akCjk=""),a}export function fitText(e){const t=e.querySelector("[data-ak-body]");if(!t||e.dataset.akAutofit!=="text")return 1;const i=e.clientHeight-parseFloat(getComputedStyle(e).paddingTop)-parseFloat(getComputedStyle(e).paddingBottom),r=s=>(e.style.setProperty("--ak-fit",String(s)),t.scrollHeight<=i+.5);if(r(1))return delete e.dataset.akFontScale,1;let o=MIN_FONT_SCALE,n=1;if(!r(o))return e.dataset.akFontScale=o.toFixed(2),o;for(;n-o>.01;){const s=(o+n)/2;r(s)?o=s:n=s}return r(o),e.dataset.akFontScale=o.toFixed(2),o}function k(e,t,i,r){const o=e.split(" "),n=[],s=a=>{const c=Number(o[a]),d=Number(o[a+1]);return[r?.h?t-c:c,r?.v?i-d:d]};for(let a=0;a<o.length;){const c=o[a++];c==="M"||c==="L"?(n.push({op:c,at:[s(a)]}),a+=2):c==="C"?(n.push({op:c,at:[s(a),s(a+2),s(a+4)]}),a+=6):c==="Z"&&n.push({op:c})}return n}const E=e=>e.map(t=>t.op==="Z"?"Z":`${t.op}${t.at.map(([i,r])=>`${String(i)} ${String(r)}`).join(" ")}`).join(" ");function X(e,t){const i=e.flatMap(n=>n.op==="Z"?[]:n.at),r=t?[...i].reverse():i,o=r[0];if(o)for(const n of r.slice(1)){const s=Math.hypot(o[0]-n[0],o[1]-n[1]);if(s>1e-6)return{at:o,out:[(o[0]-n[0])/s,(o[1]-n[1])/s]}}}function tt(e,t,i,r){const o=e.filter(a=>a.op!=="Z"),n=t?o[o.length-1]:o[0];if(!n)return;const s=t?n.at.slice(n.op==="C"?-2:-1):[...n.at,...o[1]?.op==="C"?o[1].at.slice(0,1):[]];for(const a of s)a[0]+=i,a[1]+=r}function et(e,t,i,r,o){if(t.line===null)return;const n=t.frame.width*i,s=t.frame.height*i,a=(C(t.geometry??"line",n,s,t.adjustments)?.paths??[]).filter(g=>g.stroke).map(g=>k(g.d,n,s,t.flip)),c=a[0],d=a[a.length-1];if(!c||!d)return;const u="http://www.w3.org/2000/svg",f=document.createElementNS(u,"svg");f.setAttribute("width",String(Math.max(n,1))),f.setAttribute("height",String(Math.max(s,1))),Object.assign(f.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"});const l=colorCss(t.line??B.line,o),m=L(t,c,d,r,i,l);for(const g of a){const b=document.createElementNS(u,"path");b.setAttribute("d",E(g)),b.setAttribute("fill","none"),b.setAttribute("stroke",l),b.setAttribute("stroke-width",String(r));const p=F(t.line_dash,r);p&&b.setAttribute("stroke-dasharray",p),f.append(b)}f.append(...m),e.append(f)}const nt={sysDash:[3,1],sysDot:[1,1],dash:[4,3],dashDot:[4,3,1,3],lgDash:[8,3],lgDashDot:[8,3,1,3],lgDashDotDot:[8,3,1,3,1,3]},F=(e,t)=>e&&nt[e]?.map(i=>String(i*t)).join(" "),it=25200,N={sm:2,med:3,lg:5};function L(e,t,i,r,o,n,s={begin:!0,end:!0}){const a=Math.max(r,it*o),c=[];for(const[d,u,f,l,m]of[[e.line_begin,e.line_begin_size,t,!1,s.begin],[e.line_end,e.line_end_size,i,!0,s.end]]){if(!m||d===void 0||d==="none")continue;const g=X(f,l);if(!g)continue;const b=d==="arrow"?.5:0,p=a*(N[u?.len??"med"]+b),S=a*(N[u?.w??"med"]+b);c.push(ot(d,g.at,g.out,p,S,r,n)),d!=="arrow"&&tt(f,l,-g.out[0]*p/2,-g.out[1]*p/2)}return c}function ot(e,[t,i],[r,o],n,s,a,c){const d="http://www.w3.org/2000/svg",u=(g,b)=>`${String(t-r*g-o*b)},${String(i-o*g+r*b)}`;if(e==="oval"){const g=document.createElementNS(d,"ellipse");return g.setAttribute("cx",String(t)),g.setAttribute("cy",String(i)),g.setAttribute("rx",String(n/2)),g.setAttribute("ry",String(s/2)),g.setAttribute("transform",`rotate(${String(Math.atan2(o,r)*180/Math.PI)} ${String(t)} ${String(i)})`),g.setAttribute("fill",c),g}const f=e==="arrow",l=document.createElementNS(d,f?"polyline":"polygon"),m={triangle:[u(0,0),u(n,s/2),u(n,-s/2)],stealth:[u(0,0),u(n,s/2),u(n*.7,0),u(n,-s/2)],diamond:[u(-n/2,0),u(0,s/2),u(n/2,0),u(0,-s/2)],arrow:[u(n,s/2),u(0,0),u(n,-s/2)]}[e];return l.setAttribute("points",m.join(" ")),f?(l.setAttribute("fill","none"),l.setAttribute("stroke",c),l.setAttribute("stroke-width",String(a))):l.setAttribute("fill",c),l}function rt(e,t,i,r,o,n){const s=t.frame.width*r,a=t.frame.height*r,c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg");d.setAttribute("width",String(Math.max(s,1))),d.setAttribute("height",String(Math.max(a,1))),Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"}),z(d,t);let u=colorCss(t.fill,n);if(t.gradient){const p=`ak-gradient-${String(ct++)}`;d.append(dt(c,p,t.gradient,t.frame,n)),u=`url(#${p})`}const f=i.map(p=>p.d),l=[],m=i.flatMap((p,S)=>p.stroke?[S]:[]),g=m[0],b=m[m.length-1];if(t.line!==void 0&&t.line!==null&&g!==void 0&&b!==void 0&&((t.line_begin??"none")!=="none"||(t.line_end??"none")!=="none")){const p=k(f[g]??"",s,a,void 0),S=g===b?p:k(f[b]??"",s,a,void 0),x=$=>$.at(-1)?.op!=="Z";l.push(...L(t,p,S,o,r,colorCss(t.line,n),{begin:x(p),end:x(S)})),f[g]=E(p),f[b]=E(S)}i.forEach((p,S)=>{const x=document.createElementNS(c,"path");if(x.setAttribute("d",f[S]??p.d),x.setAttribute("fill-rule","evenodd"),x.setAttribute("fill",p.fill==="none"||t.fill===null||t.fill===void 0?p.fill==="none"||!t.gradient?"none":u:p.fill==="norm"?u:st[p.fill](colorCss(t.fill,n))),t.fill_transparency!==void 0&&x.setAttribute("fill-opacity",String(1-t.fill_transparency)),p.stroke&&t.line!==void 0&&t.line!==null){x.setAttribute("stroke",colorCss(t.line,n)),x.setAttribute("stroke-width",String(o)),x.setAttribute("stroke-linejoin","round");const $=F(t.line_dash,o);$&&x.setAttribute("stroke-dasharray",$)}d.append(x)}),d.append(...l),e.append(d)}const st={darken:e=>`color-mix(in srgb, ${e} 60%, black)`,darkenLess:e=>`color-mix(in srgb, ${e} 80%, black)`,lighten:e=>`color-mix(in srgb, ${e} 60%, white)`,lightenLess:e=>`color-mix(in srgb, ${e} 80%, white)`};function lt(e,t){const i=e.path;if(!i)return[];const r=i.w===0?0:e.frame.width*t/i.w,o=i.h===0?0:e.frame.height*t/i.h;return[{d:i.steps.map(s=>s.op==="close"?"Z":s.op==="move"?`M ${String(s.x*r)} ${String(s.y*o)}`:s.op==="line"?`L ${String(s.x*r)} ${String(s.y*o)}`:`C ${String(s.x1*r)} ${String(s.y1*o)} ${String(s.x2*r)} ${String(s.y2*o)} ${String(s.x*r)} ${String(s.y*o)}`).join(" "),fill:"norm",stroke:!0}]}function z(e,t){!t.flip?.h&&!t.flip?.v||(e.style.transform=`scale(${t.flip.h?"-1":"1"}, ${t.flip.v?"-1":"1"})`)}const at=new Set(["rect","roundRect","ellipse"]),j=(e,t,i)=>t===void 0||t===0?colorCss(e,i):`color-mix(in srgb, ${colorCss(e,i)} ${String((1-t)*100)}%, transparent)`,D=(e,t)=>`linear-gradient(${String(e.angle+90)}deg, ${e.stops.map(i=>`${j(i.color,i.transparency,t)} ${String(i.at*100)}%`).join(", ")})`,T=(e,t)=>e.gradient?D(e.gradient,t):e.fill===null||e.fill===void 0?"transparent":j(e.fill,e.fill_transparency,t);let ct=0;function dt(e,t,i,r,o){const n=document.createElementNS(e,"linearGradient");n.id=t;const s=i.angle*Math.PI/180,a=Math.cos(s),c=Math.sin(s),d=(Math.abs(r.width*a)+Math.abs(r.height*c))/Math.max(r.width,r.height,1)/2;n.setAttribute("x1",String(.5-a*d)),n.setAttribute("y1",String(.5-c*d)),n.setAttribute("x2",String(.5+a*d)),n.setAttribute("y2",String(.5+c*d));for(const u of i.stops){const f=document.createElementNS(e,"stop");f.setAttribute("offset",String(u.at)),f.setAttribute("stop-color",colorCss(u.color,o)),u.transparency!==void 0&&f.setAttribute("stop-opacity",String(1-u.transparency)),n.append(f)}return n}function ut(e,t,i,r){const o=t.angle*Math.PI/180,n=t.distance*i;e.style.filter=`drop-shadow(${String(n*Math.cos(o))}px ${String(n*Math.sin(o))}px ${String(t.blur*i)}px ${j(t.color,t.transparency,r)})`}function ft(e,t,i){const r=t.geometry??"rect",o=t.frame.width*i,n=t.frame.height*i;r==="roundRect"?e.style.borderRadius=`${String(Math.min(o,n)*Math.min(.5,Math.max(0,t.adjustments?.[0]??R("roundRect")[0]??0)))}px`:r==="ellipse"&&(e.style.borderRadius="50%")}const gt={left:"borderLeft",right:"borderRight",top:"borderTop",bottom:"borderBottom"},H="http://www.w3.org/2000/svg";function mt(e,t,i,r,o){const n=i.width/w,s=i.height/w,a=r*w,c=I(t,n,s),d=document.createElementNS(H,"svg");d.setAttribute("viewBox",`0 0 ${String(n)} ${String(s)}`),d.setAttribute("width","100%"),d.setAttribute("height","100%"),Object.assign(d.style,{position:"absolute",inset:"0px",overflow:"visible"});const u=(l,m)=>{const g=document.createElementNS(H,l);for(const[b,p]of Object.entries(m))g.setAttribute(b,String(p));d.append(g)},f=l=>{u("path",{d:l.d,fill:l.fill===void 0?"none":colorCss(l.fill,o),stroke:l.width>0?colorCss(l.color,o):"none","stroke-width":l.width,"stroke-linejoin":"round"})};for(const l of[...c.grid,...c.shapes])f(l);for(const l of[...c.boxes,...c.keys])u("rect",{x:l.x,y:l.y,width:l.width,height:l.height,fill:colorCss(l.color,o)});for(const l of[...c.axes,...c.lines])f(l);for(const l of c.dots)u("circle",{cx:l.x,cy:l.y,r:l.r,fill:colorCss(l.color,o)});e.append(d);for(const l of c.words){const m=document.createElement("div");m.textContent=l.text,Object.assign(m.style,{position:"absolute",left:`${String(l.x*a)}px`,top:`${String(l.y*a)}px`,transform:`translate(${{start:"0",middle:"-50%",end:"-100%"}[l.anchor]}, -50%)`,fontSize:`${String(l.size*a)}px`,lineHeight:"1",whiteSpace:"nowrap",color:colorCss(l.color,o),fontFamily:"var(--ak-theme-minor)"}),e.append(m)}}function pt(e,t,i,r,o){const n=document.createElement("table");Object.assign(n.style,{borderCollapse:"collapse",tableLayout:"fixed",width:`${String(t.columns.reduce((a,c)=>a+c,0)*i)}px`});const s=document.createElement("colgroup");for(const a of t.columns){const c=document.createElement("col");c.style.width=`${String(a*i)}px`,s.append(c)}n.append(s);for(const[a,c]of t.rows.entries()){const d=document.createElement("tr");d.style.height=`${String(c.height*i)}px`;for(const[u,f]of c.cells.entries()){if(f.spanned)continue;const l=document.createElement("td");l.dataset.akCell=`${String(a)},${String(u)}`,f.span_width&&(l.colSpan=f.span_width),f.span_height&&(l.rowSpan=f.span_height),l.style.padding="0px",l.style.verticalAlign={t:"top",ctr:"middle",b:"bottom"}[f.text.style.vertical_anchor],f.fill!==void 0&&(l.style.background=colorCss(f.fill,o));for(const[g,b]of Object.entries(gt)){const p=f.borders?.[g];p&&(l.style[b]=`${String(p.width*i)}px solid ${colorCss(p.color,o)}`)}const m=v(f.text,i,r,o);m.style.minHeight="0px",l.append(m),d.append(l)}n.append(d)}e.style.height="auto",e.append(n)}export function drawShape(e,t,i){const{k:r,colors:o}=i;if(t.kind==="placeholder"&&t.text?.empty===!0&&!i.editing)return;const n=document.createElement("div");n.setAttribute(SHAPE_ATTR,`${e}/${t.name}`);const{left:s,top:a,width:c,height:d}=t.frame;Object.assign(n.style,{position:"absolute",left:`${String(s*r)}px`,top:`${String(a*r)}px`,width:`${String(c*r)}px`,height:`${String(d*r)}px`}),t.rotation!==void 0&&(n.style.transform=`rotate(${String(t.rotation)}deg)`);const u=(t.line_width??LINE_WIDTH)*r;if(t.chart)mt(n,t.chart,t.frame,r,o);else if(t.table)return pt(n,t.table,r,i.lang,o),n;t.shadow&&ut(n,t.shadow,r,o),t.alt!==void 0&&n.setAttribute("aria-label",t.alt);let f;if(t.kind==="autoshape"){if(!t.path&&Z(t.geometry))return et(n,t,r,u,o),n;const l=t.path?void 0:C(t.geometry??"rect",t.frame.width*r,t.frame.height*r,t.adjustments),m=t.line!==void 0&&t.line!==null&&t.line_dash!==void 0&&t.line_dash!=="solid",g=t.path?lt(t,r):at.has(t.geometry??"rect")&&!m?void 0:l?.paths;if(g)return rt(n,t,g,r,u,o),t.text&&n.append(v(t.text,r,i.lang,o,l?.text)),n;n.style.background=T(t,o),ft(n,t,r),f=l?.text}else(t.fill!==void 0||t.gradient)&&(n.style.background=T(t,o));if(t.line!==void 0&&t.line!==null&&(n.style.outline=`${String(u)}px ${t.line_dash===void 0||t.line_dash==="solid"?"solid":"dashed"} ${colorCss(t.line,o)}`,n.style.outlineOffset=`${String(-u/2)}px`),t.text?.style.auto_size==="shape"&&(n.style.height="auto",n.style.minHeight="0px"),t.kind==="picture"&&t.media){n.style.overflow="hidden";const l=document.createElement("img");l.alt=t.alt??"",l.src=i.url(t.media.path),z(l,t);const m=t.media.crop??{left:0,top:0,right:0,bottom:0},g=1-m.left-m.right,b=1-m.top-m.bottom;Object.assign(l.style,{position:"absolute",width:`${String(100/g)}%`,height:`${String(100/b)}%`,left:`${String(-m.left/g*100)}%`,top:`${String(-m.top/b*100)}%`,maxWidth:"none"}),t.flip&&(l.style.transformOrigin=`${String(50/g-m.left/g*100)}% ${String(50/b-m.top/b*100)}%`),n.append(l)}else if(t.kind==="movie"&&t.media&&!i.playing&&i.poster!==!0)n.dataset.akFilm="";else if(t.kind==="movie"&&t.media){const l=document.createElement("video");l.src=i.url(t.media.path),l.muted=!0,l.playsInline=!0,l.preload="auto",t.media.poster!==void 0&&(l.currentTime=t.media.poster),Object.assign(l.style,{width:"100%",height:"100%",objectFit:"fill",...i.playing?{}:{pointerEvents:"none"}}),n.append(l)}return t.text&&n.append(v(t.text,r,i.lang,o,f)),n}export function drawSlide(e,t){const i=document.createElement("div");i.dataset.akSlide=e.id,Object.assign(i.style,{position:"absolute",inset:"0px",background:colorCss(e.background,t.colors),overflow:"hidden"}),e.background_gradient&&(i.style.background=D(e.background_gradient,t.colors)),e.background_picture!==void 0&&(i.style.background=`${colorCss(e.background,t.colors)} url(${JSON.stringify(t.url(e.background_picture))}) center / 100% 100% no-repeat`);for(const r of e.shapes){const o=drawShape(e.id,r,t);o&&i.append(o)}return i}
|
|
3
|
+
`),n)){if(!p.ea){g.append(p.text);continue}const S=document.createElement("span");S.style.fontFamily=b,S.textContent=p.text,g.append(S)}u.append(g)}e.append(u)})}export const isCjk=e=>e!==void 0&&/^(zh|ja|ko)(-|$)/iu.test(e);function v(e,t,i,r,o){const{style:n}=e,s=n.auto_size==="shape",a=document.createElement("div");a.dataset.akText="",a.dataset.akAutofit=n.auto_size;const c=s?void 0:o;Object.assign(a.style,{position:s?"relative":"absolute",inset:s?"auto":c?`${String(c.top)}px calc(100% - ${String(c.right)}px) calc(100% - ${String(c.bottom)}px) ${String(c.left)}px`:"0px",minHeight:c?`${String(c.bottom-c.top)}px`:"100%",display:"flex",flexDirection:"column",justifyContent:q[n.vertical_anchor],padding:`${String(n.margins.top*t)}px ${String(n.margins.right*t)}px ${String(n.margins.bottom*t)}px ${String(n.margins.left*t)}px`,whiteSpace:n.word_wrap?"pre-wrap":"pre",overflowWrap:"break-word",boxSizing:"border-box"});const d=document.createElement("div");if(d.dataset.akBody="",a.append(d),Q(d,e,t,i,r),!n.word_wrap){Object.assign(d.style,{display:"flex",flexDirection:"column"});for(const u of d.children){if(!(u instanceof HTMLElement))continue;const f=u.style.textAlign;Object.assign(u.style,{width:"max-content",minWidth:"100%",boxSizing:"border-box",alignSelf:f==="center"?"center":f==="right"?"flex-end":"flex-start"})}}return i!==void 0&&(a.lang=i),isCjk(i)&&(a.dataset.akCjk=""),a}export function fitText(e){const t=e.querySelector("[data-ak-body]");if(!t||e.dataset.akAutofit!=="text")return 1;const i=e.clientHeight-parseFloat(getComputedStyle(e).paddingTop)-parseFloat(getComputedStyle(e).paddingBottom),r=s=>(e.style.setProperty("--ak-fit",String(s)),t.scrollHeight<=i+.5);if(r(1))return delete e.dataset.akFontScale,1;let o=MIN_FONT_SCALE,n=1;if(!r(o))return e.dataset.akFontScale=o.toFixed(2),o;for(;n-o>.01;){const s=(o+n)/2;r(s)?o=s:n=s}return r(o),e.dataset.akFontScale=o.toFixed(2),o}function k(e,t,i,r){const o=e.split(" "),n=[],s=a=>{const c=Number(o[a]),d=Number(o[a+1]);return[r?.h?t-c:c,r?.v?i-d:d]};for(let a=0;a<o.length;){const c=o[a++];c==="M"||c==="L"?(n.push({op:c,at:[s(a)]}),a+=2):c==="C"?(n.push({op:c,at:[s(a),s(a+2),s(a+4)]}),a+=6):c==="Z"&&n.push({op:c})}return n}const E=e=>e.map(t=>t.op==="Z"?"Z":`${t.op}${t.at.map(([i,r])=>`${String(i)} ${String(r)}`).join(" ")}`).join(" ");function X(e,t){const i=e.flatMap(n=>n.op==="Z"?[]:n.at),r=t?[...i].reverse():i,o=r[0];if(o)for(const n of r.slice(1)){const s=Math.hypot(o[0]-n[0],o[1]-n[1]);if(s>1e-6)return{at:o,out:[(o[0]-n[0])/s,(o[1]-n[1])/s]}}}function tt(e,t,i,r){const o=e.filter(a=>a.op!=="Z"),n=t?o[o.length-1]:o[0];if(!n)return;const s=t?n.at.slice(n.op==="C"?-2:-1):[...n.at,...o[1]?.op==="C"?o[1].at.slice(0,1):[]];for(const a of s)a[0]+=i,a[1]+=r}function et(e,t,i,r,o){if(t.line===null)return;const n=t.frame.width*i,s=t.frame.height*i,a=(C(t.geometry??"line",n,s,t.adjustments)?.paths??[]).filter(g=>g.stroke).map(g=>k(g.d,n,s,t.flip)),c=a[0],d=a[a.length-1];if(!c||!d)return;const u="http://www.w3.org/2000/svg",f=document.createElementNS(u,"svg");f.setAttribute("width",String(Math.max(n,1))),f.setAttribute("height",String(Math.max(s,1))),Object.assign(f.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"});const l=colorCss(t.line??B.line,o),m=L(t,c,d,r,i,l);for(const g of a){const b=document.createElementNS(u,"path");b.setAttribute("d",E(g)),b.setAttribute("fill","none"),b.setAttribute("stroke",l),b.setAttribute("stroke-width",String(r));const p=F(t.line_dash,r);p&&b.setAttribute("stroke-dasharray",p),f.append(b)}f.append(...m),e.append(f)}const nt={sysDash:[3,1],sysDot:[1,1],dash:[4,3],dashDot:[4,3,1,3],lgDash:[8,3],lgDashDot:[8,3,1,3],lgDashDotDot:[8,3,1,3,1,3]},F=(e,t)=>e&&nt[e]?.map(i=>String(i*t)).join(" "),it=25200,N={sm:2,med:3,lg:5};function L(e,t,i,r,o,n,s={begin:!0,end:!0}){const a=Math.max(r,it*o),c=[];for(const[d,u,f,l,m]of[[e.line_begin,e.line_begin_size,t,!1,s.begin],[e.line_end,e.line_end_size,i,!0,s.end]]){if(!m||d===void 0||d==="none")continue;const g=X(f,l);if(!g)continue;const b=d==="arrow"?.5:0,p=a*(N[u?.len??"med"]+b),S=a*(N[u?.w??"med"]+b);c.push(ot(d,g.at,g.out,p,S,r,n)),d!=="arrow"&&tt(f,l,-g.out[0]*p/2,-g.out[1]*p/2)}return c}function ot(e,[t,i],[r,o],n,s,a,c){const d="http://www.w3.org/2000/svg",u=(g,b)=>`${String(t-r*g-o*b)},${String(i-o*g+r*b)}`;if(e==="oval"){const g=document.createElementNS(d,"ellipse");return g.setAttribute("cx",String(t)),g.setAttribute("cy",String(i)),g.setAttribute("rx",String(n/2)),g.setAttribute("ry",String(s/2)),g.setAttribute("transform",`rotate(${String(Math.atan2(o,r)*180/Math.PI)} ${String(t)} ${String(i)})`),g.setAttribute("fill",c),g}const f=e==="arrow",l=document.createElementNS(d,f?"polyline":"polygon"),m={triangle:[u(0,0),u(n,s/2),u(n,-s/2)],stealth:[u(0,0),u(n,s/2),u(n*.7,0),u(n,-s/2)],diamond:[u(-n/2,0),u(0,s/2),u(n/2,0),u(0,-s/2)],arrow:[u(n,s/2),u(0,0),u(n,-s/2)]}[e];return l.setAttribute("points",m.join(" ")),f?(l.setAttribute("fill","none"),l.setAttribute("stroke",c),l.setAttribute("stroke-width",String(a))):l.setAttribute("fill",c),l}function rt(e,t,i,r,o,n){const s=t.frame.width*r,a=t.frame.height*r,c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg");d.setAttribute("width",String(Math.max(s,1))),d.setAttribute("height",String(Math.max(a,1))),Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"}),z(d,t);let u=colorCss(t.fill,n);if(t.gradient){const p=`ak-gradient-${String(ct++)}`;d.append(dt(c,p,t.gradient,t.frame,n)),u=`url(#${p})`}const f=i.map(p=>p.d),l=[],m=i.flatMap((p,S)=>p.stroke?[S]:[]),g=m[0],b=m[m.length-1];if(t.line!==void 0&&t.line!==null&&g!==void 0&&b!==void 0&&((t.line_begin??"none")!=="none"||(t.line_end??"none")!=="none")){const p=k(f[g]??"",s,a,void 0),S=g===b?p:k(f[b]??"",s,a,void 0),x=$=>$.at(-1)?.op!=="Z";l.push(...L(t,p,S,o,r,colorCss(t.line,n),{begin:x(p),end:x(S)})),f[g]=E(p),f[b]=E(S)}i.forEach((p,S)=>{const x=document.createElementNS(c,"path");if(x.setAttribute("d",f[S]??p.d),x.setAttribute("fill-rule","evenodd"),x.setAttribute("fill",p.fill==="none"||t.fill===null||t.fill===void 0?p.fill==="none"||!t.gradient?"none":u:p.fill==="norm"?u:st[p.fill](colorCss(t.fill,n))),t.fill_transparency!==void 0&&x.setAttribute("fill-opacity",String(1-t.fill_transparency)),p.stroke&&t.line!==void 0&&t.line!==null){x.setAttribute("stroke",colorCss(t.line,n)),x.setAttribute("stroke-width",String(o)),x.setAttribute("stroke-linejoin","round");const $=F(t.line_dash,o);$&&x.setAttribute("stroke-dasharray",$)}d.append(x)}),d.append(...l),e.append(d)}const st={darken:e=>`color-mix(in srgb, ${e} 60%, black)`,darkenLess:e=>`color-mix(in srgb, ${e} 80%, black)`,lighten:e=>`color-mix(in srgb, ${e} 60%, white)`,lightenLess:e=>`color-mix(in srgb, ${e} 80%, white)`};function lt(e,t){const i=e.path;if(!i)return[];const r=i.w===0?0:e.frame.width*t/i.w,o=i.h===0?0:e.frame.height*t/i.h;return[{d:i.steps.map(s=>s.op==="close"?"Z":s.op==="move"?`M ${String(s.x*r)} ${String(s.y*o)}`:s.op==="line"?`L ${String(s.x*r)} ${String(s.y*o)}`:`C ${String(s.x1*r)} ${String(s.y1*o)} ${String(s.x2*r)} ${String(s.y2*o)} ${String(s.x*r)} ${String(s.y*o)}`).join(" "),fill:"norm",stroke:!0}]}function z(e,t){!t.flip?.h&&!t.flip?.v||(e.style.transform=`scale(${t.flip.h?"-1":"1"}, ${t.flip.v?"-1":"1"})`)}const at=new Set(["rect","roundRect","ellipse"]),j=(e,t,i)=>t===void 0||t===0?colorCss(e,i):`color-mix(in srgb, ${colorCss(e,i)} ${String((1-t)*100)}%, transparent)`,D=(e,t)=>`linear-gradient(${String(e.angle+90)}deg, ${e.stops.map(i=>`${j(i.color,i.transparency,t)} ${String(i.at*100)}%`).join(", ")})`,T=(e,t)=>e.gradient?D(e.gradient,t):e.fill===null||e.fill===void 0?"transparent":j(e.fill,e.fill_transparency,t);let ct=0;function dt(e,t,i,r,o){const n=document.createElementNS(e,"linearGradient");n.id=t;const s=i.angle*Math.PI/180,a=Math.cos(s),c=Math.sin(s),d=(Math.abs(r.width*a)+Math.abs(r.height*c))/Math.max(r.width,r.height,1)/2;n.setAttribute("x1",String(.5-a*d)),n.setAttribute("y1",String(.5-c*d)),n.setAttribute("x2",String(.5+a*d)),n.setAttribute("y2",String(.5+c*d));for(const u of i.stops){const f=document.createElementNS(e,"stop");f.setAttribute("offset",String(u.at)),f.setAttribute("stop-color",colorCss(u.color,o)),u.transparency!==void 0&&f.setAttribute("stop-opacity",String(1-u.transparency)),n.append(f)}return n}function ut(e,t,i,r){const o=t.angle*Math.PI/180,n=t.distance*i;e.style.filter=`drop-shadow(${String(n*Math.cos(o))}px ${String(n*Math.sin(o))}px ${String(t.blur*i)}px ${j(t.color,t.transparency,r)})`}function ft(e,t,i){const r=t.geometry??"rect",o=t.frame.width*i,n=t.frame.height*i;r==="roundRect"?e.style.borderRadius=`${String(Math.min(o,n)*Math.min(.5,Math.max(0,t.adjustments?.[0]??R("roundRect")[0]??0)))}px`:r==="ellipse"&&(e.style.borderRadius="50%")}const gt={left:"borderLeft",right:"borderRight",top:"borderTop",bottom:"borderBottom"},H="http://www.w3.org/2000/svg";function mt(e,t,i,r,o){const n=i.width/w,s=i.height/w,a=r*w,c=I(t,n,s),d=document.createElementNS(H,"svg");d.setAttribute("viewBox",`0 0 ${String(n)} ${String(s)}`),d.setAttribute("width","100%"),d.setAttribute("height","100%"),Object.assign(d.style,{position:"absolute",inset:"0px",overflow:"visible"});const u=(l,m)=>{const g=document.createElementNS(H,l);for(const[b,p]of Object.entries(m))g.setAttribute(b,String(p));d.append(g)},f=l=>{u("path",{d:l.d,fill:l.fill===void 0?"none":colorCss(l.fill,o),stroke:l.width>0?colorCss(l.color,o):"none","stroke-width":l.width,"stroke-linejoin":"round"})};for(const l of[...c.grid,...c.shapes])f(l);for(const l of[...c.boxes,...c.keys])u("rect",{x:l.x,y:l.y,width:l.width,height:l.height,fill:colorCss(l.color,o)});for(const l of[...c.axes,...c.lines])f(l);for(const l of c.dots)u("circle",{cx:l.x,cy:l.y,r:l.r,fill:colorCss(l.color,o)});e.append(d);for(const l of c.words){const m=document.createElement("div");m.textContent=l.text,Object.assign(m.style,{position:"absolute",left:`${String(l.x*a)}px`,top:`${String(l.y*a)}px`,transform:`translate(${{start:"0",middle:"-50%",end:"-100%"}[l.anchor]}, -50%)`,fontSize:`${String(l.size*a)}px`,lineHeight:"1",whiteSpace:"nowrap",color:colorCss(l.color,o),fontFamily:"var(--ak-theme-minor)"}),e.append(m)}}function pt(e,t,i,r,o){const n=document.createElement("table");Object.assign(n.style,{borderCollapse:"collapse",tableLayout:"fixed",width:`${String(t.columns.reduce((a,c)=>a+c,0)*i)}px`});const s=document.createElement("colgroup");for(const a of t.columns){const c=document.createElement("col");c.style.width=`${String(a*i)}px`,s.append(c)}n.append(s);for(const[a,c]of t.rows.entries()){const d=document.createElement("tr");d.style.height=`${String(c.height*i)}px`;for(const[u,f]of c.cells.entries()){if(f.spanned)continue;const l=document.createElement("td");l.dataset.akCell=`${String(a)},${String(u)}`,f.span_width&&(l.colSpan=f.span_width),f.span_height&&(l.rowSpan=f.span_height),l.style.padding="0px",l.style.verticalAlign={t:"top",ctr:"middle",b:"bottom"}[f.text.style.vertical_anchor],f.fill!==void 0&&(l.style.background=colorCss(f.fill,o));for(const[g,b]of Object.entries(gt)){const p=f.borders?.[g];p&&(l.style[b]=`${String(p.width*i)}px solid ${colorCss(p.color,o)}`)}const m=v(f.text,i,r,o);m.style.minHeight="0px",l.append(m),d.append(l)}n.append(d)}e.style.height="auto",e.append(n)}export function drawShape(e,t,i){const{k:r,colors:o}=i;if(t.kind==="placeholder"&&t.text?.empty===!0&&!i.editing)return;const n=document.createElement("div");n.setAttribute(SHAPE_ATTR,`${e}/${t.name}`);const{left:s,top:a,width:c,height:d}=t.frame;Object.assign(n.style,{position:"absolute",left:`${String(s*r)}px`,top:`${String(a*r)}px`,width:`${String(c*r)}px`,height:`${String(d*r)}px`}),t.rotation!==void 0&&(n.style.transform=`rotate(${String(t.rotation)}deg)`);const u=(t.line_width??LINE_WIDTH)*r;if(t.chart)mt(n,t.chart,t.frame,r,o);else if(t.table)return pt(n,t.table,r,i.lang,o),n;t.shadow&&ut(n,t.shadow,r,o),t.alt!==void 0&&n.setAttribute("aria-label",t.alt);let f;if(t.kind==="autoshape"){if(!t.path&&Z(t.geometry))return et(n,t,r,u,o),n;const l=t.path?void 0:C(t.geometry??"rect",t.frame.width*r,t.frame.height*r,t.adjustments),m=t.line!==void 0&&t.line!==null&&t.line_dash!==void 0&&t.line_dash!=="solid",g=t.path?lt(t,r):at.has(t.geometry??"rect")&&!m?void 0:l?.paths;if(g)return rt(n,t,g,r,u,o),t.text&&n.append(v(t.text,r,i.lang,o,l?.text)),n;n.style.background=T(t,o),ft(n,t,r),f=l?.text}else(t.fill!==void 0||t.gradient)&&(n.style.background=T(t,o));if(t.line!==void 0&&t.line!==null&&(n.style.outline=`${String(u)}px ${t.line_dash===void 0||t.line_dash==="solid"?"solid":"dashed"} ${colorCss(t.line,o)}`,n.style.outlineOffset=`${String(-u/2)}px`),t.text?.style.auto_size==="shape"&&(n.style.height="auto",n.style.minHeight="0px"),t.kind==="picture"&&t.media){n.style.overflow="hidden";const l=document.createElement("img");l.alt=t.alt??"",l.src=i.url(t.media.path),z(l,t);const m=t.media.crop??{left:0,top:0,right:0,bottom:0},g=1-m.left-m.right,b=1-m.top-m.bottom;Object.assign(l.style,{position:"absolute",width:`${String(100/g)}%`,height:`${String(100/b)}%`,left:`${String(-m.left/g*100)}%`,top:`${String(-m.top/b*100)}%`,maxWidth:"none"}),t.flip&&(l.style.transformOrigin=`${String(50/g-m.left/g*100)}% ${String(50/b-m.top/b*100)}%`),n.append(l)}else if(t.kind==="movie"&&t.media&&!i.playing&&i.poster!==!0)n.dataset.akFilm="";else if(t.kind==="movie"&&t.media){const l=document.createElement("video");l.src=i.url(t.media.path),l.muted=!0,l.playsInline=!0,l.preload="auto",t.media.poster!==void 0&&(l.currentTime=t.media.poster),Object.assign(l.style,{width:"100%",height:"100%",objectFit:"fill",...i.playing?{}:{pointerEvents:"none"}}),n.append(l)}return t.text&&n.append(v(t.text,r,i.lang,o,f)),n}export function slideBackgroundCss(e,t,i){return e.background_picture!==void 0?`${colorCss(e.background,t)} url(${JSON.stringify(i(e.background_picture))}) center / 100% 100% no-repeat`:e.background_gradient?D(e.background_gradient,t):colorCss(e.background,t)}export function drawSlide(e,t){const i=document.createElement("div");i.dataset.akSlide=e.id,Object.assign(i.style,{position:"absolute",inset:"0px",background:slideBackgroundCss(e,t.colors,t.url),overflow:"hidden"});for(const r of e.shapes){const o=drawShape(e.id,r,t);o&&i.append(o)}return i}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{declareAll as
|
|
2
|
+
import{declareAll as w}from"@allyhub/diagnostics";import{mapShape as k}from"@allyhub/formats";import{resolveMedia as E,resolveSource as x}from"@allyhub/piece";import{consoleLog as S,installConsole as b,locateLayers as v,pickLayer as L}from"@allyhub/piece/page";export function installStage(i,h){b(),w(h);const l=new URL("../",import.meta.url),s=e=>x(e,l),y=new Map(i.flatMap(e=>Object.entries(e.runtimes??{}))),m=i.find(e=>e.code)?.code,u=i.find(e=>e.componentStage)?.componentStage,d=e=>new Error(`No extension the stage was built with lends ${e}.`);let o,a;const p=()=>{const e=document.getElementById("ak-stage");if(!e)throw new Error("The stage page has no #ak-stage element.");return e},f={get output(){return o},async load(e,t){const n=s(e);o?.dispose(),o=void 0;const r=p(),g=n.kind===void 0?void 0:y.get(n.kind);if(!g)throw d(`a runtime for the kind ${n.kind??"(none given)"}`);const c=await g(n,t,r);return await c.ready(),o=c,c.summary()},console:()=>S(),code:(e,t)=>m?m(s(e),t):Promise.reject(d("code")),async component(e,t,n){const r=s(e);if(!u)throw d("a component stage");return a?.module!==r.module&&(a?.stage.dispose(),a={module:r.module,stage:await u(r,t,p())}),a.stage.draw(n)},locate:e=>v(document,k(e,({x:t,y:n})=>({x:t*innerWidth,y:n*innerHeight}))),pick:e=>{const t=L(document,{x:e.x*innerWidth,y:e.y*innerHeight});return t&&{...t,outline:t.outline.map(n=>n.map(r=>({x:r.x/innerWidth,y:r.y/innerHeight})))}},async play(e){const t=document.getElementById("ak-stage");if(!o||!t)throw new Error("Nothing is loaded to play.");if(!o.play)throw new Error(`What the kind ${o.kind} loads does not play.`);return o.play(t,{...e,...e.media?{media:E(e.media,l)}:{}})}};window.allyhub=f}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
2
|
var allyhub=()=>window.allyhub,post=t=>{parent.postMessage({allyhub:!0,...t},"*")},firstLine=t=>String(t instanceof Error?t.message:t).split(`
|
|
3
|
-
`)[0]??"",fail=t=>{post({type:"error",message:firstLine(t)})},asked=t=>t.source===parent&&typeof t.data=="object"&&t.data!==null&&t.data.allyhub===!0,q=new URLSearchParams(location.search),value=t=>{const e=q.get(t);return e===null||e===""?void 0:e},optional=(t,e)=>e===void 0?{}:{[t]:e},number=t=>{const e=value(t),o=e===void 0?void 0:Number(e);return o!==void 0&&Number.isFinite(o)?o:void 0};function comboOf(t){return t===void 0||t==="default"?{}:Object.fromEntries(t.split(",").map(e=>{const o=e.indexOf("=");return[e.slice(0,o),e.slice(o+1)]}))}async function sourceOf(t){const e=encodeURIComponent(encodeURIComponent(t)),o=await fetch(new URL(`../build/sources/${e}.json`,location.href));if(!o.ok)throw new Error(`The piece ${t} is not built here.`);return await o.json()}async function player(t,e,o){const
|
|
3
|
+
`)[0]??"",fail=t=>{post({type:"error",message:firstLine(t)})},asked=t=>t.source===parent&&typeof t.data=="object"&&t.data!==null&&t.data.allyhub===!0,q=new URLSearchParams(location.search),value=t=>{const e=q.get(t);return e===null||e===""?void 0:e},optional=(t,e)=>e===void 0?{}:{[t]:e},number=t=>{const e=value(t),o=e===void 0?void 0:Number(e);return o!==void 0&&Number.isFinite(o)?o:void 0};function comboOf(t){return t===void 0||t==="default"?{}:Object.fromEntries(t.split(",").map(e=>{const o=e.indexOf("=");return[e.slice(0,o),e.slice(o+1)]}))}async function sourceOf(t){const e=encodeURIComponent(encodeURIComponent(t)),o=await fetch(new URL(`../build/sources/${e}.json`,location.href));if(!o.ok)throw new Error(`The piece ${t} is not built here.`);return await o.json()}async function player(t,e,o){const s=await t,p=await allyhub().load(s,e),c=allyhub().output;if(!c)throw new Error("Nothing loaded.");const r={...optional("t",number("t")),...optional("part",value("part")),...optional("offset",number("offset")),...optional("dur",number("dur"))},a={...o,size:s.format},i=Object.keys(a).sort().map(d=>`${d}=${a[d]??""}`).join(","),m={},l=[];addEventListener("message",d=>{if(!asked(d))return;const n=d.data,f=typeof n.type=="string"?c.answer?.({...n,type:n.type}):void 0;if(f){f.then(post,fail);return}if(n.type==="locate"){post({type:"located",id:n.id,layers:allyhub().locate(n.mark)});return}if(n.type==="pick"){const h=allyhub().pick(n.at);post({type:"picked",id:n.id,...h?{picked:h}:{}});return}if(typeof n.type!="string")return;const y={...n,type:n.type};m.control?m.control.command(y):l.push(y)});const u=await allyhub().play({media:s.media,seed:`${s.piece}:${p.kind}:${i}`,at:r,...value("chrome")==="0"?{chrome:!1}:{},post});m.control=u,value("play")==="1"&&u.command({type:"play"});for(const d of l.splice(0))u.command(d)}async function main(t){const e=comboOf(value("combo")),o=value("mode"),s=sourceOf(t),p={combo:e,purpose:o==="component"?"render":"play"};if(o==="code"){const c=s.then(r=>allyhub().code(r,p));c.then(post,fail),addEventListener("message",r=>{if(!asked(r))return;const a=r.data.type;c.then(i=>{a===i.type&&post(i)},fail)});return}if(o==="component"){let c=s.then(()=>{},fail);addEventListener("message",r=>{if(!asked(r)||r.data.type!=="component")return;const a=r.data;c=c.then(()=>s).then(i=>allyhub().component(i,p,{name:String(a.name),props:a.props??{},width:Number(a.width),height:Number(a.height),t:Number(a.t)})).then(i=>{post({type:"component-ready",component:i})},fail)});return}await player(s,p,e)}var piece=value("piece");piece!==void 0&&main(piece).catch(t=>{const e=firstLine(t);document.body.style.cssText="margin:0;padding:16px;background:#141210;color:#fc9cbd;font:14px/1.5 system-ui,sans-serif",document.body.textContent=e,post({type:"error",message:e})});
|